Commit 469660a6 authored by 张森's avatar 张森

31968 站端设备平台v5>关键数据>稳压泵,稳压泵启停间隔时间不正确 来源Bug-24725

parent 9926c449
......@@ -174,10 +174,11 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
public long getAllPressurePumpStartStopInterval(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong) {
String intervalTime1 = nowStrLong;
String intervalTime2 = nowStrLong;
if (!ObjectUtils.isEmpty(dataListFilterTrue) && dataListFilterTrue.size() > 1) {
dataList = dataList.stream().filter(item -> item.getValue().equals("true")).sorted(Comparator.comparing(IotDataVO::getCreatedTime).reversed()).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(dataList) && dataList.size() > 1) {
//获取启动列表中
intervalTime1 = dataListFilterTrue.get(0).getCreatedTime();
intervalTime2 = dataListFilterTrue.get(1).getCreatedTime();
intervalTime1 = dataList.get(0).getCreatedTime();
intervalTime2 = dataList.get(1).getCreatedTime();
}
// 结果向上取整
double ceil = Math.ceil(Math.abs(DateUtils.getDurationSeconds(intervalTime1, intervalTime2, DateUtils.DATE_TIME_PATTERN)) * 1.0 / Double.parseDouble(PressurePumpRelateEnum.ONE_HOUR_MINUTE.getValue()));
......
......@@ -150,6 +150,9 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
String dayAvgStartNum = dayAvgCount == 0 ? "0" : df.format(dayAvgCount / (double) Math.abs(Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue())));
pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
String prefix = null;
// 获取redis稳压泵缓存数据,默认JSON配置最近4小时
List<IotDataVO> DataList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpStart, null, bizOrgCode);
List<IotDataVO> dateList2 = new ArrayList<>();
for (Map<String, Object> item : pressurePumpInfo.getRecords()) {
String suffix = null;
String iotCode = item.get("iot_code").toString();
......@@ -209,25 +212,22 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
item.put("equipment_index_name", "无信号");
item.put("update_time", false);
}
if(CollectionUtils.isEmpty(DataList)){
//从influxdb中获取最近一次启停间隔
List<Map<String, String>> iotDataList = pressurePumpService.getIotTopSingleField(top, prefix, null, null, pressurePumpStart);
iotDataList.forEach(e -> {
try {
IotDataVO iotDataVO = (IotDataVO) pressurePumpService.mapToObject(e, IotDataVO.class, pressurePumpStart);
dateList2.add(iotDataVO);
} catch (Exception el) {
throw new RuntimeException();
}
});
}
//稳压泵当前状态 无告警并且启动时长小于5分钟为正常
// item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue());
}
// 获取redis稳压泵缓存数据,默认JSON配置最近4小时
List<IotDataVO> DataList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpStart, null, bizOrgCode);
if(CollectionUtils.isEmpty(DataList)){
//从influxdb中获取最近一次启停间隔
List<Map<String, String>> iotDataList = pressurePumpService.getIotTopSingleField(top, prefix, null, null, pressurePumpStart);
iotDataList.forEach(e -> {
try {
IotDataVO iotDataVO = (IotDataVO) pressurePumpService.mapToObject(e, IotDataVO.class, pressurePumpStart);
DataList.add(iotDataVO);
} catch (Exception el) {
throw new RuntimeException();
}
});
}
interval =pressurePumpService.getAllPressurePumpStartStopInterval(DataList, dataListFilterTrue, dataListFilterFalse, nowStrLong);
interval =pressurePumpService.getAllPressurePumpStartStopInterval(dateList2, dataListFilterTrue, dataListFilterFalse, nowStrLong);
double finalDiffMinute = (double) interval;
pressurePumpInfo.getRecords().stream(
).map(item -> {
......
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