Commit 97f33bb8 authored by 高建强's avatar 高建强

item:稳压泵诊断分析bug修改

parent ae3be219
......@@ -23,7 +23,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
......@@ -360,6 +359,24 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (!CollectionUtils.isEmpty(trueDataList)) {
durationTime = intervalTime2;
}
if (!CollectionUtils.isEmpty(falseDataList)) {
try {
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
ResponseModel pipeResponseModel = iotFeign.selectListNew(appKey, product, token, prefix, null, stop5BeforeTime, intervalTime2, null, "FHS_PipePressureDetector_PipePressure");
if (200 == pipeResponseModel.getStatus()) {
String pipeJson = JSON.toJSONString(pipeResponseModel.getResult());
List<Map<String, String>> pipeDataList = (List<Map<String, String>>) JSONArray.parse(pipeJson);
List<Map<String, String>> collect1 = pipeDataList.stream().filter(o -> o.containsKey("FHS_PipePressureDetector_PipePressure")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect1)) {
double val1 = Double.parseDouble(collect1.get(0).get("FHS_PipePressureDetector_PipePressure"));
double val2 = Double.parseDouble(collect1.get(collect1.size() - 1).get("FHS_PipePressureDetector_PipePressure"));
pipeMap.put("value", Math.abs(val1 - val2) > 0.05 ? "异常" : "正常");
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
} else {
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
durationTime = trueDataList.get(0).get("createdTime");
......
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