From fe51b4f65580559af568782cd1c9573215206ff6 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 31 Jan 2024 17:33:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E5=8F=97=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsCaseApplicationController.java | 5 +- .../com/ruoyi/common/constant/Constants.java | 4 + .../com/ruoyi/common/enums/AnnexTypeEnum.java | 4 +- .../ruoyi/framework/config/RedisConfig.java | 31 +++++ .../entity/mscase/MsCaseApplication.java | 2 + .../domain/vo/mscase/MsCaseApplicationVO.java | 8 ++ .../mscase/MsCaseApplicationService.java | 10 +- .../service/mscase/MsCasePaymentService.java | 24 ++++ .../impl/MsCaseApplicationServiceImpl.java | 119 ++++++++++++++---- .../mscase/impl/MsCasePaymentServiceImpl.java | 66 ++++++++-- 10 files changed, 237 insertions(+), 36 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java index 269bc08..cc15c6e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java @@ -165,8 +165,9 @@ public class MsCaseApplicationController extends BaseController { * @return */ @PostMapping("/accept") - public AjaxResult accept(@RequestBody MsCaseApplication req ) { - if (StrUtil.isEmpty(req.getMediationMethod()) + public AjaxResult accept(@RequestBody MsCaseApplicationVO req ) { + if (StrUtil.isEmpty(req.getMediationMethod() ) + || req.getAgreeFlag()==null || req.getPaperFlag() == null || req.getCaseFlowId() == null || req.getArbitrateConfirm() == null diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index e46e514..4e8981f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -76,6 +76,10 @@ public class Constants * 验证码有效期(分钟) */ public static final Integer CAPTCHA_EXPIRATION = 2; + /** + * 案件受理有效期(日) + */ + public static final Integer CASE_ACCEPT_EXPIRATION = 5; /** * 令牌 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java index 9abc19d..7cf705f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java @@ -13,12 +13,12 @@ public enum AnnexTypeEnum implements EnumsInterface { APPLICATION(1, "仲裁申请书"), APPLICATION_EVIDENCE(2, "申请人证据"), MEDIATION_APPLICATION(3, "调解申请书"), - PAYMENT_RECEIPT(4, "缴费单"), + PAYMENT_RECEIPT(4, "申请人缴费单"), MEETING_VIDEO(5, "会议视频"), MEDIATE(6, "庭审笔录"), MEDIATE_BOOK(7, "调解书"), MEDIATION_FILES(8, "调解资料"), - + RES_PAYMENT_RECEIPT(9, "被申请人缴费单"), SEAL_PICTURE(10, "印章图片"), diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java index 3f4f485..341a3da 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -1,14 +1,21 @@ package com.ruoyi.framework.config; +import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; 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.script.DefaultRedisScript; +import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.data.redis.serializer.StringRedisSerializer; +import javax.annotation.Resource; + /** * redis配置 * @@ -18,6 +25,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; @EnableCaching public class RedisConfig extends CachingConfigurerSupport { + @Resource + MsCaseApplicationService caseApplicationService; + @Bean @SuppressWarnings(value = { "unchecked", "rawtypes" }) public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) @@ -47,7 +57,28 @@ public class RedisConfig extends CachingConfigurerSupport redisScript.setResultType(Long.class); 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) event -> { + String key = new String(event.getSource()); + // 根据key查询案件表 + caseApplicationService.notAccept(key,"已超过案件受理期限五日,"); + }; + } /** * 限流脚本 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index b2739d6..ec3b9ce 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -173,6 +173,7 @@ public class MsCaseApplication { /** * 版本号 */ + @Column(name = "version") private Integer version; /** @@ -184,6 +185,7 @@ public class MsCaseApplication { /** * 事实和理由 */ + @Column(name = "facts") private String facts; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java index ae38dea..29cc929 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java @@ -57,5 +57,13 @@ public class MsCaseApplicationVO extends MsCaseApplication { * 待办状态,0-待办,1-已办 */ private Integer pendingStatus; + /** + * 是否同意。0-拒绝,1-同意 + */ + private Integer agreeFlag; + /** + * 拒绝原因 + */ + private String rejectReason; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index 310a004..dcfa95d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -117,7 +117,7 @@ public interface MsCaseApplicationService { * @param req * @return */ - AjaxResult accept(MsCaseApplication req); + AjaxResult accept(MsCaseApplicationVO req); /** * 案件提交 @@ -189,7 +189,7 @@ public interface MsCaseApplicationService { * @param req * @param affiliateMap */ - void accept(MsCaseApplication application, MsCaseApplication req, Map affiliateMap) ; + void accept(MsCaseApplication application, MsCaseApplicationVO req, Map affiliateMap) ; /** * 判断申请人/被申请人是否预约 * @param vo @@ -202,4 +202,10 @@ public interface MsCaseApplicationService { * @return */ void verifyMediator(MsCaseApplication application,BookingVO vo); + + /** + * 案件不予受理 + * @param caseId + */ + void notAccept(String caseId,String reason); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java index bca6754..2f47d8f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java @@ -1,8 +1,10 @@ package com.ruoyi.wisdomarbitrate.service.mscase; 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.CasePayDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; public interface MsCasePaymentService { @@ -32,5 +34,27 @@ public interface MsCasePaymentService { */ PaymentDetailVO selectPaymentDetail(Long id); + /** + * 确认已缴费 + * @param dto + * @return + */ 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); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 8703f3f..c21575d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -331,7 +331,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 生成调解申请书 req.setTemplateId(String.valueOf(templateManage.getId())); // todo 部署放开 - // caseApplicationService.generateApplication(req); + caseApplicationService.generateApplication(req); } @@ -523,17 +523,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) { UUID uuid = UUID.randomUUID(); - // todo 压缩包解压路径 + // 压缩包解压路径 String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/"; -// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/"; File zipFile = null; InputStream ins = null; try { ins = file.getInputStream(); //上传的压缩包保存的路径 - // todo String savePath = "/home/ruoyi/uploadPath/upload/zipFile/"; -// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/"; String saveName = uuid + "_" + file.getOriginalFilename(); zipFile = new File(savePath + saveName); inputChangeToFile(ins, zipFile); @@ -813,7 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional @Override - public AjaxResult accept(MsCaseApplication req) { + public AjaxResult accept(MsCaseApplicationVO req) { if (StrUtil.isNotEmpty(req.getBatchNumber())) { // 根据批号查询未锁定的案件 List applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); @@ -829,25 +826,43 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); 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 { - // 查询案件信息 - MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); - // 根据案件id查询案件相关人 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); - if (application==null||caseAffiliate == null) { - return AjaxResult.error("该案件不存在"); + // 不受理 + if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){ + if(StrUtil.isEmpty(req.getRejectReason())){ + throw new ServiceException("请填写拒绝原因"); + } + 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 affiliateMap=new HashMap<>(); + affiliateMap.put(req.getId(),caseAffiliate); + caseApplicationService.accept(application,req,affiliateMap); } - // 锁定该案件 - application.setLockStatus(YesOrNoEnum.YES.getCode()); - Map 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 */ @Transactional - public void accept(MsCaseApplication application, MsCaseApplication req, Map affiliateMap) { + public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map affiliateMap) { + + application.setPaperFlag(req.getPaperFlag()); application.setArbitrateConfirm(req.getArbitrateConfirm()); application.setMediationMethod(req.getMediationMethod()); @@ -870,7 +887,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { - String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; + String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()}); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent); @@ -885,7 +902,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 给申请人被申请人发送短信 if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) { - String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; + String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()}); 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(), ""); } + + /** + * 案件不予受理 + * @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 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index e777b53..d6061e9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -5,16 +5,20 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import com.ruoyi.ElegentPay; +import com.ruoyi.common.constant.Constants; 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.PaymentStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; +import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO; 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.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; @@ -38,6 +42,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; @Service public class MsCasePaymentServiceImpl implements MsCasePaymentService { @@ -57,6 +62,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { MsCaseFlowMapper caseFlowMapper; @Autowired MsCaseAffiliateMapper caseAffiliateMapper; + @Autowired + MsCasePaymentService casePaymentService; + @Autowired + private RedisCache redisCache; @Override @@ -161,7 +170,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { return AjaxResult.error("该批号下未找到案件"); } for (MsCaseApplication application : applicationList) { - confirmPayment(currentFlow,nextFlow, application, dto); + casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto); } } else { @@ -169,7 +178,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { MsCaseApplication application = new MsCaseApplication(); application.setId(dto.getCaseId()); application.setLockStatus(YesOrNoEnum.YES.getCode()); - confirmPayment(currentFlow,nextFlow, application, dto); + casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto); } return AjaxResult.success("确认缴费成功"); @@ -277,13 +286,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { return AjaxResult.error("该批号下未找到案件"); } for (MsCaseApplication application : applicationList) { - confirmPaid(currentFlow,nextFlow, application); + casePaymentService.confirmPaid(currentFlow,nextFlow, application); } }else { MsCaseApplication caseApplication=new MsCaseApplication(); caseApplication.setId(dto.getCaseId()); 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 */ - 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(); casePaymentRecord.setPaymentStatus(1); @@ -310,11 +325,46 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { application.setCaseFlowId(nextFlow.getId()); application.setCaseStatusName(nextFlow.getCaseStatusName()); 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(),"确认已缴费"); - // 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 dto */ - - private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) { + @Transactional + public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) { application.setPayType(dto.getPayType()); // 修改缴费附件 if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {