From b69e86316f5a8802a8cc2ff552bc798b4c27aba4 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 06 十二月 2022 09:39:59 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/data/MetaController.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/data/MetaController.java b/src/main/java/com/lf/server/controller/data/MetaController.java
index b180760..8d2e07f 100644
--- a/src/main/java/com/lf/server/controller/data/MetaController.java
+++ b/src/main/java/com/lf/server/controller/data/MetaController.java
@@ -22,6 +22,8 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 /**
@@ -40,6 +42,8 @@
 
     @Autowired
     DownloadService downloadService;
+
+    private final static String EQ = "=";
 
     @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
@@ -275,13 +279,22 @@
             if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) {
                 return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢");
             }
-            if (!downloadService.validatePwd(reqEntity)) {
+            if (!downloadService.decryptPwd(reqEntity)) {
+                return fail("瀵嗙爜瑙e瘑澶辫触", null);
+            }
+            if (!StringHelper.checkPwdValid(reqEntity.getPwd())) {
                 return fail("瀵嗙爜涓嶇鍚堣姹�");
             }
 
             List<MetaFileEntity> list = metaService.selectMetaFiles(reqEntity.getIds());
+            if (null == list || list.isEmpty()) {
+                return fail("娌℃湁鎵惧埌鍏冩暟鎹�");
+            }
 
-            return success(true);
+            UserEntity ue = tokenService.getCurrentUser(req);
+            String guid = downloadService.zipFiles(ue, list, reqEntity.getPwd());
+
+            return success(guid);
         } catch (Exception ex) {
             return fail(ex.getMessage(), null);
         }
@@ -299,6 +312,10 @@
             if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                 return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null);
             }
+            if (!pwd.endsWith(EQ)) {
+                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
+            }
+
             String password = downloadService.decryptPwd(pwd);
             if (null == password) {
                 return fail("瀵嗙爜瑙e瘑澶辫触", null);
@@ -334,6 +351,10 @@
             if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                 WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res);
             }
+            if (!pwd.endsWith(EQ)) {
+                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
+            }
+
             String password = downloadService.decryptPwd(pwd);
             if (null == password) {
                 WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res);

--
Gitblit v1.9.3