Browse Source

修复:当组织被删除后,用户继续在此组织操作,查询权限的空指针异常

dev_shibei_match
wxz 4 years ago
parent
commit
0bbb169dcd
  1. 11
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

11
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -453,6 +453,9 @@ public class AccessServiceImpl implements AccessService {
} }
CustomerAgencyDTO belongAgency = belongAgencyRst.getData(); CustomerAgencyDTO belongAgency = belongAgencyRst.getData();
if (belongAgency == null || belongAgency.getId() == null) {
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode(), "操作权限不足,用户所属的组织信息不存在");
}
//Result<CustomerAgencyDTO> agencyByStaffRst = govOrgFeignClient.getAgencyByStaff(staffId); //Result<CustomerAgencyDTO> agencyByStaffRst = govOrgFeignClient.getAgencyByStaff(staffId);
//if (!agencyByStaffRst.success()) { //if (!agencyByStaffRst.success()) {
@ -467,11 +470,15 @@ public class AccessServiceImpl implements AccessService {
// 2.拿到当前所处机关单位信息 // 2.拿到当前所处机关单位信息
Result<CustomerAgencyDTO> currAgencyRst = govOrgFeignClient.getAgencyById(currAgencyId); Result<CustomerAgencyDTO> currAgencyRst = govOrgFeignClient.getAgencyById(currAgencyId);
CustomerAgencyDTO currAgencyDto = currAgencyRst.getData(); if (!currAgencyRst.success()) {
if (!currAgencyRst.success() || currAgencyDto == null) {
throw new RenException(String.format("根据当前机构id[%s]查询pids失败:%s", currAgencyId, currAgencyRst.getMsg())); throw new RenException(String.format("根据当前机构id[%s]查询pids失败:%s", currAgencyId, currAgencyRst.getMsg()));
} }
CustomerAgencyDTO currAgencyDto = currAgencyRst.getData();
if (currAgencyDto == null || currAgencyDto.getId() == null) {
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode(), "操作权限不足,当前组织信息不存在");
}
// 获取机关单位中的角色 // 获取机关单位中的角色
// 目前一个人只在一个单位下,所以不动态查询,如果后面需要一个人在多个单位,再改这里 // 目前一个人只在一个单位下,所以不动态查询,如果后面需要一个人在多个单位,再改这里
//List<GovStaffRoleDTO> roleDTOS = queryGovStaffRoles(staffId, belongAgency.getId()); //List<GovStaffRoleDTO> roleDTOS = queryGovStaffRoles(staffId, belongAgency.getId());

Loading…
Cancel
Save