实现批量管理查询批量和批量提交

This commit is contained in:
qitz
2023-12-29 17:23:09 +08:00
parent deea55b1e9
commit 7a38c4e8a5
7 changed files with 297 additions and 10 deletions
@@ -22,4 +22,10 @@ public class BatchCaseApplication {
private Integer opinion;
/** 驳回原因 */
private String caseCheckReject;
/**
* 批号
*/
private String batchNumber;
}
@@ -133,4 +133,8 @@ public interface CaseApplicationMapper {
int batchSave(@Param("list")List<CaseApplication> caseApplications);
int selectCasenum(@Param("userId") String userId);
List<CaseApplication> selectAdminCaseApplicationListBatch(CaseApplication caseApplication);
List<CaseApplication> listCaseApplicationByBatchNumber(CaseApplication caseApplication);
}
@@ -136,4 +136,7 @@ public interface ICaseApplicationService {
CaseAttach downloadCaseZipFile(CaseApplication caseApplication);
List<CaseApplication> selectCaseApplicationListBatchByRole(CaseApplication caseApplication);
int submitCaseApplicationBatch(String batchNumber);
}
@@ -2545,7 +2545,169 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return caseAttach;
}
@Override
public List<CaseApplication> selectCaseApplicationListBatchByRole(CaseApplication caseApplication) {
return caseApplicationMapper.selectAdminCaseApplicationListBatch(caseApplication);
}
@Override
@Transactional
public int submitCaseApplicationBatch(String batchNumber) {
int rows = 0;
CaseApplication caseApplicationsel = new CaseApplication();
caseApplicationsel.setBatchNumber(batchNumber);
caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
List<Long> ids = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
if(caseApplications!=null&&caseApplications.size()>0){
Map<Long, CaseApplication> applicationMap = caseApplications.stream().collect(Collectors.toMap(CaseApplication::getId, Function.identity(), (n1, n2) -> n2));
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliateByCaseIds(ids);
// 转换为Map<CaseId,List<CaseAffiliate>>形式
Map<Long, List<CaseAffiliate>> caseAffiliateMap = caseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliate::getCaseAppliId));
for (Long id : ids) {
// 查询案件信息,做必填校验,校验不通过,提示,不能提交
StringBuilder errorMsg = new StringBuilder();
// 必填校验
CaseApplication caseApplication = applicationMap.get(id);
String caseNum = caseApplication.getCaseNum();
// 基本字段校验
if(caseApplication!=null) {
for (String baseColumn : baseColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, baseColumn))){
errorMsg.append(getColumnstr(baseColumn)).append("不能为空,");
// throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
// 校验人员
if(CollectionUtil.isNotEmpty(caseAffiliates)){
List<CaseAffiliate> affiliateList = caseAffiliateMap.get(id);
if(CollectionUtil.isNotEmpty(affiliateList)){
for (CaseAffiliate caseAffiliate : affiliateList) {
if(caseAffiliate.getIdentityType()==1){
// 校验申请人
for (String applicAffiliateColumn : applicAffiliateColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){
errorMsg.append(getColumnstr(applicAffiliateColumn)).append("不能为空,");
// throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
}else {
// 校验被申请人
for (String applicAffiliateColumn : dectborAffiliateColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){
errorMsg.append(getColumnstr(applicAffiliateColumn)).append("不能为空,");
// throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
}
}
}
}
}
if(StringUtils.isNotEmpty(errorMsg.toString())){
throw new ServiceException("案件编号" + caseNum + errorMsg.toString()+"请完善案件信息!");
}
CaseApplication application = new CaseApplication();
application.setId(id);
//提交立案申请
application.setCaseStatus(CaseApplicationConstants.CASE_CHECK);
rows += caseApplicationMapper.submitCaseApplication(application);
// 新增日志
insertCaseLog(application.getId(), CaseApplicationConstants.CASE_CHECK, "");
}
}else{
throw new ServiceException("这个批号没有批量提交的案件");
}
return rows;
}
private String getColumnstr(String columnname) {
String columnstr = "";
switch (columnname) {
case "caseName":
columnstr = "案件名称";
break;
case "caseSubjectAmount":
columnstr = "案件标的";
break;
case "loanStartDate":
columnstr = "借款开始日期";
break;
case "loanEndDate":
columnstr = "借款结束日期";
break;
case "contractNumber":
columnstr = "合同编号";
break;
case "claimInterestOwed":
columnstr = "申请人主张欠利息";
break;
case "claimLiquidDamag":
columnstr = "申请人主张违约金";
break;
case "claimPrinciOwed":
columnstr = "申请人主张欠本金";
break;
case "arbitratClaims":
columnstr = "申请人仲裁请求及事实和理由";
break;
case "name":
columnstr = "姓名";
break;
case "identityNum":
columnstr = "身份证号";
break;
case "contactTelphone":
columnstr = "联系电话";
break;
case "contactAddress":
columnstr = "联系地址";
break;
case "workTelphone":
columnstr = "单位电话";
break;
case "workAddress":
columnstr = "单位地址";
break;
case "residenAffili":
columnstr = "住所";
break;
case "compLegalPerson":
columnstr = "法定代表人";
break;
case "compLegalperPost":
columnstr = "法定代表人职位";
break;
case "email":
columnstr = "邮箱";
break;
case "nameAgent":
columnstr = "代理人姓名";
break;
case "identityNumAgent":
columnstr = "代理人身份证号";
break;
case "contactTelphoneAgent":
columnstr = "代理人联系电话";
break;
case "contactAddressAgent":
columnstr = "代理人联系地址";
break;
case "responSex":
columnstr = "被申请人性别";
break;
case "responBirth":
columnstr = "被申请人出生年月日";
break;
default:
columnstr = "";
}
return columnstr;
}
@Override
@@ -2599,9 +2761,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
//发送短信通知 1947342 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1947342");
request.setTemplateId("2033619");
// 发送开庭日期通知短信
sendHearDateMessage(caseApplication, request, "1947342");
sendHearDateMessage(caseApplication, request, "2033619");
// 新增日志
insertCaseLog(caseApplication.getId(), CaseApplicationConstants.MODIFY_HEARDATE, "");
@@ -2619,9 +2781,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
String caseNum = caseApplicationselect.getCaseNum();
//Date hearDate = caseApplicationselect.getHearDate();
Date hearDate = caseApplicationselect.getHearDate();
String hearDatestr = "";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String hearDatestr = null;
if(hearDate!=null) {
hearDatestr = dateFormat.format(hearDate);
}
String arbitratorId = caseApplicationselect.getArbitratorId();
// List<Arbitrator> arbitratorList = new ArrayList<>();
if (StringUtils.isNotEmpty(arbitratorId)) {
@@ -2638,7 +2803,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
request.setPhone(user.getPhonenumber());
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = user.getNickName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
if (templateId.equals("2033619")) {
request.setTemplateParamSet(new String[]{name, caseNum});
}
if (templateId.equals("1975139")) {
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
}
Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
@@ -2647,8 +2818,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
String content = "";
if (templateId.equals("1947342")) {
content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,开庭日期已确定为" + hearDatestr + ",请知晓,如非本人操作,请忽略本短信。";
if (templateId.equals("2033619")) {
content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,已组庭,请知晓,如非本人操作,请忽略本短信。";
}
if (templateId.equals("1975139")) {
content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,开庭日期已改为" + hearDatestr + ",请知晓,如非本人操作,请忽略本短信。";
@@ -2682,7 +2853,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
request.setPhone(caseAffiliateselect.getContactTelphone());
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = caseAffiliateselect.getName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
if (templateId.equals("2033619")) {
request.setTemplateParamSet(new String[]{name, caseNum});
}
if (templateId.equals("1975139")) {
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
}
Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
@@ -2690,7 +2866,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
String content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,开庭日期已确定为" + hearDatestr + ",请知晓,如非本人操作,请忽略本短信。";
String content = "";
if (templateId.equals("2033619")) {
content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,已组庭,请知晓,如非本人操作,请忽略本短信。";
}
if (templateId.equals("1975139")) {
content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,开庭日期已改为" + hearDatestr + ",请知晓,如非本人操作,请忽略本短信。";
}
smsSendRecord.setSendContent(content);
smsSendRecord.setCreateBy(getUsername());
if (aBoolean) {
@@ -152,12 +152,13 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
} else { //被申请人
Boolean aBoolean = SmsUtils.sendSms(request);
request.setPhone(affiliate.getContactTelphone());
request.setTemplateId("1952840");
// 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信
String name = affiliate.getName();
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseApplication.getId());