Commit 42abe034 authored by 高建强's avatar 高建强

item:稳压泵诊断分析接口修改

parent f8fec243
...@@ -248,11 +248,11 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -248,11 +248,11 @@ public class EmergencyServiceImpl implements IEmergencyService {
List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json); List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json);
if (!CollectionUtils.isEmpty(dataList)) { if (!CollectionUtils.isEmpty(dataList)) {
Collections.reverse(dataList); Collections.reverse(dataList);
Map<String, List<Map<String, String>>> dataMap = dataList.stream().filter(y -> y.containsKey("createdTime")).collect(Collectors.groupingBy(e -> e.get("createdTime").substring(5, 16).replace("T", " "))); Map<String, List<Map<String, String>>> dataMap = dataList.stream().filter(y -> y.containsKey("createdTime")).collect(Collectors.groupingBy(e -> e.get("createdTime").substring(5, 16)));
timeList.forEach(t -> { timeList.forEach(t -> {
List<Map<String, String>> data = dataMap.get(t); List<Map<String, String>> data = dataMap.get(t);
if (!CollectionUtils.isEmpty(data)) { if (!CollectionUtils.isEmpty(data)) {
List<Map<String, String>> yDataList = dataMap.get(t).stream().filter(o -> "true".equals(o.get(pressurePumpStart).toString())).collect(Collectors.toList()); List<Map<String, String>> yDataList = data.stream().filter(o -> "true".equals(o.get(pressurePumpStart))).collect(Collectors.toList());
yList.add(CollectionUtils.isEmpty(yDataList) ? 0 : 1); yList.add(CollectionUtils.isEmpty(yDataList) ? 0 : 1);
} else { } else {
yList.add(0); yList.add(0);
...@@ -331,13 +331,13 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -331,13 +331,13 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (200 == halfResponseModel.getStatus()) { if (200 == halfResponseModel.getStatus()) {
String json = JSON.toJSONString(halfResponseModel.getResult()); String json = JSON.toJSONString(halfResponseModel.getResult());
List<Map<String, String>> halfDataList = (List<Map<String, String>>) JSONArray.parse(json); List<Map<String, String>> halfDataList = (List<Map<String, String>>) JSONArray.parse(json);
List<Map<String, String>> halfCollect = halfDataList.stream().filter(o -> "true".equals(o.get(pressurePumpStart).toString())).collect(Collectors.toList()); List<Map<String, String>> halfCollect = halfDataList.stream().filter(o -> "true".equals(o.get(pressurePumpStart))).collect(Collectors.toList());
halfNum.addAndGet(halfCollect.size()); halfNum.addAndGet(halfCollect.size());
} }
if (200 == twoResponseModel.getStatus()) { if (200 == twoResponseModel.getStatus()) {
String json = JSON.toJSONString(twoResponseModel.getResult()); String json = JSON.toJSONString(twoResponseModel.getResult());
List<Map<String, String>> twoDataList = (List<Map<String, String>>) JSONArray.parse(json); List<Map<String, String>> twoDataList = (List<Map<String, String>>) JSONArray.parse(json);
List<Map<String, String>> twoCollect = twoDataList.stream().filter(o -> "true".equals(o.get(pressurePumpStart).toString())).collect(Collectors.toList()); List<Map<String, String>> twoCollect = twoDataList.stream().filter(o -> "true".equals(o.get(pressurePumpStart))).collect(Collectors.toList());
twoNum.addAndGet(twoCollect.size()); twoNum.addAndGet(twoCollect.size());
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -360,7 +360,7 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -360,7 +360,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
List<Map<String, String>> stopDataList = (List<Map<String, String>>) JSONArray.parse(stopJson); List<Map<String, String>> stopDataList = (List<Map<String, String>>) JSONArray.parse(stopJson);
List<Map<String, String>> collect = stopDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList()); List<Map<String, String>> collect = stopDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) { if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19).replace("T", " "); intervalTime = collect.get(0).get("createdTime").substring(0, 19);
// 停泵前的前5分钟,判断管网压力状态 // 停泵前的前5分钟,判断管网压力状态
try { try {
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss"); String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
...@@ -396,7 +396,7 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -396,7 +396,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson); List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson);
List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList()); List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) { if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19).replace("T", " "); intervalTime = collect.get(0).get("createdTime").substring(0, 19);
durationTime = intervalTime; durationTime = intervalTime;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment