|
|
@ -215,18 +215,22 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result<AddGridResultDTO> addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { |
|
|
|
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(addGridFormDTO.getAgencyId()); |
|
|
|
CustomerAgencyDTO customerAgencyDTO = customerAgencyService.get(addGridFormDTO.getAgencyId()); |
|
|
|
// 1. 查询该客户下可创建网格的最大数量
|
|
|
|
GridCountFormDTO gridCount = new GridCountFormDTO(); |
|
|
|
String customerId = customerAgencyDTO.getCustomerId(); |
|
|
|
gridCount.setCustomerId(customerId); |
|
|
|
GridCountResultDTO grid = operCrmOpenFeignClient.getGridCount(gridCount).getData(); |
|
|
|
if (grid.getGridCount().equals(NumConstant.ZERO)){ |
|
|
|
log.info("客户信息为:" + grid); |
|
|
|
if (null == grid) { |
|
|
|
throw new RenException("未查出该客户信息"); |
|
|
|
} |
|
|
|
if (null == grid.getGridCount() || grid.getGridCount().equals(NumConstant.ZERO)) { |
|
|
|
throw new RenException(EpmetErrorCode.GRID_COUNT_UP.getCode()); |
|
|
|
} |
|
|
|
// 2. 判断当前客户下存在的网格数量
|
|
|
|
Integer gridCounts = customerGridDao.selectGridCount(customerId); |
|
|
|
if (gridCounts >= grid.getGridCount()){ |
|
|
|
if (gridCounts >= grid.getGridCount()) { |
|
|
|
throw new RenException(EpmetErrorCode.GRID_COUNT_UP.getCode()); |
|
|
|
} |
|
|
|
// 3. 查询网格名称是否重名
|
|
|
|