| | |
| | | |
| | | import com.highdatas.mdm.entity.TUser; |
| | | import com.highdatas.mdm.pojo.NextTaskUserInfo; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.activiti.engine.*; |
| | | import org.activiti.engine.delegate.Expression; |
| | |
| | | TaskDefinition taskDef = (TaskDefinition)activityImpl.getProperties().get("taskDefinition"); |
| | | Set<Expression> userCodes = taskDef.getCandidateUserIdExpressions();//候选人 |
| | | Set<Expression> roleCodes = taskDef.getCandidateGroupIdExpressions();//候选组 |
| | | if (userCodes != null) { |
| | | Set<String> userList = userCodes.stream().map(expression -> expression.getExpressionText()).collect(Collectors.toSet()); |
| | | nextTaskUserInfo.addUserList(userList); |
| | | } |
| | | |
| | | if (roleCodes != null) { |
| | | Set<String> roleList = roleCodes.stream().map(expression -> expression.getExpressionText()).collect(Collectors.toSet()); |
| | | nextTaskUserInfo.addRoleList(roleList); |
| | | } |
| | | return nextTaskUserInfo; |
| | | Set<String> userList = new HashSet<>(); |
| | | if (userCodes != null) { |
| | | Set userSet = userCodes.stream().map(expression -> expression.getExpressionText()).collect(Collectors.toSet()); |
| | | userList.addAll(userSet); |
| | | } |
| | | List<String> roleIdList = nextTaskUserInfo.getRoleIdList(); |
| | | if (roleIdList == null || roleIdList.isEmpty()) { |
| | | nextTaskUserInfo.addUserList(userList); |
| | | return nextTaskUserInfo; |
| | | } |
| | | for (String roleId : roleIdList) { |
| | | Set<String> userByRole = DbUtils.getUserByRole(roleId); |
| | | userList.addAll(userByRole); |
| | | } |
| | | nextTaskUserInfo.addUserList(userList); |
| | | return nextTaskUserInfo; |
| | | |
| | | |
| | | } |
| | | |
| | | } |