报警处理菜单增加可选报警趋势查询功能
This commit is contained in:
parent
118ad97a8d
commit
c8052ffa72
@ -64,12 +64,12 @@ public class DataQueryController {
|
||||
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||
public CommonResult<Map<String, Object>> getFieldList(String equipId,String nameKey,String tableName, String startTime, String endTime){
|
||||
Map<String,Object> resMap = new HashMap<>();
|
||||
Map<String,String> mappingMap = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get("alarmKey2MeasurementMapping"),Map.class);
|
||||
if (!mappingMap.containsKey(nameKey)){
|
||||
return CommonResult.error(800,"找不到给参数匹配名对应的表名!");
|
||||
}
|
||||
// Map<String,String> mappingMap = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get("alarmKey2MeasurementMapping"),Map.class);
|
||||
// if (!mappingMap.containsKey(nameKey)){
|
||||
// return CommonResult.error(800,"找不到给参数匹配名对应的表名!");
|
||||
// }
|
||||
try {
|
||||
resMap = dataQueryService.queryDataListByColumnNameandDate(equipId,mappingMap.get(nameKey),nameKey,startTime,endTime);
|
||||
resMap = dataQueryService.queryDataListByColumnNameandDate(equipId,tableName,nameKey,startTime,endTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return CommonResult.error(800,"时间格式错误");
|
||||
|
@ -43,7 +43,7 @@ public class InfluxDBService {
|
||||
|
||||
@PostConstruct
|
||||
public void initInfluxDb() {
|
||||
alarmKey2MeasurementMapping();//influxDB报警键值与表名映射
|
||||
//alarmKey2MeasurementMapping();//influxDB报警键值与表名映射
|
||||
LOGGER.info("-->>开始连接influxDB数据库");
|
||||
this.retentionPolicy = retentionPolicy == null || "".equals(retentionPolicy) ? "autogen" : retentionPolicy;
|
||||
this.influxDB = influxDbBuild();
|
||||
@ -59,26 +59,26 @@ public class InfluxDBService {
|
||||
// insert(measurement, tags, fields);
|
||||
// }
|
||||
|
||||
public void alarmKey2MeasurementMapping(){
|
||||
Map<String,String> alarmKey2MeasurementMapping = new HashMap<>();
|
||||
alarmKey2MeasurementMapping.put("x_push_temp", "gateway_channel_current_data");
|
||||
alarmKey2MeasurementMapping.put("y_push_temp", "gateway_channel_current_data");
|
||||
alarmKey2MeasurementMapping.put("x_lube_press", "gateway_channel_hydra_data");
|
||||
alarmKey2MeasurementMapping.put("y_lube_press", "gateway_channel_hydra_data");
|
||||
alarmKey2MeasurementMapping.put("z_lube_press", "gateway_channel_hydra_data");
|
||||
alarmKey2MeasurementMapping.put("at_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("x_bear_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("y_bear_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("z_bear_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("x_debris_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("z_debris_temp", "gateway_channel_temp_data");
|
||||
alarmKey2MeasurementMapping.put("x_entropy", "gateway_channel_vibr_data");
|
||||
alarmKey2MeasurementMapping.put("on_time", "gateway_channel_work_data");
|
||||
alarmKey2MeasurementMapping.put("work_items", "gateway_channel_work_data");
|
||||
alarmKey2MeasurementMapping.put("work_time", "gateway_channel_work_data");
|
||||
alarmKey2MeasurementMapping.put("work_total", "gateway_channel_work_data");
|
||||
stringRedisTemplate.opsForValue().set("alarmKey2MeasurementMapping", JsonUtils.toJsonString(alarmKey2MeasurementMapping));
|
||||
}
|
||||
// public void alarmKey2MeasurementMapping(){
|
||||
// Map<String,String> alarmKey2MeasurementMapping = new HashMap<>();
|
||||
// alarmKey2MeasurementMapping.put("x_push_temp", "gateway_channel_current_data");
|
||||
// alarmKey2MeasurementMapping.put("y_push_temp", "gateway_channel_current_data");
|
||||
// alarmKey2MeasurementMapping.put("x_lube_press", "gateway_channel_hydra_data");
|
||||
// alarmKey2MeasurementMapping.put("y_lube_press", "gateway_channel_hydra_data");
|
||||
// alarmKey2MeasurementMapping.put("z_lube_press", "gateway_channel_hydra_data");
|
||||
// alarmKey2MeasurementMapping.put("at_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("x_bear_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("y_bear_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("z_bear_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("x_debris_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("z_debris_temp", "gateway_channel_temp_data");
|
||||
// alarmKey2MeasurementMapping.put("x_entropy", "gateway_channel_vibr_data");
|
||||
// alarmKey2MeasurementMapping.put("on_time", "gateway_channel_work_data");
|
||||
// alarmKey2MeasurementMapping.put("work_items", "gateway_channel_work_data");
|
||||
// alarmKey2MeasurementMapping.put("work_time", "gateway_channel_work_data");
|
||||
// alarmKey2MeasurementMapping.put("work_total", "gateway_channel_work_data");
|
||||
// stringRedisTemplate.opsForValue().set("alarmKey2MeasurementMapping", JsonUtils.toJsonString(alarmKey2MeasurementMapping));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置数据保存策略 defalut 策略名 /database 数据库名/ 30d 数据保存时限30天/ 1 副本个数为1/ 结尾DEFAULT
|
||||
|
@ -71,6 +71,14 @@ public class GatewayCardInfoController {
|
||||
return success(BeanUtils.toBean(gatewayCardInfo, GatewayCardInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getCardTree")
|
||||
@Operation(summary = "获得机床网关采集卡")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
// @PreAuthorize("@ss.hasPermission('imt:gateway-info:create')")
|
||||
public CommonResult<List<TreeSelect>> getGatewayCardTree(@RequestParam("equipId") String equipId) {
|
||||
return success(gatewayCardInfoService.getGatewayCardInfoTreeByEquipId(equipId));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得机床网关采集卡分页")
|
||||
@PreAuthorize("@ss.hasPermission('imt:gateway-info:create')")
|
||||
|
@ -30,6 +30,10 @@ public class GatewayCardInfoRespVO {
|
||||
@ExcelProperty("采集卡名称")
|
||||
private String cardName;
|
||||
|
||||
@Schema(description = "采集卡别名")
|
||||
@ExcelProperty("采集卡别名")
|
||||
private String cardAlias;
|
||||
|
||||
@Schema(description = "采集卡与influxdb映射表名")
|
||||
@ExcelProperty("采集卡与influxdb映射表名")
|
||||
private String cardTableMapping;
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.inspur.module.system.controller.admin.gatewayinfo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/9/30
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class TreeSelect {
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 选择的节点值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<TreeSelect> children;
|
||||
|
||||
public TreeSelect(GatewayCardInfoDO gatewayCardInfoDO){
|
||||
this.id = gatewayCardInfoDO.getCardId();
|
||||
this.label = gatewayCardInfoDO.getCardAlias();
|
||||
this.value = "gateway_" +gatewayCardInfoDO.getCardTableMapping() + "_data";
|
||||
}
|
||||
|
||||
public TreeSelect(GatewayCardParamsDO gatewayCardParamsDO){
|
||||
this.id = gatewayCardParamsDO.getChannelId();
|
||||
this.label = gatewayCardParamsDO.getChannelAlias();
|
||||
this.value = gatewayCardParamsDO.getParamMappingName();
|
||||
}
|
||||
}
|
@ -56,4 +56,10 @@ public interface GatewayCardInfoService {
|
||||
* 通过网关id获取采集卡列表
|
||||
*/
|
||||
List<GatewayCardInfoDO> getGatewayCardInfoListByGatewayId(String gatewayId);
|
||||
|
||||
/**
|
||||
* 通过设备id获取采集卡网关下拉树数据
|
||||
*/
|
||||
List<TreeSelect> getGatewayCardInfoTreeByEquipId(String equipId);
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.inspur.module.system.service.gatewayinfo;
|
||||
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||
import com.inspur.module.system.dal.mysql.gatewayinfo.GatewayCardParamsMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -7,6 +9,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO;
|
||||
import com.inspur.framework.common.pojo.PageResult;
|
||||
@ -30,6 +34,9 @@ public class GatewayCardInfoServiceImpl implements GatewayCardInfoService {
|
||||
@Resource
|
||||
private GatewayCardInfoMapper gatewayCardInfoMapper;
|
||||
|
||||
@Resource
|
||||
private GatewayCardParamsMapper gatewayCardParamsMapper;
|
||||
|
||||
@Override
|
||||
public String createGatewayCardInfo(GatewayCardInfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -79,4 +86,24 @@ public class GatewayCardInfoServiceImpl implements GatewayCardInfoService {
|
||||
public List<GatewayCardInfoDO> getGatewayCardInfoListByGatewayId(String gatewayId){
|
||||
return gatewayCardInfoMapper.selectList(GatewayCardInfoDO::getGatewayId, gatewayId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过设备id获取采集卡网关下拉树数据
|
||||
*/
|
||||
public List<TreeSelect> getGatewayCardInfoTreeByEquipId(String equipId){
|
||||
List<TreeSelect> resList = new ArrayList<>();
|
||||
//根据设备id查询采集卡列表
|
||||
List<GatewayCardInfoDO> cardList = gatewayCardInfoMapper.selectList(GatewayCardInfoDO::getEquipId, equipId);
|
||||
|
||||
//根据设备id查询采集卡参数列表
|
||||
List<GatewayCardParamsDO> paramsList = gatewayCardParamsMapper.selectList(GatewayCardParamsDO::getEquipId, equipId);
|
||||
|
||||
for (GatewayCardInfoDO gatewayCardInfoDO : cardList) {
|
||||
TreeSelect treeSelect = new TreeSelect(gatewayCardInfoDO);
|
||||
List<TreeSelect> paramsTreeList = paramsList.stream().filter(params -> params.getCardId().equals(gatewayCardInfoDO.getCardId())).map(TreeSelect::new).collect(Collectors.toList());
|
||||
treeSelect.setChildren(paramsTreeList);
|
||||
resList.add(treeSelect);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
}
|
@ -33,6 +33,7 @@ export const DICT_TYPE = {
|
||||
ALARM_TYPE: "equip_alarm_type",
|
||||
CARD_TYPE: "card_type",
|
||||
MSG_TYPE: "msg_type",
|
||||
CARD_ALIAS: "card_alias",
|
||||
EQUIP_RUN_STATUS: "equip_run_status",
|
||||
// ========== SYSTEM 模块 ==========
|
||||
SYSTEM_USER_SEX: "system_user_sex",
|
||||
|
@ -296,42 +296,78 @@ export default {
|
||||
},
|
||||
getEchartData1(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart1([], "", "");
|
||||
this.initchart1(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
this.initchart1(data, info.name, info.unit);
|
||||
}
|
||||
},
|
||||
getEchartData2(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart2([], "", "");
|
||||
this.initchart2(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
this.initchart2(data, info.name, info.unit);
|
||||
}
|
||||
},
|
||||
getEchartData3(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart3([], "", "");
|
||||
this.initchart3(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
this.initchart3(data, info.name, info.unit);
|
||||
}
|
||||
},
|
||||
getEchartData4(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart4([], "", "");
|
||||
this.initchart4(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
this.initchart4(data, info.name, info.unit);
|
||||
}
|
||||
},
|
||||
getEchartData5(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart5([], "", "");
|
||||
this.initchart5(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
this.initchart5(data, info.name, info.unit);
|
||||
}
|
||||
},
|
||||
getEchartData6(data, info) {
|
||||
if (data == null) {
|
||||
this.initchart6([], "", "");
|
||||
this.initchart6(
|
||||
{
|
||||
time: [],
|
||||
},
|
||||
"",
|
||||
""
|
||||
);
|
||||
} else {
|
||||
let work_time = [];
|
||||
let power_time = [];
|
||||
@ -428,10 +464,10 @@ export default {
|
||||
name: "单位: " + unit,
|
||||
type: "value",
|
||||
nameLocation: "end",
|
||||
nameTextStyle: {
|
||||
color: "#fff",
|
||||
fontSize: "9",
|
||||
},
|
||||
// nameTextStyle: {
|
||||
// color: "#fff",
|
||||
// fontSize: "9",
|
||||
// },
|
||||
axisLine: {
|
||||
show: false,
|
||||
},
|
||||
@ -467,7 +503,6 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
@ -478,7 +513,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: 10,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#E0E6F3",
|
||||
@ -586,10 +621,10 @@ export default {
|
||||
name: "单位: " + unit,
|
||||
type: "value",
|
||||
nameLocation: "end",
|
||||
nameTextStyle: {
|
||||
color: "#fff",
|
||||
fontSize: "9",
|
||||
},
|
||||
// nameTextStyle: {
|
||||
// color: "#fff",
|
||||
// fontSize: "9",
|
||||
// },
|
||||
axisLine: {
|
||||
show: false,
|
||||
},
|
||||
@ -625,7 +660,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
@ -762,10 +797,10 @@ export default {
|
||||
name: "单位: " + unit,
|
||||
type: "value",
|
||||
nameLocation: "end",
|
||||
nameTextStyle: {
|
||||
color: "#fff",
|
||||
fontSize: "9",
|
||||
},
|
||||
// nameTextStyle: {
|
||||
// color: "#fff",
|
||||
// fontSize: "9",
|
||||
// },
|
||||
axisLine: {
|
||||
show: false,
|
||||
},
|
||||
@ -801,7 +836,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
@ -1023,7 +1058,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
@ -1245,7 +1280,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
@ -1449,7 +1484,7 @@ export default {
|
||||
xAxisIndex: 0,
|
||||
filterMode: "none",
|
||||
start: 0,
|
||||
end: data.time.length,
|
||||
end: 100,
|
||||
bottom: "1%",
|
||||
fillerColor: "rgba(167,183,204,0.4)", //选中范围的填充颜色。
|
||||
borderColor: "#3C506B",
|
||||
|
@ -91,6 +91,25 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="采集数据名"
|
||||
prop="cardAlias"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.cardAlias"
|
||||
placeholder="请选择采集卡数据名"
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in this.getDictDatas(DICT_TYPE.CARD_ALIAS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
<div class="add-table">
|
||||
<el-form
|
||||
@ -141,6 +160,20 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="channelAlias"
|
||||
label="参数名"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-form-item
|
||||
:prop="'paramsList['+scope.$index+'].channelAlias'"
|
||||
:rules="paramsRules.channelAlias"
|
||||
>
|
||||
<el-input v-model="scope.row.channelAlias" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
align="center"
|
||||
v-for="(item,index) in dataList"
|
||||
@ -265,6 +298,13 @@ export default {
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
cardAlias: [
|
||||
{
|
||||
required: true,
|
||||
message: "采集数据名类型不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
paramsList: {
|
||||
channelName: [
|
||||
{
|
||||
@ -290,6 +330,18 @@ export default {
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
channelAlias: [
|
||||
{
|
||||
required: true,
|
||||
message: "参数名不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
{
|
||||
max: 50,
|
||||
message: "参数名长度不能超过50个字符",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
//参数校验
|
||||
@ -332,6 +384,7 @@ export default {
|
||||
var addObj = {
|
||||
channelName: "",
|
||||
paramMappingName: "",
|
||||
channelAlias: "",
|
||||
};
|
||||
// this.dataList.forEach((el) => {
|
||||
// addObj[el.code] = "";
|
||||
|
Loading…
Reference in New Issue
Block a user