优化以人找房,以房找人 --renpc

This commit is contained in:
Renpc-kilig 2023-11-25 14:36:05 +08:00
parent 4f0d916c99
commit 5bb9dd4b72

View File

@ -462,8 +462,6 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
}
}
// 一次性获取所有的人口信息
List<PopulationInfoDTO> populationInfoDTOs = populationInfoService.getBatch(populationInfoIds);
// 一次性获取所有的房屋信息
List<HouseDTO> houseDTOs = houseService.getBatch(houseIds);
@ -493,14 +491,8 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
e.printStackTrace();
}
Map<String, PopulationInfoDTO> populationInfoMap = null;
Map<String, HouseDTO> houseMap = null;
Map<String, PopulationInfoBaseDTO> baseMap = null;
if (!CollectionUtils.isEmpty(populationInfoDTOs)) {
populationInfoMap = populationInfoDTOs.stream()
.collect(Collectors.toMap(PopulationInfoDTO::getPopulationInfoId,
populationInfoDTO -> populationInfoDTO));
}
if (!CollectionUtils.isEmpty(houseDTOs)) {
houseMap = houseDTOs.stream()
@ -523,7 +515,7 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
} else {
populationInfoBaseDTO = setPopulationBaseInfo(populationDTO);
}
// populationInfoService.getTuoMin(populationInfoBaseDTO);
populationInfoService.getTuoMin(populationInfoBaseDTO);
populationDTO.setPopulationInfoBaseDTO(populationInfoBaseDTO);
} else {
PopulationInfoBaseDTO populationInfoBaseDTO = setPopulationBaseInfo(populationDTO);
@ -536,28 +528,6 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
}
}
// 获取人口详情
/*for (PopulationDTO populationDTO : overList) {
if (StringUtils.isNotEmpty(populationDTO.getPopulationInfoId())) {
PopulationInfoDTO populationInfoDTO = populationInfoService.get(populationDTO.getPopulationInfoId());
PopulationInfoHouseDTO populationInfoHouseDTO = new PopulationInfoHouseDTO();
BeanUtils.copyProperties(populationInfoDTO, populationInfoHouseDTO);
// 获取人员
PopulationInfoBaseDTO base = populationInfoService.getBase(populationDTO.getPopulationInfoId());
// populationInfoService.getTuoMin(base);
populationInfoHouseDTO.setPopulationInfoBaseDTO(base);
populationDTO.setPopulationInfoHouseDTO(populationInfoHouseDTO);
}
// 获取房屋详情
HouseDTO houseDTO = houseService.get(populationDTO.getHouseId());
if (null != houseDTO) {
populationDTO.setHouseDTO(houseDTO);
}
}*/
PageInfo<PopulationDTO> pageInfo = new PageInfo<>(overList);
return new SuccessResultList<>(overList, pageInfo.getPageNum(), pageInfo.getTotal());
}
@ -582,22 +552,4 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
return new SuccessResultList<>(populationDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
public class getBase implements Runnable {
private List<String> dataList;
private List<PopulationInfoBaseDTO> baseDTOList;
public getBase(List<String> dataList, List<PopulationInfoBaseDTO> baseDTOList) {
this.dataList = dataList;
this.baseDTOList = baseDTOList;
}
@Override
public void run() {
for (String s : dataList) {
PopulationInfoBaseDTO base = populationInfoService.getBase(s);
baseDTOList.add(base);
}
}
}
}