This commit is contained in:
wangqiong
2024-04-18 17:58:37 +08:00
4 changed files with 96 additions and 69 deletions
@@ -74,6 +74,8 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -1609,20 +1611,23 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setUpdateBy(SecurityUtils.getUsername());
application.setUpdateTime(new Date());
application.setBatchNumber(null);
// 给被申请人发送短信
if (affiliateMap.containsKey(application.getId())) {
List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
// 被申受理分配通知
SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知",
"尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。",
"2074247",
new String[]{application.getCaseNum()}
);
SMSNotice notice = new SMSNotice(null,resNotice);
caseApplicationService.sendNotice(application,affiliates,false,notice);
}
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
// 给被申请人发送短信
if (affiliateMap.containsKey(application.getId())) {
List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
// 被申受理分配通知
SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知",
"尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。",
"2074247",
new String[]{application.getCaseNum()}
);
SMSNotice notice = new SMSNotice(null,resNotice);
caseApplicationService.sendNotice(application,affiliates,false,notice);
}}, executor);
}
/**
@@ -1639,6 +1644,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(selectApplication==null){
return;
}
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
List<String> appPhones=new ArrayList<>();
List<String> resPhones=new ArrayList<>();
List<String> appEmails=new ArrayList<>();
@@ -1682,7 +1689,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
}
}
}
}}, executor);
}
/**
@@ -2125,54 +2132,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 根据案件id查询案件
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
// 发送开庭短信
if(CollectionUtil.isNotEmpty(vo.getHerDates())) {
List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
caseApplication.setHearDate(application.getHearDate());
// 申请人发送开庭日期短信
sendHearDateSms(caseApplication, affiliates);
long l = System.currentTimeMillis();
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
// 发送开庭短信
if (CollectionUtil.isNotEmpty(vo.getHerDates())) {
List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
caseApplication.setHearDate(application.getHearDate());
// 申请人发送开庭日期短信
sendHearDateSms(caseApplication, affiliates);
// 调解员发送短信,根据调解员id查询用户
if (caseApplication.getMediatorId() != null) {
// 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。";
String templateId="2077966";
String subject="开庭日期通知";
MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
meditorAffliate.setPhone(sysUser.getPhonenumber());
meditorAffliate.setEmail(sysUser.getEmail());
String roomUuid=null;
// 线上调解
if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
// 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
content="尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
templateId = "2130103";
}
// 电话号不为空,发送短信,否则发邮箱
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
if(roomUuid==null) {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
}else {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate(),roomUuid});
}
}, executor);
// 调解员发送短信,根据调解员id查询用户
CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) {
// 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。";
String templateId = "2077966";
String subject = "开庭日期通知";
MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
meditorAffliate.setPhone(sysUser.getPhonenumber());
meditorAffliate.setEmail(sysUser.getEmail());
String roomUuid = null;
// 线上调解
if (StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")) {
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
// 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
} else {
// 发送邮件
caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
}
content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" + roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
templateId = "2130103";
}
}
// 新增日志
// 电话号不为空,发送短信,否则发邮箱
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
if (roomUuid == null) {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
} else {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid});
}
} else {
// 发送邮件
caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
}
} }, executor);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
}
@@ -2327,7 +2338,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setRejectReason(reason);
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
// todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
// 申请人不受理分配通知
// 申请人不受理分配通知 // todo 短信异步
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason();
SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知",
"尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。",
@@ -2337,6 +2350,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
SMSNotice notice = new SMSNotice(applicantNotice,null);
caseApplicationService.sendNotice(application,affiliates,true,notice);
}, executor);
// 修改案件状态为17,结束
MsCaseApplication caseApplication = new MsCaseApplication();
caseApplication.setId(id);
@@ -2419,6 +2433,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult mediation(MsCaseApplicationReq req) throws EsignDemoException, InterruptedException {
req.setSealFlag(null);
// 查询案件是否存在
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
if (application == null) {
@@ -2709,7 +2724,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (caseFlow != null) {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
msCaseApplicationMapper.updateByPrimaryKey(application);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
}
@@ -2748,7 +2763,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
}
return AjaxResult.success();
} else if (mediaResult == 3) {
@@ -2760,7 +2775,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
// 新增结束日志
@@ -2802,7 +2817,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
}
return AjaxResult.success();
@@ -3051,7 +3066,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
@@ -14,6 +14,7 @@ import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ThreadUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse;
@@ -41,6 +42,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -339,7 +342,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
}
casePaymentRecord.setCaseId(application.getId());
Example example = new Example(MsCasePaymentRecord.class);
example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example);
example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());
casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example);
// 更改案件流程id和案件状态
application.setCaseFlowId(flow.getId());
application.setCaseStatusName(flow.getCaseStatusName());
@@ -379,6 +383,9 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
if(CollectionUtil.isEmpty(operatorList)){
throw new ServiceException("未找到案件操作人员");
}
// 异步发送短信
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
if(dto.getApplicantConfirm()) {
List<String> appPhones=new ArrayList<>();
@@ -427,7 +434,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
}
}
}
}}, executor);
}
@@ -522,7 +522,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
return AjaxResult.error("未找到案件被申请操作人");
}
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
Integer organizeFlag = caseApplication.getOrganizeFlag();
Long userId = SecurityUtils.getUserId();
if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){
@@ -533,7 +533,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
if (sealSignRecords != null && sealSignRecords.size() > 0) {
String signFlowid = sealSignRecords.get(0).getSignFlowId();
if(organizeFlag!=null){
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setPensonAccount(appOpt.get().getPhone());
sealSignRecord.setPensonName(appOpt.get().getName());
@@ -549,7 +548,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String urlapply = signUrlData.get("shortUrl").getAsString();
sealSignRecordres.setSealUrl(urlapply);
}
}
return AjaxResult.success(sealSignRecordres);
}else {
return AjaxResult.error();
@@ -674,7 +672,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
signStatusMediator!=null&&signStatusMediator.equals(1)){
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag().equals(1)) {
// 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else {
@@ -121,11 +121,18 @@ public class ShortMessageServiceImpl implements ShortMessageService {
List<String> recordParamList = recordParamContentMap.get(record.getId());
if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){
List<MsSmsTemplateParam> templateParamList = templateParamMap.get(record.getMsSmsTemplateId());
ArrayList<MsSmsTemplateParam> copyParamList = new ArrayList<>();
for (int i = 0; i < templateParamList.size(); i++) {
MsSmsTemplateParam templateParam = templateParamList.get(i);
templateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i));
MsSmsTemplateParam msSmsTemplateParam =new MsSmsTemplateParam();
msSmsTemplateParam.setParam(templateParam.getParam());
msSmsTemplateParam.setSmsTemplateId(templateParam.getSmsTemplateId());
msSmsTemplateParam.setParamName(templateParam.getParamName());
msSmsTemplateParam.setId(templateParam.getId());
msSmsTemplateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i));
copyParamList.add(msSmsTemplateParam);
}
record.setTemplateParams(templateParamList);
record.setTemplateParams(copyParamList);
}
// 按顺序替换占位符