|
|
|
@@ -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;
|
|
|
|
|
|
|
|
|
@@ -105,13 +107,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public int editCaseApplication(CaseApplication caseApplication) {
|
|
|
|
|
//根据仲裁费用计费规则计算应缴费用
|
|
|
|
|
//暂时设置计费比率为0.01
|
|
|
|
|
BigDecimal feeRate = new BigDecimal(0.01);
|
|
|
|
|
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
caseApplication.setFeePayable(feePayable);
|
|
|
|
|
|
|
|
|
|
int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
|
|
|
|
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
|
|
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
|
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
|
|
|
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
|
|
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
|
|
|
|
|
if(caseAttachList!=null&&caseAttachList.size()>0){
|
|
|
|
|
for (CaseAttach caseAttach : caseAttachList){
|
|
|
|
|
caseAttach.setCaseAppliId(caseApplication.getId());
|
|
|
|
|
caseAttachMapper.updateCaseAttach(caseAttach);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rows;
|
|
|
|
|
}
|
|
|
|
@@ -191,38 +208,47 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public String importCaseApplication(List<CaseApplication> caseApplicationList, String operName) {
|
|
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
|
|
int successNum = 0;
|
|
|
|
|
int failureNum = 0;
|
|
|
|
|
if(caseApplicationList!=null&&caseApplicationList.size()>0){
|
|
|
|
|
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < caseApplicationList.size(); i++){
|
|
|
|
|
CaseApplication caseApplication = caseApplicationList.get(i);
|
|
|
|
|
//根据仲裁费用计费规则计算应缴费用
|
|
|
|
|
//暂时设置计费比率为0.01
|
|
|
|
|
BigDecimal feeRate = new BigDecimal(0.01);
|
|
|
|
|
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
caseApplication.setFeePayable(feePayable);
|
|
|
|
|
|
|
|
|
|
//赋值CaseApplication的案件关联人信息
|
|
|
|
|
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){
|
|
|
|
|
List<CaseApplication> caseApplicationNewList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
|
|
|
|
|
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
|
|
|
|
|
// if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
|
|
|
|
|
List<CaseApplication> caseApplicationNewList = null;
|
|
|
|
|
for (int i = 0; i < caseApplicationListinsert.size(); i++){
|
|
|
|
|
caseApplicationNewList = new ArrayList<>();
|
|
|
|
|
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
|
|
|
|
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
|
|
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
|
|
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
|
|
@@ -244,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){
|
|
|
|
@@ -256,7 +284,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -265,8 +293,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
}else {
|
|
|
|
|
throw new ServiceException("导入立案申请数据不能为空!");
|
|
|
|
|
}
|
|
|
|
|
// 编号存在不导入
|
|
|
|
|
if(StringUtils.isNotEmpty(failureMsg)){
|
|
|
|
|
return failureMsg.append(successMsg).toString();
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
return successMsg.toString();
|
|
|
|
|
return successMsg.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@@ -362,7 +395,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
@Override
|
|
|
|
|
public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) {
|
|
|
|
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication);
|
|
|
|
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
|
|
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
|
|
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
|
|
if(caseAffiliatListeselect!=null){
|
|
|
|
|
StringBuffer applicantName = new StringBuffer();
|
|
|
|
|
for (int i = 0; i < caseAffiliatListeselect.size(); i++){
|
|
|
|
|
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
|
|
|
|
|
int identityType = caseAffiliateselect.getIdentityType();
|
|
|
|
|
if(identityType==1){
|
|
|
|
|
applicantName.append(caseAffiliateselect.getName()).append(",");;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
caseApplicationselect.setApplicantName(applicantName.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return caseApplicationselect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -374,7 +422,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
|
|
|
|
|
//发送短信通知
|
|
|
|
|
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
|
|
|
request.setTemplateId("1931000");
|
|
|
|
|
request.setTemplateId("1947342");
|
|
|
|
|
|
|
|
|
|
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
|
|
String caseNum = caseApplicationselect.getCaseNum();
|
|
|
|
@@ -398,7 +446,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
Arbitrator arbitratorselect = arbitratorList.get(i);
|
|
|
|
|
//给仲裁员发送短信通知
|
|
|
|
|
request.setPhone(arbitratorselect.getTelephone());
|
|
|
|
|
// 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
|
|
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
|
|
String name = arbitratorselect.getArbitratorName();
|
|
|
|
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
|
|
|
SmsUtils.sendSms(request);
|
|
|
|
@@ -415,7 +463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
int identityType = caseAffiliateselect.getIdentityType();
|
|
|
|
|
//给申请人、被申请人发送短信通知
|
|
|
|
|
request.setPhone(caseAffiliateselect.getContactTelphone());
|
|
|
|
|
// 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
|
|
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
|
|
String name = caseAffiliateselect.getName();
|
|
|
|
|
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
|
|
|
|
|
SmsUtils.sendSms(request);
|
|
|
|
@@ -478,6 +526,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
|
|
caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
|
|
|
|
|
caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
|
|
|
|
|
caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
|
|
|
|
|
caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|