From 8c10eb7086cb61712747b96dae712526d90e5269 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 06 三月 2023 15:45:31 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/service/show/DataLibService.java     |    4 +-
 src/main/java/com/lf/server/mapper/sys/AttachMapper.java         |    4 +-
 src/main/java/com/lf/server/service/sys/AttachService.java       |    4 +-
 src/main/java/com/lf/server/helper/Zip4jHelper.java              |   19 +++++----
 src/main/java/com/lf/server/service/all/UploadAttachService.java |    6 +-
 data/db_cx.sql                                                   |    5 +-
 src/main/java/com/lf/server/controller/sys/ResController.java    |   23 ++++++-----
 src/main/java/com/lf/server/service/show/PipelineService.java    |    2 
 src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java   |   20 ++++++++++
 src/main/java/com/lf/server/service/data/DownloadService.java    |    2 
 10 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/data/db_cx.sql b/data/db_cx.sql
index f32338d..296d457 100644
--- a/data/db_cx.sql
+++ b/data/db_cx.sql
@@ -9,8 +9,9 @@
 select * from lf.sys_attach where tab='lf.sys_style';
 select * from lf.sys_attach order by tab,tab_guid;
 
-
-
+select * from bs.s_survey_information 鍕樺療淇℃伅琛�
+select * from bs.s_surveyworksite 鍕樺療宸ョ偣
+select * from lf.sys_download order by id desc;
 
 
 
diff --git a/src/main/java/com/lf/server/controller/sys/ResController.java b/src/main/java/com/lf/server/controller/sys/ResController.java
index 47b4970..c9c0ae9 100644
--- a/src/main/java/com/lf/server/controller/sys/ResController.java
+++ b/src/main/java/com/lf/server/controller/sys/ResController.java
@@ -3,6 +3,7 @@
 import com.lf.server.annotation.SysLog;
 import com.lf.server.controller.all.BaseController;
 import com.lf.server.entity.all.ResponseMsg;
+import com.lf.server.entity.ctrl.DownloadReqEntity;
 import com.lf.server.entity.sys.ResEntity;
 import com.lf.server.entity.sys.UserEntity;
 import com.lf.server.helper.StringHelper;
@@ -321,17 +322,17 @@
             @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c")
     })
     @ResponseBody
-    @PostMapping(value = "/downloadReq")
-    public ResponseMsg<Object> downloadReqForGuids(String[] guids, HttpServletRequest req, HttpServletResponse res) {
+    @PostMapping(value = "/downloadReqForGuids")
+    public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
         try {
-            if (null == guids || guids.length == 0) {
+            if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) {
                 return fail("Guid鏁扮粍涓虹┖");
             }
 
             UserEntity ue = tokenService.getCurrentUser(req);
-            String guid = uploadAttachService.downloadReqForGuids(ue, guids);
+            String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids());
 
-            return success("");
+            return success(guid);
         } catch (Exception ex) {
             return fail(ex, null);
         }
@@ -344,18 +345,18 @@
             @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "08e5b4ad-93b8-46f6-adaa-46a6274af4ce,6f94f4f8-6e8d-44e7-8803-3d068d34983f")
     })
     @ResponseBody
-    @PostMapping(value = "/downloadReq")
-    public ResponseMsg<Object> downloadReqForTabGuids(String tab, String[] guids, HttpServletRequest req, HttpServletResponse res) {
+    @PostMapping(value = "/downloadReqForTabGuids")
+    public ResponseMsg<Object> downloadReqForTabGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
         try {
-            if (StringHelper.isEmpty(tab)) {
+            if (null == dre || StringHelper.isEmpty(dre.getTab())) {
                 return fail("琛ㄥ悕涓虹┖");
             }
-            if (null != guids && guids.length == 0) {
-                guids = null;
+            if (null != dre.getGuids() && dre.getGuids().size() == 0) {
+                dre.setIds(null);
             }
 
             UserEntity ue = tokenService.getCurrentUser(req);
-            String guid = uploadAttachService.downloadReqForTabGuids(ue, tab, guids);
+            String guid = uploadAttachService.downloadReqForTabGuids(ue, dre.getTab(), dre.getGuids());
 
             return success(guid);
         } catch (Exception ex) {
diff --git a/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java b/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java
index f2471d5..19a76e2 100644
--- a/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java
+++ b/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java
@@ -14,11 +14,15 @@
 
     private String guid;
 
+    private List<String> guids;
+
     private List<Integer> ids;
 
     private String wkt;
 
     private List<String> entities;
+
+    private String tab;
 
     private List<String> tabs;
 
@@ -49,6 +53,14 @@
         this.guid = guid;
     }
 
+    public List<String> getGuids() {
+        return guids;
+    }
+
+    public void setGuids(List<String> guids) {
+        this.guids = guids;
+    }
+
     public List<Integer> getIds() {
         return ids;
     }
@@ -65,6 +77,14 @@
         this.wkt = wkt;
     }
 
+    public String getTab() {
+        return tab;
+    }
+
+    public void setTab(String tab) {
+        this.tab = tab;
+    }
+
     public List<String> getTabs() {
         return tabs;
     }
diff --git a/src/main/java/com/lf/server/helper/Zip4jHelper.java b/src/main/java/com/lf/server/helper/Zip4jHelper.java
index 0a388c7..f9ed14b 100644
--- a/src/main/java/com/lf/server/helper/Zip4jHelper.java
+++ b/src/main/java/com/lf/server/helper/Zip4jHelper.java
@@ -41,7 +41,7 @@
                 f.delete();
             }
 
-            ZipParameters params = getZipParams();
+            ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd));
 
             // 瑕佹墦鍖呯殑鏂囦欢鎴栨枃浠跺す
             File currentFile = new File(sourcePath);
@@ -84,19 +84,22 @@
     /**
      * 鑾峰彇ZipParameters
      */
-    public static ZipParameters getZipParams() {
+    public static ZipParameters getZipParams(boolean flag) {
         // 璁剧疆鍘嬬缉鏂囦欢鍙傛暟
         ZipParameters params = new ZipParameters();
         // 鍘嬬缉鏂瑰紡
         params.setCompressionMethod(CompressionMethod.DEFLATE);
         // 鍘嬬缉绾у埆
         params.setCompressionLevel(CompressionLevel.MAXIMUM);
-        // 鏄惁璁剧疆鍔犲瘑鏂囦欢
-        params.setEncryptFiles(true);
-        // 璁剧疆AES鍔犲瘑寮哄害锛欿EY_STRENGTH_256
-        params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128);
-        // 璁剧疆鍔犲瘑绠楁硶
-        params.setEncryptionMethod(EncryptionMethod.AES);
+
+        if (flag) {
+            // 鏄惁璁剧疆鍔犲瘑鏂囦欢
+            params.setEncryptFiles(true);
+            // 璁剧疆AES鍔犲瘑寮哄害锛欿EY_STRENGTH_256
+            params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128);
+            // 璁剧疆鍔犲瘑绠楁硶
+            params.setEncryptionMethod(EncryptionMethod.AES);
+        }
 
         return params;
     }
diff --git a/src/main/java/com/lf/server/mapper/sys/AttachMapper.java b/src/main/java/com/lf/server/mapper/sys/AttachMapper.java
index 88c2ea5..c8598fb 100644
--- a/src/main/java/com/lf/server/mapper/sys/AttachMapper.java
+++ b/src/main/java/com/lf/server/mapper/sys/AttachMapper.java
@@ -60,7 +60,7 @@
      * @param guids
      * @return
      */
-    public List<AttachEntity> selectByGuids(String[] guids);
+    public List<AttachEntity> selectByGuids(List<String> guids);
 
     /**
      * 鏍规嵁琛ㄥ悕鍜孏UID鏌ヨ
@@ -79,7 +79,7 @@
      * @param guids
      * @return
      */
-    public List<AttachEntity> selectByTabGuids(String tab, String[] guids);
+    public List<AttachEntity> selectByTabGuids(String tab, List<String> guids);
 
     /**
      * 鏍规嵁琛ㄥ拰GUID鏌ヨ
diff --git a/src/main/java/com/lf/server/service/all/UploadAttachService.java b/src/main/java/com/lf/server/service/all/UploadAttachService.java
index 53cb4b3..84de858 100644
--- a/src/main/java/com/lf/server/service/all/UploadAttachService.java
+++ b/src/main/java/com/lf/server/service/all/UploadAttachService.java
@@ -413,7 +413,7 @@
     /**
      * 璇锋眰涓嬭浇
      */
-    public String downloadReqForGuids(UserEntity ue, String[] guids) {
+    public String downloadReqForGuids(UserEntity ue, List<String> guids) {
         List<AttachEntity> list = attachService.selectByGuids(guids);
 
         return downloadReq(ue, list);
@@ -422,7 +422,7 @@
     /**
      * 璇锋眰涓嬭浇
      */
-    public String downloadReqForTabGuids(UserEntity ue, String tab, String[] guids) {
+    public String downloadReqForTabGuids(UserEntity ue, String tab, List<String> guids) {
         List<AttachEntity> list = attachService.selectByTabGuids(tab, guids);
 
         return downloadReq(ue, list);
@@ -440,7 +440,7 @@
         String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
 
         ZipFile zip = Zip4jHelper.createZipFile(zipFile, null);
-        ZipParameters params = Zip4jHelper.getZipParams();
+        ZipParameters params = Zip4jHelper.getZipParams(false);
         addZipFiles(zip, params, list);
 
         DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, null);
diff --git a/src/main/java/com/lf/server/service/data/DownloadService.java b/src/main/java/com/lf/server/service/data/DownloadService.java
index 86fe8e1..6d35529 100644
--- a/src/main/java/com/lf/server/service/data/DownloadService.java
+++ b/src/main/java/com/lf/server/service/data/DownloadService.java
@@ -198,7 +198,7 @@
         String zipFile = downloadPath + File.separator + zipName;
 
         ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
-        ZipParameters params = Zip4jHelper.getZipParams();
+        ZipParameters params = Zip4jHelper.getZipParams(true);
         addMetaFiles(zip, params, list);
 
         String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
diff --git a/src/main/java/com/lf/server/service/show/DataLibService.java b/src/main/java/com/lf/server/service/show/DataLibService.java
index 81cf020..89b1d58 100644
--- a/src/main/java/com/lf/server/service/show/DataLibService.java
+++ b/src/main/java/com/lf/server/service/show/DataLibService.java
@@ -112,7 +112,7 @@
         String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
 
         ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
-        ZipParameters params = Zip4jHelper.getZipParams();
+        ZipParameters params = Zip4jHelper.getZipParams(true);
         addZipFiles(zip, params, file.listFiles());
 
         String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
@@ -266,7 +266,7 @@
         String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
 
         ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
-        ZipParameters params = Zip4jHelper.getZipParams();
+        ZipParameters params = Zip4jHelper.getZipParams(true);
         addZipFiles(zip, params, file.listFiles());
 
         String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
diff --git a/src/main/java/com/lf/server/service/show/PipelineService.java b/src/main/java/com/lf/server/service/show/PipelineService.java
index d7836a1..aee0704 100644
--- a/src/main/java/com/lf/server/service/show/PipelineService.java
+++ b/src/main/java/com/lf/server/service/show/PipelineService.java
@@ -80,7 +80,7 @@
         String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
 
         ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
-        ZipParameters params = Zip4jHelper.getZipParams();
+        ZipParameters params = Zip4jHelper.getZipParams(true);
         addZipFiles(zip, params, file.listFiles());
 
         String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
diff --git a/src/main/java/com/lf/server/service/sys/AttachService.java b/src/main/java/com/lf/server/service/sys/AttachService.java
index b7c2994..3387605 100644
--- a/src/main/java/com/lf/server/service/sys/AttachService.java
+++ b/src/main/java/com/lf/server/service/sys/AttachService.java
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public List<AttachEntity> selectByGuids(String[] guids) {
+    public List<AttachEntity> selectByGuids(List<String> guids) {
         return attachMapper.selectByGuids(guids);
     }
 
@@ -57,7 +57,7 @@
     }
 
     @Override
-    public List<AttachEntity> selectByTabGuids(String tab, String[] guids) {
+    public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) {
         return attachMapper.selectByTabGuids(tab, guids);
     }
 

--
Gitblit v1.9.3