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 a880184..6802630 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 @@ -278,12 +278,25 @@ public class MsCaseApplicationController extends BaseController { */ @PostMapping("/mediation") public AjaxResult mediation(@RequestBody MsCaseApplicationReq req) throws EsignDemoException, InterruptedException { - if (req.getCaseFlowId() == null || req.getId() == null) { + if (req.getCaseFlowId() == null || req.getId() == null || req.getMediaResult()==null) { return error("参数校验失败"); } return caseApplicationService.mediation(req); } + /** + * 确定会议结果 + * @param + * @return + */ + @PostMapping("/confirmMeetingResult") + public AjaxResult confirmMeetingResult(@RequestBody MsCaseApplicationReq req) { + if (req.getCaseFlowId() == null || req.getId() == null || req.getMediaResult()==null) { + return error("参数校验失败"); + } + + return caseApplicationService.confirmMeetingResult(req); + } /** * 修改庭审笔录 * @param diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/TemplateTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/TemplateTypeEnum.java index 88c7f2e..d7fdc56 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/TemplateTypeEnum.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/TemplateTypeEnum.java @@ -10,9 +10,10 @@ import com.ruoyi.common.interfaces.EnumsInterface; * @Created wangqiong */ public enum TemplateTypeEnum implements EnumsInterface { - MEDIATION_APPLICATION(1, "调解申请书模板"), + MEDIATION_APPLICATION(1, "机构调解申请书模板"), MEDIATION_AGREEMENT(2, "和解协议模板"), MEDIATE_BOOK(3, "调解书模板"), + PERSON_MEDIATION_APPLICATION(4, "自然人调解申请书模板"), 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 9cc6cc5..d608991 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 @@ -42,6 +42,10 @@ public interface MsCaseApplicationMapper extends Mapper { "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " + "join ms_case_affiliate a on c.id=a.case_appli_id " + + "" + + " AND c.mediator_id = #{req.mediatorId} " + + " " + + " and a.application_id in" + "" + "#{organId}" + @@ -87,8 +91,12 @@ 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 c1.mediator_id = #{req.mediatorId} " + + " " + + "" + - " AND c.mediation_method = #{req.mediationMethod} " + + " AND c1.mediation_method = #{req.mediationMethod} " + " " + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java index 6115a19..0dbc074 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java @@ -641,6 +641,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { ajax.put("temName",list.get(0).getTemName()); // 调节申请书 ajax.put("applicationFile",manageMap.get(TemplateTypeEnum.MEDIATION_APPLICATION.getCode())); + ajax.put("personApplicationFile",manageMap.get(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode())); // 和解协议 ajax.put("agreementFile",manageMap.get(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode())); // 调解书 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 36c6973..741b8c4 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 @@ -166,6 +166,12 @@ public interface MsCaseApplicationService { * @return */ AjaxResult mediation(MsCaseApplicationReq req) throws EsignDemoException, InterruptedException; + /** + * 确定会议结果 + * @param req + * @return + */ + AjaxResult confirmMeetingResult(MsCaseApplicationReq req); /** * 修改庭审笔录 @@ -227,4 +233,6 @@ public interface MsCaseApplicationService { * @return */ List getSmsSendRecord(SmsSendRecord smsSendRecord); + + } 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 8214eb7..c8ce7a2 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 @@ -168,6 +168,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { throw new ServiceException("该用户未指定角色"); } req.setUserName(SecurityUtils.getUsername()); + // 根据角色查询关联的案件状态 Example example = new Example(MsCaseFlowRoleRelated.class); example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); @@ -207,6 +208,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setRespondentIdentityNum(sysUser.getIdCard()); break; } + if(StrUtil.equals(role.getRoleName(),"调解员")) { + req.setMediatorId(String.valueOf(sysUser.getUserId())); + break; + } } } if(req.getMediationMethod()!=null){ @@ -333,7 +338,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setBatchNumber(caseApplication.getBatchNumber()); } // 生成调解申请书 - req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); + if(affiliate.getOrganizeFlag()==0){ + // 自然人 + req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); + }else { + // 机构 + req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); + } req.setTemplateId(String.valueOf(templateId)); caseApplicationService.generateApplication(req); @@ -892,25 +903,10 @@ 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())||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() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; @@ -1072,7 +1068,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag(); // 预约,申请人预约为Null,否则为被申请人预约 - Integer miniProgressFlag=null; + Integer miniProgressFlag=YesOrNoEnum.NO.getCode(); List roles = SecurityUtils.getLoginUser().getUser().getRoles(); if(CollectionUtil.isNotEmpty(roles)){ for (SysRole role : roles) { @@ -1081,7 +1077,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } - + vo.setMiniProgressFlag(miniProgressFlag); // 先删除已选择的调解员,在新增 Example mediatorExample = new Example(MsCaseMediator.class); Example.Criteria mediatorCriteria = mediatorExample.createCriteria(); @@ -1103,7 +1099,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 申请人预约 - if (vo.getMiniProgressFlag() == null) { + if (vo.getMiniProgressFlag() == null || vo.getMiniProgressFlag().equals( YesOrNoEnum.NO.getCode())) { // 新增日志 CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人选择调解员"); @@ -1142,11 +1138,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { Map userMap = mediatorUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); Example example = new Example(MsCaseMediator.class); Example.Criteria criteria = example.createCriteria(); - if(vo.getMiniProgressFlag() == null) { + if(vo.getMiniProgressFlag() == null || vo.getMiniProgressFlag().equals( YesOrNoEnum.NO.getCode())) { // 申请人预约,需要查询被申请人是否预约,identity_type不为空 criteria.andEqualTo("type", MediatorTypeEnum.MI_NI_PROGRESS.getCode()); }else { - // todo PC端被申请人选择调解员时,未存到预约表,导致节点状态未改变 // 被申请人预约,需要查询申请人是否预约,identity_type为空 criteria.andEqualTo("type", MediatorTypeEnum.PC.getCode()); } @@ -1202,12 +1197,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setLockStatus(null); msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 新增日志 - if(vo.getMiniProgressFlag() == null) { - CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "申请人选择调解员"); - }else { - CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "被申请人选择调解员"); - - } +// if(vo.getMiniProgressFlag() == null || vo.getMiniProgressFlag().equals( YesOrNoEnum.NO.getCode())) { +// CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "申请人选择调解员"); +// }else { +// CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "被申请人选择调解员"); +// +// } } } @@ -1259,12 +1254,63 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setCaseFlowId(nextFlow.getNodeId()); application.setCaseStatusName(nextFlow.getCaseStatusName()); msCaseApplicationMapper.updateByPrimaryKeySelective(application); - // todo 发送短信 + // 根据案件id查询案件 + MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); + MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(application.getId()); + if(caseApplication==null || affiliate==null){ + throw new ServiceException("未找到该案件"); + } + // 申请人电话 + String phone=""; + if(affiliate.getOrganizeFlag().equals(0)){ + // 自然人 + if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){ + phone=affiliate.getContactTelphoneAgent(); + }else { + phone=affiliate.getApplicationPhone(); + } + + }else { + phone=affiliate.getContactTelphoneAgent(); + } + + // 申请人发送开庭日期短信 + sendHearDateSms(application,phone); + // 被申发送开庭日期短信 + sendHearDateSms(application,affiliate.getRespondentPhone()); + // 调解员发送短信 + // 根据调解员id查询用户 + if(application.getMediatorId()!=null) { + SysUser sysUser = sysUserMapper.selectUserById(application.getMediatorId()); + sendHearDateSms(application, sysUser.getPhonenumber()); + } // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), ""); } + /** + * 发送开庭日期短信 + * @param application + * @param phone + */ + private void sendHearDateSms(MsCaseApplication application, String phone) { + if(StrUtil.isEmpty(phone)){ + return; + } + // 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2075447", phone, new String[]{application.getCaseNum(),application.getHearDate()}); + String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; + // 新增短信记录 + 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); + } + /** * 案件不予受理 * @param caseId @@ -1389,19 +1435,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); if (application.getMediationMethod().equals("1")) { // 线上调解 + List attachList = req.getAttachList(); + if(CollectionUtil.isNotEmpty(attachList)) { + // 先删除已经存在的调解书 + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + for (MsCaseAttach attach : attachList) { + attach.setCaseAppliId(req.getId()); + } + msCaseAttachMapper.batchSave(attachList); + } Integer mediaResult = req.getMediaResult(); - if(mediaResult!=null){ if(mediaResult.intValue()==1){ //达成调解 - if (application.getTemplateId() == null) { - return AjaxResult.error("未找到模板"); - } - String templateId = String.valueOf(application.getTemplateId()); - req.setTemplateId(templateId); - req.setTemplateType(TemplateTypeEnum.MEDIATE_BOOK.getCode()); - AjaxResult result = generateApplication(req); - if (result != null && result.isSuccess()) { List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { @@ -1690,7 +1736,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } - } + return AjaxResult.success(); }else if(mediaResult.intValue()==2){ //未达成调解 @@ -1764,15 +1810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { .body(paramsbody) .execute(); }else if(mediaResult.intValue()==5){ - //达成和解 - if (application.getTemplateId() == null) { - return AjaxResult.error("未找到模板"); - } - String templateId = String.valueOf(application.getTemplateId()); - req.setTemplateId(templateId); - req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()); - AjaxResult result = generateApplication(req); - if (result != null && result.isSuccess()) { + // 达成和解 List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { @@ -1984,7 +2022,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } - } } } @@ -1994,6 +2031,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(CollectionUtil.isEmpty(attachList)){ return AjaxResult.error("请上传调解资料"); } + // 先删除已经存在的调解书 + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(),AnnexTypeEnum.MEDIATE_BOOK.getCode()); for (MsCaseAttach attach : attachList) { attach.setCaseAppliId(req.getId()); } @@ -2016,6 +2055,38 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.error(); } + /** + * 确定会议结果 + * @param req + * @return + */ + @Override + public AjaxResult confirmMeetingResult(MsCaseApplicationReq req) { + // 查询案件是否存在 + MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); + if (application == null) { + return AjaxResult.error("未找到案件"); + } + if (application.getTemplateId() == null) { + return AjaxResult.error("未找到模板"); + } + String templateId = String.valueOf(application.getTemplateId()); + req.setTemplateId(templateId); + // 调解结果 + Integer mediaResult = req.getMediaResult(); + if(mediaResult==1){ + // 达成调解,生成调解协议 + req.setTemplateType(TemplateTypeEnum.MEDIATE_BOOK.getCode()); + + }else if(mediaResult==5){ + // 达成和解,生成和解协议 + req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()); + + } + AjaxResult result = generateApplication(req); + return AjaxResult.success(); + } + /** * 修改庭审笔录 * @param attach 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 196a26b..7fd8540 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 @@ -335,8 +335,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } casePaymentRecord.setCaseId(application.getId()); Example example = new Example(MsCasePaymentRecord.class); - example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId()); - casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example); + example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example); // 更改案件流程id和案件状态 application.setCaseFlowId(flow.getId()); application.setCaseStatusName(flow.getCaseStatusName()); @@ -354,7 +353,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { if (dto.getYesOrNo().equals(YesOrNoEnum.NO.getCode())) { // 拒绝,新增审核记录 MsCaseAudit audit = new MsCaseAudit(); - audit.setCaseNode(flow.getNodeId()); + audit.setCaseNode(flow.getId()); audit.setCaseStatusName(flow.getCaseStatusName()); audit.setCaseAppliId(dto.getCaseId()); audit.setYesOrNo(dto.getYesOrNo());