Pārlūkot izejas kodu

酒店报警处理情况和环境指标数据代码逻辑

wangchenghong 3 gadi atpakaļ
vecāks
revīzija
50b57a511f
14 mainītis faili ar 306 papildinājumiem un 126 dzēšanām
  1. 24 0
      src/main/java/com/persagy/apm/energy/report/common/service/CommonService.java
  2. 69 2
      src/main/java/com/persagy/apm/energy/report/common/service/impl/CommonServiceImpl.java
  3. 1 1
      src/main/java/com/persagy/apm/energy/report/common/service/impl/EnvironmentPlatformServiceImpl.java
  4. 64 1
      src/main/java/com/persagy/apm/energy/report/common/utils/DataUtils.java
  5. 14 1
      src/main/java/com/persagy/apm/energy/report/environment/client/EnvironmentWebClient.java
  6. 30 0
      src/main/java/com/persagy/apm/energy/report/environment/model/dto/BatchQueryEnvListByParamDTO.java
  7. 22 0
      src/main/java/com/persagy/apm/energy/report/environment/model/vo/EnvRateInfoVO.java
  8. 11 1
      src/main/java/com/persagy/apm/energy/report/environment/service/IEnvironmentWebService.java
  9. 16 2
      src/main/java/com/persagy/apm/energy/report/environment/service/impl/EnvironmentWebClientWrapper.java
  10. 44 5
      src/main/java/com/persagy/apm/energy/report/environment/service/impl/IEnvironmentWebServiceImpl.java
  11. 2 2
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectAlarmDealInfo.java
  12. 3 0
      src/main/java/com/persagy/apm/energy/report/monthly/detail/hotel/project/model/vo/HotelProjectKpiItem.java
  13. 5 11
      src/main/java/com/persagy/apm/energy/report/workorder/service/IWorkOrderWebService.java
  14. 1 100
      src/main/java/com/persagy/apm/energy/report/workorder/service/impl/IWorkOrderWebServiceImpl.java

+ 24 - 0
src/main/java/com/persagy/apm/energy/report/common/service/CommonService.java

@@ -1,10 +1,14 @@
 package com.persagy.apm.energy.report.common.service;
 
 import com.persagy.apm.energy.report.common.dto.QueryPlatformParamDTO;
+import com.persagy.apm.energy.report.monthly.config.function.model.Function;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
 import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectAlarmDealInfo;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectKpiItem;
 import io.swagger.annotations.Api;
 
+import java.util.Date;
 import java.util.List;
 
 @Api(value = "公共service接口")
@@ -25,4 +29,24 @@ public interface CommonService {
      */
     Platform getPlatform(StatisticItems statisticItems, QueryPlatformParamDTO queryPlatformParamDTO);
 
+    /**
+     * 获取酒店项目报警处理信息
+     *
+     * @param projectId 项目id
+     * @param reportDate 报告月
+     * @return 酒店项目报警处理信息
+     */
+    HotelProjectAlarmDealInfo getHotelProjectAlarmDealInfo(String projectId, Date reportDate);
+
+    /**
+     * 获取酒店项目环境指标条目信息
+     *
+     * @param projectId 项目id
+     * @param reportDate 报告月
+     * @param projectIdList 当前报告类型下的所有项目id列表
+     * @param function  function信息
+     * @return 酒店项目环境指标条目信息
+     */
+    HotelProjectKpiItem getHotelProjectKpiItem(String projectId, Date reportDate, List<String> projectIdList, Function function);
+
 }

+ 69 - 2
src/main/java/com/persagy/apm/energy/report/common/service/impl/CommonServiceImpl.java

@@ -7,24 +7,33 @@ import com.persagy.apm.energy.report.common.dto.QueryPlatformParamDTO;
 import com.persagy.apm.energy.report.common.service.CommonService;
 import com.persagy.apm.energy.report.common.service.PlatformService;
 import com.persagy.apm.energy.report.common.utils.DataUtils;
+import com.persagy.apm.energy.report.common.utils.DateUtils;
 import com.persagy.apm.energy.report.common.utils.SpringContextHolder;
 import com.persagy.apm.energy.report.common.vo.PlatformAreaInfoVO;
+import com.persagy.apm.energy.report.environment.model.dto.BatchQueryEnvListByParamDTO;
+import com.persagy.apm.energy.report.environment.service.IEnvironmentWebService;
+import com.persagy.apm.energy.report.monthly.config.function.model.Function;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
 import com.persagy.apm.energy.report.monthly.config.type.constant.enums.BelongTypeEnum;
 import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectAlarmDealInfo;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectKpiItem;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryProjectDTO;
 import com.persagy.apm.energy.report.saasweb.model.vo.PoemsProjectVO;
 import com.persagy.apm.energy.report.saasweb.service.impl.SaasWebClientWrapper;
+import com.persagy.apm.energy.report.workorder.service.IWorkOrderWebService;
 import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 @Api(value = "公共service实现类")
 @Service
+@Slf4j
 public class CommonServiceImpl implements CommonService {
 
     @Autowired
@@ -33,6 +42,12 @@ public class CommonServiceImpl implements CommonService {
     @Autowired
     SpringContextHolder holder;
 
+    @Autowired
+    IWorkOrderWebService iWorkOrderWebService;
+
+    @Autowired
+    IEnvironmentWebService iEnvironmentWebService;
+
     @Override
     public List<String> getPjNameByPjId(List<String> pjIdList) {
         if (CollectionUtils.isEmpty(pjIdList)) {
@@ -84,4 +99,56 @@ public class CommonServiceImpl implements CommonService {
         }
         return platform;
     }
+
+    @Override
+    public HotelProjectAlarmDealInfo getHotelProjectAlarmDealInfo(String projectId, Date reportDate) {
+        Integer workCount = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "ask_end_time");
+        Integer dealCount = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "create_time");
+        Double completeRate = null;
+        if (null != workCount && workCount != 0 && null != dealCount) {
+            completeRate = DataUtils.parseDouble(dealCount) / workCount * 100;
+        }
+        HotelProjectAlarmDealInfo hotelProjectAlarmDealInfo = new HotelProjectAlarmDealInfo();
+        hotelProjectAlarmDealInfo.setHandledCount(dealCount);
+        hotelProjectAlarmDealInfo.setHandledPercent(completeRate);
+        hotelProjectAlarmDealInfo.setTotalCount(workCount);
+        return hotelProjectAlarmDealInfo;
+    }
+
+    @Override
+    public HotelProjectKpiItem getHotelProjectKpiItem(String projectId, Date reportDate, List<String> projectIdList, Function function) {
+        if (CollectionUtils.isEmpty(projectIdList) || StringUtils.isEmpty(projectId) || null == reportDate || null == function || StringUtils.isEmpty(function.getItemId())) {
+            return new HotelProjectKpiItem();
+        }
+        try {
+            String startTime = DateUtils.date2Str(reportDate, DateUtils.SDF_SECOND);
+            String endTime = DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDF_SECOND);
+            String itemId = function.getItemId();
+            String[] itemIdList = itemId.split("_");
+            String envTypdId = itemIdList[0];
+            String envParentTypeId = itemIdList[1];
+            BatchQueryEnvListByParamDTO batchQueryEnvListByParamDTO = new BatchQueryEnvListByParamDTO();
+            batchQueryEnvListByParamDTO.setProjectIdList(projectIdList);
+            batchQueryEnvListByParamDTO.setEnvTypeId(envTypdId);
+            batchQueryEnvListByParamDTO.setEnvParentTypeId(envParentTypeId);
+            batchQueryEnvListByParamDTO.setStartTime(startTime);
+            batchQueryEnvListByParamDTO.setEndTime(endTime);
+            List<HotelProjectKpiItem> hotelProjectKpiItemList = iEnvironmentWebService.getPjEnvRateInfoMap(batchQueryEnvListByParamDTO);
+            Map<String, Integer> sortMap = new HashMap<>();
+            sortMap.put("controlRates", 1);
+            DataUtils.sort(hotelProjectKpiItemList, sortMap);
+            for (int i = 0; i < hotelProjectKpiItemList.size(); i++) {
+                HotelProjectKpiItem hotelProjectKpiItem = hotelProjectKpiItemList.get(i);
+                if (!hotelProjectKpiItem.getProjectId().equals(projectId)) {
+                    continue;
+                }
+                hotelProjectKpiItem.setRankWithinClimateZone(i + 1);
+                return hotelProjectKpiItem;
+            }
+        } catch (Exception e) {
+            log.error("获取HotelProjectKpiItem的" + function.getItemId() + "数据失败:", e);
+        }
+        return new HotelProjectKpiItem();
+    }
+
 }

+ 1 - 1
src/main/java/com/persagy/apm/energy/report/common/service/impl/EnvironmentPlatformServiceImpl.java

@@ -59,7 +59,7 @@ public class EnvironmentPlatformServiceImpl implements PlatformService {
             paramDTO.setEnvParentTypeId(DataConstants.ENV_PARENT_TYPE_ID);
             paramDTO.setStartTime(DateUtils.date2Str(reportDate, DateUtils.SDF_SECOND));
             paramDTO.setEndTime(DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDF_SECOND));
-            PoemsFeignResponse<EnvAvgRateVO> response = environmentWebClientWrapper.listWorkOrderByParam(paramDTO);
+            PoemsFeignResponse<EnvAvgRateVO> response = environmentWebClientWrapper.listEnvTypeAvgRateByParam(paramDTO);
             List<EnvAvgRateVO> envAvgRateVOList = response.getContent();
             if (!CollectionUtils.isEmpty(envAvgRateVOList)) {
                 EnvAvgRateVO envAvgRateVO = envAvgRateVOList.get(0);

+ 64 - 1
src/main/java/com/persagy/apm/energy/report/common/utils/DataUtils.java

@@ -3,12 +3,17 @@ package com.persagy.apm.energy.report.common.utils;
 import org.nfunk.jep.JEP;
 import org.springframework.util.CollectionUtils;
 
+import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
-import java.util.List;
+import java.text.Collator;
+import java.util.*;
 import java.util.stream.Collectors;
 
 public class DataUtils {
+
+    private final static Collator CHINA_COLLATOR = Collator.getInstance(Locale.CHINA);
+
     /**
      * 对象转Double类型
      *
@@ -151,4 +156,62 @@ public class DataUtils {
         BigDecimal bigDecimal2 = new BigDecimal(d2);
         return bigDecimal1.subtract(bigDecimal2).doubleValue();
     }
+
+    public static void sort(List<?> list, final Map<String, Integer> comparatorMap) {
+        Comparator<Object> comparator = new Comparator<Object>() {
+
+            @Override
+            public int compare(Object o1, Object o2) {
+                // TODO Auto-generated method stub
+                for (Map.Entry<String, Integer> entry : comparatorMap.entrySet()) {
+                    int sort = 0;
+                    try {
+                        Comparable v1 = null;
+                        Comparable v2 = null;
+                        if (o1 instanceof Map) {
+                            v1 = (Comparable) ((Map) o1).get(entry.getKey());
+                            v2 = (Comparable) ((Map) o2).get(entry.getKey());
+                        } else {
+                            PropertyDescriptor pd1 = new PropertyDescriptor(entry.getKey(), o1.getClass());
+                            PropertyDescriptor pd2 = new PropertyDescriptor(entry.getKey(), o2.getClass());
+                            v1 = (Comparable) pd1.getReadMethod().invoke(o1);
+                            v2 = (Comparable) pd2.getReadMethod().invoke(o2);
+                        }
+                        if (entry.getValue() == 1) {
+                            if (v1 instanceof String) {
+                                sort = CHINA_COLLATOR.compare(v1, v2);
+                            } else {
+                                if (v1.compareTo(v2) > 0) {
+                                    sort = 1;
+                                } else if (v1.compareTo(v2) < 0) {
+                                    sort = -1;
+                                }
+                            }
+                        } else {
+                            if (v1 instanceof String) {
+                                sort = CHINA_COLLATOR.compare(v2, v1);
+                            } else {
+                                if (v1.compareTo(v2) > 0) {
+                                    sort = -1;
+                                } else if (v1.compareTo(v2) < 0) {
+                                    sort = 1;
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        // TODO Auto-generated catch block
+                        throw new RuntimeException(e);
+                    }
+                    if (sort != 0) {
+                        return sort;
+                    }
+                }
+
+                return 0;
+            }
+
+        };
+        Collections.sort(list, comparator);
+    }
+
 }

+ 14 - 1
src/main/java/com/persagy/apm/energy/report/environment/client/EnvironmentWebClient.java

@@ -5,6 +5,7 @@ import com.persagy.apm.energy.report.common.FeignClientNameConstants;
 import com.persagy.apm.energy.report.common.FeignConfig;
 import com.persagy.apm.energy.report.environment.client.fallback.EnvironmentWebClientFallbackFactory;
 import com.persagy.apm.energy.report.environment.model.vo.EnvAvgRateVO;
+import com.persagy.apm.energy.report.environment.model.vo.EnvRateInfoVO;
 import feign.Headers;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -26,6 +27,18 @@ public interface EnvironmentWebClient {
      */
     @PostMapping("/Spring/MVC/entrance/unifier/GetEnvTypeRate")
     @Headers({"Content-Type: application/x-www-form-urlencoded"})
-    PoemsFeignResponse<EnvAvgRateVO> listWorkOrderByParam(@RequestParam("jsonString") String queryEnvListByParamDTO);
+    PoemsFeignResponse<EnvAvgRateVO> listEnvTypeAvgRateByParam(@RequestParam("jsonString") String queryEnvListByParamDTO);
+
+    /**
+     * 根据条件查询环境对应指标的达标率信息
+     *
+     * @param queryEnvListByParamDTO 查询条件
+     * @return 环境对应指标的达标率信息
+     * @author wch
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    @PostMapping("/Spring/MVC/entrance/unifier/BatchQueryEnvTypeRate")
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<EnvRateInfoVO> listEnvTypeRateInfoByParam(@RequestParam("jsonString") String queryEnvListByParamDTO);
 
 }

+ 30 - 0
src/main/java/com/persagy/apm/energy/report/environment/model/dto/BatchQueryEnvListByParamDTO.java

@@ -0,0 +1,30 @@
+package com.persagy.apm.energy.report.environment.model.dto;
+
+import com.persagy.apm.common.model.dto.PoemsFeignBaseDTO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class BatchQueryEnvListByParamDTO extends PoemsFeignBaseDTO {
+
+    @ApiModelProperty("项目id")
+    private List<String> projectIdList;
+
+    @ApiModelProperty("环境类型id")
+    private String envTypeId;
+
+    @ApiModelProperty("环境父类型id")
+    private String envParentTypeId;
+
+    @ApiModelProperty("开始时间")
+    private String startTime;
+
+    @ApiModelProperty("结束时间")
+    private String endTime;
+}

+ 22 - 0
src/main/java/com/persagy/apm/energy/report/environment/model/vo/EnvRateInfoVO.java

@@ -0,0 +1,22 @@
+package com.persagy.apm.energy.report.environment.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Map;
+
+@ApiModel
+@Data
+public class EnvRateInfoVO {
+
+    @ApiModelProperty(value = "项目id")
+    private String projectId;
+
+    @ApiModelProperty(value = "平均达标率")
+    private Double avgNum;
+
+    @ApiModelProperty(value = "项目对应天的达标率")
+    private Map dayDataList;
+
+}

+ 11 - 1
src/main/java/com/persagy/apm/energy/report/environment/service/IEnvironmentWebService.java

@@ -2,10 +2,11 @@ package com.persagy.apm.energy.report.environment.service;
 
 import com.persagy.apm.energy.report.common.dto.QueryAreaPlatformParamDTO;
 import com.persagy.apm.energy.report.common.dto.QueryPjPlatformParamDTO;
+import com.persagy.apm.energy.report.environment.model.dto.BatchQueryEnvListByParamDTO;
 import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectKpiItem;
 import io.swagger.annotations.Api;
 
-import java.util.Date;
 import java.util.List;
 
 @Api(value = "环境健康管理service接口")
@@ -27,4 +28,13 @@ public interface IEnvironmentWebService {
      * @version V1.0 2021/5/19 4:04 下午
      */
     void getAreaTempRate(QueryAreaPlatformParamDTO queryAreaPlatformParamDTO, Platform platform);
+
+    /**
+     * 获取项目环境类型达标率数据
+     *
+     * @param batchQueryEnvListByParamDTO 查询条件对象
+     * @author wch
+     * @version V1.0 2021/5/19 4:04 下午
+     */
+    List<HotelProjectKpiItem> getPjEnvRateInfoMap(BatchQueryEnvListByParamDTO batchQueryEnvListByParamDTO);
 }

+ 16 - 2
src/main/java/com/persagy/apm/energy/report/environment/service/impl/EnvironmentWebClientWrapper.java

@@ -3,8 +3,10 @@ package com.persagy.apm.energy.report.environment.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.persagy.apm.common.response.PoemsFeignResponse;
 import com.persagy.apm.energy.report.environment.client.EnvironmentWebClient;
+import com.persagy.apm.energy.report.environment.model.dto.BatchQueryEnvListByParamDTO;
 import com.persagy.apm.energy.report.environment.model.dto.QueryEnvListByParamDTO;
 import com.persagy.apm.energy.report.environment.model.vo.EnvAvgRateVO;
+import com.persagy.apm.energy.report.environment.model.vo.EnvRateInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,8 +26,20 @@ public class EnvironmentWebClientWrapper {
      * @author wch
      * @version V1.0 2021/5/19 2:27 下午
      */
-    public PoemsFeignResponse<EnvAvgRateVO> listWorkOrderByParam(QueryEnvListByParamDTO queryEnvListByParamDTO) {
-        return environmentWebClient.listWorkOrderByParam(JSON.toJSONString(queryEnvListByParamDTO));
+    public PoemsFeignResponse<EnvAvgRateVO> listEnvTypeAvgRateByParam(QueryEnvListByParamDTO queryEnvListByParamDTO) {
+        return environmentWebClient.listEnvTypeAvgRateByParam(JSON.toJSONString(queryEnvListByParamDTO));
+    }
+
+    /**
+     * 根据条件查询环境对应指标达标率
+     *
+     * @param batchQueryEnvListByParamDTO 查询条件
+     * @return 环境对应指标达标率
+     * @author wch
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    public PoemsFeignResponse<EnvRateInfoVO> listEnvTypeRateInfoByParam(BatchQueryEnvListByParamDTO batchQueryEnvListByParamDTO) {
+        return environmentWebClient.listEnvTypeRateInfoByParam(JSON.toJSONString(batchQueryEnvListByParamDTO));
     }
 
 }

+ 44 - 5
src/main/java/com/persagy/apm/energy/report/environment/service/impl/IEnvironmentWebServiceImpl.java

@@ -7,22 +7,25 @@ import com.persagy.apm.energy.report.common.dto.QueryPjPlatformParamDTO;
 import com.persagy.apm.energy.report.common.service.CommonService;
 import com.persagy.apm.energy.report.common.utils.DataUtils;
 import com.persagy.apm.energy.report.common.utils.DateUtils;
+import com.persagy.apm.energy.report.environment.model.dto.BatchQueryEnvListByParamDTO;
 import com.persagy.apm.energy.report.environment.model.dto.QueryEnvListByParamDTO;
 import com.persagy.apm.energy.report.environment.model.vo.EnvAvgRateVO;
+import com.persagy.apm.energy.report.environment.model.vo.EnvRateInfoVO;
 import com.persagy.apm.energy.report.environment.service.IEnvironmentWebService;
 import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
+import com.persagy.apm.energy.report.monthly.detail.common.model.vo.DateGraphItemVO;
+import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectKpiItem;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.TreeMap;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
+@Slf4j
 public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
 
     @Autowired
@@ -52,7 +55,7 @@ public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
             paramDTO.setEnvParentTypeId(DataConstants.ENV_PARENT_TYPE_ID);
             paramDTO.setStartTime(DateUtils.date2Str(reportDate, DateUtils.SDF_SECOND));
             paramDTO.setEndTime(DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDF_SECOND));
-            PoemsFeignResponse<EnvAvgRateVO> response = environmentWebClientWrapper.listWorkOrderByParam(paramDTO);
+            PoemsFeignResponse<EnvAvgRateVO> response = environmentWebClientWrapper.listEnvTypeAvgRateByParam(paramDTO);
             List<EnvAvgRateVO> envAvgRateVOList = response.getContent();
             if (!CollectionUtils.isEmpty(envAvgRateVOList)) {
                 EnvAvgRateVO envAvgRateVO = envAvgRateVOList.get(0);
@@ -95,4 +98,40 @@ public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
         platform.setUnsatisfiedCount(unsatisfiedCount);
         platform.setUnsatisfiedProjects(pjNameList);
     }
+
+    @Override
+    public List<HotelProjectKpiItem> getPjEnvRateInfoMap(BatchQueryEnvListByParamDTO batchQueryEnvListByParamDTO) {
+        List<HotelProjectKpiItem> resultList = new ArrayList<>();
+        try {
+            PoemsFeignResponse<EnvRateInfoVO> response = environmentWebClientWrapper.listEnvTypeRateInfoByParam(batchQueryEnvListByParamDTO);
+            List<EnvRateInfoVO> envRateInfoVOList = response.getContent();
+            if (!CollectionUtils.isEmpty(envRateInfoVOList)) {
+                for (EnvRateInfoVO vo : envRateInfoVOList) {
+                    HotelProjectKpiItem hotelProjectKpiItem = new HotelProjectKpiItem();
+                    hotelProjectKpiItem.setControlRates(vo.getAvgNum());
+                    List<DateGraphItemVO> detailInfo = new ArrayList<>();
+                    hotelProjectKpiItem.setDetailInfo(detailInfo);
+                    hotelProjectKpiItem.setProjectId(vo.getProjectId());
+                    hotelProjectKpiItem.setProjectNumWithinClimateZone(batchQueryEnvListByParamDTO.getProjectIdList().size());
+                    Map dataInfoMap = vo.getDayDataList();
+                    if(null == dataInfoMap){
+                        dataInfoMap = new HashMap();
+                    }
+                    TreeMap<String, Double> dataMap =  new TreeMap<>(dataInfoMap);
+                    if (!CollectionUtils.isEmpty(dataMap)) {
+                        for (Map.Entry<String, Double> entry : dataMap.entrySet()) {
+                            DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
+                            dateGraphItemVO.setDate(DateUtils.str2Date(entry.getKey(),DateUtils.SDF_SECOND));
+                            dateGraphItemVO.setValue(entry.getValue());
+                            detailInfo.add(dateGraphItemVO);
+                        }
+                    }
+                    resultList.add(hotelProjectKpiItem);
+                }
+            }
+        } catch (Exception e) {
+            log.error("获取环境健康服务" + batchQueryEnvListByParamDTO.getEnvTypeId() + "类型达标率数据异常", e);
+        }
+        return resultList;
+    }
 }

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

@@ -20,9 +20,9 @@ public class HotelProjectAlarmDealInfo {
     @ApiModelProperty(value = "项目名称")
     private String projectName;
     @ApiModelProperty(value = "报警总条数")
-    private Double totalCount;
+    private Integer totalCount;
     @ApiModelProperty(value = "处理条数")
-    private Double handledCount;
+    private Integer handledCount;
     @ApiModelProperty(value = "处理率")
     private Double handledPercent;
 }

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

@@ -28,4 +28,7 @@ public class HotelProjectKpiItem extends HotelRankVO {
     @ApiModelProperty(value = "图表信息")
     private List<DateGraphItemVO> detailInfo;
 
+    @ApiModelProperty(value = "项目id")
+    private String projectId;
+
 }

+ 5 - 11
src/main/java/com/persagy/apm/energy/report/workorder/service/IWorkOrderWebService.java

@@ -10,21 +10,15 @@ import java.util.List;
 
 @Api(value = "工单管理service接口")
 public interface IWorkOrderWebService {
-    /**
-     * 获取项目能源管理平台运维工单完成率信息
-     *
-     * @param queryPjPlatformParamDTO 查询条件对象
-     * @author wch
-     * @version V1.0 2021/5/19 4:04 下午
-     */
-    void getPjWorkOrderRate(QueryPjPlatformParamDTO queryPjPlatformParamDTO, Platform platform);
 
     /**
-     * 获取大区能源管理平台运维工单完成率信息
+     * 根据查询类型获取工单数据量信息
      *
-     * @param queryAreaPlatformParamDTO 查询条件对象
+     * @param projectId 项目id
+     * @param reportDate 报告日期
+     * @param timeType 查询类型
      * @author wch
      * @version V1.0 2021/5/19 4:04 下午
      */
-    void getAreaWorkOrderRate(QueryAreaPlatformParamDTO queryAreaPlatformParamDTO, Platform platform);
+    Integer getWorkOrderNumByParam(String projectId, Date reportDate, String timeType);
 }

+ 1 - 100
src/main/java/com/persagy/apm/energy/report/workorder/service/impl/IWorkOrderWebServiceImpl.java

@@ -1,15 +1,7 @@
 package com.persagy.apm.energy.report.workorder.service.impl;
 
-import com.persagy.apm.common.response.PoemsFeignResponse;
-import com.persagy.apm.energy.report.common.dto.QueryAreaPlatformParamDTO;
-import com.persagy.apm.energy.report.common.dto.QueryPjPlatformParamDTO;
-import com.persagy.apm.energy.report.common.service.CommonService;
-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.detail.business.model.Platform;
-import com.persagy.apm.energy.report.workorder.client.WorkOrderWebClient;
 import com.persagy.apm.energy.report.workorder.model.WorkOrder;
-import com.persagy.apm.energy.report.workorder.model.dto.QueryWorkOrderListByParamDTO;
 import com.persagy.apm.energy.report.workorder.repository.WorkOrderRepository;
 import com.persagy.apm.energy.report.workorder.service.IWorkOrderWebService;
 import org.apache.commons.lang.StringUtils;
@@ -21,78 +13,17 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
 import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
-import java.util.TreeMap;
-import java.util.stream.Collectors;
 
 
 @Service
 public class IWorkOrderWebServiceImpl implements IWorkOrderWebService {
 
-    @Resource
-    private WorkOrderWebClient workOrderWebClient;
-    @Resource
-    private CommonService commonService;
     @Autowired
     private WorkOrderRepository workOrderRepository;
 
     @Override
-    public void getPjWorkOrderRate(QueryPjPlatformParamDTO queryPjPlatformParamDTO, Platform platform) {
-        TreeMap<Date, Double> date_rateMap = new TreeMap<>();
-        Date reportDate = queryPjPlatformParamDTO.getReportDate();
-        Date startDate = DateUtils.getFirstDayOfYear(reportDate);
-        while (startDate.before(DateUtils.getMonthOff(reportDate, 1))) {
-            date_rateMap.put(startDate, getWorkOrderCompleteRate(queryPjPlatformParamDTO.getProjectId(), startDate));
-            startDate = DateUtils.getMonthOff(startDate, 1);
-        }
-        List<Double> monthlySummaries = date_rateMap.values().stream().collect(Collectors.toList());
-        platform.setMonthlySummaries(monthlySummaries);
-    }
-
-    private Double getWorkOrderCompleteRate(String projectId, Date reportDate, String userId) {
-        Double completeRate = null;
-        try {
-            QueryWorkOrderListByParamDTO paramDTO = new QueryWorkOrderListByParamDTO();
-            paramDTO.setUser_id(userId);
-            paramDTO.setProject_id(projectId);
-            paramDTO.setTimeType("ask_end_time");
-            paramDTO.setStart_time(DateUtils.date2Str(reportDate, DateUtils.SDFSECOND));
-            paramDTO.setEnd_time(DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDFSECOND));
-            PoemsFeignResponse<Object> response = workOrderWebClient.listWorkOrderByParam(paramDTO);
-            Integer dealCount = response.getCount();
-            paramDTO.setTimeType("create_time");
-            response = workOrderWebClient.listWorkOrderByParam(paramDTO);
-            Integer workCount = response.getCount();
-            if (null != workCount && workCount != 0) {
-                completeRate = Double.valueOf(dealCount) / workCount * 100;
-            }
-            return completeRate;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return completeRate;
-    }
-
-
-    private Double getWorkOrderCompleteRate(String projectId, Date reportDate) {
-        Double completeRate = null;
-        try {
-            Integer workCount = getWorkOrderNumByParam(projectId, reportDate, "ask_end_time");
-            Integer dealCount = getWorkOrderNumByParam(projectId, reportDate, "create_time");
-            if (null != workCount && workCount != 0) {
-                completeRate = Double.valueOf(dealCount) / workCount * 100;
-            }
-            return completeRate;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return completeRate;
-    }
-
-    private Integer getWorkOrderNumByParam(String projectId, Date reportDate, String timeType) {
+    public Integer getWorkOrderNumByParam(String projectId, Date reportDate, String timeType) {
         try {
             String startTime = DateUtils.date2Str(reportDate, DateUtils.SDFSECOND);
             String endTime = DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDFSECOND);
@@ -134,34 +65,4 @@ public class IWorkOrderWebServiceImpl implements IWorkOrderWebService {
     }
 
 
-    @Override
-    public void getAreaWorkOrderRate(QueryAreaPlatformParamDTO queryAreaPlatformParamDTO, Platform platform) {
-        // 合格标准
-        Double standardValue = platform.getStandardValue();
-        // 校验规则
-        String qualifyFormula = platform.getQualifyFormula();
-        // 达标数量
-        Integer satisfiedCount = 0;
-        // 未达标数量
-        Integer unsatisfiedCount = 0;
-        // 未达标项目id列表
-        List<String> unsatisfiedPjIdList = new ArrayList<>();
-        for (String pjId : queryAreaPlatformParamDTO.getProjectIdList()) {
-            Double completeRate = getWorkOrderCompleteRate(pjId, queryAreaPlatformParamDTO.getReportDate(), queryAreaPlatformParamDTO.getUserId());
-            if (null != completeRate && null != standardValue) {
-                if (DataUtils.getQualifyResult(standardValue, qualifyFormula, completeRate) == 0.0) {
-                    unsatisfiedCount++;
-                    unsatisfiedPjIdList.add(pjId);
-                } else {
-                    satisfiedCount++;
-                }
-            }
-        }
-        // 根据未达标项目id列表获取不达标项目名称
-        List<String> pjNameList = commonService.getPjNameByPjId(unsatisfiedPjIdList);
-        platform.setSatisfiedCount(satisfiedCount);
-        platform.setUnsatisfiedCount(unsatisfiedCount);
-        platform.setUnsatisfiedProjects(pjNameList);
-    }
-
 }