|
|
@ -144,8 +144,20 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
|
@Override |
|
|
|
public void bind(PowerKernelHouseFormDTO form) { |
|
|
|
String customerId = loginUserUtil.getLoginUserCustomerId(); |
|
|
|
|
|
|
|
// 查询出重复的houseId
|
|
|
|
List<String> idList = baseDao.queryHouseIdList(form.getHouseIdList(), form.getAxisStructId(), customerId); |
|
|
|
// 将idList转换为Set集合进行去重
|
|
|
|
Set<String> setIdList = new HashSet<>(); |
|
|
|
for (String id : idList) { |
|
|
|
setIdList.add(id); |
|
|
|
} |
|
|
|
// 将前端发送的houseId放入Set集合
|
|
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
|
Collections.addAll(houseIds, form.getHouseIdList()); |
|
|
|
// 去重
|
|
|
|
houseIds.removeAll(setIdList); |
|
|
|
|
|
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); |
|
|
|
if (!listResult.success()) { |
|
|
|
return; |
|
|
@ -178,9 +190,7 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
|
entity.setOwnerName(houseDto.getOwnerName()); |
|
|
|
|
|
|
|
entity.setStructReferenceId(form.getAxisStructId()); |
|
|
|
if(baseDao.queryRepeatHouseId(entity) > NumConstant.ZERO){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "只允许绑定一次"); |
|
|
|
} |
|
|
|
|
|
|
|
powerKernelHouseholdService.insert(entity); |
|
|
|
} |
|
|
|
} |
|
|
|