|
|
@ -626,23 +626,25 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
|
for (CustomerStaffDTO staffDTO : customerStaffList){ |
|
|
|
// 2.根据 customer_id 去 gov_staff_role表,查询 customer_id + role_key = root_manager ,确定 根管理员的id,即roleId
|
|
|
|
GovStaffRoleDTO roleKey = govStaffRoleDao.getRoleByCustomerIdAndRoleKey(staffDTO.getCustomerId(), RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); |
|
|
|
// 3.根据roleId + staff_id(即 userId) 查 staff_role表的主键id, 如果查到了,那这个userId就是 根管理员
|
|
|
|
StaffRoleDTO staffRoleDTO = staffRoleDao.selectStaffRoleByStaffIdAndRoleId(staffDTO.getUserId(), roleKey.getId()); |
|
|
|
if (null != staffRoleDTO){ |
|
|
|
// 4.如果userID是根管理员的话,则根据customerId 去 customer表 查询 id、customer_name
|
|
|
|
customerDTO.setId(staffDTO.getCustomerId()); |
|
|
|
Result<CustomerDTO> customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); |
|
|
|
if (!customerInfo.success()) { |
|
|
|
logger.error(String.format("获取根管理员信息失败,调用%s服务查询客户名称失败,入参%s", ServiceConstant.OPER_CRM_SERVER, JSON.toJSONString(staffDTO.getCustomerId()))); |
|
|
|
} else { |
|
|
|
if (null != customerInfo.getData()){ |
|
|
|
CustomerListResultDTO resultDTO = new CustomerListResultDTO(); |
|
|
|
resultDTO.setCustomerId(customerInfo.getData().getId()); |
|
|
|
resultDTO.setCustomerName(customerInfo.getData().getCustomerName()); |
|
|
|
listResultDTO.add(resultDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != roleKey){ |
|
|
|
// 3.根据roleId + staff_id(即 userId) 查 staff_role表的主键id, 如果查到了,那这个userId就是 根管理员
|
|
|
|
StaffRoleDTO staffRoleDTO = staffRoleDao.selectStaffRoleByStaffIdAndRoleId(staffDTO.getUserId(), roleKey.getId()); |
|
|
|
if (null != staffRoleDTO){ |
|
|
|
// 4.如果userID是根管理员的话,则根据customerId 去 customer表 查询 id、customer_name
|
|
|
|
customerDTO.setId(staffDTO.getCustomerId()); |
|
|
|
Result<CustomerDTO> customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); |
|
|
|
if (!customerInfo.success()) { |
|
|
|
logger.error(String.format("获取根管理员信息失败,调用%s服务查询客户名称失败,入参%s", ServiceConstant.OPER_CRM_SERVER, JSON.toJSONString(staffDTO.getCustomerId()))); |
|
|
|
} else { |
|
|
|
if (null != customerInfo.getData()){ |
|
|
|
CustomerListResultDTO resultDTO = new CustomerListResultDTO(); |
|
|
|
resultDTO.setCustomerId(customerInfo.getData().getId()); |
|
|
|
resultDTO.setCustomerName(customerInfo.getData().getCustomerName()); |
|
|
|
listResultDTO.add(resultDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result<List<CustomerListResultDTO>>().ok(listResultDTO); |
|
|
|
} |
|
|
|