From c007f0ca1785db093d48f4846cda82fe8e955765 Mon Sep 17 00:00:00 2001 From: kimi <kimi42345@gmail.com> Date: 星期三, 27 五月 2020 09:59:29 +0800 Subject: [PATCH] merage --- src/main/java/com/highdatas/mdm/service/act/impl/TaskServiceImpl.java | 88 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 70 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/highdatas/mdm/service/act/impl/TaskServiceImpl.java b/src/main/java/com/highdatas/mdm/service/act/impl/TaskServiceImpl.java index 8037cfd..b728c2b 100644 --- a/src/main/java/com/highdatas/mdm/service/act/impl/TaskServiceImpl.java +++ b/src/main/java/com/highdatas/mdm/service/act/impl/TaskServiceImpl.java @@ -2,6 +2,7 @@ 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; @@ -30,6 +31,14 @@ RuntimeService runtimeService; @Autowired IdentityService identityService; + /** + * + * @description: 妫�楠岃妭鐐规槸鍚﹀凡缁忚鎺ユ敹 + * @param workflowId 娴佺▼id + * @return: 鏄惁宸茶鎺ユ敹 + * + */ + public boolean checkClaim(String workflowId) { Task task = getTask(workflowId); if (task == null) { @@ -42,6 +51,13 @@ return false; } } + /** + * + * @description: 鎺ユ敹浠诲姟 + * @param workflowId 娴佺▼id + * @return: 浠诲姟id + * + */ public String claimTask(String workflowId) { Task task = getTask(workflowId); if (task == null) { @@ -63,14 +79,20 @@ } } - - public boolean completeTask(String taskId, boolean pass, String reason, Map<String,Object> other) { + /** + * + * @description: 瀹屾垚鑺傜偣浠诲姟 + * @param taskId 浠诲姟id + * @param pass 鏄惁閫氳繃 true锛宖alse + * @param reason 鍘熷洜 + * @param other 鍏朵粬鍙傛暟 + * @return: 鏄惁瀹屾垚鎴愬姛 + * + */ + public boolean completeTask(String taskId, Object pass, String reason, Map<String,Object> other) { Map<String, Object> variables = new LinkedHashMap<String, Object>(); if(other != null){ - Set<String> keySet = other.keySet(); - for (String key : keySet) { - variables.put(key, other.get(key)); - } + variables.putAll(other); } variables.put("pass", pass); variables.put("reason", reason); @@ -85,12 +107,25 @@ log.debug("can not complete task(" + taskId + "): " + e.getMessage()); return false; } - } - - public boolean completeTask(String taskId, boolean pass, String reason) { + } + /** + * + * @description: 瀹屾垚鑺傜偣浠诲姟 + * @param taskId 浠诲姟id + * @param pass 鏄惁閫氳繃 true锛宖alse + * @param reason 鍘熷洜 + * @return: 鏄惁瀹屾垚鎴愬姛 + * + */ + public boolean completeTask(String taskId, Object pass, String reason) { return completeTask(taskId,pass,reason,null); - } - + } + /** + * + * @description: 鑾峰彇寰呭鎵逛换鍔″垪琛� + * @return: 寰呭鎵逛换鍔″垪琛� + * + */ public List<String> getTodoTask() { TUser onlineUser = getOnlineUser(); Set<String> result = new HashSet<>(); @@ -115,7 +150,13 @@ return new ArrayList<>(result); } - + /** + * + * @description: 閫氳繃娴佺▼鑾峰彇褰撳墠浠诲姟鑺傜偣 + * @param processId 娴佺▼id + * @return: 褰撳墠浠诲姟鑺傜偣 + * + */ public Task geTask(String processId) { Task task = taskService.createTaskQuery().processInstanceId(processId).singleResult(); return task; @@ -142,16 +183,27 @@ 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; + } } -- Gitblit v1.8.0