!47 refactor(flow): 统一管理部门ID和角色ID至 OrgConfig
* refactor(flow): 统一管理部门ID和角色ID至 OrgConfig
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package org.jeecg;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "flow-biz.org")
|
||||||
|
public class OrgConfig {
|
||||||
|
|
||||||
|
private Dept dept = new Dept();
|
||||||
|
private Role role = new Role();
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Dept {
|
||||||
|
private String jj;
|
||||||
|
private String sld;
|
||||||
|
private String dq;
|
||||||
|
private String bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Role {
|
||||||
|
private String ld;
|
||||||
|
private String jjWorker;
|
||||||
|
private String sldJwsj;
|
||||||
|
private String sdwsj;
|
||||||
|
private String sdw;
|
||||||
|
}
|
||||||
|
}
|
||||||
-7
@@ -1,12 +1,5 @@
|
|||||||
package org.jeecg.inspectcloseout;
|
package org.jeecg.inspectcloseout;
|
||||||
|
|
||||||
public class InspectCloseoutConstant {
|
public class InspectCloseoutConstant {
|
||||||
public static final String JJ_DEPT_ID = "2054466800692432898";
|
|
||||||
public static final String JJ_DEPT_LEADER_ROLE_ID = "2044680793306591234";
|
|
||||||
public static final String JJ_DEPT_WORKER_ROLE_ID = "2047511967494213633";
|
|
||||||
public static final String SLD_DEPT_ID = "2044677562460508161";
|
|
||||||
public static final String SLD_JWSJ_ROLE_ID = "2063902766943363073";
|
|
||||||
public static final String DQ_DEPT_ID = "2044677628281720834";
|
|
||||||
public static final String DQ_DEPT_WORKER_ROLE_ID = "2047511967494213633";
|
|
||||||
public static final int ZERO_INDEX = 0;
|
public static final int ZERO_INDEX = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-20
@@ -5,8 +5,8 @@ import com.jeecg.weibo.exception.BusinessException;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.inspectimprove.InspectImproveConfig;
|
|
||||||
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
|
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
|
|||||||
public class InspectCloseoutFlow {
|
public class InspectCloseoutFlow {
|
||||||
|
|
||||||
private final InspectCloseoutConfig inspectCloseoutConfig;
|
private final InspectCloseoutConfig inspectCloseoutConfig;
|
||||||
|
private final OrgConfig orgConfig;
|
||||||
private final FlowNodeExpression flowNodeExpression;
|
private final FlowNodeExpression flowNodeExpression;
|
||||||
private final ISysBaseAPI iSysBaseAPI;
|
private final ISysBaseAPI iSysBaseAPI;
|
||||||
|
|
||||||
@@ -54,12 +55,10 @@ public class InspectCloseoutFlow {
|
|||||||
|
|
||||||
//流程表达式内用法 ${inspectImproveFlow.getJJDeptLdUserIdList()}
|
//流程表达式内用法 ${inspectImproveFlow.getJJDeptLdUserIdList()}
|
||||||
public List<String> getJJDeptLdUserIdList() {
|
public List<String> getJJDeptLdUserIdList() {
|
||||||
|
String deptId = orgConfig.getDept().getJj();
|
||||||
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID);
|
String roleId = orgConfig.getRole().getLd();
|
||||||
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID,
|
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID
|
|
||||||
);
|
|
||||||
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
@@ -76,20 +75,18 @@ public class InspectCloseoutFlow {
|
|||||||
|
|
||||||
//流程表达式内用法 ${inspectCloseoutFlow.getJJDeptLdWorkerIdList()}
|
//流程表达式内用法 ${inspectCloseoutFlow.getJJDeptLdWorkerIdList()}
|
||||||
public List<String> getJJDeptLdWorkerIdList() {
|
public List<String> getJJDeptLdWorkerIdList() {
|
||||||
|
String deptId = orgConfig.getDept().getJj();
|
||||||
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID);
|
String roleId = orgConfig.getRole().getJjWorker();
|
||||||
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID,
|
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
InspectCloseoutConstant.JJ_DEPT_WORKER_ROLE_ID
|
|
||||||
);
|
|
||||||
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//流程表达式内用法 ${inspectCloseoutFlow.getJWSJUser()}
|
//流程表达式内用法 ${inspectCloseoutFlow.getJWSJUser()}
|
||||||
public String getJWSJUser() {
|
public String getJWSJUser() {
|
||||||
String deptId = InspectCloseoutConstant.SLD_DEPT_ID;
|
String deptId = orgConfig.getDept().getSld();
|
||||||
String roleId = InspectCloseoutConstant.SLD_JWSJ_ROLE_ID;
|
String roleId = orgConfig.getRole().getSldJwsj();
|
||||||
|
|
||||||
log.info("【巡视整改销号-流程表达式】查询纪委书记用户, deptId: {}, roleId: {}", deptId, roleId);
|
log.info("【巡视整改销号-流程表达式】查询纪委书记用户, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
|
|
||||||
@@ -112,11 +109,10 @@ public class InspectCloseoutFlow {
|
|||||||
|
|
||||||
//流程表达式内用法 ${inspectCloseoutFlow.getDqDeptLdUserIdList()}
|
//流程表达式内用法 ${inspectCloseoutFlow.getDqDeptLdUserIdList()}
|
||||||
public List<String> getDqDeptLdUserIdList() {
|
public List<String> getDqDeptLdUserIdList() {
|
||||||
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", InspectCloseoutConstant.DQ_DEPT_ID, InspectCloseoutConstant.DQ_DEPT_WORKER_ROLE_ID);
|
String deptId = orgConfig.getDept().getDq();
|
||||||
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
String roleId = orgConfig.getRole().getJjWorker();
|
||||||
InspectCloseoutConstant.DQ_DEPT_ID,
|
log.info("【巡视整改销号-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
InspectCloseoutConstant.DQ_DEPT_WORKER_ROLE_ID
|
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
);
|
|
||||||
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
log.info("【巡视整改销号-流程表达式】查询到用户列表, userList: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -9,8 +9,6 @@ public class InspectConstant {
|
|||||||
public static final String DQ_DEPT_LEADER_KEY = "dq_dept_leader";
|
public static final String DQ_DEPT_LEADER_KEY = "dq_dept_leader";
|
||||||
public static final String IS_END_KEY = "is_end";
|
public static final String IS_END_KEY = "is_end";
|
||||||
public static final String SUB_APPROVE_USER_KEY = "sub_approve_user";
|
public static final String SUB_APPROVE_USER_KEY = "sub_approve_user";
|
||||||
public static final String SLD_DEPT_ID = "2044677562460508161";
|
|
||||||
public static final String SDWSJ_ROLE_ID = "2062796937607499777";
|
|
||||||
public static final String IS_NEED_LEADER_APPROVE_KEY = "is_need_leader_approve";
|
public static final String IS_NEED_LEADER_APPROVE_KEY = "is_need_leader_approve";
|
||||||
public static final String LEADER_APPROVE_USER_KEY = "leader_approve_user";
|
public static final String LEADER_APPROVE_USER_KEY = "leader_approve_user";
|
||||||
public static final int ZERO_INDEX = 0;
|
public static final int ZERO_INDEX = 0;
|
||||||
|
|||||||
-2
@@ -35,7 +35,5 @@ public class InspectImproveConfig {
|
|||||||
private String workProgressKey;
|
private String workProgressKey;
|
||||||
/** 完成状态 key */
|
/** 完成状态 key */
|
||||||
private String completionStatusKey;
|
private String completionStatusKey;
|
||||||
private String dqDeptId;
|
|
||||||
private String ldRoleId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-18
@@ -7,13 +7,13 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.service.IDqInspectTaskService;
|
import org.jeecg.modules.demo.dqinspecttask.service.IDqInspectTaskService;
|
||||||
import org.jeecg.modules.dj.inspectimprove.entity.DjInspectImprove;
|
import org.jeecg.modules.dj.inspectimprove.entity.DjInspectImprove;
|
||||||
import org.jeecg.modules.dj.inspectimprove.service.IDjInspectImproveService;
|
import org.jeecg.modules.dj.inspectimprove.service.IDjInspectImproveService;
|
||||||
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
|
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
|
||||||
import org.jeecg.xispeak.XiSpeakConfig;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -27,34 +27,28 @@ import java.util.stream.Collectors;
|
|||||||
public class InspectImproveFlow {
|
public class InspectImproveFlow {
|
||||||
|
|
||||||
private final InspectImproveConfig inspectImproveConfig;
|
private final InspectImproveConfig inspectImproveConfig;
|
||||||
|
private final OrgConfig orgConfig;
|
||||||
private final IDjInspectImproveService djInspectImproveService;
|
private final IDjInspectImproveService djInspectImproveService;
|
||||||
private final FlowNodeExpression flowNodeExpression;
|
private final FlowNodeExpression flowNodeExpression;
|
||||||
private final XiSpeakConfig xiSpeakConfig;
|
|
||||||
private final ISysBaseAPI iSysBaseAPI;
|
private final ISysBaseAPI iSysBaseAPI;
|
||||||
private final IDqInspectTaskService dqInspectTaskService;
|
private final IDqInspectTaskService dqInspectTaskService;
|
||||||
private final RuntimeService runtimeService;
|
private final RuntimeService runtimeService;
|
||||||
|
|
||||||
//流程表达式内用法 ${inspectImproveFlow.getDqDeptLdUserIdList()}
|
//流程表达式内用法 ${inspectImproveFlow.getDqDeptLdUserIdList()}
|
||||||
public List<String> getDqDeptLdUserIdList() {
|
public List<String> getDqDeptLdUserIdList() {
|
||||||
InspectImproveConfig.InspectImproveProperties props = inspectImproveConfig.getInspectImprove();
|
String deptId = orgConfig.getDept().getDq();
|
||||||
if (props == null || !org.apache.shiro.util.StringUtils.hasText(props.getDqDeptId())) {
|
String roleId = orgConfig.getRole().getLd();
|
||||||
log.error("【巡视整改-流程表达式】流程配置缺失, key: flow-biz.inspect-improve.dq-dept-id");
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("【巡视整改-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", props.getDqDeptId(), props.getLdRoleId());
|
log.info("【巡视整改-流程表达式】查询部门角色用户列表, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
props.getDqDeptId(),
|
|
||||||
props.getLdRoleId()
|
|
||||||
);
|
|
||||||
log.info("【巡视整改-流程表达式】查询到用户列表, userList: {}", userList);
|
log.info("【巡视整改-流程表达式】查询到用户列表, userList: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流程表达式内用法 ${inspectImproveFlow.getSDWSJ()}
|
// 流程表达式内用法 ${inspectImproveFlow.getSDWSJ()}
|
||||||
public String getSDWSJ() {
|
public String getSDWSJ() {
|
||||||
String deptId = InspectConstant.SLD_DEPT_ID;
|
String deptId = orgConfig.getDept().getSld();
|
||||||
String roleId = InspectConstant.SDWSJ_ROLE_ID;
|
String roleId = orgConfig.getRole().getSdwsj();
|
||||||
|
|
||||||
log.info("【巡视整改-流程表达式】开始查询所党委书记用户, deptId: {}, roleId: {}", deptId, roleId);
|
log.info("【巡视整改-流程表达式】开始查询所党委书记用户, deptId: {}, roleId: {}", deptId, roleId);
|
||||||
|
|
||||||
@@ -147,15 +141,15 @@ public class InspectImproveFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InspectImproveConfig.InspectImproveProperties props = inspectImproveConfig.getInspectImprove();
|
String ldRoleId = orgConfig.getRole().getLd();
|
||||||
log.info("正在查询整改责任部门: {} 下的角色: {} 的领导列表", measureDeptId, props.getLdRoleId());
|
log.info("正在查询整改责任部门: {} 下的角色: {} 的领导列表", measureDeptId, ldRoleId);
|
||||||
List<String> leaderList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
List<String> leaderList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
||||||
measureDeptId,
|
measureDeptId,
|
||||||
props.getLdRoleId()
|
ldRoleId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (leaderList == null || leaderList.isEmpty()) {
|
if (leaderList == null || leaderList.isEmpty()) {
|
||||||
log.warn("【节点预警】整改责任部门: {} 下未配置角色: {} 的用户,审批人列表为空!", measureDeptId, props.getLdRoleId());
|
log.warn("【节点预警】整改责任部门: {} 下未配置角色: {} 的用户,审批人列表为空!", measureDeptId, ldRoleId);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ public class XiSpeakConfig {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class XiSpeakProperties {
|
public static class XiSpeakProperties {
|
||||||
/** 对应 bg-dept-id */
|
|
||||||
private String bgDeptId;
|
|
||||||
/** 对应 ld-role-id */
|
|
||||||
private String ldRoleId;
|
|
||||||
/** 对应 need-sdw-approve-code */
|
/** 对应 need-sdw-approve-code */
|
||||||
private String needSdwApproveCode;
|
private String needSdwApproveCode;
|
||||||
/** 对应 json-data-key */
|
/** 对应 json-data-key */
|
||||||
@@ -28,8 +24,6 @@ public class XiSpeakConfig {
|
|||||||
private String implDeptKey;
|
private String implDeptKey;
|
||||||
/** 对应impl-dept-collection-used*/
|
/** 对应impl-dept-collection-used*/
|
||||||
private String implDeptCollectionUsedKey;
|
private String implDeptCollectionUsedKey;
|
||||||
/** 对应sdw-role-id*/
|
|
||||||
private String sdwRoleId;
|
|
||||||
/** 对应business-key*/
|
/** 对应business-key*/
|
||||||
private String businessKey;
|
private String businessKey;
|
||||||
/** 对应impl-dept-key-underscore-key*/
|
/** 对应impl-dept-key-underscore-key*/
|
||||||
|
|||||||
+10
-24
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.shiro.util.StringUtils;
|
import org.apache.shiro.util.StringUtils;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||||
@@ -26,6 +27,7 @@ import java.util.stream.Collectors;
|
|||||||
public class XiSpeakFlow {
|
public class XiSpeakFlow {
|
||||||
|
|
||||||
private final XiSpeakConfig xiSpeakConfig;
|
private final XiSpeakConfig xiSpeakConfig;
|
||||||
|
private final OrgConfig orgConfig;
|
||||||
private final ISysBaseAPI iSysBaseAPI;
|
private final ISysBaseAPI iSysBaseAPI;
|
||||||
private final RuntimeService runtimeService;
|
private final RuntimeService runtimeService;
|
||||||
private final FlowNodeExpression flowNodeExpression;
|
private final FlowNodeExpression flowNodeExpression;
|
||||||
@@ -33,34 +35,18 @@ public class XiSpeakFlow {
|
|||||||
|
|
||||||
//流程表达式内用法 ${xiSpeakFlow.getBgDeptLdUserIdList()}
|
//流程表达式内用法 ${xiSpeakFlow.getBgDeptLdUserIdList()}
|
||||||
public List<String> getBgDeptLdUserIdList() {
|
public List<String> getBgDeptLdUserIdList() {
|
||||||
// 1. 安全获取配置,防止 NPE
|
String deptId = orgConfig.getDept().getBg();
|
||||||
XiSpeakConfig.XiSpeakProperties props = xiSpeakConfig.getXiSpeak();
|
String roleId = orgConfig.getRole().getLd();
|
||||||
if (props == null || !StringUtils.hasText(props.getBgDeptId())) {
|
log.info("正在查询部门: {} 下的角色: {} 的用户列表", deptId, roleId);
|
||||||
log.error("流程配置缺失: [flow-biz.xi-speak.bg-dept-id] 未在 YAML 中定义");
|
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 调用接口获取数据
|
|
||||||
log.info("正在查询部门: {} 下的角色: {} 的用户列表", props.getBgDeptId(), props.getLdRoleId());
|
|
||||||
List<String> userList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
|
||||||
props.getBgDeptId(),
|
|
||||||
props.getLdRoleId()
|
|
||||||
);
|
|
||||||
log.info("查询到的用户为: {}", userList);
|
log.info("查询到的用户为: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSDWLeader() {
|
public List<String> getSDWLeader() {
|
||||||
// 1. 安全获取配置,防止 NPE
|
String roleId = orgConfig.getRole().getSdw();
|
||||||
XiSpeakConfig.XiSpeakProperties props = xiSpeakConfig.getXiSpeak();
|
log.info("正在查询sdw:{}角色下的用户列表", roleId);
|
||||||
if (props == null || !StringUtils.hasText(props.getSdwRoleId())) {
|
List<String> userList = iSysBaseAPI.getUserByRoleIdLocalApi(roleId);
|
||||||
log.error("流程配置缺失: [flow-biz.xi-speak.sdw-role-id] 未在 YAML 中定义");
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 调用接口获取数据
|
|
||||||
log.info("正在查询sdw:{}角色下的用户列表",props.getSdwRoleId());
|
|
||||||
List<String> userList = iSysBaseAPI.getUserByRoleIdLocalApi(props.getSdwRoleId());
|
|
||||||
log.info("查询到的用户为: {}", userList);
|
log.info("查询到的用户为: {}", userList);
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
@@ -330,7 +316,7 @@ public class XiSpeakFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getImplDeptLdsList(String deptId) {
|
public List<String> getImplDeptLdsList(String deptId) {
|
||||||
return iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, xiSpeakConfig.getXiSpeak().getLdRoleId());
|
return iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, orgConfig.getRole().getLd());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getImplDeptLdsListLength(String deptId) {
|
public int getImplDeptLdsListLength(String deptId) {
|
||||||
|
|||||||
-5
@@ -1,7 +1,6 @@
|
|||||||
package org.jeecg.xispeakfb;
|
package org.jeecg.xispeakfb;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jeecg.xispeak.XiSpeakConfig;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -17,10 +16,6 @@ public class XiSpeakFeedbackConfig {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class XiSpeakPropertiesFb {
|
public static class XiSpeakPropertiesFb {
|
||||||
String deptId;
|
|
||||||
String businessId;
|
String businessId;
|
||||||
String jjDeptId;
|
|
||||||
String jjWorkerRoleId;
|
|
||||||
String jjLeaderRoleId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-33
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||||
@@ -16,7 +17,6 @@ import org.jeecg.modules.bg.xispeak.entity.DeptApproveDetailMap;
|
|||||||
import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakService;
|
import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakService;
|
||||||
import org.jeecg.modules.tasktask.entity.TaskTask;
|
import org.jeecg.modules.tasktask.entity.TaskTask;
|
||||||
import org.jeecg.modules.tasktask.service.ITaskTaskService;
|
import org.jeecg.modules.tasktask.service.ITaskTaskService;
|
||||||
import org.jeecg.xispeak.XiSpeakConfig;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
|||||||
public class XiSpeakFeedbackFlow {
|
public class XiSpeakFeedbackFlow {
|
||||||
|
|
||||||
private final XiSpeakFeedbackConfig xiSpeakFeedbackConfig;
|
private final XiSpeakFeedbackConfig xiSpeakFeedbackConfig;
|
||||||
|
private final OrgConfig orgConfig;
|
||||||
private final ISysBaseAPI iSysBaseAPI;
|
private final ISysBaseAPI iSysBaseAPI;
|
||||||
private final RuntimeService runtimeService;
|
private final RuntimeService runtimeService;
|
||||||
private final IBgXiSpeakService bgXiSpeakService;
|
private final IBgXiSpeakService bgXiSpeakService;
|
||||||
@@ -227,23 +228,10 @@ public class XiSpeakFeedbackFlow {
|
|||||||
* @example 表达式用法: ${XiSpeakFeedbackFlow.getJJDeptWorkerList()}
|
* @example 表达式用法: ${XiSpeakFeedbackFlow.getJJDeptWorkerList()}
|
||||||
*/
|
*/
|
||||||
public List<String> getJJDeptWorkerList() {
|
public List<String> getJJDeptWorkerList() {
|
||||||
// 1. 安全获取配置对象
|
String deptId = orgConfig.getDept().getJj();
|
||||||
XiSpeakFeedbackConfig.XiSpeakPropertiesFb config = xiSpeakFeedbackConfig.getXiSpeakFb();
|
String roleId = orgConfig.getRole().getJjWorker();
|
||||||
if (config == null) {
|
|
||||||
log.error("xiSpeakFb 配置对象加载失败,请检查配置文件!");
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
String deptId = config.getJjDeptId();
|
// 2. 调用接口并处理结果
|
||||||
String roleId = config.getJjWorkerRoleId();
|
|
||||||
|
|
||||||
// 2. 参数合法性拦截
|
|
||||||
if (StringUtils.isAnyBlank(deptId, roleId)) {
|
|
||||||
log.warn("xiSpeakFb 配置项不完整: deptId={}, roleId={}", deptId, roleId);
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 调用接口并处理结果
|
|
||||||
List<String> workerList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
List<String> workerList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(workerList)) {
|
if (CollectionUtils.isEmpty(workerList)) {
|
||||||
@@ -278,23 +266,10 @@ public class XiSpeakFeedbackFlow {
|
|||||||
* @example 表达式用法: ${XiSpeakFeedbackFlow.getJJDeptLeaderList()}
|
* @example 表达式用法: ${XiSpeakFeedbackFlow.getJJDeptLeaderList()}
|
||||||
*/
|
*/
|
||||||
public List<String> getJJDeptLeaderList() {
|
public List<String> getJJDeptLeaderList() {
|
||||||
// 1. 安全获取配置对象
|
String deptId = orgConfig.getDept().getJj();
|
||||||
XiSpeakFeedbackConfig.XiSpeakPropertiesFb config = xiSpeakFeedbackConfig.getXiSpeakFb();
|
String roleId = orgConfig.getRole().getLd();
|
||||||
if (config == null) {
|
|
||||||
log.error("xiSpeakFb 配置对象加载失败,请检查配置文件!");
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
String deptId = config.getJjDeptId();
|
// 2. 调用接口并处理结果
|
||||||
String roleId = config.getJjLeaderRoleId ();
|
|
||||||
|
|
||||||
// 2. 参数合法性拦截
|
|
||||||
if (StringUtils.isAnyBlank(deptId, roleId)) {
|
|
||||||
log.warn("xiSpeakFb 配置项不完整: deptId={}, roleId={}", deptId, roleId);
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 调用接口并处理结果
|
|
||||||
List<String> workerList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
List<String> workerList = iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(deptId, roleId);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(workerList)) {
|
if (CollectionUtils.isEmpty(workerList)) {
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
flow-biz:
|
flow-biz:
|
||||||
|
org:
|
||||||
|
dept:
|
||||||
|
jj: "2054466800692432898"
|
||||||
|
sld: "2044677562460508161"
|
||||||
|
dq: "2044677628281720834"
|
||||||
|
bg: "2044677604785229826"
|
||||||
|
role:
|
||||||
|
ld: "2044680793306591234"
|
||||||
|
jj-worker: "2047511967494213633"
|
||||||
|
sld-jwsj: "2063902766943363073"
|
||||||
|
sdwsj: "2062796937607499777"
|
||||||
|
sdw: "2044676455280570370"
|
||||||
xi-speak:
|
xi-speak:
|
||||||
bg-dept-id: "2044677604785229826"
|
|
||||||
ld-role-id: "2044680793306591234"
|
|
||||||
need-sdw-approve-code: "needSdwApproval"
|
need-sdw-approve-code: "needSdwApproval"
|
||||||
feedback-right-now-code: "feedback_right_now"
|
feedback-right-now-code: "feedback_right_now"
|
||||||
json-data-key: "json_data"
|
json-data-key: "json_data"
|
||||||
impl-dept-key: "implDept"
|
impl-dept-key: "implDept"
|
||||||
impl-dept-key-underscore-key: "impl_dept"
|
impl-dept-key-underscore-key: "impl_dept"
|
||||||
impl-dept-collection-used-key: "impl_dept_id"
|
impl-dept-collection-used-key: "impl_dept_id"
|
||||||
sdw-role-id: "2044676455280570370"
|
|
||||||
business-key: "business_id"
|
business-key: "business_id"
|
||||||
dept-worker-key: "subApproveUser"
|
dept-worker-key: "subApproveUser"
|
||||||
xi-speak-fb-flowcode: "process_1778315114392"
|
xi-speak-fb-flowcode: "process_1778315114392"
|
||||||
@@ -19,8 +28,6 @@ flow-biz:
|
|||||||
sdw-leader-list-key: "sdwLeaderList"
|
sdw-leader-list-key: "sdwLeaderList"
|
||||||
is-end-key: "isEnd"
|
is-end-key: "isEnd"
|
||||||
inspect-improve:
|
inspect-improve:
|
||||||
dq-dept-id: "2044677628281720834"
|
|
||||||
ld-role-id: "2044680793306591234"
|
|
||||||
business-key: "business_id"
|
business-key: "business_id"
|
||||||
json-data-key: "json_data"
|
json-data-key: "json_data"
|
||||||
form-url: "dj/inspectimprove/components/DjInspectImproveBPMForm"
|
form-url: "dj/inspectimprove/components/DjInspectImproveBPMForm"
|
||||||
@@ -43,11 +50,7 @@ flow-biz:
|
|||||||
closeout-desc-key: "closeoutDesc"
|
closeout-desc-key: "closeoutDesc"
|
||||||
completion-status-key: "completionStatus"
|
completion-status-key: "completionStatus"
|
||||||
xi-speak-fb:
|
xi-speak-fb:
|
||||||
dept-id: "x"
|
|
||||||
business-id: "business_id"
|
business-id: "business_id"
|
||||||
jj-dept-id: "2054466800692432898"
|
|
||||||
jj-worker-role-id: "2047511967494213633"
|
|
||||||
jj-leader-role-id: "2044680793306591234"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+30
-25
@@ -5,6 +5,7 @@ import static org.mockito.Mockito.*;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jeecg.weibo.exception.BusinessException;
|
import com.jeecg.weibo.exception.BusinessException;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.inspectcloseout.InspectCloseoutConfig.InspectCloseoutProperties;
|
import org.jeecg.inspectcloseout.InspectCloseoutConfig.InspectCloseoutProperties;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -23,11 +24,16 @@ class InspectCloseoutFlowTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private InspectCloseoutConfig inspectCloseoutConfig;
|
private InspectCloseoutConfig inspectCloseoutConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private OrgConfig orgConfig;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private ISysBaseAPI iSysBaseAPI;
|
private ISysBaseAPI iSysBaseAPI;
|
||||||
|
|
||||||
private InspectCloseoutFlow flow;
|
private InspectCloseoutFlow flow;
|
||||||
private InspectCloseoutProperties props;
|
private InspectCloseoutProperties props;
|
||||||
|
private OrgConfig.Dept dept;
|
||||||
|
private OrgConfig.Role role;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
@@ -43,8 +49,19 @@ class InspectCloseoutFlowTest {
|
|||||||
props.setCompletionStatusKey("completionStatusKey");
|
props.setCompletionStatusKey("completionStatusKey");
|
||||||
lenient().when(inspectCloseoutConfig.getInspectCloseout()).thenReturn(props);
|
lenient().when(inspectCloseoutConfig.getInspectCloseout()).thenReturn(props);
|
||||||
|
|
||||||
|
dept = new OrgConfig.Dept();
|
||||||
|
dept.setJj("dept-jj");
|
||||||
|
dept.setSld("dept-sld");
|
||||||
|
dept.setDq("dept-dq");
|
||||||
|
role = new OrgConfig.Role();
|
||||||
|
role.setLd("role-ld");
|
||||||
|
role.setJjWorker("role-jj-worker");
|
||||||
|
role.setSldJwsj("role-sld-jwsj");
|
||||||
|
lenient().when(orgConfig.getDept()).thenReturn(dept);
|
||||||
|
lenient().when(orgConfig.getRole()).thenReturn(role);
|
||||||
|
|
||||||
// FlowNodeExpression 未使用,传 null
|
// FlowNodeExpression 未使用,传 null
|
||||||
flow = new InspectCloseoutFlow(inspectCloseoutConfig, null, iSysBaseAPI);
|
flow = new InspectCloseoutFlow(inspectCloseoutConfig, orgConfig, null, iSysBaseAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 部门角色用户查询 ====================
|
// ==================== 部门角色用户查询 ====================
|
||||||
@@ -55,8 +72,7 @@ class InspectCloseoutFlowTest {
|
|||||||
@Test
|
@Test
|
||||||
void getJJDeptLdUserIdList_shouldReturnUserList() {
|
void getJJDeptLdUserIdList_shouldReturnUserList() {
|
||||||
List<String> users = List.of("user1", "user2");
|
List<String> users = List.of("user1", "user2");
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-ld"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID))
|
|
||||||
.thenReturn(users);
|
.thenReturn(users);
|
||||||
|
|
||||||
assertEquals(users, flow.getJJDeptLdUserIdList());
|
assertEquals(users, flow.getJJDeptLdUserIdList());
|
||||||
@@ -64,8 +80,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJJDeptLdUserIdList_shouldReturnEmptyList() {
|
void getJJDeptLdUserIdList_shouldReturnEmptyList() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-ld"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID))
|
|
||||||
.thenReturn(Collections.emptyList());
|
.thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
assertEquals(Collections.emptyList(), flow.getJJDeptLdUserIdList());
|
assertEquals(Collections.emptyList(), flow.getJJDeptLdUserIdList());
|
||||||
@@ -73,8 +88,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJJDeptLdUserIdListLength_shouldReturnCount() {
|
void getJJDeptLdUserIdListLength_shouldReturnCount() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-ld"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID))
|
|
||||||
.thenReturn(List.of("user1", "user2", "user3"));
|
.thenReturn(List.of("user1", "user2", "user3"));
|
||||||
|
|
||||||
assertEquals(3, flow.getJJDeptLdUserIdListLength());
|
assertEquals(3, flow.getJJDeptLdUserIdListLength());
|
||||||
@@ -82,8 +96,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJJDeptLdUserIdListLength_shouldReturnZeroWhenEmpty() {
|
void getJJDeptLdUserIdListLength_shouldReturnZeroWhenEmpty() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-ld"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID))
|
|
||||||
.thenReturn(Collections.emptyList());
|
.thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
assertEquals(0, flow.getJJDeptLdUserIdListLength());
|
assertEquals(0, flow.getJJDeptLdUserIdListLength());
|
||||||
@@ -92,8 +105,7 @@ class InspectCloseoutFlowTest {
|
|||||||
@Test
|
@Test
|
||||||
void getJJDeptLdWorkerIdList_shouldReturnUserList() {
|
void getJJDeptLdWorkerIdList_shouldReturnUserList() {
|
||||||
List<String> users = List.of("worker1");
|
List<String> users = List.of("worker1");
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-jj-worker"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_WORKER_ROLE_ID))
|
|
||||||
.thenReturn(users);
|
.thenReturn(users);
|
||||||
|
|
||||||
assertEquals(users, flow.getJJDeptLdWorkerIdList());
|
assertEquals(users, flow.getJJDeptLdWorkerIdList());
|
||||||
@@ -101,8 +113,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJJDeptLdWorkerIdListLength_shouldReturnCount() {
|
void getJJDeptLdWorkerIdListLength_shouldReturnCount() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-jj", "role-ld"))
|
||||||
InspectCloseoutConstant.JJ_DEPT_ID, InspectCloseoutConstant.JJ_DEPT_LEADER_ROLE_ID))
|
|
||||||
.thenReturn(List.of("user1", "user2"));
|
.thenReturn(List.of("user1", "user2"));
|
||||||
|
|
||||||
assertEquals(2, flow.getJJDeptLdWorkerIdListLength());
|
assertEquals(2, flow.getJJDeptLdWorkerIdListLength());
|
||||||
@@ -111,8 +122,7 @@ class InspectCloseoutFlowTest {
|
|||||||
@Test
|
@Test
|
||||||
void getDqDeptLdUserIdList_shouldReturnUserList() {
|
void getDqDeptLdUserIdList_shouldReturnUserList() {
|
||||||
List<String> users = List.of("dq_user1");
|
List<String> users = List.of("dq_user1");
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-dq", "role-jj-worker"))
|
||||||
InspectCloseoutConstant.DQ_DEPT_ID, InspectCloseoutConstant.DQ_DEPT_WORKER_ROLE_ID))
|
|
||||||
.thenReturn(users);
|
.thenReturn(users);
|
||||||
|
|
||||||
assertEquals(users, flow.getDqDeptLdUserIdList());
|
assertEquals(users, flow.getDqDeptLdUserIdList());
|
||||||
@@ -120,8 +130,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDqDeptLdUserIdListLength_shouldReturnCount() {
|
void getDqDeptLdUserIdListLength_shouldReturnCount() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-dq", "role-jj-worker"))
|
||||||
InspectCloseoutConstant.DQ_DEPT_ID, InspectCloseoutConstant.DQ_DEPT_WORKER_ROLE_ID))
|
|
||||||
.thenReturn(List.of("user1", "user2"));
|
.thenReturn(List.of("user1", "user2"));
|
||||||
|
|
||||||
assertEquals(2, flow.getDqDeptLdUserIdListLength());
|
assertEquals(2, flow.getDqDeptLdUserIdListLength());
|
||||||
@@ -129,8 +138,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDqDeptLdUserIdListLength_shouldReturnZeroWhenEmpty() {
|
void getDqDeptLdUserIdListLength_shouldReturnZeroWhenEmpty() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-dq", "role-jj-worker"))
|
||||||
InspectCloseoutConstant.DQ_DEPT_ID, InspectCloseoutConstant.DQ_DEPT_WORKER_ROLE_ID))
|
|
||||||
.thenReturn(Collections.emptyList());
|
.thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
assertEquals(0, flow.getDqDeptLdUserIdListLength());
|
assertEquals(0, flow.getDqDeptLdUserIdListLength());
|
||||||
@@ -144,8 +152,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJWSJUser_shouldReturnUniqueUser() {
|
void getJWSJUser_shouldReturnUniqueUser() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sld-jwsj"))
|
||||||
InspectCloseoutConstant.SLD_DEPT_ID, InspectCloseoutConstant.SLD_JWSJ_ROLE_ID))
|
|
||||||
.thenReturn(List.of("jwsj_user"));
|
.thenReturn(List.of("jwsj_user"));
|
||||||
|
|
||||||
assertEquals("jwsj_user", flow.getJWSJUser());
|
assertEquals("jwsj_user", flow.getJWSJUser());
|
||||||
@@ -153,8 +160,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJWSJUser_shouldThrowWhenEmpty() {
|
void getJWSJUser_shouldThrowWhenEmpty() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sld-jwsj"))
|
||||||
InspectCloseoutConstant.SLD_DEPT_ID, InspectCloseoutConstant.SLD_JWSJ_ROLE_ID))
|
|
||||||
.thenReturn(Collections.emptyList());
|
.thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
assertThrows(BusinessException.class, () -> flow.getJWSJUser());
|
assertThrows(BusinessException.class, () -> flow.getJWSJUser());
|
||||||
@@ -162,8 +168,7 @@ class InspectCloseoutFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getJWSJUser_shouldThrowWhenMultipleUsers() {
|
void getJWSJUser_shouldThrowWhenMultipleUsers() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sld-jwsj"))
|
||||||
InspectCloseoutConstant.SLD_DEPT_ID, InspectCloseoutConstant.SLD_JWSJ_ROLE_ID))
|
|
||||||
.thenReturn(List.of("user1", "user2"));
|
.thenReturn(List.of("user1", "user2"));
|
||||||
|
|
||||||
assertThrows(BusinessException.class, () -> flow.getJWSJUser());
|
assertThrows(BusinessException.class, () -> flow.getJWSJUser());
|
||||||
|
|||||||
+24
-21
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.jeecg.weibo.exception.BusinessException;
|
import com.jeecg.weibo.exception.BusinessException;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.RuntimeService;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
import org.jeecg.OrgConfig;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
import org.jeecg.inspectimprove.InspectImproveConfig.InspectImproveProperties;
|
import org.jeecg.inspectimprove.InspectImproveConfig.InspectImproveProperties;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
||||||
@@ -27,6 +28,9 @@ class InspectImproveFlowTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private InspectImproveConfig inspectImproveConfig;
|
private InspectImproveConfig inspectImproveConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private OrgConfig orgConfig;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private ISysBaseAPI iSysBaseAPI;
|
private ISysBaseAPI iSysBaseAPI;
|
||||||
|
|
||||||
@@ -41,21 +45,30 @@ class InspectImproveFlowTest {
|
|||||||
|
|
||||||
private InspectImproveFlow flow;
|
private InspectImproveFlow flow;
|
||||||
private InspectImproveProperties props;
|
private InspectImproveProperties props;
|
||||||
|
private OrgConfig.Dept dept;
|
||||||
|
private OrgConfig.Role role;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
props = new InspectImproveProperties();
|
props = new InspectImproveProperties();
|
||||||
props.setBusinessKey("businessKey");
|
props.setBusinessKey("businessKey");
|
||||||
props.setDqDeptId("dept-001");
|
|
||||||
props.setLdRoleId("role-001");
|
|
||||||
props.setMeasureResLeaderKey("measureResLeader");
|
props.setMeasureResLeaderKey("measureResLeader");
|
||||||
props.setMeasureResDeptKey("measureResDept");
|
props.setMeasureResDeptKey("measureResDept");
|
||||||
props.setQuestionResLeaderKey("questionResLeader");
|
props.setQuestionResLeaderKey("questionResLeader");
|
||||||
props.setQuestionResDeptKey("questionResDept");
|
props.setQuestionResDeptKey("questionResDept");
|
||||||
lenient().when(inspectImproveConfig.getInspectImprove()).thenReturn(props);
|
lenient().when(inspectImproveConfig.getInspectImprove()).thenReturn(props);
|
||||||
|
|
||||||
// IDjInspectImproveService, FlowNodeExpression, XiSpeakConfig 未使用,传 null
|
dept = new OrgConfig.Dept();
|
||||||
flow = new InspectImproveFlow(inspectImproveConfig, null, null, null,
|
dept.setDq("dept-dq");
|
||||||
|
dept.setSld("dept-sld");
|
||||||
|
role = new OrgConfig.Role();
|
||||||
|
role.setLd("role-ld");
|
||||||
|
role.setSdwsj("role-sdwsj");
|
||||||
|
lenient().when(orgConfig.getDept()).thenReturn(dept);
|
||||||
|
lenient().when(orgConfig.getRole()).thenReturn(role);
|
||||||
|
|
||||||
|
// IDjInspectImproveService, FlowNodeExpression 未使用,传 null
|
||||||
|
flow = new InspectImproveFlow(inspectImproveConfig, orgConfig, null, null,
|
||||||
iSysBaseAPI, dqInspectTaskService, runtimeService);
|
iSysBaseAPI, dqInspectTaskService, runtimeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,22 +224,15 @@ class InspectImproveFlowTest {
|
|||||||
@Test
|
@Test
|
||||||
void getDqDeptLdUserIdList_shouldReturnUserList() {
|
void getDqDeptLdUserIdList_shouldReturnUserList() {
|
||||||
List<String> users = List.of("user1", "user2");
|
List<String> users = List.of("user1", "user2");
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-001", "role-001"))
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-dq", "role-ld"))
|
||||||
.thenReturn(users);
|
.thenReturn(users);
|
||||||
|
|
||||||
assertEquals(users, flow.getDqDeptLdUserIdList());
|
assertEquals(users, flow.getDqDeptLdUserIdList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void getDqDeptLdUserIdList_shouldReturnEmptyWhenPropsIsNull() {
|
|
||||||
when(inspectImproveConfig.getInspectImprove()).thenReturn(null);
|
|
||||||
|
|
||||||
assertEquals(Collections.emptyList(), flow.getDqDeptLdUserIdList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDqDeptLdUserIdListLength_shouldReturnCount() {
|
void getDqDeptLdUserIdListLength_shouldReturnCount() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-001", "role-001"))
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-dq", "role-ld"))
|
||||||
.thenReturn(List.of("user1", "user2"));
|
.thenReturn(List.of("user1", "user2"));
|
||||||
|
|
||||||
assertEquals(2, flow.getDqDeptLdUserIdListLength());
|
assertEquals(2, flow.getDqDeptLdUserIdListLength());
|
||||||
@@ -234,8 +240,7 @@ class InspectImproveFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getSDWSJ_shouldReturnUniqueUser() {
|
void getSDWSJ_shouldReturnUniqueUser() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sdwsj"))
|
||||||
InspectConstant.SLD_DEPT_ID, InspectConstant.SDWSJ_ROLE_ID))
|
|
||||||
.thenReturn(List.of("party_secretary"));
|
.thenReturn(List.of("party_secretary"));
|
||||||
|
|
||||||
assertEquals("party_secretary", flow.getSDWSJ());
|
assertEquals("party_secretary", flow.getSDWSJ());
|
||||||
@@ -243,8 +248,7 @@ class InspectImproveFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getSDWSJ_shouldThrowWhenEmpty() {
|
void getSDWSJ_shouldThrowWhenEmpty() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sdwsj"))
|
||||||
InspectConstant.SLD_DEPT_ID, InspectConstant.SDWSJ_ROLE_ID))
|
|
||||||
.thenReturn(Collections.emptyList());
|
.thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
assertThrows(BusinessException.class, () -> flow.getSDWSJ());
|
assertThrows(BusinessException.class, () -> flow.getSDWSJ());
|
||||||
@@ -252,8 +256,7 @@ class InspectImproveFlowTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getSDWSJ_shouldThrowWhenMultipleUsers() {
|
void getSDWSJ_shouldThrowWhenMultipleUsers() {
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi(
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-sld", "role-sdwsj"))
|
||||||
InspectConstant.SLD_DEPT_ID, InspectConstant.SDWSJ_ROLE_ID))
|
|
||||||
.thenReturn(List.of("user1", "user2"));
|
.thenReturn(List.of("user1", "user2"));
|
||||||
|
|
||||||
assertThrows(BusinessException.class, () -> flow.getSDWSJ());
|
assertThrows(BusinessException.class, () -> flow.getSDWSJ());
|
||||||
@@ -272,7 +275,7 @@ class InspectImproveFlowTest {
|
|||||||
task.setMeasureResDept("dept-100");
|
task.setMeasureResDept("dept-100");
|
||||||
|
|
||||||
List<String> leaders = List.of("leader1");
|
List<String> leaders = List.of("leader1");
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-100", "role-001"))
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-100", "role-ld"))
|
||||||
.thenReturn(leaders);
|
.thenReturn(leaders);
|
||||||
|
|
||||||
assertEquals(leaders, flow.getImplDeptLeaderList(execution));
|
assertEquals(leaders, flow.getImplDeptLeaderList(execution));
|
||||||
@@ -293,7 +296,7 @@ class InspectImproveFlowTest {
|
|||||||
DqInspectTask task = mockTaskFound("biz-001");
|
DqInspectTask task = mockTaskFound("biz-001");
|
||||||
task.setMeasureResDept("dept-100");
|
task.setMeasureResDept("dept-100");
|
||||||
|
|
||||||
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-100", "role-001"))
|
when(iSysBaseAPI.getUsersListByDeptIdAndRoleIdLocalApi("dept-100", "role-ld"))
|
||||||
.thenReturn(List.of("leader1", "leader2"));
|
.thenReturn(List.of("leader1", "leader2"));
|
||||||
|
|
||||||
assertEquals(2, flow.getImplDeptLeaderListLength(execution));
|
assertEquals(2, flow.getImplDeptLeaderListLength(execution));
|
||||||
|
|||||||
Reference in New Issue
Block a user