考勤明细修改审核数据隔离

Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
lSun 2025-02-21 10:19:51 +08:00
parent 368fb1f49b
commit c494111a4e
1 changed files with 35 additions and 32 deletions

View File

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