Merge branch 'wq' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #309.
This commit is contained in:
2023-12-15 10:58:52 +08:00
committed by Gitea
6 changed files with 98 additions and 42 deletions
@@ -72,6 +72,7 @@ public class SmsUtils {
* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空
*/
private String[] templateParamSet;
private Long caseId;
}
}
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -11,4 +12,11 @@ public interface SmsRecordMapper {
int saveSmsSendRecord(SmsSendRecord smsSendRecord);
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
/**
* 批量新增
* @param smsSendRecordList
* @return
*/
int batchSaveSmsSendRecord(@Param("list") List<SmsSendRecord> smsSendRecordList);
}
@@ -111,7 +111,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String offLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于 "+offLineDate+"在仲裁委所在地开庭审理了本案。";
//书面仲裁时
String writtenDate="{{writtenDate}}";
String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+writtenDate+"在仲裁委所在地开庭审理了本案。";
String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+writtenDate+"在仲裁委所在地开庭审理了本案。仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,根据《2022年版仲裁规则》第五十八条的规定对本案进行了书面审理。 ";
//开庭+缺席审理
String absent = "申请人的特别授权委托代理人{{agentName}}"+"出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
"《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明,\" +\n" +
@@ -1249,10 +1249,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
// 尊敬的{1},您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setCaseId(caseAffiliate.getCaseAppliId());
request.setTemplateId("1956159");
request.setPhone(agentUser.getPhonenumber());
request.setTemplateParamSet(new String[]{agentUser.getNickName()});
Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
@@ -216,12 +216,7 @@ public class CaseZipImportImpl {
caseApplication.setCaseLogId(IdWorkerUtil.getId());
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
caseApplication.setCaseAppliId(caseApplication.getId());
//默认案件标的 todo 案件标的是什么,默认写死
caseApplication.setCaseSubjectAmount(new BigDecimal(100000));
//todo 暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
// 设置批号
if (StrUtil.isEmpty(caseApplication.getBatchNumber())) {
maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
@@ -356,18 +351,32 @@ public class CaseZipImportImpl {
}
);
// todo 发送短信
// ThreadPoolUtil.execute(() -> {
// CaseLogUtils.batchInsertCaseLog(logRecords);
// // 发送短信
// if (CollectionUtil.isNotEmpty(smsRequestList)) {
// for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
// Boolean aBoolean = SmsUtils.sendSms(request);
// }
// }
//
// }
//
// );
ThreadPoolUtil.execute(() -> {
CaseLogUtils.batchInsertCaseLog(logRecords);
// 发送短信
if (CollectionUtil.isNotEmpty(smsRequestList)) {
Map<Long, SmsSendRecord> sendRecordMap = null;
if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
Boolean aBoolean = SmsUtils.sendSms(request);
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
if (aBoolean) {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
} else {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
}
}
}
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
}
}
}
);
}
// 案件日志
return success("导入成功");
@@ -598,7 +607,7 @@ public class CaseZipImportImpl {
} else if (dictData.getDictLabel().contains("申请人") || dictData.getDictLabel().contains("统一社会信用代码")
|| dictData.getDictLabel().contains("法定代表人") || dictData.getDictLabel().contains("委托代理人")) {
// 组装申请人内置自段
buildAffilcateColumn(dictData, fatchMap, affiliate, deptMap, sysDepts, userMap, addUsers, userRoleList, caseApplication.getId(), smsSendRecords, smsRequestList);
buildAffilcateColumn(dictData, fatchMap, affiliate, deptMap, sysDepts, userMap, addUsers, userRoleList, caseApplication, smsSendRecords, smsRequestList);
} else if (dictData.getDictLabel().contains("合同编号")) {
// 合同编号
String contractNumber = fatchMap.get("合同编号" + Constants.PDFSTR + caseApplication.getId());
@@ -608,6 +617,14 @@ public class CaseZipImportImpl {
String replaceAll = contractNumber.replaceAll(regx, "");
caseApplication.setContractNumber(replaceAll.toUpperCase());
}
}else if(dictData.getDictLabel().contains("案件标的")){
// todo 案件标的名字要改,字典配置中也要改
if(null!=caseApplication.getCaseSubjectAmount()) {
//todo 暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
}
} else {
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
}
@@ -637,7 +654,7 @@ public class CaseZipImportImpl {
*/
private void buildAffilcateColumn(SysDictData dictData, Map<String, String> fatchMap, CaseAffiliate affiliate,
Map<String, Long> deptMap, List<SysDept> sysDepts,
Map<String, SysUser> userMap, List<SysUser> addUsers, List<SysUserRole> userRoleList, Long caseId,
Map<String, SysUser> userMap, List<SysUser> addUsers, List<SysUserRole> userRoleList, CaseApplication caseApplication,
List<SmsSendRecord> smsSendRecords, List<SmsUtils.SendSmsRequest> smsRequestList) {
affiliate.setIdentityType(1);
@@ -645,7 +662,7 @@ public class CaseZipImportImpl {
// 申请人
switch (dictData.getDictLabel()) {
case "申请人姓名":
affiliate.setName((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)));
affiliate.setName((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
if (StrUtil.isNotEmpty(affiliate.getName())) {
// 组装申请机构
// 将组织机构id设为申请人名称
@@ -673,25 +690,25 @@ public class CaseZipImportImpl {
}
break;
case "统一社会信用代码":
affiliate.setIdentityNum((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)));
affiliate.setIdentityNum((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
break;
case "法定代表人":
affiliate.setCompLegalPerson(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
affiliate.setCompLegalPerson(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
break;
case "法定代表人职位":
affiliate.setCompLegalperPost((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)));
affiliate.setCompLegalperPost((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
break;
case "申请人住所":
affiliate.setResidenAffili((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)));
affiliate.setResidenAffili((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
break;
case "申请人联系地址":
affiliate.setContactAddress(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
affiliate.setContactAddress(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
break;
case "委托代理人姓名":
affiliate.setNameAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
affiliate.setNameAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
break;
case "委托代理人联系电话":
affiliate.setContactTelphoneAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
affiliate.setContactTelphoneAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
SysUser agentUser = null;
// 用户已存在
@@ -736,14 +753,15 @@ public class CaseZipImportImpl {
}
if (addUsers != null) {
SysUser finalAgentUser = agentUser;
if(CollectionUtil.isNotEmpty(smsRequestList)&& smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))){
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
request.setPhone(agentUser.getPhonenumber());
request.setTemplateParamSet(new String[]{agentUser.getNickName()});
smsRequestList.add(request);
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseId);
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(caseId);
smsSendRecord.setCaseId(caseApplication.getId());
smsSendRecord.setCaseNum(caseApplication.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
@@ -751,13 +769,15 @@ public class CaseZipImportImpl {
smsSendRecord.setSendContent(content);
smsSendRecord.setCreateBy(getUsername());
smsSendRecords.add(smsSendRecord);
smsRequestList.add(request);
}
}
}
break;
case "委托代理人电子邮件":
affiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)) ? fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId).replace("\n", "").replaceAll("\\s", "") : null);
affiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())) ? fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()).replace("\n", "").replaceAll("\\s", "") : null);
break;
default:
@@ -39,6 +39,31 @@
sysdate()
)
</insert>
<insert id="batchSaveSmsSendRecord">
insert into sms_send_record(
case_appli_id,
case_num,
phone,
send_time,
send_content,
create_by,
send_status,
create_time
)values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.caseId},
#{item.caseNum},
#{item.phone},
#{item.sendTime},
#{item.sendContent},
#{item.createBy},
#{item.sendStatus},
sysdate()
)
</foreach>
</insert>
<select id="getSmsSendRecord" parameterType="SmsSendRecord" resultMap="SmsSendRecordResult">