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