|
@ -1,5 +1,6 @@ |
|
|
package com.epmet.plugin.power.modules.axis.service.impl; |
|
|
package com.epmet.plugin.power.modules.axis.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
@ -27,6 +28,7 @@ import com.epmet.plugin.power.modules.axis.entity.PowerKernelHouseholdEntity; |
|
|
import com.epmet.plugin.power.modules.axis.redis.PowerKernelHouseholdRedis; |
|
|
import com.epmet.plugin.power.modules.axis.redis.PowerKernelHouseholdRedis; |
|
|
import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; |
|
|
import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; |
|
|
import com.epmet.plugin.power.modules.axis.service.PowerKernelHouseholdService; |
|
|
import com.epmet.plugin.power.modules.axis.service.PowerKernelHouseholdService; |
|
|
|
|
|
import com.google.common.collect.Sets; |
|
|
import org.apache.commons.compress.utils.Lists; |
|
|
import org.apache.commons.compress.utils.Lists; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -148,29 +150,35 @@ 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(); |
|
|
|
|
|
// 需要绑定的房屋ID集合
|
|
|
// 查询出重复的houseId
|
|
|
List<String> houseIdList = form.getHouseIdList(); |
|
|
List<String> idList = baseDao.queryHouseIdList(form.getHouseIdList(), form.getAxisStructId(), customerId); |
|
|
// 查询已绑定的houseId集合
|
|
|
// 将idList转换为Set集合进行去重
|
|
|
List<String> existHouseIdList = baseDao.queryHouseIdList(houseIdList, form.getAxisStructId(), customerId); |
|
|
Set<String> setIdList = new HashSet<>(); |
|
|
// 倒序,取差集
|
|
|
for (String id : idList) { |
|
|
for (int i = houseIdList.size() - 1; i >= 0; i--) { |
|
|
setIdList.add(id); |
|
|
for (String existHouseId : existHouseIdList) { |
|
|
|
|
|
if (existHouseId.equals(houseIdList.get(i))) { |
|
|
|
|
|
houseIdList.remove(i); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
// 将前端发送的houseId放入Set集合
|
|
|
|
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
|
|
|
Collections.addAll(houseIds, form.getHouseIdList()); |
|
|
|
|
|
// 去重
|
|
|
|
|
|
houseIds.removeAll(setIdList); |
|
|
|
|
|
|
|
|
|
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); |
|
|
if (CollUtil.isEmpty(houseIdList)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
// 查询房屋信息
|
|
|
|
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(Sets.newHashSet(houseIdList), customerId); |
|
|
if (!listResult.success()) { |
|
|
if (!listResult.success()) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
List<HouseInfoDTO> houseList = listResult.getData(); |
|
|
List<HouseInfoDTO> houseList = listResult.getData(); |
|
|
PowerKernelHouseholdEntity entity; |
|
|
PowerKernelHouseholdEntity entity; |
|
|
|
|
|
|
|
|
|
|
|
Result<IcHouseDTO> icHouseDTOResult; |
|
|
for (HouseInfoDTO houseInfo : houseList) { |
|
|
for (HouseInfoDTO houseInfo : houseList) { |
|
|
Result<IcHouseDTO> icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId()); |
|
|
|
|
|
|
|
|
// 查询房屋与房主信息
|
|
|
|
|
|
icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId()); |
|
|
if (!icHouseDTOResult.success()) { |
|
|
if (!icHouseDTOResult.success()) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|