|
|
@@ -3,12 +3,14 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|
3
|
3
|
import cn.hutool.core.collection.CollectionUtil;
|
|
4
|
4
|
import cn.hutool.core.util.StrUtil;
|
|
5
|
5
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
6
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
6
|
7
|
import com.ruoyi.common.enums.UpdateSubmitStatus;
|
|
7
|
8
|
import com.ruoyi.common.enums.YesOrNoEnum;
|
|
8
|
9
|
import com.ruoyi.common.utils.ObjectFieldUtils;
|
|
9
|
10
|
import com.ruoyi.common.utils.SmsUtils;
|
|
10
|
11
|
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
|
11
|
12
|
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
|
|
13
|
+import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
|
12
|
14
|
import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
|
|
13
|
15
|
import com.ruoyi.wisdomarbitrate.domain.vo.CompareCaseVO;
|
|
14
|
16
|
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
|
|
|
@@ -22,6 +24,7 @@ import java.util.Date;
|
|
22
|
24
|
import java.util.List;
|
|
23
|
25
|
import java.util.Map;
|
|
24
|
26
|
import java.util.Objects;
|
|
|
27
|
+import java.util.function.Function;
|
|
25
|
28
|
import java.util.stream.Collectors;
|
|
26
|
29
|
|
|
27
|
30
|
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
@@ -42,6 +45,10 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
42
|
45
|
@Autowired
|
|
43
|
46
|
private CaseAffiliateMapper caseAffiliateMapper;
|
|
44
|
47
|
@Autowired
|
|
|
48
|
+ private CaseAttachMapper caseAttachMapper;
|
|
|
49
|
+ @Autowired
|
|
|
50
|
+ private CaseAttachLogMapper caseAttachLogMapper;
|
|
|
51
|
+ @Autowired
|
|
45
|
52
|
private SmsRecordMapper smsRecordMapper;
|
|
46
|
53
|
@Override
|
|
47
|
54
|
public int insert(CaseApplication caseApplicationLog) {
|
|
|
@@ -105,6 +112,8 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
105
|
112
|
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
|
|
106
|
113
|
// 如果版本号为1,则直接返回
|
|
107
|
114
|
if(vo.getVersion() <= 1){
|
|
|
115
|
+ vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
|
|
|
116
|
+ caseApplicationLogMapper.updateStatus(vo);
|
|
108
|
117
|
return AjaxResult.success();
|
|
109
|
118
|
}
|
|
110
|
119
|
// 同意,查询日志记录表本版本数据,将数据更新到主表,并将日志表改版本的状态改为同意
|
|
|
@@ -123,8 +132,24 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
123
|
132
|
|
|
124
|
133
|
// 更新相关人员主表
|
|
125
|
134
|
if(CollectionUtil.isNotEmpty(affiliateLogList)){
|
|
|
135
|
+ caseAffiliateMapper.deleteByCaseId(vo.getCaseId());
|
|
126
|
136
|
for (CaseAffiliate caseAffiliate : affiliateLogList) {
|
|
127
|
|
- caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
|
137
|
+ caseAffiliate.setCaseAppliId(vo.getCaseId());
|
|
|
138
|
+
|
|
|
139
|
+ }
|
|
|
140
|
+ caseAffiliateMapper.batchCaseAffiliate(affiliateLogList);
|
|
|
141
|
+ }
|
|
|
142
|
+ // // 根据caseLogId查询案件记录附件表
|
|
|
143
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
144
|
+ caseApplication.setCaseLogId(caseApplicationLog.getCaseLogId());
|
|
|
145
|
+ caseApplication.setAnnexType(2);
|
|
|
146
|
+ List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
|
|
147
|
+ // 更新记录附件表
|
|
|
148
|
+ if(CollectionUtil.isNotEmpty(attachLogList)){
|
|
|
149
|
+ // caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
|
|
|
150
|
+ for (CaseAttach caseAttach : attachLogList) {
|
|
|
151
|
+ caseAttach.setCaseAppliId(vo.getCaseId());
|
|
|
152
|
+ caseAttachMapper.updateCaseAttach(caseAttach);
|
|
128
|
153
|
}
|
|
129
|
154
|
}
|
|
130
|
155
|
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
|
|
|
@@ -177,7 +202,6 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
177
|
202
|
return AjaxResult.success();
|
|
178
|
203
|
}
|
|
179
|
204
|
|
|
180
|
|
- // todo 给申请人发送短信
|
|
181
|
205
|
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
182
|
206
|
request.setTemplateId("1996949");
|
|
183
|
207
|
request.setPhone(caseAffiliate.getContactTelphone());
|
|
|
@@ -209,20 +233,29 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
209
|
233
|
public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
|
|
210
|
234
|
// 查询当前版本号和上一个版本号的案件
|
|
211
|
235
|
CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
|
212
|
|
- CaseApplication beforeCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
|
|
|
236
|
+ CaseApplication beforeCase = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion());
|
|
213
|
237
|
// 查询案件关联人员
|
|
214
|
238
|
beforeCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(beforeCase.getCaseLogId()));
|
|
215
|
239
|
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
|
|
|
240
|
+ // 查询附件
|
|
|
241
|
+ CaseAttach caseAttach = new CaseAttach();
|
|
|
242
|
+ caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
|
|
|
243
|
+ caseAttach.setAnnexType(2);
|
|
|
244
|
+ caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
|
|
245
|
+ beforeCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
|
|
|
246
|
+ caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
|
|
|
247
|
+ afterCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
|
|
216
|
248
|
CompareCaseVO compareCaseVO = new CompareCaseVO();
|
|
217
|
249
|
compareCaseVO.setBeforeCase(beforeCase);
|
|
218
|
250
|
compareCaseVO.setAfterCase(afterCase);
|
|
219
|
251
|
// 对比两个版本修改的字段
|
|
220
|
252
|
String[] columns = {"caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
|
|
221
|
253
|
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
|
|
222
|
|
- String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAdress","workTelphone","workAddress",
|
|
|
254
|
+ String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress",
|
|
223
|
255
|
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
|
|
224
|
256
|
"compLegalperPost","responSex","responBirth"};
|
|
225
|
257
|
StringBuilder changeColumn = new StringBuilder();
|
|
|
258
|
+ // 对比基本字段
|
|
226
|
259
|
for (String column : columns) {
|
|
227
|
260
|
String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
|
|
228
|
261
|
String afterValue = ObjectFieldUtils.getValue(afterCase, column);
|
|
|
@@ -241,6 +274,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
241
|
274
|
}
|
|
242
|
275
|
|
|
243
|
276
|
}
|
|
|
277
|
+ // 对比人员字段
|
|
244
|
278
|
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
|
|
245
|
279
|
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
|
|
246
|
280
|
Map<Integer, CaseAffiliate> beforeCaseCaseAffiliateMap = null;
|
|
|
@@ -257,8 +291,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
257
|
291
|
affiliateChangeColumn.append(column).append(",");
|
|
258
|
292
|
}
|
|
259
|
293
|
|
|
260
|
|
- }
|
|
261
|
|
- else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
|
|
|
294
|
+ } else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
|
|
262
|
295
|
affiliateChangeColumn = new StringBuilder();
|
|
263
|
296
|
for (String column : affiliateColumns) {
|
|
264
|
297
|
|
|
|
@@ -302,8 +335,49 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
302
|
335
|
}
|
|
303
|
336
|
|
|
304
|
337
|
|
|
|
338
|
+ }
|
|
|
339
|
+ boolean notEmptyFlag = CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isEmpty(afterCase.getCaseAttachList());
|
|
|
340
|
+ boolean emptyFlag = CollectionUtil.isEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList());
|
|
|
341
|
+ // 对比附件
|
|
|
342
|
+ if(notEmptyFlag || emptyFlag){
|
|
|
343
|
+ changeColumn.append("fileColumn");
|
|
|
344
|
+ }else if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
|
|
345
|
+ if(beforeCase.getCaseAttachList().size()!=afterCase.getCaseAttachList().size()){
|
|
|
346
|
+ changeColumn.append("fileColumn");
|
|
|
347
|
+ }else {
|
|
|
348
|
+ Map<String, CaseAttach> afterAttachMap = afterCase.getCaseAttachList().stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
|
|
|
349
|
+
|
|
|
350
|
+
|
|
|
351
|
+ for (CaseAttach beforeCaseAttach : beforeCase.getCaseAttachList()) {
|
|
|
352
|
+ if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
|
|
|
353
|
+ changeColumn.append("fileColumn");
|
|
|
354
|
+ break;
|
|
|
355
|
+ }
|
|
|
356
|
+ }
|
|
|
357
|
+ }
|
|
|
358
|
+
|
|
|
359
|
+
|
|
305
|
360
|
}
|
|
306
|
361
|
compareCaseVO.setChangeColumn(changeColumn.toString());
|
|
|
362
|
+ if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
|
|
363
|
+ List<CaseAttach> caseAttachList = afterCase.getCaseAttachList();
|
|
|
364
|
+ for (CaseAttach attach : caseAttachList) {
|
|
|
365
|
+ String annexName = attach.getAnnexName();
|
|
|
366
|
+ String prefix = "/profile";
|
|
|
367
|
+ int startIndex = annexName.indexOf(prefix);
|
|
|
368
|
+ startIndex += prefix.length();
|
|
|
369
|
+ String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
|
370
|
+ attach.setAnnexPath(annexPath);
|
|
|
371
|
+ int startIndexnew = annexName.lastIndexOf("/");
|
|
|
372
|
+ if (startIndexnew != -1) {
|
|
|
373
|
+ String annexNamenew = annexName.substring(startIndexnew + 1);
|
|
|
374
|
+ attach.setAnnexName(annexNamenew);
|
|
|
375
|
+ }
|
|
|
376
|
+
|
|
|
377
|
+
|
|
|
378
|
+ }
|
|
|
379
|
+ afterCase.setCaseAttachList(caseAttachList);
|
|
|
380
|
+ }
|
|
307
|
381
|
|
|
308
|
382
|
return AjaxResult.success(compareCaseVO);
|
|
309
|
383
|
}
|
|
|
@@ -319,7 +393,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
319
|
393
|
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() );
|
|
320
|
394
|
|
|
321
|
395
|
}else {
|
|
322
|
|
- caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
|
|
|
396
|
+ caseApplicationLog = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion() );
|
|
323
|
397
|
}
|
|
324
|
398
|
if (caseApplicationLog == null) {
|
|
325
|
399
|
return;
|
|
|
@@ -330,13 +404,30 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
|
330
|
404
|
// 根据caseLogId查询相关人员表
|
|
331
|
405
|
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
|
|
332
|
406
|
|
|
|
407
|
+
|
|
333
|
408
|
// 更新案件主表
|
|
334
|
409
|
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
|
|
335
|
410
|
|
|
336
|
411
|
// 更新相关人员主表
|
|
337
|
412
|
if(CollectionUtil.isNotEmpty(affiliateLogList)){
|
|
|
413
|
+ caseAffiliateMapper.deleteByCaseId(vo.getCaseId());
|
|
338
|
414
|
for (CaseAffiliate caseAffiliate : affiliateLogList) {
|
|
339
|
|
- caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
|
415
|
+ caseAffiliate.setCaseAppliId(vo.getCaseId());
|
|
|
416
|
+
|
|
|
417
|
+ }
|
|
|
418
|
+ caseAffiliateMapper.batchCaseAffiliate(affiliateLogList);
|
|
|
419
|
+ }
|
|
|
420
|
+ // // 根据caseLogId查询案件记录附件表
|
|
|
421
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
422
|
+ caseApplication.setCaseLogId(caseApplicationLog.getCaseLogId());
|
|
|
423
|
+ caseApplication.setAnnexType(2);
|
|
|
424
|
+ List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
|
|
425
|
+ // 更新记录附件表
|
|
|
426
|
+ if(CollectionUtil.isNotEmpty(attachLogList)){
|
|
|
427
|
+ // caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
|
|
|
428
|
+ for (CaseAttach caseAttach : attachLogList) {
|
|
|
429
|
+ caseAttach.setCaseAppliId(vo.getCaseId());
|
|
|
430
|
+ caseAttachMapper.updateCaseAttach(caseAttach);
|
|
340
|
431
|
}
|
|
341
|
432
|
}
|
|
342
|
433
|
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
|