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

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());
@@ -53,6 +53,8 @@
<result property="batchNumber" column="batch_number"/>
<result property="mediationAgreement" column="mediation_agreement"/>
<result property="identityType" column="identity_type"/>
<result property="name" column="name"/>
</resultMap>
@@ -851,6 +853,32 @@
</where>
order by c.case_num desc
</select>
<select id="selectAdminCaseApplicationListBatch" parameterType="CaseApplication" resultMap="CaseApplicationResult">
SELECT DISTINCT c.batch_number ,c.arbitrat_method ,c.arbitrator_name ,
c.arbitrator_id ,c.case_status ,a.identity_type ,a.name ,
CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
when 18 then '待仲裁员审核仲裁文书'
when 31 then '待修改开庭时间'
ELSE '无案件状态'
END caseStatusName,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式'
END arbitratMethodName
FROM case_application c left join case_affiliate a on c.id = a.case_appli_id
WHERE c.lock_status = 0 and c.batch_number is not null
and a.identity_type = 1
<if test="batchNumber != null and batchNumber != ''">
AND c.batch_number = #{batchNumber}
</if>
order by c.batch_number desc
</select>
<select id="selectAdminCaseToDoCount" resultType="com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount">
SELECT
sum( case when c.case_status=0 then 1 else 0 end) caseApply,
@@ -1286,6 +1314,45 @@
where c.id = #{id} and p.payment_status=1 limit 1
</select>
<select id="listCaseApplicationByBatchNumber" resultMap="CaseApplicationResult">
select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,c.case_name,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式'
END arbitratMethodName,
c.case_status ,
CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
when 12 then '待部门长审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
when 18 then '待仲裁员审核仲裁文书'
when 31 then '待修改开庭时间'
ELSE '无案件状态'
END caseStatusName,
c.hear_date ,c.arbitrat_claims ,
c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
,c.fee_payable ,
c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
,c.request_rule,c.adjudica_counter,c.proper_preser,
c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
,ca.application_organ_name as applicantName,
c.batch_number,
c.facts,
c.mediation_agreement,c.template_id templateId
from case_application c
LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
WHERE c.lock_status = 0
<if test="batchNumber != null and batchNumber != ''">
AND c.batch_number = #{batchNumber}
</if>
<if test="caseStatus != null">
AND c.case_status = #{caseStatus}
</if>
</select>
<select id="selectCaseNumLike" resultType="java.lang.Integer">
select max(substring(case_num, #{length}+1,12)) as maxCaseNum
from case_application where case_num like CONCAT(#{caseNum},'%') ;