瀏覽代碼

运行状态时间 逻辑修改

miaolijing 3 年之前
父節點
當前提交
50e05c2345

+ 38 - 9
src/main/java/com/persagy/apm/diagnose/maintenance/service/impl/ProjectDataRecordServiceImpl.java

@@ -61,6 +61,13 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
 
     @Value(value = "${energy.eq.run.system.code}")
     private String systemCode;
+
+    //测试环境  运行状态 上下限值
+    @Value(value = "${energy.eq.run.state.up.limit}")
+    private Double runStateUpLimit;
+    @Value(value = "${energy.eq.run.state.down.limit}")
+    private Double runStateDownLimit;
+
     //报警分类
     public final static String alarmSplit = "_";
     private final static Long ConfigItemKeyTime = 60 * 60 * 1000L;
@@ -616,11 +623,16 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
      * 冷却塔 日均计算
      */
     Date computeCoolTowerData(Date startDate, Date endDate, String projectId, String cTObjId, EnumMaintenanceIndicatorType indicatorType) throws Exception {
+//        Date runDate = null;
+//        //获取冷却塔下所有风机运行时时间列表(所有风机运行时间合并为一组时间列表)
+//        Map<Date, List<Date>> allDateRunDataMap = getCoolTowerRunDateMap(projectId, startDate, endDate);
+//        //获取持续运行2小时之后的  时间点集合
+//        Map<Date, List<Date>> dateRunDataMap = getCoolTowerContinuedRunDateMap(allDateRunDataMap);
+
         Date runDate = null;
-        //获取冷却塔下所有风机运行时时间列表(所有风机运行时间合并为一组时间列表)
-        Map<Date, List<Date>> allDateRunDataMap = getCoolTowerRunDateMap(projectId, startDate, endDate);
-        //获取持续运行2小时之后的  时间点集合
-        Map<Date, List<Date>> dateRunDataMap = getCoolTowerContinuedRunDateMap(allDateRunDataMap);
+        Map<Date, List<TimeDataDTO>> dayTimeDataMap = getServiceDataFromCenterDataService(projectId, cTObjId, EnumCoolWaterPointNameType.RunStatus.getCode(), startDate, endDate);
+        //获取日 对应运行时间集合
+        Map<Date, List<Date>> dateRunDataMap = getContinuedRunDateMap(dayTimeDataMap);
         //获取冷却水回水干管温度数据集合
         Map<Date, List<TimeDataDTO>> dayCoolWaterMainReturnTempMap = null;
         //获取室外湿球温度数据集合
@@ -791,10 +803,17 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                     }
                     List<Date> dateList = new ArrayList<>();
                     for (TimeDataDTO dto : dataDTOList) {
+                        if (null == dto.getData()){
+                            continue;
+                        }
                         String time = dto.getTime();
                         Date getDate = com.persagy.apm.diagnose.utils.DateUtils.str2Date(time, com.persagy.apm.diagnose.utils.DateUtils.SDFSECOND);
                         if (getDate.compareTo(twoHourDate) > 0) {
-                            if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+//                            if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+//                                dateList.add(getDate);
+//                            }
+                            //TODO 测试 运行状态
+                            if (dto.getData() > runStateDownLimit && dto.getData() < runStateUpLimit) {
                                 dateList.add(getDate);
                             }
                         }
@@ -864,8 +883,14 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                         dateList = dateRunDataMap.get(dayDate);
                     }
                     for (TimeDataDTO dto : dataDTOList) {
+                        if (null == dto.getData()){
+                            continue;
+                        }
                         Date getDate = com.persagy.apm.diagnose.utils.DateUtils.str2Date(dto.getTime(), com.persagy.apm.diagnose.utils.DateUtils.SDFSECOND);
-                        if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+//                        if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+//                            dateList.add(getDate);
+//                        }
+                        if (dto.getData() > runStateDownLimit && dto.getData() < runStateUpLimit) {
                             dateList.add(getDate);
                         }
                     }
@@ -907,10 +932,14 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
     public String getFirstRunDate(List<TimeDataDTO> dataDTOList) {
         try {
             for (TimeDataDTO dto : dataDTOList) {
-                //
-                if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+                if (null == dto.getData()){
+                    continue;
+                }
+//                if (Objects.equals(EnumRunStatusType.Open.getCode(), dto.getData())) {
+//                    return dto.getTime();
+//                }
+                if (dto.getData() > runStateDownLimit && dto.getData() < runStateUpLimit) {
                     return dto.getTime();
-                    //return com.persagy.apm.diagnose.utils.DateUtils.str2Date(dto.getTime(), com.persagy.apm.diagnose.utils.DateUtils.SDF_SECOND);
                 }
             }
         } catch (Exception e) {