Forráskód Böngészése

fix(user): 修复用户部门配置错误导致的项目部获取问题

- 当用户所属部门的上层未找到项目部时抛出业务异常
- 提供详细的错误信息包括用户ID用于排查问题
- 确保项目ID设置前进行有效的部门验证
dazhaxie 1 napja
szülő
commit
187e7896eb

+ 4 - 1
platform-service/src/main/java/com/platform/service/upms/impl/SysUserServiceImpl.java

@@ -321,7 +321,10 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser,
         userInfoDTO.setDeptId(myDeptVo == null ? null : myDeptVo.getDeptId());
         userInfoDTO.setDeptName(myDeptVo == null ? null : myDeptVo.getDeptName());
         SysDeptVO deptVO = UserUtil.getUserNatureDeptAllowNull(DeptNatureEnum.XIANG_MU_BU, userInfo);
-        userInfoDTO.setProjectId(deptVO == null ? null : deptVO.getDeptId());
+        if (deptVO == null) {
+            throw new BusinessException("用户部门配置错误,当前用户所属部门的上层未找到项目部,请联系管理员检查部门结构配置,用户ID:" + userInfoDTO.getUserId());
+        }
+        userInfoDTO.setProjectId(deptVO.getDeptId());
         deptVO = UserUtil.getUserNatureDeptAllowNull(DeptNatureEnum.FEN_GONG_SI, userInfo);
         userInfoDTO.setCompanyId(deptVO == null ? null : deptVO.getDeptId());
         deptVO = activitiBusinessService.getRegionDept(userInfoDTO.getDeptId());