From 95cacd287b87744a0c50c08354305f157fb61d60 Mon Sep 17 00:00:00 2001 From: qitz <18810291185@163.com> Date: Fri, 5 Jan 2024 16:31:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=80=81=E8=BE=BE=E8=A3=81?= =?UTF-8?q?=E5=86=B3=E4=B9=A6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 29 ++- .../service/IAdjudicationService.java | 4 + .../service/impl/AdjudicationServiceImpl.java | 191 ++++++++++++++++++ 3 files changed, 223 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index 5abc938..da230f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -42,7 +42,7 @@ public class AdjudicationController extends BaseController { /** * 根据批号查询批量签名链接 */ - @PostMapping("/selectBatchSignUrl") + @PostMapping("/getSignUrlBatch") public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) { if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){ return error("参数校验失败"); @@ -170,6 +170,19 @@ public class AdjudicationController extends BaseController { return adjudicationService.caseFile(batchCaseApplication.getIds()); } + /** + * 批量归档(暂时只改案件状态) + * @param batchCaseApplication + * @return + */ + @PostMapping("/caseFileBatch") + public AjaxResult caseFileBatch(@RequestBody CaseApplication caseApplication){ + if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){ + return error("参数校验失败"); + } + return adjudicationService.caseFileBatch(caseApplication.getBatchNumber()); + } + /** * 送达(不包含发送电子邮件) * @param bookSendVO @@ -180,6 +193,20 @@ public class AdjudicationController extends BaseController { public AjaxResult service(@RequestBody BookSendVO bookSendVO){ return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); } + + /** + * 批量送达仲裁书 + * @param caseApplication + * @return + */ + @PostMapping("/serviceBatch") + public AjaxResult serviceBatch( CaseApplication caseApplication){ + if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){ + return error("参数校验失败"); + } + return adjudicationService.serviceBatch(caseApplication.getBatchNumber()); + } + /** * 用印(暂时只改案件状态) * @param caseApplication diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java index 401d67e..9ed4fa2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java @@ -61,4 +61,8 @@ public interface IAdjudicationService { SealSignRecord getSignUrlBatch(StringIdsReq idsReq); SealSignRecord getSealUrlBatch(StringIdsReq idsReq); + + AjaxResult caseFileBatch(Integer batchNumber); + + AjaxResult serviceBatch(Integer batchNumber); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index 784a5eb..b27883a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -744,6 +744,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } @Override + @Transactional public AjaxResult signature(CaseApplication caseApplication) { //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); @@ -755,6 +756,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } @Override + @Transactional public AjaxResult caseFile(List ids) { try { for (Long id : ids) { @@ -1529,6 +1531,195 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return signRecord; } + @Override + @Transactional + public AjaxResult caseFileBatch(Integer batchNumber) { + CaseApplication caseApplicationsel = new CaseApplication(); + caseApplicationsel.setBatchNumber(batchNumber); + caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_FILING); + List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); + if (caseApplications1 != null && caseApplications1.size() > 0) { + List ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList()); + try { + for (Long id : ids) { + CaseApplication caseApplication = new CaseApplication(); + caseApplication.setId(id); + //更改案件状态(暂时) + caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED); + caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_ARCHIVED, ""); + } + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + + }else{ + throw new ServiceException("这个批号没有批量归档的案件"); + } + + return AjaxResult.success("归档成功"); + } + + @Override + @Transactional + public AjaxResult serviceBatch(Integer batchNumber) { + CaseApplication caseApplicationsel = new CaseApplication(); + caseApplicationsel.setBatchNumber(batchNumber); + caseApplicationsel.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); + List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); + if (caseApplications1 != null && caseApplications1.size() > 0) { + List ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList()); + for (Long id : ids) { + CaseApplication caseApplication = new CaseApplication(); + caseApplication.setId(id); + CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); + if (caseApplication1 == null) { + return AjaxResult.error("未查询到相关案件"); + } + List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (CaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == 3) { + String annexName = caseAttach.getAnnexName(); + String prefix = "/profile/upload/"; + int startIndex = prefix.length(); + String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + File file = new File(path); + // todo 部署放开 + if (!file.exists()) { + return AjaxResult.error("未生成裁决书"); + } + + } + } + } + //修改案件状态 + caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING); + caseApplicationMapper.submitCaseApplication(caseApplication1); + + String appEmail = ""; + String resEmail = ""; + CaseAffiliate caseAffiliate = new CaseAffiliate(); + caseAffiliate.setCaseAppliId(id); + List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); + if (caseAffiliates != null && caseAffiliates.size() > 0) { + for (CaseAffiliate affiliate : caseAffiliates) { + if (affiliate.getIdentityType() == 1) { //申请人 + appEmail = affiliate.getSendEmail(); + } else { + resEmail = affiliate.getSendEmail(); + } + } + } + + //申请人发送邮件 + boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList); + SendMailRecord sendMailRecord = new SendMailRecord(); + sendMailRecord.setCaseId(id); + sendMailRecord.setMailAddress(appEmail); + sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅"); +// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); + sendMailRecord.setMailName("签署后的裁决书"); + sendMailRecord.setSendTime(new Date()); + sendMailRecord.setCreateBy(getUsername()); + if (appEmailFlag) { + sendMailRecord.setSendStatus(1); + } else { + sendMailRecord.setSendStatus(0); + } + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); + // 被申请人发送邮件 + boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList); + + SendMailRecord sendMailRecord1 = new SendMailRecord(); + sendMailRecord1.setCaseId(id); + sendMailRecord1.setMailAddress(resEmail); +// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); + sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅"); + sendMailRecord1.setMailName("签署后的裁决书"); + sendMailRecord1.setSendTime(new Date()); + sendMailRecord1.setCreateBy(getUsername()); + if (resEmailFlag) { + sendMailRecord1.setSendStatus(1); + }else { + sendMailRecord1.setSendStatus(0); + } + sendMailRecordMapper.saveSendMailRecord(sendMailRecord1); + if(!appEmailFlag&&!resEmailFlag){ + throw new ServiceException("裁决书发送失败"); + } + if(!appEmailFlag){ + throw new ServiceException("申请人裁决书发送失败"); + } + if(!resEmailFlag){ + throw new ServiceException("被申请人裁决书发送失败"); + } + // 发送短信 + if (appEmailFlag||resEmailFlag) { + + if (CollectionUtil.isNotEmpty(caseAffiliates)) { + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("1990362"); + for (CaseAffiliate affiliate : caseAffiliates) { + String telphone=null; + if(appEmailFlag&&affiliate.getIdentityType()==1){ + telphone = affiliate.getContactTelphone(); + }else if(resEmailFlag&&affiliate.getIdentityType()==2){ + telphone = affiliate.getContactTelphone(); + } + if(StrUtil.isEmpty(telphone)){ + continue; + } + + request.setPhone(telphone); +// if(affiliate.getIdentityType() == 1) { +// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail}); +// }else { +// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail}); +// } + request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()}); + Boolean aBoolean = SmsUtils.sendSms(request); + + // 保存短信发送记录 + SmsSendRecord smsSendRecord = new SmsSendRecord(); + smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId()); + + smsSendRecord.setCaseNum(caseApplication1.getCaseNum()); + smsSendRecord.setPhone(request.getPhone()); + smsSendRecord.setSendTime(new Date()); +// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。 +// if(affiliate.getIdentityType() == 1) { +// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); +// }else { +// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); +// } + smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。"); + + + smsSendRecord.setCreateBy(getUsername()); + if (aBoolean) { + smsSendRecord.setSendStatus(1); + } else { + smsSendRecord.setSendStatus(0); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + } + + } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication1.getId(), CaseApplicationConstants.CASE_FILING, ""); + + } + + } + + }else{ + throw new ServiceException("这个批号没有批量送达裁决书的案件"); + } + return AjaxResult.success("仲裁文书送达成功"); + } + /** * 根据仲裁员手机号分页查询等待签署,签署中的裁决书 *