admin权限修改,注册逻辑修改 #136
@@ -21,6 +21,7 @@ import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.security.context.AuthenticationContextHolder;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -56,6 +57,8 @@ public class SysLoginService
|
||||
private ISysConfigService configService;
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
@@ -231,7 +234,12 @@ public class SysLoginService
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
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){
|
||||
// 新增用户
|
||||
user = new SysUser();
|
||||
|
||||
+3
-1
@@ -63,7 +63,9 @@ public class SysPermissionService
|
||||
// 管理员拥有所有权限
|
||||
if (user.isAdmin())
|
||||
{
|
||||
perms.add("*:*:*");
|
||||
// 查询所有数据权限,排除案件管理下的权限即可
|
||||
perms.addAll(menuService.selectAdminMenu());
|
||||
// perms.add("*:*:*");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
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.entity.SysMenu;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
*
|
||||
@@ -141,4 +142,11 @@ public interface ISysMenuService
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkMenuNameUnique(SysMenu menu);
|
||||
|
||||
/**
|
||||
* 查询管理员权限
|
||||
* @return
|
||||
*/
|
||||
|
||||
Set<String> selectAdminMenu();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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 cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
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.SysRoleMenuMapper;
|
||||
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
|
||||
*/
|
||||
@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查询菜单
|
||||
@@ -346,6 +364,8 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取路由名称
|
||||
*
|
||||
|
||||
@@ -483,11 +483,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
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);
|
||||
for (Long userId : userIds) {
|
||||
// 删除缓存
|
||||
|
||||
+2
-10
@@ -120,18 +120,11 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
||||
if(checkPhoneUnique!=null){
|
||||
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();
|
||||
// if(roleIdByName==null){
|
||||
// return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
|
||||
// }
|
||||
if(sysUser!=null){
|
||||
sysUser.setIdCard(ientityAuthentication.getIdentityNo());
|
||||
sysUser.setNickName(ientityAuthentication.getName());
|
||||
@@ -145,7 +138,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
|
||||
ientityAuthentication.setUserId(sysUser.getUserId());
|
||||
int count=0;
|
||||
if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){
|
||||
|
||||
for (SysRole role : sysUser.getRoles()) {
|
||||
if(Objects.equals(role.getRoleId(), roleIdByName)){
|
||||
count++;
|
||||
|
||||
+377
-377
@@ -1806,8 +1806,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
if(CollectionUtil.isEmpty(operatorList)){
|
||||
return AjaxResult.error("未找到案件操作人员");
|
||||
}
|
||||
long applicantCount = operatorList.stream().filter(affiliate -> (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 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 ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count();
|
||||
if(applicantCount==0 && resCount==0){
|
||||
return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息");
|
||||
}else if(applicantCount==0 ){
|
||||
@@ -2534,6 +2534,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
}
|
||||
// 调解结果
|
||||
Integer mediaResult = req.getMediaResult();
|
||||
if (mediaResult == null) {
|
||||
return AjaxResult.error("请选择调解结果");
|
||||
}
|
||||
if (application.getMediationMethod().equals("1")) {
|
||||
// 线上调解
|
||||
List<MsCaseAttach> attachList = req.getAttachList();
|
||||
@@ -2639,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
double positionX = coordinateObj.getDoubleValue("positionX");
|
||||
double positionY = coordinateObj.getDoubleValue("positionY");
|
||||
sealSignRecord.setPositionXpsn(positionX + 120);
|
||||
sealSignRecord.setPositionYpsn(positionY+40);
|
||||
sealSignRecord.setPositionYpsn(positionY + 40);
|
||||
}
|
||||
} else if (keyword.equals("被申请人(签字):")) {
|
||||
//签名
|
||||
@@ -2654,7 +2657,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
double positionX = coordinateObj.getDoubleValue("positionX");
|
||||
double positionY = coordinateObj.getDoubleValue("positionY");
|
||||
sealSignRecord.setPositionXpsnRes(positionX + 120);
|
||||
sealSignRecord.setPositionYpsnRes(positionY+10 );
|
||||
sealSignRecord.setPositionYpsnRes(positionY + 10);
|
||||
}
|
||||
} else if (keyword.equals("调解员(签字):")) {
|
||||
//签名
|
||||
@@ -2669,7 +2672,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
double positionX = coordinateObj.getDoubleValue("positionX");
|
||||
double positionY = coordinateObj.getDoubleValue("positionY");
|
||||
sealSignRecord.setPositionXpsnMedi(positionX + 120);
|
||||
sealSignRecord.setPositionYpsnMedi(positionY+10 );
|
||||
sealSignRecord.setPositionYpsnMedi(positionY + 10);
|
||||
}
|
||||
} else {
|
||||
// 设置用印位置
|
||||
@@ -2854,6 +2857,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
}
|
||||
|
||||
application.setMediaResult(mediaResult);
|
||||
application.setSealFlag(req.getSealFlag());
|
||||
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
@@ -2867,412 +2871,408 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult.intValue() == 2) {
|
||||
//未达成调解
|
||||
//todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信
|
||||
// 申请人短信
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
request.setTemplateId("2066725");
|
||||
request.setPhone(applicantAffiliateOpt.get().getPhone());
|
||||
request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()});
|
||||
// todo 短信
|
||||
} else if (mediaResult == 2) {
|
||||
//未达成调解
|
||||
//todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信
|
||||
// 申请人短信
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
request.setTemplateId("2066725");
|
||||
request.setPhone(applicantAffiliateOpt.get().getPhone());
|
||||
request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()});
|
||||
// todo 短信
|
||||
// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request);
|
||||
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);
|
||||
if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
|
||||
appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
|
||||
} else {
|
||||
appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(appSmsSendRecord);
|
||||
// 被申请人短信
|
||||
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
|
||||
request1.setTemplateId("2066725");
|
||||
request1.setPhone(resAffiliateOpt.get().getPhone());
|
||||
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()});
|
||||
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);
|
||||
if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
|
||||
appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
|
||||
} else {
|
||||
appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(appSmsSendRecord);
|
||||
// 被申请人短信
|
||||
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
|
||||
request1.setTemplateId("2066725");
|
||||
request1.setPhone(resAffiliateOpt.get().getPhone());
|
||||
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()});
|
||||
// todo 短信注释
|
||||
// cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1);
|
||||
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);
|
||||
if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
|
||||
resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
|
||||
} else {
|
||||
resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(resSmsSendRecord);
|
||||
// 修改案件状态为结束
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
application.setCaseFlowId(caseFlow.getId());
|
||||
application.setCaseStatusName(caseFlow.getCaseStatusName());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult.intValue() == 3) {
|
||||
//未达成调解但不再争议
|
||||
// 修改案件状态为结束
|
||||
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());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult.intValue() == 4) {
|
||||
//未达成调解但同意引入仲裁
|
||||
String accessSec = "mCFMA6ffe938v79m";
|
||||
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
|
||||
BeanUtils.copyProperties(application, applicationVO);
|
||||
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);
|
||||
if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
|
||||
resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
|
||||
} else {
|
||||
resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(resSmsSendRecord);
|
||||
// 修改案件状态为结束
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
application.setCaseFlowId(caseFlow.getId());
|
||||
application.setCaseStatusName(caseFlow.getCaseStatusName());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult == 3) {
|
||||
//未达成调解但不再争议
|
||||
// 修改案件状态为结束
|
||||
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());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult == 4) {
|
||||
//未达成调解但同意引入仲裁
|
||||
String accessSec = "mCFMA6ffe938v79m";
|
||||
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
|
||||
BeanUtils.copyProperties(application, applicationVO);
|
||||
|
||||
CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
|
||||
BeanUtils.copyProperties(applicationVO, caseApplicationVO);
|
||||
boolean importFlag = applicationVO.isImportFlag();
|
||||
if (importFlag == true) {
|
||||
caseApplicationVO.setImportFlag(1);
|
||||
} else {
|
||||
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();
|
||||
// 修改案件状态为结束
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
application.setCaseFlowId(caseFlow.getId());
|
||||
application.setCaseStatusName(caseFlow.getCaseStatusName());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
}
|
||||
CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
|
||||
BeanUtils.copyProperties(applicationVO, caseApplicationVO);
|
||||
boolean importFlag = applicationVO.isImportFlag();
|
||||
if (importFlag) {
|
||||
caseApplicationVO.setImportFlag(1);
|
||||
} else {
|
||||
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();
|
||||
// 修改案件状态为结束
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
|
||||
// todo 新增结束日志
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
|
||||
application.setCaseFlowId(caseFlow.getId());
|
||||
application.setCaseStatusName(caseFlow.getCaseStatusName());
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKey(application);
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult.intValue() == 5) {
|
||||
// 达成和解
|
||||
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
for (MsCaseAttach caseAttach : caseAttachList) {
|
||||
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
||||
// String prefix = "/profile";
|
||||
// int startIndex = prefix.length();
|
||||
String annexPath = caseAttach.getAnnexPath();
|
||||
return AjaxResult.success();
|
||||
} else if (mediaResult == 5) {
|
||||
// 达成和解
|
||||
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
for (MsCaseAttach caseAttach : caseAttachList) {
|
||||
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
||||
// String prefix = "/profile";
|
||||
// int startIndex = prefix.length();
|
||||
String annexPath = caseAttach.getAnnexPath();
|
||||
// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
||||
if (annexPath.contains("/profile/upload")) {
|
||||
annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
|
||||
}
|
||||
String path = annexPath;
|
||||
//获取文件上传地址
|
||||
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
||||
String body = response.getBody();
|
||||
if (body != null) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String fileId = jsonObject.getJSONObject("data").getString("fileId");
|
||||
String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
|
||||
//上传文件流
|
||||
EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
||||
if (jsonObject1.getIntValue("errCode") == 0) {
|
||||
//查看文件上传状态
|
||||
Thread.sleep(1000);
|
||||
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
|
||||
JSONObject data = jsonObject2.getJSONObject("data");
|
||||
int fileStatus = data.getIntValue("fileStatus");
|
||||
if (fileStatus == 2 || fileStatus == 5) {
|
||||
String fileName = data.getString("fileName");
|
||||
//上传成功,获取文件签名印章位置
|
||||
SealSignRecord sealSignRecord = new SealSignRecord();
|
||||
sealSignRecord.setFileid(fileId);
|
||||
EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
|
||||
Gson gson = new Gson();
|
||||
JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
||||
JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
||||
String keywordPositions = positionsData.get("keywordPositions").toString();
|
||||
//发起签署
|
||||
sealSignRecord.setFilename(fileName);
|
||||
if (annexPath.contains("/profile/upload")) {
|
||||
annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
|
||||
}
|
||||
String path = annexPath;
|
||||
//获取文件上传地址
|
||||
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
||||
String body = response.getBody();
|
||||
if (body != null) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String fileId = jsonObject.getJSONObject("data").getString("fileId");
|
||||
String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
|
||||
//上传文件流
|
||||
EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
||||
if (jsonObject1.getIntValue("errCode") == 0) {
|
||||
//查看文件上传状态
|
||||
Thread.sleep(1000);
|
||||
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
|
||||
JSONObject data = jsonObject2.getJSONObject("data");
|
||||
int fileStatus = data.getIntValue("fileStatus");
|
||||
if (fileStatus == 2 || fileStatus == 5) {
|
||||
String fileName = data.getString("fileName");
|
||||
//上传成功,获取文件签名印章位置
|
||||
SealSignRecord sealSignRecord = new SealSignRecord();
|
||||
sealSignRecord.setFileid(fileId);
|
||||
EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
|
||||
Gson gson = new Gson();
|
||||
JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
||||
JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
||||
String keywordPositions = positionsData.get("keywordPositions").toString();
|
||||
//发起签署
|
||||
sealSignRecord.setFilename(fileName);
|
||||
|
||||
Long arbitratorId = application.getMediatorId();
|
||||
if (arbitratorId != null) {
|
||||
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
||||
if (sysUser == null) {
|
||||
Long arbitratorId = application.getMediatorId();
|
||||
if (arbitratorId != null) {
|
||||
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
||||
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();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// 修改案件状态为待签名
|
||||
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(), "");
|
||||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
application.setMediaResult(mediaResult);
|
||||
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
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 {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
// 线下调解
|
||||
List<MsCaseAttach> attachList = req.getAttachList();
|
||||
if (CollectionUtil.isEmpty(attachList)) {
|
||||
return AjaxResult.error("请上传调解资料");
|
||||
}
|
||||
// 先删除已经存在的调解书
|
||||
if (StrUtil.isEmpty(application.getCaseSource())) {
|
||||
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
if (CollectionUtil.isNotEmpty(existAttach)) {
|
||||
// todo 对接北明,同步案件状态,删除
|
||||
for (MsCaseAttach msCaseAttach : existAttach) {
|
||||
if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
|
||||
continue;
|
||||
} else {
|
||||
// 线下调解
|
||||
List<MsCaseAttach> attachList = req.getAttachList();
|
||||
if (CollectionUtil.isEmpty(attachList)) {
|
||||
return AjaxResult.error("请上传调解资料");
|
||||
}
|
||||
// 先删除已经存在的调解书
|
||||
if (StrUtil.isEmpty(application.getCaseSource())) {
|
||||
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
if (CollectionUtil.isNotEmpty(existAttach)) {
|
||||
// todo 对接北明,同步案件状态,删除
|
||||
for (MsCaseAttach msCaseAttach : existAttach) {
|
||||
if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
|
||||
continue;
|
||||
}
|
||||
beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
||||
}
|
||||
beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
for (MsCaseAttach attach : attachList) {
|
||||
attach.setCaseAppliId(req.getId());
|
||||
msCaseAttachMapper.updateCaseAttach(attach);
|
||||
}
|
||||
// todo 对接北明,调用上传附件接口
|
||||
List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
|
||||
for (MsCaseAttach msCaseAttach : msCaseAttaches) {
|
||||
String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
|
||||
File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
||||
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
|
||||
// 更新附件表
|
||||
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
|
||||
msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
||||
msCaseAttachMapper.updateCaseAttach(msCaseAttach);
|
||||
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
for (MsCaseAttach attach : attachList) {
|
||||
attach.setCaseAppliId(req.getId());
|
||||
msCaseAttachMapper.updateCaseAttach(attach);
|
||||
}
|
||||
// todo 对接北明,调用上传附件接口
|
||||
List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
|
||||
for (MsCaseAttach msCaseAttach : msCaseAttaches) {
|
||||
String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
|
||||
File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
||||
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
|
||||
// 更新附件表
|
||||
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
|
||||
msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
||||
msCaseAttachMapper.updateCaseAttach(msCaseAttach);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 修改案件状态为待送达
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
if (mediaResult == 1 || mediaResult == 5) {
|
||||
// 达成调解,达成和解,案件状态改为待送达
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
|
||||
} else if (mediaResult == 2 || mediaResult == 3) {
|
||||
// 未达成调解,未达成调解但不在争议改为结束状态
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
} else if (mediaResult == 4) {
|
||||
// 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
String accessSec = "mCFMA6ffe938v79m";
|
||||
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
|
||||
BeanUtils.copyProperties(application, applicationVO);
|
||||
// 修改案件状态为待送达
|
||||
Example flowExample = new Example(MsCaseFlow.class);
|
||||
if (mediaResult == 1 || mediaResult == 5) {
|
||||
// 达成调解,达成和解,案件状态改为待送达
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
|
||||
} else if (mediaResult == 2 || mediaResult == 3) {
|
||||
// 未达成调解,未达成调解但不在争议改为结束状态
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
} else if (mediaResult == 4) {
|
||||
// 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口
|
||||
flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
|
||||
String accessSec = "mCFMA6ffe938v79m";
|
||||
MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
|
||||
BeanUtils.copyProperties(application, applicationVO);
|
||||
|
||||
CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
|
||||
BeanUtils.copyProperties(applicationVO, caseApplicationVO);
|
||||
boolean importFlag = applicationVO.isImportFlag();
|
||||
if (importFlag == true) {
|
||||
caseApplicationVO.setImportFlag(1);
|
||||
} else {
|
||||
caseApplicationVO.setImportFlag(0);
|
||||
CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
|
||||
BeanUtils.copyProperties(applicationVO, caseApplicationVO);
|
||||
boolean importFlag = applicationVO.isImportFlag();
|
||||
if (importFlag == true) {
|
||||
caseApplicationVO.setImportFlag(1);
|
||||
} else {
|
||||
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);
|
||||
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();
|
||||
}
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
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);
|
||||
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
||||
if (caseFlow != null) {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user