ソースを参照

Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev

hejinbo 2 年 前
コミット
aef4ae747e

+ 13
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java ファイルの表示

@@ -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
 }

+ 14
- 0
ruoyi-common/pom.xml ファイルの表示

@@ -164,6 +164,20 @@
164 164
             <version>1.9.1</version>
165 165
         </dependency>
166 166
 
167
+        <dependency>
168
+            <groupId>com.documents4j</groupId>
169
+            <artifactId>documents4j-local</artifactId>
170
+            <version>1.0.3</version>
171
+        </dependency>
172
+        <dependency>
173
+            <groupId>com.documents4j</groupId>
174
+            <artifactId>documents4j-transformer-msoffice-word</artifactId>
175
+            <version>1.0.3</version>
176
+        </dependency>
177
+
178
+
179
+
180
+
167 181
         <!--  发送邮件-->
168 182
         <dependency>
169 183
             <groupId>org.springframework.boot</groupId>

+ 2
- 0
ruoyi-system/pom.xml ファイルの表示

@@ -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 ファイルの表示

@@ -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
 }

+ 179
- 33
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java ファイルの表示

@@ -4,13 +4,18 @@ 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
+import com.documents4j.api.DocumentType;
12
+import com.documents4j.api.IConverter;
13
+import com.documents4j.job.LocalConverter;
10 14
 import com.google.gson.Gson;
11 15
 import com.google.gson.JsonArray;
12 16
 import com.google.gson.JsonObject;
13 17
 import com.ruoyi.common.annotation.DataScope;
18
+import com.ruoyi.common.config.RuoYiConfig;
14 19
 import com.ruoyi.common.constant.CaseApplicationConstants;
15 20
 import com.ruoyi.common.core.domain.AjaxResult;
16 21
 import com.ruoyi.common.core.domain.entity.*;
@@ -19,6 +24,7 @@ import com.ruoyi.common.enums.UpdateSubmitStatus;
19 24
 import com.ruoyi.common.exception.EsignDemoException;
20 25
 import com.ruoyi.common.exception.ServiceException;
21 26
 import com.ruoyi.common.utils.*;
27
+import com.ruoyi.common.utils.file.FileUploadUtils;
22 28
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
23 29
 import com.ruoyi.common.core.domain.entity.SysUser;
24 30
 import com.ruoyi.common.utils.thread.ThreadPoolUtil;
@@ -44,11 +50,14 @@ import org.apache.http.entity.StringEntity;
44 50
 import org.apache.http.impl.client.CloseableHttpClient;
45 51
 import org.apache.http.impl.client.HttpClients;
46 52
 import org.apache.http.util.EntityUtils;
53
+import org.apache.poi.xwpf.usermodel.Document;
54
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
47 55
 import org.springframework.beans.factory.annotation.Autowired;
48 56
 import org.springframework.beans.factory.annotation.Value;
49 57
 import org.springframework.stereotype.Service;
50 58
 import org.springframework.transaction.annotation.Transactional;
51 59
 import org.springframework.web.multipart.MultipartFile;
60
+
52 61
 import java.io.*;
53 62
 import java.math.BigDecimal;
54 63
 import java.math.RoundingMode;
@@ -61,6 +70,8 @@ import java.time.ZoneId;
61 70
 import java.util.*;
62 71
 import java.util.regex.Pattern;
63 72
 import java.util.stream.Collectors;
73
+import java.util.zip.ZipEntry;
74
+import java.util.zip.ZipInputStream;
64 75
 
65 76
 import static com.ruoyi.common.core.domain.AjaxResult.success;
66 77
 import static com.ruoyi.common.utils.PageUtils.startPage;
@@ -159,7 +170,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
159 170
             }
160 171
 
161 172
             for (SysRole role : roles) {
162
-                if(StrUtil.isEmpty(role.getRoleName())){
173
+                if (StrUtil.isEmpty(role.getRoleName())) {
163 174
                     continue;
164 175
                 }
165 176
                 // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
@@ -190,7 +201,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
190 201
                     caseApplication.setDeptIds(deptIds);
191 202
                 }
192 203
                 if ("申请人".equals(role.getRoleName())) {
193
-                //    caseApplication.setIsOtherRole(1);
204
+                    //    caseApplication.setIsOtherRole(1);
194 205
                     // 查询有关的用户部门
195 206
                     caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
196 207
                 }
@@ -202,7 +213,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
202 213
                 if ("代理人".equals(role.getRoleName())) {
203 214
                     caseApplication.setIsOtherRole(1);
204 215
                     // 查询角色有关的用户部门
205
-                        // List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
216
+                    // List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
206 217
                     List<Long> agentDeptIds = new ArrayList<>();
207 218
                     agentDeptIds.add(sysUser.getDeptId());
208 219
                     caseApplication.setAgentDeptIds(agentDeptIds);
@@ -235,7 +246,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
235 246
         CaseApplication caseApplication = new CaseApplication();
236 247
         List<Integer> caseStatusList = new ArrayList<>();
237 248
         for (SysRole role : roles) {
238
-            if(StrUtil.isEmpty(role.getRoleName())){
249
+            if (StrUtil.isEmpty(role.getRoleName())) {
239 250
                 continue;
240 251
             }
241 252
             // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
@@ -266,7 +277,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
266 277
                 caseApplication.setDeptIds(deptIds);
267 278
             }
268 279
             if ("申请人".equals(role.getRoleName())) {
269
-              //  caseApplication.setIsOtherRole(1);
280
+                //  caseApplication.setIsOtherRole(1);
270 281
                 // 查询角色有关的用户部门
271 282
                 caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
272 283
             }
@@ -288,7 +299,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
288 299
 
289 300
         // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
290 301
         ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication);
291
-        if(toDoCount==null){
302
+        if (toDoCount == null) {
292 303
             return new ToDoCount();
293 304
         }
294 305
         return toDoCount;
@@ -362,7 +373,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
362 373
             return AjaxResult.error("请选择要上传的文件");
363 374
         }
364 375
         String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
365
-//        String targetPath =  "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile";
376
+        // String targetPath = "D:\\home\\unzip\\";
366 377
         File zipFile = null;
367 378
         InputStream ins = null;
368 379
         try {
@@ -542,7 +553,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
542 553
                 }
543 554
             }
544 555
         }
545
-
546 556
         return success();
547 557
 
548 558
     }
@@ -880,6 +890,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
880 890
 
881 891
     /**
882 892
      * 新增案件
893
+     *
883 894
      * @param caseApplication
884 895
      * @return
885 896
      */
@@ -900,7 +911,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
900 911
         caseApplication.setVersion(1);
901 912
         // 新增立案信息
902 913
         int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
903
-        if(rows==0){
914
+        if (rows == 0) {
904 915
             return rows;
905 916
         }
906 917
         List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
@@ -1024,12 +1035,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1024 1035
         caseApplication.setFeePayable(feePayable);
1025 1036
         caseApplication.setUpdateBy(getUsername());
1026 1037
         // 立案申请状态直接修改主表信息
1027
-        if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1038
+        if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1028 1039
 
1029 1040
             caseApplicationMapper.updataCaseApplication(caseApplication);
1030 1041
             // 修改记录表状态为同意提交修改的内容
1031 1042
             caseApplication.setUpdateSubmitStatus(0);
1032
-        }else {
1043
+        } else {
1033 1044
             // 修改记录表状态为已提交修改的内容
1034 1045
             caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode());
1035 1046
         }
@@ -1078,7 +1089,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1078 1089
 
1079 1090
                 }
1080 1091
                 // 立案申请状态直接修改主表信息
1081
-                if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1092
+                if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
1082 1093
 
1083 1094
                     caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
1084 1095
                 }
@@ -1111,11 +1122,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1111 1122
         if (maxVersion == null) {
1112 1123
             maxVersion = 1;
1113 1124
         }
1114
-        caseApplication.setVersion(maxVersion+1);
1125
+        caseApplication.setVersion(maxVersion + 1);
1115 1126
         // 将修改提交状态改为未提交
1116
-       // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1127
+        // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1117 1128
         // 修改案件表的版本号
1118
-     //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1129
+        //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1119 1130
 
1120 1131
         // 异步新增案件日志
1121 1132
         ThreadPoolUtil.execute(() -> {
@@ -1353,7 +1364,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1353 1364
         StringBuilder failureMsg = new StringBuilder();
1354 1365
         StringBuilder successMsg = new StringBuilder();
1355 1366
         int successNum = 0;
1356
-        List<CaseAffiliate> caseAffiliateLogList=new ArrayList<>();
1367
+        List<CaseAffiliate> caseAffiliateLogList = new ArrayList<>();
1357 1368
         if (caseApplicationList != null && caseApplicationList.size() > 0) {
1358 1369
             // 1,查询所有的组织机构,组装成map
1359 1370
             List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
@@ -1420,7 +1431,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1420 1431
                         caseApplicationItera.setCreateBy(getUsername());
1421 1432
                         caseApplicationItera.setImportFlag(1);
1422 1433
                         int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
1423
-                        if(rows==0){
1434
+                        if (rows == 0) {
1424 1435
                             continue;
1425 1436
                         }
1426 1437
                         // 新增日志
@@ -1440,7 +1451,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1440 1451
                         caseApplicationItera.setVersion(1);
1441 1452
 
1442 1453
                         int insertRow = caseApplicationLogMapper.insert(caseApplicationItera);
1443
-                        if(insertRow>0){
1454
+                        if (insertRow > 0) {
1444 1455
                             caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId()));
1445 1456
                             caseAffiliateLogList.addAll(caseAffiliates);
1446 1457
                         }
@@ -1454,7 +1465,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1454 1465
             }
1455 1466
             // 异步新增案件日志
1456 1467
             ThreadPoolUtil.execute(() -> {
1457
-                if ( CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
1468
+                if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) {
1458 1469
                     // 插入案件日志人员相关表
1459 1470
                     caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList);
1460 1471
                 }
@@ -1503,7 +1514,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1503 1514
         }
1504 1515
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) {
1505 1516
             failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;");
1506
-        } else if (! IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
1517
+        } else if (!IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
1507 1518
             failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;");
1508 1519
         }
1509 1520
         String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent();
@@ -1533,7 +1544,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1533 1544
         }
1534 1545
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) {
1535 1546
             failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;");
1536
-        } else if (! IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
1547
+        } else if (!IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
1537 1548
             failureMsg.append("【被申请人主体信息-身份证号】不合法;");
1538 1549
         }
1539 1550
         String debtorContactTelphone = caseApplication.getDebtorContactTelphone();
@@ -1570,7 +1581,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1570 1581
         }
1571 1582
         if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) {
1572 1583
             failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;");
1573
-        } else if(!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()){
1584
+        } else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) {
1574 1585
 
1575 1586
             failureMsg.append("【被申请人主体信息-邮箱】字段不合法;");
1576 1587
         }
@@ -1676,7 +1687,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1676 1687
         }
1677 1688
         if (StrUtil.isEmpty(caseApplication.getEmail())) {
1678 1689
             failureMsg.append("【申请人主体信息-邮箱】字段不能为空;");
1679
-        } else if(!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()){
1690
+        } else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) {
1680 1691
 
1681 1692
             failureMsg.append("【申请人主体信息-邮箱】字段不合法;");
1682 1693
         }
@@ -1974,7 +1985,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1974 1985
                                                 EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord, sealIdList);
1975 1986
 
1976 1987
                                                 JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1977
-                                                if (jsonObject3 != null){
1988
+                                                if (jsonObject3 != null) {
1978 1989
                                                     if (jsonObject3.getIntValue("code") == 0) {
1979 1990
                                                         //获取签署流程ID
1980 1991
                                                         JSONObject data1 = jsonObject3.getJSONObject("data");
@@ -1987,7 +1998,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1987 1998
                                                     } else {
1988 1999
                                                         throw new ServiceException("发起签署流程失败,请检查参数是否有误");
1989 2000
                                                     }
1990
-                                                }else {
2001
+                                                } else {
1991 2002
                                                     return AjaxResult.error();
1992 2003
                                                 }
1993 2004
 
@@ -2738,14 +2749,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2738 2749
      */
2739 2750
     @Transactional
2740 2751
     @Override
2741
-    public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO)  {
2752
+    public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) {
2742 2753
 
2743 2754
         // 新增预约会议表
2744
-        ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(),SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
2745
-                            reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
2755
+        ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
2756
+                reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
2746 2757
 
2747
-    reservedConferenceMapper.insert(conference);
2748
-    return success("预约会议成功");
2758
+        reservedConferenceMapper.insert(conference);
2759
+        return success("预约会议成功");
2749 2760
     }
2750 2761
 
2751 2762
 
@@ -2774,10 +2785,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2774 2785
         // 查询最大房间号
2775 2786
         Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
2776 2787
 
2777
-        if (null == maxRoomId || maxRoomId >4294967294L) {
2788
+        if (null == maxRoomId || maxRoomId > 4294967294L) {
2778 2789
             return 1L;
2779 2790
         } else {
2780
-            return maxRoomId+1;
2791
+            return maxRoomId + 1;
2781 2792
         }
2782 2793
 
2783 2794
     }
@@ -2833,9 +2844,144 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2833 2844
     @Override
2834 2845
     public AjaxResult deleteRoom(String roomId) {
2835 2846
 
2836
-        return success( reservedConferenceMapper.deleteByRoomId(roomId));
2847
+        return success(reservedConferenceMapper.deleteByRoomId(roomId));
2848
+    }
2849
+
2850
+    @Override
2851
+    public AjaxResult uploadCaseZipFile(MultipartFile file) {
2852
+        if (file.isEmpty()) {
2853
+            return AjaxResult.error("请选择要上传的文件");
2854
+        }
2855
+        //String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
2856
+        UUID uuid = UUID.randomUUID();
2857
+        String targetPath = "D:\\home\\unzip\\"+uuid+"\\";
2858
+        File zipFile = null;
2859
+        InputStream ins = null;
2860
+        try {
2861
+            ins = file.getInputStream();
2862
+            String savePath = "D:\\develop\\java\\";
2863
+            String saveName = uuid+file.getOriginalFilename();
2864
+            zipFile = new File(savePath+saveName);
2865
+            inputChangeToFile(ins, zipFile);
2866
+        } catch (IOException e) {
2867
+            e.printStackTrace();
2868
+        }
2869
+        //解压缩上传的压缩包
2870
+        boolean unzipSuccess  = UnZipFileUtils.unZipFile(zipFile, targetPath);
2871
+        if (unzipSuccess ) {
2872
+            //去掉后缀名,拿到解压后的文件夹路径
2873
+            String fileName = file.getOriginalFilename();
2874
+            String nameWithoutExtension = fileName.substring(0, fileName.lastIndexOf("."));
2875
+            File directory = new File(targetPath);
2876
+            List<String> andConvertPDF = findAndConvertPDF(directory);
2877
+            if (andConvertPDF != null && andConvertPDF.size() > 0){
2878
+                // 返回找到的PDF文件路径
2879
+                return AjaxResult.success(andConvertPDF);
2880
+            }else {
2881
+                // 没有找到符合条件的文件
2882
+                return AjaxResult.error("未找到符合条件的文件");
2883
+            }
2884
+        }else {
2885
+            // 解压失败
2886
+            return AjaxResult.error("解压失败");
2887
+        }
2888
+
2889
+    }
2890
+    public static List<String> findAndConvertPDF(File directory) {
2891
+        List<String> pdfPaths = new ArrayList<>();
2892
+        if (directory.isFile()) {
2893
+            String path = "";
2894
+            // 如果传入的参数是一个文件
2895
+            if (directory.getName().contains("仲裁申请书")) {
2896
+                if (isPDF(directory)) {
2897
+                    // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
2898
+                    path = directory.getAbsolutePath();
2899
+                } else {
2900
+                    // 如果不是PDF格式,进行转换成PDF并返回路径
2901
+                    String pdfPath = convertToPDF(directory);
2902
+                    if (pdfPath != null) {
2903
+                        path = pdfPath;
2904
+                    }
2905
+                }
2906
+                if (path!= null) {
2907
+                    pdfPaths.add(path);
2908
+                }
2909
+            }
2910
+        } else if (directory.isDirectory()) {
2911
+            searchAndConvertPDF(directory, pdfPaths);
2912
+        }else {
2913
+            return null;
2914
+        }
2915
+      return pdfPaths;
2916
+    }
2917
+
2918
+    public static boolean isPDF(File file) {
2919
+        String extension = getFileExtension(file);
2920
+        return extension.equalsIgnoreCase("pdf");
2837 2921
     }
2838 2922
 
2923
+    public static String getFileExtension(File file) {
2924
+        String name = file.getName();
2925
+        int lastIndexOfDot = name.lastIndexOf(".");
2926
+        if (lastIndexOfDot != -1 && lastIndexOfDot < name.length() - 1) {
2927
+            return name.substring(lastIndexOfDot + 1);
2928
+        } else {
2929
+            return "";
2930
+        }
2931
+    }
2932
+    public static void searchAndConvertPDF(File directory, List<String> pdfPaths) {
2933
+        File[] files = directory.listFiles();
2934
+        if (files != null) {
2935
+            for (File file : files) {
2936
+                if (file.isFile()) {
2937
+                    // 如果是文件且文件名包含"仲裁申请书"
2938
+                    if (file.getName().contains("仲裁申请书")) {
2939
+                        if (isPDF(file)) {
2940
+                            // 如果是PDF格式,直接添加到列表中
2941
+                            pdfPaths.add(file.getAbsolutePath());
2942
+                        } else {
2943
+                            // 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
2944
+                            String pdfPath = convertToPDF(file);
2945
+                            if (pdfPath != null) {
2946
+                                pdfPaths.add(pdfPath);
2947
+                            }
2948
+                        }
2949
+                    }
2950
+                } else if (file.isDirectory()) {
2951
+                    // 如果是目录,递归查找
2952
+                    searchAndConvertPDF(file, pdfPaths);
2953
+                }
2954
+            }
2955
+        }
2956
+    }
2957
+    private static String convertToPDF(File file) {
2958
+        String wordFilePath = file.getAbsolutePath();
2959
+        String pdfSaveDirectory ="D:\\home\\unzip\\wordToPDF\\";
2960
+        File directory = new File(pdfSaveDirectory);
2961
+        if (!directory.exists()) {
2962
+            directory.mkdirs();
2963
+        }
2964
+        String name = file.getName();
2965
+        String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
2966
+        String pdfFilePath =pdfSaveDirectory+nameWithoutExtension+".pdf";
2967
+        File inputWord = new File(wordFilePath);
2968
+        File outputFile = new File(pdfFilePath);
2969
+        try  {
2970
+            InputStream docxInputStream = new FileInputStream(inputWord);
2971
+            OutputStream outputStream = new FileOutputStream(outputFile);
2972
+            IConverter converter = LocalConverter.builder().build();
2973
+            converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
2974
+            docxInputStream.close();
2975
+            outputStream.close();
2976
+            System.out.println("success");
2977
+            File file1= new File(pdfFilePath);
2978
+            System.out.println("这是转化后的PDF文件路径"+file1);
2979
+
2980
+        } catch (Exception e) {
2981
+            e.printStackTrace();
2982
+        }
2983
+        return pdfFilePath;
2984
+    }
2839 2985
 }
2840 2986
 
2841 2987
 

+ 0
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java ファイルの表示

@@ -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 ファイルの表示

@@ -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
     }

+ 52
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/Tset.java ファイルの表示

@@ -0,0 +1,52 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import com.documents4j.api.DocumentType;
4
+import com.documents4j.api.IConverter;
5
+import com.documents4j.job.LocalConverter;
6
+import com.tencentcloudapi.common.Credential;
7
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
8
+import com.tencentcloudapi.common.profile.ClientProfile;
9
+import com.tencentcloudapi.common.profile.HttpProfile;
10
+import com.tencentcloudapi.ocr.v20181119.OcrClient;
11
+import com.tencentcloudapi.ocr.v20181119.models.GeneralAccurateOCRRequest;
12
+import com.tencentcloudapi.ocr.v20181119.models.GeneralAccurateOCRResponse;
13
+
14
+
15
+import java.io.*;
16
+
17
+public class Tset {
18
+    public static void main(String[] args) {
19
+        //API的SecretId
20
+       final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp";
21
+        //API的SecretKey
22
+         final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V";
23
+
24
+        String pdfFilePath = "D:\\data\\1. 仲裁申请书-陈博.pdf";
25
+
26
+        try{
27
+            // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
28
+            // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
29
+            // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
30
+            Credential cred = new Credential(SECRET_ID, SECRET_KEY);
31
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
32
+            HttpProfile httpProfile = new HttpProfile();
33
+            httpProfile.setEndpoint("ocr.tencentcloudapi.com");
34
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
35
+            ClientProfile clientProfile = new ClientProfile();
36
+            clientProfile.setHttpProfile(httpProfile);
37
+            // 实例化要请求产品的client对象,clientProfile是可选的
38
+            OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile);
39
+            // 实例化一个请求对象,每个接口都会对应一个request对象
40
+            GeneralAccurateOCRRequest req = new GeneralAccurateOCRRequest();
41
+            req.setImageUrl(pdfFilePath);
42
+            req.setIsPdf(true);
43
+            req.setPdfPageNumber(1L);
44
+            // 返回的resp是一个GeneralAccurateOCRResponse的实例,与请求对象对应
45
+            GeneralAccurateOCRResponse resp = client.GeneralAccurateOCR(req);
46
+            // 输出json格式的字符串回包
47
+            System.out.println(GeneralAccurateOCRResponse.toJsonString(resp));
48
+        } catch (TencentCloudSDKException e) {
49
+            System.out.println(e.toString());
50
+        }
51
+    }
52
+}

+ 15
- 47
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java ファイルの表示

@@ -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
 }