bug修复

This commit is contained in:
zhangjunwen 2024-06-14 15:57:55 +08:00
parent 64d43ba2a0
commit 7722a4b738
3 changed files with 157 additions and 136 deletions

View File

@ -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<Map<String, Object>> list = new ArrayList<>();
logger.info("查询时间差:" + intervalHours);
if(intervalHours <= 6){//6小时内全查
list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime);
}else if(intervalHours <= 7*24 ){//7天内每30s一个
@ -253,13 +256,15 @@ public class DataQueryService implements IDataQueryService {
}
for (Map<String, Object> 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));
// 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);
resMap.put("x", timelist);
@ -426,7 +431,7 @@ public class DataQueryService implements IDataQueryService {
* @return
*/
private List<Map<String, Object>> 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));
}

View File

@ -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);

View File

@ -456,6 +456,20 @@
>
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
<el-main class="main">
<el-row style="height: 10%">
<div
v-if="this.cylipcstatus == 30"
style="text-align:center;margin-left:50px"
>吸油油品监测</div>
<div
v-if="this.cylipcstatus == 40"
style="text-align:center;margin-left:50px"
>回油油品监测</div>
<div
v-if="this.cylipcstatus == 60"
style="text-align:center;margin-left:50px"
>底层油品监测</div>
</el-row>
<el-row style="height: 40%">
<el-col
:span="8"
@ -534,21 +548,8 @@
<span class="numCol">{{ cylyykld21 }}</span>
</el-col>
</el-row>
<el-row>
<div
v-if="this.cylipcstatus == 30"
style="text-align:center;margin-left:50px;margin-top:10px"
>吸油油品监测</div>
<div
v-if="this.cylipcstatus == 40"
style="text-align:center;margin-left:50px;margin-top:10px"
>回油油品监测</div>
<div
v-if="this.cylipcstatus == 60"
style="text-align:center;margin-left:50px;margin-top:10px"
>底层油品监测</div>
</el-row>
<el-row style="height: 50%">
<el-row style="height: 40%">
<el-col
:span="24"
id="cylyykldtx"
@ -1319,6 +1320,20 @@
>
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
<el-main class="main">
<el-row style="height:10%">
<div
v-if="this.ipcstatus == 30"
style="text-align:center;margin-left:50px"
>吸油油品监测</div>
<div
v-if="this.ipcstatus == 40"
style="text-align:center;margin-left:50px"
>回油油品监测</div>
<div
v-if="this.ipcstatus == 60"
style="text-align:center;margin-left:50px"
>底层油品监测</div>
</el-row>
<el-row style="height: 40%">
<el-col
:span="8"
@ -1397,21 +1412,8 @@
<span class="numCol">{{ yykld21 }}</span>
</el-col>
</el-row>
<el-row>
<div
v-if="this.ipcstatus == 30"
style="text-align:center;margin-left:50px;margin-top:10px"
>吸油油品监测</div>
<div
v-if="this.ipcstatus == 40"
style="text-align:center;margin-left:50px;margin-top:10px"
>回油油品监测</div>
<div
v-if="this.ipcstatus == 60"
style="text-align:center;margin-left:50px;margin-top:10px"
>底层油品监测</div>
</el-row>
<el-row style="height: 50%">
<el-row style="height: 40%">
<el-col
:span="24"
id="yykldtx"
@ -2184,6 +2186,20 @@
>
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
<el-main class="main">
<el-row style="height:10%">
<div
v-if="this.bsipcstatus == 30"
style="text-align:center;margin-left:50px"
>吸油油品监测</div>
<div
v-if="this.bsipcstatus == 40"
style="text-align:center;margin-left:50px"
>回油油品监测</div>
<div
v-if="this.bsipcstatus == 60"
style="text-align:center;margin-left:50px"
>底层油品监测</div>
</el-row>
<el-row style="height: 40%">
<el-col
:span="8"
@ -2262,21 +2278,8 @@
<span class="numCol">{{ bsyykld21 }}</span>
</el-col>
</el-row>
<el-row>
<div
v-if="this.bsipcstatus == 30"
style="text-align:center;margin-left:50px;margin-top:10px"
>吸油油品监测</div>
<div
v-if="this.bsipcstatus == 40"
style="text-align:center;margin-left:50px;margin-top:10px"
>回油油品监测</div>
<div
v-if="this.bsipcstatus == 60"
style="text-align:center;margin-left:50px;margin-top:10px"
>底层油品监测</div>
</el-row>
<el-row style="height: 50%">
<el-row style="height: 40%">
<el-col
:span="24"
id="bsyykldtx"
@ -2576,7 +2579,7 @@
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
@click="handleQuery(null)"
> </el-button>
<el-button
icon="el-icon-refresh"
@ -2934,6 +2937,8 @@ export default {
},
handleQuery(key) {
this.loading = true;
// console.log("key:", key);
// console.log("queryParams:", this.queryParams);
if (key != null) {
if (
key === "driven_soft_flw" ||
@ -2953,8 +2958,18 @@ export default {
this.getData(this.queryParams);
},
resetQuery() {
var key = this.queryParams.columnName;
if (
key === "driven_soft_flw" ||
key === "driven_hot_flw" ||
key === "opr_soft_flw" ||
key === "opr_hot_flw"
) {
this.datetime = this.getTimeRangeByHours(5);
} else {
this.datetime = this.getDefaultTimeRange();
this.handleQuery();
}
this.handleQuery(null);
},
getData(queryObj) {
this.chartLoading = true;
@ -3156,6 +3171,7 @@ export default {
],
};
//
if (queryObj != null && queryObj.columnName != null) {
if (
queryObj.columnName === "gran4" ||
queryObj.columnName === "gran6" ||
@ -3244,6 +3260,7 @@ export default {
option.series[0].markArea = { data: aredata };
}
}
}
this.chart.setOption(option);
this.chartLoading = false;
});