|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
|
3
|
+
|
|
3
|
4
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
4
|
5
|
import com.ruoyi.common.exception.ServiceException;
|
|
5
|
6
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
@@ -12,16 +13,11 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
12
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
13
|
14
|
import org.springframework.stereotype.Service;
|
|
14
|
15
|
import org.springframework.transaction.annotation.Transactional;
|
|
15
|
|
-
|
|
16
|
|
-import java.lang.reflect.Field;
|
|
17
|
16
|
import java.math.BigDecimal;
|
|
18
|
17
|
import java.text.SimpleDateFormat;
|
|
19
|
18
|
import java.util.*;
|
|
20
|
19
|
import java.util.stream.Collectors;
|
|
21
|
20
|
|
|
22
|
|
-import static com.ruoyi.common.core.domain.AjaxResult.error;
|
|
23
|
|
-import static java.util.stream.Collectors.collectingAndThen;
|
|
24
|
|
-import static java.util.stream.Collectors.toCollection;
|
|
25
|
21
|
|
|
26
|
22
|
@Service
|
|
27
|
23
|
public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
@@ -58,6 +54,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
58
|
54
|
BigDecimal feeRate = new BigDecimal(0.01);
|
|
59
|
55
|
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
60
|
56
|
caseApplication.setFeePayable(feePayable);
|
|
|
57
|
+ // 获取自动编码
|
|
|
58
|
+ String caseNum = generateCaseNum();
|
|
|
59
|
+ caseApplication.setCaseNum(caseNum);
|
|
61
|
60
|
|
|
62
|
61
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
|
|
63
|
62
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
|
@@ -80,6 +79,26 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
80
|
79
|
return rows;
|
|
81
|
80
|
}
|
|
82
|
81
|
|
|
|
82
|
+ /**
|
|
|
83
|
+ * 获取自动编码
|
|
|
84
|
+ * @return
|
|
|
85
|
+ */
|
|
|
86
|
+
|
|
|
87
|
+ private String generateCaseNum() {
|
|
|
88
|
+ // 自动编码格式 zc+yyyyMMdd+001
|
|
|
89
|
+ String currentDay = DateUtils.dateTime();
|
|
|
90
|
+ String caseNum = "zc"+ currentDay;
|
|
|
91
|
+ //查询出当天的案件编号的最大值
|
|
|
92
|
+ Integer maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum,caseNum.length());
|
|
|
93
|
+ if(null == maxCaseNum){
|
|
|
94
|
+ caseNum = caseNum + "001";
|
|
|
95
|
+ }else {
|
|
|
96
|
+ caseNum = caseNum + String.format("%03d", maxCaseNum);
|
|
|
97
|
+ }
|
|
|
98
|
+ return caseNum;
|
|
|
99
|
+
|
|
|
100
|
+ }
|
|
|
101
|
+
|
|
83
|
102
|
@Override
|
|
84
|
103
|
public int selectCaseApplicationCount(CaseApplication caseApplication) {
|
|
85
|
104
|
return caseApplicationMapper.selectCaseApplicationCount(caseApplication);
|
|
|
@@ -88,13 +107,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
88
|
107
|
@Override
|
|
89
|
108
|
@Transactional
|
|
90
|
109
|
public int editCaseApplication(CaseApplication caseApplication) {
|
|
|
110
|
+ //根据仲裁费用计费规则计算应缴费用
|
|
|
111
|
+ //暂时设置计费比率为0.01
|
|
|
112
|
+ BigDecimal feeRate = new BigDecimal(0.01);
|
|
|
113
|
+ BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
114
|
+ caseApplication.setFeePayable(feePayable);
|
|
|
115
|
+
|
|
91
|
116
|
int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
|
|
92
|
117
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
93
|
118
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
94
|
119
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
|
120
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
95
|
121
|
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
96
|
122
|
}
|
|
97
|
123
|
}
|
|
|
124
|
+ List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
|
|
|
125
|
+ if(caseAttachList!=null&&caseAttachList.size()>0){
|
|
|
126
|
+ for (CaseAttach caseAttach : caseAttachList){
|
|
|
127
|
+ caseAttach.setCaseAppliId(caseApplication.getId());
|
|
|
128
|
+ caseAttachMapper.updateCaseAttach(caseAttach);
|
|
|
129
|
+ }
|
|
|
130
|
+
|
|
|
131
|
+ }
|
|
98
|
132
|
|
|
99
|
133
|
return rows;
|
|
100
|
134
|
}
|
|
|
@@ -174,38 +208,49 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
174
|
208
|
@Override
|
|
175
|
209
|
@Transactional
|
|
176
|
210
|
public String importCaseApplication(List<CaseApplication> caseApplicationList, String operName) {
|
|
177
|
|
- StringBuilder successMsg = new StringBuilder();
|
|
178
|
211
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
212
|
+ StringBuilder successMsg = new StringBuilder();
|
|
179
|
213
|
int successNum = 0;
|
|
180
|
214
|
int failureNum = 0;
|
|
181
|
215
|
if(caseApplicationList!=null&&caseApplicationList.size()>0){
|
|
182
|
216
|
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
|
|
183
|
217
|
for (int i = 0; i < caseApplicationList.size(); i++){
|
|
184
|
218
|
CaseApplication caseApplication = caseApplicationList.get(i);
|
|
|
219
|
+ //根据仲裁费用计费规则计算应缴费用
|
|
|
220
|
+ //暂时设置计费比率为0.01
|
|
|
221
|
+ BigDecimal feeRate = new BigDecimal(0.01);
|
|
|
222
|
+ BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
223
|
+ caseApplication.setFeePayable(feePayable);
|
|
|
224
|
+
|
|
185
|
225
|
//赋值CaseApplication的案件关联人信息
|
|
186
|
226
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
187
|
227
|
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
|
|
188
|
228
|
|
|
189
|
|
- int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
190
|
|
- if(caseApplicationCount>0){
|
|
191
|
|
- failureNum++;
|
|
192
|
|
- failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
193
|
|
- }else {
|
|
194
|
|
- caseApplicationListinsert.add(caseApplication);
|
|
195
|
|
- }
|
|
|
229
|
+// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
|
230
|
+// if(caseApplicationCount>0){
|
|
|
231
|
+// failureNum++;
|
|
|
232
|
+// failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
|
233
|
+// }else {
|
|
|
234
|
+// caseApplicationListinsert.add(caseApplication);
|
|
|
235
|
+// }
|
|
|
236
|
+ caseApplicationListinsert.add(caseApplication);
|
|
196
|
237
|
}
|
|
|
238
|
+
|
|
197
|
239
|
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
198
|
|
- List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
199
|
|
- collectingAndThen(
|
|
200
|
|
- toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
201
|
|
- ArrayList::new));
|
|
|
240
|
+// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
|
241
|
+// collectingAndThen(
|
|
|
242
|
+// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
243
|
+// ArrayList::new));
|
|
202
|
244
|
|
|
203
|
245
|
|
|
204
|
246
|
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
|
|
205
|
|
- if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
206
|
|
- List<CaseApplication> caseApplicationNewList = new ArrayList<>();
|
|
207
|
|
- for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
|
|
208
|
|
- CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
|
|
|
247
|
+// if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
|
248
|
+ List<CaseApplication> caseApplicationNewList = null;
|
|
|
249
|
+ for (int i = 0; i < caseApplicationListinsert.size(); i++){
|
|
|
250
|
+ caseApplicationNewList = new ArrayList<>();
|
|
|
251
|
+ CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
|
|
|
252
|
+ // 设置自动编码
|
|
|
253
|
+ caseApplicationinsertDiffer.setCaseNum(generateCaseNum());
|
|
209
|
254
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
210
|
255
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
211
|
256
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
|
@@ -227,6 +272,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
227
|
272
|
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
|
|
228
|
273
|
// 新增立案信息
|
|
229
|
274
|
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
|
|
275
|
+
|
|
230
|
276
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
|
|
231
|
277
|
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
|
|
232
|
278
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
@@ -239,7 +285,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
239
|
285
|
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
240
|
286
|
}
|
|
241
|
287
|
|
|
242
|
|
- }
|
|
|
288
|
+// }
|
|
243
|
289
|
|
|
244
|
290
|
}
|
|
245
|
291
|
|
|
|
@@ -248,8 +294,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
248
|
294
|
}else {
|
|
249
|
295
|
throw new ServiceException("导入立案申请数据不能为空!");
|
|
250
|
296
|
}
|
|
|
297
|
+ // 编号存在不导入
|
|
|
298
|
+ if(StringUtils.isNotEmpty(failureMsg)){
|
|
|
299
|
+ return failureMsg.append(successMsg).toString();
|
|
|
300
|
+ }else {
|
|
251
|
301
|
|
|
252
|
|
- return successMsg.toString();
|
|
|
302
|
+ return successMsg.toString();
|
|
|
303
|
+ }
|
|
253
|
304
|
}
|
|
254
|
305
|
|
|
255
|
306
|
@Override
|
|
|
@@ -345,7 +396,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
345
|
396
|
@Override
|
|
346
|
397
|
public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) {
|
|
347
|
398
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication);
|
|
|
399
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
400
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
401
|
+ List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
402
|
+ if(caseAffiliatListeselect!=null){
|
|
|
403
|
+ StringBuffer applicantName = new StringBuffer();
|
|
|
404
|
+ for (int i = 0; i < caseAffiliatListeselect.size(); i++){
|
|
|
405
|
+ CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
|
|
|
406
|
+ int identityType = caseAffiliateselect.getIdentityType();
|
|
|
407
|
+ if(identityType==1){
|
|
|
408
|
+ applicantName.append(caseAffiliateselect.getName()).append(",");;
|
|
|
409
|
+ }
|
|
|
410
|
+ }
|
|
|
411
|
+ caseApplicationselect.setApplicantName(applicantName.toString());
|
|
348
|
412
|
|
|
|
413
|
+
|
|
|
414
|
+ }
|
|
349
|
415
|
return caseApplicationselect;
|
|
350
|
416
|
}
|
|
351
|
417
|
|
|
|
@@ -357,7 +423,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
357
|
423
|
|
|
358
|
424
|
//发送短信通知
|
|
359
|
425
|
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
360
|
|
- request.setTemplateId("1931000");
|
|
|
426
|
+ request.setTemplateId("1947342");
|
|
361
|
427
|
|
|
362
|
428
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
363
|
429
|
String caseNum = caseApplicationselect.getCaseNum();
|
|
|
@@ -381,7 +447,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
381
|
447
|
Arbitrator arbitratorselect = arbitratorList.get(i);
|
|
382
|
448
|
//给仲裁员发送短信通知
|
|
383
|
449
|
request.setPhone(arbitratorselect.getTelephone());
|
|
384
|
|
- // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
450
|
+ // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
385
|
451
|
String name = arbitratorselect.getArbitratorName();
|
|
386
|
452
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
387
|
453
|
SmsUtils.sendSms(request);
|
|
|
@@ -398,7 +464,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
398
|
464
|
int identityType = caseAffiliateselect.getIdentityType();
|
|
399
|
465
|
//给申请人、被申请人发送短信通知
|
|
400
|
466
|
request.setPhone(caseAffiliateselect.getContactTelphone());
|
|
401
|
|
- // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
467
|
+ // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
402
|
468
|
String name = caseAffiliateselect.getName();
|
|
403
|
469
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
404
|
470
|
SmsUtils.sendSms(request);
|
|
|
@@ -445,12 +511,41 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
445
|
511
|
|
|
446
|
512
|
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
|
|
447
|
513
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
514
|
+
|
|
448
|
515
|
// BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
|
|
449
|
516
|
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
|
|
|
517
|
+ caseAffiliate.setIdentityType(1);
|
|
450
|
518
|
caseAffiliatesnew.add(caseAffiliate);
|
|
|
519
|
+
|
|
|
520
|
+ // 组装被申请人信息
|
|
|
521
|
+ caseAffiliatesnew.add( buildDebtorInfo(caseApplication));
|
|
451
|
522
|
caseApplication.setCaseAffiliates(caseAffiliatesnew);
|
|
452
|
523
|
}
|
|
453
|
524
|
|
|
|
525
|
+ /**
|
|
|
526
|
+ * 组装被申请人信息
|
|
|
527
|
+ * @param caseApplication
|
|
|
528
|
+ * @return
|
|
|
529
|
+ */
|
|
|
530
|
+
|
|
|
531
|
+ private CaseAffiliate buildDebtorInfo(CaseApplication caseApplication) {
|
|
|
532
|
+ // 被申请人信息
|
|
|
533
|
+ CaseAffiliate debtorCaseAffiliate = new CaseAffiliate();
|
|
|
534
|
+ debtorCaseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
535
|
+ debtorCaseAffiliate.setIdentityType(2);
|
|
|
536
|
+ debtorCaseAffiliate.setName(caseApplication.getDebtorName());
|
|
|
537
|
+ debtorCaseAffiliate.setIdentityNum(caseApplication.getDebtorIdentityNum());
|
|
|
538
|
+ debtorCaseAffiliate.setContactTelphone(caseApplication.getDebtorContactTelphone());
|
|
|
539
|
+ debtorCaseAffiliate.setContactAddress(caseApplication.getDebtorContactAddress());
|
|
|
540
|
+ debtorCaseAffiliate.setWorkTelphone(caseApplication.getDebtorWorkTelphone());
|
|
|
541
|
+ debtorCaseAffiliate.setWorkAddress(caseApplication.getDebtorWorkAddress());
|
|
|
542
|
+ debtorCaseAffiliate.setNameAgent(caseApplication.getDebtorNameAgent());
|
|
|
543
|
+ debtorCaseAffiliate.setIdentityNumAgent(caseApplication.getDebtorIdentityNumAgent());
|
|
|
544
|
+ debtorCaseAffiliate.setContactTelphoneAgent(caseApplication.getDebtorContactTelphoneAgent());
|
|
|
545
|
+ debtorCaseAffiliate.setContactAddressAgent(caseApplication.getDebtorContactAddressAgent());
|
|
|
546
|
+ return debtorCaseAffiliate;
|
|
|
547
|
+ }
|
|
|
548
|
+
|
|
454
|
549
|
private void copyCaseApplication(CaseApplication caseApplicationinsertDiffer, CaseApplication caseApplicationNew) {
|
|
455
|
550
|
caseApplicationNew.setArbitratClaims(caseApplicationinsertDiffer.getArbitratClaims());
|
|
456
|
551
|
caseApplicationNew.setCaseNum(caseApplicationinsertDiffer.getCaseNum());
|
|
|
@@ -461,6 +556,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
461
|
556
|
caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
|
|
462
|
557
|
caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
|
|
463
|
558
|
caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
|
|
|
559
|
+ caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
|
|
464
|
560
|
}
|
|
465
|
561
|
|
|
466
|
562
|
|