|
|
@ -6,12 +6,15 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.CustomerAgencyDao; |
|
|
|
import com.epmet.dao.IcNeighborHoodDao; |
|
|
|
import com.epmet.dto.form.HouseInformationFormDTO; |
|
|
|
import com.epmet.dto.form.IcUserCountFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.CustomerAgencyEntity; |
|
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.service.HouseInformationService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
@ -21,7 +24,11 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description |
|
|
@ -36,6 +43,8 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
private IcNeighborHoodDao icNeighborHoodDao; |
|
|
|
@Resource |
|
|
|
private CustomerAgencyDao customerAgencyDao; |
|
|
|
@Resource |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* 【双实录入】社区录入数据统计 |
|
|
@ -71,7 +80,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
CommunityCountResultDTO result = icNeighborHoodDao.getCommunityCount(formDTO); |
|
|
|
result.setId(agency.getId()); |
|
|
|
result.setName(orgName); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.ZERO_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getCommunityId()); |
|
|
|
countFormDTO.setType(NumConstant.ZERO_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
if (map.containsKey(formDTO.getCommunityId())) { |
|
|
|
result.setPersonCount(map.get(formDTO.getCommunityId())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -89,7 +106,22 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<GridCountListResultDTO> list = icNeighborHoodDao.getGridList(formDTO); |
|
|
|
PageInfo<GridCountListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.ZERO_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getCommunityId()); |
|
|
|
countFormDTO.setType(NumConstant.ONE_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
|
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
@ -105,7 +137,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
@Override |
|
|
|
public GridStatisticsResultDTO getGridCount(HouseInformationFormDTO formDTO) { |
|
|
|
GridStatisticsResultDTO result = icNeighborHoodDao.getGridCount(formDTO); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.ONE_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getGridId()); |
|
|
|
countFormDTO.setType(NumConstant.ZERO_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
if (map.containsKey(formDTO.getGridId())) { |
|
|
|
result.setPersonCount(map.get(formDTO.getGridId())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -123,7 +163,20 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<NeighborHoodListResultDTO> list = icNeighborHoodDao.getNeighborHoodList(formDTO); |
|
|
|
PageInfo<NeighborHoodListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.ONE_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getGridId()); |
|
|
|
countFormDTO.setType(NumConstant.ONE_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); |
|
|
|
}); |
|
|
|
} |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
@ -139,7 +192,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
@Override |
|
|
|
public NeighborHoodCountResultDTO getNeighborHoodCount(HouseInformationFormDTO formDTO) { |
|
|
|
NeighborHoodCountResultDTO result = icNeighborHoodDao.getNeighborHoodCount(formDTO); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.TWO_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getNeighborHoodId()); |
|
|
|
countFormDTO.setType(NumConstant.ZERO_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
if (map.containsKey(formDTO.getNeighborHoodId())) { |
|
|
|
result.setPersonCount(map.get(formDTO.getNeighborHoodId())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -156,17 +217,47 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
public PageData<BuildingListResultDTO> getBuildingList(HouseInformationFormDTO formDTO) { |
|
|
|
List<BuildingListResultDTO> list; |
|
|
|
long total = 0; |
|
|
|
//TODO 获取录入人口数
|
|
|
|
if (NumConstant.FIVE_STR.equals(formDTO.getSort())) { |
|
|
|
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.TWO_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getNeighborHoodId()); |
|
|
|
countFormDTO.setType(NumConstant.ONE_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
|
|
|
|
if (!NumConstant.FIVE_STR.equals(formDTO.getSort())) { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
list = icNeighborHoodDao.getBuildingList(formDTO); |
|
|
|
PageInfo<BuildingListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
total = pageInfo.getTotal(); |
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
list = icNeighborHoodDao.getBuildingList(formDTO); |
|
|
|
total = list.size(); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
total = list.size(); |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); |
|
|
|
}); |
|
|
|
|
|
|
|
//排序
|
|
|
|
list = list.stream().sorted(Comparator.comparing(BuildingListResultDTO::getDifferPersonCount).reversed()).collect(Collectors.toList()); |
|
|
|
//分页
|
|
|
|
list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new PageData<>(list, total); |
|
|
|
} |
|
|
|
|
|
|
@ -182,7 +273,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
@Override |
|
|
|
public BuildingCountResultDTO getBuildingCount(HouseInformationFormDTO formDTO) { |
|
|
|
BuildingCountResultDTO result = icNeighborHoodDao.getBuildingCount(formDTO); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.THREE_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getBuildingId()); |
|
|
|
countFormDTO.setType(NumConstant.ZERO_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
if (map.containsKey(formDTO.getBuildingId())) { |
|
|
|
result.setPersonCount(map.get(formDTO.getBuildingId())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -200,7 +299,19 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<UnitListResultDTO> list = icNeighborHoodDao.getUnitList(formDTO); |
|
|
|
PageInfo<UnitListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.THREE_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getBuildingId()); |
|
|
|
countFormDTO.setType(NumConstant.ONE_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
@ -216,7 +327,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
@Override |
|
|
|
public UnitCountResultDTO getUnitCount(HouseInformationFormDTO formDTO) { |
|
|
|
UnitCountResultDTO result = icNeighborHoodDao.getUnitCount(formDTO); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.FOUR_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getUnitId()); |
|
|
|
countFormDTO.setType(NumConstant.ZERO_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
if (map.containsKey(formDTO.getUnitId())) { |
|
|
|
result.setPersonCount(map.get(formDTO.getUnitId())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -231,15 +350,54 @@ public class HouseInformationServiceImpl implements HouseInformationService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<HomeListResultDTO> getHouseList(HouseInformationFormDTO formDTO) { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<HomeListResultDTO> list = icNeighborHoodDao.getHouseList(formDTO); |
|
|
|
PageInfo<HomeListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
//TODO 获取录入人口数
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
list.forEach(item -> { |
|
|
|
item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); |
|
|
|
}); |
|
|
|
List<HomeListResultDTO> list = null; |
|
|
|
long total = 0; |
|
|
|
//获取录入人口数
|
|
|
|
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); |
|
|
|
countFormDTO.setOrgType(NumConstant.FOUR_STR); |
|
|
|
countFormDTO.setOrgId(formDTO.getUnitId()); |
|
|
|
countFormDTO.setType(NumConstant.ONE_STR); |
|
|
|
Map<String, Integer> map = getMapResult(countFormDTO); |
|
|
|
|
|
|
|
if (!NumConstant.TWO_STR.equals(formDTO.getSort())) { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
list = icNeighborHoodDao.getHouseList(formDTO); |
|
|
|
PageInfo<HomeListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
total = pageInfo.getTotal(); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
list = icNeighborHoodDao.getHouseList(formDTO); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
total = list.size(); |
|
|
|
list.forEach(item -> { |
|
|
|
if (map.containsKey(item.getId())) { |
|
|
|
item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); |
|
|
|
item.setPersonCount(map.get(item.getId())); |
|
|
|
} |
|
|
|
}); |
|
|
|
//排序
|
|
|
|
list = list.stream().sorted(Comparator.comparing(HomeListResultDTO::getPersonCount).reversed()).collect(Collectors.toList()); |
|
|
|
//分页
|
|
|
|
list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
|
|
|
|
return new PageData<>(list, total); |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, Integer> getMapResult(IcUserCountFormDTO countFormDTO) { |
|
|
|
Result<Map<String, Integer>> result = userOpenFeignClient.getIcUserCount(countFormDTO); |
|
|
|
if (!result.success()) { |
|
|
|
log.warn("查询录入人数失败"); |
|
|
|
return Collections.emptyMap(); |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
|