Commit cb057e5e authored by chenyuxi's avatar chenyuxi

feat: 审批代码+流程配置提交

parent 89fcbc77
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprProcessProperties;
import com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* @Author huyc
* @Date 2022-07-18
* @Description
* @Version 1.0
* 流程
* @author chenyuxi
* @date 2025-01-10 17:47:32
* @since 1.7.5
*/
@Log4j2
@EnableConfigurationProperties(DaprProcessProperties.class)
......@@ -18,4 +22,32 @@ public class ProcessDaprUtils {
@Autowired
private DaprProcessProperties daprProcessProperties;
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
public R<ProcessVo> getProcessVoByType(String processType) {
R<ProcessVo> processVoR = HttpDaprUtil.invokeMethodPost(daprProcessProperties.getAppUrl(),daprProcessProperties.getAppId(),"/tprocess/inner/getProcessVoByType", processType, ProcessVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(processVoR)){
return R.failed("根据流程类型查询ProcessVo失败!");
}
return processVoR;
}
/**
* 根据流程Id查询ProcessVo
* @param processId 流程ID
* @return R<ProcessVo>
* @since mvp1.7.5
**/
public R<ProcessVo> getProcessVoById(String processId) {
R<ProcessVo> processVoR = HttpDaprUtil.invokeMethodPost(daprProcessProperties.getAppUrl(),daprProcessProperties.getAppId(),"/tprocess/inner/getProcessVoByProcessId", processId, ProcessVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(processVoR)){
return R.failed("根据流程ID查询ProcessVo失败!");
}
return processVoR;
}
}
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -113,4 +110,12 @@ public class UpmsDaprUtils {
}
return userR;
}
public R<SysUserListVo> getUserByRoleIdForCrm(UserApprovalRoleVO userByApprovalRole) {
R<SysUserListVo> allUserVoR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/getUser/getUserByRoleIdForCrm",userByApprovalRole, SysUserListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(allUserVoR)){
return R.failed("查询流程配置审批角色对应的审批人失败!");
}
return allUserVoR;
}
}
......@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.InsuranceDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SalaryDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.EkpDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.PermissionDaprUtil
com.yifu.cloud.plus.v1.yifu.common.dapr.util.PermissionDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.ProcessDaprUtils
......@@ -38,6 +38,10 @@ dapr.permission.appId=yifu-permission
dapr.ekp.appUrl=http://yifu-ekp.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.ekp.appId=yifu-ekp
dapr.process.appUrl=http://yifu-process.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.process.appId=yifu-process
#\u6D4B\u8BD5\u73AF\u5883-\u85AA\u8D44\u670D\u52A1
#dapr.salary.appUrl=http://yifu-salary.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
#dapr.salary.appId=yifu-salary
......
package com.yifu.cloud.plus.v1.yifu.process.constant;
/**
* @auther wangan
* @date 2020/9/17
* @author chenyuxi
* @since 1.7.5
*/
public class ProcessConstants {
//审批中心各个节点类型
......@@ -14,9 +13,6 @@ public class ProcessConstants {
public static final String PROCESS_NODE_EMBED = "embed";
public static final String PROCESS_NODE_SERVICE = "service";
// 【含风险项目商险不购买申请流程】条件判断审批节点名称
public static final String PROCESS_NODE_INSURANCEUNPURCHASE_REASON_TYPE = "是否为已购买社保";
public static final String PROCESS_NODE_INSURANCEUNPURCHASE_DEPT_PROPERTY = "是否属于子分公司";
......
......@@ -84,7 +84,7 @@ public class TNodePrimission extends Model<TNodePrimission> {
private String approvalRole;
@Length(max = 10, message = "指定事业部配置表负责人标识不能超过10个字符")
@Schema(description = "指定事业部配置表负责人标识")
@Schema(description = "指定事业部配置表负责人标识(0事业部条线负责人;1事业部负责人;2分管副总)")
private String divisionIdentification;
@Length(max = 1, message = "是否允许直接通过不能超过1个字符")
......
......@@ -23,40 +23,4 @@ public class CommonProcessUserUtil {
public static final String FEGIN_USER_FAIL = "调用用户服务失败";
public static final String FEGIN_USER_RETURN_FAIL = "调用用户服务回失败";
/**
* 获取crm部门审核人
* @param nodePrimission
* @param departId
* @return List<SysUser>
**/
public static List<SysUser> getDepartAuditUser(TNodePrimission nodePrimission, String departId) {
SysUser remoteSysUser = null;
List<SysUser> remoteSysUserList = new ArrayList<>();
if (CommonConstants.THREE_INT == nodePrimission.getType().intValue()) {
//3.指定用户
if (Common.isEmpty(nodePrimission.getUser())) {
throw new CheckedException("未查询当前流程权限对应的用户");
}
// 查找当前用户
// todo 通过用户id查询用户角色
// remoteSysUser = RemoteRequestUtil.getSysUser(remoteUserService, Integer.parseInt(nodePrimission.getUser()));
remoteSysUserList.add(remoteSysUser);
} else if (CommonConstants.TWO_INT == nodePrimission.getType().intValue()) {
//2.指定角色
if (Common.isEmpty(nodePrimission.getRole())) {
throw new CheckedException("未查询当前流程对应的组织权限");
}
//如果下个节点是角色这要取下个角色是否存在
// remoteSysUser = RemoteRequestUtil.getUserManagerByRoleAndDepartId(remoteUserService, departId, nodePrimission.getRole());
remoteSysUserList.add(remoteSysUser);
} else if (CommonConstants.FIVE_INT == nodePrimission.getType().intValue()){
// 5.指定角色(crm)
if (Common.isEmpty(nodePrimission.getApprovalRole())) {
throw new CheckedException("未查询当前节点配置的审核角色");
}
// remoteSysUserList = RemoteRequestUtil.getUserByRoleIdForCrm(remoteUserService, departId, nodePrimission.getApprovalRole());
}
return remoteSysUserList;
}
}
package com.yifu.cloud.plus.v1.yifu.process.util;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.process.constant.ProcessConstants;
import com.yifu.cloud.plus.v1.yifu.process.entity.TNodeRoute;
......@@ -10,6 +12,7 @@ import com.yifu.cloud.plus.v1.yifu.process.entity.TProcessNode;
import com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
......@@ -30,41 +33,43 @@ public class ProcessAuditUtil {
public static final String BEGIN_NODE_NO_FOUND = "未找到开始节点";
/**
* @param
* @param processId
* @Author: wangan
* @Date: 2020/9/21
* @Description: 获通过流程id, 获取流程
* @return: com.yifu.cloud.plus.v1.process.api.vo.ProcessVo
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
public static ProcessVo getProcessVo(String processId) {
// todo 改成dapr请求
//R<ProcessVo> processVoR = remoteProcessService.getProcessVoByName(processId, SecurityConstants.FROM_IN);
R<ProcessVo> processVoR = new R<>();
if (processVoR == null) {
throw new CheckedException("调用流程服务返回为空");
}
if (CommonConstants.SUCCESS != processVoR.getCode()) {
throw new CheckedException("调用流程服务返回失败");
}
ProcessVo processVo = processVoR.getData();
if (processVo == null) {
throw new CheckedException("调用流程服务返回数据为空");
}
return processVo;
}
// public static ProcessVo getProcessVoByType(ProcessDaprUtils processDaprUtils, String processType) {
// // todo 改成dapr请求
// //R<ProcessVo> processVoR = remoteProcessService.getProcessVoByName(processId, SecurityConstants.FROM_IN);
// R<SysUserListVo> res = upmsDaprUtils.getUserIdsByUserNames(domain.getServiceTeam());
// if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())){
// // 先清理缓存
// this.removeSettleCache(null, res.getData().getUserIds());
// saveForEkp(res.getData().getUserList(), domain);
// }
// R<ProcessVo> processVoR = new R<>();
//
// if (processVoR == null) {
// throw new CheckedException("调用流程服务返回为空");
// }
// if (CommonConstants.SUCCESS != processVoR.getCode()) {
// throw new CheckedException("调用流程服务返回失败");
// }
// ProcessVo processVo = processVoR.getData();
// if (processVo == null) {
// throw new CheckedException("调用流程服务返回数据为空");
// }
// return processVo;
// }
/**
* 通过条件表达式判断路由的下一个节点
* @param nodeRouteList
* @param nodeRouteConditionList
* @param object
* @Author: wangan
* @Date: 2020/9/17
* @Description: 条件节点:通过条件表达式判断路由的下一个节点
* @return: com.yifu.cloud.plus.v1.process.api.entity.TNodeRoute
**/
public static TNodeRoute getTNodeRoteByExpress(List<TNodeRoute> nodeRouteList, List<TNodeRouteCondition> nodeRouteConditionList, Object object, Class<?> parameterTypes) {
TNodeRoute matchNodeRoute = null;
......@@ -149,10 +154,8 @@ public class ProcessAuditUtil {
throw new CheckedException(END_PRE_NODE_NO_FOUND);
}
return preEndTProcessNode;
}
/**
* @param processVo
* @Author: wangan
......@@ -164,16 +167,16 @@ public class ProcessAuditUtil {
//获取当前节点的下个节点
List<TProcessNode> processNodeList = processVo.getProcessNodeList();
//开始节点
TProcessNode startTProcessNode = null;
TProcessNode startProcessNode = null;
for (TProcessNode processNode : processNodeList) {
if (StringUtils.equals(ProcessConstants.PROCESS_NODE_BEGIN, processNode.getType())) {
startTProcessNode = processNode;
startProcessNode = processNode;
}
}
if (startTProcessNode == null) {
if (startProcessNode == null) {
throw new CheckedException(BEGIN_NODE_NO_FOUND);
}
return startTProcessNode;
return startProcessNode;
}
......
......@@ -99,53 +99,6 @@ public class TProcessApprovalConfController {
return new R<>(tProcessApprovalConfService.removeById(id));
}
/**
* todo
* @param type
* @param parentId
* @Author: wangan
* @Date: 2020/12/7
* @Description: 通过类型和父类名称去获取字段名称
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<TProcessApprovalConf>
* @see com.yifu.cloud.plus.v1.process.controller
**/
@Inner
@GetMapping("/inner/getRecord/byTypeAndParentId")
public R<TProcessApprovalConf> getRecordbyTypeAndParentId(@RequestParam("type") String type, @RequestParam("parentId") String parentId) {
List<TProcessApprovalConf> list = tProcessApprovalConfService.list(Wrappers.<TProcessApprovalConf>query().lambda()
.eq(TProcessApprovalConf::getType, type)
.eq(TProcessApprovalConf::getParentId, parentId)
.eq(TProcessApprovalConf::getDeleteFlag, CommonConstants.ZERO_STRING));
if (list.isEmpty()) {
return new R<>(null);
}
return new R<>(list.get(CommonConstants.ZERO_INT));
}
/**
* todo
* @param type
* @param parentId
* @Author: wangan
* @Date: 2020/12/7
* @Description: 通过相关条件获取正确的一个主流程
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<TProcessApprovalConf>
* @see com.yifu.cloud.plus.v1.process.controller
**/
@Inner
@GetMapping("/inner/getRecord/byCondition")
public R<TProcessApprovalConf> getRecordByCondition(@RequestParam("type") String type,
@RequestParam("parentId") String parentId,
@RequestParam("fieldName") String fieldName,
@RequestParam("fieldValue") String fieldValue) {
return tProcessApprovalConfService.getRecordByCondition(type,parentId,fieldName,fieldValue);
}
/**
* todo
* @param processId
......
......@@ -26,7 +26,7 @@ import java.time.LocalDateTime;
/**
* 主流程表
*
* @author hgw
* @author chenyuxi
* @date 2020-07-16 15:44:02
*/
@RestController
......@@ -89,18 +89,27 @@ public class TProcessController {
}
/**
* todo
* @param processId 流程名称
* @Description: 根据流程名称查询ProcessVo
* @Author: hgw
* @Date: 2020-7-22 18:17:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<ProcessVo>
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@PostMapping("/inner/getProcessVoByType")
@Inner
public ProcessVo getProcessVoByType(String processType) {
return tProcessService.getProcessVoByType(processType);
}
/**
* 根据流程Id查询ProcessVo
* @param processId 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@Operation(summary = "根据流程名称查询ProcessVo")
@PostMapping("/inner/getProcessVoByName")
@PostMapping("/inner/getProcessVoByProcessId")
@Inner
public R<ProcessVo> getProcessVoByName(String processId) {
return tProcessService.getProcessVoByName(processId);
public ProcessVo getProcessVoByProcessId(String processId) {
return tProcessService.getProcessVoById(processId);
}
/**
......
......@@ -34,13 +34,12 @@ public interface TProcessService extends IService<TProcess> {
ProcessVo getProcessVoById(String id);
/**
* @param processId
* @Description: 返回ProcessVo
* @Author: hgw
* @Date: 2020-7-22 18:18:42
* @return: ProcessVo
* 根据流程类型查询ProcessVo
* @param processType 流程类型
*
* @return R<ProcessVo>
**/
R<ProcessVo> getProcessVoByName(String processId);
ProcessVo getProcessVoByType(String processType);
/**
* @param processVo
......
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.process.vo.DeleteProcessIdsVo;
import com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo;
import com.yifu.cloud.plus.v1.yifu.process.vo.TProcessViewVo;
import com.yifu.cloud.plus.v1.yifu.process.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -44,6 +45,7 @@ import static com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants.F
* @date 2020-07-16 15:44:02
*/
@Service
@Slf4j
public class TProcessServiceImpl extends ServiceImpl<TProcessMapper, TProcess> implements TProcessService {
@Resource
......@@ -231,75 +233,66 @@ public class TProcessServiceImpl extends ServiceImpl<TProcessMapper, TProcess> i
}
/**
* @param processId
* @Description: 获取包装类
* @Author: hgw
* @Date: 2020/7/17 11:05
* @return: ProcessVo
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@Override
public R<ProcessVo> getProcessVoByName(String processId) {
// 主流程表
public ProcessVo getProcessVoByType(String processType) {
TProcessApprovalConf approvalConf = processApprovalConfService.getOne(Wrappers.<TProcessApprovalConf>query().lambda()
.eq(TProcessApprovalConf::getType, processType)
.eq(TProcessApprovalConf::getDeleteFlag, CommonConstants.ZERO_STRING).last(CommonConstants.SQL_LIMIT_ONE));
if(Common.isEmpty(approvalConf)){
log.error("根据类型获取流程配置失败>>processType={}",processType);
return null;
}
// 获取主流程信息
ProcessVo processVo = new ProcessVo();
TProcess process = this.getById(processId);
if (process == null) {
return R.failed("获取流程失败");
TProcess process = this.getById(approvalConf.getProcessId());
if (Common.isEmpty(process)) {
log.error("获取主流程信息失败>>processId={}",approvalConf.getProcessId());
return null;
}
String processId = process.getId();
processVo.setProcessId(processId);
processVo.setName(process.getName());
// 节点
TProcessNode processNode = new TProcessNode();
processNode.setProcessId(processId);
// 节点查询
QueryWrapper<TProcessNode> queryWrapperPn = new QueryWrapper<>();
queryWrapperPn.setEntity(processNode);
// 节点列表
List<TProcessNode> processNodeList = processNodeService.list(queryWrapperPn);
if (processNodeList != null && !processNodeList.isEmpty()) {
// 权限
TNodePrimission nodePrimission;
// 权限查询
QueryWrapper<TNodePrimission> queryWrapperNp;
// 权限列表
// 获取节点列表信息
List<TProcessNode> processNodeList = processNodeService.list(Wrappers.<TProcessNode>query().lambda()
.eq(TProcessNode::getProcessId, processId));
if (Common.isNotNull(processNodeList)) {
// 定义审批用户列表
List<TNodePrimission> nodePrimissionList;
// 抄送
TNodeReaderPromission nodeReaderPromission;
// 抄送查询
QueryWrapper<TNodeReaderPromission> queryWrapperNrp;
// 抄送列表
// 定义抄送用户列表
List<TNodeReaderPromission> nodeReaderPromissionList;
for (TProcessNode proNode : processNodeList) {
nodePrimission = new TNodePrimission();
nodePrimission.setNodeId(proNode.getId());
queryWrapperNp = new QueryWrapper<>();
queryWrapperNp.setEntity(nodePrimission);
nodePrimissionList = nodePrimissionService.list(queryWrapperNp);
proNode.setNodePrimissionList(nodePrimissionList);
nodeReaderPromission = new TNodeReaderPromission();
nodeReaderPromission.setNodeId(proNode.getId());
queryWrapperNrp = new QueryWrapper<>();
queryWrapperNrp.setEntity(nodeReaderPromission);
nodeReaderPromissionList = nodeReaderPromissionService.list(queryWrapperNrp);
proNode.setNodeReaderPromissionList(nodeReaderPromissionList);
//子流程
proNode.setNodeTransferConfigs(nodeTransferConfigService.list(Wrappers.<TNodeTransferConfig>query().lambda().eq(TNodeTransferConfig::getNodeId, proNode.getId())));
for (TProcessNode nodeInfo : processNodeList) {
// 赋值审批用户列表
nodePrimissionList = nodePrimissionService.list(Wrappers.<TNodePrimission>query().lambda()
.eq(TNodePrimission::getNodeId, nodeInfo.getId()));
nodeInfo.setNodePrimissionList(nodePrimissionList);
// 赋值抄送用户列表
nodeReaderPromissionList = nodeReaderPromissionService.list(Wrappers.<TNodeReaderPromission>query().lambda()
.eq(TNodeReaderPromission::getNodeId, nodeInfo.getId()));
nodeInfo.setNodeReaderPromissionList(nodeReaderPromissionList);
}
}
processVo.setProcessNodeList(processNodeList);
// 路由
TNodeRoute nodeRoute = new TNodeRoute();
nodeRoute.setProcessId(processId);
// 路由查询
QueryWrapper<TNodeRoute> queryWrapperNr = new QueryWrapper<>();
queryWrapperNr.setEntity(nodeRoute);
// 路由列表
List<TNodeRoute> nodeRouteList = nodeRouteService.list(queryWrapperNr);
for (TNodeRoute tNodeRoute : nodeRouteList) { tNodeRoute.setNodeRouteConditionList(nodeRouteConditionService.list(Wrappers.<TNodeRouteCondition>query().lambda().eq(TNodeRouteCondition::getNodeRouteId,tNodeRoute.getId())));
List<TNodeRoute> nodeRouteList = nodeRouteService.list(Wrappers.<TNodeRoute>query().lambda()
.eq(TNodeRoute::getProcessId, processId));
// 路由条件判断列表
if (Common.isNotNull(nodeRouteList)) {
List<TNodeRouteCondition> nodeRouteConditionList;
for (TNodeRoute tNodeRoute : nodeRouteList) {
nodeRouteConditionList = nodeRouteConditionService.list(Wrappers.<TNodeRouteCondition>query().lambda().eq(TNodeRouteCondition::getNodeRouteId,tNodeRoute.getId()));
tNodeRoute.setNodeRouteConditionList(nodeRouteConditionList);
}
processVo.setNodeRouteList(nodeRouteList);
return new R<>(processVo);
}
return processVo;
}
/**
......
......@@ -21,10 +21,10 @@ import java.time.LocalDateTime;
* @since 1.7.5
*/
@Data
@TableName("t_audit_node_proocess")
@TableName("t_audit_node_process")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "审批主流程记录表节点表")
public class TAuditNodeProocess extends BaseEntity {
public class TAuditNodeProcess extends BaseEntity {
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
......
package com.yifu.cloud.plus.v1.yifu.salary.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Author: huyc
* @Date: 2023/7/28
* @Description:
* @return: 企业微信配置
**/
@Configuration
@Data
@Slf4j
public class WxConfig {
@Value("${wx.corpid}")
private String corpid;
@Value("${wx.corpsecret}")
private String corpsecret;
@Value("${wx.agentid}")
private String agentid;
@Value("${wx.authUrl}")
private String authUrl;
@Autowired
private RedisTemplate redisTemplate;
//未授权
private String accossTokenInvliad = "40014";
/**
* @param
* @Author: huyc
* @Date: 2023/7/28
* @Description: 获取微信accos_token
* @return: java.lang.String
**/
public String getAccessToken(RestTemplate restTemplate) {
if (Common.isNotNull(agentid)) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
public String getAccessToken(RestTemplate restTemplate,String corpsecret)throws AuthenticationServiceException {
if(Common.isEmpty(corpsecret)){
throw new AuthenticationServiceException("未找到对应的corpsecret请联系管理员配置");
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
/**
* @param restTemplate
* @param tokenKey
* @param corpsecretKey
* @Description: 获取token
* @Author: huyc
* @Date: 2023/7/28 14:46
* @return: java.lang.String
**/
public String getToken(RestTemplate restTemplate,String tokenKey, String corpsecretKey) {
Object wxToken = redisTemplate.opsForValue().get(tokenKey);
if (null != wxToken) {
return String.valueOf(wxToken);
}
String requestTokenUrl = String.format(SecurityConstants.WX_GET_ACCOSS_TOKEN, corpid, corpsecretKey);
String result = restTemplate.getForObject(requestTokenUrl, String.class);
if (Common.isEmpty(result)) {
throw new CheckedException("微信授权失败");
}
String token = JSON.parseObject(result).getString("access_token");
if (Common.isEmpty(token)) {
log.info(result);
throw new CheckedException("获取微信token失败");
}
redisTemplate.opsForValue().set(tokenKey, token);
redisTemplate.expire(tokenKey, 3600, TimeUnit.SECONDS);
return token;
}
/**
* @param
* @Author: huyc
* @Date: 2023/7/28 14:43
* @Description: 移除微信accossToken
* @return: java.lang.String
**/
public void removeAccessToken() {
redisTemplate.delete(CacheConstants.WX_ACCOSS_TOKEN);
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:48
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.info(gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info(JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:50
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendAppTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.info("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAppAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info("发企业微信===返回:{}",JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/**
* 功能描述: 获取微信accos_token
* @Author: huyc
* @Date: 2023/7/28 14:50
* @return: java.lang.String
*/
public String getAppAccessToken(RestTemplate restTemplate) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
}
......@@ -2,8 +2,8 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
import com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProocessService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess;
import com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProcessService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "审批主流程记录表节点表管理")
public class TAuditNodeProocessController {
private final TAuditNodeProocessService tAuditNodeProocessService;
private final TAuditNodeProcessService tAuditNodeProcessService;
/**
* 通过id查询审批主流程记录表节点表
......@@ -34,34 +34,34 @@ public class TAuditNodeProocessController {
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('insurances_tauditnodeproocess_get')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('insurances_tauditnodeproocess_get')" )
public R<TAuditNodeProocess> getById(@PathVariable("id" ) String id) {
return R.ok(tAuditNodeProocessService.getById(id));
public R<TAuditNodeProcess> getById(@PathVariable("id" ) String id) {
return R.ok(tAuditNodeProcessService.getById(id));
}
/**
* 新增审批主流程记录表节点表
* @param tAuditNodeProocess 审批主流程记录表节点表
* @param tAuditNodeProcess 审批主流程记录表节点表
* @return R
*/
@Operation(summary = "新增审批主流程记录表节点表", description = "新增审批主流程记录表节点表:hasPermission('insurances_tauditnodeproocess_add')")
@SysLog("新增审批主流程记录表节点表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('insurances_tauditnodeproocess_add')" )
public R<Boolean> save(@RequestBody TAuditNodeProocess tAuditNodeProocess) {
return R.ok(tAuditNodeProocessService.save(tAuditNodeProocess));
public R<Boolean> save(@RequestBody TAuditNodeProcess tAuditNodeProcess) {
return R.ok(tAuditNodeProcessService.save(tAuditNodeProcess));
}
/**
* 修改审批主流程记录表节点表
* @param tAuditNodeProocess 审批主流程记录表节点表
* @param tAuditNodeProcess 审批主流程记录表节点表
* @return R
*/
@Operation(summary = "修改审批主流程记录表节点表", description = "修改审批主流程记录表节点表:hasPermission('insurances_tauditnodeproocess_edit')")
@SysLog("修改审批主流程记录表节点表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('insurances_tauditnodeproocess_edit')" )
public R<Boolean> updateById(@RequestBody TAuditNodeProocess tAuditNodeProocess) {
return R.ok(tAuditNodeProocessService.updateById(tAuditNodeProocess));
public R<Boolean> updateById(@RequestBody TAuditNodeProcess tAuditNodeProcess) {
return R.ok(tAuditNodeProcessService.updateById(tAuditNodeProcess));
}
/**
......@@ -74,7 +74,7 @@ public class TAuditNodeProocessController {
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('insurances_tauditnodeproocess_del')" )
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tAuditNodeProocessService.removeById(id));
return R.ok(tAuditNodeProcessService.removeById(id));
}
}
package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess;
import org.apache.ibatis.annotations.Mapper;
/**
......@@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
* @since 1.7.5
*/
@Mapper
public interface TAuditNodeProocessMapper extends BaseMapper<TAuditNodeProocess> {
public interface TAuditNodeProcessMapper extends BaseMapper<TAuditNodeProcess> {
}
package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess;
/**
* 审批主流程记录表节点表
......@@ -10,6 +10,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
* @date 2025-01-10 17:47:32
* @since 1.7.5
*/
public interface TAuditNodeProocessService extends IService<TAuditNodeProocess> {
public interface TAuditNodeProcessService extends IService<TAuditNodeProcess> {
}
package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProocessMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProocessService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProcessMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProcessService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -16,6 +16,6 @@ import org.springframework.stereotype.Service;
*/
@Log4j2
@Service
public class TAuditNodeProocessServiceImpl extends ServiceImpl<TAuditNodeProocessMapper, TAuditNodeProocess> implements TAuditNodeProocessService {
public class TAuditNodeProcessServiceImpl extends ServiceImpl<TAuditNodeProcessMapper, TAuditNodeProcess> implements TAuditNodeProcessService {
}
......@@ -8,9 +8,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
......@@ -500,7 +502,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
if(entity==null){
return R.failed(ResultConstants.FAIL_INFO_NO_MODEL);
}
if(!StringUtils.equals(entity.getStatus(),CommonConstants.ONE_STRING)){
if(!CommonConstants.ONE_STRING.equals(entity.getStatus())){
return R.failed("当前记录不为待提交状态");
}
String[] reasonType = {"1", "2"};
......@@ -518,12 +520,29 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
if(Common.isEmpty(entity.getCreateUserDeptId())){
return R.failed("申请人所属部门id不能为空");
}
// 传流程类型 1不购买商险申请,审核类型 0不购买商险审核
// R<List<SysUser>> auditUserListR = tInsuranceUnpurchaseApplyAuditProcess.commitAuditUserList(id, user, entity.getCreateUserDeptId(), CommonConstants.ONE_STRING, CommonConstants.ZERO_STRING,
// "",entity.getApplyNo(),entity,TInsuranceUnpurchaseApply.class);
// if (auditUserListR == null || auditUserListR.getCode() != CommonConstants.SUCCESS || auditUserListR.getData() == null) {
// throw new CheckedException("获取审批人失败,请联系管理员");
// }
// 传:流程类型 1不购买商险申请;审核类型 0不购买商险审核
R<List<SysUser>> auditUserListR = tInsuranceUnpurchaseApplyAuditProcess.getAuditUserList(id, user, entity.getCreateUserDeptId(),
CommonConstants.ONE_STRING, CommonConstants.ZERO_STRING,
"", entity.getApplyNo(), entity, TInsuranceUnpurchaseApply.class);
if (auditUserListR == null || auditUserListR.getCode() != CommonConstants.SUCCESS || auditUserListR.getData() == null) {
throw new CheckedException("获取审批人失败,请联系管理员");
}
// 存即将审批人的信息
String auditUserNameStrs = "";
String auditUserIdStrs = "";
for(SysUser userInfo : auditUserListR.getData()){
auditUserIdStrs = auditUserIdStrs.concat(";").concat(userInfo.getUserId());
auditUserNameStrs = auditUserNameStrs.concat(";").concat(userInfo.getNickname());
}
if(Common.isNotNull(auditUserNameStrs)){
auditUserNameStrs = auditUserNameStrs.substring(1);
}
if(Common.isNotNull(auditUserIdStrs)){
auditUserIdStrs = auditUserIdStrs.substring(1);
}
entity.setAuditUser(auditUserNameStrs);
entity.setAuditUserId(auditUserIdStrs);
entity.setStatus(CommonConstants.TWO_STRING);
this.updateById(entity);
return R.ok(null,"提交成功");
......@@ -532,9 +551,8 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
@Override
@Transactional
public R<String> auditAndCommit(TInsuranceUnpurchaseApply insuranceUnpurchaseApply, String approvalResult, String approvalOpinion, YifuUser user) {
return R.ok("审核完毕");
// return tInsuranceUnpurchaseApplyAuditProcess.auditUserList(insuranceUnpurchaseApply.getId(), approvalResult, approvalOpinion, user, CommonConstants.ZERO_STRING,
// insuranceUnpurchaseApply, insuranceUnpurchaseApply.getCreateUserDeptId());
return tInsuranceUnpurchaseApplyAuditProcess.auditUserList(insuranceUnpurchaseApply.getId(), approvalResult, approvalOpinion, user, CommonConstants.ZERO_STRING,
insuranceUnpurchaseApply, insuranceUnpurchaseApply.getCreateUserDeptId());
}
}
......@@ -26,3 +26,9 @@ spring:
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-worfu.com/yifu-auth/method/oauth/wxLogin
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProocessMapper">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProcessMapper">
<resultMap id="tAuditNodeProocessMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess">
<resultMap id="tAuditNodeProcessMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess">
<id property="id" column="id"/>
<result property="processId" column="process_id"/>
<result property="nodeId" column="node_id"/>
......@@ -43,61 +43,61 @@
a.add_sign_approval_man,
a.add_sign_approval_man_name
</sql>
<sql id="tAuditNodeProocess_where">
<if test="tAuditNodeProocess != null">
<if test="tAuditNodeProocess.id != null and tAuditNodeProocess.id.trim() != ''">
AND a.id = #{tAuditNodeProocess.id}
<sql id="tAuditNodeProcess_where">
<if test="tAuditNodeProcess != null">
<if test="tAuditNodeProcess.id != null and tAuditNodeProcess.id.trim() != ''">
AND a.id = #{tAuditNodeProcess.id}
</if>
<if test="tAuditNodeProocess.processId != null and tAuditNodeProocess.processId.trim() != ''">
AND a.process_id = #{tAuditNodeProocess.processId}
<if test="tAuditNodeProcess.processId != null and tAuditNodeProcess.processId.trim() != ''">
AND a.process_id = #{tAuditNodeProcess.processId}
</if>
<if test="tAuditNodeProocess.nodeId != null and tAuditNodeProocess.nodeId.trim() != ''">
AND a.node_id = #{tAuditNodeProocess.nodeId}
<if test="tAuditNodeProcess.nodeId != null and tAuditNodeProcess.nodeId.trim() != ''">
AND a.node_id = #{tAuditNodeProcess.nodeId}
</if>
<if test="tAuditNodeProocess.nodeType != null and tAuditNodeProocess.nodeType.trim() != ''">
AND a.node_type = #{tAuditNodeProocess.nodeType}
<if test="tAuditNodeProcess.nodeType != null and tAuditNodeProcess.nodeType.trim() != ''">
AND a.node_type = #{tAuditNodeProcess.nodeType}
</if>
<if test="tAuditNodeProocess.createTime != null">
AND a.create_time = #{tAuditNodeProocess.createTime}
<if test="tAuditNodeProcess.createTime != null">
AND a.create_time = #{tAuditNodeProcess.createTime}
</if>
<if test="tAuditNodeProocess.domainId != null and tAuditNodeProocess.domainId.trim() != ''">
AND a.domain_id = #{tAuditNodeProocess.domainId}
<if test="tAuditNodeProcess.domainId != null and tAuditNodeProcess.domainId.trim() != ''">
AND a.domain_id = #{tAuditNodeProcess.domainId}
</if>
<if test="tAuditNodeProocess.mainType != null and tAuditNodeProocess.mainType.trim() != ''">
AND a.main_type = #{tAuditNodeProocess.mainType}
<if test="tAuditNodeProcess.mainType != null and tAuditNodeProcess.mainType.trim() != ''">
AND a.main_type = #{tAuditNodeProcess.mainType}
</if>
<if test="tAuditNodeProocess.logoTitle != null and tAuditNodeProocess.logoTitle.trim() != ''">
AND a.logo_title = #{tAuditNodeProocess.logoTitle}
<if test="tAuditNodeProcess.logoTitle != null and tAuditNodeProcess.logoTitle.trim() != ''">
AND a.logo_title = #{tAuditNodeProcess.logoTitle}
</if>
<if test="tAuditNodeProocess.nodeName != null and tAuditNodeProocess.nodeName.trim() != ''">
AND a.node_name = #{tAuditNodeProocess.nodeName}
<if test="tAuditNodeProcess.nodeName != null and tAuditNodeProcess.nodeName.trim() != ''">
AND a.node_name = #{tAuditNodeProcess.nodeName}
</if>
<if test="tAuditNodeProocess.processName != null and tAuditNodeProocess.processName.trim() != ''">
AND a.process_name = #{tAuditNodeProocess.processName}
<if test="tAuditNodeProcess.processName != null and tAuditNodeProcess.processName.trim() != ''">
AND a.process_name = #{tAuditNodeProcess.processName}
</if>
<if test="tAuditNodeProocess.parentProcessId != null and tAuditNodeProocess.parentProcessId.trim() != ''">
AND a.parent_process_id = #{tAuditNodeProocess.parentProcessId}
<if test="tAuditNodeProcess.parentProcessId != null and tAuditNodeProcess.parentProcessId.trim() != ''">
AND a.parent_process_id = #{tAuditNodeProcess.parentProcessId}
</if>
<if test="tAuditNodeProocess.deleteFlag != null and tAuditNodeProocess.deleteFlag.trim() != ''">
AND a.delete_flag = #{tAuditNodeProocess.deleteFlag}
<if test="tAuditNodeProcess.deleteFlag != null and tAuditNodeProcess.deleteFlag.trim() != ''">
AND a.delete_flag = #{tAuditNodeProcess.deleteFlag}
</if>
<if test="tAuditNodeProocess.type != null and tAuditNodeProocess.type.trim() != ''">
AND a.type = #{tAuditNodeProocess.type}
<if test="tAuditNodeProcess.type != null and tAuditNodeProcess.type.trim() != ''">
AND a.type = #{tAuditNodeProcess.type}
</if>
<if test="tAuditNodeProocess.addSignParentNodeId != null and tAuditNodeProocess.addSignParentNodeId.trim() != ''">
AND a.add_sign_parent_node_id = #{tAuditNodeProocess.addSignParentNodeId}
<if test="tAuditNodeProcess.addSignParentNodeId != null and tAuditNodeProcess.addSignParentNodeId.trim() != ''">
AND a.add_sign_parent_node_id = #{tAuditNodeProcess.addSignParentNodeId}
</if>
<if test="tAuditNodeProocess.addSignDepartmentId != null and tAuditNodeProocess.addSignDepartmentId.trim() != ''">
AND a.add_sign_department_id = #{tAuditNodeProocess.addSignDepartmentId}
<if test="tAuditNodeProcess.addSignDepartmentId != null and tAuditNodeProcess.addSignDepartmentId.trim() != ''">
AND a.add_sign_department_id = #{tAuditNodeProcess.addSignDepartmentId}
</if>
<if test="tAuditNodeProocess.domainName != null and tAuditNodeProocess.domainName.trim() != ''">
AND a.domain_name = #{tAuditNodeProocess.domainName}
<if test="tAuditNodeProcess.domainName != null and tAuditNodeProcess.domainName.trim() != ''">
AND a.domain_name = #{tAuditNodeProcess.domainName}
</if>
<if test="tAuditNodeProocess.addSignApprovalMan != null and tAuditNodeProocess.addSignApprovalMan.trim() != ''">
AND a.add_sign_approval_man = #{tAuditNodeProocess.addSignApprovalMan}
<if test="tAuditNodeProcess.addSignApprovalMan != null and tAuditNodeProcess.addSignApprovalMan.trim() != ''">
AND a.add_sign_approval_man = #{tAuditNodeProcess.addSignApprovalMan}
</if>
<if test="tAuditNodeProocess.addSignApprovalManName != null and tAuditNodeProocess.addSignApprovalManName.trim() != ''">
AND a.add_sign_approval_man_name = #{tAuditNodeProocess.addSignApprovalManName}
<if test="tAuditNodeProcess.addSignApprovalManName != null and tAuditNodeProcess.addSignApprovalManName.trim() != ''">
AND a.add_sign_approval_man_name = #{tAuditNodeProcess.addSignApprovalManName}
</if>
</if>
</sql>
......
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author chenyuxi
* @date 2025/01/15
* @since 1.7.5
*/
@Data
public class UserApprovalRoleVO implements Serializable {
private static final long serialVersionUID = 1L;
private String departId;
private String roleId;
}
......@@ -589,4 +589,31 @@ public class UserController {
public R<String> updateUserAndDept(HttpServletRequest request,@RequestBody JSONObject json) {
return userService.updateUserAndDept(request,json);
}
/**
* 查询流程配置审批角色对应的审批人
*
* @param userByApprovalRole
* @author chenyuxi
* @date 2025-01-10 17:47:32
* @since 1.7.5
**/
@Inner
@PostMapping("/inner/getUser/getUserByRoleIdForCrm")
public SysUserListVo getUserByRoleIdForCrm(UserApprovalRoleVO userByApprovalRole) {
SysUserListVo naVo = new SysUserListVo();
if (Common.isEmpty(userByApprovalRole.getDepartId()) || Common.isEmpty(userByApprovalRole.getRoleId())) {
return naVo;
}
List<SysUser> sysUsers = userService.getUserByRoleIdForCrm(Integer.parseInt(userByApprovalRole.getDepartId()),userByApprovalRole.getRoleId());
if (Common.isEmpty(sysUsers)) {
//如果不存在则取上级所在部门负责人
sysUsers = userService.getUserManagerByUpDepartIdUp(Integer.parseInt(userByApprovalRole.getDepartId()), userByApprovalRole.getRoleId());
}
if (Common.isNotEmpty(sysUsers)) {
naVo.setUserList(sysUsers);
}
return naVo;
}
}
......@@ -77,4 +77,8 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
void updateUser(@Param("list") List<Map<String,Object>> list);
Page<BusinessUserVo> getBusinessUserVoPage(Page page,@Param("query") BusinessUserVo user);
List<SysUser> getUserByRoleIdForCrm(@Param("departId") Integer departId, @Param("roleId") String roleId);
List<SysUser> getUserManagerByUpDepartIdUp(@Param("departId") Integer departId, @Param("roleId")String roleId);
}
......@@ -185,4 +185,9 @@ public interface SysUserService extends IService<SysUser> {
* @return R
*/
R<String> updateUserAndDept(HttpServletRequest request, JSONObject json);
List<SysUser> getUserByRoleIdForCrm(Integer departId, String roleId);
List<SysUser> getUserManagerByUpDepartIdUp(Integer departId, String roleId);
}
......@@ -942,4 +942,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
}
@Override
public List<SysUser> getUserByRoleIdForCrm(Integer departId, String roleId) {
return baseMapper.getUserByRoleIdForCrm(departId,roleId);
}
@Override
public List<SysUser> getUserManagerByUpDepartIdUp(Integer departId, String roleId) {
return baseMapper.getUserManagerByUpDepartIdUp(departId,roleId);
}
}
......@@ -342,4 +342,41 @@
</where>
ORDER BY `user`.create_time DESC
</select>
<select id="getUserByRoleIdForCrm" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser">
SELECT
*
FROM
sys_user
WHERE
user_id IN (
SELECT
b.user_id
FROM
sys_approval_role a
LEFT JOIN sys_approval_role_user_dept b ON a.role_id = b.approval_role_id
WHERE
b.dept_id = #{departId}
AND approval_role_id = #{roleId}
)
</select>
<select id="getUserManagerByUpDepartIdUp" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser">
SELECT * FROM sys_user WHERE user_id IN(
SELECT
user_id
FROM
sys_approval_role_user_dept
WHERE
dept_id = (
SELECT
ORGAN_PARENT
FROM
sys_organization_info
WHERE
id = #{departId}
)
AND approval_role_id = #{roleId}
)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment