|
@@ -107,26 +107,32 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ReportAreaVO getReportAreaInfo(String areaCode) {
|
|
|
- ReportAreaVO reportAreaVO = new ReportAreaVO();
|
|
|
- // 查询管理分区信息
|
|
|
- QueryPartitionDTO queryPartitionDTO = new QueryPartitionDTO();
|
|
|
- queryPartitionDTO.setManagePartitionIds(Lists.newArrayList(areaCode));
|
|
|
- PoemsFeignResponse<PoemsPartitionVO> partitionsResponse = saasWebClientWrapper.queryPartitionsByIds(queryPartitionDTO);
|
|
|
- List<PoemsPartitionVO> partitionVOList = partitionsResponse.getContent();
|
|
|
- if (!CollectionUtils.isEmpty(partitionVOList)) {
|
|
|
- PoemsPartitionVO poemsPartitionVO = partitionVOList.get(0);
|
|
|
- reportAreaVO.setAreaId(areaCode);
|
|
|
- reportAreaVO.setAreaName(poemsPartitionVO.getManagePartitionName());
|
|
|
- }
|
|
|
+ public ReportAreaVO getReportAreaInfo(String areaCode, String buildingType) {
|
|
|
+ ReportAreaVO reportAreaVO = getReportAreaBaseInfo(areaCode);
|
|
|
+
|
|
|
+ List<PoemsProjectVO> projectsByAreaAndBuildingType = getProjectsByAreaAndBuildingType(areaCode, buildingType);
|
|
|
|
|
|
- List<PoemsProjectVO> projectVOList = getProjectsByArea(areaCode);
|
|
|
+ ReportAreaVO reportAreaAreaInfo = getReportAreaAreaInfo(projectsByAreaAndBuildingType);
|
|
|
+ reportAreaVO.setUndergroundGarageArea(reportAreaAreaInfo.getUndergroundGarageArea());
|
|
|
+ reportAreaVO.setCommercialArea(reportAreaAreaInfo.getCommercialArea());
|
|
|
+ return reportAreaVO;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取分区的面积信息
|
|
|
+ *
|
|
|
+ * @param projects 分区下要统计的项目
|
|
|
+ * @return 这些项目的面积信息
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/5/31 6:19 下午
|
|
|
+ */
|
|
|
+ private ReportAreaVO getReportAreaAreaInfo(List<PoemsProjectVO> projects) {
|
|
|
+ ReportAreaVO reportAreaVO = new ReportAreaVO();
|
|
|
// 统计分区下总的商业面积,地下停车场面积
|
|
|
BigDecimal totalCommercialArea = new BigDecimal("0");
|
|
|
BigDecimal totalUndergroundGarageArea = new BigDecimal("0");
|
|
|
- if (!CollectionUtils.isEmpty(projectVOList)) {
|
|
|
- for (PoemsProjectVO poemsProjectVO : projectVOList) {
|
|
|
+ if (!CollectionUtils.isEmpty(projects)) {
|
|
|
+ for (PoemsProjectVO poemsProjectVO : projects) {
|
|
|
// 获取项目下建筑的面积总和
|
|
|
ReportProjectVO projectAreas = getProjectAreas(poemsProjectVO.getProjectId());
|
|
|
if (StringUtils.isNotBlank(projectAreas.getCommercialArea())) {
|
|
@@ -142,6 +148,29 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
return reportAreaVO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取区域的基本信息
|
|
|
+ *
|
|
|
+ * @param areaCode 区域编码
|
|
|
+ * @return 区域的基本信息
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/5/31 6:04 下午
|
|
|
+ */
|
|
|
+ private ReportAreaVO getReportAreaBaseInfo(String areaCode) {
|
|
|
+ ReportAreaVO reportAreaVO = new ReportAreaVO();
|
|
|
+ // 查询管理分区信息
|
|
|
+ QueryPartitionDTO queryPartitionDTO = new QueryPartitionDTO();
|
|
|
+ queryPartitionDTO.setManagePartitionIds(Lists.newArrayList(areaCode));
|
|
|
+ PoemsFeignResponse<PoemsPartitionVO> partitionsResponse = saasWebClientWrapper.queryPartitionsByIds(queryPartitionDTO);
|
|
|
+ List<PoemsPartitionVO> partitionVOList = partitionsResponse.getContent();
|
|
|
+ if (!CollectionUtils.isEmpty(partitionVOList)) {
|
|
|
+ PoemsPartitionVO poemsPartitionVO = partitionVOList.get(0);
|
|
|
+ reportAreaVO.setAreaId(areaCode);
|
|
|
+ reportAreaVO.setAreaName(poemsPartitionVO.getManagePartitionName());
|
|
|
+ }
|
|
|
+ return reportAreaVO;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<PoemsProjectVO> getProjectsByArea(String areaCode) {
|
|
|
// 获取管理分区下的项目
|
|
@@ -160,7 +189,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
* @author lixing
|
|
|
* @version V1.0 2021/5/24 6:01 下午
|
|
|
*/
|
|
|
- private List<SimpleProjectVO> getProjectsByAreaAndBuildingType(String areaCode, String buildingType) {
|
|
|
+ private List<PoemsProjectVO> getProjectsByAreaAndBuildingType(String areaCode, String buildingType) {
|
|
|
if (StringUtils.isBlank(areaCode) || StringUtils.isBlank(areaCode)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
@@ -173,11 +202,11 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
if (CollectionUtils.isEmpty(buildingTypes)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
- return projectsByArea.stream().filter(
|
|
|
- poemsProjectVO -> StringUtils.isNotBlank(poemsProjectVO.getFunctionType()) &&
|
|
|
- buildingTypes.contains(poemsProjectVO.getFunctionType())).map(
|
|
|
- ConvertSaasWebTool.INSTANCE::convert2SimpleProjectVO
|
|
|
- ).collect(Collectors.toList());
|
|
|
+ return projectsByArea.stream().
|
|
|
+ filter(
|
|
|
+ poemsProjectVO -> StringUtils.isNotBlank(poemsProjectVO.getFunctionType()) &&
|
|
|
+ buildingTypes.contains(poemsProjectVO.getFunctionType())).
|
|
|
+ collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -501,9 +530,9 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
// 取用户可选项目和分区下项目的交集,projectIds会被更新为两个集合的交集
|
|
|
availableProjectIds.retainAll(projectIds);
|
|
|
// 根据业态和分区过滤项目
|
|
|
- List<SimpleProjectVO> projectsByAreaAndBuildingType = getProjectsByAreaAndBuildingType(partition.getAreaId(), buildingType);
|
|
|
+ List<PoemsProjectVO> projectsByAreaAndBuildingType = getProjectsByAreaAndBuildingType(partition.getAreaId(), buildingType);
|
|
|
Set<String> projectIdsByAreaAndBuildingType = projectsByAreaAndBuildingType.stream().
|
|
|
- map(SimpleProjectVO::getProjectId).collect(Collectors.toSet());
|
|
|
+ map(PoemsProjectVO::getProjectId).collect(Collectors.toSet());
|
|
|
availableProjectIds.retainAll(projectIdsByAreaAndBuildingType);
|
|
|
if (CollectionUtils.isEmpty(projectIds) || projectIdsByAreaAndBuildingType.size() != projectIds.size()) {
|
|
|
continue;
|
|
@@ -555,4 +584,28 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ReportAreaVO getCompareReportAreaInfo(String areaCode, String buildingType, Date reportMonth) {
|
|
|
+ ReportAreaVO reportAreaVO = getReportAreaBaseInfo(areaCode);
|
|
|
+ List<PoemsProjectVO> projectsByAreaAndBuildingType = getProjectsByAreaAndBuildingType(areaCode, buildingType);
|
|
|
+ if (CollectionUtils.isEmpty(projectsByAreaAndBuildingType)) {
|
|
|
+ return reportAreaVO;
|
|
|
+ }
|
|
|
+ List<PoemsProjectVO> comparableProjects = projectsByAreaAndBuildingType.stream().filter(poemsProjectVO -> {
|
|
|
+ String businessOpeningTime = poemsProjectVO.getBusinessOpeningTime();
|
|
|
+ try {
|
|
|
+ Date openDate = DateUtils.str2Date(businessOpeningTime, DateUtils.SDFSECOND);
|
|
|
+ Date firstDayOfLastYear = DateUtils.getFirstDayOfLastYear(reportMonth);
|
|
|
+ // 如果开业时间早于去年,添加到结果集
|
|
|
+ return DateUtils.compareDate(openDate, firstDayOfLastYear);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("时间转换异常", e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ ReportAreaVO reportAreaAreaInfo = getReportAreaAreaInfo(comparableProjects);
|
|
|
+ reportAreaVO.setUndergroundGarageArea(reportAreaAreaInfo.getUndergroundGarageArea());
|
|
|
+ reportAreaVO.setCommercialArea(reportAreaAreaInfo.getCommercialArea());
|
|
|
+ return reportAreaVO;
|
|
|
+ }
|
|
|
}
|