Browse Source

批次密码解压修改

wangliang 1 year ago
parent
commit
99923f1aef

+ 9 - 5
server/src/main/java/com/qmth/jkserver/service/impl/ExamPaperTempServiceImpl.java

@@ -243,11 +243,15 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
             } else {
             } else {
                 for (ExamPaperUncoiling examPaperUncoiling : examPaperUncoilingList) {
                 for (ExamPaperUncoiling examPaperUncoiling : examPaperUncoilingList) {
                     Optional.ofNullable(examPaperUncoiling.getPassword()).orElseThrow(() -> new JkServerException("考试编号[" + examPaperUncoiling.getExamCode() + "]批次:" + examPaperUncoiling.getBatchId() + "未设置开卷密码!"));
                     Optional.ofNullable(examPaperUncoiling.getPassword()).orElseThrow(() -> new JkServerException("考试编号[" + examPaperUncoiling.getExamCode() + "]批次:" + examPaperUncoiling.getBatchId() + "未设置开卷密码!"));
-                    List<File> fileList = kwService.unZipByPasswordByDest(target, examPaperUncoiling.getPassword());
-                    if (Objects.nonNull(fileList) && fileList.size() > 0) {
-                        for (File file : fileList) {
-                            mapFile.computeIfAbsent(file.getName(), v -> file);
-                            analyzePaperZip(file, examPaperUncoilingList, mapFile, deletePaths);
+                    String fileName = target.getName();
+                    String[] strs = fileName.substring(0, fileName.indexOf(".")).split("_");
+                    if (strs.length > 1 && Objects.nonNull(strs[1]) && Objects.equals(strs[1].trim(), examPaperUncoiling.getBatchId().trim())) {
+                        List<File> fileList = kwService.unZipByPasswordByDest(target, examPaperUncoiling.getPassword());
+                        if (Objects.nonNull(fileList) && fileList.size() > 0) {
+                            for (File file : fileList) {
+                                mapFile.computeIfAbsent(file.getName(), v -> file);
+                                analyzePaperZip(file, examPaperUncoilingList, mapFile, deletePaths);
+                            }
                         }
                         }
                     }
                     }
                 }
                 }