xiexiang 1 年之前
父節點
當前提交
fa86a2e352

+ 17 - 17
src/main/java/com/example/fms/controller/FileMangerController.java

@@ -49,9 +49,9 @@ public class FileMangerController {
     @Operation(summary = "上传普通文件")
     public String uploadNormalFile(@RequestBody List<MultipartFile> files, Integer sourceId) throws IOException {
         if(files != null && files.size() != 0){
-            List<Integer> insertIds = fileManagerService.uploadFile(files, sourceId);
-            if(insertIds != null && insertIds.size() != 0){
-                return Response.success("上传文件成功,文件信息id为" + insertIds);
+            List<String> GUIDs = fileManagerService.uploadFile(files, sourceId);
+            if(GUIDs != null && GUIDs.size() != 0){
+                return Response.success(GUIDs);
             } else {
                 return Response.error("文件信息入表失败");
             }
@@ -60,20 +60,20 @@ public class FileMangerController {
         }
     }
 
-    @PostMapping("/uploadPatentFile")
-    @Operation(summary = "上传专利文件")
-    public String uploadPatentFile(@RequestBody List<MultipartFile> files, Integer sourceId) throws IOException {
-        if(files != null && files.size() != 0){
-            List<Integer> insertIds = fileManagerService.uploadFile(files, sourceId);
-            if(insertIds != null && insertIds.size() != 0){
-                return Response.success("上传文件成功,文件信息id为" + insertIds);
-            } else {
-                return Response.error("文件信息入表失败");
-            }
-        } else {
-            return Response.error("上传文件不能为空");
-        }
-    }
+//    @PostMapping("/uploadPatentFile")
+//    @Operation(summary = "上传专利文件")
+//    public String uploadPatentFile(@RequestBody List<MultipartFile> files, Integer sourceId) throws IOException {
+//        if(files != null && files.size() != 0){
+//            List<String> GUIDs = fileManagerService.uploadFile(files, sourceId);
+//            if(GUIDs != null && GUIDs.size() != 0){
+//                return Response.success("上传文件成功,文件信息id为" + GUIDs);
+//            } else {
+//                return Response.error("文件信息入表失败");
+//            }
+//        } else {
+//            return Response.error("上传文件不能为空");
+//        }
+//    }
 
 //    @GetMapping("/downloadSystemFile")
 //    @Operation(summary = "取出文件")

+ 3 - 3
src/main/java/com/example/fms/service/FileMangerService.java

@@ -40,7 +40,7 @@ public class FileMangerService {
      * @return insertIds 文件在数据库中的id集合
      * @throws IOException
      */
-    public List<Integer> uploadFile(List<MultipartFile> files, Integer sourceId) throws IOException {
+    public List<String> uploadFile(List<MultipartFile> files, Integer sourceId) throws IOException {
         if (files != null && files.size() != 0) {
             //1.调用解析配置方法,获取配置信息
             List<ConfigSettingVO> configSettingVOS = ExcuteConfigUtils.excuteConfigVO();
@@ -53,8 +53,8 @@ public class FileMangerService {
             List<SystemFileDTO> systemFileDTOS = fileFactoryObject.uploadFile(files, configSettingVO);
             //4.根据上传后的返回实体类信息,将实体类信息入库,调用systemFileService add
             if (systemFileDTOS != null && systemFileDTOS.size() != 0) {
-                List<Integer> insertIds = systemFileService.add(systemFileDTOS, sourceId);
-                return insertIds;
+                List<String> GUIDs = systemFileService.add(systemFileDTOS, sourceId);
+                return GUIDs;
             } else {
                 throw new XiaoShiException("入表信息为空");
             }

+ 4 - 4
src/main/java/com/example/fms/service/SystemFileService.java

@@ -35,10 +35,10 @@ public class SystemFileService extends ServiceImpl<SystemFileMapper, SystemFile>
      *
      * @param systemFileDTOS
      */
-    public List<Integer> add(List<SystemFileDTO> systemFileDTOS, Integer sourceId) {
+    public List<String> add(List<SystemFileDTO> systemFileDTOS, Integer sourceId) {
         //判断传入列表不为空
         if (systemFileDTOS != null && systemFileDTOS.size() > 0) {
-            List<Integer> insertIds = new ArrayList<>();
+            List<String> GUIDs = new ArrayList<>();
             //遍历传入列表
             for (int i = 0; i < systemFileDTOS.size(); i++) {
                 SystemFile systemFile = new SystemFile();
@@ -55,9 +55,9 @@ public class SystemFileService extends ServiceImpl<SystemFileMapper, SystemFile>
                 systemFile.setPType(sourceId);
                 //插入数据
                 systemFile.insert();
-                insertIds.add(systemFile.getId());
+                GUIDs.add(systemFile.getGUID());
             }
-            return insertIds;
+            return GUIDs;
         } else {
             throw new XiaoShiException("传入数据不能为空");
         }