Commit e42c19db authored by 高建强's avatar 高建强

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

parent fbbe7b46
......@@ -239,7 +239,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
suffix = iotCode.toString().substring(8);
ResponseModel responseModel = null;
try {
responseModel = iotFeign.selectList(appKey, product, token, startTime, endTime, prefix, suffix, pressurePumpStart);
responseModel = iotFeign.selectListNew(appKey, product, token, prefix, startTime, endTime, null, pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -248,7 +248,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json);
if (!CollectionUtils.isEmpty(dataList)) {
Collections.reverse(dataList);
Map<String, List<Map<String, String>>> dataMap = dataList.stream().collect(Collectors.groupingBy(e -> e.get("time").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).replace("T", " ")));
timeList.forEach(t -> {
List<Map<String, String>> data = dataMap.get(t);
if (!CollectionUtils.isEmpty(data)) {
......@@ -358,8 +358,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (200 == stopResponseModel.getStatus()) {
String stopJson = JSON.toJSONString(stopResponseModel.getResult());
List<Map<String, String>> stopDataList = (List<Map<String, String>>) JSONArray.parse(stopJson);
if (!CollectionUtils.isEmpty(stopDataList)) {
intervalTime = stopDataList.get(0).get("time").substring(0, 19).replace("T", " ");
List<Map<String, String>> collect = stopDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19).replace("T", " ");
// 停泵前的前5分钟,判断管网压力状态
try {
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
......@@ -367,9 +368,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (200 == pipeResponseModel.getStatus()) {
String pipeJson = JSON.toJSONString(pipeResponseModel.getResult());
List<Map<String, String>> pipeDataList = (List<Map<String, String>>) JSONArray.parse(pipeJson);
if (!CollectionUtils.isEmpty(pipeDataList)) {
int val1 = Integer.parseInt(pipeDataList.get(0).get("FHS_PipePressureDetector_PipePressure"));
int val2 = Integer.parseInt(pipeDataList.get(pipeDataList.size() - 1).get("FHS_PipePressureDetector_PipePressure"));
List<Map<String, String>> collect1 = pipeDataList.stream().filter(o -> o.containsKey("FHS_PipePressureDetector_PipePressure")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect1)) {
int val1 = Integer.parseInt(collect1.get(0).get("FHS_PipePressureDetector_PipePressure"));
int val2 = Integer.parseInt(collect1.get(pipeDataList.size() - 1).get("FHS_PipePressureDetector_PipePressure"));
pipeMap.put("value", (val1 - val2) > 0.05 ? "异常" : "正常");
}
}
......@@ -382,8 +384,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (200 == startResponseModel.getStatus()) {
String startJson = JSON.toJSONString(startResponseModel.getResult());
List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson);
if (!CollectionUtils.isEmpty(startDataList) && startDataList.size() > 1) {
durationTime = startDataList.get(1).get("time").substring(0, 19).replace("T", " ");
List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect) && collect.size() > 1) {
durationTime = collect.get(1).get("createdTime").substring(0, 19).replace("T", " ");
}
}
} else {
......@@ -391,8 +394,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (200 == startResponseModel.getStatus()) {
String startJson = JSON.toJSONString(startResponseModel.getResult());
List<Map<String, String>> startDataList = (List<Map<String, String>>) JSONArray.parse(startJson);
if (!CollectionUtils.isEmpty(startDataList)) {
intervalTime = startDataList.get(0).get("time").substring(0, 19).replace("T", " ");
List<Map<String, String>> collect = startDataList.stream().filter(o -> o.containsKey("createdTime")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
intervalTime = collect.get(0).get("createdTime").substring(0, 19).replace("T", " ");
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