|
|
@@ -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,7 +54,7 @@ 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);
|
|
61
|
|
-
|
|
|
57
|
+ // 获取自动编码
|
|
62
|
58
|
String caseNum = generateCaseNum();
|
|
63
|
59
|
caseApplication.setCaseNum(caseNum);
|
|
64
|
60
|
|
|
|
@@ -83,15 +79,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
83
|
79
|
return rows;
|
|
84
|
80
|
}
|
|
85
|
81
|
|
|
|
82
|
+ /**
|
|
|
83
|
+ * 获取自动编码
|
|
|
84
|
+ * @return
|
|
|
85
|
+ */
|
|
|
86
|
+
|
|
86
|
87
|
private String generateCaseNum() {
|
|
87
|
|
- String currentday = DateUtils.dateTime();
|
|
88
|
|
- String caseNum = "zc"+ currentday;
|
|
89
|
|
- //查询出当天的案件编号的最大值 ,如等于1
|
|
90
|
|
- Integer caseNumMax = 1;
|
|
91
|
|
- if(caseNumMax!=null){
|
|
92
|
|
- //根据查询到的caseNumMax拼接一个案件编号
|
|
|
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";
|
|
93
|
95
|
}else {
|
|
94
|
|
- caseNum += "001";
|
|
|
96
|
+ caseNum = caseNum + String.format("%03d", maxCaseNum);
|
|
95
|
97
|
}
|
|
96
|
98
|
return caseNum;
|
|
97
|
99
|
|
|
|
@@ -105,13 +107,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
105
|
107
|
@Override
|
|
106
|
108
|
@Transactional
|
|
107
|
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
|
+
|
|
108
|
116
|
int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
|
|
109
|
117
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
110
|
118
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
111
|
119
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
|
120
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
112
|
121
|
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
113
|
122
|
}
|
|
114
|
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
|
+ }
|
|
115
|
132
|
|
|
116
|
133
|
return rows;
|
|
117
|
134
|
}
|
|
|
@@ -191,38 +208,47 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
191
|
208
|
@Override
|
|
192
|
209
|
@Transactional
|
|
193
|
210
|
public String importCaseApplication(List<CaseApplication> caseApplicationList, String operName) {
|
|
194
|
|
- StringBuilder successMsg = new StringBuilder();
|
|
195
|
211
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
212
|
+ StringBuilder successMsg = new StringBuilder();
|
|
196
|
213
|
int successNum = 0;
|
|
197
|
214
|
int failureNum = 0;
|
|
198
|
215
|
if(caseApplicationList!=null&&caseApplicationList.size()>0){
|
|
199
|
216
|
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
|
|
200
|
217
|
for (int i = 0; i < caseApplicationList.size(); i++){
|
|
201
|
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
|
+
|
|
202
|
225
|
//赋值CaseApplication的案件关联人信息
|
|
203
|
226
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
204
|
227
|
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
|
|
205
|
228
|
|
|
206
|
|
- int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
207
|
|
- if(caseApplicationCount>0){
|
|
208
|
|
- failureNum++;
|
|
209
|
|
- failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
210
|
|
- }else {
|
|
211
|
|
- caseApplicationListinsert.add(caseApplication);
|
|
212
|
|
- }
|
|
|
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);
|
|
213
|
237
|
}
|
|
|
238
|
+
|
|
214
|
239
|
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
215
|
|
- List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
216
|
|
- collectingAndThen(
|
|
217
|
|
- toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
218
|
|
- ArrayList::new));
|
|
|
240
|
+// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
|
241
|
+// collectingAndThen(
|
|
|
242
|
+// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
243
|
+// ArrayList::new));
|
|
219
|
244
|
|
|
220
|
245
|
|
|
221
|
246
|
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
|
|
222
|
|
- if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
223
|
|
- List<CaseApplication> caseApplicationNewList = new ArrayList<>();
|
|
224
|
|
- for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
|
|
225
|
|
- 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);
|
|
226
|
252
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
227
|
253
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
228
|
254
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
|
@@ -244,6 +270,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
244
|
270
|
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
|
|
245
|
271
|
// 新增立案信息
|
|
246
|
272
|
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
|
|
273
|
+ // 设置自动编码
|
|
|
274
|
+ caseApplicationItera.setCaseNum(generateCaseNum());
|
|
247
|
275
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
|
|
248
|
276
|
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
|
|
249
|
277
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
@@ -256,7 +284,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
256
|
284
|
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
257
|
285
|
}
|
|
258
|
286
|
|
|
259
|
|
- }
|
|
|
287
|
+// }
|
|
260
|
288
|
|
|
261
|
289
|
}
|
|
262
|
290
|
|
|
|
@@ -265,8 +293,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
265
|
293
|
}else {
|
|
266
|
294
|
throw new ServiceException("导入立案申请数据不能为空!");
|
|
267
|
295
|
}
|
|
|
296
|
+ // 编号存在不导入
|
|
|
297
|
+ if(StringUtils.isNotEmpty(failureMsg)){
|
|
|
298
|
+ return failureMsg.append(successMsg).toString();
|
|
|
299
|
+ }else {
|
|
268
|
300
|
|
|
269
|
|
- return successMsg.toString();
|
|
|
301
|
+ return successMsg.toString();
|
|
|
302
|
+ }
|
|
270
|
303
|
}
|
|
271
|
304
|
|
|
272
|
305
|
@Override
|
|
|
@@ -362,7 +395,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
362
|
395
|
@Override
|
|
363
|
396
|
public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) {
|
|
364
|
397
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication);
|
|
|
398
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
399
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
400
|
+ List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
401
|
+ if(caseAffiliatListeselect!=null){
|
|
|
402
|
+ StringBuffer applicantName = new StringBuffer();
|
|
|
403
|
+ for (int i = 0; i < caseAffiliatListeselect.size(); i++){
|
|
|
404
|
+ CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
|
|
|
405
|
+ int identityType = caseAffiliateselect.getIdentityType();
|
|
|
406
|
+ if(identityType==1){
|
|
|
407
|
+ applicantName.append(caseAffiliateselect.getName()).append(",");;
|
|
|
408
|
+ }
|
|
|
409
|
+ }
|
|
|
410
|
+ caseApplicationselect.setApplicantName(applicantName.toString());
|
|
365
|
411
|
|
|
|
412
|
+
|
|
|
413
|
+ }
|
|
366
|
414
|
return caseApplicationselect;
|
|
367
|
415
|
}
|
|
368
|
416
|
|
|
|
@@ -374,7 +422,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
374
|
422
|
|
|
375
|
423
|
//发送短信通知
|
|
376
|
424
|
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
377
|
|
- request.setTemplateId("1931000");
|
|
|
425
|
+ request.setTemplateId("1947342");
|
|
378
|
426
|
|
|
379
|
427
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
380
|
428
|
String caseNum = caseApplicationselect.getCaseNum();
|
|
|
@@ -398,7 +446,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
398
|
446
|
Arbitrator arbitratorselect = arbitratorList.get(i);
|
|
399
|
447
|
//给仲裁员发送短信通知
|
|
400
|
448
|
request.setPhone(arbitratorselect.getTelephone());
|
|
401
|
|
- // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
449
|
+ // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
402
|
450
|
String name = arbitratorselect.getArbitratorName();
|
|
403
|
451
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
404
|
452
|
SmsUtils.sendSms(request);
|
|
|
@@ -415,7 +463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
415
|
463
|
int identityType = caseAffiliateselect.getIdentityType();
|
|
416
|
464
|
//给申请人、被申请人发送短信通知
|
|
417
|
465
|
request.setPhone(caseAffiliateselect.getContactTelphone());
|
|
418
|
|
- // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
466
|
+ // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
419
|
467
|
String name = caseAffiliateselect.getName();
|
|
420
|
468
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
421
|
469
|
SmsUtils.sendSms(request);
|
|
|
@@ -478,6 +526,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
478
|
526
|
caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
|
|
479
|
527
|
caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
|
|
480
|
528
|
caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
|
|
|
529
|
+ caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
|
|
481
|
530
|
}
|
|
482
|
531
|
|
|
483
|
532
|
|