|
|
@@ -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
|
|
|
|
@@ -224,28 +226,29 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
224
|
226
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
225
|
227
|
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
|
|
226
|
228
|
|
|
227
|
|
- int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
228
|
|
- if(caseApplicationCount>0){
|
|
229
|
|
- failureNum++;
|
|
230
|
|
- failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
231
|
|
- }else {
|
|
232
|
|
- caseApplicationListinsert.add(caseApplication);
|
|
233
|
|
- }
|
|
|
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);
|
|
234
|
237
|
}
|
|
235
|
238
|
|
|
236
|
239
|
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
237
|
|
- List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
238
|
|
- collectingAndThen(
|
|
239
|
|
- toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
240
|
|
- ArrayList::new));
|
|
|
240
|
+// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
|
241
|
+// collectingAndThen(
|
|
|
242
|
+// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
243
|
+// ArrayList::new));
|
|
241
|
244
|
|
|
242
|
245
|
|
|
243
|
246
|
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
|
|
244
|
|
- if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
|
247
|
+// if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
245
|
248
|
List<CaseApplication> caseApplicationNewList = null;
|
|
246
|
|
- for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
|
|
|
249
|
+ for (int i = 0; i < caseApplicationListinsert.size(); i++){
|
|
247
|
250
|
caseApplicationNewList = new ArrayList<>();
|
|
248
|
|
- CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
|
|
|
251
|
+ CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
|
|
249
|
252
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
250
|
253
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
251
|
254
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
|
@@ -267,6 +270,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
267
|
270
|
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
|
|
268
|
271
|
// 新增立案信息
|
|
269
|
272
|
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
|
|
273
|
+ // 设置自动编码
|
|
|
274
|
+ caseApplicationItera.setCaseNum(generateCaseNum());
|
|
270
|
275
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
|
|
271
|
276
|
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
|
|
272
|
277
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
@@ -279,7 +284,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
279
|
284
|
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
280
|
285
|
}
|
|
281
|
286
|
|
|
282
|
|
- }
|
|
|
287
|
+// }
|
|
283
|
288
|
|
|
284
|
289
|
}
|
|
285
|
290
|
|