From 398d4a80d06944461adc0cd9ae0523f5d9156b58 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 21 Feb 2024 09:35:21 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D221?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsCaseApplicationController.java | 12 + .../MsCaseApplicationPayController.java | 18 +- .../domain/dto/mscase/CaseConfirmPayDTO.java | 12 + .../domain/entity/mscase/MsCaseAudit.java | 68 ++++++ .../vo/mscase/MsCaseApplicationReq.java | 4 + .../domain/vo/mscase/MsCaseApplicationVO.java | 4 + .../mscase/MsCaseApplicationMapper.java | 12 +- .../mapper/mscase/MsCaseAuditMapper.java | 17 ++ .../mscase/MsCaseApplicationService.java | 7 + .../service/mscase/MsCasePaymentService.java | 9 +- .../impl/MsCaseApplicationServiceImpl.java | 66 ++++-- .../mscase/impl/MsCasePaymentServiceImpl.java | 220 +++++++++++++----- .../mscase/MsCaseAuditMapper.xml | 18 ++ .../sendrecord/SendMailRecordMapper.xml | 4 +- 14 files changed, 388 insertions(+), 83 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAudit.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAuditMapper.java create mode 100644 ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAuditMapper.xml 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 bf509f8..a880184 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 @@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.IdCardUtils; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; @@ -354,4 +355,15 @@ public class MsCaseApplicationController extends BaseController { return success(videoService.reserveConferenceList(caseId)); } + /** + * 查询短信发送记录 + * @param smsSendRecord + * @return + */ + @PostMapping("/smsRecord") + public TableDataInfo getSmsSendRecord(@RequestBody SmsSendRecord smsSendRecord){ + startPage(); + List list = caseApplicationService.getSmsSendRecord(smsSendRecord); + return getDataTable(list); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationPayController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationPayController.java index 881eca9..872a0b8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationPayController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationPayController.java @@ -65,7 +65,7 @@ public class MsCaseApplicationPayController extends BaseController { } /** - * 确认缴费,支持批量(batchNumber不为空,则为批量) + * 申请人/被申请人确认缴费,支持批量(batchNumber不为空,则为批量) * @param dto 缴费传入参数 * @return 统一响应结果 */ @@ -79,7 +79,7 @@ public class MsCaseApplicationPayController extends BaseController { return casePaymentService.confirmPayment(dto); } /** - * 确认已缴费,支持批量(batchNumber不为空,则为批量) + * 财务确认已缴费,支持批量(batchNumber不为空,则为批量) * @param dto 缴费传入参数 * @return 统一响应结果 */ @@ -91,5 +91,17 @@ public class MsCaseApplicationPayController extends BaseController { } return casePaymentService.confirmPaid(dto); } - + /** + * 财务确认被申请人已缴费,支持批量(batchNumber不为空,则为批量) + * @param dto 缴费传入参数 + * @return 统一响应结果 + */ + @PostMapping("/resConfirmPaid") + public AjaxResult resConfirmPaid(@RequestBody CaseConfirmPayDTO dto) { + if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber())) + || dto.getCaseFlowId() == null) { + return error("参数校验失败"); + } + return casePaymentService.confirmPaid(dto); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/mscase/CaseConfirmPayDTO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/mscase/CaseConfirmPayDTO.java index 27a91f9..01d3942 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/mscase/CaseConfirmPayDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/mscase/CaseConfirmPayDTO.java @@ -30,5 +30,17 @@ public class CaseConfirmPayDTO { * 缴费凭证 */ private List payOrderList; + /** + * 是否同意,0-拒绝,1-同意 + */ + private Integer yesOrNo; + /** + * 拒绝原因 + */ + private String reason; + /** + * 是否申请人确认缴费 + */ + private Boolean applicantConfirm=true; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAudit.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAudit.java new file mode 100644 index 0000000..d4ea3fd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAudit.java @@ -0,0 +1,68 @@ +package com.ruoyi.wisdomarbitrate.domain.entity.mscase; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Getter +@Setter +@ToString +@Table(name = "ms_case_audit") +public class MsCaseAudit { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 案件申请id + */ + @Column(name = "case_appli_id") + private Long caseAppliId; + + /** + * 案件节点 + */ + @Column(name = "case_node") + private Integer caseNode; + + /** + * 案件状态 + */ + @Column(name = "case_status_name") + private String caseStatusName; + + /** + * 是否同意,0-拒绝,1-同意,默认1同意 + */ + @Column(name = "yes_or_no") + private Integer yesOrNo; + + /** + * 操作人用户名 + */ + @Column(name = "create_by") + private String createBy; + + /** + * 操作人用户昵称 + */ + @Column(name = "create_nick_name") + private String createNickName; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + + /** + * 拒绝原因 + */ + private String reason; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 003e5b2..2094447 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -95,6 +95,10 @@ public class MsCaseApplicationReq { * 是否小程序,1-是 */ private Integer miniProgressFlag ; + /** + * 是否线上调解,1-线上调解 + */ + private Integer mediationMethod ; /** * 附件 */ 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 8440c2d..77c7588 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 @@ -69,6 +69,10 @@ public class MsCaseApplicationVO extends MsCaseApplication { * 调解方式名称,1-线上调解,2-线下调解 */ private String mediationMethodName; + /** + * 缴费拒绝原因 + */ + private String reason; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java index 12112f9..9cc6cc5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java @@ -58,7 +58,12 @@ public interface MsCaseApplicationMapper extends Mapper { " " + "" + " AND c.case_flow_id = #{req.caseFlowId} " + - " " + + " " + + + "" + + " AND c.mediation_method = #{req.mediationMethod} " + + " " + + "" + " AND c.case_num like concat('%', #{req.caseNum}, '%') "+ " " @@ -82,6 +87,11 @@ public interface MsCaseApplicationMapper extends Mapper { "join ms_case_affiliate a on c.id=a.case_appli_id r.create_by=#{req.userName} and c.id not in (" + "select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id" + + "" + + " AND c.mediation_method = #{req.mediationMethod} " + + " " + + + " and a.application_id in" + "" + "#{organId}" + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAuditMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAuditMapper.java new file mode 100644 index 0000000..149d9d4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAuditMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.wisdomarbitrate.mapper.mscase; + +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAudit; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import tk.mybatis.mapper.common.Mapper; + +public interface MsCaseAuditMapper extends Mapper { + /** + * 查询拒绝原因 + * @param id + * @param caseFlowId + * @return + */ + @Select("select reason from ms_case_audit where case_appli_id=#{caseAppliId} and case_node=#{caseFlowId} order by id desc limit 1") + String selectByCaseId(@Param("caseAppliId") Long id, @Param("caseFlowId") Integer caseFlowId); +} \ No newline at end of file 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 6824efa..36c6973 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 @@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; +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; @@ -220,4 +221,10 @@ public interface MsCaseApplicationService { * 根据登录人返回用户信息 */ SysUser getUserInfo(); + /** + * 查询短信发送记录 + * @param smsSendRecord + * @return + */ + List getSmsSendRecord(SmsSendRecord smsSendRecord); } 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 2f47d8f..f51d36f 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 @@ -47,7 +47,14 @@ public interface MsCasePaymentService { * @param nextFlow * @param application */ - public void confirmPaid(MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application); + public void confirmPaid(CaseConfirmPayDTO dto,MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application); + /** + * 被申请人确认已缴费 + * @param dto + * @return + */ + AjaxResult resConfirmPaid(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 4eaf52b..8214eb7 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 @@ -140,6 +140,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { private SealManageMapper sealManageMapper; @Autowired private MsSealSignRecordMapper sealSignRecordMapper; + @Autowired + private MsCaseAuditMapper auditMapper; // 案件基本字段 public static final List CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); @@ -207,6 +209,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } + if(req.getMediationMethod()!=null){ + // 查询视频审理 + req.setCaseFlowId(9); + } startPage(); // 查询案件列表 return msCaseApplicationMapper.list(req, caseStatusNames); @@ -226,6 +232,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 自定义字段 List columnValueVOS = columnValueMapper.listByCaseId(id); vo.setColumnValueList(columnValueVOS); + // 查询拒绝原因 + vo.setReason(auditMapper.selectByCaseId(id,caseApplication.getCaseFlowId())); return vo; } @@ -314,7 +322,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) { affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", "")); } - msCaseAffiliateMapper.insert(affiliate); + msCaseAffiliateMapper.insert(affiliate); // 批量生成调解申请书 MsCaseApplicationReq req = new MsCaseApplicationReq(); req.setCaseFlowId(caseFlow.getId()); @@ -326,6 +334,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 生成调解申请书 req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); + req.setTemplateId(String.valueOf(templateId)); caseApplicationService.generateApplication(req); // 保存案件附件 @@ -876,8 +885,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map affiliateMap) { - - application.setPaperFlag(req.getPaperFlag()); application.setArbitrateConfirm(req.getArbitrateConfirm()); application.setMediationMethod(req.getMediationMethod()); @@ -885,30 +892,30 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setUpdateTime(new Date()); application.setBatchNumber(null); msCaseApplicationMapper.updateByPrimaryKeySelective(application); - MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); + // MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); // 给申请人被申请人发送短信 if (affiliateMap.containsKey(application.getId())) { MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); - if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { - String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; - // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2073601", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()}); - // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent); - if (smsFlag) { - // 发送成功 - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } +// if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())||StrUtil.isNotEmpty(affiliate.getApplicationPhone())) { +// String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; +// // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 +// Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2073601", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()}); +// // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent); +// SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent); +// if (smsFlag) { +// // 发送成功 +// smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); +// } else { +// smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); +// } +// smsRecordMapper.saveSmsSendRecord(smsSendRecord); +// } // 被申请人发送短信 if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) { - String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; - // 给被申请人发送案件受理短信 2068468 待缴费通知 尊敬的用户,您编号为{1}的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2068468", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()}); + String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; + // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 + Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()}); // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent); SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent); if (smsFlag) { @@ -1063,7 +1070,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (currentFlow == null) { return AjaxResult.error("当前流程不存在"); } - Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag(); + // Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag(); + // 预约,申请人预约为Null,否则为被申请人预约 + Integer miniProgressFlag=null; + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + if(role.getRoleName().equals("被申请人")){ + miniProgressFlag=YesOrNoEnum.YES.getCode(); + } + } + } + // 先删除已选择的调解员,在新增 Example mediatorExample = new Example(MsCaseMediator.class); Example.Criteria mediatorCriteria = mediatorExample.createCriteria(); @@ -1314,6 +1332,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } return sysUser; } + @Override + public List getSmsSendRecord(SmsSendRecord smsSendRecord) { + return smsRecordMapper.getSmsSendRecord(smsSendRecord); + } /** * 查询预约信息 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 d4024be..196a26b 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 @@ -11,6 +11,7 @@ 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.SecurityUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; @@ -19,15 +20,9 @@ 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; -import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCasePaymentRecord; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; -import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAffiliateMapper; -import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; -import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; -import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCasePaymentRecordMapper; +import com.ruoyi.wisdomarbitrate.mapper.mscase.*; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService; @@ -66,6 +61,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { MsCasePaymentService casePaymentService; @Autowired private RedisCache redisCache; + @Autowired + private MsCaseAuditMapper auditMapper; @Override @@ -273,101 +270,206 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { if (currentFlow == null) { return AjaxResult.error("未找到当前流程节点"); } + MsCaseFlow flow =null; + // 如果同意,查找下一个流程节点,拒绝,查找上一个流程 + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 同意,根据流程id查找下一个流程节点 + flow = caseFlowMapper.nextFlow(dto.getCaseFlowId()); + if (flow == null) { + return AjaxResult.error("未找到下一个流程节点"); + } + } else { + if (currentFlow.getBackFlowId() == null) { + return AjaxResult.error("未找到驳回流程"); + } + // 拒绝,查找驳回流程 + flow = caseFlowMapper.selectByPrimaryKey(currentFlow.getBackFlowId()); + if (flow == null) { + return AjaxResult.error("未找到驳回流程"); + } - // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId()); - if (nextFlow == null) { - return AjaxResult.error("未找到下一个流程节点"); } - if (StrUtil.isNotEmpty(dto.getBatchNumber())) { // 批量 List applicationList = applicationService.listByBatchNumber(dto.getBatchNumber(), dto.getCaseFlowId()); - if(CollectionUtil.isEmpty(applicationList)){ + if (CollectionUtil.isEmpty(applicationList)) { return AjaxResult.error("该批号下未找到案件"); } for (MsCaseApplication application : applicationList) { - casePaymentService.confirmPaid(currentFlow,nextFlow, application); + casePaymentService.confirmPaid(dto, currentFlow, flow, application); } - }else { - MsCaseApplication caseApplication=new MsCaseApplication(); + } else { + MsCaseApplication caseApplication = new MsCaseApplication(); caseApplication.setId(dto.getCaseId()); caseApplication.setLockStatus(YesOrNoEnum.YES.getCode()); - casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication ); + casePaymentService.confirmPaid(dto, currentFlow, flow, caseApplication); } - return AjaxResult.success("确认缴费成功"); + + return AjaxResult.success(); } /** * 确认已缴费 - * @param nextFlow + * @param flow * @param application * @param */ @Transactional - public void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) { + public void confirmPaid(CaseConfirmPayDTO dto, MsCaseFlow currentFlow, MsCaseFlow flow, MsCaseApplication application) { // 查询案件 MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId()); - if(caseAppllication==null){ + if (caseAppllication == null) { throw new RuntimeException("未找到该案件"); } //更改记录表里的支付状态和支付时间 MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord(); - casePaymentRecord.setPaymentStatus(1); + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 同意 + casePaymentRecord.setPaymentStatus(1); + casePaymentRecord.setPaymentTime(new Date()); + casePaymentRecord.setUpdateTime(new Date()); + }else { + casePaymentRecord.setPaymentStatus(0); + } casePaymentRecord.setCaseId(application.getId()); - casePaymentRecord.setPaymentTime(new Date()); - casePaymentRecord.setUpdateTime(new Date()); Example example = new Example(MsCasePaymentRecord.class); example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId()); - casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord,example); + casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example); // 更改案件流程id和案件状态 - application.setCaseFlowId(nextFlow.getId()); - application.setCaseStatusName(nextFlow.getCaseStatusName()); + application.setCaseFlowId(flow.getId()); + application.setCaseStatusName(flow.getCaseStatusName()); caseApplicationMapper.updateByPrimaryKeySelective(application); - // 将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束 - redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS); - + if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 申请人确认缴费后将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束 + redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS); + } // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费"); - + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "确认已缴费"); + }else { + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "拒绝确认缴费,拒绝原因为:"+dto.getReason()); + } + if (dto.getYesOrNo().equals(YesOrNoEnum.NO.getCode())) { + // 拒绝,新增审核记录 + MsCaseAudit audit = new MsCaseAudit(); + audit.setCaseNode(flow.getNodeId()); + audit.setCaseStatusName(flow.getCaseStatusName()); + audit.setCaseAppliId(dto.getCaseId()); + audit.setYesOrNo(dto.getYesOrNo()); + audit.setReason(dto.getReason()); + audit.setCreateTime(new Date()); + if (SecurityUtils.getLoginUser().getUser() != null) { + audit.setCreateBy(SecurityUtils.getUsername()); + audit.setCreateNickName(SecurityUtils.getLoginUser().getUser().getNickName()); + } + auditMapper.insert(audit); + } // 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信 MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId()); - if(affiliate != null) { - String phone=""; - String userName=""; - if(affiliate.getOrganizeFlag().equals(0)){ + // 发送缴费通知 + sendPaymentSms(dto,caseAppllication, affiliate,flow); + + + } + /** + * 被申请人确认已缴费 + * @param dto + * @return + */ + @Transactional + @Override + public AjaxResult resConfirmPaid(CaseConfirmPayDTO dto) { + dto.setApplicantConfirm(false); + confirmPaid(dto); + return AjaxResult.success(); + + } + + /** + * 发送缴费短信 + * @param dto + * @param caseAppllication + * @param affiliate + */ + private void sendPaymentSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication, MsCaseAffiliate affiliate,MsCaseFlow flow) { + if (affiliate != null) { + // 受理通知 + String phone = ""; + String userName = ""; + // 缴费通知 + String payPhone = ""; + String payUserName = ""; + if (affiliate.getOrganizeFlag().equals(0)) { // 自然人 - if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){ - phone=affiliate.getContactTelphoneAgent(); - userName=affiliate.getNameAgent(); - }else { - phone=affiliate.getApplicationPhone(); - userName=affiliate.getApplicationName(); + 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(); + } 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 + ",您的调解申请费用已缴费成功。"); - + if (StrUtil.isNotEmpty(phone)) { + payPhone=phone; + payUserName=userName; + if(!dto.getApplicantConfirm()) { + // 被申请人发送通知 + payPhone=affiliate.getRespondentPhone(); + payUserName=affiliate.getRespondentName(); + } + Boolean smsFlag =true; + SmsSendRecord smsSendRecord=null; + // 申请人被申请人发送缴费成功短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。 + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", payPhone, new String[]{payUserName}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + ",您的调解申请费用已缴费成功。"); + } else { + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", payPhone, new String[]{payUserName, caseAppllication.getCaseNum(), dto.getReason()}); + // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + } // 新增短信记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + ",您的调解申请费用已缴费成功。"); - if(smsFlag){ + if (smsFlag) { smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - }else { + } else { smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); + if(dto.getApplicantConfirm()&& dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 申请人发送受理短信 + sendAcceptSms(dto, caseAppllication, userName, phone); + // 被申请人发送受理短信 + sendAcceptSms(dto, caseAppllication, affiliate.getRespondentName(), affiliate.getRespondentPhone()); + } } } } + /** + * 发送受理短信 + * @param dto + * @param caseAppllication + */ + private void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { + // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 + Boolean smsFlag = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); + SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。"); + // 新增短信记录 + if (smsFlag) { + smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + + } + /** * 确认缴费 * @@ -380,7 +482,17 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { application.setPayType(dto.getPayType()); // 修改缴费附件 if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) { + + for (MsCaseAttach caseAttach : dto.getPayOrderList()) { + // 先删除之前的缴费 + if(currentFlow.getButtonAuthFlag().equals("caseManagement:list:pay")){ + // 申请人附件 + caseAttachMapper.deleteCaseAttachByCasedIdAndType(application.getId(),AnnexTypeEnum.PAYMENT_RECEIPT.getCode()); + }else { + // 被申请人缴费附件 + caseAttachMapper.deleteCaseAttachByCasedIdAndType(application.getId(),AnnexTypeEnum.RES_PAYMENT_RECEIPT.getCode()); + } caseAttach.setCaseAppliId(application.getId()); caseAttachMapper.updateCaseAttach(caseAttach); } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAuditMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAuditMapper.xml new file mode 100644 index 0000000..f42f40a --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAuditMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml index d73ad2d..0b38049 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml @@ -19,7 +19,7 @@ - insert into send_mail_record( + insert into ms_send_mail_record( mail_name, mail_content, mail_address,