|
@@ -1,22 +1,33 @@
|
|
|
package com.persagy.apm.energy.report.monthly.outline.service.builder.hotel.impl;
|
|
|
|
|
|
+import com.persagy.apm.common.context.poems.PoemsContext;
|
|
|
+import com.persagy.apm.energy.report.common.service.CommonService;
|
|
|
+import com.persagy.apm.energy.report.monthly.config.function.model.Function;
|
|
|
+import com.persagy.apm.energy.report.monthly.config.function.model.dto.QueryFunctionDTO;
|
|
|
+import com.persagy.apm.energy.report.monthly.config.function.service.IFunctionService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.dto.AddReportHotelProjectDetailDTO;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.*;
|
|
|
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportCostService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportPowerInfoOutlineService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportPublicPowerInfoService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IReportHotelProjectDetailService;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.constants.HotelReportParagraphs;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
|
|
|
-import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportCostService;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.service.builder.common.impl.ReportBuilder;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.service.builder.hotel.IHotelProjectReportBuilder;
|
|
|
+import com.persagy.apm.energy.report.saasweb.model.vo.PoemsProjectVO;
|
|
|
+import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 酒店项目报告建造者
|
|
@@ -35,6 +46,14 @@ public class HotelProjectReportBuilder extends ReportBuilder implements IHotelPr
|
|
|
private IHotelProjectReportPublicPowerInfoService publicPowerInfoService;
|
|
|
@Autowired
|
|
|
private IHotelProjectReportPowerInfoOutlineService powerInfoOutlineService;
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+ @Autowired
|
|
|
+ private ISaasWebService saasWebService;
|
|
|
+ @Autowired
|
|
|
+ private IReportOutlineService reportOutlineService;
|
|
|
+ @Autowired
|
|
|
+ private IFunctionService functionService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -70,14 +89,31 @@ public class HotelProjectReportBuilder extends ReportBuilder implements IHotelPr
|
|
|
|
|
|
@Override
|
|
|
public HotelProjectAlarmDealInfo getAlarmDealInfo(ReportOutline reportOutline) {
|
|
|
- // TODO: 2021/6/9
|
|
|
- return null;
|
|
|
+ return commonService.getHotelProjectAlarmDealInfo(reportOutline.getBelong(), reportOutline.getReportMonth());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public HotelProjectMaintenanceInfo getMaintenanceInfo(ReportOutline reportOutline) {
|
|
|
- // TODO: 2021/6/9
|
|
|
- return null;
|
|
|
+ List<String> functionIdList = getFunctionsByParagraph(
|
|
|
+ reportOutline.getReportTypeId(), HotelReportParagraphs.MAINTENANCE);
|
|
|
+ if (CollectionUtils.isEmpty(functionIdList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询同气候区下的项目
|
|
|
+ String projectId = reportOutline.getBelong();
|
|
|
+ String buildingType = reportOutlineService.getBuildingType(reportOutline);
|
|
|
+ List<String> projectIdsInSameClimateZone = getProjectIdsInSameClimateZone(projectId, buildingType);
|
|
|
+ // 查询段落下的功能点
|
|
|
+ QueryFunctionDTO queryFunctionDTO = new QueryFunctionDTO();
|
|
|
+ queryFunctionDTO.setFunctionIdList(functionIdList);
|
|
|
+ List<Function> functions = functionService.queryFunctionList(queryFunctionDTO);
|
|
|
+ // 获取平台运维信息
|
|
|
+ return commonService.getHotelProjectMaintenanceInfo(
|
|
|
+ PoemsContext.getContext().getUserId(), reportOutline.getBelong(),
|
|
|
+ reportOutline.getReportMonth(), functions, projectIdsInSameClimateZone
|
|
|
+ );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -88,7 +124,50 @@ public class HotelProjectReportBuilder extends ReportBuilder implements IHotelPr
|
|
|
|
|
|
@Override
|
|
|
public HotelProjectEnvKpi getEnvKpi(ReportOutline reportOutline) {
|
|
|
- // TODO: 2021/6/9
|
|
|
+ List<String> functionIdList = getFunctionsByParagraph(
|
|
|
+ reportOutline.getReportTypeId(), HotelReportParagraphs.ENV_KPI);
|
|
|
+ if (CollectionUtils.isEmpty(functionIdList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ HotelProjectEnvKpi hotelProjectEnvKpi = new HotelProjectEnvKpi();
|
|
|
+
|
|
|
+ String projectId = reportOutline.getBelong();
|
|
|
+ String buildingType = reportOutlineService.getBuildingType(reportOutline);
|
|
|
+ List<String> projectIdsInClimateZone = getProjectIdsInSameClimateZone(projectId, buildingType);
|
|
|
+ List<HotelProjectKpiItem> kpiItems = new ArrayList<>();
|
|
|
+
|
|
|
+ for (String functionId : functionIdList) {
|
|
|
+ HotelProjectKpiItem hotelProjectKpiItem = commonService.getHotelProjectKpiItem(
|
|
|
+ projectId, reportOutline.getReportMonth(),
|
|
|
+ projectIdsInClimateZone, functionService.queryFunctionDetail(functionId));
|
|
|
+ kpiItems.add(hotelProjectKpiItem);
|
|
|
+ }
|
|
|
+ hotelProjectEnvKpi.setEnvKpiItems(kpiItems);
|
|
|
+
|
|
|
+ return hotelProjectEnvKpi;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取同气候区,同业态的项目id列表
|
|
|
+ *
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @param buildingType 业态类型
|
|
|
+ * @return 项目id列表
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/6/10 7:13 下午
|
|
|
+ */
|
|
|
+ private List<String> getProjectIdsInSameClimateZone(String projectId, String buildingType) {
|
|
|
+ // 获取项目所在气候区
|
|
|
+ String projectClimateZone = saasWebService.getProjectClimateZone(projectId);
|
|
|
+ // 根据气候区获取项目
|
|
|
+ List<PoemsProjectVO> projectsInClimateZone = saasWebService.getProjectsByClimateAndBuildingType(
|
|
|
+ projectClimateZone, buildingType);
|
|
|
+ if (!CollectionUtils.isEmpty(projectsInClimateZone)) {
|
|
|
+ return projectsInClimateZone.stream().
|
|
|
+ map(PoemsProjectVO::getProjectId).
|
|
|
+ collect(Collectors.toList());
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|