diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index c1863e5cd0..6a95c20596 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -19,18 +19,18 @@ import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.BuildingTreeLevelDTO; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.BuildingResultDTO; -import com.epmet.dto.result.BuildingResultPagedDTO; -import com.epmet.dto.result.IcBuildingListResultDTO; -import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.enums.BuildingTypeEnums; import com.epmet.excel.IcBuildingExcel; @@ -264,6 +264,14 @@ public class BuildingServiceImpl implements BuildingService { } + /** + * Desc: + * 2022-06-06 需求变动,只返回当前组织下级ID + * @param customerId + * @param staffId + * @author zxc + * @date 2022/6/6 09:19 + */ @Override public List treeIds(String customerId, String staffId) { List result = new ArrayList<>(); @@ -272,34 +280,25 @@ public class BuildingServiceImpl implements BuildingService { log.error("com.epmet.service.impl.BuildingServiceImpl.treeIds,没有找到工作人员所属的机关信息,用户Id:{}", staffId); return new ArrayList<>(); } - //1.获取所在组织及下级组织 - CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId()); - List customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId()); - customerAgencyList.add(customerAgency); - if (CollectionUtils.isEmpty(customerAgencyList)) { - return new ArrayList<>(); + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agency.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("未查询到组织信息"+agency.getAgencyId()); } - result.addAll(customerAgencyList.stream().map(m -> m.getId()).collect(Collectors.toList())); - List 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 agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); - List customerGridList = customerGridDao.selectList(new QueryWrapper().lambda().in(CustomerGridEntity::getPid, agencyIdList)); - if (CollectionUtils.isEmpty(customerGridList)) { - return result; + if (agencyInfo.getLevel().equals(CustomerAgencyConstant.COMMUNITY_LEVEL)){ + // 查询所属组织的下级网格 + List agencyGridListResultDTOS = customerGridDao.selectAgencyGridList(agency.getAgencyId()); + if (!CollectionUtils.isEmpty(agencyGridListResultDTOS)){ + result.addAll(agencyGridListResultDTOS.stream().map(m -> m.getGridId()).collect(Collectors.toList())); + result.add(agency.getAgencyId()); + } + }else { + // 查询组织下的组织 + List sonAgencyId = customerAgencyDao.getSonAgencyId(agency.getAgencyId()); + if (!CollectionUtils.isEmpty(sonAgencyId)){ + result.addAll(sonAgencyId.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); + result.add(agency.getAgencyId()); + } } - result.addAll(customerGridList.stream().map(m -> m.getId()).collect(Collectors.toList())); return result; }