diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java index 3590a7f..1e99983 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/DataQueryService.java @@ -8,6 +8,8 @@ import com.inspur.industrial.utils.InfluxdbTimeUtil; import com.inspur.system.domain.SysConfig; import com.inspur.system.service.ISysConfigService; import com.inspur.system.service.influx.InfluxDBService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -25,7 +27,7 @@ import java.util.Map; */ @Service public class DataQueryService implements IDataQueryService { - + private static final Logger logger = LoggerFactory.getLogger(DataQueryService.class); @Resource private InfluxDBService influxDBUtils; @@ -230,6 +232,7 @@ public class DataQueryService implements IDataQueryService { LocalDateTime etime = LocalDateTime.parse(endTime); long intervalHours = ChronoUnit.HOURS.between(stime, etime); List> list = new ArrayList<>(); + logger.info("查询时间差:" + intervalHours); if(intervalHours <= 6){//6小时内全查 list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime); }else if(intervalHours <= 7*24 ){//7天内,每30s一个 @@ -253,12 +256,14 @@ public class DataQueryService implements IDataQueryService { } for (Map data : list) { //取两位小数 - columnList.add(data.get(columnName) == null ? 0.0 : Math.round(Double.parseDouble(data.get(columnName).toString()) * 100) / 100.0); - columnList.add(data.get(columnName)); - statusList.add((Double)data.get("ipc_status")); - LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - timelist.add(time.format(formatter)); +// columnList.add(data.get(columnName) == null ? 0.0 : ); + if(data.get(columnName) != null) { + columnList.add(Math.round(Double.parseDouble(data.get(columnName).toString()) * 100) / 100.0); + statusList.add((Double) data.get("ipc_status")); + LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + timelist.add(time.format(formatter)); + } } resMap.put("y", columnList); @@ -426,7 +431,7 @@ public class DataQueryService implements IDataQueryService { * @return */ private List> selectLongTimeDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime, String interval){ - String sql = "select time, ipc_status, mean(" + columnName + ") from " + tableName + " where time >= '" + startTime + "' and time <= '" + endTime + "' group by time(" + interval +")"; + String sql = "select time, mean(ipc_status) as ipc_status, mean(" + columnName + ") from " + tableName + " where time >= '" + startTime + "' and time <= '" + endTime + "' group by time(" + interval +") fill(null)"; return influxDBUtils.queryResultProcess(influxDBUtils.query(sql)); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/IpcUtil.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/IpcUtil.java index fc15349..538bd5c 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/IpcUtil.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/IpcUtil.java @@ -79,8 +79,7 @@ public class IpcUtil { ipcAlarmRecord.setEquipId(rule.getEquipId()); ipcAlarmRecord.setSensorId(rule.getSensorId()); String name = rule.getAlarmNameKey(); - float value = (float)map.get(name); - ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf(value)); + ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf((Float)map.get(name))); ipcAlarmRecord.setNameKey(name); ipcAlarmRecord.setContent(type == 0 ? "(开机监测)" + rule.getReferenceName() : rule.getReferenceName()); ipcAlarmRecord.setStatus(0); diff --git a/zfipc-ui/src/views/zf/bigscreen/bigscreen.vue b/zfipc-ui/src/views/zf/bigscreen/bigscreen.vue index 4d24675..d76d772 100644 --- a/zfipc-ui/src/views/zf/bigscreen/bigscreen.vue +++ b/zfipc-ui/src/views/zf/bigscreen/bigscreen.vue @@ -456,6 +456,20 @@ > ZFSC4超压底缸加压系统油品特性 + +
吸油油品监测
+
回油油品监测
+
底层油品监测
+
{{ cylyykld21 }} - -
吸油油品监测
-
回油油品监测
-
底层油品监测
-
- + + ZFSC4超压底缸加压系统油品特性 + +
吸油油品监测
+
回油油品监测
+
底层油品监测
+
{{ yykld21 }} - -
吸油油品监测
-
回油油品监测
-
底层油品监测
-
- + + ZFSC4超压底缸加压系统油品特性 + +
吸油油品监测
+
回油油品监测
+
底层油品监测
+
{{ bsyykld21 }} - -
吸油油品监测
-
回油油品监测
-
底层油品监测
-
- + + 查 询