Browse Source

文件上传

huxy 2 years ago
parent
commit
d80f78fb62

+ 8 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.jeecg.common.system.api.ISysBaseAPI;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
 import org.apache.shiro.SecurityUtils;
@@ -31,6 +32,7 @@ import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
 import org.jeecg.modules.splfi.vo.SyPackingListFabricVo;
 import org.jeecg.modules.splt.entity.SyPackingListTailoring;
 import org.jeecg.modules.splt.entity.SyPackingListTailoringItem;
+import org.jeecg.modules.system.controller.CommonController;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -633,11 +635,15 @@ public class SyPackingListFabricController {
 		 }
 	 }
 
+	 @Autowired
+	 CommonController commonController;
+
 	 @AutoLog(value = "附件上传")
 	 @ApiOperation(value="附件上传", notes="附件上传")
 	 @RequestMapping(value = "/upload")
-	 public Result upload(String id,String fileName){
-		Result result=new Result();
+	 public Result upload(HttpServletRequest request, HttpServletResponse response,String id){
+	 	String fileName=commonController.upload(request,response).getMessage();
+	 	Result result=new Result();
 		if(oConvertUtils.isEmpty(id)){
 			result.setMessage("id为空");
 			return result;
@@ -653,7 +659,6 @@ public class SyPackingListFabricController {
 			result.setMessage("上传成功");
 		}else{
 			result.setMessage("数据库未找到该数据");
-			return result;
 		}
 		return result;
 	 }

+ 6 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -36,6 +36,7 @@ import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListService;
 import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListVo;
 import org.jeecg.modules.splfi.entity.SyPackingListFabric;
 import org.jeecg.modules.splt.vo.SyPackingListTailoringVo;
+import org.jeecg.modules.system.controller.CommonController;
 import org.jeecg.modules.system.entity.SysPermission;
 import org.jeecg.modules.system.service.impl.SysPermissionServiceImpl;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -862,10 +863,14 @@ public class SyPackingListTailoringController {
 		return result;
 	 }
 
+	 @Autowired
+	 CommonController commonController;
+
 	 @AutoLog(value = "附件上传")
 	 @ApiOperation(value="附件上传", notes="附件上传")
 	 @RequestMapping(value = "/upload")
-	 public Result upload(String id,String fileName){
+	 public Result upload(HttpServletRequest request, HttpServletResponse response,String id){
+		 String fileName=commonController.upload(request,response).getMessage();
 		 Result result=new Result();
 		 if(oConvertUtils.isEmpty(id)){
 			 result.setMessage("id为空");
@@ -882,7 +887,6 @@ public class SyPackingListTailoringController {
 			 result.setMessage("上传成功");
 		 }else{
 			 result.setMessage("数据库未找到该数据");
-			 return result;
 		 }
 		 return result;
 	 }