From 0e6155e184b2871978e9a6b358601cabe462876b Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 24 三月 2023 18:47:32 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/data/upload/UploadController.java |   43 +++++++++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/data/upload/UploadController.java b/src/main/java/com/lf/server/controller/data/upload/UploadController.java
index cc96e06..c125dd0 100644
--- a/src/main/java/com/lf/server/controller/data/upload/UploadController.java
+++ b/src/main/java/com/lf/server/controller/data/upload/UploadController.java
@@ -2,7 +2,7 @@
 
 import com.lf.server.annotation.SysLog;
 import com.lf.server.entity.all.ResponseMsg;
-import com.lf.server.entity.all.StaticData;
+import com.lf.server.entity.ctrl.KeyValueEntity;
 import com.lf.server.entity.data.DirEntity;
 import com.lf.server.entity.data.MetaEntity;
 import com.lf.server.entity.data.MetaFileEntity;
@@ -33,6 +33,9 @@
     @Autowired
     UploadService uploadService;
 
+    @Autowired
+    UploadAttachService uploadAttachService;
+
     @SysLog()
     @ApiOperation(value = "鏌ヨ璺緞")
     @GetMapping(value = "/selectPath")
@@ -42,7 +45,8 @@
 
             return success(pathName);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            log.error(ex.getMessage(), ex);
+            return fail(ex, null);
         }
     }
 
@@ -55,14 +59,16 @@
     @PostMapping(value = "/uploadFiles")
     public ResponseMsg<Object> uploadFiles(String path, HttpServletRequest req, HttpServletResponse res) {
         try {
-            List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res);
+            List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res);
             if (null == list || list.isEmpty()) {
                 return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null);
             }
 
+            uploadService.copePath(list);
+
             return success(list);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -76,12 +82,16 @@
     @ApiOperation(value = "涓婁紶Excel闄勪欢")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "ids", value = "鍏冩暟鎹泦鍚�", dataType = "Integer", paramType = "query")
+            @ApiImplicitParam(name = "ids", value = "鍏冩暟鎹泦鍚�", dataType = "Integer", allowMultiple = true, paramType = "query")
     })
     @ResponseBody
     @PostMapping(value = "/uploadXlsAnnex")
     public ResponseMsg<Object> uploadXlsAnnex(String path, Integer[] ids, HttpServletRequest req, HttpServletResponse res) {
         try {
+            UserEntity ue = tokenService.getCurrentUser(req);
+            if (ue == null) {
+                return fail("鐢ㄦ埛鏈櫥褰�", null);
+            }
             if (null == ids || ids.length == 0) {
                 return fail("鎵句笉鍒板厓鏁版嵁鐨処D闆嗗悎");
             }
@@ -91,14 +101,19 @@
                 return fail("鎵句笉鍒拌涓婁紶闄勪欢鐨勫厓鏁版嵁");
             }
 
-            List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res);
+            List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res);
             if (null == list || list.isEmpty()) {
                 return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null);
             }
 
-            return success(list);
+            List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path);
+            if (null == rs || rs.size() == 0) {
+                return fail("娌℃湁瑕佹洿鏂扮殑鍏冩暟鎹�");
+            }
+
+            return success(rs);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -110,11 +125,11 @@
     @GetMapping(value = "/selectFiles")
     public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) {
         try {
-            List<MetaFileEntity> list = uploadService.selectFiles(path, StaticData.ALL_EXTENSION);
+            List<MetaFileEntity> list = uploadService.selectFiles(path);
 
             return success(list);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -139,7 +154,7 @@
 
             return success("鎴愬姛", rows);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -174,7 +189,7 @@
 
             return success(list);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -199,7 +214,7 @@
 
             return success("鎴愬姛", list);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), null);
+            return fail(ex, null);
         }
     }
 
@@ -219,7 +234,7 @@
 
             return success(count);
         } catch (Exception ex) {
-            return fail(ex.getMessage(), -1);
+            return fail(ex, -1);
         }
     }
 }

--
Gitblit v1.9.3