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

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 (Collections.frequency(roleId, "1") == 0 && Collections.frequency(roleId, "16") == 0) {
// 根据用户id查询是否是考勤员
if (Collections.frequency(roleId, "14") == 1) {
Long userId = SecurityUtils.getUserId();
List<MapVo> orgList = sysOrgDao.getOrgIdListAdministrators(userId);
if (!orgList.isEmpty()) {
// 使用 LinkedHashSet 来保证顺序并自动去重
Set<String> 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<MapVo> orgList = sysOrgDao.getOrgIdListAdministrators(userId);
if (!orgList.isEmpty()) {
// 使用 LinkedHashSet 来保证顺序并自动去重
Set<String> 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<String> uniqueIds = new ArrayList<>(idsSet);
bean.setOrgList(uniqueIds);
}
// 如果需要转换回 List 类型
List<String> uniqueIds = new ArrayList<>(idsSet);
bean.setOrgList(uniqueIds);
}
} else if (Collections.frequency(roleId, "14") == 1) {
//部门负责人
Long userId = SecurityUtils.getUserId();
List<MapVo> orgList = sysOrgDao.getOrgIdListManager(userId);
if (!orgList.isEmpty()) {
// 使用 LinkedHashSet 来保证顺序并自动去重
Set<String> 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<MapVo> orgList = sysOrgDao.getOrgIdListManager(userId);
if (!orgList.isEmpty()) {
// 使用 LinkedHashSet 来保证顺序并自动去重
Set<String> idsSet = new LinkedHashSet<>();
for (MapVo mapVo : orgList) {
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();
bean.setUserId(userId);
}