|
|
@@ -21,10 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
21
|
21
|
import org.springframework.stereotype.Service;
|
|
22
|
22
|
import org.springframework.transaction.annotation.Transactional;
|
|
23
|
23
|
|
|
24
|
|
-import java.util.Date;
|
|
25
|
|
-import java.util.List;
|
|
26
|
|
-import java.util.Map;
|
|
27
|
|
-import java.util.Objects;
|
|
|
24
|
+import java.util.*;
|
|
28
|
25
|
import java.util.function.Function;
|
|
29
|
26
|
import java.util.stream.Collectors;
|
|
30
|
27
|
|
|
|
@@ -53,6 +50,13 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
53
|
50
|
private SmsRecordMapper smsRecordMapper;
|
|
54
|
51
|
@Autowired
|
|
55
|
52
|
private ICaseApplicationService caseApplicationService;
|
|
|
53
|
+ // 对比两个版本修改的字段,基本字段对比
|
|
|
54
|
+ private static final String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
|
|
|
55
|
+ "claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
|
|
|
56
|
+ // 人员字段对比
|
|
|
57
|
+ private static final String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
|
|
|
58
|
+ "nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
|
|
|
59
|
+ "compLegalperPost","responSex","responBirth"};
|
|
56
|
60
|
@Override
|
|
57
|
61
|
public int insert(CaseApplication caseApplicationLog) {
|
|
58
|
62
|
return caseApplicationLogMapper.insert(caseApplicationLog);
|
|
|
@@ -149,40 +153,28 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
149
|
153
|
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
|
150
|
154
|
// 更新记录附件表
|
|
151
|
155
|
if(CollectionUtil.isNotEmpty(attachLogList)){
|
|
152
|
|
- // caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
|
|
153
|
156
|
for (CaseAttach caseAttach : attachLogList) {
|
|
154
|
157
|
caseAttach.setCaseAppliId(vo.getCaseId());
|
|
155
|
158
|
caseAttachMapper.updateCaseAttach(caseAttach);
|
|
156
|
159
|
}
|
|
157
|
160
|
}
|
|
158
|
|
- // caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
|
|
159
|
161
|
} else {
|
|
160
|
162
|
// 拒绝,将日志表改版本的状态改为拒绝
|
|
161
|
163
|
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
|
|
162
|
164
|
caseApplicationLogMapper.updateStatus(vo);
|
|
163
|
165
|
return sendAuditMessage(vo);
|
|
164
|
|
-
|
|
165
|
|
-
|
|
166
|
|
- // 修改案件表的版本号
|
|
167
|
|
- // caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
|
|
168
|
|
-
|
|
169
|
166
|
}
|
|
170
|
167
|
return AjaxResult.success();
|
|
171
|
168
|
} else if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.REVOKE.getCode())) {
|
|
172
|
|
- // 如果版本号为1,则直接返回
|
|
173
|
|
-
|
|
174
|
169
|
// 审核修改撤销状态
|
|
175
|
170
|
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
|
|
|
171
|
+ // 同意撤销
|
|
176
|
172
|
agreeRevoke(vo);
|
|
177
|
|
- // 同意撤销,查询日志记录表上个版本数据,将数据更新到主表,并将日志表改版本的状态改为同意撤销
|
|
178
|
|
-
|
|
179
|
173
|
} else {
|
|
180
|
174
|
// 拒绝撤销,将日志表改版本的状态改为拒绝撤销
|
|
181
|
175
|
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode());
|
|
182
|
176
|
caseApplicationLogMapper.updateStatus(vo);
|
|
183
|
177
|
return sendAuditMessage(vo);
|
|
184
|
|
- // 修改案件表的版本号
|
|
185
|
|
- // caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
|
|
186
|
178
|
}
|
|
187
|
179
|
return AjaxResult.success();
|
|
188
|
180
|
}
|
|
|
@@ -234,34 +226,43 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
234
|
226
|
|
|
235
|
227
|
@Override
|
|
236
|
228
|
public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
|
|
237
|
|
- // 查询当前版本号和上一个版本号的案件
|
|
|
229
|
+ // 查询当前版本号和主表的案件
|
|
238
|
230
|
CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
|
239
|
|
- // CaseApplication beforeCase = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion());
|
|
240
|
231
|
CaseApplication caseApplication = new CaseApplication();
|
|
241
|
232
|
caseApplication.setCaseAppliId(vo.getCaseId());
|
|
242
|
233
|
caseApplication.setId(vo.getCaseId());
|
|
243
|
234
|
CaseApplication beforeCase= caseApplicationService.selectCaseApplication(caseApplication);
|
|
244
|
235
|
|
|
245
|
236
|
// 查询案件关联人员
|
|
246
|
|
- // beforeCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(beforeCase.getCaseLogId()));
|
|
247
|
237
|
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
|
|
248
|
238
|
// 查询附件
|
|
249
|
239
|
CaseAttach caseAttach = new CaseAttach();
|
|
250
|
240
|
caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
|
|
251
|
241
|
caseAttach.setAnnexType(2);
|
|
252
|
242
|
caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
|
253
|
|
- // beforeCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
|
|
254
|
243
|
caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
|
|
255
|
|
- afterCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
|
|
|
244
|
+ List<CaseAttach> afterAttachList = caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
|
|
245
|
+ if(CollectionUtil.isNotEmpty(afterAttachList)){
|
|
|
246
|
+ for (CaseAttach attach : afterAttachList) {
|
|
|
247
|
+ String annexName = attach.getAnnexName();
|
|
|
248
|
+ String prefix = "/profile";
|
|
|
249
|
+ int startIndex = annexName.indexOf(prefix);
|
|
|
250
|
+ startIndex += prefix.length();
|
|
|
251
|
+ String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
|
252
|
+ attach.setAnnexPath(annexPath);
|
|
|
253
|
+ int startIndexnew = annexName.lastIndexOf("/");
|
|
|
254
|
+ if (startIndexnew != -1) {
|
|
|
255
|
+ String annexNamenew = annexName.substring(startIndexnew + 1);
|
|
|
256
|
+ attach.setAnnexName(annexNamenew);
|
|
|
257
|
+ }
|
|
|
258
|
+ }
|
|
|
259
|
+ afterCase.setCaseAttachList(afterAttachList);
|
|
|
260
|
+ }
|
|
|
261
|
+ afterCase.setCaseAttachList(afterAttachList);
|
|
256
|
262
|
CompareCaseVO compareCaseVO = new CompareCaseVO();
|
|
257
|
263
|
compareCaseVO.setBeforeCase(beforeCase);
|
|
258
|
264
|
compareCaseVO.setAfterCase(afterCase);
|
|
259
|
|
- // 对比两个版本修改的字段
|
|
260
|
|
- String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
|
|
261
|
|
- "claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
|
|
262
|
|
- String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
|
|
263
|
|
- "nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
|
|
264
|
|
- "compLegalperPost","responSex","responBirth"};
|
|
|
265
|
+
|
|
265
|
266
|
StringBuilder changeColumn = new StringBuilder();
|
|
266
|
267
|
// 对比基本字段
|
|
267
|
268
|
for (String column : columns) {
|
|
|
@@ -282,6 +283,54 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
282
|
283
|
}
|
|
283
|
284
|
|
|
284
|
285
|
}
|
|
|
286
|
+ // 对比案件人员字段
|
|
|
287
|
+ compareAffilate(beforeCase,afterCase);
|
|
|
288
|
+ // 对比申请人证据资料
|
|
|
289
|
+ compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase,afterCase,changeColumn).toString());
|
|
|
290
|
+
|
|
|
291
|
+ return AjaxResult.success(compareCaseVO);
|
|
|
292
|
+ }
|
|
|
293
|
+
|
|
|
294
|
+ /**
|
|
|
295
|
+ * 对比申请人证据资料
|
|
|
296
|
+ * @param beforeCase
|
|
|
297
|
+ * @param afterCase
|
|
|
298
|
+ * @param changeColumn
|
|
|
299
|
+ * @return
|
|
|
300
|
+ */
|
|
|
301
|
+ private StringBuilder compareApplicantFile(CaseApplication beforeCase, CaseApplication afterCase, StringBuilder changeColumn) {
|
|
|
302
|
+ List<CaseAttach> beforeAttachFilter =new ArrayList<>();
|
|
|
303
|
+ List<CaseAttach> afterAttachFilter =new ArrayList<>();
|
|
|
304
|
+ if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
|
|
|
305
|
+ beforeAttachFilter = beforeCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
|
|
|
306
|
+ }
|
|
|
307
|
+ if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
|
|
308
|
+ afterAttachFilter = afterCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
|
|
|
309
|
+ }
|
|
|
310
|
+ if(CollectionUtil.isNotEmpty(beforeAttachFilter)&& CollectionUtil.isNotEmpty(afterAttachFilter)){
|
|
|
311
|
+ if(beforeAttachFilter.size()!=afterAttachFilter.size()){
|
|
|
312
|
+ changeColumn.append("fileColumn");
|
|
|
313
|
+ }else {
|
|
|
314
|
+ Map<String, CaseAttach> afterAttachMap = afterAttachFilter.stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
|
|
|
315
|
+ for (CaseAttach beforeCaseAttach : beforeAttachFilter) {
|
|
|
316
|
+ if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
|
|
|
317
|
+ changeColumn.append("fileColumn");
|
|
|
318
|
+ break;
|
|
|
319
|
+ }
|
|
|
320
|
+ }
|
|
|
321
|
+ }
|
|
|
322
|
+ }
|
|
|
323
|
+
|
|
|
324
|
+
|
|
|
325
|
+ return changeColumn;
|
|
|
326
|
+ }
|
|
|
327
|
+
|
|
|
328
|
+ /**
|
|
|
329
|
+ * 对比案件人员字段
|
|
|
330
|
+ * @param beforeCase
|
|
|
331
|
+ * @param afterCase
|
|
|
332
|
+ */
|
|
|
333
|
+ private void compareAffilate(CaseApplication beforeCase, CaseApplication afterCase) {
|
|
285
|
334
|
// 对比人员字段
|
|
286
|
335
|
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
|
|
287
|
336
|
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
|
|
|
@@ -344,50 +393,6 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
344
|
393
|
|
|
345
|
394
|
|
|
346
|
395
|
}
|
|
347
|
|
- boolean notEmptyFlag = CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isEmpty(afterCase.getCaseAttachList());
|
|
348
|
|
- boolean emptyFlag = CollectionUtil.isEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList());
|
|
349
|
|
- // 对比附件
|
|
350
|
|
- if(notEmptyFlag || emptyFlag){
|
|
351
|
|
- changeColumn.append("fileColumn");
|
|
352
|
|
- }else if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
|
353
|
|
- if(beforeCase.getCaseAttachList().size()!=afterCase.getCaseAttachList().size()){
|
|
354
|
|
- changeColumn.append("fileColumn");
|
|
355
|
|
- }else {
|
|
356
|
|
- Map<String, CaseAttach> afterAttachMap = afterCase.getCaseAttachList().stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
|
|
357
|
|
-
|
|
358
|
|
-
|
|
359
|
|
- for (CaseAttach beforeCaseAttach : beforeCase.getCaseAttachList()) {
|
|
360
|
|
- if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
|
|
361
|
|
- changeColumn.append("fileColumn");
|
|
362
|
|
- break;
|
|
363
|
|
- }
|
|
364
|
|
- }
|
|
365
|
|
- }
|
|
366
|
|
-
|
|
367
|
|
-
|
|
368
|
|
- }
|
|
369
|
|
- compareCaseVO.setChangeColumn(changeColumn.toString());
|
|
370
|
|
- if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
|
371
|
|
- List<CaseAttach> caseAttachList = afterCase.getCaseAttachList();
|
|
372
|
|
- for (CaseAttach attach : caseAttachList) {
|
|
373
|
|
- String annexName = attach.getAnnexName();
|
|
374
|
|
- String prefix = "/profile";
|
|
375
|
|
- int startIndex = annexName.indexOf(prefix);
|
|
376
|
|
- startIndex += prefix.length();
|
|
377
|
|
- String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
378
|
|
- attach.setAnnexPath(annexPath);
|
|
379
|
|
- int startIndexnew = annexName.lastIndexOf("/");
|
|
380
|
|
- if (startIndexnew != -1) {
|
|
381
|
|
- String annexNamenew = annexName.substring(startIndexnew + 1);
|
|
382
|
|
- attach.setAnnexName(annexNamenew);
|
|
383
|
|
- }
|
|
384
|
|
-
|
|
385
|
|
-
|
|
386
|
|
- }
|
|
387
|
|
- afterCase.setCaseAttachList(caseAttachList);
|
|
388
|
|
- }
|
|
389
|
|
-
|
|
390
|
|
- return AjaxResult.success(compareCaseVO);
|
|
391
|
396
|
}
|
|
392
|
397
|
|
|
393
|
398
|
/**
|
|
|
@@ -432,12 +437,10 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
432
|
437
|
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
|
433
|
438
|
// 更新记录附件表
|
|
434
|
439
|
if(CollectionUtil.isNotEmpty(attachLogList)){
|
|
435
|
|
- // caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
|
|
436
|
440
|
for (CaseAttach caseAttach : attachLogList) {
|
|
437
|
441
|
caseAttach.setCaseAppliId(vo.getCaseId());
|
|
438
|
442
|
caseAttachMapper.updateCaseAttach(caseAttach);
|
|
439
|
443
|
}
|
|
440
|
444
|
}
|
|
441
|
|
- // caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
|
|
442
|
445
|
}
|
|
443
|
446
|
}
|