|
|
|
@ -59,7 +59,7 @@ public class getLiquidLevelInformation { |
|
|
|
|
|
|
|
|
|
List<DeviceInfo> deviceInfos = mongoTemplate.find(query, DeviceInfo.class); |
|
|
|
|
//如果为true的情况则表示是连续排放 生成告警
|
|
|
|
|
if (this.isDecreasing(deviceInfos)) { |
|
|
|
|
if (this.isIncreasing(deviceInfos)) { |
|
|
|
|
//?equipmentCode=code1&longitude=115.518539&latitude=38.875441
|
|
|
|
|
System.out.println("是连续下降"); |
|
|
|
|
String param = "equipmentCode=" + deviceInfos.get(deviceInfos.size() - 1).getDeviceId() + "&longitude=" + deviceInfos.get(deviceInfos.size() - 1).getLongitude() + "&latitude=" + deviceInfos.get(deviceInfos.size() - 1).getLatitude(); |
|
|
|
@ -69,7 +69,18 @@ public class getLiquidLevelInformation { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
public boolean isIncreasing(List<DeviceInfo> arr) { |
|
|
|
|
if (arr == null || arr.size() < 2) { |
|
|
|
|
return false; // 数据集合为空或只有单个元素,不能判定是否连续增加
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果最早的数据小于最新的数据,说明液位增加了
|
|
|
|
|
if (arr.get(0).getFuelLevel().compareTo(arr.get(arr.size() - 1).getFuelLevel()) < 0) { |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//判断 当前设备的液位是否是连续下降的
|
|
|
|
|
public boolean isDecreasing(List<DeviceInfo> arr) { |
|
|
|
|
if (arr == null || arr.size() < 2) { |
|
|
|
|