From 032c41299701ee41f1093267225cf0992227e99a Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Thu, 12 Sep 2019 16:37:34 +0800
Subject: [PATCH] 预测接口温度判断
---
src/main/java/com/moral/controller/ScreenController.java | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index ab58fc3..5733c13 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -1057,14 +1057,12 @@
Date date = new SimpleDateFormat("yy-MM-dd").parse(intoTime);
DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
String alterTime = df1.format(date.getTime()-15*24*60*60*1000);
- System.out.println("startTime:"+alterTime);
parameters.put("time", alterTime);
ParameterUtils.getTimeType4Time(parameters);
String monitor_point_id = (String) parameters.get("monitorPoint");
parameters.put("monitorPointId", parameters.remove("monitorPoint"));
String[] sensorKeys = parameters.remove("sensorKey").toString().split(",");
parameters.put("sensors", Arrays.asList(sensorKeys));
- // monitorPointService.isCompensateCalculation(parameters);
List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
Map<String, Object> mpMap = new HashMap<>();
@@ -1074,8 +1072,18 @@
weatherParameters.put("organizationId", mpMap.get("organization_id"));
weatherParameters.put("time", intoTime);
//������������������
- Map<String, Object> weatherMap = weatherService.get15DayWeatherDataByRegion(weatherParameters);
- Map<String, Object> tempMap = TempAllocationUtils.tempAllocation(weatherMap);
+ Map<String, Object> weatherMap = new HashMap<>();
+ Map<String, Object> tempMap = new HashMap<>();
+ Boolean tf = false;
+ for(int i=0;i<sensorKeys.length;i++) {
+ if(sensorKeys[i].equals("e7")) {
+ tf = true;
+ }
+ }
+ if (tf) {
+ weatherMap = weatherService.get15DayWeatherDataByRegion(weatherParameters);
+ tempMap = TempAllocationUtils.tempAllocation(weatherMap);
+ }
//������������������
Map<String, Map<String, Object>> sensorUnitMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
@@ -1083,7 +1091,9 @@
String time = map.get("time").toString();
time = time.substring(time.length() - 2);
map.put("time", Integer.valueOf(time));
- map.put("temp", tempMap.get(map.get("time").toString()));
+ if (tempMap!=null) {
+ map.put("temp", tempMap.get(map.get("time").toString()));
+ }
List<Number> values = new ArrayList<Number>();
List<String> units = new ArrayList<String>();
for (String string : sensorKeys) {
--
Gitblit v1.8.0