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

This commit was merged in pull request #56.
This commit is contained in:
2024-01-31 17:35:59 +08:00
committed by Gitea
10 changed files with 237 additions and 36 deletions
@@ -165,8 +165,9 @@ public class MsCaseApplicationController extends BaseController {
* @return * @return
*/ */
@PostMapping("/accept") @PostMapping("/accept")
public AjaxResult accept(@RequestBody MsCaseApplication req ) { public AjaxResult accept(@RequestBody MsCaseApplicationVO req ) {
if (StrUtil.isEmpty(req.getMediationMethod()) if (StrUtil.isEmpty(req.getMediationMethod() )
|| req.getAgreeFlag()==null
|| req.getPaperFlag() == null || req.getPaperFlag() == null
|| req.getCaseFlowId() == null || req.getCaseFlowId() == null
|| req.getArbitrateConfirm() == null || req.getArbitrateConfirm() == null
@@ -76,6 +76,10 @@ public class Constants
* 验证码有效期(分钟) * 验证码有效期(分钟)
*/ */
public static final Integer CAPTCHA_EXPIRATION = 2; public static final Integer CAPTCHA_EXPIRATION = 2;
/**
* 案件受理有效期(日)
*/
public static final Integer CASE_ACCEPT_EXPIRATION = 5;
/** /**
* 令牌 * 令牌
@@ -13,12 +13,12 @@ public enum AnnexTypeEnum implements EnumsInterface {
APPLICATION(1, "仲裁申请书"), APPLICATION(1, "仲裁申请书"),
APPLICATION_EVIDENCE(2, "申请人证据"), APPLICATION_EVIDENCE(2, "申请人证据"),
MEDIATION_APPLICATION(3, "调解申请书"), MEDIATION_APPLICATION(3, "调解申请书"),
PAYMENT_RECEIPT(4, "缴费单"), PAYMENT_RECEIPT(4, "申请人缴费单"),
MEETING_VIDEO(5, "会议视频"), MEETING_VIDEO(5, "会议视频"),
MEDIATE(6, "庭审笔录"), MEDIATE(6, "庭审笔录"),
MEDIATE_BOOK(7, "调解书"), MEDIATE_BOOK(7, "调解书"),
MEDIATION_FILES(8, "调解资料"), MEDIATION_FILES(8, "调解资料"),
RES_PAYMENT_RECEIPT(9, "被申请人缴费单"),
SEAL_PICTURE(10, "印章图片"), SEAL_PICTURE(10, "印章图片"),
@@ -1,14 +1,21 @@
package com.ruoyi.framework.config; package com.ruoyi.framework.config;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisKeyExpiredEvent;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript; import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
import javax.annotation.Resource;
/** /**
* redis配置 * redis配置
* *
@@ -18,6 +25,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@EnableCaching @EnableCaching
public class RedisConfig extends CachingConfigurerSupport public class RedisConfig extends CachingConfigurerSupport
{ {
@Resource
MsCaseApplicationService caseApplicationService;
@Bean @Bean
@SuppressWarnings(value = { "unchecked", "rawtypes" }) @SuppressWarnings(value = { "unchecked", "rawtypes" })
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
@@ -47,7 +57,28 @@ public class RedisConfig extends CachingConfigurerSupport
redisScript.setResultType(Long.class); redisScript.setResultType(Long.class);
return redisScript; return redisScript;
} }
@Bean
public RedisMessageListenerContainer listenerContainer(RedisConnectionFactory connectionFactory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
//container.addMessageListener(new KeyExpirationMessageListener(), new PatternTopic("__keyevent@0__:expired"));
return container;
}
@Bean
public KeyExpirationEventMessageListener keyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer) {
return new KeyExpirationEventMessageListener(listenerContainer);
}
@Bean
public ApplicationListener applicationListener() {
return (ApplicationListener<RedisKeyExpiredEvent>) event -> {
String key = new String(event.getSource());
// 根据key查询案件表
caseApplicationService.notAccept(key,"已超过案件受理期限五日,");
};
}
/** /**
* 限流脚本 * 限流脚本
*/ */
@@ -173,6 +173,7 @@ public class MsCaseApplication {
/** /**
* 版本号 * 版本号
*/ */
@Column(name = "version")
private Integer version; private Integer version;
/** /**
@@ -184,6 +185,7 @@ public class MsCaseApplication {
/** /**
* 事实和理由 * 事实和理由
*/ */
@Column(name = "facts")
private String facts; private String facts;
@@ -57,5 +57,13 @@ public class MsCaseApplicationVO extends MsCaseApplication {
* 待办状态,0-待办,1-已办 * 待办状态,0-待办,1-已办
*/ */
private Integer pendingStatus; private Integer pendingStatus;
/**
* 是否同意。0-拒绝,1-同意
*/
private Integer agreeFlag;
/**
* 拒绝原因
*/
private String rejectReason;
} }
@@ -117,7 +117,7 @@ public interface MsCaseApplicationService {
* @param req * @param req
* @return * @return
*/ */
AjaxResult accept(MsCaseApplication req); AjaxResult accept(MsCaseApplicationVO req);
/** /**
* 案件提交 * 案件提交
@@ -189,7 +189,7 @@ public interface MsCaseApplicationService {
* @param req * @param req
* @param affiliateMap * @param affiliateMap
*/ */
void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) ; void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) ;
/** /**
* 判断申请人/被申请人是否预约 * 判断申请人/被申请人是否预约
* @param vo * @param vo
@@ -202,4 +202,10 @@ public interface MsCaseApplicationService {
* @return * @return
*/ */
void verifyMediator(MsCaseApplication application,BookingVO vo); void verifyMediator(MsCaseApplication application,BookingVO vo);
/**
* 案件不予受理
* @param caseId
*/
void notAccept(String caseId,String reason);
} }
@@ -1,8 +1,10 @@
package com.ruoyi.wisdomarbitrate.service.mscase; package com.ruoyi.wisdomarbitrate.service.mscase;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
public interface MsCasePaymentService { public interface MsCasePaymentService {
@@ -32,5 +34,27 @@ public interface MsCasePaymentService {
*/ */
PaymentDetailVO selectPaymentDetail(Long id); PaymentDetailVO selectPaymentDetail(Long id);
/**
* 确认已缴费
* @param dto
* @return
*/
AjaxResult confirmPaid(CaseConfirmPayDTO dto); AjaxResult confirmPaid(CaseConfirmPayDTO dto);
/**
* 确认已缴费
* @param currentFlow
* @param nextFlow
* @param application
*/
public void confirmPaid(MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application);
/**
* 确认缴费
*
* @param nextFlow
* @param application
* @param dto
*/
public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto);
} }
@@ -331,7 +331,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 生成调解申请书 // 生成调解申请书
req.setTemplateId(String.valueOf(templateManage.getId())); req.setTemplateId(String.valueOf(templateManage.getId()));
// todo 部署放开 // todo 部署放开
// caseApplicationService.generateApplication(req); caseApplicationService.generateApplication(req);
} }
@@ -523,17 +523,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Override @Override
public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) { public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
// todo 压缩包解压路径 // 压缩包解压路径
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/"; String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
File zipFile = null; File zipFile = null;
InputStream ins = null; InputStream ins = null;
try { try {
ins = file.getInputStream(); ins = file.getInputStream();
//上传的压缩包保存的路径 //上传的压缩包保存的路径
// todo
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/"; String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
String saveName = uuid + "_" + file.getOriginalFilename(); String saveName = uuid + "_" + file.getOriginalFilename();
zipFile = new File(savePath + saveName); zipFile = new File(savePath + saveName);
inputChangeToFile(ins, zipFile); inputChangeToFile(ins, zipFile);
@@ -813,7 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/ */
@Transactional @Transactional
@Override @Override
public AjaxResult accept(MsCaseApplication req) { public AjaxResult accept(MsCaseApplicationVO req) {
if (StrUtil.isNotEmpty(req.getBatchNumber())) { if (StrUtil.isNotEmpty(req.getBatchNumber())) {
// 根据批号查询未锁定的案件 // 根据批号查询未锁定的案件
List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId());
@@ -829,25 +826,43 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
for (MsCaseApplication application : applicationList) { for (MsCaseApplication application : applicationList) {
caseApplicationService.accept(application,req,affiliateMap); // 不受理
if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
if(StrUtil.isEmpty(req.getRejectReason())){
throw new ServiceException("请填写拒绝原因");
}
caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
}else {
caseApplicationService.accept(application,req,affiliateMap);
}
} }
} else { } else {
// 查询案件信息 // 不受理
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
// 根据案件id查询案件相关人 if(StrUtil.isEmpty(req.getRejectReason())){
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); throw new ServiceException("请填写拒绝原因");
if (application==null||caseAffiliate == null) { }
return AjaxResult.error("该案件不存在"); caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
}else {
// 查询案件信息
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
// 根据案件id查询案件相关人
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
if (application==null||caseAffiliate == null) {
return AjaxResult.error("该案件不存在");
}
// 锁定该案件
application.setLockStatus(YesOrNoEnum.YES.getCode());
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
affiliateMap.put(req.getId(),caseAffiliate);
caseApplicationService.accept(application,req,affiliateMap);
} }
// 锁定该案件
application.setLockStatus(YesOrNoEnum.YES.getCode());
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
affiliateMap.put(req.getId(),caseAffiliate);
caseApplicationService.accept(application,req,affiliateMap);
} }
return AjaxResult.success("受理成功"); return AjaxResult.success();
} }
/** /**
* 案件受理 * 案件受理
@@ -856,7 +871,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param affiliateMap * @param affiliateMap
*/ */
@Transactional @Transactional
public void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) { public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) {
application.setPaperFlag(req.getPaperFlag()); application.setPaperFlag(req.getPaperFlag());
application.setArbitrateConfirm(req.getArbitrateConfirm()); application.setArbitrateConfirm(req.getArbitrateConfirm());
application.setMediationMethod(req.getMediationMethod()); application.setMediationMethod(req.getMediationMethod());
@@ -870,7 +887,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
// 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()}); Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
@@ -885,7 +902,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
// 给申请人被申请人发送短信 // 给申请人被申请人发送短信
if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) { if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
// 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()}); Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
@@ -1167,6 +1184,64 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), ""); CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
} }
/**
* 案件不予受理
* @param caseId
*/
@Transactional
@Override
public void notAccept(String caseId,String reason) {
if(StrUtil.isEmpty(caseId)){
return;
}
Long id = Long.valueOf(caseId);
// 根据案件id查询案件
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
if(application==null || affiliate==null){
return;
}
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
// 超过五日还没有受理,给申请人发送不受理通知
String phone="";
if(affiliate.getOrganizeFlag().equals(0)){
// 自然人
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
phone=affiliate.getContactTelphoneAgent();
}else {
phone=affiliate.getApplicationPhone();
}
}else {
phone=affiliate.getContactTelphoneAgent();
}
if(StrUtil.isNotEmpty(phone)) {
// 发送短信 2065809 案件不予受理通知 尊敬的用户,您编号为{1}的案件由于{2}所以不予受理,请知晓,如非本人操作,请忽略本短信。
Boolean smsFlag = SmsUtils.sendSms(id, "2065809", phone, new String[]{application.getCaseNum(),reason});
String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+reason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。";
CaseLogUtils.insertCaseLog(application.getId(), application.getCaseFlowId(), application.getCaseStatusName(), sendContent);
// 新增短信记录
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), phone, new Date(), sendContent);
if(smsFlag){
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
}else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
// 修改案件状态为17,结束
MsCaseApplication caseApplication = new MsCaseApplication();
caseApplication.setId(id);
caseApplication.setCaseFlowId(17);
caseApplication.setCaseStatusName("结束");
msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication);
CaseLogUtils.insertCaseLog(application.getId(), 17, "结束", null);
}
}
/** /**
* 查询预约信息 * 查询预约信息
* @param id * @param id
@@ -5,16 +5,20 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.ruoyi.ElegentPay; import com.ruoyi.ElegentPay;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.PaymentStatusEnum; import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse; import com.ruoyi.dto.PayResponse;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -38,6 +42,7 @@ 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.TimeUnit;
@Service @Service
public class MsCasePaymentServiceImpl implements MsCasePaymentService { public class MsCasePaymentServiceImpl implements MsCasePaymentService {
@@ -57,6 +62,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCaseFlowMapper caseFlowMapper; MsCaseFlowMapper caseFlowMapper;
@Autowired @Autowired
MsCaseAffiliateMapper caseAffiliateMapper; MsCaseAffiliateMapper caseAffiliateMapper;
@Autowired
MsCasePaymentService casePaymentService;
@Autowired
private RedisCache redisCache;
@Override @Override
@@ -161,7 +170,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件"); return AjaxResult.error("该批号下未找到案件");
} }
for (MsCaseApplication application : applicationList) { for (MsCaseApplication application : applicationList) {
confirmPayment(currentFlow,nextFlow, application, dto); casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
} }
} else { } else {
@@ -169,7 +178,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(dto.getCaseId()); application.setId(dto.getCaseId());
application.setLockStatus(YesOrNoEnum.YES.getCode()); application.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPayment(currentFlow,nextFlow, application, dto); casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
} }
return AjaxResult.success("确认缴费成功"); return AjaxResult.success("确认缴费成功");
@@ -277,13 +286,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件"); return AjaxResult.error("该批号下未找到案件");
} }
for (MsCaseApplication application : applicationList) { for (MsCaseApplication application : applicationList) {
confirmPaid(currentFlow,nextFlow, application); casePaymentService.confirmPaid(currentFlow,nextFlow, application);
} }
}else { }else {
MsCaseApplication caseApplication=new MsCaseApplication(); MsCaseApplication caseApplication=new MsCaseApplication();
caseApplication.setId(dto.getCaseId()); caseApplication.setId(dto.getCaseId());
caseApplication.setLockStatus(YesOrNoEnum.YES.getCode()); caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPaid(currentFlow,nextFlow,caseApplication ); casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication );
} }
@@ -296,7 +305,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param application * @param application
* @param * @param
*/ */
private void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) { @Transactional
public void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
// 查询案件
MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId());
if(caseAppllication==null){
throw new RuntimeException("未找到该案件");
}
//更改记录表里的支付状态和支付时间 //更改记录表里的支付状态和支付时间
MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord(); MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
casePaymentRecord.setPaymentStatus(1); casePaymentRecord.setPaymentStatus(1);
@@ -310,11 +325,46 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName()); application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
// 将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束
redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费"); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
// todo 发送短信
// 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信
MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
if(affiliate != null) {
String phone="";
String userName="";
if(affiliate.getOrganizeFlag().equals(0)){
// 自然人
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
phone=affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent();
}else {
phone=affiliate.getApplicationPhone();
userName=affiliate.getApplicationName();
}
}else {
phone=affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent();
}
if(StrUtil.isNotEmpty(phone)) {
// 发送短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。
Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", phone, new String[]{userName});
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人调解缴费成功通知短信,尊敬的" + userName + ",您的调解申请费用已缴费成功。");
// 新增短信记录
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + ",您的调解申请费用已缴费成功。");
if(smsFlag){
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
}else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
}
} }
/** /**
@@ -324,8 +374,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param application * @param application
* @param dto * @param dto
*/ */
@Transactional
private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) { public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
application.setPayType(dto.getPayType()); application.setPayType(dto.getPayType());
// 修改缴费附件 // 修改缴费附件
if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) { if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {