Bläddra i källkod

压缩包导入

hejinbo 2 år sedan
förälder
incheckning
e3cd2495cf

+ 13
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java Visa fil

@@ -429,4 +429,17 @@ public class CaseApplicationController extends BaseController {
429 429
 
430 430
         return  success(caseApplicationService.reserveConferenceList(caseId));
431 431
     }
432
+
433
+    /**
434
+     * 案件压缩包导入
435
+     * @param file
436
+     * @return
437
+     * @throws IOException
438
+     */
439
+    @PostMapping("/uploadCaseZipFile")
440
+    public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file) throws IOException {
441
+        return caseApplicationService.uploadCaseZipFile(file);
442
+    }
443
+
444
+
432 445
 }

+ 2
- 0
ruoyi-system/pom.xml Visa fil

@@ -22,6 +22,7 @@
22 22
             <groupId>com.ruoyi</groupId>
23 23
             <artifactId>ruoyi-common</artifactId>
24 24
         </dependency>
25
+
25 26
         <dependency>
26 27
             <groupId>com.ruoyi</groupId>
27 28
             <artifactId>pay</artifactId>
@@ -32,6 +33,7 @@
32 33
             <artifactId>tls-sig-api-v2</artifactId>
33 34
             <version>1.2</version>
34 35
         </dependency>
36
+
35 37
     </dependencies>
36 38
 
37 39
 </project>

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java Visa fil

@@ -112,4 +112,6 @@ public interface ICaseApplicationService {
112 112
 
113 113
     AjaxResult deleteRoom(  String roomId);
114 114
 
115
+    AjaxResult uploadCaseZipFile(MultipartFile file);
116
+
115 117
 }

+ 101
- 33
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Visa fil

@@ -4,6 +4,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
4 4
 import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.IdcardUtil;
6 6
 import cn.hutool.core.util.StrUtil;
7
+import cn.hutool.core.util.ZipUtil;
7 8
 import com.alibaba.fastjson.JSON;
8 9
 import com.alibaba.fastjson.JSONArray;
9 10
 import com.alibaba.fastjson.JSONObject;
@@ -11,6 +12,7 @@ import com.google.gson.Gson;
11 12
 import com.google.gson.JsonArray;
12 13
 import com.google.gson.JsonObject;
13 14
 import com.ruoyi.common.annotation.DataScope;
15
+import com.ruoyi.common.config.RuoYiConfig;
14 16
 import com.ruoyi.common.constant.CaseApplicationConstants;
15 17
 import com.ruoyi.common.core.domain.AjaxResult;
16 18
 import com.ruoyi.common.core.domain.entity.*;
@@ -19,6 +21,7 @@ import com.ruoyi.common.enums.UpdateSubmitStatus;
19 21
 import com.ruoyi.common.exception.EsignDemoException;
20 22
 import com.ruoyi.common.exception.ServiceException;
21 23
 import com.ruoyi.common.utils.*;
24
+import com.ruoyi.common.utils.file.FileUploadUtils;
22 25
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
23 26
 import com.ruoyi.common.core.domain.entity.SysUser;
24 27
 import com.ruoyi.common.utils.thread.ThreadPoolUtil;
@@ -49,6 +52,7 @@ import org.springframework.beans.factory.annotation.Value;
49 52
 import org.springframework.stereotype.Service;
50 53
 import org.springframework.transaction.annotation.Transactional;
51 54
 import org.springframework.web.multipart.MultipartFile;
55
+
52 56
 import java.io.*;
53 57
 import java.math.BigDecimal;
54 58
 import java.math.RoundingMode;
@@ -61,6 +65,8 @@ import java.time.ZoneId;
61 65
 import java.util.*;
62 66
 import java.util.regex.Pattern;
63 67
 import java.util.stream.Collectors;
68
+import java.util.zip.ZipEntry;
69
+import java.util.zip.ZipInputStream;
64 70
 
65 71
 import static com.ruoyi.common.core.domain.AjaxResult.success;
66 72
 import static com.ruoyi.common.utils.PageUtils.startPage;
@@ -157,7 +163,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
157 163
             }
158 164
 
159 165
             for (SysRole role : roles) {
160
-                if(StrUtil.isEmpty(role.getRoleName())){
166
+                if (StrUtil.isEmpty(role.getRoleName())) {
161 167
                     continue;
162 168
                 }
163 169
                 // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
@@ -188,7 +194,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
188 194
                     caseApplication.setDeptIds(deptIds);
189 195
                 }
190 196
                 if ("申请人".equals(role.getRoleName())) {
191
-                //    caseApplication.setIsOtherRole(1);
197
+                    //    caseApplication.setIsOtherRole(1);
192 198
                     // 查询有关的用户部门
193 199
                     caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
194 200
                 }
@@ -200,7 +206,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
200 206
                 if ("代理人".equals(role.getRoleName())) {
201 207
                     caseApplication.setIsOtherRole(1);
202 208
                     // 查询角色有关的用户部门
203
-                        // List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
209
+                    // List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
204 210
                     List<Long> agentDeptIds = new ArrayList<>();
205 211
                     agentDeptIds.add(sysUser.getDeptId());
206 212
                     caseApplication.setAgentDeptIds(agentDeptIds);
@@ -233,7 +239,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
233 239
         CaseApplication caseApplication = new CaseApplication();
234 240
         List<Integer> caseStatusList = new ArrayList<>();
235 241
         for (SysRole role : roles) {
236
-            if(StrUtil.isEmpty(role.getRoleName())){
242
+            if (StrUtil.isEmpty(role.getRoleName())) {
237 243
                 continue;
238 244
             }
239 245
             // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
@@ -264,7 +270,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
264 270
                 caseApplication.setDeptIds(deptIds);
265 271
             }
266 272
             if ("申请人".equals(role.getRoleName())) {
267
-              //  caseApplication.setIsOtherRole(1);
273
+                //  caseApplication.setIsOtherRole(1);
268 274
                 // 查询角色有关的用户部门
269 275
                 caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
270 276
             }
@@ -286,7 +292,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
286 292
 
287 293
         // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
288 294
         ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication);
289
-        if(toDoCount==null){
295
+        if (toDoCount == null) {
290 296
             return new ToDoCount();
291 297
         }
292 298
         return toDoCount;
@@ -360,7 +366,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
360 366
             return AjaxResult.error("请选择要上传的文件");
361 367
         }
362 368
         String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
363
-//        String targetPath =  "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile";
369
+        // String targetPath = "D:\\home\\unzip\\";
364 370
         File zipFile = null;
365 371
         InputStream ins = null;
366 372
         try {
@@ -540,7 +546,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
540 546
                 }
541 547
             }
542 548
         }
543
-
544 549
         return success();
545 550
 
546 551
     }
@@ -878,6 +883,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
878 883
 
879 884
     /**
880 885
      * 新增案件
886
+     *
881 887
      * @param caseApplication
882 888
      * @return
883 889
      */
@@ -898,7 +904,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
898 904
         caseApplication.setVersion(1);
899 905
         // 新增立案信息
900 906
         int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
901
-        if(rows==0){
907
+        if (rows == 0) {
902 908
             return rows;
903 909
         }
904 910
         List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
@@ -1010,12 +1016,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1010 1016
         caseApplication.setFeePayable(feePayable);
1011 1017
         caseApplication.setUpdateBy(getUsername());
1012 1018
         // 立案申请状态直接修改主表信息
1013
-        if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1019
+        if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1014 1020
 
1015 1021
             caseApplicationMapper.updataCaseApplication(caseApplication);
1016 1022
             // 修改记录表状态为同意提交修改的内容
1017 1023
             caseApplication.setUpdateSubmitStatus(0);
1018
-        }else {
1024
+        } else {
1019 1025
             // 修改记录表状态为已提交修改的内容
1020 1026
             caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode());
1021 1027
         }
@@ -1064,7 +1070,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1064 1070
 
1065 1071
                 }
1066 1072
                 // 立案申请状态直接修改主表信息
1067
-                if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1073
+                if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1068 1074
 
1069 1075
                     caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
1070 1076
                 }
@@ -1084,11 +1090,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1084 1090
         if (maxVersion == null) {
1085 1091
             maxVersion = 1;
1086 1092
         }
1087
-        caseApplication.setVersion(maxVersion+1);
1093
+        caseApplication.setVersion(maxVersion + 1);
1088 1094
         // 将修改提交状态改为未提交
1089
-       // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1095
+        // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1090 1096
         // 修改案件表的版本号
1091
-     //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1097
+        //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1092 1098
 
1093 1099
         // 异步新增案件日志
1094 1100
         ThreadPoolUtil.execute(() -> {
@@ -1307,7 +1313,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1307 1313
         StringBuilder failureMsg = new StringBuilder();
1308 1314
         StringBuilder successMsg = new StringBuilder();
1309 1315
         int successNum = 0;
1310
-        List<CaseAffiliate> caseAffiliateLogList=new ArrayList<>();
1316
+        List<CaseAffiliate> caseAffiliateLogList = new ArrayList<>();
1311 1317
         if (caseApplicationList != null && caseApplicationList.size() > 0) {
1312 1318
             // 1,查询所有的组织机构,组装成map
1313 1319
             List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
@@ -1374,7 +1380,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1374 1380
                         caseApplicationItera.setCreateBy(getUsername());
1375 1381
                         caseApplicationItera.setImportFlag(1);
1376 1382
                         int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
1377
-                        if(rows==0){
1383
+                        if (rows == 0) {
1378 1384
                             continue;
1379 1385
                         }
1380 1386
                         // 新增日志
@@ -1394,7 +1400,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1394 1400
                         caseApplicationItera.setVersion(1);
1395 1401
 
1396 1402
                         int insertRow = caseApplicationLogMapper.insert(caseApplicationItera);
1397
-                        if(insertRow>0){
1403
+                        if (insertRow > 0) {
1398 1404
                             caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId()));
1399 1405
                             caseAffiliateLogList.addAll(caseAffiliates);
1400 1406
                         }
@@ -1408,7 +1414,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1408 1414
             }
1409 1415
             // 异步新增案件日志
1410 1416
             ThreadPoolUtil.execute(() -> {
1411
-                if ( CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
1417
+                if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
1412 1418
                     // 插入案件日志人员相关表
1413 1419
                     caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList);
1414 1420
                 }
@@ -1457,7 +1463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1457 1463
         }
1458 1464
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) {
1459 1465
             failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;");
1460
-        } else if (! IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
1466
+        } else if (!IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
1461 1467
             failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;");
1462 1468
         }
1463 1469
         String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent();
@@ -1487,7 +1493,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1487 1493
         }
1488 1494
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) {
1489 1495
             failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;");
1490
-        } else if (! IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
1496
+        } else if (!IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
1491 1497
             failureMsg.append("【被申请人主体信息-身份证号】不合法;");
1492 1498
         }
1493 1499
         String debtorContactTelphone = caseApplication.getDebtorContactTelphone();
@@ -1524,7 +1530,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1524 1530
         }
1525 1531
         if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) {
1526 1532
             failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;");
1527
-        } else if(!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()){
1533
+        } else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) {
1528 1534
 
1529 1535
             failureMsg.append("【被申请人主体信息-邮箱】字段不合法;");
1530 1536
         }
@@ -1630,7 +1636,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1630 1636
         }
1631 1637
         if (StrUtil.isEmpty(caseApplication.getEmail())) {
1632 1638
             failureMsg.append("【申请人主体信息-邮箱】字段不能为空;");
1633
-        } else if(!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()){
1639
+        } else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) {
1634 1640
 
1635 1641
             failureMsg.append("【申请人主体信息-邮箱】字段不合法;");
1636 1642
         }
@@ -1928,7 +1934,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1928 1934
                                                 EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord, sealIdList);
1929 1935
 
1930 1936
                                                 JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1931
-                                                if (jsonObject3 != null){
1937
+                                                if (jsonObject3 != null) {
1932 1938
                                                     if (jsonObject3.getIntValue("code") == 0) {
1933 1939
                                                         //获取签署流程ID
1934 1940
                                                         JSONObject data1 = jsonObject3.getJSONObject("data");
@@ -1941,7 +1947,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1941 1947
                                                     } else {
1942 1948
                                                         throw new ServiceException("发起签署流程失败,请检查参数是否有误");
1943 1949
                                                     }
1944
-                                                }else {
1950
+                                                } else {
1945 1951
                                                     return AjaxResult.error();
1946 1952
                                                 }
1947 1953
 
@@ -2692,14 +2698,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2692 2698
      */
2693 2699
     @Transactional
2694 2700
     @Override
2695
-    public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO)  {
2701
+    public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) {
2696 2702
 
2697 2703
         // 新增预约会议表
2698
-        ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(),SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
2699
-                            reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
2704
+        ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
2705
+                reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
2700 2706
 
2701
-    reservedConferenceMapper.insert(conference);
2702
-    return success("预约会议成功");
2707
+        reservedConferenceMapper.insert(conference);
2708
+        return success("预约会议成功");
2703 2709
     }
2704 2710
 
2705 2711
 
@@ -2728,10 +2734,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2728 2734
         // 查询最大房间号
2729 2735
         Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
2730 2736
 
2731
-        if (null == maxRoomId || maxRoomId >4294967294L) {
2737
+        if (null == maxRoomId || maxRoomId > 4294967294L) {
2732 2738
             return 1L;
2733 2739
         } else {
2734
-            return maxRoomId+1;
2740
+            return maxRoomId + 1;
2735 2741
         }
2736 2742
 
2737 2743
     }
@@ -2776,10 +2782,72 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2776 2782
     @Override
2777 2783
     public AjaxResult deleteRoom(String roomId) {
2778 2784
 
2779
-        return success( reservedConferenceMapper.deleteByRoomId(roomId));
2785
+        return success(reservedConferenceMapper.deleteByRoomId(roomId));
2780 2786
     }
2781 2787
 
2788
+    @Override
2789
+    public AjaxResult uploadCaseZipFile(MultipartFile file) {
2790
+        if (file.isEmpty()) {
2791
+            return AjaxResult.error("请选择要上传的文件");
2792
+        }
2793
+        //String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
2794
+        String targetPath = "D:\\home\\unzip\\";
2795
+        File zipFile = null;
2796
+        InputStream ins = null;
2797
+        try {
2798
+            ins = file.getInputStream();
2799
+            zipFile = new File(file.getOriginalFilename());
2800
+            inputChangeToFile(ins, zipFile);
2801
+        } catch (IOException e) {
2802
+            e.printStackTrace();
2803
+        }
2804
+        //解压缩上传的压缩包
2805
+        boolean unzipSuccess  = UnZipFileUtils.unZipFile(zipFile, targetPath);
2806
+        if (unzipSuccess ) {
2807
+            String unzipPath = targetPath + file.getOriginalFilename() + "\\";
2808
+            File directory = new File(targetPath);
2809
+            String pdfFilePath  = findAndConvertPDF(directory);
2810
+            if (pdfFilePath != null){
2811
+                // 返回找到的PDF文件路径
2812
+                return AjaxResult.success(pdfFilePath);
2813
+            }else {
2814
+                // 没有找到符合条件的文件
2815
+                return AjaxResult.error("未找到符合条件的文件");
2816
+            }
2817
+        }else {
2818
+            // 解压失败
2819
+            return AjaxResult.error("解压失败");
2820
+        }
2821
+
2822
+    }
2823
+    public static String findAndConvertPDF(File directory) {
2824
+
2825
+        File[] matches = directory.listFiles(new FilenameFilter() {
2826
+            public boolean accept(File dir, String name) {
2827
+                return name.contains("仲裁申请书");
2828
+            }
2829
+        });
2782 2830
 
2831
+        if (matches != null && matches.length > 0) {
2832
+            for (File file : matches) {
2833
+                if (file.isFile() && file.getName().toLowerCase().endsWith(".pdf")) {
2834
+                    // 如果是PDF格式直接返回路径
2835
+                    return file.getAbsolutePath();
2836
+                } else {
2837
+                    // 如果不是PDF格式,进行转换成PDF并返回路径
2838
+                    String pdfPath = convertToPDF(file);
2839
+                    return pdfPath;
2840
+                }
2841
+            }
2842
+        }
2843
+        return null;
2844
+    }
2845
+
2846
+    private static String convertToPDF(File file) {
2847
+        // 实现文件格式转换逻辑,这里假设已经实现了转换逻辑,返回转换后的PDF文件路径
2848
+        String pdfPath = "convertedFilePath.pdf"; // 这里替换为实际转换后的PDF文件路径
2849
+        return pdfPath;
2850
+    }
2783 2851
 }
2784 2852
 
2785 2853
 

+ 0
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java Visa fil

@@ -223,7 +223,6 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
223 223
                 casePaymentRecordMapper.saveRecord(paymentRecord);
224 224
                 // 新增日志
225 225
                 CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
226
-
227 226
             }
228 227
         }
229 228
 

+ 74
- 173
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Visa fil

@@ -182,192 +182,93 @@ public class FixSelectFlowDetailUtils {
182 182
     public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
183 183
         Gson gson = new Gson();
184 184
         DeptIdentify deptIdentify = new DeptIdentify();
185
-        deptIdentify.setIdentifyStatus(0);
186 185
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
187 186
         if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
188 187
             for (int i = 0; i < deptIdentifysnew.size(); i++) {
189 188
                 DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
190
-                String authFlowId = deptIdentify1.getAuthFlowId();
191
-                if (authFlowId != null) {
192
-                    EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
193
-                    JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
194
-                    int code = identifyInfoJsonObject.get("code").getAsInt();
195
-                    if (code == 0) {
196
-                        JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
197
-                        int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
198
-                        if (realnameStatus == 1) {
199
-                            String orgId = identifyInfoData.get("orgId").getAsString();
200
-                            //查询企业内部印章
201
-                            EsignHttpResponse response = SignAward.deptIdentifySealList(orgId);
202
-                            JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class);
203
-                            int code1 = jsonObject.get("code").getAsInt();
204
-                            if (code1 == 0) {
205
-                                JsonObject data = jsonObject.getAsJsonObject("data");
206
-                                JsonArray seals = data.get("seals").getAsJsonArray();
207
-                                if (seals.size() > 0) {
208
-                                    for (int j = 0; j < seals.size(); j++) {
209
-                                        //保存印章信息到数据库
210
-                                        JsonObject asJsonObject = seals.get(j).getAsJsonObject();
211
-                                        SealManage sealManage = new SealManage();
212
-                                        String sealName = asJsonObject.get("sealName").toString();
213
-                                        String sealId = asJsonObject.get("sealId").toString();
214
-                                        String url = asJsonObject.get("sealImageDownloadUrl").toString();
215
-                                        LocalDate now = LocalDate.now();
216
-                                        String year = Integer.toString(now.getYear());
217
-                                        String month = String.format("%02d", now.getMonthValue());
218
-                                        String day = String.format("%02d", now.getDayOfMonth());
219
-                                        String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
220
-                                        String fileName = UUID.randomUUID().toString().replace("-", "") + ".jpg";
221
-                                        String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
222
-                                        String savePath = "/home/ruoyi/uploadPath/upload/";
223
-                                        // 创建日期目录
224
-                                        File saveFolder = new File(saveFolderPath);
225
-                                        if (!saveFolder.exists()) {
226
-                                            saveFolder.mkdirs();
227
-                                        }
228
-                                        String resultFilePath = saveFolderPath + "/" + fileName;
229
-                                        File resultFilePathFile = new File(resultFilePath);
230
-                                        if (!resultFilePathFile.exists()) {
231
-                                            resultFilePathFile.createNewFile();
232
-                                        }
233
-                                        String fileDownloadUrlnew = url.substring(1, url.length() - 1);
234
-                                        boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
235
-                                        if (downLoadFile) {
236
-                                            CaseAttach caseAttach = new CaseAttach();
237
-                                            caseAttach.setAnnexType(10);  //10代表印章图片
238
-                                            caseAttach.setAnnexPath(savePath);
239
-                                            caseAttach.setAnnexName(saveName);
240
-                                            int i1 = caseAttachMapper.save(caseAttach);
241
-                                            if (i1 > 0) {
242
-                                                //将印章信息保存到公章管理表里
243
-                                                String sealName1 = sealName.substring(1, sealName.length() - 1);
244
-                                                String sealId1 = sealId.substring(1, sealId.length() - 1);
245
-                                                Integer annexId1 = caseAttach.getAnnexId();
246
-                                                sealManage.setAnnexId(annexId1);
247
-                                                sealManage.setSealId(sealId1);
248
-                                                sealManage.setSealName(sealName1);
249
-                                                sealManage.setIdentifyId(deptIdentify1.getId());
250
-                                                sealManage.setSealStatus(1);
251
-                                                sealManage.setIsUse(1);
252
-                                                sealManageMapper.insertSealManage(sealManage);
189
+                Integer identifyStatus = deptIdentify1.getIdentifyStatus();
190
+                if (identifyStatus!=1){
191
+                    String authFlowId = deptIdentify1.getAuthFlowId();
192
+                    if (authFlowId != null) {
193
+                        EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
194
+                        JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
195
+                        int code = identifyInfoJsonObject.get("code").getAsInt();
196
+                        if (code == 0) {
197
+                            JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
198
+                            int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
199
+                            if (realnameStatus == 1) {
200
+                                String orgId = identifyInfoData.get("orgId").getAsString();
201
+                                //查询企业内部印章
202
+                                EsignHttpResponse response = SignAward.deptIdentifySealList(orgId);
203
+                                JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class);
204
+                                int code1 = jsonObject.get("code").getAsInt();
205
+                                if (code1 == 0) {
206
+                                    JsonObject data = jsonObject.getAsJsonObject("data");
207
+                                    JsonArray seals = data.get("seals").getAsJsonArray();
208
+                                    if (seals.size() > 0) {
209
+                                        for (int j = 0; j < seals.size(); j++) {
210
+                                            //保存印章信息到数据库
211
+                                            JsonObject asJsonObject = seals.get(j).getAsJsonObject();
212
+                                            SealManage sealManage = new SealManage();
213
+                                            String sealName = asJsonObject.get("sealName").toString();
214
+                                            String sealId = asJsonObject.get("sealId").toString();
215
+                                            String url = asJsonObject.get("sealImageDownloadUrl").toString();
216
+                                            LocalDate now = LocalDate.now();
217
+                                            String year = Integer.toString(now.getYear());
218
+                                            String month = String.format("%02d", now.getMonthValue());
219
+                                            String day = String.format("%02d", now.getDayOfMonth());
220
+                                            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
221
+                                            String fileName = UUID.randomUUID().toString().replace("-", "") + ".jpg";
222
+                                            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
223
+                                            String savePath = "/home/ruoyi/uploadPath/upload/";
224
+                                            // 创建日期目录
225
+                                            File saveFolder = new File(saveFolderPath);
226
+                                            if (!saveFolder.exists()) {
227
+                                                saveFolder.mkdirs();
253 228
                                             }
254
-                                        }
255
-                                    }
256
-                                }
257
-
258
-                            }
259
-                            //将orgId保存到数据库里
260
-                            deptIdentify1.setOrgId(orgId);
261
-                            deptIdentify1.setIdentifyStatus(1);
262
-                            deptIdentify1.setIsUse(0);  //默认机构为未启用
263
-                            int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
264
-                        }
265
-                    }else {
266
-                        deptIdentify1.setIdentifyStatus(2);
267
-                        deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
268
-                    }
269
-                }
270
-
271
-            }
272
-        }
273
-    }
274
-
275
-    /**
276
-     * 定时查询企业认证状态
277
-     *
278
-     * @throws Exception
279
-     */
280
-    @Scheduled(cron = "*/30 * * * * *")
281
-    @Transactional
282
-    public void fixExecuteSelectDeptIndentify() throws Exception {
283
-        Gson gson = new Gson();
284
-        DeptIdentify deptIdentify = new DeptIdentify();
285
-        deptIdentify.setIdentifyStatus(2);
286
-        List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
287
-        if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
288
-            for (int i = 0; i < deptIdentifysnew.size(); i++) {
289
-                DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
290
-                String authFlowId = deptIdentify1.getAuthFlowId();
291
-                if (authFlowId != null) {
292
-                    EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
293
-                    JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
294
-                    int code = identifyInfoJsonObject.get("code").getAsInt();
295
-                    if (code == 0) {
296
-                        JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
297
-                        int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
298
-                        if (realnameStatus == 1) {
299
-                            String orgId = identifyInfoData.get("orgId").getAsString();
300
-                            //查询企业内部印章
301
-                            EsignHttpResponse response = SignAward.deptIdentifySealList(orgId);
302
-                            JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class);
303
-                            int code1 = jsonObject.get("code").getAsInt();
304
-                            if (code1 == 0) {
305
-                                JsonObject data = jsonObject.getAsJsonObject("data");
306
-                                JsonArray seals = data.get("seals").getAsJsonArray();
307
-                                if (seals.size() > 0) {
308
-                                    for (int j = 0; j < seals.size(); j++) {
309
-                                        //保存印章信息到数据库
310
-                                        JsonObject asJsonObject = seals.get(j).getAsJsonObject();
311
-                                        SealManage sealManage = new SealManage();
312
-                                        String sealName = asJsonObject.get("sealName").toString();
313
-                                        String sealId = asJsonObject.get("sealId").toString();
314
-                                        String url = asJsonObject.get("sealImageDownloadUrl").toString();
315
-                                        LocalDate now = LocalDate.now();
316
-                                        String year = Integer.toString(now.getYear());
317
-                                        String month = String.format("%02d", now.getMonthValue());
318
-                                        String day = String.format("%02d", now.getDayOfMonth());
319
-                                        String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
320
-                                        String fileName = UUID.randomUUID().toString().replace("-", "") + ".jpg";
321
-                                        String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
322
-                                        String savePath = "/home/ruoyi/uploadPath/upload/";
323
-                                        // 创建日期目录
324
-                                        File saveFolder = new File(saveFolderPath);
325
-                                        if (!saveFolder.exists()) {
326
-                                            saveFolder.mkdirs();
327
-                                        }
328
-                                        String resultFilePath = saveFolderPath + "/" + fileName;
329
-                                        File resultFilePathFile = new File(resultFilePath);
330
-                                        if (!resultFilePathFile.exists()) {
331
-                                            resultFilePathFile.createNewFile();
332
-                                        }
333
-                                        String fileDownloadUrlnew = url.substring(1, url.length() - 1);
334
-                                        boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
335
-                                        if (downLoadFile) {
336
-                                            CaseAttach caseAttach = new CaseAttach();
337
-                                            caseAttach.setAnnexType(10);  //10代表印章图片
338
-                                            caseAttach.setAnnexPath(savePath);
339
-                                            caseAttach.setAnnexName(saveName);
340
-                                            int i1 = caseAttachMapper.save(caseAttach);
341
-                                            if (i1 > 0) {
342
-                                                //将印章信息保存到公章管理表里
343
-                                                String sealName1 = sealName.substring(1, sealName.length() - 1);
344
-                                                String sealId1 = sealId.substring(1, sealId.length() - 1);
345
-                                                Integer annexId1 = caseAttach.getAnnexId();
346
-                                                sealManage.setAnnexId(annexId1);
347
-                                                sealManage.setSealId(sealId1);
348
-                                                sealManage.setSealName(sealName1);
349
-                                                sealManage.setIdentifyId(deptIdentify1.getId());
350
-                                                sealManage.setSealStatus(1);
351
-                                                sealManage.setIsUse(1);
352
-                                                sealManageMapper.insertSealManage(sealManage);
229
+                                            String resultFilePath = saveFolderPath + "/" + fileName;
230
+                                            File resultFilePathFile = new File(resultFilePath);
231
+                                            if (!resultFilePathFile.exists()) {
232
+                                                resultFilePathFile.createNewFile();
233
+                                            }
234
+                                            String fileDownloadUrlnew = url.substring(1, url.length() - 1);
235
+                                            boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
236
+                                            if (downLoadFile) {
237
+                                                CaseAttach caseAttach = new CaseAttach();
238
+                                                caseAttach.setAnnexType(10);  //10代表印章图片
239
+                                                caseAttach.setAnnexPath(savePath);
240
+                                                caseAttach.setAnnexName(saveName);
241
+                                                int i1 = caseAttachMapper.save(caseAttach);
242
+                                                if (i1 > 0) {
243
+                                                    //将印章信息保存到公章管理表里
244
+                                                    String sealName1 = sealName.substring(1, sealName.length() - 1);
245
+                                                    String sealId1 = sealId.substring(1, sealId.length() - 1);
246
+                                                    Integer annexId1 = caseAttach.getAnnexId();
247
+                                                    sealManage.setAnnexId(annexId1);
248
+                                                    sealManage.setSealId(sealId1);
249
+                                                    sealManage.setSealName(sealName1);
250
+                                                    sealManage.setIdentifyId(deptIdentify1.getId());
251
+                                                    sealManage.setSealStatus(1);
252
+                                                    sealManage.setIsUse(1);
253
+                                                    sealManageMapper.insertSealManage(sealManage);
254
+                                                }
353 255
                                             }
354 256
                                         }
355 257
                                     }
356
-                                }
357 258
 
259
+                                }
260
+                                //将orgId保存到数据库里
261
+                                deptIdentify1.setOrgId(orgId);
262
+                                deptIdentify1.setIdentifyStatus(1);
263
+                                deptIdentify1.setIsUse(0);  //默认机构为未启用
264
+                                int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
358 265
                             }
359
-                            //将orgId保存到数据库里
360
-                            deptIdentify1.setOrgId(orgId);
361
-                            deptIdentify1.setIdentifyStatus(1);
362
-                            deptIdentify1.setIsUse(0);  //默认机构为未启用
363
-                            int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
266
+                        }else {
267
+                            deptIdentify1.setIdentifyStatus(2);
268
+                            deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
364 269
                         }
365
-                    }else {
366
-                        deptIdentify1.setIdentifyStatus(2);
367
-                        deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
368 270
                     }
369 271
                 }
370
-
371 272
             }
372 273
         }
373 274
     }

+ 15
- 47
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java Visa fil

@@ -17,43 +17,14 @@ import java.util.zip.ZipFile;
17 17
 public class UnZipFileUtils {
18 18
 
19 19
     public static void main(String[] args) {
20
-        // 压缩包路径
21
-//        String zipPath = "F:\\testZip\\zipFile\\上传申请书证据材料.zip";
22
-        // 解压后存放路径
23
-//        String targetPath =  "F:\\testZip\\unzipFile";
24
-//        unZipFile(new File(zipPath),targetPath);
25
-
26
-
27
-//        String zipPath = "F:\\testZip\\unzipFile\\上传申请书证据材料";
28
-//        File dirUnzipPath = new File(zipPath);
29
-//        List<File> allFiles = new ArrayList<>();
30
-//        getFiles(dirUnzipPath,allFiles);
31
-//        if(allFiles!=null&&allFiles.size()>0){
32
-//            for (File fileIter : allFiles) {
33
-//                System.out.println(fileIter.getName());
34
-//                System.out.println(fileIter.getAbsolutePath());
35
-//            }
36
-//        }
37
-
38
-         String key = "\\";
39
-         String str = "F:\\testZip\\上传申请书证据材料\\证据材料\\仲裁裁决书模板.docx";
40
-        List<Integer> allindex = new ArrayList<>();
41
-        int a = str.indexOf(key);//*第一个出现的索引位置
42
-        allindex.add(a);
43
-        while (a != -1) {
44
-            System.out.print(a + "\t");
45
-            a = str.indexOf(key, a + 1);//*从这个索引往后开始第一个出现的位置
46
-            allindex.add(a);
47
-        }
48
-        String substr = str.substring(allindex.get(1)+1,allindex.get(2));
49
-        System.out.println("substr---"+substr);
50
-
51
-
20
+        File file = new File("D:\\home\\ruoyi\\仲裁委项目-测试单.zip");
21
+        String targetPath = "D:\\home\\unzip\\";
22
+        unZipFile(file,targetPath);
52 23
     }
53 24
 
54 25
     public static boolean unZipFile(File aboriginalFile, String targetPath) {
55 26
         if (!aboriginalFile.exists()) {
56
-            log.error("此文件不存在:",aboriginalFile.getPath());
27
+            log.error("此文件不存在:", aboriginalFile.getPath());
57 28
             return false;
58 29
         }
59 30
         try {
@@ -65,18 +36,18 @@ public class UnZipFileUtils {
65 36
                     String directPath = targetPath + File.separator + entryZip.getName();
66 37
                     File directFile = new File(directPath);
67 38
                     boolean makeDirs = directFile.mkdirs();
68
-                    System.out.println("创建文件夹是否成功:" +makeDirs);
39
+                    System.out.println("创建文件夹是否成功:" + makeDirs);
69 40
                 } else {
70 41
                     //若是文件,就创建文件
71 42
                     File sourceFile = new File(targetPath + File.separator + entryZip.getName());
72
-                    if(!sourceFile.getParentFile().exists()){
43
+                    if (!sourceFile.getParentFile().exists()) {
73 44
                         boolean mDirect = sourceFile.getParentFile().mkdirs();
74
-                        System.out.println("创建压缩文件时,创建父文件夹是否成功:" +mDirect);
45
+                        System.out.println("创建压缩文件时,创建父文件夹是否成功:" + mDirect);
75 46
                     }
76 47
                     boolean newUnZipFile = sourceFile.createNewFile();
77
-                    if (newUnZipFile){
48
+                    if (newUnZipFile) {
78 49
                         // 将压缩文件内容写入到这个文件中
79
-                        try{
50
+                        try {
80 51
                             InputStream is = srcZipFile.getInputStream(entryZip);
81 52
                             FileOutputStream fos = new FileOutputStream(sourceFile);
82 53
                             int len;
@@ -84,8 +55,8 @@ public class UnZipFileUtils {
84 55
                             while ((len = is.read(buf)) != -1) {
85 56
                                 fos.write(buf, 0, len);
86 57
                             }
87
-                        } catch (Exception e){
88
-                            log.error("解压失败",e);
58
+                        } catch (Exception e) {
59
+                            log.error("解压失败", e);
89 60
                         }
90 61
                     }
91 62
                 }
@@ -93,7 +64,7 @@ public class UnZipFileUtils {
93 64
             return true;
94 65
 
95 66
         } catch (IOException e) {
96
-            log.error("解压失败",e);
67
+            log.error("解压失败", e);
97 68
             return false;
98 69
         }
99 70
 
@@ -106,11 +77,11 @@ public class UnZipFileUtils {
106 77
             return;
107 78
         }
108 79
         File[] fileArray = fileSource.listFiles();
109
-        if(fileArray!=null&&fileArray.length>0){
80
+        if (fileArray != null && fileArray.length > 0) {
110 81
             for (File fileIter : fileArray) {
111 82
                 if (fileIter.isDirectory()) {
112
-                    getFiles(fileIter,allFiles);
113
-                }else {
83
+                    getFiles(fileIter, allFiles);
84
+                } else {
114 85
                     allFiles.add(fileIter);
115 86
                 }
116 87
 
@@ -120,7 +91,4 @@ public class UnZipFileUtils {
120 91
     }
121 92
 
122 93
 
123
-
124
-
125
-
126 94
 }