|
@@ -4,19 +4,24 @@ package com.jsh.erp.controller.apkVersion;
|
|
|
import com.jsh.erp.base.AjaxResult;
|
|
|
import com.jsh.erp.base.BaseController;
|
|
|
import com.jsh.erp.base.TableDataInfo;
|
|
|
-import com.jsh.erp.datasource.dto.TaskStocktakingDTO;
|
|
|
-import com.jsh.erp.datasource.dto.TaskStocktakingQueryDTO;
|
|
|
import com.jsh.erp.datasource.entities.ApkVersion;
|
|
|
-import com.jsh.erp.datasource.vo.TaskStocktakingVO;
|
|
|
import com.jsh.erp.service.ApkVersionService;
|
|
|
+import com.jsh.erp.service.SystemConfigService;
|
|
|
+import com.jsh.erp.utils.BaseResponseInfo;
|
|
|
+import com.jsh.erp.utils.StringUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -28,6 +33,12 @@ public class apkVersionController extends BaseController {
|
|
|
@Resource
|
|
|
private ApkVersionService apkVersionService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private SystemConfigService systemConfigService;
|
|
|
+
|
|
|
+ @Value(value="${file.path}")
|
|
|
+ private String filePath;
|
|
|
+
|
|
|
@ApiOperation("apk版本列表")
|
|
|
@PostMapping("/list")
|
|
|
public TableDataInfo list(){
|
|
@@ -47,4 +58,40 @@ public class apkVersionController extends BaseController {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * apk文件上传方法
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/upload")
|
|
|
+ @ApiOperation(value = "apk文件上传方法")
|
|
|
+ public BaseResponseInfo upload(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ BaseResponseInfo res = new BaseResponseInfo();
|
|
|
+ try {
|
|
|
+ String savePath = "";
|
|
|
+ String bizPath = request.getParameter("biz");
|
|
|
+ if ("bill".equals(bizPath) || "financial".equals(bizPath) || "material".equals(bizPath)) {
|
|
|
+ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
+ MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
|
|
+ savePath = systemConfigService.uploadLocal(file, bizPath, request);
|
|
|
+ if(StringUtil.isNotEmpty(savePath)){
|
|
|
+ res.code = 200;
|
|
|
+ res.data = filePath + "/" +savePath;
|
|
|
+ }else {
|
|
|
+ res.code = 500;
|
|
|
+ res.data = "上传失败!";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res.code = 505;
|
|
|
+ res.data = "文件分类错误!";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+ res.code = 500;
|
|
|
+ res.data = "上传失败!";
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|