From f94ab7ea9ab4d9f12f8b64574e28f40534cf79b5 Mon Sep 17 00:00:00 2001 From: caihaohan Date: Sun, 12 Nov 2023 19:30:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=81=E6=A0=87=E7=AD=89=E7=BA=A7?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=BA=8C=E7=BA=A7=E4=B8=89=E7=BA=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...EnterpriseStandardAuthUserServiceImpl.java | 52 ++++++++++++++++--- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardAuthUserServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardAuthUserServiceImpl.java index ebae907f..c648f054 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardAuthUserServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardAuthUserServiceImpl.java @@ -17,7 +17,9 @@ import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard; import com.jero.modules.laws.standard.entity.LawsStandardTempPermission; import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService; import com.jero.modules.sys.entity.LawsEnterpriseStandardLevel; +import com.jero.modules.sys.entity.LawsGrade; import com.jero.modules.sys.service.ILawsEnterpriseStandardLevelService; +import com.jero.modules.sys.service.ILawsGradeService; import com.jero.modules.sys.utils.UserUtils; import com.jero.modules.system.entity.SysUser; import com.jero.modules.system.model.DepartIdModel; @@ -66,6 +68,9 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl standardLevelList = standardLevelService.list(); - List levelDeptIds = standardLevelList.stream().map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); + List gradeList = gradeService.list(); + Map gradeMap = gradeList.stream().collect(Collectors.toMap(LawsGrade::getLevel, e -> e)); + + List levelOneDeptIds = standardLevelList.stream().filter(l -> l.getGradeId().equals(gradeMap.get(1).getId())) + .map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); + List levelTwoDeptIds = standardLevelList.stream().filter(l -> l.getGradeId().equals(gradeMap.get(2).getId())) + .map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); // 起草部门有所有企标的查看权限 if (!departNames.isEmpty() && departNames.contains(draftDepartName)) { @@ -151,7 +162,6 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl map : records) { String standardId = (String) map.get(FieldCommon.ID); LawsEnterpriseStandard es = esMap.get(standardId); - String mainDraftingUnit = es.getMainDraftingUnit(); // 授权部门和临时权限 if (authStandardIds.contains(standardId)) { map.put(FieldCommon.DETAIL_FLAG, true); @@ -165,8 +175,14 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl standardIds) { + SysUser currentUser = sysUserService.getById(userId); + // 管理员有所有企标的权限 + List roleList = sysUserRoleService.getRole(currentUser.getUsername()); + if (roleList != null && roleList.contains(FieldCommon.ROLE_ADMIN)) { + return true; + } + List> records = new ArrayList<>(); for (String id : standardIds) { Map map = new HashMap<>(); @@ -212,7 +235,14 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl standardLevelList = standardLevelService.list(); - List levelDeptIds = standardLevelList.stream().map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); + List gradeList = gradeService.list(); + Map gradeMap = gradeList.stream().collect(Collectors.toMap(LawsGrade::getLevel, e -> e)); + + List levelOneDeptIds = standardLevelList.stream().filter(l -> l.getGradeId().equals(gradeMap.get(1).getId())) + .map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); + List levelTwoDeptIds = standardLevelList.stream().filter(l -> l.getGradeId().equals(gradeMap.get(2).getId())) + .map(LawsEnterpriseStandardLevel::getDeptId).collect(Collectors.toList()); + // 起草部门有所有企标的查看权限 if (!departNames.isEmpty() && departNames.contains(draftDepartName)) { @@ -230,13 +260,19 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl