浏览代码

提交酒店报告初始化代码

lixing 3 年之前
父节点
当前提交
ffa9e69929
共有 16 个文件被更改,包括 149 次插入23 次删除
  1. 2 2
      src/main/java/com/persagy/apm/energy/report/monthly/detail/business/controller/ReportBusinessDetailController.java
  2. 6 1
      src/main/java/com/persagy/apm/energy/report/monthly/detail/common/model/vo/CostItemVO.java
  3. 2 1
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/ReportHotelAreaDetail.java
  4. 31 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/vo/HotelAreaPowerConsumptionOutline.java
  5. 1 1
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/vo/ResponseReportHotelAreaDetailItemVO.java
  6. 2 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectAlarmDealInfo.java
  7. 2 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectCostInfo.java
  8. 3 1
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectEnergyWorkerOrderBaseInfo.java
  9. 1 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectEnergyWorkerOrderInfo.java
  10. 2 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectMaintenanceBaseInfo.java
  11. 6 4
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPowerConsumptionOutline.java
  12. 4 1
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectPublicPowerConsumption.java
  13. 20 0
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/IReportOutlineService.java
  14. 20 0
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/IHotelProjectReportGenerator.java
  15. 11 2
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/impl/GenerateReportThreadPool.java
  16. 36 10
      src/main/java/com/persagy/apm/energy/report/monthly/outline/service/impl/ReportOutlineServiceImpl.java

+ 2 - 2
src/main/java/com/persagy/apm/energy/report/monthly/detail/business/controller/ReportBusinessDetailController.java

@@ -35,7 +35,7 @@ import java.util.List;
  * @author lixing
  * @version V1.0 2021-05-17 11:08:34
  */
-@Api(tags = "报告详情")
+@Api(tags = "商业报告详情")
 @Validated
 @RestController
 @RequestMapping("reportBusinessDetails")
@@ -52,7 +52,7 @@ public class ReportBusinessDetailController {
     //    }
 
 
-    @ApiOperation(value = "更新报告详情")
+    @ApiOperation(value = "更新商业报告详情")
     @PostMapping("/update")
     public CommonResult<ApmResponseUpsertVO> updateReportBusinessDetail(
             @Valid @RequestBody UpdateReportBusinessDetailDTO updateReportBusinessDetailDTO) {

+ 6 - 1
src/main/java/com/persagy/apm/energy/report/monthly/detail/common/model/vo/CostItemVO.java

@@ -11,10 +11,15 @@ import lombok.Data;
  **/
 @Data
 @ApiModel(value = "费用条目")
-@JsonInclude(JsonInclude.Include.NON_NULL)
 public class CostItemVO {
     @ApiModelProperty("条目名称")
     private String name;
+    @ApiModelProperty(value = "条目能耗类型",
+            notes = "com.persagy.apm.energy.report.monthly.config.function.constant.enums.EnergyTypeEnum")
+    private String energyType;
+    @ApiModelProperty("功能类型(0-能耗,1-费用 ,2-能耗预算,3-费用预算)")
+    private String functionType;
+
 
     @ApiModelProperty("本月费用")
     public Double currentMonth;

+ 2 - 1
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/ReportHotelAreaDetail.java

@@ -2,6 +2,7 @@ package com.persagy.apm.energy.report.monthly.detail.hotel.area.model;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.persagy.apm.energy.report.monthly.detail.hotel.area.model.vo.HotelAreaPowerConsumptionOutline;
 import com.persagy.apm.energy.report.monthly.detail.hotel.area.model.vo.HotelAreaRemainProblem;
 import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.*;
 import io.swagger.annotations.ApiModel;
@@ -42,7 +43,7 @@ public class ReportHotelAreaDetail extends AuditableEntity<ReportHotelAreaDetail
 
     @ApiModelProperty("用电量概述")
     @TableField(typeHandler = FastjsonTypeHandler.class)
-    private List<HotelProjectPowerConsumptionOutline> powerUsageOutline;
+    private List<HotelAreaPowerConsumptionOutline> powerUsageOutline;
 
     @ApiModelProperty("用电量说明")
     private String powerUsageDescription;

+ 31 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/vo/HotelAreaPowerConsumptionOutline.java

@@ -0,0 +1,31 @@
+package com.persagy.apm.energy.report.monthly.detail.hotel.area.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerConsumptionItem;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author lixing
+ * @version V1.0 2021/6/7 2:12 下午
+ **/
+@Data
+@ApiModel("酒店区域用电量信息")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class HotelAreaPowerConsumptionOutline {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    @ApiModelProperty(value = "本月总耗电量")
+    private Double consumptionCurrentMonth;
+    @ApiModelProperty(value = "公区本月总耗电量")
+    private Double publicConsumptionCurrentMonth;
+    @ApiModelProperty(value = "单位建筑面积能耗")
+    private Double consumptionPerSquareMetre;
+    @ApiModelProperty(value = "同比涨幅")
+    private Double consumptionSameTimeRange;
+    @ApiModelProperty(value = "环比涨幅")
+    private Double consumptionChainRange;
+}

+ 1 - 1
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/area/model/vo/ResponseReportHotelAreaDetailItemVO.java

@@ -33,7 +33,7 @@ public class ResponseReportHotelAreaDetailItemVO {
     private String costDescription;
 
     @ApiModelProperty("用电量概述")
-    private List<HotelProjectPowerConsumptionOutline> powerUsageOutline;
+    private List<HotelAreaPowerConsumptionOutline> powerUsageOutline;
 
     @ApiModelProperty("用电量说明")
     private String powerUsageDescription;

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

@@ -17,6 +17,8 @@ import java.util.List;
 @ApiModel("酒店项目报警处理信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectAlarmDealInfo {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
     @ApiModelProperty(value = "报警总条数")
     private Double totalCount;
     @ApiModelProperty(value = "处理条数")

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

@@ -16,6 +16,8 @@ import java.util.List;
 @ApiModel("酒店项目费用信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectCostInfo {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
     @ApiModelProperty(value = "总费用")
     private Double totalCost;
     @ApiModelProperty(value = "单位建筑面积费用")

+ 3 - 1
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectEnergyWorkerOrderBaseInfo.java

@@ -12,9 +12,11 @@ import java.util.List;
  * @version V1.0 2021/6/7 2:12 下午
  **/
 @Data
-@ApiModel("酒店项目节能工单信息")
+@ApiModel("酒店项目节能工单基础信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectEnergyWorkerOrderBaseInfo {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
     @ApiModelProperty(value = "工单总条数")
     private Double totalCount;
     @ApiModelProperty(value = "工单总节能量")

+ 1 - 0
src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectEnergyWorkerOrderInfo.java

@@ -17,6 +17,7 @@ import java.util.List;
 @ApiModel("酒店项目节能工单信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectEnergyWorkerOrderInfo extends HotelProjectEnergyWorkerOrderBaseInfo {
+
     @ApiModelProperty(value = "执行采纳条数")
     private Double executeCount;
     @ApiModelProperty(value = "采纳率")

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

@@ -18,6 +18,8 @@ import java.util.List;
 @ApiModel("酒店项目维护基础信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectMaintenanceBaseInfo {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
     @ApiModelProperty(value = "变损率")
     private Double changeLossRate;
     @ApiModelProperty(value = "总支不平衡率")

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

@@ -16,6 +16,8 @@ import java.util.List;
 @ApiModel("酒店项目用电量信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class HotelProjectPowerConsumptionOutline {
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
     @ApiModelProperty(value = "本月总耗电量")
     private Double consumptionCurrentMonth;
     @ApiModelProperty(value = "同等碳排放量")
@@ -26,8 +28,8 @@ public class HotelProjectPowerConsumptionOutline {
     private Double overallFloorage;
     @ApiModelProperty(value = "去年同期耗电量")
     private Double consumptionLastYear;
-    @ApiModelProperty(value = "费用同比涨幅")
-    private Double consumptionMonthRange;
-    @ApiModelProperty(value = "条目费用信息")
-    private List<HotelPowerConsumptionItem> itemsCostInfo;
+    @ApiModelProperty(value = "同比涨幅")
+    private Double consumptionSameTimeRange;
+    @ApiModelProperty(value = "条目信息")
+    private List<HotelPowerConsumptionItem> detailInfo;
 }

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

@@ -2,10 +2,12 @@ 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.HotelPowerConsumptionItem;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelPowerPublicConsumptionItem;
 import com.persagy.apm.energy.report.monthly.detail.common.model.vo.HotelRankVO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 import lombok.With;
 
 import java.util.List;
@@ -14,6 +16,7 @@ import java.util.List;
  * @author lixing
  * @version V1.0 2021/6/7 2:12 下午
  **/
+@EqualsAndHashCode(callSuper = true)
 @Data
 @ApiModel("酒店项目公区用电量信息")
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -34,5 +37,5 @@ public class HotelProjectPublicPowerConsumption extends HotelRankVO {
     private Double guideValue;
 
     @ApiModelProperty(value = "条目费用信息")
-    private List<HotelPowerConsumptionItem> itemsCostInfo;
+    private List<HotelPowerPublicConsumptionItem> itemsCostInfo;
 }

+ 20 - 0
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/IReportOutlineService.java

@@ -32,6 +32,26 @@ public interface IReportOutlineService {
     String createReportOutline(AddReportOutlineDTO addReportOutlineDTO);
 
     /**
+     * 获取报告概要的所属类型
+     *
+     * @param reportOutline 报告概要
+     * @return 报告概要的所属类型
+     * @author lixing
+     * @version V1.0 2021/6/8 5:26 下午
+     */
+    String getBelongType(ReportOutline reportOutline);
+
+    /**
+     * 获取报告概要的业态
+     *
+     * @param reportOutline 报告概要
+     * @return 报告概要的业态
+     * @author lixing
+     * @version V1.0 2021/6/8 5:26 下午
+     */
+    String getBuildingType(ReportOutline reportOutline);
+
+    /**
      * 报告概要详情
      *
      * @param id 主键

+ 20 - 0
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/builder/IHotelProjectReportGenerator.java

@@ -0,0 +1,20 @@
+package com.persagy.apm.energy.report.monthly.outline.service.builder;
+
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
+
+/**
+ * 生成酒店项目报告建造者接口
+ *
+ * @author lixing
+ * @version V1.0 2021/5/30 10:26 下午
+ **/
+public interface IHotelProjectReportGenerator {
+    /**
+     * 生成报告。如果生成失败,数据回滚并且报告状态修改为生成失败
+     *
+     * @param reportOutline 报告outline对象
+     * @author lixing
+     * @version V1.0 2021/5/24 4:09 下午
+     */
+    void generateReport(ReportOutline reportOutline);
+}

+ 11 - 2
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/impl/GenerateReportThreadPool.java

@@ -2,9 +2,9 @@ package com.persagy.apm.energy.report.monthly.outline.service.impl;
 
 import cn.hutool.core.thread.ExecutorBuilder;
 import com.persagy.apm.common.context.poems.PoemsContext;
-import com.persagy.apm.energy.report.monthly.config.type.constant.enums.BelongTypeEnum;
 import com.persagy.apm.energy.report.monthly.config.type.constant.enums.BuildingTypeEnum;
 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.monthly.outline.service.builder.IBusinessReportGenerator;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +25,8 @@ import java.util.concurrent.ThreadPoolExecutor;
 public class GenerateReportThreadPool {
     @Autowired
     IBusinessReportGenerator businessReportGenerator;
+    @Autowired
+    IReportOutlineService reportOutlineService;
 
     private final ExecutorService es;
 
@@ -52,7 +54,14 @@ public class GenerateReportThreadPool {
         es.execute(() -> {
             PoemsContext.setContext(userId, loginDevice, pd);
             synchronized (reportOutline.getId().intern()) {
-                businessReportGenerator.generateReport(reportOutline);
+                String buildingType = reportOutlineService.getBuildingType(reportOutline);
+                if (BuildingTypeEnum.BUSINESS.getType().equals(buildingType)) {
+                    businessReportGenerator.generateReport(reportOutline);
+                } else if (BuildingTypeEnum.HOTEL.getType().equals(buildingType)) {
+
+                } else {
+                    throw new IllegalArgumentException("不支持此类报告的生成,业态:" + buildingType);
+                }
             }
         });
     }

+ 36 - 10
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/impl/ReportOutlineServiceImpl.java

@@ -111,8 +111,7 @@ public class ReportOutlineServiceImpl extends ServiceImpl<ReportOutlineMapper, R
 
         /* 拼接报告的名称 */
         // 根据报告类型判断报告所属是项目还是管理分区, 获取报告所属名称
-        String reportTypeId = reportOutline.getReportTypeId();
-        ReportType reportType = reportTypeService.queryReportTypeDetail(reportTypeId);
+        ReportType reportType = getReportType(reportOutline);
         String belongName = "";
         if (BelongTypeEnum.PROJECT.getType().equals(reportType.getBelongType())) {
             ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(reportOutline.getBelong());
@@ -130,6 +129,39 @@ public class ReportOutlineServiceImpl extends ServiceImpl<ReportOutlineMapper, R
     }
 
     /**
+     * 获取报告概要的报告类型
+     *
+     * @param reportOutline 报告概要
+     * @return 报告概要的报告类型
+     * @author lixing
+     * @version V1.0 2021/6/8 5:26 下午
+     */
+    private ReportType getReportType(ReportOutline reportOutline) {
+        String reportTypeId = reportOutline.getReportTypeId();
+        return reportTypeService.queryReportTypeDetail(reportTypeId);
+    }
+
+    @Override
+    public String getBelongType(ReportOutline reportOutline) {
+        ReportType reportType = getReportType(reportOutline);
+        if (reportType != null) {
+            return reportType.getBelongType();
+        }
+        return null;
+    }
+
+    @Override
+    public String getBuildingType(ReportOutline reportOutline) {
+        ReportType reportType = getReportType(reportOutline);
+        if (reportType != null) {
+            return reportType.getBuildingType();
+        }
+        return null;
+    }
+
+
+
+    /**
      * 报告概要详情
      *
      * @param id 主键
@@ -326,10 +358,7 @@ public class ReportOutlineServiceImpl extends ServiceImpl<ReportOutlineMapper, R
 
     @Override
     public List<String> queryRelatedProjectIds(ReportOutline reportOutline) {
-        String reportTypeId = reportOutline.getReportTypeId();
-
-        ReportType reportType = reportTypeService.queryReportTypeDetail(reportTypeId);
-        String belongType = reportType.getBelongType();
+        String belongType = getBelongType(reportOutline);
 
         List<String> projectIds = new ArrayList<>();
         if (BelongTypeEnum.PROJECT.getType().equals(belongType)) {
@@ -348,10 +377,7 @@ public class ReportOutlineServiceImpl extends ServiceImpl<ReportOutlineMapper, R
 
     @Override
     public List<SimpleProjectVO> queryRelatedProjects(ReportOutline reportOutline) {
-        String reportTypeId = reportOutline.getReportTypeId();
-
-        ReportType reportType = reportTypeService.queryReportTypeDetail(reportTypeId);
-        String belongType = reportType.getBelongType();
+        String belongType = getBelongType(reportOutline);
 
         List<SimpleProjectVO> projects = new ArrayList<>();
         if (BelongTypeEnum.PROJECT.getType().equals(belongType)) {