ApplicationUpdateController.java
2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.ruoyi.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.global.Result;
import com.ruoyi.pojo.request.HeartPackageVo;
import com.ruoyi.service.AppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 管理应用更新
*
* @author 20412
*/
@RestController
@Api(tags = "管理应用更新")
@RequestMapping("/app")
public class ApplicationUpdateController {
@Resource
private AppService appService;
/**
* 校验版本号
*/
@GetMapping("/version/check/{currentVersion}")
@ApiOperation("校验版本号")
public AjaxResult checkVersionNum(@PathVariable("currentVersion") Integer currentVersion, @RequestParam(value = "deviceId", required = false) String deviceId) {
return AjaxResult.success(appService.checkVersionNum(currentVersion,deviceId));
}
/**
* 下载最新apk 弃用
*/
@Deprecated
@PostMapping("/download")
// @ApiOperation("下载最新apk")
public void downloadApk(String apkUrl, HttpServletResponse response) {
try {
appService.downloadApk(apkUrl, response);
} catch (IOException e) {
throw new RuntimeException("下载失败,请联系管理员处理,失败原因 :" + e.getMessage());
}
}
@PostMapping("/uploadApk")
@ApiOperation("上传apk文件")
public AjaxResult uploadApk(MultipartFile file) {
try {
return appService.uploadApk(file);
} catch (Exception e) {
return AjaxResult.error("上传失败,请重试,再次失败请联系管理员,失败原因:" + e.getMessage());
}
}
@PostMapping("/uploadApk/other")
@ApiOperation("上传apk文件")
public AjaxResult uploadApkOther(MultipartFile file) {
try {
return appService.uploadApkOther(file);
} catch (Exception e) {
return AjaxResult.error("上传失败,请重试,再次失败请联系管理员,失败原因:" + e.getMessage());
}
}
@GetMapping("/checkDeviceHeart")
@ApiOperation("设备心跳检测")
public Result<?> checkAppHeart(@Validated @ApiParam @ModelAttribute HeartPackageVo vo) {
appService.checkAppHeart(vo);
return Result.OK();
}
}