wsm-添加适配会签任务内再次会签的变量获取方法
This commit is contained in:
@@ -29,5 +29,7 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,26 @@ public class XiSpeakFlow {
|
|||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getSDWLeader() {
|
||||||
|
// 1. 安全获取配置,防止 NPE
|
||||||
|
XiSpeakConfig.XiSpeakProperties props = xiSpeakConfig.getXiSpeak();
|
||||||
|
if (props == null || !StringUtils.hasText(props.getSdwRoleId())) {
|
||||||
|
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);
|
||||||
|
return userList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSDWLeaderLength() {
|
||||||
|
return this.getSDWLeader().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getBgDeptLdUserIdListLength() {
|
public int getBgDeptLdUserIdListLength() {
|
||||||
return getBgDeptLdUserIdList().size();
|
return getBgDeptLdUserIdList().size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ flow-biz:
|
|||||||
json-data-key: "json_data"
|
json-data-key: "json_data"
|
||||||
impl-dept-key: "implDept"
|
impl-dept-key: "implDept"
|
||||||
impl-dept-collection-used-key: "impl_dept_id"
|
impl-dept-collection-used-key: "impl_dept_id"
|
||||||
|
sdw-role-id: "2044676455280570370"
|
||||||
|
|||||||
+55
@@ -304,6 +304,8 @@ public class FlowNodeExpression {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * 从当前流程实例的所有执行实例中获取指定的局部变量
|
// * 从当前流程实例的所有执行实例中获取指定的局部变量
|
||||||
@@ -376,6 +378,59 @@ public class FlowNodeExpression {
|
|||||||
return usernames.get(0);
|
return usernames.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get subprocess variable.
|
||||||
|
* Example: ${flowNodeExpression.getSonProcessVariable(execution, 'subApproveUser')}
|
||||||
|
*
|
||||||
|
* @param execution current execution
|
||||||
|
* @param variableName subprocess variable name
|
||||||
|
* @return username list
|
||||||
|
*/
|
||||||
|
public List<String> getSonProcessHqVariableList(DelegateExecution execution, String variableName) {
|
||||||
|
if (execution == null || StringUtils.isBlank(variableName)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String parentExecutionId = execution.getParentId();
|
||||||
|
if(StringUtils.isBlank(parentExecutionId)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (execution.hasVariableLocal(variableName)) {
|
||||||
|
return splitUsernames(execution.getVariableLocal(variableName));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||||
|
.processInstanceId(parentExecutionId)
|
||||||
|
.list();
|
||||||
|
for (Execution childExecution : executions) {
|
||||||
|
if (execution.getId().equals(childExecution.getId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Object localVariable = runtimeService.getVariableLocal(childExecution.getId(), variableName);
|
||||||
|
if (localVariable != null) {
|
||||||
|
return splitUsernames(localVariable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object variable = execution.getVariable(variableName);
|
||||||
|
if (variable != null) {
|
||||||
|
return splitUsernames(variable);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("getSonProcessVariable failed, executionId={}, variableName={}",
|
||||||
|
execution.getId(), variableName, e);
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSonProcessHqVariableListLength(DelegateExecution execution, String variableName) {
|
||||||
|
return this.getSonProcessHqVariableList(execution,variableName).size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSonProcessHqVariableString(DelegateExecution execution, String variableName) {
|
||||||
|
if(execution == null || StringUtils.isBlank(variableName) || getSonProcessHqVariableList(execution, variableName).isEmpty()) return StringUtils.EMPTY;
|
||||||
|
return getSonProcessHqVariableList(execution, variableName).get(0);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Save current task assignee as execution local variable.
|
* Save current task assignee as execution local variable.
|
||||||
* Example: ${flowNodeExpression.saveCurrentTaskAssigneeLocal(task, 'subApproveUser')}
|
* Example: ${flowNodeExpression.saveCurrentTaskAssigneeLocal(task, 'subApproveUser')}
|
||||||
|
|||||||
+3
-1
@@ -566,4 +566,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
List<String> getUsersListByJsonLocalAPI(Object jsonData, String deptKeyName, String roleId);
|
List<String> getUsersListByJsonLocalAPI(Object jsonData, String deptKeyName, String roleId);
|
||||||
|
|
||||||
List<String> getUsersListByDeptIdAndRoleIdLocalApi(String deptId, String roleId);
|
List<String> getUsersListByDeptIdAndRoleIdLocalApi(String deptId, String roleId);
|
||||||
}
|
|
||||||
|
List<String> getUserByRoleIdLocalApi(String roleId);
|
||||||
|
}
|
||||||
|
|||||||
+7
@@ -244,4 +244,11 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysUser> queryUserByDeptAndROle( String deptId, String roleId, Integer secretLevel);
|
List<SysUser> queryUserByDeptAndROle( String deptId, String roleId, Integer secretLevel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过角色id获取用户
|
||||||
|
* @param roleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysUser> getUserByRoleId(String roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -496,4 +496,6 @@ public interface ISysUserService extends IService<SysUser> {
|
|||||||
void updatePasswordNotBindPhone(String oldPassword, String password, String username);
|
void updatePasswordNotBindPhone(String oldPassword, String password, String username);
|
||||||
|
|
||||||
List<String> queryUserByDeptAndROle(@NotBlank(message = "deptId不为空") String deptId, @NotBlank(message = "角色id不为空") String roleId, @NotBlank(message = "secretLevel不为空") Integer secretLevel);
|
List<String> queryUserByDeptAndROle(@NotBlank(message = "deptId不为空") String deptId, @NotBlank(message = "角色id不为空") String roleId, @NotBlank(message = "secretLevel不为空") Integer secretLevel);
|
||||||
|
|
||||||
|
List<String> getUserByRoleId(String roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -2152,4 +2152,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getUserByRoleIdLocalApi(String roleId){
|
||||||
|
List<String> sysUserList = sysUserService.getUserByRoleId(roleId);
|
||||||
|
return Optional.ofNullable(sysUserList)
|
||||||
|
.orElse(Collections.emptyList())
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+5
@@ -2419,4 +2419,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
public List<String> queryUserByDeptAndROle(@NotBlank(message = "deptId不为空") String deptId, @NotBlank(message = "角色id不为空") String roleId, @NotBlank(message = "secretLevel不为空") Integer secretLevel){
|
public List<String> queryUserByDeptAndROle(@NotBlank(message = "deptId不为空") String deptId, @NotBlank(message = "角色id不为空") String roleId, @NotBlank(message = "secretLevel不为空") Integer secretLevel){
|
||||||
return sysUserMapper.queryUserByDeptAndROle(deptId,roleId,secretLevel).stream().map(SysUser::getUsername).collect(Collectors.toList()) ;
|
return sysUserMapper.queryUserByDeptAndROle(deptId,roleId,secretLevel).stream().map(SysUser::getUsername).collect(Collectors.toList()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getUserByRoleId(String roleId){
|
||||||
|
return sysUserMapper.getUserByRoleId(roleId).stream().map(SysUser::getUsername).collect(Collectors.toList()) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user