|
@@ -25,13 +25,21 @@ import com.jsh.erp.datasource.vo.TaskStocktakingVO;
|
|
|
import com.jsh.erp.datasource.vo.TreeNode;
|
|
|
import com.jsh.erp.query.LambdaQueryWrapperX;
|
|
|
import com.jsh.erp.service.*;
|
|
|
+import com.jsh.erp.utils.FileUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -67,6 +75,9 @@ public class PdaController extends BaseController {
|
|
|
@Resource
|
|
|
private MaterialExtendService materialExtendService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ApkVersionService apkVersionService;
|
|
|
+
|
|
|
/**
|
|
|
* 采购入库
|
|
|
* @return
|
|
@@ -177,7 +188,6 @@ public class PdaController extends BaseController {
|
|
|
@ApiOperation("开始任务")
|
|
|
@GetMapping("/startTask/{id}")
|
|
|
public AjaxResult startTask(@PathVariable("id") Long id){
|
|
|
-
|
|
|
taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>()
|
|
|
.set("task_status", 2)
|
|
|
.eq("id", id));
|
|
@@ -233,7 +243,6 @@ public class PdaController extends BaseController {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@ApiOperation("负责人下拉列表")
|
|
|
@GetMapping("/creatorSpinnerList/{taskId}")
|
|
|
public AjaxResult creatorSpinnerList(@PathVariable("taskId") Long taskId) {
|
|
@@ -289,4 +298,48 @@ public class PdaController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @ApiOperation("下载安装包")
|
|
|
+ @PostMapping("/downloadApk")
|
|
|
+ public void downloadApk(@RequestBody ApkVersion apkVersion, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
+ // 将文件路径转换为 Path 对象
|
|
|
+ Path path = Paths.get(apkVersion.getUrl()).toAbsolutePath().normalize();
|
|
|
+ File file = path.toFile();
|
|
|
+ String fileUrl = apkVersion.getUrl();
|
|
|
+ // 检查文件是否存在
|
|
|
+ if (!file.exists() || !file.isFile()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ InputStream inputStream = null;
|
|
|
+ OutputStream outputStream = null;
|
|
|
+ inputStream = new BufferedInputStream(new FileInputStream(fileUrl));
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ byte[] buf = new byte[1024];
|
|
|
+ int len;
|
|
|
+ while ((len = inputStream.read(buf)) > 0) {
|
|
|
+ outputStream.write(buf, 0, len);
|
|
|
+ }
|
|
|
+ response.flushBuffer();
|
|
|
+ if (inputStream != null) {
|
|
|
+ try {
|
|
|
+ inputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询版本信息")
|
|
|
+ @GetMapping("selectVersion")
|
|
|
+ public AjaxResult selectVersion() {
|
|
|
+ ApkVersion apkVersion = apkVersionService.getOne(new LambdaQueryWrapperX<ApkVersion>().orderByDesc(ApkVersion::getId).last("limit 1"));
|
|
|
+ return AjaxResult.success(apkVersion);
|
|
|
+ }
|
|
|
+
|
|
|
}
|