admin权限修改,注册逻辑修改

This commit is contained in:
18792927508
2024-04-09 16:22:08 +08:00
parent 6559304793
commit 02ba078238
7 changed files with 434 additions and 404 deletions
@@ -21,6 +21,7 @@ import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,8 @@ public class SysLoginService
private ISysConfigService configService; private ISysConfigService configService;
@Autowired @Autowired
private SysRoleMapper roleMapper; private SysRoleMapper roleMapper;
@Autowired
private SysUserMapper userMapper;
/** /**
* 登录验证 * 登录验证
@@ -231,7 +234,12 @@ public class SysLoginService
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
String username = loginBody.getUsername(); String username = loginBody.getUsername();
// 根据用户名获取用户信息,如果用户不存在则新增用户 // 根据用户名获取用户信息,如果用户不存在则新增用户
SysUser user = userService.selectUserByUserName(username); SysUser user =null;
if(username.contains("@")) {
user= userMapper.selectUserByEmail(username);
}else {
user= userService.selectUserByUserName(username);
}
if(user==null){ if(user==null){
// 新增用户 // 新增用户
user = new SysUser(); user = new SysUser();
@@ -63,7 +63,9 @@ public class SysPermissionService
// 管理员拥有所有权限 // 管理员拥有所有权限
if (user.isAdmin()) if (user.isAdmin())
{ {
perms.add("*:*:*"); // 查询所有数据权限,排除案件管理下的权限即可
perms.addAll(menuService.selectAdminMenu());
// perms.add("*:*:*");
} }
else else
{ {
@@ -1,11 +1,12 @@
package com.ruoyi.system.service; package com.ruoyi.system.service;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.domain.vo.RouterVo;
import java.util.List;
import java.util.Set;
/** /**
* 菜单 业务层 * 菜单 业务层
* *
@@ -141,4 +142,11 @@ public interface ISysMenuService
* @return 结果 * @return 结果
*/ */
public boolean checkMenuNameUnique(SysMenu menu); public boolean checkMenuNameUnique(SysMenu menu);
/**
* 查询管理员权限
* @return
*/
Set<String> selectAdminMenu();
} }
@@ -1,15 +1,6 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList; import cn.hutool.core.collection.CollectionUtil;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.TreeSelect;
@@ -24,6 +15,11 @@ import com.ruoyi.system.mapper.SysMenuMapper;
import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysRoleMenuMapper; import com.ruoyi.system.mapper.SysRoleMenuMapper;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 菜单 业务层处理 * 菜单 业务层处理
@@ -120,6 +116,28 @@ public class SysMenuServiceImpl implements ISysMenuService
} }
return permsSet; return permsSet;
} }
/**
* 查询管理员权限
* @return
*/
@Override
public Set<String> selectAdminMenu() {
Set<String> permsSet = new HashSet<>();
List<SysMenu> sysMenus = menuMapper.selectMenuList(new SysMenu());
Long caseMenuId =null;
if(CollectionUtil.isNotEmpty(sysMenus)){
Optional<SysMenu> optional = sysMenus.stream().filter(sysMenu -> sysMenu.getMenuName().equals("案件列表")).findFirst();
if(optional.isPresent()){
caseMenuId= optional.get().getMenuId();
}
for (SysMenu sysMenu : sysMenus) {
if(!sysMenu.getParentId().equals(caseMenuId)&&StringUtils.isNotEmpty(sysMenu.getPerms())){
permsSet.addAll(Arrays.asList(sysMenu.getPerms().trim().split(",")));
}
}
}
return permsSet;
}
/** /**
* 根据用户ID查询菜单 * 根据用户ID查询菜单
@@ -346,6 +364,8 @@ public class SysMenuServiceImpl implements ISysMenuService
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
/** /**
* 获取路由名称 * 获取路由名称
* *
@@ -483,11 +483,11 @@ public class SysUserServiceImpl implements ISysUserService {
checkUserDataScope(userId); checkUserDataScope(userId);
} }
// 删除用户与角色关联 // 删除用户与角色关联
userRoleMapper.deleteUserRole(userIds); // userRoleMapper.deleteUserRole(userIds);
// 删除用户与岗位关联 // 删除用户与岗位关联
userPostMapper.deleteUserPost(userIds); // userPostMapper.deleteUserPost(userIds);
// 删除用户部门关联 // 删除用户部门关联
userDeptMapper.deleteUserByIds(userIds); // userDeptMapper.deleteUserByIds(userIds);
int i = userMapper.deleteUserByIds(userIds); int i = userMapper.deleteUserByIds(userIds);
for (Long userId : userIds) { for (Long userId : userIds) {
// 删除缓存 // 删除缓存
@@ -120,18 +120,11 @@ public class WeChatUserServiceImpl implements WeChatUserService {
if(checkPhoneUnique!=null){ if(checkPhoneUnique!=null){
return AjaxResult.warn("手机号已存在"); return AjaxResult.warn("手机号已存在");
} }
SysUser checkEmailUnique = sysUserMapper.checkEmailUnique(ientityAuthentication.getEmail());
if(checkEmailUnique!=null){
return AjaxResult.warn("邮箱已存在");
}
// 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增 // 根据邮箱查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo()); SysUser sysUser=sysUserMapper.selectUserByEmail(ientityAuthentication.getEmail());
// 查询角色 // 查询角色
Long roleIdByName =ientityAuthentication.getRoleId(); Long roleIdByName =ientityAuthentication.getRoleId();
// if(roleIdByName==null){
// return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
// }
if(sysUser!=null){ if(sysUser!=null){
sysUser.setIdCard(ientityAuthentication.getIdentityNo()); sysUser.setIdCard(ientityAuthentication.getIdentityNo());
sysUser.setNickName(ientityAuthentication.getName()); sysUser.setNickName(ientityAuthentication.getName());
@@ -145,7 +138,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
ientityAuthentication.setUserId(sysUser.getUserId()); ientityAuthentication.setUserId(sysUser.getUserId());
int count=0; int count=0;
if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){ if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){
for (SysRole role : sysUser.getRoles()) { for (SysRole role : sysUser.getRoles()) {
if(Objects.equals(role.getRoleId(), roleIdByName)){ if(Objects.equals(role.getRoleId(), roleIdByName)){
count++; count++;
@@ -1806,8 +1806,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(CollectionUtil.isEmpty(operatorList)){ if(CollectionUtil.isEmpty(operatorList)){
return AjaxResult.error("未找到案件操作人员"); return AjaxResult.error("未找到案件操作人员");
} }
long applicantCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count(); long applicantCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count();
long resCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count(); long resCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count();
if(applicantCount==0 && resCount==0){ if(applicantCount==0 && resCount==0){
return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息"); return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息");
}else if(applicantCount==0 ){ }else if(applicantCount==0 ){
@@ -2534,6 +2534,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
// 调解结果 // 调解结果
Integer mediaResult = req.getMediaResult(); Integer mediaResult = req.getMediaResult();
if (mediaResult == null) {
return AjaxResult.error("请选择调解结果");
}
if (application.getMediationMethod().equals("1")) { if (application.getMediationMethod().equals("1")) {
// 线上调解 // 线上调解
List<MsCaseAttach> attachList = req.getAttachList(); List<MsCaseAttach> attachList = req.getAttachList();
@@ -2639,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
double positionX = coordinateObj.getDoubleValue("positionX"); double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY"); double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsn(positionX + 120); sealSignRecord.setPositionXpsn(positionX + 120);
sealSignRecord.setPositionYpsn(positionY+40); sealSignRecord.setPositionYpsn(positionY + 40);
} }
} else if (keyword.equals("被申请人(签字):")) { } else if (keyword.equals("被申请人(签字):")) {
//签名 //签名
@@ -2654,7 +2657,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
double positionX = coordinateObj.getDoubleValue("positionX"); double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY"); double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsnRes(positionX + 120); sealSignRecord.setPositionXpsnRes(positionX + 120);
sealSignRecord.setPositionYpsnRes(positionY+10 ); sealSignRecord.setPositionYpsnRes(positionY + 10);
} }
} else if (keyword.equals("调解员(签字):")) { } else if (keyword.equals("调解员(签字):")) {
//签名 //签名
@@ -2669,7 +2672,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
double positionX = coordinateObj.getDoubleValue("positionX"); double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY"); double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsnMedi(positionX + 120); sealSignRecord.setPositionXpsnMedi(positionX + 120);
sealSignRecord.setPositionYpsnMedi(positionY+10 ); sealSignRecord.setPositionYpsnMedi(positionY + 10);
} }
} else { } else {
// 设置用印位置 // 设置用印位置
@@ -2854,6 +2857,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
application.setMediaResult(mediaResult); application.setMediaResult(mediaResult);
application.setSealFlag(req.getSealFlag());
msCaseApplicationMapper.updateByPrimaryKeySelective(application); msCaseApplicationMapper.updateByPrimaryKeySelective(application);
} else { } else {
return AjaxResult.error(); return AjaxResult.error();
@@ -2867,412 +2871,408 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
} }
} return AjaxResult.success();
return AjaxResult.success(); } else if (mediaResult == 2) {
} else if (mediaResult.intValue() == 2) { //未达成调解
//未达成调解 //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信
//todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 // 申请人短信
// 申请人短信 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId("2066725");
request.setTemplateId("2066725"); request.setPhone(applicantAffiliateOpt.get().getPhone());
request.setPhone(applicantAffiliateOpt.get().getPhone()); request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()});
request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); // todo 短信
// todo 短信
// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request); // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request);
cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
// 新增短信记录 // 新增短信记录
SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null);
if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else { } else {
appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
} }
smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); smsRecordMapper.saveSmsSendRecord(appSmsSendRecord);
// 被申请人短信 // 被申请人短信
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
request1.setTemplateId("2066725"); request1.setTemplateId("2066725");
request1.setPhone(resAffiliateOpt.get().getPhone()); request1.setPhone(resAffiliateOpt.get().getPhone());
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()});
// todo 短信注释 // todo 短信注释
// cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1); // cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1);
cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject();
// 新增短信记录 // 新增短信记录
SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null);
if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else { } else {
resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
} }
smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); smsRecordMapper.saveSmsSendRecord(resSmsSendRecord);
// 修改案件状态为结束 // 修改案件状态为结束
Example flowExample = new Example(MsCaseFlow.class); Example flowExample = new Example(MsCaseFlow.class);
flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
if (caseFlow != null) { if (caseFlow != null) {
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
// todo 新增结束日志 // todo 新增结束日志
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
application.setCaseFlowId(caseFlow.getId()); application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult); application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application); msCaseApplicationMapper.updateByPrimaryKey(application);
} }
return AjaxResult.success(); return AjaxResult.success();
} else if (mediaResult.intValue() == 3) { } else if (mediaResult == 3) {
//未达成调解但不再争议 //未达成调解但不再争议
// 修改案件状态为结束 // 修改案件状态为结束
Example flowExample = new Example(MsCaseFlow.class); Example flowExample = new Example(MsCaseFlow.class);
flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
if (caseFlow != null) { if (caseFlow != null) {
application.setCaseFlowId(caseFlow.getId()); application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult); application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application); msCaseApplicationMapper.updateByPrimaryKey(application);
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
// todo 新增结束日志 // todo 新增结束日志
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
} }
return AjaxResult.success(); return AjaxResult.success();
} else if (mediaResult.intValue() == 4) { } else if (mediaResult == 4) {
//未达成调解但同意引入仲裁 //未达成调解但同意引入仲裁
String accessSec = "mCFMA6ffe938v79m"; String accessSec = "mCFMA6ffe938v79m";
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
BeanUtils.copyProperties(application, applicationVO); BeanUtils.copyProperties(application, applicationVO);
CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
BeanUtils.copyProperties(applicationVO, caseApplicationVO); BeanUtils.copyProperties(applicationVO, caseApplicationVO);
boolean importFlag = applicationVO.isImportFlag(); boolean importFlag = applicationVO.isImportFlag();
if (importFlag == true) { if (importFlag) {
caseApplicationVO.setImportFlag(1); caseApplicationVO.setImportFlag(1);
} else { } else {
caseApplicationVO.setImportFlag(0); caseApplicationVO.setImportFlag(0);
} }
String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
String urlstr = arbitrateUrl; String urlstr = arbitrateUrl;
HttpResponse httpResponse = HttpRequest.post(urlstr) HttpResponse httpResponse = HttpRequest.post(urlstr)
.header("timestampstr", String.valueOf(timestamp)) .header("timestampstr", String.valueOf(timestamp))
.header("signstr", signStr) .header("signstr", signStr)
.body(paramsbody) .body(paramsbody)
.execute(); .execute();
// 修改案件状态为结束 // 修改案件状态为结束
Example flowExample = new Example(MsCaseFlow.class); Example flowExample = new Example(MsCaseFlow.class);
flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
if (caseFlow != null) { if (caseFlow != null) {
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
// todo 新增结束日志 // todo 新增结束日志
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
application.setCaseFlowId(caseFlow.getId()); application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult); application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application); msCaseApplicationMapper.updateByPrimaryKey(application);
} }
return AjaxResult.success(); return AjaxResult.success();
} else if (mediaResult.intValue() == 5) { } else if (mediaResult == 5) {
// 达成和解 // 达成和解
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
if (caseAttachList != null && caseAttachList.size() > 0) { if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) { for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
// String prefix = "/profile"; // String prefix = "/profile";
// int startIndex = prefix.length(); // int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
if (annexPath.contains("/profile/upload")) { if (annexPath.contains("/profile/upload")) {
annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
} }
String path = annexPath; String path = annexPath;
//获取文件上传地址 //获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody(); String body = response.getBody();
if (body != null) { if (body != null) {
JSONObject jsonObject = JSONObject.parseObject(body); JSONObject jsonObject = JSONObject.parseObject(body);
String fileId = jsonObject.getJSONObject("data").getString("fileId"); String fileId = jsonObject.getJSONObject("data").getString("fileId");
String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
//上传文件流 //上传文件流
EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
if (jsonObject1.getIntValue("errCode") == 0) { if (jsonObject1.getIntValue("errCode") == 0) {
//查看文件上传状态 //查看文件上传状态
Thread.sleep(1000); Thread.sleep(1000);
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
JSONObject data = jsonObject2.getJSONObject("data"); JSONObject data = jsonObject2.getJSONObject("data");
int fileStatus = data.getIntValue("fileStatus"); int fileStatus = data.getIntValue("fileStatus");
if (fileStatus == 2 || fileStatus == 5) { if (fileStatus == 2 || fileStatus == 5) {
String fileName = data.getString("fileName"); String fileName = data.getString("fileName");
//上传成功,获取文件签名印章位置 //上传成功,获取文件签名印章位置
SealSignRecord sealSignRecord = new SealSignRecord(); SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setFileid(fileId); sealSignRecord.setFileid(fileId);
EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
Gson gson = new Gson(); Gson gson = new Gson();
JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
String keywordPositions = positionsData.get("keywordPositions").toString(); String keywordPositions = positionsData.get("keywordPositions").toString();
//发起签署 //发起签署
sealSignRecord.setFilename(fileName); sealSignRecord.setFilename(fileName);
Long arbitratorId = application.getMediatorId(); Long arbitratorId = application.getMediatorId();
if (arbitratorId != null) { if (arbitratorId != null) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
if (sysUser == null) { if (sysUser == null) {
return AjaxResult.error();
}
sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
sealSignRecord.setPensonNameMedi(sysUser.getNickName());
}
// todo 申请人账户
sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone());
sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName());
// 被申账户
sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone());
sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName());
//解析文件签名印章位置
JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject3 = jsonArray.getJSONObject(i);
String keyword = jsonObject3.getString("keyword");
if (keyword.equals("申请人(签字):")) {
//签名
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++) {
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsn(positionX + 120);
sealSignRecord.setPositionYpsn(positionY);
}
} else if (keyword.equals("被申请人(签字):")) {
//签名
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++) {
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsnRes(positionX + 120);
sealSignRecord.setPositionYpsnRes(positionY + 10);
}
}
}
EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject3 != null) {
if (jsonObject3.getIntValue("code") == 0) {
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(application.getId());
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
msSealSignRecord.setFileId(sealSignRecord.getFileid());
msSealSignRecord.setFileName(sealSignRecord.getFilename());
msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
sealSignRecordMapper.insert(msSealSignRecord);
// 申请人签名记录
SealSignRecord sealSignRecordapply = new SealSignRecord();
sealSignRecordapply.setSignFlowid(signFlowId);
sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone());
EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String urlapply = signUrlData.get("shortUrl").getAsString();
String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1);
//发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
// 申请人短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("2047719");
request.setPhone(applicantAffiliateOpt.get().getPhone());
request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew});
// todo 短信
// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request);
cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject();
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null);
// 新增短信记录
if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else {
smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
// 被申签名记录
SealSignRecord sealSignRecordRespon = new SealSignRecord();
sealSignRecordRespon.setSignFlowid(signFlowId);
sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone());
EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1);
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
request1.setTemplateId("2047719");
request1.setPhone(resAffiliateOpt.get().getPhone());
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
// todo 短信
// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1);
cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject();
SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null);
// 新增短信记录
if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else {
resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
}
smsRecordMapper.saveSmsSendRecord(resSendRecord);
} else {
throw new ServiceException(jsonObject3.getString("message"));
}
} else {
return AjaxResult.error(); return AjaxResult.error();
} }
sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
sealSignRecord.setPensonNameMedi(sysUser.getNickName()); // 修改案件状态为待签名
} Example flowExample = new Example(MsCaseFlow.class);
// todo 申请人账户 flowExample.createCriteria().andEqualTo("caseStatusName", "待签名");
sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); if (caseFlow != null) {
// 被申账户 application.setCaseFlowId(caseFlow.getId());
sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); application.setCaseStatusName(caseFlow.getCaseStatusName());
sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); // 新增日志
//解析文件签名印章位置 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject3 = jsonArray.getJSONObject(i);
String keyword = jsonObject3.getString("keyword");
if (keyword.equals("申请人(签字):")) {
//签名
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++) {
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsn(positionX + 120);
sealSignRecord.setPositionYpsn(positionY);
}
} else if (keyword.equals("被申请人(签字):")) {
//签名
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++) {
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsnRes(positionX + 120);
sealSignRecord.setPositionYpsnRes(positionY + 10);
}
} }
}
EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); return AjaxResult.success();
if (jsonObject3 != null) {
if (jsonObject3.getIntValue("code") == 0) {
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(application.getId());
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
msSealSignRecord.setFileId(sealSignRecord.getFileid());
msSealSignRecord.setFileName(sealSignRecord.getFilename());
msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
sealSignRecordMapper.insert(msSealSignRecord);
// 申请人签名记录
SealSignRecord sealSignRecordapply = new SealSignRecord();
sealSignRecordapply.setSignFlowid(signFlowId);
sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone());
EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String urlapply = signUrlData.get("shortUrl").getAsString();
String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1);
//发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
// 申请人短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("2047719");
request.setPhone(applicantAffiliateOpt.get().getPhone());
request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew});
// todo 短信
// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request);
cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject();
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null);
// 新增短信记录
if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else {
smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
// 被申签名记录
SealSignRecord sealSignRecordRespon = new SealSignRecord();
sealSignRecordRespon.setSignFlowid(signFlowId);
sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone());
EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1);
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
request1.setTemplateId("2047719");
request1.setPhone(resAffiliateOpt.get().getPhone());
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
// todo 短信
// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1);
cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject();
SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null);
// 新增短信记录
if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
} else {
resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
}
smsRecordMapper.saveSmsSendRecord(resSendRecord);
} else {
throw new ServiceException(jsonObject3.getString("message"));
}
} else { } else {
return AjaxResult.error(); return AjaxResult.error();
} }
// 修改案件状态为待签名
Example flowExample = new Example(MsCaseFlow.class);
flowExample.createCriteria().andEqualTo("caseStatusName", "待签名");
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
if (caseFlow != null) {
application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName());
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
}
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
return AjaxResult.success();
} else { } else {
return AjaxResult.error(); return AjaxResult.error();
} }
} else {
return AjaxResult.error();
} }
break;
} }
break;
} }
} }
} }
} } else {
// 线下调解
else List<MsCaseAttach> attachList = req.getAttachList();
if (CollectionUtil.isEmpty(attachList)) {
{ return AjaxResult.error("请上传调解资料");
// 线下调解 }
List<MsCaseAttach> attachList = req.getAttachList(); // 先删除已经存在的调解书
if (CollectionUtil.isEmpty(attachList)) { if (StrUtil.isEmpty(application.getCaseSource())) {
return AjaxResult.error("请上传调解资料"); List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
} if (CollectionUtil.isNotEmpty(existAttach)) {
// 先删除已经存在的调解书 // todo 对接北明,同步案件状态,删除
if (StrUtil.isEmpty(application.getCaseSource())) { for (MsCaseAttach msCaseAttach : existAttach) {
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
if (CollectionUtil.isNotEmpty(existAttach)) { continue;
// todo 对接北明,同步案件状态,删除 }
for (MsCaseAttach msCaseAttach : existAttach) { beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
continue;
} }
beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
} }
} }
} msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); for (MsCaseAttach attach : attachList) {
for (MsCaseAttach attach : attachList) { attach.setCaseAppliId(req.getId());
attach.setCaseAppliId(req.getId()); msCaseAttachMapper.updateCaseAttach(attach);
msCaseAttachMapper.updateCaseAttach(attach); }
} // todo 对接北明,调用上传附件接口
// todo 对接北明,调用上传附件接口 List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { for (MsCaseAttach msCaseAttach : msCaseAttaches) {
for (MsCaseAttach msCaseAttach : msCaseAttaches) { String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); File file = new File(templatePath.replace("/profile", "/uploadPath"));
File file = new File(templatePath.replace("/profile", "/uploadPath")); MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表
// 更新附件表 if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); msCaseAttachMapper.updateCaseAttach(msCaseAttach);
msCaseAttachMapper.updateCaseAttach(msCaseAttach); }
} }
} }
} // 修改案件状态为待送达
// 修改案件状态为待送达 Example flowExample = new Example(MsCaseFlow.class);
Example flowExample = new Example(MsCaseFlow.class); if (mediaResult == 1 || mediaResult == 5) {
if (mediaResult == 1 || mediaResult == 5) { // 达成调解,达成和解,案件状态改为待送达
// 达成调解,达成和解,案件状态改为待送达 flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); } else if (mediaResult == 2 || mediaResult == 3) {
} else if (mediaResult == 2 || mediaResult == 3) { // 未达成调解,未达成调解但不在争议改为结束状态
// 未达成调解,未达成调解但不在争议改为结束状态 flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); } else if (mediaResult == 4) {
} else if (mediaResult == 4) { // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口
// 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); String accessSec = "mCFMA6ffe938v79m";
String accessSec = "mCFMA6ffe938v79m"; MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); BeanUtils.copyProperties(application, applicationVO);
BeanUtils.copyProperties(application, applicationVO);
CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
BeanUtils.copyProperties(applicationVO, caseApplicationVO); BeanUtils.copyProperties(applicationVO, caseApplicationVO);
boolean importFlag = applicationVO.isImportFlag(); boolean importFlag = applicationVO.isImportFlag();
if (importFlag == true) { if (importFlag == true) {
caseApplicationVO.setImportFlag(1); caseApplicationVO.setImportFlag(1);
} else { } else {
caseApplicationVO.setImportFlag(0); caseApplicationVO.setImportFlag(0);
}
String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
long timestamp = System.currentTimeMillis();
String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
String urlstr = arbitrateUrl;
HttpResponse httpResponse = HttpRequest.post(urlstr)
.header("timestampstr", String.valueOf(timestamp))
.header("signstr", signStr)
.body(paramsbody)
.execute();
} }
String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
long timestamp = System.currentTimeMillis(); if (caseFlow != null) {
String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); application.setCaseFlowId(caseFlow.getId());
String urlstr = arbitrateUrl; application.setCaseStatusName(caseFlow.getCaseStatusName());
HttpResponse httpResponse = HttpRequest.post(urlstr) application.setMediaResult(mediaResult);
.header("timestampstr", String.valueOf(timestamp)) msCaseApplicationMapper.updateByPrimaryKey(application);
.header("signstr", signStr) // 新增日志
.body(paramsbody) CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
.execute(); if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
} CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); // todo 结束对接北明,为调解失败状态
if (caseFlow != null) { caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
application.setCaseFlowId(caseFlow.getId()); }
application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKey(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
// todo 结束对接北明,为调解失败状态
caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
} }
return AjaxResult.success();
} }
return AjaxResult.success();
return AjaxResult.error();
} }
return AjaxResult.success();
}
/** /**
* 确定会议结果 * 确定会议结果
* @param req * @param req