Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #147.
This commit is contained in:
2024-04-19 11:31:27 +08:00
committed by Gitea
3 changed files with 123 additions and 46 deletions
@@ -120,8 +120,8 @@ token:
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期(默认30分钟)
expireTime: 30
# 令牌有效期(默认120分钟)
expireTime: 120
# MyBatis配置
mybatis:
@@ -2133,7 +2133,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 根据案件id查询案件
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
caseApplication.setHearDate(application.getHearDate());
long l = System.currentTimeMillis();
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
// 发送开庭短信
@@ -2160,11 +2159,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 线上调解
if (StrUtil.isNotEmpty(caseApplication.getMediationMethod()) && caseApplication.getMediationMethod().equals("1")) {
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication.getId()).roomId(caseApplication.getRoomId()).build();
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication.getId()).roomId(caseApplication.getRoomId()).systemType("TJ").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 + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
templateId = "2130103";
}
// 电话号不为空,发送短信,否则发邮箱
@@ -2174,7 +2173,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
} else {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid});
new String[]{caseApplication.getCaseNum(), application.getHearDate(), "authId="+roomUuid});
}
@@ -2209,14 +2208,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 申请人
if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) {
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
// 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+"authId="+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
if (StrUtil.isNotEmpty(affiliate.getPhone())&&!appPhones.contains(affiliate.getPhone())) {
appPhones.add(affiliate.getPhone());
SmsUtils.sendSms(application,"2130103", affiliate.getPhone(),
new String[]{application.getCaseNum(),application.getHearDate(),roomUuid});
new String[]{application.getCaseNum(),application.getHearDate(),"authId="+roomUuid});
} else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!appEmails.contains(affiliate.getEmail())) {
appEmails.add(affiliate.getEmail());
@@ -2229,14 +2228,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 被申请人
if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) {
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
// 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+"authId="+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
if (StrUtil.isNotEmpty(affiliate.getPhone())&& !resPhones.contains(affiliate.getPhone())) {
resPhones.add(affiliate.getPhone());
SmsUtils.sendSms(application,"2130103", affiliate.getPhone(),
new String[]{application.getCaseNum(),application.getHearDate(),roomUuid});
new String[]{application.getCaseNum(),application.getHearDate(),"authId="+roomUuid});
} else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!resEmails.contains(affiliate.getEmail())){
resEmails.add(affiliate.getEmail());
@@ -2440,6 +2439,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (application == null) {
return AjaxResult.error("未找到案件");
}
req.setSealFlag(application.getSealFlag());
if (StrUtil.isEmpty(application.getMediationMethod())) {
return AjaxResult.error("未选择调解方式");
}
@@ -21,6 +21,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ThreadUtil;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord;
@@ -43,6 +44,7 @@ import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
@@ -53,8 +55,10 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -67,6 +71,8 @@ import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.domain.AjaxResult.success;
@@ -123,7 +129,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
BeiMingInterfaceService beiMingInterfaceService;
@Autowired
private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper;
@Autowired
ShortMessageService shortMessageService;
@@ -423,21 +430,48 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(CollectionUtil.isEmpty(affiliates)){
return AjaxResult.error("未找到案件相关人员");
}
List<MsCaseAffiliate> oprratorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null
&& affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail()))
.collect(Collectors.toList());
if(CollectionUtil.isEmpty(oprratorList)){
return AjaxResult.error("未找到案件操作人员");
// 申请操作人
Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
// 被申请操作人
Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) {
throw new ServiceException("未找到案件操作人员");
}
for (MsCaseAffiliate affiliate : oprratorList) {
if(affiliate.getRoleType()==null){
continue;
}
boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList);
ExecutorService executor = ThreadUtil.createThreadPool();
// 发送邮件
CompletableFuture.runAsync(() -> {
if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
}
if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
} }, executor);
// 发送签收短信,2126313 尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
CompletableFuture.runAsync(() -> {
SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
}else if(StrUtil.isNotEmpty(sysUser.getEmail())){
String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
}
}, executor);
CompletableFuture.runAsync(() -> {
SysUser sysUser = sysUserMapper.selectUserById(resAffiliateOpt.get().getUserId());
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
}else if(StrUtil.isNotEmpty(sysUser.getEmail())){
String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
emailOutUtil.sendMessage(sysUser.getEmail(), "调解系统文件签收", content, null, null);
sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
}
}, executor);
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
@@ -449,42 +483,85 @@ public class MsSignSealServiceImpl implements MsSignSealService {
return AjaxResult.success("");
}
public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
SendMailRecord sendMailRecord = new SendMailRecord();
sendMailRecord.setCaseId(application.getId());
sendMailRecord.setMailAddress(user.getEmail());
sendMailRecord.setMailContent(sendContent);
sendMailRecord.setMailName(subject);
sendMailRecord.setSendTime(new Date());
// sendMailRecord.setCreateBy(SecurityUtils.getUsername());
sendMailRecord.setCreateTime(new Date());
sendMailRecord.setMailSubject(subject);
sendMailRecord.setMailFromAddress(emailFrom);
if (emailFlag) {
sendMailRecord.setSendStatus(1);
} else {
sendMailRecord.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
// 新增历史记录
MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord();
BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord);
msSendMailHistoryRecord.setParentId(sendMailRecord.getId());
msSendMailHistoryRecord.setId(null);
sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
}
@Override
@Transactional
public AjaxResult msCaseSign(MsSignSealDTO dto) {
Long caseId = dto.getCaseId();
// MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
if(caseApplicationselect==null){
return AjaxResult.error("当前案件不存在");
}
// 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
if (currentFlow == null) {
return AjaxResult.error("当前流程不存在");
}
if (dto.getIsSignApply() != null && dto.getIsSignApply().equals(1) ) {
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
Long loginUserId = SecurityUtils.getUserId();
Example example = new Example(MsCaseAffiliate.class);
example.createCriteria().andEqualTo("caseAppliId", caseId);
List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
if(CollectionUtil.isEmpty(msCaseAffiliates)){
return AjaxResult.error("未找到案件相关人员");
}
if (dto.getIsSignRespon() != null && dto.getIsSignRespon().equals(1)) {
for (MsCaseAffiliate affiliate : msCaseAffiliates) {
// 申请人签收,根据流程id查找下一个流程节点
if(affiliate.getUserId()!=null
&& loginUserId.equals(affiliate.getUserId())
&&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2))) {
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
// 被申请人签收结束对接北明,为调解成功状态
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
// 被申请人签收
if(affiliate.getUserId()!=null
&& loginUserId.equals(affiliate.getUserId())
&&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4))) {
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
// 被申请人签收结束对接北明,为调解成功状态
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
}
}
}
return AjaxResult.success("签收成功");
}
@@ -1156,7 +1233,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
Long fileId = null;
if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK.getCode())) {
String prefix = "/profile";
int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath();