瀏覽代碼

生成酒店报告代码提交

lixing 3 年之前
父節點
當前提交
628313da63
共有 25 個文件被更改,包括 868 次插入415 次删除
  1. 3 95
      src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/IBusinessReportPowerInfoService.java
  2. 3 30
      src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/impl/BusinessReportCostInfoServiceImpl.java
  3. 6 236
      src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/impl/BusinessReportPowerInfoServiceImpl.java
  4. 23 2
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/model/vo/PowerItemVO.java
  5. 16 2
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/IReportCostInfoService.java
  6. 126 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/IReportPowerInfoService.java
  7. 35 5
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/impl/ReportCostInfoServiceImpl.java
  8. 303 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/impl/ReportPowerInfoServiceImpl.java
  9. 23 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/ConvertReportHotelProjectDetailTool.java
  10. 4 2
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPowerConsumptionOutline.java
  11. 7 7
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPublicPowerConsumption.java
  12. 27 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/IHotelProjectReportPowerInfoOutlineService.java
  13. 29 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/IHotelProjectReportPublicPowerInfoService.java
  14. 2 22
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportCostServiceImpl.java
  15. 83 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportPowerInfoOutlineServiceImpl.java
  16. 99 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportPublicPowerInfoServiceImpl.java
  17. 0 2
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/business/impl/BusinessReportBuilder.java
  18. 0 1
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/IHotelAreaReportBuilder.java
  19. 0 2
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/impl/HotelAreaReportBuilder.java
  20. 14 7
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/impl/HotelProjectReportBuilder.java
  21. 2 0
      src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/BuildingInfoVO.java
  22. 2 0
      src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/ReportProjectVO.java
  23. 2 0
      src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/SimpleProjectVO.java
  24. 21 1
      src/main/java/com/persagy/apm/energy/report/saasweb/service/ISaasWebService.java
  25. 38 1
      src/main/java/com/persagy/apm/energy/report/saasweb/service/impl/SaasWebServiceImpl.java

+ 3 - 95
src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/IBusinessReportPowerInfoService.java

@@ -4,6 +4,7 @@ import com.persagy.apm.energy.report.monthly.config.function.model.Function;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
+import com.persagy.apm.energy.report.monthly.detail.common.service.IReportPowerInfoService;
 import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
 
 import java.util.Date;
@@ -12,104 +13,11 @@ import java.util.Map;
 import java.util.TreeMap;
 
 /**
- * 接口说明
+ * 商业报告用电量信息服务接口
  *
  * @author lixing
  * @version V1.0 2021/5/30 10:25 下午
  **/
-public interface IBusinessReportPowerInfoService {
-    /**
-     * 获取项目用电量
-     *
-     * @param reportOutline  报告outline对象
-     * @param groupIdList    用电量信息点分组列表
-     * @param functionIdList 用电量信息点列表
-     * @return 项目用电量
-     * @author lixing
-     * @version V1.0 2021/5/24 4:14 下午
-     */
-    PowerVO getPowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList);
+public interface IBusinessReportPowerInfoService extends IReportPowerInfoService {
 
-    /**
-     * 获取可同比项目用电量
-     *
-     * @param reportOutline  报告outline对象
-     * @param groupIdList    用电量信息点分组列表
-     * @param functionIdList 用电量信息点列表
-     * @return 项目用电量
-     * @author lixing
-     * @version V1.0 2021/5/24 4:14 下午
-     */
-    PowerVO getComparePowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList);
-
-    /**
-     * 获取用电量条目信息
-     *
-     * @param functionIdList 用电量条目列表
-     * @param reportMonth    报告月份
-     * @return 用电量条目列表
-     * @author lixing
-     * @version V1.0 2021/5/24 7:15 下午
-     */
-    List<PowerItemVO> getPowerItemInfos(List<String> functionIdList, Date reportMonth, List<String> projectIds);
-
-    /**
-     * 获取一组项目一个功能点的用电量信息
-     *
-     * @param reportMonth 报告月份
-     * @param projectIds  一组项目id
-     * @param function    功能点(条目)
-     * @return 一组项目一个功能点的用电量信息
-     * @author lixing
-     * @version V1.0 2021/5/30 5:55 下午
-     */
-    List<PowerItemVO> getPowerItemsByProjects(Date reportMonth, List<String> projectIds, Function function);
-
-    /**
-     * 获取一个条目的用电量信息
-     *
-     * @param reportMonth       报告月份
-     * @param reportProjectInfo 报告项目信息
-     * @param dateValueMap      日期 -> 用电量
-     * @return 用电量对象
-     * @author lixing
-     * @version V1.0 2021/5/30 5:54 下午
-     */
-    PowerItemVO getPowerItemInfo(Date reportMonth, Double reportProjectInfo, TreeMap<Date, Double> dateValueMap);
-
-    /**
-     * 获取条目能耗值map
-     *
-     * @param reportMonth    报告月份
-     * @param itemId         条目id
-     * @param modelCode      模型编码
-     * @param projectLocalId 项目本地编码
-     * @return 分项每月能耗信息{分项id:{时间(Date):数据(Double)}
-     * @author lixing
-     * @version V1.0 2021/5/30 11:39 上午
-     */
-    Map<String, TreeMap<Date, Double>> getItemEnergyDataMap(
-            Date reportMonth, String itemId, String modelCode, String projectLocalId);
-
-    /**
-     * 求一组用电量条目的统计值
-     *
-     * @param powerItems 一组用电量条目
-     * @return 一个新的用电量条目对象,将统计值属性赋值给它
-     * @author lixing
-     * @version V1.0 2021/5/30 10:46 上午
-     */
-    PowerItemVO getPowerSum(List<PowerItemVO> powerItems);
-
-    /**
-     * 获取用电量分组信息
-     *
-     * @param groupIdList 分组id列表
-     * @param reportMonth 报告月份
-     * @param projectIds  报告涉及的项目id列表
-     * @return 分组对象列表
-     * @author lixing
-     * @version V1.0 2021/5/24 7:12 下午
-     */
-    List<GroupInfo<PowerItemVO>> getPowerGroupInfos(List<String> groupIdList, Date reportMonth, List<String> projectIds);
 }

+ 3 - 30
src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/impl/BusinessReportCostInfoServiceImpl.java

@@ -53,35 +53,8 @@ public class BusinessReportCostInfoServiceImpl extends ReportCostInfoServiceImpl
         return getCostInfoByProjectIds(groupIdList, functionIdList, reportMonth, comparableProjects);
     }
 
-    /**
-     * 根据项目id获取费用信息
-     *
-     * @param groupIdList    费用信息点分组列表
-     * @param functionIdList 费用信息点列表
-     * @param reportMonth    报告月份
-     * @param projectIds     项目id列表
-     * @return 费用信息
-     * @author lixing
-     * @version V1.0 2021/5/30 11:41 下午
-     */
-    private CostVO getCostInfoByProjectIds(List<String> groupIdList, List<String> functionIdList, Date reportMonth, List<String> projectIds) {
-        CostVO costVO = new CostVO();
-        List<GroupInfo<CostItemVO>> costGroupInfos = getCostGroupInfos(groupIdList, reportMonth, projectIds);
-        costVO.setGroups(costGroupInfos);
-
-        List<CostItemVO> costItemInfos = getCostItemInfos(functionIdList, reportMonth, projectIds);
-        costVO.setItems(costItemInfos);
-
-        List<CostItemVO> paragraphSums = new ArrayList<>();
-
-        if (!CollectionUtils.isEmpty(costGroupInfos)) {
-            paragraphSums.addAll(
-                    costGroupInfos.stream().map(GroupInfo::getSummary).collect(Collectors.toList()));
-        }
-        if (!CollectionUtils.isEmpty(costItemInfos)) {
-            paragraphSums.addAll(costItemInfos);
-        }
-        costVO.setSummary(getCostSum(paragraphSums));
-        return costVO;
+    @Override
+    public Double getProjectBuildingArea(List<String> projectIds) {
+        return saasWebService.getTotalCommercialArea(projectIds);
     }
 }

+ 6 - 236
src/main/java/com/persagy/apm/energy/report/monthly/detail/business/service/impl/BusinessReportPowerInfoServiceImpl.java

@@ -1,29 +1,12 @@
 package com.persagy.apm.energy.report.monthly.detail.business.service.impl;
 
-import com.persagy.apm.energy.report.centermiddleware.constant.enums.TimeTypeEnum;
-import com.persagy.apm.energy.report.centermiddleware.model.dto.QueryEnergyDataDTO;
-import com.persagy.apm.energy.report.centermiddleware.service.ICenterMiddlewareWebService;
-import com.persagy.apm.energy.report.common.utils.DataUtils;
-import com.persagy.apm.energy.report.common.utils.DateUtils;
-import com.persagy.apm.energy.report.monthly.config.function.model.Function;
-import com.persagy.apm.energy.report.monthly.config.function.service.IFunctionService;
-import com.persagy.apm.energy.report.monthly.config.functiongroup.model.FunctionGroup;
-import com.persagy.apm.energy.report.monthly.config.functiongroup.service.IFunctionGroupService;
-import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
-import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
-import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
-import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
 import com.persagy.apm.energy.report.monthly.detail.business.service.IBusinessReportPowerInfoService;
-import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
-import com.persagy.apm.energy.report.saasweb.model.vo.ReportProjectVO;
+import com.persagy.apm.energy.report.monthly.detail.common.service.impl.ReportPowerInfoServiceImpl;
 import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
-import org.assertj.core.util.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.List;
 
 /**
  * 商业类报告用电量service类
@@ -32,226 +15,13 @@ import java.util.stream.Collectors;
  * @version V1.0 2021/5/30 7:30 下午
  **/
 @Service
-public class BusinessReportPowerInfoServiceImpl implements IBusinessReportPowerInfoService {
-    @Autowired
-    private IReportOutlineService reportOutlineService;
-    @Autowired
-    private IFunctionGroupService functionGroupService;
-    @Autowired
-    private IFunctionService functionService;
-    @Autowired
-    private ICenterMiddlewareWebService centerMiddlewareWebService;
+public class BusinessReportPowerInfoServiceImpl extends ReportPowerInfoServiceImpl
+        implements IBusinessReportPowerInfoService {
     @Autowired
     private ISaasWebService saasWebService;
 
     @Override
-    public PowerVO getPowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList) {
-        Date reportMonth = reportOutline.getReportMonth();
-
-        List<String> projectIds = reportOutlineService.queryRelatedProjectIds(reportOutline);
-
-        return getPowerInfoByProjectIds(groupIdList, functionIdList, reportMonth, projectIds);
-    }
-
-    @Override
-    public PowerVO getComparePowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList) {
-        Date reportMonth = reportOutline.getReportMonth();
-
-        List<String> projectIds = reportOutlineService.queryRelatedProjectIds(reportOutline);
-
-        List<String> comparableProjects = saasWebService.getComparableProjects(projectIds, reportMonth);
-
-        return getPowerInfoByProjectIds(groupIdList, functionIdList, reportMonth, comparableProjects);
-    }
-
-    /**
-     * 根据项目id获取用电信息
-     *
-     * @param groupIdList    费用信息点分组列表
-     * @param functionIdList 费用信息点列表
-     * @param reportMonth    报告月份
-     * @param projectIds     项目id列表
-     * @return 用电信息
-     * @author lixing
-     * @version V1.0 2021/5/30 11:41 下午
-     */
-    private PowerVO getPowerInfoByProjectIds(
-            List<String> groupIdList, List<String> functionIdList,
-            Date reportMonth, List<String> projectIds) {
-        PowerVO powerVO = new PowerVO();
-        List<GroupInfo<PowerItemVO>> powerGroupInfos = getPowerGroupInfos(groupIdList, reportMonth, projectIds);
-        powerVO.setGroups(powerGroupInfos);
-
-        List<PowerItemVO> powerItemInfos = getPowerItemInfos(functionIdList, reportMonth, projectIds);
-        powerVO.setItems(powerItemInfos);
-
-        List<PowerItemVO> paragraphSums = new ArrayList<>();
-
-        if (!CollectionUtils.isEmpty(powerGroupInfos)) {
-            paragraphSums.addAll(
-                    powerGroupInfos.stream().map(GroupInfo::getSummary).collect(Collectors.toList()));
-        }
-        if (!CollectionUtils.isEmpty(powerItemInfos)) {
-            paragraphSums.addAll(powerItemInfos);
-        }
-        powerVO.setSummary(getPowerSum(paragraphSums));
-        return powerVO;
-    }
-
-    @Override
-    public List<PowerItemVO> getPowerItemInfos(List<String> functionIdList, Date reportMonth, List<String> projectIds) {
-        List<PowerItemVO> powerItemVOList = Lists.newArrayList();
-        if (CollectionUtils.isEmpty(functionIdList) || CollectionUtils.isEmpty(projectIds)) {
-            return powerItemVOList;
-        }
-
-        for (String functionId : functionIdList) {
-            Function function = functionService.queryFunctionDetail(functionId);
-            String itemName = functionService.getItemName(function, projectIds.get(0));
-
-            List<PowerItemVO> projectPowerItems = getPowerItemsByProjects(reportMonth, projectIds, function);
-            PowerItemVO powerSumByProjects = getPowerSum(projectPowerItems);
-            powerSumByProjects.setName(itemName);
-            powerItemVOList.add(powerSumByProjects);
-        }
-        return powerItemVOList;
-    }
-
-    @Override
-    public List<PowerItemVO> getPowerItemsByProjects(Date reportMonth, List<String> projectIds, Function function) {
-        List<PowerItemVO> projectPowerItems = Lists.newArrayList();
-        if (CollectionUtils.isEmpty(projectIds)) {
-            return projectPowerItems;
-        }
-
-        // 统计项目总的商业面积
-        Double totalCommercialArea = saasWebService.getTotalCommercialArea(projectIds);
-
-        for (String projectId : projectIds) {
-            // 获取项目信息
-            ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
-            if (reportProjectInfo == null) {
-                continue;
-            }
-            Map<String, TreeMap<Date, Double>> itemEnergyDataMap = getItemEnergyDataMap(
-                    reportMonth, function.getItemId(), function.getModelCode(), reportProjectInfo.getProjectLocalID());
-            TreeMap<Date, Double> dateValueMap = itemEnergyDataMap.get(function.getItemId());
-            if (dateValueMap != null) {
-                PowerItemVO powerItemInfo = getPowerItemInfo(reportMonth, totalCommercialArea, dateValueMap);
-                projectPowerItems.add(powerItemInfo);
-            }
-        }
-        return projectPowerItems;
-    }
-
-    @Override
-    public PowerItemVO getPowerItemInfo(Date reportMonth, Double totalCommercialArea, TreeMap<Date, Double> dateValueMap) {
-        PowerItemVO powerItemVO = new PowerItemVO();
-        Double currentMonth = dateValueMap.get(reportMonth);
-        powerItemVO.setCurrentMonth(currentMonth);
-        Double lastMonth = dateValueMap.get(DateUtils.getFirstDayOfLastMonth(reportMonth));
-        powerItemVO.setLastMonth(lastMonth);
-
-        // 统计去年同期的用电量
-        Double lastYearCount = null;
-        List<Date> lastYearMonths = DateUtils.getFirstDayOfEveryMonth(
-                DateUtils.getFirstDayOfLastYear(reportMonth),
-                DateUtils.getSameMonthFirstDayOfLastYear(reportMonth));
-        List<PowerItemVO> lastYearItems = new ArrayList<>();
-        for (Date lastYearMonth : lastYearMonths) {
-            PowerItemVO tmp = new PowerItemVO();
-            tmp.setLastYearCount(dateValueMap.get(lastYearMonth));
-            lastYearItems.add(tmp);
-        }
-        Double zero = 0d;
-        PowerItemVO lastYearSumItem = getPowerSum(lastYearItems);
-        if (lastYearSumItem != null) {
-            lastYearCount = lastYearSumItem.getLastYearCount();
-            powerItemVO.setLastYearCount(lastYearCount);
-            if (totalCommercialArea != null && !totalCommercialArea.equals(zero) && lastYearCount != null) {
-                powerItemVO.setLastYearPerCount(DataUtils.doubleDivide(lastYearCount, totalCommercialArea));
-            }
-        }
-
-        // 统计今年的用电量
-        Double yearCount = null;
-        List<Date> yearMonths = DateUtils.getFirstDayOfEveryMonth(
-                DateUtils.getFirstDayOfYear(reportMonth),
-                reportMonth);
-        List<PowerItemVO> yearItems = new ArrayList<>();
-        for (Date yearMonth : yearMonths) {
-            PowerItemVO tmp = new PowerItemVO();
-            tmp.setYearCount(dateValueMap.get(yearMonth));
-            yearItems.add(tmp);
-        }
-
-        PowerItemVO yearSumItem = getPowerSum(yearItems);
-        if (yearSumItem != null) {
-            yearCount = yearSumItem.getYearCount();
-            powerItemVO.setYearCount(yearCount);
-            if (totalCommercialArea != null && !totalCommercialArea.equals(zero) && yearCount != null) {
-                powerItemVO.setYearPerCount(DataUtils.doubleDivide(yearCount, totalCommercialArea));
-            }
-        }
-
-        if (currentMonth != null && lastMonth != null) {
-            Double linkCount = DataUtils.doubleSubtract(currentMonth, lastMonth);
-            Double linkRange = DataUtils.doubleDivide(linkCount, lastMonth);
-            powerItemVO.setLinkCount(linkCount);
-            powerItemVO.setLinkRange(linkRange);
-        }
-
-        if (lastYearCount != null && yearCount != null) {
-            double sameCount = DataUtils.doubleSubtract(yearCount, lastYearCount);
-            powerItemVO.setSameCount(sameCount);
-            powerItemVO.setSameRange(DataUtils.doubleDivide(sameCount, lastYearCount));
-        }
-        return powerItemVO;
+    public Double getProjectBuildingArea(List<String> projectIds) {
+        return saasWebService.getTotalCommercialArea(projectIds);
     }
-
-    @Override
-    public Map<String, TreeMap<Date, Double>> getItemEnergyDataMap(
-            Date reportMonth, String itemId, String modelCode, String projectLocalId) {
-        QueryEnergyDataDTO queryEnergyDataDTO = new QueryEnergyDataDTO();
-        queryEnergyDataDTO.setProjectId(projectLocalId);
-        queryEnergyDataDTO.setBuildingId(projectLocalId);
-        queryEnergyDataDTO.setModelCode(modelCode);
-        // 去年一月
-        queryEnergyDataDTO.setStartDate(DateUtils.date2Str(
-                DateUtils.getFirstDayOfLastYear(reportMonth), DateUtils.SDF_SECOND));
-        // 结束时间往后延一个月,中间件时间查询为左闭右开
-        queryEnergyDataDTO.setEndDate(DateUtils.date2Str(DateUtils.getMonthOff(reportMonth, 1), DateUtils.SDF_SECOND));
-        queryEnergyDataDTO.setItemIdList(Lists.newArrayList(itemId));
-        queryEnergyDataDTO.setTimeType(TimeTypeEnum.MONTH.getType());
-        return centerMiddlewareWebService.getItemEnergyDataMap(queryEnergyDataDTO);
-    }
-
-    @Override
-    public PowerItemVO getPowerSum(List<PowerItemVO> powerItems) {
-        return DataUtils.sumDoubleParams(powerItems, PowerItemVO.class);
-    }
-
-    @Override
-    public List<GroupInfo<PowerItemVO>> getPowerGroupInfos(List<String> groupIdList, Date reportMonth, List<String> projectIds) {
-        List<GroupInfo<PowerItemVO>> groupInfoList = Lists.newArrayList();
-        if (CollectionUtils.isEmpty(groupIdList)) {
-            return groupInfoList;
-        }
-        for (String groupId : groupIdList) {
-            GroupInfo<PowerItemVO> groupInfo = new GroupInfo<>();
-            FunctionGroup functionGroup = functionGroupService.queryFunctionGroupDetail(groupId);
-            groupInfo.setGroupName(functionGroup.getName());
-            // 获取组下的分组(本期不做)
-            // 获取组下的分项
-            String functionIdStr = functionGroup.getFunctionIds();
-            List<String> functionIds = Lists.newArrayList(functionIdStr.split(","));
-            List<PowerItemVO> powerItemInfos = getPowerItemInfos(functionIds, reportMonth, projectIds);
-            groupInfo.setItems(powerItemInfos);
-            groupInfo.setSummary(getPowerSum(powerItemInfos));
-            groupInfoList.add(groupInfo);
-        }
-        return groupInfoList;
-    }
-
-
 }

+ 23 - 2
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/model/vo/PowerItemVO.java

@@ -22,6 +22,9 @@ public class PowerItemVO {
     @ApiModelProperty("上月用电量")
     public Double lastMonth;
 
+    @ApiModelProperty("去年同期月用电量")
+    public Double lastYearSameTime;
+
     @ApiModelProperty("本年度累计用电量")
     public Double yearCount;
 
@@ -34,10 +37,10 @@ public class PowerItemVO {
     @ApiModelProperty("环比增幅")
     public Double linkRange;
 
-    @ApiModelProperty("同比增量")
+    @ApiModelProperty("年累计同比增量")
     public Double sameCount;
 
-    @ApiModelProperty("同比增幅")
+    @ApiModelProperty("年累计同比增幅")
     public Double sameRange;
 
     @ApiModelProperty("本年单方用电量")
@@ -46,4 +49,22 @@ public class PowerItemVO {
     @ApiModelProperty("去年单方用电量")
     public Double lastYearPerCount;
 
+    @ApiModelProperty("本月单方用电量")
+    public Double currentMonthPerSqm;
+
+    @ApiModelProperty("去年同期月单方用电量")
+    public Double lastYearSameTimePerSqm;
+
+    @ApiModelProperty("去年同期用电量增量")
+    public Double sameTimeGrowth;
+
+    @ApiModelProperty("去年同期用电量增幅")
+    public Double sameTimeRange;
+
+    @ApiModelProperty("同期月单方用电量增量")
+    public Double sameTimeGrowthPerSqm;
+
+    @ApiModelProperty("同期月单方用电量增幅")
+    public Double sameTimeRangePerSqm;
+
 }

+ 16 - 2
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/IReportCostInfoService.java

@@ -2,19 +2,33 @@ package com.persagy.apm.energy.report.monthly.detail.common.service;
 
 import com.persagy.apm.energy.report.monthly.config.function.model.Function;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostVO;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
 
 import java.util.Date;
 import java.util.List;
 
 /**
- * 商业报告费用信息service接口
+ * 报告费用信息service接口
  *
  * @author lixing
  * @version V1.0 2021/5/30 10:26 下午
  **/
 public interface IReportCostInfoService {
     /**
+     * 根据项目id获取费用信息
+     *
+     * @param groupIdList    费用信息点分组列表
+     * @param functionIdList 费用信息点列表
+     * @param reportMonth    报告月份
+     * @param projectIds     项目id列表
+     * @return 费用信息
+     * @author lixing
+     * @version V1.0 2021/5/30 11:41 下午
+     */
+    CostVO getCostInfoByProjectIds(List<String> groupIdList, List<String> functionIdList, Date reportMonth, List<String> projectIds);
+
+    /**
      * 获取费用条目信息
      *
      * @param functionIdList 费用条目列表
@@ -46,7 +60,7 @@ public interface IReportCostInfoService {
      * @author lixing
      * @version V1.0 2021/6/9 7:51 下午
      */
-    Double getProjectCostBuildingArea(List<String> projectIds);
+    Double getProjectBuildingArea(List<String> projectIds);
 
     /**
      * 获取一个条目的费用信息

+ 126 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/IReportPowerInfoService.java

@@ -0,0 +1,126 @@
+package com.persagy.apm.energy.report.monthly.detail.common.service;
+
+import com.persagy.apm.energy.report.monthly.config.function.model.Function;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * 报告用电量信息服务接口
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 10:25 下午
+ **/
+public interface IReportPowerInfoService {
+    /**
+     * 获取项目用电量
+     *
+     * @param reportOutline  报告outline对象
+     * @param groupIdList    用电量信息点分组列表
+     * @param functionIdList 用电量信息点列表
+     * @return 项目用电量
+     * @author lixing
+     * @version V1.0 2021/5/24 4:14 下午
+     */
+    PowerVO getPowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList);
+
+    /**
+     * 获取可同比项目用电量
+     *
+     * @param reportOutline  报告outline对象
+     * @param groupIdList    用电量信息点分组列表
+     * @param functionIdList 用电量信息点列表
+     * @return 项目用电量
+     * @author lixing
+     * @version V1.0 2021/5/24 4:14 下午
+     */
+    PowerVO getComparePowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList);
+
+    /**
+     * 获取用电量条目信息
+     *
+     * @param functionIdList 用电量条目列表
+     * @param reportMonth    报告月份
+     * @param projectIds     项目id列表
+     * @return 用电量条目列表
+     * @author lixing
+     * @version V1.0 2021/5/24 7:15 下午
+     */
+    List<PowerItemVO> getPowerItemInfos(List<String> functionIdList, Date reportMonth, List<String> projectIds);
+
+    /**
+     * 获取一组项目一个功能点的用电量信息
+     *
+     * @param reportMonth 报告月份
+     * @param projectIds  一组项目id
+     * @param function    功能点(条目)
+     * @return 一组项目一个功能点的用电量信息
+     * @author lixing
+     * @version V1.0 2021/5/30 5:55 下午
+     */
+    List<PowerItemVO> getPowerItemsByProjects(Date reportMonth, List<String> projectIds, Function function);
+
+    /**
+     * 获取一个条目的用电量信息
+     *
+     * @param reportMonth       报告月份
+     * @param reportProjectInfo 报告项目信息
+     * @param dateValueMap      日期 -> 用电量
+     * @return 用电量对象
+     * @author lixing
+     * @version V1.0 2021/5/30 5:54 下午
+     */
+    PowerItemVO getPowerItemInfo(Date reportMonth, Double reportProjectInfo, TreeMap<Date, Double> dateValueMap);
+
+    /**
+     * 获取条目能耗值map
+     *
+     * @param reportMonth    报告月份
+     * @param itemId         条目id
+     * @param modelCode      模型编码
+     * @param projectLocalId 项目本地编码
+     * @return 分项每月能耗信息{分项id:{时间(Date):数据(Double)}
+     * @author lixing
+     * @version V1.0 2021/5/30 11:39 上午
+     */
+    Map<String, TreeMap<Date, Double>> getItemEnergyDataMap(
+            Date reportMonth, String itemId, String modelCode, String projectLocalId);
+
+    /**
+     * 求一组用电量条目的统计值
+     *
+     * @param powerItems 一组用电量条目
+     * @return 一个新的用电量条目对象,将统计值属性赋值给它
+     * @author lixing
+     * @version V1.0 2021/5/30 10:46 上午
+     */
+    PowerItemVO getPowerSum(List<PowerItemVO> powerItems);
+
+    /**
+     * 获取用电量分组信息
+     *
+     * @param groupIdList 分组id列表
+     * @param reportMonth 报告月份
+     * @param projectIds  报告涉及的项目id列表
+     * @return 分组对象列表
+     * @author lixing
+     * @version V1.0 2021/5/24 7:12 下午
+     */
+    List<GroupInfo<PowerItemVO>> getPowerGroupInfos(List<String> groupIdList, Date reportMonth, List<String> projectIds);
+
+    /**
+     * 获取统计费用需要使用的项目面积
+     *
+     * @param projectIds 需要统计的项目的id列表
+     * @return 统计费用需要使用的项目面积
+     * @author lixing
+     * @version V1.0 2021/6/9 7:51 下午
+     */
+    Double getProjectBuildingArea(List<String> projectIds);
+}

+ 35 - 5
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/impl/ReportCostInfoServiceImpl.java

@@ -8,6 +8,7 @@ import com.persagy.apm.energy.report.monthly.config.function.service.IFunctionSe
 import com.persagy.apm.energy.report.monthly.config.functiongroup.model.FunctionGroup;
 import com.persagy.apm.energy.report.monthly.config.functiongroup.service.IFunctionGroupService;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostVO;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
 import com.persagy.apm.energy.report.monthly.detail.common.service.IReportCostInfoService;
 import com.persagy.apm.energy.report.monthly.functionvalue.service.IFunctionValueService;
@@ -21,6 +22,7 @@ import org.springframework.util.CollectionUtils;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 商业类报告费用service类
@@ -29,7 +31,7 @@ import java.util.List;
  * @version V1.0 2021/5/30 7:30 下午
  **/
 @Service
-public class ReportCostInfoServiceImpl implements IReportCostInfoService {
+public abstract class ReportCostInfoServiceImpl implements IReportCostInfoService {
     @Autowired
     private IFunctionGroupService functionGroupService;
     @Autowired
@@ -40,6 +42,28 @@ public class ReportCostInfoServiceImpl implements IReportCostInfoService {
     private ISaasWebService saasWebService;
 
     @Override
+    public CostVO getCostInfoByProjectIds(List<String> groupIdList, List<String> functionIdList, Date reportMonth, List<String> projectIds) {
+        CostVO costVO = new CostVO();
+        List<GroupInfo<CostItemVO>> costGroupInfos = getCostGroupInfos(groupIdList, reportMonth, projectIds);
+        costVO.setGroups(costGroupInfos);
+
+        List<CostItemVO> costItemInfos = getCostItemInfos(functionIdList, reportMonth, projectIds);
+        costVO.setItems(costItemInfos);
+
+        List<CostItemVO> paragraphSums = new ArrayList<>();
+
+        if (!CollectionUtils.isEmpty(costGroupInfos)) {
+            paragraphSums.addAll(
+                    costGroupInfos.stream().map(GroupInfo::getSummary).collect(Collectors.toList()));
+        }
+        if (!CollectionUtils.isEmpty(costItemInfos)) {
+            paragraphSums.addAll(costItemInfos);
+        }
+        costVO.setSummary(getCostSum(paragraphSums));
+        return costVO;
+    }
+
+    @Override
     public List<CostItemVO> getCostItemInfos(List<String> functionIdList, Date reportMonth, List<String> projectIds) {
         List<CostItemVO> costItemVOList = Lists.newArrayList();
         if (CollectionUtils.isEmpty(functionIdList) || CollectionUtils.isEmpty(projectIds)) {
@@ -66,7 +90,7 @@ public class ReportCostInfoServiceImpl implements IReportCostInfoService {
         }
 
         // 统计项目总的商业面积
-        Double projectCostBuildingArea = getProjectCostBuildingArea(projectIds);
+        Double projectCostBuildingArea = getProjectBuildingArea(projectIds);
 
         for (String projectId : projectIds) {
             // 获取项目信息
@@ -80,10 +104,16 @@ public class ReportCostInfoServiceImpl implements IReportCostInfoService {
         return projectCostItems;
     }
 
+    /**
+     * 获取统计费用需要使用的项目面积
+     *
+     * @param projectIds 需要统计的项目的id列表
+     * @return 统计费用需要使用的项目面积
+     * @author lixing
+     * @version V1.0 2021/6/9 7:51 下午
+     */
     @Override
-    public Double getProjectCostBuildingArea(List<String> projectIds) {
-        return saasWebService.getTotalCommercialArea(projectIds);
-    }
+    public abstract Double getProjectBuildingArea(List<String> projectIds);
 
     @Override
     public CostItemVO getCostItemInfo(

+ 303 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/service/impl/ReportPowerInfoServiceImpl.java

@@ -0,0 +1,303 @@
+package com.persagy.apm.energy.report.monthly.detail.common.service.impl;
+
+import com.persagy.apm.energy.report.centermiddleware.constant.enums.TimeTypeEnum;
+import com.persagy.apm.energy.report.centermiddleware.model.dto.QueryEnergyDataDTO;
+import com.persagy.apm.energy.report.centermiddleware.service.ICenterMiddlewareWebService;
+import com.persagy.apm.energy.report.common.utils.DataUtils;
+import com.persagy.apm.energy.report.common.utils.DateUtils;
+import com.persagy.apm.energy.report.monthly.config.function.model.Function;
+import com.persagy.apm.energy.report.monthly.config.function.service.IFunctionService;
+import com.persagy.apm.energy.report.monthly.config.functiongroup.model.FunctionGroup;
+import com.persagy.apm.energy.report.monthly.config.functiongroup.service.IFunctionGroupService;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.GroupInfo;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
+import com.persagy.apm.energy.report.monthly.detail.common.service.IReportPowerInfoService;
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
+import com.persagy.apm.energy.report.saasweb.model.vo.ReportProjectVO;
+import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
+import org.assertj.core.util.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 商业类报告用电量service类
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 7:30 下午
+ **/
+@Service
+public abstract class ReportPowerInfoServiceImpl implements IReportPowerInfoService {
+    @Autowired
+    private IReportOutlineService reportOutlineService;
+    @Autowired
+    private IFunctionGroupService functionGroupService;
+    @Autowired
+    private IFunctionService functionService;
+    @Autowired
+    private ICenterMiddlewareWebService centerMiddlewareWebService;
+    @Autowired
+    private ISaasWebService saasWebService;
+
+    @Override
+    public PowerVO getPowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList) {
+        Date reportMonth = reportOutline.getReportMonth();
+
+        List<String> projectIds = reportOutlineService.queryRelatedProjectIds(reportOutline);
+
+        return getPowerInfoByProjectIds(groupIdList, functionIdList, reportMonth, projectIds);
+    }
+
+    @Override
+    public PowerVO getComparePowerInfo(ReportOutline reportOutline, List<String> groupIdList, List<String> functionIdList) {
+        Date reportMonth = reportOutline.getReportMonth();
+
+        List<String> projectIds = reportOutlineService.queryRelatedProjectIds(reportOutline);
+
+        List<String> comparableProjects = saasWebService.getComparableProjects(projectIds, reportMonth);
+
+        return getPowerInfoByProjectIds(groupIdList, functionIdList, reportMonth, comparableProjects);
+    }
+
+    /**
+     * 根据项目id获取用电信息
+     *
+     * @param groupIdList    费用信息点分组列表
+     * @param functionIdList 费用信息点列表
+     * @param reportMonth    报告月份
+     * @param projectIds     项目id列表
+     * @return 用电信息
+     * @author lixing
+     * @version V1.0 2021/5/30 11:41 下午
+     */
+    private PowerVO getPowerInfoByProjectIds(
+            List<String> groupIdList, List<String> functionIdList,
+            Date reportMonth, List<String> projectIds) {
+        PowerVO powerVO = new PowerVO();
+        List<GroupInfo<PowerItemVO>> powerGroupInfos = getPowerGroupInfos(groupIdList, reportMonth, projectIds);
+        powerVO.setGroups(powerGroupInfos);
+
+        List<PowerItemVO> powerItemInfos = getPowerItemInfos(functionIdList, reportMonth, projectIds);
+        powerVO.setItems(powerItemInfos);
+
+        List<PowerItemVO> paragraphSums = new ArrayList<>();
+
+        if (!CollectionUtils.isEmpty(powerGroupInfos)) {
+            paragraphSums.addAll(
+                    powerGroupInfos.stream().map(GroupInfo::getSummary).collect(Collectors.toList()));
+        }
+        if (!CollectionUtils.isEmpty(powerItemInfos)) {
+            paragraphSums.addAll(powerItemInfos);
+        }
+        powerVO.setSummary(getPowerSum(paragraphSums));
+        return powerVO;
+    }
+
+    @Override
+    public List<PowerItemVO> getPowerItemInfos(List<String> functionIdList, Date reportMonth, List<String> projectIds) {
+        List<PowerItemVO> powerItemVOList = Lists.newArrayList();
+        if (CollectionUtils.isEmpty(functionIdList) || CollectionUtils.isEmpty(projectIds)) {
+            return powerItemVOList;
+        }
+
+        for (String functionId : functionIdList) {
+            Function function = functionService.queryFunctionDetail(functionId);
+            String itemName = functionService.getItemName(function, projectIds.get(0));
+
+            List<PowerItemVO> projectPowerItems = getPowerItemsByProjects(reportMonth, projectIds, function);
+            PowerItemVO powerSumByProjects = getPowerSum(projectPowerItems);
+            powerSumByProjects.setName(itemName);
+            powerItemVOList.add(powerSumByProjects);
+        }
+        return powerItemVOList;
+    }
+
+    @Override
+    public List<PowerItemVO> getPowerItemsByProjects(Date reportMonth, List<String> projectIds, Function function) {
+        List<PowerItemVO> projectPowerItems = Lists.newArrayList();
+        if (CollectionUtils.isEmpty(projectIds)) {
+            return projectPowerItems;
+        }
+
+        // 统计项目的面积
+        Double projectBuildingArea = getProjectBuildingArea(projectIds);
+
+        for (String projectId : projectIds) {
+            // 获取项目信息
+            ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
+            if (reportProjectInfo == null) {
+                continue;
+            }
+            Map<String, TreeMap<Date, Double>> itemEnergyDataMap = getItemEnergyDataMap(
+                    reportMonth, function.getItemId(), function.getModelCode(), reportProjectInfo.getProjectLocalID());
+            TreeMap<Date, Double> dateValueMap = itemEnergyDataMap.get(function.getItemId());
+            if (dateValueMap != null) {
+                PowerItemVO powerItemInfo = getPowerItemInfo(reportMonth, projectBuildingArea, dateValueMap);
+                projectPowerItems.add(powerItemInfo);
+            }
+        }
+        return projectPowerItems;
+    }
+
+    @Override
+    public PowerItemVO getPowerItemInfo(Date reportMonth, Double buildingArea, TreeMap<Date, Double> dateValueMap) {
+        PowerItemVO powerItemVO = new PowerItemVO();
+        Double currentMonth = dateValueMap.get(reportMonth);
+        if (buildingAreaIsValid(buildingArea) && currentMonth != null) {
+            powerItemVO.setCurrentMonthPerSqm(DataUtils.doubleDivide(currentMonth, buildingArea));
+        }
+        powerItemVO.setCurrentMonth(currentMonth);
+        Double lastMonth = dateValueMap.get(DateUtils.getFirstDayOfLastMonth(reportMonth));
+        powerItemVO.setLastMonth(lastMonth);
+        Double lastYearSameTime = dateValueMap.get(DateUtils.getSameMonthFirstDayOfLastYear(reportMonth));
+        powerItemVO.setLastYearSameTime(lastYearSameTime);
+        // 去年同期每平方米耗电量
+        Double lastYearSameTimePerSqm = null;
+        if (buildingAreaIsValid(buildingArea) && lastYearSameTime != null) {
+            lastYearSameTimePerSqm = DataUtils.doubleDivide(lastYearSameTime, buildingArea);
+            powerItemVO.setLastYearSameTimePerSqm(lastYearSameTimePerSqm);
+        }
+
+        if (lastYearSameTime != null && currentMonth != null && buildingAreaIsValid(buildingArea)) {
+            Double sameTimeGrowth = DataUtils.doubleSubtract(currentMonth, lastYearSameTime);
+            powerItemVO.setSameTimeGrowth(sameTimeGrowth);
+            Double sameTimeRange = DataUtils.doubleDivide(sameTimeGrowth, lastYearSameTime);
+            powerItemVO.setSameTimeRange(sameTimeRange);
+            Double sameTimeGrowthPerSqm = DataUtils.doubleDivide(sameTimeGrowth, buildingArea);
+            powerItemVO.setSameTimeGrowthPerSqm(sameTimeGrowthPerSqm);
+            if (lastYearSameTimePerSqm != null) {
+                Double sameTimeRangePerSqm = DataUtils.doubleDivide(sameTimeGrowthPerSqm, lastYearSameTimePerSqm);
+                powerItemVO.setSameTimeRangePerSqm(sameTimeRangePerSqm);
+            }
+        }
+
+        // 统计去年同期的用电量
+        Double lastYearCount = null;
+        List<Date> lastYearMonths = DateUtils.getFirstDayOfEveryMonth(
+                DateUtils.getFirstDayOfLastYear(reportMonth),
+                DateUtils.getSameMonthFirstDayOfLastYear(reportMonth));
+        List<PowerItemVO> lastYearItems = new ArrayList<>();
+        for (Date lastYearMonth : lastYearMonths) {
+            PowerItemVO tmp = new PowerItemVO();
+            tmp.setLastYearCount(dateValueMap.get(lastYearMonth));
+            lastYearItems.add(tmp);
+        }
+
+        PowerItemVO lastYearSumItem = getPowerSum(lastYearItems);
+        if (lastYearSumItem != null) {
+            lastYearCount = lastYearSumItem.getLastYearCount();
+            powerItemVO.setLastYearCount(lastYearCount);
+            if (buildingAreaIsValid(buildingArea) && lastYearCount != null) {
+                powerItemVO.setLastYearPerCount(DataUtils.doubleDivide(lastYearCount, buildingArea));
+            }
+        }
+
+        // 统计今年的用电量
+        Double yearCount = null;
+        List<Date> yearMonths = DateUtils.getFirstDayOfEveryMonth(
+                DateUtils.getFirstDayOfYear(reportMonth),
+                reportMonth);
+        List<PowerItemVO> yearItems = new ArrayList<>();
+        for (Date yearMonth : yearMonths) {
+            PowerItemVO tmp = new PowerItemVO();
+            tmp.setYearCount(dateValueMap.get(yearMonth));
+            yearItems.add(tmp);
+        }
+
+        PowerItemVO yearSumItem = getPowerSum(yearItems);
+        if (yearSumItem != null) {
+            yearCount = yearSumItem.getYearCount();
+            powerItemVO.setYearCount(yearCount);
+            if (buildingAreaIsValid(buildingArea) && yearCount != null) {
+                powerItemVO.setYearPerCount(DataUtils.doubleDivide(yearCount, buildingArea));
+            }
+        }
+
+        if (currentMonth != null && lastMonth != null) {
+            Double linkCount = DataUtils.doubleSubtract(currentMonth, lastMonth);
+            Double linkRange = DataUtils.doubleDivide(linkCount, lastMonth);
+            powerItemVO.setLinkCount(linkCount);
+            powerItemVO.setLinkRange(linkRange);
+        }
+
+        if (lastYearCount != null && yearCount != null) {
+            double sameCount = DataUtils.doubleSubtract(yearCount, lastYearCount);
+            powerItemVO.setSameCount(sameCount);
+            powerItemVO.setSameRange(DataUtils.doubleDivide(sameCount, lastYearCount));
+        }
+        return powerItemVO;
+    }
+
+    /**
+     * 判断建筑面积是否合法(不为空,且不为0)
+     *
+     * @param buildingArea 建筑面积
+     * @return 建筑面积是否合法
+     * @author lixing
+     * @version V1.0 2021/6/10 3:06 下午
+     */
+    private boolean buildingAreaIsValid(Double buildingArea) {
+        Double zero = 0d;
+        return buildingArea != null && !buildingArea.equals(zero);
+    }
+
+    @Override
+    public Map<String, TreeMap<Date, Double>> getItemEnergyDataMap(
+            Date reportMonth, String itemId, String modelCode, String projectLocalId) {
+        QueryEnergyDataDTO queryEnergyDataDTO = new QueryEnergyDataDTO();
+        queryEnergyDataDTO.setProjectId(projectLocalId);
+        queryEnergyDataDTO.setBuildingId(projectLocalId);
+        queryEnergyDataDTO.setModelCode(modelCode);
+        // 去年一月
+        queryEnergyDataDTO.setStartDate(DateUtils.date2Str(
+                DateUtils.getFirstDayOfLastYear(reportMonth), DateUtils.SDF_SECOND));
+        // 结束时间往后延一个月,中间件时间查询为左闭右开
+        queryEnergyDataDTO.setEndDate(DateUtils.date2Str(DateUtils.getMonthOff(reportMonth, 1), DateUtils.SDF_SECOND));
+        queryEnergyDataDTO.setItemIdList(Lists.newArrayList(itemId));
+        queryEnergyDataDTO.setTimeType(TimeTypeEnum.MONTH.getType());
+        return centerMiddlewareWebService.getItemEnergyDataMap(queryEnergyDataDTO);
+    }
+
+    @Override
+    public PowerItemVO getPowerSum(List<PowerItemVO> powerItems) {
+        return DataUtils.sumDoubleParams(powerItems, PowerItemVO.class);
+    }
+
+    @Override
+    public List<GroupInfo<PowerItemVO>> getPowerGroupInfos(List<String> groupIdList, Date reportMonth, List<String> projectIds) {
+        List<GroupInfo<PowerItemVO>> groupInfoList = Lists.newArrayList();
+        if (CollectionUtils.isEmpty(groupIdList)) {
+            return groupInfoList;
+        }
+        for (String groupId : groupIdList) {
+            GroupInfo<PowerItemVO> groupInfo = new GroupInfo<>();
+            FunctionGroup functionGroup = functionGroupService.queryFunctionGroupDetail(groupId);
+            groupInfo.setGroupName(functionGroup.getName());
+            // 获取组下的分组(本期不做)
+            // 获取组下的分项
+            String functionIdStr = functionGroup.getFunctionIds();
+            List<String> functionIds = Lists.newArrayList(functionIdStr.split(","));
+            List<PowerItemVO> powerItemInfos = getPowerItemInfos(functionIds, reportMonth, projectIds);
+            groupInfo.setItems(powerItemInfos);
+            groupInfo.setSummary(getPowerSum(powerItemInfos));
+            groupInfoList.add(groupInfo);
+        }
+        return groupInfoList;
+    }
+
+    /**
+     * 获取统计费用需要使用的项目面积
+     *
+     * @param projectIds 需要统计的项目的id列表
+     * @return 统计费用需要使用的项目面积
+     * @author lixing
+     * @version V1.0 2021/6/9 7:51 下午
+     */
+    @Override
+    public abstract Double getProjectBuildingArea(List<String> projectIds);
+}

+ 23 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/ConvertReportHotelProjectDetailTool.java

@@ -1,5 +1,8 @@
 package com.persagy.apm.energy.report.monthly.detail.hotel.project.model;
 
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerPublicConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
 import org.mapstruct.*;
 import org.mapstruct.MappingTarget;
 import org.mapstruct.factory.Mappers;
@@ -70,5 +73,25 @@ public interface ConvertReportHotelProjectDetailTool {
      * @version V1.0 2021-06-07 09:42:59
      */
     ReportHotelProjectDetail convertUpdateDto2Entity(@MappingTarget ReportHotelProjectDetail reportHotelProjectDetail, UpdateReportHotelProjectDetailDTO updateReportHotelProjectDetailDTO);
+
+    /**
+     * PowerItemVO转换为 HotelPowerConsumptionItem
+     *
+     * @param item PowerItemVO
+     * @return HotelPowerConsumptionItem
+     * @author lixing
+     * @version V1.0 2021/6/10 3:28 下午
+     */
+    HotelPowerConsumptionItem convert2HotelPowerConsumptionItem(PowerItemVO item);
+
+    /**
+     * PowerItemVO转换为 HotelPowerPublicConsumptionItem
+     *
+     * @param powerItemVO PowerItemVO
+     * @return HotelPowerPublicConsumptionItem
+     * @author lixing
+     * @version V1.0 2021/6/10 3:28 下午
+     */
+    HotelPowerPublicConsumptionItem convert2HotelPowerPublicConsumptionItem(PowerItemVO powerItemVO);
 }
 

+ 4 - 2
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPowerConsumptionOutline.java

@@ -1,6 +1,7 @@
 package com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostItemVO;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerConsumptionItem;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -23,13 +24,14 @@ public class HotelProjectPowerConsumptionOutline {
     @ApiModelProperty(value = "同等碳排放量")
     private Double tce;
     @ApiModelProperty(value = "单位建筑面积能耗")
-    private Double consumptionPerSquareMetre;
+    private Double consumptionPerSqm;
     @ApiModelProperty(value = "总建筑面积")
     private Double overallFloorage;
     @ApiModelProperty(value = "去年同期耗电量")
     private Double consumptionLastYear;
-    @ApiModelProperty(value = "同比涨幅")
+    @ApiModelProperty(value = "同比涨幅")
     private Double consumptionSameTimeRange;
     @ApiModelProperty(value = "条目信息")
     private List<HotelPowerConsumptionItem> detailInfo;
+//    private List<CostItemVO> detailInfo;
 }

+ 7 - 7
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPublicPowerConsumption.java

@@ -24,18 +24,18 @@ public class HotelProjectPublicPowerConsumption extends HotelRankVO {
     @ApiModelProperty(value = "本月总耗电量")
     private Double consumptionCurrentMonth;
     @ApiModelProperty(value = "本月单位建筑面积能耗")
-    private Double consumptionPerSquareMetreCurrentMonth;
+    private Double consumptionPerSqmCurrentMonth;
     @ApiModelProperty(value = "费用环比涨幅")
     private Double consumptionMonthRange;
     @ApiModelProperty(value = "本年单位建筑面积能耗")
-    private Double consumptionPerSquareMetreCurrentYear;
+    private Double consumptionPerSqmCurrentYear;
     @ApiModelProperty(value = "去年同期单位建筑面积能耗")
-    private Double consumptionPerSquareMetreLastYear;
-    @ApiModelProperty(value = "费用同比涨幅")
+    private Double consumptionPerSqmLastYear;
+    @ApiModelProperty(value = "能耗同比涨幅")
     private Double consumptionYearRange;
     @ApiModelProperty(value = "国标引导值")
-    private Double guideValue;
+    private String guideValue;
 
-    @ApiModelProperty(value = "条目费用信息")
-    private List<HotelPowerPublicConsumptionItem> itemsCostInfo;
+    @ApiModelProperty(value = "条目信息")
+    private List<HotelPowerPublicConsumptionItem> itemsInfo;
 }

+ 27 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/IHotelProjectReportPowerInfoOutlineService.java

@@ -0,0 +1,27 @@
+package com.persagy.apm.energy.report.monthly.detail.hotel.project.service;
+
+import com.persagy.apm.energy.report.monthly.detail.common.service.IReportPowerInfoService;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPowerConsumptionOutline;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPublicPowerConsumption;
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+
+import java.util.List;
+
+/**
+ * 酒店项目报告用电量信息概要服务接口
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 10:25 下午
+ **/
+public interface IHotelProjectReportPowerInfoOutlineService extends IReportPowerInfoService {
+    /**
+     * 获取用电量信息概要
+     *
+     * @param reportOutline 报告概要
+     * @param functionIdList 概要功能点列表
+     * @return 用电量信息概要
+     * @author lixing
+     * @version V1.0 2021/6/10 2:35 下午
+     */
+    HotelProjectPowerConsumptionOutline getConsumptionOutline(ReportOutline reportOutline, List<String> functionIdList);
+}

+ 29 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/IHotelProjectReportPublicPowerInfoService.java

@@ -0,0 +1,29 @@
+package com.persagy.apm.energy.report.monthly.detail.hotel.project.service;
+
+import com.persagy.apm.energy.report.monthly.detail.common.service.IReportPowerInfoService;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPowerConsumptionOutline;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPublicPowerConsumption;
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+
+import java.util.List;
+
+/**
+ * 酒店项目报告公区用电量信息服务接口
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 10:25 下午
+ **/
+public interface IHotelProjectReportPublicPowerInfoService extends IReportPowerInfoService {
+
+    /**
+     * 获取公区用电量信息
+     *
+     * @param reportOutline 报告概要
+     * @param functionIdList 公区功能点列表
+     * @return 公区用电量信息
+     * @author lixing
+     * @version V1.0 2021/6/10 2:35 下午
+     */
+    HotelProjectPublicPowerConsumption getPublicConsumption(ReportOutline reportOutline, List<String> functionIdList);
+
+}

+ 2 - 22
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportCostServiceImpl.java

@@ -36,27 +36,19 @@ import java.util.stream.Collectors;
 public class HotelProjectReportCostServiceImpl extends ReportCostInfoServiceImpl
         implements IHotelProjectReportCostService {
     @Autowired
-    private IFunctionGroupService functionGroupService;
-    @Autowired
     private IFunctionService functionService;
     @Autowired
-    private IFunctionValueService functionValueService;
-    @Autowired
     private ISaasWebService saasWebService;
     @Autowired
     private IReportOutlineService reportOutlineService;
 
     @Override
     public HotelProjectCostInfo getCost(ReportOutline reportOutline, List<String> functionIdList) {
-
         Date reportMonth = reportOutline.getReportMonth();
-
         List<String> projectIds = reportOutlineService.queryRelatedProjectIds(reportOutline);
-
         if (CollectionUtils.isEmpty(projectIds)) {
             return null;
         }
-
         return getCostInfoByProjectId(functionIdList, reportMonth, projectIds.get(0));
     }
 
@@ -103,19 +95,7 @@ public class HotelProjectReportCostServiceImpl extends ReportCostInfoServiceImpl
     }
 
     @Override
-    public Double getProjectCostBuildingArea(List<String> projectIds) {
-        BigDecimal totalBuildingArea = new BigDecimal("0");
-        for (String projectId : projectIds) {
-            // 获取项目总的建筑面积
-            ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
-            if (reportProjectInfo == null) {
-                return null;
-            }
-            if (StringUtils.isNotBlank(reportProjectInfo.getTotalBuildingArea())) {
-                totalBuildingArea = totalBuildingArea.add(new BigDecimal(reportProjectInfo.getTotalBuildingArea()));
-            }
-
-        }
-        return totalBuildingArea.doubleValue();
+    public Double getProjectBuildingArea(List<String> projectIds) {
+        return saasWebService.getTotalBuildingArea(projectIds);
     }
 }

+ 83 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportPowerInfoOutlineServiceImpl.java

@@ -0,0 +1,83 @@
+package com.persagy.apm.energy.report.monthly.detail.hotel.project.service.impl;
+
+import com.persagy.apm.energy.report.common.utils.DataUtils;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerPublicConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
+import com.persagy.apm.energy.report.monthly.detail.common.service.impl.ReportPowerInfoServiceImpl;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.ConvertReportHotelProjectDetailTool;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPowerConsumptionOutline;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPublicPowerConsumption;
+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.outline.model.ReportOutline;
+import com.persagy.apm.energy.report.saasweb.model.vo.SimpleProjectVO;
+import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
+import org.assertj.core.util.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 商业类报告用电量service类
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 7:30 下午
+ **/
+@Service
+public class HotelProjectReportPowerInfoOutlineServiceImpl extends ReportPowerInfoServiceImpl
+        implements IHotelProjectReportPowerInfoOutlineService {
+    @Autowired
+    private ISaasWebService saasWebService;
+
+    @Override
+    public Double getProjectBuildingArea(List<String> projectIds) {
+        return saasWebService.getTotalBuildingArea(projectIds);
+    }
+
+    @Override
+    public HotelProjectPowerConsumptionOutline getConsumptionOutline(
+            ReportOutline reportOutline, List<String> functionIdList) {
+        PowerVO powerInfo = getPowerInfo(reportOutline, null, functionIdList);
+        HotelProjectPowerConsumptionOutline hotelProjectPowerConsumptionOutline = new HotelProjectPowerConsumptionOutline();
+        String projectId = reportOutline.getBelong();
+        // 获取项目信息
+        SimpleProjectVO simpleProjectInfo = saasWebService.getSimpleProjectInfo(projectId);
+        if (simpleProjectInfo == null) {
+            return null;
+        }
+        hotelProjectPowerConsumptionOutline.setProjectName(simpleProjectInfo.getProjectName());
+        PowerItemVO summary = powerInfo.getSummary();
+        if (summary != null) {
+            // 本月耗电量
+            Double currentMonth = summary.getCurrentMonth();
+            hotelProjectPowerConsumptionOutline.setConsumptionCurrentMonth(currentMonth);
+            // 同等碳排放量
+            Double slewRate = 2500d;
+            hotelProjectPowerConsumptionOutline.setTce(DataUtils.doubleDivide(currentMonth, slewRate));
+            // 单位建筑面积能耗
+            hotelProjectPowerConsumptionOutline.setConsumptionPerSqm(
+                    summary.getCurrentMonthPerSqm());
+            // 总建筑面积
+            hotelProjectPowerConsumptionOutline.setOverallFloorage(
+                    getProjectBuildingArea(Lists.newArrayList(projectId)));
+            // 去年同期耗电量
+            hotelProjectPowerConsumptionOutline.setConsumptionLastYear(summary.getLastYearSameTime());
+            // 月同比涨幅
+            hotelProjectPowerConsumptionOutline.setConsumptionSameTimeRange(summary.getSameTimeRange());
+        }
+        // 条目信息
+        List<PowerItemVO> items = powerInfo.getItems();
+        if (!CollectionUtils.isEmpty(items)) {
+            List<HotelPowerConsumptionItem> consumptions = items.stream().map(
+                    ConvertReportHotelProjectDetailTool.INSTANCE::convert2HotelPowerConsumptionItem
+                ).collect(Collectors.toList());
+            hotelProjectPowerConsumptionOutline.setDetailInfo(consumptions);
+        }
+        return hotelProjectPowerConsumptionOutline;
+    }
+}

+ 99 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/service/impl/HotelProjectReportPublicPowerInfoServiceImpl.java

@@ -0,0 +1,99 @@
+package com.persagy.apm.energy.report.monthly.detail.hotel.project.service.impl;
+
+import com.google.common.collect.Maps;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerPublicConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerItemVO;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
+import com.persagy.apm.energy.report.monthly.detail.common.service.impl.ReportPowerInfoServiceImpl;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.ConvertReportHotelProjectDetailTool;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectPublicPowerConsumption;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportPublicPowerInfoService;
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+import com.persagy.apm.energy.report.saasweb.model.vo.SimpleProjectVO;
+import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.stream.Collectors;
+
+/**
+ * 商业类报告用电量service类
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 7:30 下午
+ **/
+@Service
+public class HotelProjectReportPublicPowerInfoServiceImpl extends ReportPowerInfoServiceImpl
+        implements IHotelProjectReportPublicPowerInfoService {
+    @Autowired
+    private ISaasWebService saasWebService;
+
+    @Override
+    public Double getProjectBuildingArea(List<String> projectIds) {
+        return saasWebService.getTotalPublicArea(projectIds);
+    }
+
+    @Override
+    public HotelProjectPublicPowerConsumption getPublicConsumption(
+            ReportOutline reportOutline, List<String> functionIdList) {
+        // 获取用电量信息
+        PowerVO powerInfo = getPowerInfo(reportOutline, null, functionIdList);
+        HotelProjectPublicPowerConsumption hotelProjectPublicPowerConsumption = new HotelProjectPublicPowerConsumption();
+
+        String projectId = reportOutline.getBelong();
+        PowerItemVO summary = powerInfo.getSummary();
+        if (summary != null) {
+            // 本月总耗电量
+            hotelProjectPublicPowerConsumption.setConsumptionCurrentMonth(summary.getCurrentMonth());
+            // 本月单位建筑面积能耗
+            hotelProjectPublicPowerConsumption.setConsumptionPerSqmCurrentMonth(summary.getCurrentMonthPerSqm());
+            // 费用环比涨幅
+            hotelProjectPublicPowerConsumption.setConsumptionMonthRange(summary.getLinkRange());
+            // 本年单位建筑面积能耗
+            hotelProjectPublicPowerConsumption.setConsumptionPerSqmCurrentYear(summary.getYearPerCount());
+            // 能耗同比涨幅
+            hotelProjectPublicPowerConsumption.setConsumptionYearRange(summary.getSameRange());
+            // 国标引导值
+            hotelProjectPublicPowerConsumption.setGuideValue(getGuideValue(projectId));
+        }
+
+        // 设置条目信息
+        List<PowerItemVO> items = powerInfo.getItems();
+        if (!CollectionUtils.isEmpty(items)) {
+            List<HotelPowerPublicConsumptionItem> publicConsumptionItems = items.stream().map(
+                    ConvertReportHotelProjectDetailTool.INSTANCE::convert2HotelPowerPublicConsumptionItem
+            ).collect(Collectors.toList());
+            hotelProjectPublicPowerConsumption.setItemsInfo(publicConsumptionItems);
+        }
+
+        return hotelProjectPublicPowerConsumption;
+    }
+
+    /**
+     * 获取项目公区能耗国标引导值
+     *
+     * @param projectId 项目id
+     * @return 引导值
+     * @author lixing
+     * @version V1.0 2021/6/10 5:11 下午
+     */
+    private String getGuideValue(String projectId) {
+        ConcurrentMap<String, String> guideValueMap = Maps.newConcurrentMap();
+        // 严寒地区和寒冷地区:80 kWh/㎡;夏热冬冷地区:135 kWh/㎡;夏热冬暖地区:110 kWh/㎡;温和地区:60 kWh/㎡
+        guideValueMap.put("1", "80 kWh/㎡");
+        guideValueMap.put("2", "135 kWh/㎡");
+        guideValueMap.put("3", "110 kWh/㎡");
+        guideValueMap.put("4", "60 kWh/㎡");
+
+        // 获取项目所在的气候区
+        SimpleProjectVO simpleProjectInfo = saasWebService.getSimpleProjectInfo(projectId);
+        if (simpleProjectInfo != null) {
+            String climateZone = simpleProjectInfo.getClimateZone();
+            return guideValueMap.get(climateZone);
+        }
+        return null;
+    }
+}

+ 0 - 2
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/business/impl/BusinessReportBuilder.java

@@ -33,8 +33,6 @@ public class BusinessReportBuilder extends ReportBuilder implements IBusinessRep
     @Autowired
     private IReportBusinessDetailService businessDetailService;
     @Autowired
-    private IReportDetailService reportDetailService;
-    @Autowired
     private IBusinessReportPowerInfoService businessReportPowerInfoService;
     @Autowired
     private IBusinessReportCostInfoService businessReportCostInfoService;

+ 0 - 1
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/IHotelAreaReportBuilder.java

@@ -1,6 +1,5 @@
 package com.persagy.apm.energy.report.monthly.outline.service.builder.hotel;
 
-import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
 import com.persagy.apm.energy.report.monthly.outline.service.builder.common.IReportBuilder;
 
 /**

+ 0 - 2
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/impl/HotelAreaReportBuilder.java

@@ -24,8 +24,6 @@ import java.util.List;
 @Slf4j
 public class HotelAreaReportBuilder extends ReportBuilder implements IHotelAreaReportBuilder {
     @Autowired
-    private IReportDetailService reportDetailService;
-    @Autowired
     private IReportHotelAreaDetailService reportHotelAreaDetailService;
 
     @Override

+ 14 - 7
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/hotel/impl/HotelProjectReportBuilder.java

@@ -1,8 +1,9 @@
 package com.persagy.apm.energy.report.monthly.outline.service.builder.hotel.impl;
 
-import com.persagy.apm.energy.report.monthly.detail.common.service.IReportDetailService;
 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.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;
@@ -30,6 +31,10 @@ public class HotelProjectReportBuilder extends ReportBuilder implements IHotelPr
     private IReportHotelProjectDetailService reportHotelProjectDetailService;
     @Autowired
     private IHotelProjectReportCostService costService;
+    @Autowired
+    private IHotelProjectReportPublicPowerInfoService publicPowerInfoService;
+    @Autowired
+    private IHotelProjectReportPowerInfoOutlineService powerInfoOutlineService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -95,20 +100,22 @@ public class HotelProjectReportBuilder extends ReportBuilder implements IHotelPr
 
     @Override
     public HotelProjectPublicPowerConsumption getPublicPowerConsumption(ReportOutline reportOutline) {
-        // TODO: 2021/6/9
-        return null;
+        List<String> functionIdList = getFunctionsByParagraph(
+                reportOutline.getReportTypeId(), HotelReportParagraphs.PUBLIC_POWER_CONSUMPTION);
+        return publicPowerInfoService.getPublicConsumption(reportOutline, functionIdList);
     }
 
     @Override
     public HotelProjectPowerConsumptionOutline getPowerConsumptionOutline(ReportOutline reportOutline) {
-        // TODO: 2021/6/9
-        return null;
+        List<String> functionIdList = getFunctionsByParagraph(
+                reportOutline.getReportTypeId(), HotelReportParagraphs.POWER_CONSUMPTION_OUTLINE);
+        return powerInfoOutlineService.getConsumptionOutline(reportOutline, functionIdList);
     }
 
     @Override
     public HotelProjectCostInfo getCostInfo(ReportOutline reportOutline) {
-        List<String> costFunctionIdList = getFunctionsByParagraph(
+        List<String> functionIdList = getFunctionsByParagraph(
                 reportOutline.getReportTypeId(), HotelReportParagraphs.COST);
-        return costService.getCost(reportOutline, costFunctionIdList);
+        return costService.getCost(reportOutline, functionIdList);
     }
 }

+ 2 - 0
src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/BuildingInfoVO.java

@@ -23,4 +23,6 @@ public class BuildingInfoVO {
     private String undergroundGarageArea;
     @ApiModelProperty(value = "建筑总面积")
     private String totalArea;
+    @ApiModelProperty(value = "公区面积")
+    private String publicArea;
 }

+ 2 - 0
src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/ReportProjectVO.java

@@ -19,4 +19,6 @@ public class ReportProjectVO extends SimpleProjectVO{
     private String undergroundGarageArea;
     @ApiModelProperty(value = "总建筑面积")
     private String totalBuildingArea;
+    @ApiModelProperty(value = "公区面积")
+    private String publicArea;
 }

+ 2 - 0
src/main/java/com/persagy/apm/energy/report/saasweb/model/vo/SimpleProjectVO.java

@@ -23,4 +23,6 @@ public class SimpleProjectVO {
     private String projectLocalID;
     @ApiModelProperty(value = "开业时间")
     private String businessOpeningTime;
+    @ApiModelProperty(value = "气候区")
+    private String climateZone;
 }

+ 21 - 1
src/main/java/com/persagy/apm/energy/report/saasweb/service/ISaasWebService.java

@@ -34,7 +34,7 @@ public interface ISaasWebService {
     ReportProjectVO getReportProjectInfo(String projectId);
 
     /**
-     * 获取一组项目的总的商业面
+     * 获取一组项目的总的商业面
      *
      * @param projectIds 一组项目id
      * @return 这组项目总的商业面积
@@ -44,6 +44,26 @@ public interface ISaasWebService {
     Double getTotalCommercialArea(List<String> projectIds);
 
     /**
+     * 获取一组项目的总的公区面积
+     *
+     * @param projectIds 一组项目id
+     * @return 这组项目总的建筑面积
+     * @author lixing
+     * @version V1.0 2021/5/30 11:28 下午
+     */
+    Double getTotalPublicArea(List<String> projectIds);
+
+    /**
+     * 获取一组项目的总的建筑面积
+     *
+     * @param projectIds 一组项目id
+     * @return 这组项目总的建筑面积
+     * @author lixing
+     * @version V1.0 2021/5/30 11:28 下午
+     */
+    Double getTotalBuildingArea(List<String> projectIds);
+
+    /**
      * 获取区域可同比项目信息
      *
      * @param areaCode     区域编码

+ 38 - 1
src/main/java/com/persagy/apm/energy/report/saasweb/service/impl/SaasWebServiceImpl.java

@@ -87,15 +87,17 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 获取项目下的建筑信息
         PoemsFeignResponse<BuildingInfoVO> buildsResponse = saasWebClientWrapper.listBuildingsByProjectId(queryByProjectIdDTO);
         List<BuildingInfoVO> buildingInfoVOList = buildsResponse.getContent();
-        // 统计项目下建筑总的商业面积,地下停车场面积, 总面
+        // 统计项目下建筑总的商业面积,地下停车场面积,总面积,公区面
         BigDecimal totalCommercialArea = new BigDecimal("0");
         BigDecimal totalUndergroundGarageArea = new BigDecimal("0");
         BigDecimal totalBuildingArea = new BigDecimal("0");
+        BigDecimal totalPublicArea = new BigDecimal("0");
         if (!CollectionUtils.isEmpty(buildingInfoVOList)) {
             for (BuildingInfoVO buildingInfoVO : buildingInfoVOList) {
                 String commercialArea = buildingInfoVO.getCommercialArea();
                 String undergroundGarageArea = buildingInfoVO.getUndergroundGarageArea();
                 String totalArea = buildingInfoVO.getTotalArea();
+                String publicArea = buildingInfoVO.getPublicArea();
                 if (StringUtils.isNotBlank(commercialArea)) {
                     totalCommercialArea = totalCommercialArea.add(new BigDecimal(commercialArea));
                 }
@@ -105,6 +107,9 @@ public class SaasWebServiceImpl implements ISaasWebService {
                 if (StringUtils.isNotBlank(totalArea)) {
                     totalBuildingArea = totalBuildingArea.add(new BigDecimal(totalArea));
                 }
+                if (StringUtils.isNotBlank(publicArea)) {
+                    totalPublicArea = totalPublicArea.add(new BigDecimal(publicArea));
+                }
             }
         }
         reportProjectVO.setCommercialArea(totalCommercialArea.toString());
@@ -581,6 +586,38 @@ public class SaasWebServiceImpl implements ISaasWebService {
     }
 
     @Override
+    public Double getTotalPublicArea(List<String> projectIds) {
+        if (CollectionUtils.isEmpty(projectIds)) {
+            return 0d;
+        }
+
+        BigDecimal result = new BigDecimal("0");
+        for (String projectId : projectIds) {
+            ReportProjectVO projectAreas = getProjectAreas(projectId);
+            String publicArea = projectAreas.getPublicArea();
+            result = result.add(new BigDecimal(publicArea));
+        }
+        return result.doubleValue();
+    }
+
+    @Override
+    public Double getTotalBuildingArea(List<String> projectIds) {
+        BigDecimal totalBuildingArea = new BigDecimal("0");
+        for (String projectId : projectIds) {
+            // 获取项目总的建筑面积
+            ReportProjectVO reportProjectInfo = getReportProjectInfo(projectId);
+            if (reportProjectInfo == null) {
+                return null;
+            }
+            if (StringUtils.isNotBlank(reportProjectInfo.getTotalBuildingArea())) {
+                totalBuildingArea = totalBuildingArea.add(new BigDecimal(reportProjectInfo.getTotalBuildingArea()));
+            }
+
+        }
+        return totalBuildingArea.doubleValue();
+    }
+
+    @Override
     public List<String> getComparableProjects(List<String> projectIds, Date month) {
         if (CollectionUtils.isEmpty(projectIds)) {
             return Lists.newArrayList();