|
@ -144,26 +144,38 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
@Override |
|
|
@Override |
|
|
public void bind(PowerKernelHouseFormDTO form) { |
|
|
public void bind(PowerKernelHouseFormDTO form) { |
|
|
String customerId = loginUserUtil.getLoginUserCustomerId(); |
|
|
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<>(); |
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
Collections.addAll(houseIds,form.getHouseIdList()); |
|
|
Collections.addAll(houseIds, form.getHouseIdList()); |
|
|
|
|
|
// 去重
|
|
|
|
|
|
houseIds.removeAll(setIdList); |
|
|
|
|
|
|
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); |
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); |
|
|
if(!listResult.success()){ |
|
|
if (!listResult.success()) { |
|
|
return ; |
|
|
return; |
|
|
} |
|
|
} |
|
|
List<HouseInfoDTO> houseList = listResult.getData(); |
|
|
List<HouseInfoDTO> houseList = listResult.getData(); |
|
|
List<PowerKernelHouseholdEntity> list = Lists.newArrayList(); |
|
|
List<PowerKernelHouseholdEntity> list = Lists.newArrayList(); |
|
|
PowerKernelHouseholdEntity entity; |
|
|
PowerKernelHouseholdEntity entity; |
|
|
|
|
|
|
|
|
for(HouseInfoDTO houseInfo : houseList){ |
|
|
for (HouseInfoDTO houseInfo : houseList) { |
|
|
Result<IcHouseDTO> icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId()); |
|
|
Result<IcHouseDTO> icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId()); |
|
|
if(!icHouseDTOResult.success()){ |
|
|
if (!icHouseDTOResult.success()) { |
|
|
continue ; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
IcHouseDTO houseDto = icHouseDTOResult.getData(); |
|
|
IcHouseDTO houseDto = icHouseDTOResult.getData(); |
|
|
entity = new PowerKernelHouseholdEntity(); |
|
|
entity = new PowerKernelHouseholdEntity(); |
|
|
entity.setHouseId(houseInfo.getHomeId()); |
|
|
entity.setHouseId(houseInfo.getHomeId()); |
|
|
|
|
|
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLatitude()) && !org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLongitude())){ |
|
|
if (!org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLatitude()) && !org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLongitude())) { |
|
|
entity.setLatitude(new BigDecimal(houseInfo.getBuildingLatitude())); |
|
|
entity.setLatitude(new BigDecimal(houseInfo.getBuildingLatitude())); |
|
|
entity.setLongitude(new BigDecimal(houseInfo.getBuildingLongitude())); |
|
|
entity.setLongitude(new BigDecimal(houseInfo.getBuildingLongitude())); |
|
|
} else { |
|
|
} else { |
|
@ -178,9 +190,7 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
entity.setOwnerName(houseDto.getOwnerName()); |
|
|
entity.setOwnerName(houseDto.getOwnerName()); |
|
|
|
|
|
|
|
|
entity.setStructReferenceId(form.getAxisStructId()); |
|
|
entity.setStructReferenceId(form.getAxisStructId()); |
|
|
if(baseDao.queryRepeatHouseId(entity) > NumConstant.ZERO){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "只允许绑定一次"); |
|
|
|
|
|
} |
|
|
|
|
|
powerKernelHouseholdService.insert(entity); |
|
|
powerKernelHouseholdService.insert(entity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|