Browse Source

Merge remote-tracking branch 'origin/dev_0608fix'

feature/teamB_zz_wgh
yinzuomei 3 years ago
parent
commit
cea6ce416f
  1. 59
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

59
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.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; 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.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.*; import com.epmet.dao.*;
import com.epmet.dto.BuildingTreeLevelDTO; import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcBuildingListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums; import com.epmet.enums.BuildingTypeEnums;
import com.epmet.excel.IcBuildingExcel; 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 @Override
public List<String> treeIds(String customerId, String staffId) { public List<String> treeIds(String customerId, String staffId) {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
@ -272,34 +280,25 @@ public class BuildingServiceImpl implements BuildingService {
log.error("com.epmet.service.impl.BuildingServiceImpl.treeIds,没有找到工作人员所属的机关信息,用户Id:{}", staffId); log.error("com.epmet.service.impl.BuildingServiceImpl.treeIds,没有找到工作人员所属的机关信息,用户Id:{}", staffId);
return new ArrayList<>(); return new ArrayList<>();
} }
//1.获取所在组织及下级组织 AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agency.getAgencyId());
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId()); if (null == agencyInfo){
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId()); throw new EpmetException("未查询到组织信息"+agency.getAgencyId());
customerAgencyList.add(customerAgency);
if (CollectionUtils.isEmpty(customerAgencyList)) {
return new ArrayList<>();
} }
result.addAll(customerAgencyList.stream().map(m -> m.getId()).collect(Collectors.toList())); if (agencyInfo.getLevel().equals(CustomerAgencyConstant.COMMUNITY_LEVEL)){
List<BuildingTreeLevelDTO> agencyList = customerAgencyList.stream().map(item -> { // 查询所属组织的下级网格
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO(); List<AgencyGridListResultDTO> agencyGridListResultDTOS = customerGridDao.selectAgencyGridList(agency.getAgencyId());
buildingTreeLevelDTO.setId(item.getId()); if (!CollectionUtils.isEmpty(agencyGridListResultDTOS)){
buildingTreeLevelDTO.setPId(item.getPid()); result.addAll(agencyGridListResultDTOS.stream().map(m -> m.getGridId()).collect(Collectors.toList()));
buildingTreeLevelDTO.setLabel(item.getOrganizationName()); result.add(agency.getAgencyId());
buildingTreeLevelDTO.setLevel(item.getLevel()); }
buildingTreeLevelDTO.setLongitude(item.getLongitude()); }else {
buildingTreeLevelDTO.setLatitude(item.getLatitude()); // 查询组织下的组织
buildingTreeLevelDTO.setChildren(new ArrayList<>()); List<SonOrgResultDTO> sonAgencyId = customerAgencyDao.getSonAgencyId(agency.getAgencyId());
//当前组织有几个下级组织 if (!CollectionUtils.isEmpty(sonAgencyId)){
buildingTreeLevelDTO.setShowNum(StrConstant.EPMETY_STR); result.addAll(sonAgencyId.stream().map(m -> m.getOrgId()).collect(Collectors.toList()));
return buildingTreeLevelDTO; result.add(agency.getAgencyId());
}).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()));
return result; return result;
} }

Loading…
Cancel
Save