diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttendanceDetailsController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttendanceDetailsController.java index e010206..fbdaa66 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttendanceDetailsController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttendanceDetailsController.java @@ -184,43 +184,46 @@ public class AttendanceDetailsController extends BaseController { //管理员与人资角色可以看到所有 if (roleId != null && !roleId.isEmpty()) { if (Collections.frequency(roleId, "1") == 0 && Collections.frequency(roleId, "16") == 0) { - // 根据用户id查询是否是考勤员 - if (Collections.frequency(roleId, "14") == 1) { - Long userId = SecurityUtils.getUserId(); - List orgList = sysOrgDao.getOrgIdListAdministrators(userId); - if (!orgList.isEmpty()) { - // 使用 LinkedHashSet 来保证顺序并自动去重 - Set idsSet = new LinkedHashSet<>(); - for (MapVo mapVo : orgList) { - String id = proDeptRoleDao.getOrgChildById(mapVo.getId()); - if (id != null && !id.trim().isEmpty()) { // 防止空或仅含空白字符的字符串 - // 将分割后的数组添加到 Set 中,自动去重 - Collections.addAll(idsSet, id.split(",")); + //判断是否是普通人员 + if (Collections.frequency(roleId, "15") == 0) { + // 根据用户id查询是否是管理员 + if (Collections.frequency(roleId, "14") == 0) { + Long userId = SecurityUtils.getUserId(); + List orgList = sysOrgDao.getOrgIdListAdministrators(userId); + if (!orgList.isEmpty()) { + // 使用 LinkedHashSet 来保证顺序并自动去重 + Set idsSet = new LinkedHashSet<>(); + for (MapVo mapVo : orgList) { + String id = proDeptRoleDao.getOrgChildById(mapVo.getId()); + if (id != null && !id.trim().isEmpty()) { // 防止空或仅含空白字符的字符串 + // 将分割后的数组添加到 Set 中,自动去重 + Collections.addAll(idsSet, id.split(",")); + } } + // 如果需要转换回 List 类型 + List uniqueIds = new ArrayList<>(idsSet); + bean.setOrgList(uniqueIds); } - // 如果需要转换回 List 类型 - List uniqueIds = new ArrayList<>(idsSet); - bean.setOrgList(uniqueIds); - } - } else if (Collections.frequency(roleId, "14") == 1) { - //部门负责人 - Long userId = SecurityUtils.getUserId(); - List orgList = sysOrgDao.getOrgIdListManager(userId); - if (!orgList.isEmpty()) { - // 使用 LinkedHashSet 来保证顺序并自动去重 - Set idsSet = new LinkedHashSet<>(); - for (MapVo mapVo : orgList) { - String id = mapVo.getId() +""; - if (id != null && !id.trim().isEmpty()) { // 防止空或仅含空白字符的字符串 - // 将分割后的数组添加到 Set 中,自动去重 - Collections.addAll(idsSet, id); + } else { + //部门负责人 + Long userId = SecurityUtils.getUserId(); + List orgList = sysOrgDao.getOrgIdListManager(userId); + if (!orgList.isEmpty()) { + // 使用 LinkedHashSet 来保证顺序并自动去重 + Set idsSet = new LinkedHashSet<>(); + for (MapVo mapVo : orgList) { + String id = mapVo.getId() +""; + if (id != null && !id.trim().isEmpty()) { // 防止空或仅含空白字符的字符串 + // 将分割后的数组添加到 Set 中,自动去重 + Collections.addAll(idsSet, id); + } } + // 如果需要转换回 List 类型 + List uniqueIds = new ArrayList<>(idsSet); + bean.setOrgList(uniqueIds); } - // 如果需要转换回 List 类型 - List uniqueIds = new ArrayList<>(idsSet); - bean.setOrgList(uniqueIds); } - }else{ + }else { Long userId = SecurityUtils.getUserId(); bean.setUserId(userId); }