|
|
@ -1607,4 +1607,100 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao |
|
|
|
return new Result<List<CurrentUserCommunityInfoResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 返回组织的orgIdPath:包含自身 |
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public String getOrgIdPath(String orgId) { |
|
|
|
CustomerAgencyEntity customerAgencyEntity = baseDao.selectById(orgId); |
|
|
|
if (null == customerAgencyEntity) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode()); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(customerAgencyEntity.getPid()) || NumConstant.ZERO_STR.equals(customerAgencyEntity.getPid())) { |
|
|
|
return orgId; |
|
|
|
} |
|
|
|
return customerAgencyEntity.getPids().concat(StrConstant.COLON).concat(orgId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description: |
|
|
|
* @param agencyId: |
|
|
|
* @Return java.util.List<com.epmet.dto.result.AgencyCountCensusResultDTO> |
|
|
|
* @Author: lichao |
|
|
|
* @Date: 2023/4/7 14:17 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId) { |
|
|
|
|
|
|
|
List<AgencyCountCensusResultDTO> agencyCountCensusResultDTOS = new ArrayList<>(); |
|
|
|
|
|
|
|
CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId); |
|
|
|
if (customerAgency != null){ |
|
|
|
String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); |
|
|
|
agencyCountCensusResultDTOS = baseDao.agencyCount(pids); |
|
|
|
AgencyCountCensusResultDTO agencyCountCensusResultDTOGrid = new AgencyCountCensusResultDTO(); |
|
|
|
agencyCountCensusResultDTOGrid.setLevel("grid"); |
|
|
|
agencyCountCensusResultDTOGrid.setCount(baseDao.agencyGridCount(pids)); |
|
|
|
agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOGrid); |
|
|
|
|
|
|
|
AgencyCountCensusResultDTO agencyCountCensusResultDTOStaff = new AgencyCountCensusResultDTO(); |
|
|
|
agencyCountCensusResultDTOStaff.setLevel("staff"); |
|
|
|
agencyCountCensusResultDTOStaff.setCount(baseDao.agencyStaffCount(pids)); |
|
|
|
agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOStaff); |
|
|
|
|
|
|
|
}else{ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); |
|
|
|
} |
|
|
|
return agencyCountCensusResultDTOS; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CommunityCountCensusResultDTO> getCommunityCountList(CommunityCountCensusFormDTO dto) { |
|
|
|
|
|
|
|
List<CommunityCountCensusResultDTO> resultDTOS = new ArrayList<>(); |
|
|
|
|
|
|
|
CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId()); |
|
|
|
if (customerAgency!=null){ |
|
|
|
String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); |
|
|
|
|
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> queryWrapper = new LambdaQueryWrapper<CustomerAgencyEntity>().eq(CustomerAgencyEntity::getPids,pids); |
|
|
|
List<CustomerAgencyEntity> agencyEntityList = baseDao.selectList(queryWrapper); |
|
|
|
agencyEntityList.forEach( |
|
|
|
entity->{ |
|
|
|
CommunityCountCensusResultDTO communityCountCensusResultDTO = new CommunityCountCensusResultDTO(); |
|
|
|
communityCountCensusResultDTO.setAgencyId(entity.getId()); |
|
|
|
communityCountCensusResultDTO.setAgencyName(entity.getOrganizationName()); |
|
|
|
String agencyPids = PidUtils.convertPid2OrgIdPath(entity.getId(),entity.getPids()); |
|
|
|
communityCountCensusResultDTO.setCount(baseDao.getCommunityCount(agencyPids,dto.getTimeStart(),dto.getTimeEnd())); |
|
|
|
resultDTOS.add(communityCountCensusResultDTO); |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
}else { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTOS; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CommunityListByAgencyIdResultDTO> getCommunityList(CommunityCountCensusFormDTO dto) { |
|
|
|
|
|
|
|
CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId()); |
|
|
|
if (customerAgency!=null){ |
|
|
|
|
|
|
|
String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|