From f53f519d84bfbbc98e8ba718b8ff6e293a15b2b4 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 17 Nov 2023 10:39:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E6=A8=A1=E6=9D=BF=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 25 ++++++++- .../service/impl/SysUserServiceImpl.java | 2 +- .../service/impl/AdjudicationServiceImpl.java | 52 +++++++++++++------ .../impl/CaseApplicationServiceImpl.java | 29 +++++++---- .../wisdomarbitrate/CaseApplicationMapper.xml | 10 ++++ 5 files changed, 88 insertions(+), 30 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index ea82ce6..0a21f06 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -2,8 +2,10 @@ package com.ruoyi.web.controller.wisdomarbitrate; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import com.alipay.api.internal.util.file.IOUtils; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; @@ -11,6 +13,7 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.WxAppletNotifyUtils; +import com.ruoyi.util.FileUtil; import com.ruoyi.wisdomarbitrate.domain.*; import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; @@ -25,6 +28,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLEncoder; import java.util.List; @@ -184,8 +191,22 @@ public class CaseApplicationController extends BaseController { */ @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) { - ExcelUtil util = new ExcelUtil(CaseApplication.class); - util.importTemplateExcel(response, "立案申请数据"); + // 读取文件 + try { + InputStream fileInputStream = new URL("http://121.40.189.20:8000/API/uploadPath/template/案件导入模板.xlsx").openStream(); + response.setHeader("content-type", "application/octet-stream"); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("案件导入模板.xlsx","UTF-8")); + byte[] buffer = new byte[1024]; + int length; + while ((length = fileInputStream.read(buffer)) > 0) { + response.getOutputStream().write(buffer, 0, length); + } + + } catch (IOException e) { + throw new RuntimeException(e); + } + } @Log(title = "立案信息导入", businessType = BusinessType.IMPORT) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 978e99f..1024793 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -248,7 +248,7 @@ public class SysUserServiceImpl implements ISysUserService { if (deptId != null) { SysDept dept = sysDeptMapper.selectDeptById(deptId); Integer deptType = dept.getDeptType(); - if (deptType.intValue() == 1) { + if (deptType!=null && deptType.intValue() == 1) { SysPost sysPost = postMapper.selectPostByPostCode("jbr"); Long postId = sysPost.getPostId(); if (postIds.length > 0) { 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 c11542d..628309b 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 @@ -524,6 +524,22 @@ public class AdjudicationServiceImpl implements IAdjudicationService { 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); + if(!file.exists()){ + return AjaxResult.error("未生成裁决书"); + } + + } + } + } //修改案件状态 caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING); caseApplicationMapper.submitCaseApplication(caseApplication1); @@ -545,7 +561,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } //发送邮件 - boolean b = sendCaseEmail(caseApplication1, appEmail, resEmail); + boolean b = sendCaseEmail(caseApplication1, appEmail, resEmail,caseAttachList); SendMailRecord sendMailRecord = new SendMailRecord(); sendMailRecord.setCaseId(id); sendMailRecord.setMailAddress(appEmail); @@ -575,11 +591,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService { for (CaseAffiliate affiliate : caseAffiliates) { request.setPhone(affiliate.getContactTelphone()); - if(affiliate.getIdentityType() == 1) { - request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail}); - }else { - request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail}); - } +// 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[]{caseAffiliate.getName(), caseApplication1.getCaseNum()}); Boolean aBoolean = SmsUtils.sendSms(request); // 保存短信发送记录 @@ -589,14 +606,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService { smsSendRecord.setCaseNum(caseApplication1.getCaseNum()); smsSendRecord.setPhone(request.getPhone()); smsSendRecord.setSendTime(new Date()); - // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达至{3}邮箱,请知晓,如非本人操作,请忽略本短信。 - if(affiliate.getIdentityType() == 1) { - smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); - }else { - smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); - } +// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。 +// if(affiliate.getIdentityType() == 1) { +// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); +// }else { +// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); +// } + smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。"); - smsSendRecord.setCreateBy(getUsername()); + + smsSendRecord.setCreateBy(getUsername()); if (aBoolean) { smsSendRecord.setSendStatus(1); } else { @@ -627,11 +646,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { * @param appEmail * @param resEmail */ - private boolean sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) { + private boolean sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail, List caseAttachList) { List fileList = new ArrayList<>(); File file = null; - - List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1); if (caseAttachList != null && caseAttachList.size() > 0) { for (CaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == 3) { @@ -645,7 +662,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } } - if (file != null) { + + if (file != null && file.exists()) { try { Boolean aBoolean = emailOutUtil.sendEmil(appEmail, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null); Boolean aBoolean1 = emailOutUtil.sendEmil(resEmail, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 065c1b3..cb1ecff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -183,8 +183,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (role.getRoleName().equals("代理人")) { // 查询角色有关的用户部门 - List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); - caseApplication.setAgentDeptIds(agentDeptIds); + // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); + List agentDeptIds = new ArrayList<>(); + agentDeptIds.add(sysUser.getDeptId()); + caseApplication.setAgentDeptIds(agentDeptIds); } } @@ -246,6 +248,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // caseApplication.setIdCard(String.valueOf(sysUser.getIdCard())); } + if (role.getRoleName().equals("代理人")) { + // 查询角色有关的用户部门 + // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); + List agentDeptIds = new ArrayList<>(); + agentDeptIds.add(sysUser.getDeptId()); + caseApplication.setAgentDeptIds(agentDeptIds); + } } @@ -1389,7 +1398,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) { failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;"); - } else if (validateIdCard(caseApplication.getDebtorIdentityNumAgent())) { + } else if (!validateIdCard(caseApplication.getDebtorIdentityNumAgent())) { failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;"); } String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent(); @@ -1419,7 +1428,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) { failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;"); - } else if (validateIdCard(caseApplication.getDebtorIdentityNum())) { + } else if (!validateIdCard(caseApplication.getDebtorIdentityNum())) { failureMsg.append("【被申请人主体信息-身份证号】不合法;"); } String debtorContactTelphone = caseApplication.getDebtorContactTelphone(); @@ -1456,7 +1465,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) { failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;"); - } else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) { + } else if(!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()){ failureMsg.append("【被申请人主体信息-邮箱】字段不合法;"); } @@ -1562,7 +1571,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getEmail())) { failureMsg.append("【申请人主体信息-邮箱】字段不能为空;"); - } else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) { + } else if(!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()){ failureMsg.append("【申请人主体信息-邮箱】字段不合法;"); } @@ -2669,7 +2678,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 新增预约会议表 ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), roomId, - reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime(), 1); + reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime(),1); reservedConferenceMapper.insert(conference); return AjaxResult.success("预约会议成功"); @@ -2697,7 +2706,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String roomId = generateRoomId(); // 新增预约会议表 ReservedConference conference = new ReservedConference(caseId, roomId, - null, null, 0); + null, null,0); reservedConferenceMapper.insert(conference); return roomId; } @@ -2711,7 +2720,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 查询最大房间号 Integer maxRoomId = caseApplicationMapper.selectMaxRoomId(); - if (null == maxRoomId || maxRoomId > 999999) { + if (null == maxRoomId || maxRoomId >999999) { return "000001"; } else { return String.format("%06d", maxRoomId); @@ -2759,7 +2768,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override public AjaxResult deleteRoom(String roomId) { - return AjaxResult.success(reservedConferenceMapper.deleteByRoomId(roomId)); + return AjaxResult.success( reservedConferenceMapper.deleteByRoomId(roomId)); } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 4566363..4fd040e 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -283,6 +283,16 @@ or ( t.identity_type=1 and t.case_status =#{financeStatus}) + + + or ( + t.application_organ_id in + #{deptId} + + AND t.identity_type=1 + and t.case_status in (0,9)) + + ) t1