bug修复
This commit is contained in:
parent
64d43ba2a0
commit
7722a4b738
@ -8,6 +8,8 @@ import com.inspur.industrial.utils.InfluxdbTimeUtil;
|
|||||||
import com.inspur.system.domain.SysConfig;
|
import com.inspur.system.domain.SysConfig;
|
||||||
import com.inspur.system.service.ISysConfigService;
|
import com.inspur.system.service.ISysConfigService;
|
||||||
import com.inspur.system.service.influx.InfluxDBService;
|
import com.inspur.system.service.influx.InfluxDBService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -25,7 +27,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DataQueryService implements IDataQueryService {
|
public class DataQueryService implements IDataQueryService {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DataQueryService.class);
|
||||||
@Resource
|
@Resource
|
||||||
private InfluxDBService influxDBUtils;
|
private InfluxDBService influxDBUtils;
|
||||||
|
|
||||||
@ -230,6 +232,7 @@ public class DataQueryService implements IDataQueryService {
|
|||||||
LocalDateTime etime = LocalDateTime.parse(endTime);
|
LocalDateTime etime = LocalDateTime.parse(endTime);
|
||||||
long intervalHours = ChronoUnit.HOURS.between(stime, etime);
|
long intervalHours = ChronoUnit.HOURS.between(stime, etime);
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
logger.info("查询时间差:" + intervalHours);
|
||||||
if(intervalHours <= 6){//6小时内全查
|
if(intervalHours <= 6){//6小时内全查
|
||||||
list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime);
|
list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime);
|
||||||
}else if(intervalHours <= 7*24 ){//7天内,每30s一个
|
}else if(intervalHours <= 7*24 ){//7天内,每30s一个
|
||||||
@ -253,13 +256,15 @@ public class DataQueryService implements IDataQueryService {
|
|||||||
}
|
}
|
||||||
for (Map<String, Object> data : list) {
|
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) == null ? 0.0 : );
|
||||||
columnList.add(data.get(columnName));
|
if(data.get(columnName) != null) {
|
||||||
statusList.add((Double)data.get("ipc_status"));
|
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());
|
LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString());
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
timelist.add(time.format(formatter));
|
timelist.add(time.format(formatter));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resMap.put("y", columnList);
|
resMap.put("y", columnList);
|
||||||
resMap.put("x", timelist);
|
resMap.put("x", timelist);
|
||||||
@ -426,7 +431,7 @@ public class DataQueryService implements IDataQueryService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<Map<String, Object>> selectLongTimeDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime, String interval){
|
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));
|
return influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,7 @@ public class IpcUtil {
|
|||||||
ipcAlarmRecord.setEquipId(rule.getEquipId());
|
ipcAlarmRecord.setEquipId(rule.getEquipId());
|
||||||
ipcAlarmRecord.setSensorId(rule.getSensorId());
|
ipcAlarmRecord.setSensorId(rule.getSensorId());
|
||||||
String name = rule.getAlarmNameKey();
|
String name = rule.getAlarmNameKey();
|
||||||
float value = (float)map.get(name);
|
ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf((Float)map.get(name)));
|
||||||
ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf(value));
|
|
||||||
ipcAlarmRecord.setNameKey(name);
|
ipcAlarmRecord.setNameKey(name);
|
||||||
ipcAlarmRecord.setContent(type == 0 ? "(开机监测)" + rule.getReferenceName() : rule.getReferenceName());
|
ipcAlarmRecord.setContent(type == 0 ? "(开机监测)" + rule.getReferenceName() : rule.getReferenceName());
|
||||||
ipcAlarmRecord.setStatus(0);
|
ipcAlarmRecord.setStatus(0);
|
||||||
|
@ -456,6 +456,20 @@
|
|||||||
>
|
>
|
||||||
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
||||||
<el-main class="main">
|
<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-row style="height: 40%">
|
||||||
<el-col
|
<el-col
|
||||||
:span="8"
|
:span="8"
|
||||||
@ -534,21 +548,8 @@
|
|||||||
<span class="numCol">{{ cylyykld21 }}</span>
|
<span class="numCol">{{ cylyykld21 }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
|
||||||
<div
|
<el-row style="height: 40%">
|
||||||
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-col
|
<el-col
|
||||||
:span="24"
|
:span="24"
|
||||||
id="cylyykldtx"
|
id="cylyykldtx"
|
||||||
@ -1319,6 +1320,20 @@
|
|||||||
>
|
>
|
||||||
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
||||||
<el-main class="main">
|
<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-row style="height: 40%">
|
||||||
<el-col
|
<el-col
|
||||||
:span="8"
|
:span="8"
|
||||||
@ -1397,21 +1412,8 @@
|
|||||||
<span class="numCol">{{ yykld21 }}</span>
|
<span class="numCol">{{ yykld21 }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
|
||||||
<div
|
<el-row style="height: 40%">
|
||||||
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-col
|
<el-col
|
||||||
:span="24"
|
:span="24"
|
||||||
id="yykldtx"
|
id="yykldtx"
|
||||||
@ -2184,6 +2186,20 @@
|
|||||||
>
|
>
|
||||||
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
<el-header class="header">ZFSC4超压底缸加压系统油品特性</el-header>
|
||||||
<el-main class="main">
|
<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-row style="height: 40%">
|
||||||
<el-col
|
<el-col
|
||||||
:span="8"
|
:span="8"
|
||||||
@ -2262,21 +2278,8 @@
|
|||||||
<span class="numCol">{{ bsyykld21 }}</span>
|
<span class="numCol">{{ bsyykld21 }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
|
||||||
<div
|
<el-row style="height: 40%">
|
||||||
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-col
|
<el-col
|
||||||
:span="24"
|
:span="24"
|
||||||
id="bsyykldtx"
|
id="bsyykldtx"
|
||||||
@ -2576,7 +2579,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleQuery"
|
@click="handleQuery(null)"
|
||||||
>查 询</el-button>
|
>查 询</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
@ -2934,6 +2937,8 @@ export default {
|
|||||||
},
|
},
|
||||||
handleQuery(key) {
|
handleQuery(key) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
// console.log("key:", key);
|
||||||
|
// console.log("queryParams:", this.queryParams);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
if (
|
if (
|
||||||
key === "driven_soft_flw" ||
|
key === "driven_soft_flw" ||
|
||||||
@ -2953,8 +2958,18 @@ export default {
|
|||||||
this.getData(this.queryParams);
|
this.getData(this.queryParams);
|
||||||
},
|
},
|
||||||
resetQuery() {
|
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.datetime = this.getDefaultTimeRange();
|
||||||
this.handleQuery();
|
}
|
||||||
|
this.handleQuery(null);
|
||||||
},
|
},
|
||||||
getData(queryObj) {
|
getData(queryObj) {
|
||||||
this.chartLoading = true;
|
this.chartLoading = true;
|
||||||
@ -3156,6 +3171,7 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
//设置标志区域
|
//设置标志区域
|
||||||
|
if (queryObj != null && queryObj.columnName != null) {
|
||||||
if (
|
if (
|
||||||
queryObj.columnName === "gran4" ||
|
queryObj.columnName === "gran4" ||
|
||||||
queryObj.columnName === "gran6" ||
|
queryObj.columnName === "gran6" ||
|
||||||
@ -3244,6 +3260,7 @@ export default {
|
|||||||
option.series[0].markArea = { data: aredata };
|
option.series[0].markArea = { data: aredata };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.chart.setOption(option);
|
this.chart.setOption(option);
|
||||||
this.chartLoading = false;
|
this.chartLoading = false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user