This commit is contained in:
hejinbo
2023-11-17 14:25:53 +08:00
5 changed files with 88 additions and 30 deletions
@@ -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<CaseApplication> util = new ExcelUtil<CaseApplication>(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)
@@ -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) {
@@ -524,6 +524,22 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
if (caseApplication1 == null) {
return AjaxResult.error("未查询到相关案件");
}
List<CaseAttach> 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<CaseAttach> caseAttachList) {
List<File> fileList = new ArrayList<>();
File file = null;
List<CaseAttach> 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);
@@ -183,8 +183,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
if (role.getRoleName().equals("代理人")) {
// 查询角色有关的用户部门
List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
caseApplication.setAgentDeptIds(agentDeptIds);
// List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
List<Long> 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<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
List<Long> 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("【申请人主体信息-邮箱】字段不合法;");
}
@@ -2671,7 +2680,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("预约会议成功");
@@ -2699,7 +2708,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;
}
@@ -2713,7 +2722,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);
@@ -2761,7 +2770,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
public AjaxResult deleteRoom(String roomId) {
return AjaxResult.success(reservedConferenceMapper.deleteByRoomId(roomId));
return AjaxResult.success( reservedConferenceMapper.deleteByRoomId(roomId));
}
}
@@ -283,6 +283,16 @@
or ( t.identity_type=1 and t.case_status =#{financeStatus})
</if>
<!--代理人-->
<if test="agentDeptIds != null and agentDeptIds.size()>0">
or (
t.application_organ_id in
<foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
</foreach>
AND t.identity_type=1
and t.case_status in (0,9))
</if>
</where>
) t1
</select>