|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
|
package com.ruoyi.wisdomarbitrate.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
@@ -12,16 +13,11 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
|
|
|
|
import static java.util.stream.Collectors.collectingAndThen;
|
|
|
|
|
import static java.util.stream.Collectors.toCollection;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
@@ -58,7 +54,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
BigDecimal feeRate = new BigDecimal(0.01);
|
|
|
|
|
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
caseApplication.setFeePayable(feePayable);
|
|
|
|
|
|
|
|
|
|
// 获取自动编码
|
|
|
|
|
String caseNum = generateCaseNum();
|
|
|
|
|
caseApplication.setCaseNum(caseNum);
|
|
|
|
|
|
|
|
|
@@ -83,15 +79,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
return rows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取自动编码
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private String generateCaseNum() {
|
|
|
|
|
String currentday = DateUtils.dateTime();
|
|
|
|
|
String caseNum = "zc"+ currentday;
|
|
|
|
|
//查询出当天的案件编号的最大值 ,如等于1
|
|
|
|
|
Integer caseNumMax = 1;
|
|
|
|
|
if(caseNumMax!=null){
|
|
|
|
|
//根据查询到的caseNumMax拼接一个案件编号
|
|
|
|
|
// 自动编码格式 zc+yyyyMMdd+001
|
|
|
|
|
String currentDay = DateUtils.dateTime();
|
|
|
|
|
String caseNum = "zc"+ currentDay;
|
|
|
|
|
//查询出当天的案件编号的最大值
|
|
|
|
|
Integer maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum,caseNum.length());
|
|
|
|
|
if(null == maxCaseNum){
|
|
|
|
|
caseNum = caseNum + "001";
|
|
|
|
|
}else {
|
|
|
|
|
caseNum += "001";
|
|
|
|
|
caseNum = caseNum + String.format("%03d", maxCaseNum);
|
|
|
|
|
}
|
|
|
|
|
return caseNum;
|
|
|
|
|
|
|
|
|
@@ -224,28 +226,29 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
|
|
|
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
|
|
|
|
|
|
|
|
|
|
int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
|
|
|
if(caseApplicationCount>0){
|
|
|
|
|
failureNum++;
|
|
|
|
|
failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
|
|
|
}else {
|
|
|
|
|
caseApplicationListinsert.add(caseApplication);
|
|
|
|
|
}
|
|
|
|
|
// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
|
|
|
// if(caseApplicationCount>0){
|
|
|
|
|
// failureNum++;
|
|
|
|
|
// failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
|
|
|
|
|
// }else {
|
|
|
|
|
// caseApplicationListinsert.add(caseApplication);
|
|
|
|
|
// }
|
|
|
|
|
caseApplicationListinsert.add(caseApplication);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
|
|
|
List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
|
|
|
collectingAndThen(
|
|
|
|
|
toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
|
|
ArrayList::new));
|
|
|
|
|
// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
|
|
|
// collectingAndThen(
|
|
|
|
|
// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
|
|
// ArrayList::new));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
|
|
|
|
|
if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
|
|
|
// if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
|
|
|
List<CaseApplication> caseApplicationNewList = null;
|
|
|
|
|
for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
|
|
|
|
|
for (int i = 0; i < caseApplicationListinsert.size(); i++){
|
|
|
|
|
caseApplicationNewList = new ArrayList<>();
|
|
|
|
|
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
|
|
|
|
|
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
|
|
|
|
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
|
|
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
|
|
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
|
|
@@ -267,6 +270,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
|
|
|
|
|
// 新增立案信息
|
|
|
|
|
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
|
|
|
|
// 设置自动编码
|
|
|
|
|
caseApplicationItera.setCaseNum(generateCaseNum());
|
|
|
|
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
|
|
|
|
|
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
|
|
|
|
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
|
@@ -279,7 +284,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|