|
|
@ -20,14 +20,8 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.CustomerGridConstant; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcBuildingDao; |
|
|
|
import com.epmet.dao.IcBuildingUnitDao; |
|
|
|
import com.epmet.dao.IcHouseDao; |
|
|
|
import com.epmet.dao.IcNeighborHoodDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.IcBuildingDTO; |
|
|
|
import com.epmet.dto.IcBuildingUnitDTO; |
|
|
|
import com.epmet.dto.IcHouseDTO; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
@ -56,6 +50,7 @@ import java.text.NumberFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Slf4j |
|
|
@ -90,9 +85,12 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ExecutorService executorService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private CustomerAgencyDao customerAgencyDao; |
|
|
|
@Autowired |
|
|
|
private CustomerGridDao customerGridDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -374,7 +372,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
houseTotal.addAndGet(l.getNum()); |
|
|
|
if (l.getRentFlag() == 0) { |
|
|
|
resultDTO.setZzHouseTotal(l.getNum()); |
|
|
|
} else if (l.getRentFlag() == 0) { |
|
|
|
} else if (l.getRentFlag() == 1) { |
|
|
|
resultDTO.setCzHouseTotal(l.getNum()); |
|
|
|
} else { |
|
|
|
resultDTO.setXzHouseTotal(l.getNum()); |
|
|
@ -395,7 +393,109 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<SubUserHouseListResultDTO> subUserHouseList(HouseChartFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
List<SubUserHouseListResultDTO> resultList = new ArrayList<>(); |
|
|
|
//1.判断入参没值的赋值当前工作人员缓存所属组织信息
|
|
|
|
if (StringUtils.isEmpty(formDTO.getOrgId())) { |
|
|
|
//获取工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
} |
|
|
|
formDTO.setOrgId(staffInfo.getAgencyId()); |
|
|
|
formDTO.setOrgType("agency"); |
|
|
|
} |
|
|
|
if ("village".equals(formDTO.getOrgType())) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
//2.根据入参值查询直属下级列表(组织、网格、小区列表)
|
|
|
|
List<String> idList = new ArrayList<>(); |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
String orgType = ""; |
|
|
|
if ("agency".equals(formDTO.getOrgType())) { |
|
|
|
//获取组织缓存,判断组织级别
|
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); |
|
|
|
if (null == agencyInfo) { |
|
|
|
throw new RenException(String.format("查询组织信息失败%s", formDTO.getOrgId())); |
|
|
|
} |
|
|
|
//直属下级网格列表
|
|
|
|
if ("community".equals(agencyInfo.getLevel())) { |
|
|
|
orgType = "grid"; |
|
|
|
List<GridListResultDTO> list = customerGridDao.selectGridList(formDTO.getOrgId()); |
|
|
|
idList = list.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
map = list.stream().collect(Collectors.toMap(GridListResultDTO::getGridId, GridListResultDTO::getGridName, (k1, k2) -> k1)); |
|
|
|
} else { |
|
|
|
//直属下级组织列表
|
|
|
|
orgType = "agency"; |
|
|
|
List<AgencyListResultDTO> list = customerAgencyDao.selectAgencyList(formDTO.getOrgId()); |
|
|
|
idList = list.stream().map(AgencyListResultDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
map = list.stream().collect(Collectors.toMap(AgencyListResultDTO::getAgencyId, AgencyListResultDTO::getAgencyName, (k1, k2) -> k1)); |
|
|
|
} |
|
|
|
} else if ("grid".equals(formDTO.getOrgType())) { |
|
|
|
//网格直属小区列表
|
|
|
|
orgType = "village"; |
|
|
|
List<IcNeighborHoodDTO> list = icNeighborHoodDao.selectNeighborList(formDTO.getOrgId()); |
|
|
|
idList = list.stream().map(IcNeighborHoodDTO::getId).collect(Collectors.toList()); |
|
|
|
map = list.stream().collect(Collectors.toMap(IcNeighborHoodDTO::getId, IcNeighborHoodDTO::getNeighborHoodName, (k1, k2) -> k1)); |
|
|
|
} |
|
|
|
|
|
|
|
//3.分别查询直属下级列表的房屋、居民统计数据
|
|
|
|
resultList = houseUserChartList(idList, map, orgType); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 【人房】房屋、居民统计列表数据 |
|
|
|
**/ |
|
|
|
private List<SubUserHouseListResultDTO> houseUserChartList(List<String> idList, Map<String, String> map, String orgType) { |
|
|
|
List<SubUserHouseListResultDTO> list = new ArrayList<>(); |
|
|
|
//1.直属下级列表的房屋数据
|
|
|
|
List<HouseChartResultDTO> houseList = new ArrayList<>(); |
|
|
|
HouseChartFormDTO houseDTO = new HouseChartFormDTO(); |
|
|
|
houseDTO.setOrgType(orgType); |
|
|
|
for (String id : idList) { |
|
|
|
houseDTO.setOrgId(id); |
|
|
|
houseList.add(houseChart(houseDTO)); |
|
|
|
} |
|
|
|
//2.直属下级列表的居民数据
|
|
|
|
UserChartFormDTO userDTO = new UserChartFormDTO(); |
|
|
|
userDTO.setOrgType(orgType); |
|
|
|
userDTO.setIdList(idList); |
|
|
|
Result<List<UserChartResultDTO>> userResult = epmetUserOpenFeignClient.userChartList(userDTO); |
|
|
|
if (!userResult.success()) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民人房统计数据失败" + userResult.getInternalMsg(), userResult.getMsg()); |
|
|
|
} |
|
|
|
//3.汇总封装数据
|
|
|
|
SubUserHouseListResultDTO dto = null; |
|
|
|
for (String id : idList) { |
|
|
|
dto = new SubUserHouseListResultDTO(); |
|
|
|
dto.setOrgId(id); |
|
|
|
dto.setOrgName(map.get(id)); |
|
|
|
dto.setOrgType(orgType); |
|
|
|
for (HouseChartResultDTO h : houseList) { |
|
|
|
if (h.getOrgId().equals(id)) { |
|
|
|
dto.setHouseTotal(h.getHouseTotal()); |
|
|
|
dto.setZzHouseTotal(h.getZzHouseTotal()); |
|
|
|
dto.setZzHouseRatio(h.getZzHouseRatio()); |
|
|
|
dto.setCzHouseTotal(h.getCzHouseTotal()); |
|
|
|
dto.setCzHouseRatio(h.getCzHouseRatio()); |
|
|
|
dto.setXzHouseTotal(h.getXzHouseTotal()); |
|
|
|
dto.setXzHouseRatio(h.getXzHouseRatio()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (UserChartResultDTO u : userResult.getData()) { |
|
|
|
if (u.getOrgId().equals(id)) { |
|
|
|
dto.setUserTotal(u.getUserTotal()); |
|
|
|
dto.setCzUserTotal(u.getCzUserTotal()); |
|
|
|
dto.setCzUserRatio(u.getCzUserRatio()); |
|
|
|
dto.setLdUserTotal(u.getLdUserTotal()); |
|
|
|
dto.setLdUserRatio(u.getLdUserRatio()); |
|
|
|
} |
|
|
|
} |
|
|
|
list.add(dto); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|