Commit eea81ea2 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 7dd93159 d8234bd3
......@@ -6,7 +6,9 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -55,7 +57,13 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
@Override
public Map<String, Object> checkTaskAuthMap(String processInstanceId, ReginParams userInfo) {
// 获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName();
// String currentLoginUserRole = userInfo.getRole().getRoleName();
Set<String> roleNameSet = Sets.newHashSet();
userInfo.getUserModel().getOrgRoles().values().forEach(i -> {
i.forEach(e -> {
roleNameSet.add(e.getRoleName());
});
});
String currentLoginUserName = userInfo.getUserModel().getUserName();
Map<String, Object> map = new HashMap<String, Object>();
map.put(WorkFlowEnum.CHECKFLAG.getCode(), false);
......@@ -67,7 +75,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
if (WorkFlowEnum.制定计划内容.getCode().equals(detail.getString(WorkFlowEnum.NAME.getCode()))
|| WorkFlowEnum.现场确认.getCode().equals(detail.getString(WorkFlowEnum.NAME.getCode()))) {
String groupName = getFristFlowDetail(processInstanceId);
if (StringUtils.isNotBlank(groupName) && currentLoginUserRole.equals(groupName)) {
if (StringUtils.isNotBlank(groupName) && roleNameSet.contains(groupName)) {
map.put(WorkFlowEnum.TASKID.getCode(), detail.getString(WorkFlowEnum.ID.getCode()));
map.put(WorkFlowEnum.CHECKFLAG.getCode(), true);
map.put(WorkFlowEnum.NAME.getCode(), detail.getString(WorkFlowEnum.NAME.getCode()));
......@@ -104,13 +112,13 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
continue;
}
// 判断当前登录人的角色是不是与流程中设置的当前任务节点权限一致,一致则执行,不一致则退出
if (!defaultExecutionRoleProcess.equals(currentLoginUserRole)) {
if (!roleNameSet.contains(defaultExecutionRoleProcess)) {
continue;
}
map.put(WorkFlowEnum.TASKID.getCode(), detail.getString(WorkFlowEnum.ID.getCode()));
map.put(WorkFlowEnum.CHECKFLAG.getCode(), true);
map.put(WorkFlowEnum.NAME.getCode(), detail.getString(WorkFlowEnum.NAME.getCode()));
map.put(WorkFlowEnum.GROUPNAME.getCode(), currentLoginUserRole);
map.put(WorkFlowEnum.GROUPNAME.getCode(), defaultExecutionRoleProcess);
}
}
return map;
......@@ -224,7 +232,13 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
* @throws Exception
*/
public Object getCurrentUserAllTaskList(String key, ReginParams userInfo) throws Exception {
String currentLoginUserRole = userInfo.getRole().getRoleName();
Set<String> roleNameSet = Sets.newHashSet();
userInfo.getUserModel().getOrgRoles().values().forEach(i -> {
i.forEach(e -> {
roleNameSet.add(e.getRoleName());
});
});
// String currentLoginUserRole = userInfo.getRole().getRoleName();
JSONObject CurrentUserAllTaskResult = null;
try {
//获取该登录用户已经分配到他名下和他对应的角色权限所能执行的任务组
......@@ -240,7 +254,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
SpecifyTaskArray.stream().forEach(i -> {
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(i));
String groupName = getFristFlowDetail(json.getString(WorkFlowEnum.PROCESSINSTANCEID.getCode()));
if (StringUtils.isNotBlank(groupName) && currentLoginUserRole.equals(groupName)) {
if (StringUtils.isNotBlank(groupName) && roleNameSet.contains(groupName)) {
allTaskResultList.add(i);
}
});
......
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