|
@@ -11,10 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author dzc
|
|
* @author dzc
|
|
@@ -55,6 +52,7 @@ public class HistoryLoopHealthLevelController {
|
|
log.info("调用query接口:{}", JSON.toJSONString(request));
|
|
log.info("调用query接口:{}", JSON.toJSONString(request));
|
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
|
Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
|
|
Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
|
|
String beginDateStr = (String) rangeMap.get("from");
|
|
String beginDateStr = (String) rangeMap.get("from");
|
|
@@ -62,6 +60,10 @@ public class HistoryLoopHealthLevelController {
|
|
Date beginDated = format.parse(beginDateStr);
|
|
Date beginDated = format.parse(beginDateStr);
|
|
Date endDated = format.parse(endDateStr);
|
|
Date endDated = format.parse(endDateStr);
|
|
|
|
|
|
|
|
+ Map<String,Object> rangeRawMap = (Map<String, Object>) request.get("rangeRaw");
|
|
|
|
+ String fromType = (String) rangeRawMap.get("from");
|
|
|
|
+ String toType = (String) rangeRawMap.get("to");
|
|
|
|
+
|
|
String beginDate = format.format(beginDated);
|
|
String beginDate = format.format(beginDated);
|
|
String endDate = format.format(endDated);
|
|
String endDate = format.format(endDated);
|
|
|
|
|
|
@@ -80,8 +82,14 @@ public class HistoryLoopHealthLevelController {
|
|
|
|
|
|
|
|
|
|
ArrayList<ResultD> list = new ArrayList<>();
|
|
ArrayList<ResultD> list = new ArrayList<>();
|
|
-
|
|
|
|
- Map<String, List<LoopHealthLevel>> loopHealthLevelMap = dashboardService.getLoopHealthLevels(deviceName, sysName, beginDate,endDate);
|
|
|
|
|
|
+ Map<String, List<LoopHealthLevel>> loopHealthLevelMap = new HashMap<>();
|
|
|
|
+ if ("now/y".equals(fromType)){
|
|
|
|
+ beginDate = formatMonth.format(beginDated);
|
|
|
|
+ endDate = formatMonth.format(endDated);
|
|
|
|
+ loopHealthLevelMap = dashboardService.getLoopHealthLevelsMonth(deviceName, sysName, beginDate,endDate);
|
|
|
|
+ }else {
|
|
|
|
+ loopHealthLevelMap = dashboardService.getLoopHealthLevels(deviceName, sysName, beginDate,endDate);
|
|
|
|
+ }
|
|
|
|
|
|
for (String key : loopHealthLevelMap.keySet()) {
|
|
for (String key : loopHealthLevelMap.keySet()) {
|
|
ResultD<String[]> result = new ResultD<>();
|
|
ResultD<String[]> result = new ResultD<>();
|
|
@@ -89,7 +97,13 @@ public class HistoryLoopHealthLevelController {
|
|
ArrayList<String[]> strings = new ArrayList<>();
|
|
ArrayList<String[]> strings = new ArrayList<>();
|
|
List<LoopHealthLevel> itemList = loopHealthLevelMap.get(key);
|
|
List<LoopHealthLevel> itemList = loopHealthLevelMap.get(key);
|
|
for (LoopHealthLevel item : itemList) {
|
|
for (LoopHealthLevel item : itemList) {
|
|
- Date dateTime = format.parse(item.getTime());
|
|
|
|
|
|
+ Date dateTime = new Date();
|
|
|
|
+ if ("now/y".equals(fromType)){
|
|
|
|
+ dateTime = formatMonth.parse(item.getTime());
|
|
|
|
+ }else {
|
|
|
|
+ dateTime = format.parse(item.getTime());
|
|
|
|
+ }
|
|
|
|
+
|
|
String[] v = new String[]{item.getNumber(),String.valueOf(dateTime.getTime())};
|
|
String[] v = new String[]{item.getNumber(),String.valueOf(dateTime.getTime())};
|
|
strings.add(v);
|
|
strings.add(v);
|
|
}
|
|
}
|