|
|
@ -261,6 +261,71 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<String> treeIds(String customerId, String staffId) { |
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
if(null == agency || StringUtils.isBlank(agency.getAgencyId())){ |
|
|
|
log.error("com.epmet.service.impl.BuildingServiceImpl.treeIds,没有找到工作人员所属的机关信息,用户Id:{}",staffId); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
//1.获取所在组织及下级组织
|
|
|
|
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId()); |
|
|
|
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId()); |
|
|
|
customerAgencyList.add(customerAgency); |
|
|
|
if(CollectionUtils.isEmpty(customerAgencyList)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
result.addAll(customerAgencyList.stream().map(m -> m.getId()).collect(Collectors.toList())); |
|
|
|
List<BuildingTreeLevelDTO> agencyList = customerAgencyList.stream().map(item -> { |
|
|
|
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO(); |
|
|
|
buildingTreeLevelDTO.setId(item.getId()); |
|
|
|
buildingTreeLevelDTO.setPId(item.getPid()); |
|
|
|
buildingTreeLevelDTO.setLabel(item.getOrganizationName()); |
|
|
|
buildingTreeLevelDTO.setLevel(item.getLevel()); |
|
|
|
buildingTreeLevelDTO.setLongitude(item.getLongitude()); |
|
|
|
buildingTreeLevelDTO.setLatitude(item.getLatitude()); |
|
|
|
buildingTreeLevelDTO.setChildren(new ArrayList<>()); |
|
|
|
//当前组织有几个下级组织
|
|
|
|
buildingTreeLevelDTO.setShowNum(StrConstant.EPMETY_STR); |
|
|
|
return buildingTreeLevelDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//2.获取组织所在网格
|
|
|
|
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
|
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList)); |
|
|
|
if(CollectionUtils.isEmpty(customerGridList)){ |
|
|
|
return result; |
|
|
|
} |
|
|
|
result.addAll(customerGridList.stream().map(m -> m.getId()).collect(Collectors.toList())); |
|
|
|
List<BuildingTreeLevelDTO> gridList = customerGridList.stream().map(item -> { |
|
|
|
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO(); |
|
|
|
buildingTreeLevelDTO.setId(item.getId()); |
|
|
|
buildingTreeLevelDTO.setLabel(item.getGridName()); |
|
|
|
buildingTreeLevelDTO.setLevel("grid"); |
|
|
|
buildingTreeLevelDTO.setPId(item.getPid()); |
|
|
|
buildingTreeLevelDTO.setLongitude(item.getLongitude()); |
|
|
|
buildingTreeLevelDTO.setLatitude(item.getLatitude()); |
|
|
|
buildingTreeLevelDTO.setChildren(new ArrayList<>()); |
|
|
|
//当前网格下有几个小区
|
|
|
|
buildingTreeLevelDTO.setShowNum(StrConstant.EPMETY_STR); |
|
|
|
return buildingTreeLevelDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
//3.获取网格下的所有小区
|
|
|
|
List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda() |
|
|
|
.in(IcNeighborHoodEntity::getGridId, gridIdList) |
|
|
|
.orderByAsc(IcNeighborHoodEntity::getCreatedTime); |
|
|
|
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper); |
|
|
|
if(CollectionUtils.isEmpty(icNeighborHoodList)){ |
|
|
|
agencyList.addAll(gridList); |
|
|
|
return result; |
|
|
|
} |
|
|
|
result.addAll(icNeighborHoodList.stream().map(m -> m.getId()).collect(Collectors.toList())); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList) { |
|
|
|