Commit 574c9f24 authored by 耿迪迪's avatar 耿迪迪

隐患审核查询权限

parent 0429003f
...@@ -68,7 +68,7 @@ public class TDangerServiceImpl implements ITDangerService ...@@ -68,7 +68,7 @@ public class TDangerServiceImpl implements ITDangerService
* 1.班长审核 2.部门经理审核 3.安全部审核 4.安全总监审核 5.常务副总审核 6.总经理审核结束 * 1.班长审核 2.部门经理审核 3.安全部审核 4.安全总监审核 5.常务副总审核 6.总经理审核结束
*/ */
private final Map<String,String> approvalPermission = new HashMap<String,String>(){{ private final Map<String,String> approvalPermission = new HashMap<String,String>(){{
put("minister","2"); put("shengchanjingli","2");
put("se","4"); put("se","4");
put("fuzong","5"); put("fuzong","5");
put("manager","6"); put("manager","6");
...@@ -331,22 +331,32 @@ public class TDangerServiceImpl implements ITDangerService ...@@ -331,22 +331,32 @@ public class TDangerServiceImpl implements ITDangerService
// 1. 管理员条件 // 1. 管理员条件
TRectifyGroupMemberInfo queryParam = new TRectifyGroupMemberInfo(); TRectifyGroupMemberInfo queryParam = new TRectifyGroupMemberInfo();
queryParam.setUserId(Long.valueOf(userInfo.getUserId())); queryParam.setUserId(Long.valueOf(userInfo.getUserId()));
List<TRectifyGroupMemberInfo> memberInfoList = tRectifyGroupMemberInfoMapper.selectTRectifyGroupMemberInfoList(queryParam); List<TRectifyGroupMemberInfo> userInfoList = tRectifyGroupMemberInfoMapper.selectTRectifyGroupMemberInfoList(queryParam);
if (!CollectionUtils.isEmpty(memberInfoList)) { if (!CollectionUtils.isEmpty(userInfoList)) {
boolean isAdmin = memberInfoList.stream().anyMatch(item -> "1".equals(item.getPost())); List<Long> userIdList = new ArrayList<>();
if (isAdmin) { for(TRectifyGroupMemberInfo user : userInfoList){
List<Long> userIdList = memberInfoList.stream() if("1".equals(user.getPost()) && null != user.getGroupId()){
.map(TRectifyGroupMemberInfo::getUserId) //查询组员信息
.filter(Objects::nonNull) TRectifyGroupMemberInfo teamQuery = new TRectifyGroupMemberInfo();
.distinct() teamQuery.setGroupId(user.getGroupId());
.collect(Collectors.toList()); teamQuery.setPost("2");
List<TRectifyGroupMemberInfo> teamInfoList = tRectifyGroupMemberInfoMapper.selectTRectifyGroupMemberInfoList(teamQuery);
if (!CollectionUtils.isEmpty(userIdList)) { //查询组员信息
String userIds = userIdList.stream() List<Long> teamUserIdList = teamInfoList.stream()
.map(String::valueOf) .map(TRectifyGroupMemberInfo::getUserId)
.collect(Collectors.joining(",")); .filter(Objects::nonNull)
conditions.add("(danger.admin_id IN (" + userIds + ") AND danger.approval_status = '1')"); .distinct()
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(teamUserIdList)) userIdList.addAll(teamUserIdList);
} }
}
if (!CollectionUtils.isEmpty(userIdList)) {
String userIds = userIdList.stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
conditions.add("(danger.admin_id IN (" + userIds + ") AND danger.approval_status = '1')");
} }
} }
...@@ -378,6 +388,7 @@ public class TDangerServiceImpl implements ITDangerService ...@@ -378,6 +388,7 @@ public class TDangerServiceImpl implements ITDangerService
if (conditions.isEmpty()) { if (conditions.isEmpty()) {
return ""; return "";
} }
if(conditions.size() == 1) return " AND " + conditions.get(0);
return " AND (" + String.join(" OR ", conditions) + ")"; return " AND (" + String.join(" OR ", conditions) + ")";
} }
} }
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