From c509bd8047cfd582c59bba66d148b236e45d038d Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 12 一月 2023 10:15:15 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/service/data/DownloadService.java |   45 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 34 insertions(+), 11 deletions(-)

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 25dcae7..685ddb2 100644
--- a/src/main/java/com/lf/server/service/data/DownloadService.java
+++ b/src/main/java/com/lf/server/service/data/DownloadService.java
@@ -2,7 +2,8 @@
 
 import com.lf.server.entity.ctrl.DownloadReqEntity;
 import com.lf.server.entity.data.DownloadEntity;
-import com.lf.server.entity.data.MetaFileEntity;
+import com.lf.server.entity.data.MetaEntity;
+import com.lf.server.entity.show.PipelineEntity;
 import com.lf.server.entity.sys.UserEntity;
 import com.lf.server.helper.*;
 import com.lf.server.mapper.data.DownloadMapper;
@@ -117,15 +118,15 @@
     }
 
     /**
-     * 鏍¢獙瀵嗙爜鏈夋晥鎬�
+     * 瑙e瘑
      *
      * @param reqEntity 璇锋眰涓嬭浇瀹炰綋绫�
-     * @return 鏄�/鍚︽湁鏁�
+     * @return 鏄�/鍚﹁В瀵嗘垚鍔�
      */
-    public boolean validatePwd(DownloadReqEntity reqEntity) {
+    public static boolean decryptPwd(DownloadReqEntity reqEntity) {
         try {
             String pwd = RsaHelper.decrypt(reqEntity.getPwd());
-            if (StringHelper.isEmpty(pwd) || !StringHelper.checkPwdValid(pwd)) {
+            if (StringHelper.isEmpty(pwd)) {
                 return false;
             }
 
@@ -141,10 +142,32 @@
     /**
      * 瑙e瘑
      *
+     * @param pe 绠¢亾鍒嗘瀽瀹炰綋绫�
+     * @return 鏄�/鍚﹁В瀵嗘垚鍔�
+     */
+    public static boolean decryptPwd(PipelineEntity pe) {
+        try {
+            String pwd = RsaHelper.decrypt(pe.getPwd());
+            if (StringHelper.isEmpty(pwd)) {
+                return false;
+            }
+
+            pe.setPwd(pwd);
+
+            return true;
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            return false;
+        }
+    }
+
+    /**
+     * 瑙e瘑
+     *
      * @param pwd 鍔犲瘑瀵嗙爜
      * @return 鍘熷瀵嗙爜
      */
-    public String decryptPwd(String pwd) {
+    public static String decryptPwd(String pwd) {
         try {
             return RsaHelper.decrypt(pwd);
         } catch (Exception ex) {
@@ -161,7 +184,7 @@
      * @param pwd  瀵嗙爜
      * @return 涓嬭浇鏂囦欢GUID
      */
-    public String zipFiles(UserEntity ue, List<MetaFileEntity> list, String pwd) throws Exception {
+    public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception {
         rmRepeatMetaFiles(list);
 
         String downloadPath = pathHelper.getDownloadFullPath();
@@ -182,12 +205,12 @@
     /**
      * 绉婚櫎閲嶅鐨勫厓鏁版嵁鏂囦欢
      */
-    private void rmRepeatMetaFiles(List<MetaFileEntity> list) {
+    private void rmRepeatMetaFiles(List<MetaEntity> list) {
         List<String> guidList = new ArrayList<>();
 
         int i = 0;
         while (i < list.size()) {
-            MetaFileEntity entity = list.get(i);
+            MetaEntity entity = list.get(i);
             if (guidList.contains(entity.getGuid())) {
                 list.remove(i);
                 continue;
@@ -201,11 +224,11 @@
     /**
      * 娣诲姞鍏冩暟鎹枃浠惰嚦Zip鍖�
      */
-    private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaFileEntity> list) {
+    private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) {
         String uploadPath = pathHelper.getConfig().getUploadPath();
 
         int i = 1;
-        for (MetaFileEntity entity : list) {
+        for (MetaEntity entity : list) {
             try {
                 File file = new File(uploadPath + File.separator + entity.getPath());
                 zip.addFile(file, params);

--
Gitblit v1.9.3