异步发送短信
This commit is contained in:
+34
-20
@@ -74,6 +74,8 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -1609,6 +1611,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
application.setUpdateBy(SecurityUtils.getUsername());
|
application.setUpdateBy(SecurityUtils.getUsername());
|
||||||
application.setUpdateTime(new Date());
|
application.setUpdateTime(new Date());
|
||||||
application.setBatchNumber(null);
|
application.setBatchNumber(null);
|
||||||
|
|
||||||
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||||
|
caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
||||||
|
ExecutorService executor = ThreadUtil.createThreadPool();
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
// 给被申请人发送短信
|
// 给被申请人发送短信
|
||||||
if (affiliateMap.containsKey(application.getId())) {
|
if (affiliateMap.containsKey(application.getId())) {
|
||||||
List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
|
List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
|
||||||
@@ -1620,9 +1627,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
);
|
);
|
||||||
SMSNotice notice = new SMSNotice(null,resNotice);
|
SMSNotice notice = new SMSNotice(null,resNotice);
|
||||||
caseApplicationService.sendNotice(application,affiliates,false,notice);
|
caseApplicationService.sendNotice(application,affiliates,false,notice);
|
||||||
}
|
}}, executor);
|
||||||
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
||||||
caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1639,6 +1644,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
if(selectApplication==null){
|
if(selectApplication==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ExecutorService executor = ThreadUtil.createThreadPool();
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
List<String> appPhones=new ArrayList<>();
|
List<String> appPhones=new ArrayList<>();
|
||||||
List<String> resPhones=new ArrayList<>();
|
List<String> resPhones=new ArrayList<>();
|
||||||
List<String> appEmails=new ArrayList<>();
|
List<String> appEmails=new ArrayList<>();
|
||||||
@@ -1682,7 +1689,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}}, executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2125,42 +2132,48 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||||
// 根据案件id查询案件
|
// 根据案件id查询案件
|
||||||
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
|
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
|
||||||
|
long l = System.currentTimeMillis();
|
||||||
|
ExecutorService executor = ThreadUtil.createThreadPool();
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
// 发送开庭短信
|
// 发送开庭短信
|
||||||
if(CollectionUtil.isNotEmpty(vo.getHerDates())) {
|
if (CollectionUtil.isNotEmpty(vo.getHerDates())) {
|
||||||
List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
|
List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
|
||||||
caseApplication.setHearDate(application.getHearDate());
|
caseApplication.setHearDate(application.getHearDate());
|
||||||
// 申请人发送开庭日期短信
|
// 申请人发送开庭日期短信
|
||||||
sendHearDateSms(caseApplication, affiliates);
|
sendHearDateSms(caseApplication, affiliates);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}, executor);
|
||||||
// 调解员发送短信,根据调解员id查询用户
|
// 调解员发送短信,根据调解员id查询用户
|
||||||
if (caseApplication.getMediatorId() != null) {
|
CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) {
|
||||||
// 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
|
// 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
|
||||||
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
|
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
|
||||||
String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。";
|
String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。";
|
||||||
String templateId="2077966";
|
String templateId = "2077966";
|
||||||
String subject="开庭日期通知";
|
String subject = "开庭日期通知";
|
||||||
MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
|
MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
|
||||||
meditorAffliate.setPhone(sysUser.getPhonenumber());
|
meditorAffliate.setPhone(sysUser.getPhonenumber());
|
||||||
meditorAffliate.setEmail(sysUser.getEmail());
|
meditorAffliate.setEmail(sysUser.getEmail());
|
||||||
String roomUuid=null;
|
String roomUuid = null;
|
||||||
// 线上调解
|
// 线上调解
|
||||||
if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){
|
if (StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")) {
|
||||||
// 获取短信链接uuid
|
// 获取短信链接uuid
|
||||||
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
|
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
|
||||||
roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
|
roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
|
||||||
// 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
|
// 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
|
||||||
|
|
||||||
content="尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
|
content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" + roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
|
||||||
templateId = "2130103";
|
templateId = "2130103";
|
||||||
}
|
}
|
||||||
// 电话号不为空,发送短信,否则发邮箱
|
// 电话号不为空,发送短信,否则发邮箱
|
||||||
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
|
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
|
||||||
if(roomUuid==null) {
|
if (roomUuid == null) {
|
||||||
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
|
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
|
||||||
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
|
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
|
||||||
}else {
|
} else {
|
||||||
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
|
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
|
||||||
new String[]{caseApplication.getCaseNum(), application.getHearDate(),roomUuid});
|
new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2169,10 +2182,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
|
caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} }, executor);
|
||||||
}
|
|
||||||
// 新增日志
|
// 新增日志
|
||||||
|
|
||||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2327,7 +2338,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
application.setRejectReason(reason);
|
application.setRejectReason(reason);
|
||||||
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
|
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
|
||||||
// todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
|
// todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
|
||||||
// 申请人不受理分配通知
|
// 申请人不受理分配通知 // todo 短信异步
|
||||||
|
ExecutorService executor = ThreadUtil.createThreadPool();
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason();
|
String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason();
|
||||||
SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知",
|
SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知",
|
||||||
"尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。",
|
"尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。",
|
||||||
@@ -2337,6 +2350,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|||||||
|
|
||||||
SMSNotice notice = new SMSNotice(applicantNotice,null);
|
SMSNotice notice = new SMSNotice(applicantNotice,null);
|
||||||
caseApplicationService.sendNotice(application,affiliates,true,notice);
|
caseApplicationService.sendNotice(application,affiliates,true,notice);
|
||||||
|
}, executor);
|
||||||
// 修改案件状态为17,结束
|
// 修改案件状态为17,结束
|
||||||
MsCaseApplication caseApplication = new MsCaseApplication();
|
MsCaseApplication caseApplication = new MsCaseApplication();
|
||||||
caseApplication.setId(id);
|
caseApplication.setId(id);
|
||||||
|
|||||||
+9
-2
@@ -14,6 +14,7 @@ import com.ruoyi.common.enums.PaymentStatusEnum;
|
|||||||
import com.ruoyi.common.enums.YesOrNoEnum;
|
import com.ruoyi.common.enums.YesOrNoEnum;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.ThreadUtil;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.dto.PayRequest;
|
import com.ruoyi.dto.PayRequest;
|
||||||
import com.ruoyi.dto.PayResponse;
|
import com.ruoyi.dto.PayResponse;
|
||||||
@@ -41,6 +42,8 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -339,7 +342,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
|
|||||||
}
|
}
|
||||||
casePaymentRecord.setCaseId(application.getId());
|
casePaymentRecord.setCaseId(application.getId());
|
||||||
Example example = new Example(MsCasePaymentRecord.class);
|
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和案件状态
|
// 更改案件流程id和案件状态
|
||||||
application.setCaseFlowId(flow.getId());
|
application.setCaseFlowId(flow.getId());
|
||||||
application.setCaseStatusName(flow.getCaseStatusName());
|
application.setCaseStatusName(flow.getCaseStatusName());
|
||||||
@@ -379,6 +383,9 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
|
|||||||
if(CollectionUtil.isEmpty(operatorList)){
|
if(CollectionUtil.isEmpty(operatorList)){
|
||||||
throw new ServiceException("未找到案件操作人员");
|
throw new ServiceException("未找到案件操作人员");
|
||||||
}
|
}
|
||||||
|
// 异步发送短信
|
||||||
|
ExecutorService executor = ThreadUtil.createThreadPool();
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
if(dto.getApplicantConfirm()) {
|
if(dto.getApplicantConfirm()) {
|
||||||
List<String> appPhones=new ArrayList<>();
|
List<String> appPhones=new ArrayList<>();
|
||||||
|
|
||||||
@@ -427,7 +434,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}}, executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user