故障树接口和菜单

This commit is contained in:
zhangjunwen 2024-04-15 14:12:26 +08:00
parent c7db1f18c9
commit 1ff3072ad2
23 changed files with 2685 additions and 495 deletions

View File

@ -2,6 +2,8 @@ package com.inspur.web.controller.industrial;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -46,6 +48,18 @@ public class IpcAlarmRecordController extends BaseController
return getDataTable(list);
}
/**
* 查询所有报警记录
* @param ipcAlarmRecord
* @return
*/
@GetMapping("/listAll")
public AjaxResult listAll(IpcAlarmRecord ipcAlarmRecord)
{
List<IpcAlarmRecord> list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord);
return AjaxResult.success(list);
}
/**
* 导出报警记录列表
*/

View File

@ -0,0 +1,118 @@
package com.inspur.web.controller.industrial;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.service.IIpcFaultTreeConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 故障树配置Controller
*
* @author inspur
* @date 2024-04-02
*/
@RestController
@RequestMapping("/ipc/faultTreeConfig")
public class IpcFaultTreeConfigController extends BaseController
{
@Autowired
private IIpcFaultTreeConfigService ipcFaultTreeConfigService;
/**
* 查询故障树配置列表
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:list')")
@GetMapping("/list")
public AjaxResult list(IpcFaultTreeConfig ipcFaultTreeConfig)
{
List<IpcFaultTreeConfig> list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
return AjaxResult.success(list);
}
/**
* 导出故障树配置列表
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:export')")
@Log(title = "故障树配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcFaultTreeConfig ipcFaultTreeConfig)
{
List<IpcFaultTreeConfig> list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
ExcelUtil<IpcFaultTreeConfig> util = new ExcelUtil<IpcFaultTreeConfig>(IpcFaultTreeConfig.class);
util.exportExcel(response, list, "故障树配置数据");
}
/**
* 获取故障树配置详细信息
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')")
@GetMapping(value = "/{nodeId}")
public AjaxResult getInfo(@PathVariable("nodeId") Long nodeId)
{
return AjaxResult.success(ipcFaultTreeConfigService.selectIpcFaultTreeConfigByNodeId(nodeId));
}
/**
* 校验是否存在子节点
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')")
@GetMapping(value = "/hasChild/{nodeId}")
public AjaxResult hasChild(@PathVariable("nodeId") Long nodeId)
{
return AjaxResult.success(ipcFaultTreeConfigService.hasChild(nodeId));
}
/**
* 新增故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:add')")
@Log(title = "故障树配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig)
{
return toAjax(ipcFaultTreeConfigService.insertIpcFaultTreeConfig(ipcFaultTreeConfig));
}
/**
* 修改故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:edit')")
@Log(title = "故障树配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig)
{
return toAjax(ipcFaultTreeConfigService.updateIpcFaultTreeConfig(ipcFaultTreeConfig));
}
/**
* 删除故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:remove')")
@Log(title = "故障树配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{nodeIds}")
public AjaxResult remove(@PathVariable Long[] nodeIds)
{
return toAjax(ipcFaultTreeConfigService.deleteIpcFaultTreeConfigByNodeIds(nodeIds));
}
/**
* 查询故障树查询
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:list')")
@GetMapping("/getFaultTreeShow/{equipId}")
public AjaxResult getFaultTreeShow(@PathVariable("equipId") String equipId)
{
return AjaxResult.success(ipcFaultTreeConfigService.getFaultTreeShow(equipId));
}
}

View File

@ -41,4 +41,9 @@ public class CacheConstants
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* ipc规则
*/
public static final String IPC_RULES_KEY = "ipc_rules:";
}

View File

@ -1,6 +1,12 @@
package com.inspur.datasyn.modbus;
import com.inspur.common.utils.spring.SpringUtils;
import com.inspur.industrial.domain.IpcAlarmRecord;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRecordService;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil;
import com.inspur.industrial.utils.JudgeUtil;
import com.inspur.system.service.influx.InfluxDBService;
import com.serotonin.modbus4j.BatchRead;
@ -14,9 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.*;
public class IPCData2SyncThread implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(IPCDataSyncThread.class);
@ -24,6 +28,8 @@ public class IPCData2SyncThread implements Runnable {
private ModbusMaster master;
private String time;
private static final String EQUIP_ID = "5d6c1a1374ea490a91e1361c1f5400aa";
public IPCData2SyncThread(ModbusMaster master, String time){
this.master = master;
this.time = time;
@ -58,7 +64,11 @@ public class IPCData2SyncThread implements Runnable {
Map<String,String> tags = new TreeMap();
tags.put("equ_id","5d6c1a1374ea490a91e1361c1f5400aa");
Map<String,Object> fields = new TreeMap();
IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class);
IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
@ -71,6 +81,12 @@ public class IPCData2SyncThread implements Runnable {
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
//液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule();
//正式需要放开
fields.put("level_min",levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max",levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
@ -133,7 +149,7 @@ public class IPCData2SyncThread implements Runnable {
// 十一压区比例减压阀
fields.put("press11",(float) 0 + Math.random());
// 一压区流量
fields.put("flw1",(float) 0 + Math.random());
fields.put("pre",(float) 0 + Math.random());
// 二压区流量
fields.put("flw2",(float) 0 + Math.random());
// 三压区流量
@ -154,15 +170,34 @@ public class IPCData2SyncThread implements Runnable {
fields.put("flw10",(float) 0 + Math.random());
// 十一压区流量
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// fields.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags, Constant.RUNNING,rulesList));
if (!alarmRecordList.isEmpty()){//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
// JudgeUtil.judgeAndSaveAlarmData(fields,"2");
i.insert(measurement,tags,fields);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取液位的报警规则
* @return
*/
private IpcAlarmRules getLevelAlarmRule(){
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(EQUIP_ID);
query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中
return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0);
}
}

View File

@ -1,6 +1,12 @@
package com.inspur.datasyn.modbus;
import com.inspur.common.utils.spring.SpringUtils;
import com.inspur.industrial.domain.IpcAlarmRecord;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRecordService;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil;
import com.inspur.industrial.utils.JudgeUtil;
import com.inspur.system.service.influx.InfluxDBService;
import com.serotonin.modbus4j.BatchRead;
@ -14,9 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.*;
public class IPCData3SyncThread implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(IPCDataSyncThread.class);
@ -24,6 +28,8 @@ public class IPCData3SyncThread implements Runnable {
private ModbusMaster master;
private String time;
private static final String EQUIP_ID = "8b2d5cb04e254c15ade1e53a4f594f3f";
public IPCData3SyncThread(ModbusMaster master, String time){
this.master = master;
this.time = time;
@ -59,6 +65,12 @@ public class IPCData3SyncThread implements Runnable {
tags.put("equ_id","8b2d5cb04e254c15ade1e53a4f594f3f");
Map<String,Object> fields = new TreeMap();
IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class);
IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
// 系统流量
@ -70,6 +82,13 @@ public class IPCData3SyncThread implements Runnable {
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
//液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule();
//正式需要放开
fields.put("level_min",levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max",levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
@ -128,9 +147,16 @@ public class IPCData3SyncThread implements Runnable {
// 十一压区流量
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// fields.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags, Constant.RUNNING,rulesList));
if (!alarmRecordList.isEmpty()){//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
// JudgeUtil.judgeAndSaveAlarmData(fields,"3");
@ -139,4 +165,12 @@ public class IPCData3SyncThread implements Runnable {
e.printStackTrace();
}
}
private IpcAlarmRules getLevelAlarmRule(){
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(EQUIP_ID);
query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中
return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0);
}
}

View File

@ -180,9 +180,9 @@ public class IPCDataSyncThread implements Runnable {
// // DS软辊加压压力
// fields.put("dsrgjyyl",0.4);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
tags.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// tags.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
@ -190,7 +190,7 @@ public class IPCDataSyncThread implements Runnable {
i.insert(measurement,tags,fields);
if (!alarmRecordList.isEmpty()){//运行需放开
//alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -34,6 +34,11 @@ public class IpcAlarmRecord extends BaseEntity
@Excel(name = "传感器id")
private String sensorId;
/**
* 参数key值
*/
private String nameKey;
/** 报警内容 */
@Excel(name = "报警内容")
private String content;
@ -43,8 +48,8 @@ public class IpcAlarmRecord extends BaseEntity
private BigDecimal alarmValue;
/** 报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS")
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:SS")
private Date alarmTime;
/** 处理结果 */
@ -112,6 +117,14 @@ public class IpcAlarmRecord extends BaseEntity
this.content = content;
}
public String getNameKey() {
return nameKey;
}
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
public String getContent()
{
return content;
@ -170,21 +183,21 @@ public class IpcAlarmRecord extends BaseEntity
this.alarmLevel = alarmLevel;
}
public IpcEquipInfo getEquipInfo() {
return equipInfo;
}
public void setEquipInfo(IpcEquipInfo equipInfo) {
this.equipInfo = equipInfo;
}
public IpcAlarmRules getAlarmRules() {
return alarmRules;
}
public void setAlarmRules(IpcAlarmRules alarmRules) {
this.alarmRules = alarmRules;
}
// public IpcEquipInfo getEquipInfo() {
// return equipInfo;
// }
//
// public void setEquipInfo(IpcEquipInfo equipInfo) {
// this.equipInfo = equipInfo;
// }
//
// public IpcAlarmRules getAlarmRules() {
// return alarmRules;
// }
//
// public void setAlarmRules(IpcAlarmRules alarmRules) {
// this.alarmRules = alarmRules;
// }
public String[] getIds() {
return ids;
@ -201,6 +214,7 @@ public class IpcAlarmRecord extends BaseEntity
.append("alarmRulesId", getAlarmRulesId())
.append("equipId", getEquipId())
.append("sensorId", getSensorId())
.append("nameKey", getNameKey())
.append("content", getContent())
.append("alarmValue", getAlarmValue())
.append("alarmTime", getAlarmTime())

View File

@ -0,0 +1,212 @@
package com.inspur.industrial.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.TreeEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 故障树配置对象 ipc_fault_tree_config
*
* @author inspur
* @date 2024-04-02
*/
public class IpcFaultTreeConfig extends TreeEntity
{
private static final long serialVersionUID = 1L;
/** 节点id */
private Long nodeId;
/** 部门名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 所属部位 */
@Excel(name = "所属设备id")
private String equipId;
/** 规则id */
@Excel(name = "规则id")
private String alarmRuleConfigId;
/** 规则描述 */
@Excel(name = "规则描述")
private String alarmRuleConfigDescription;
/** 节点图标 */
@Excel(name = "节点图标")
private String iconCls;
/** 节点形状 */
@Excel(name = "节点形状")
private String nodeShapeType;
/** 节点默认颜色 */
@Excel(name = "节点默认颜色")
private String nodeDefaultColor;
/** 节点报警颜色 */
@Excel(name = "节点报警颜色")
private String nodeAlarmColor;
/** 是否叶子节点 */
@Excel(name = "是否叶子节点")
private String isLeaf;
/** 是否报警 */
@Excel(name = "是否报警")
private String isAlarm;
/** 节点状态0正常 1停用 */
@Excel(name = "节点状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setNodeId(Long nodeId)
{
this.nodeId = nodeId;
}
public Long getNodeId()
{
return nodeId;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setEquipId(String equipId)
{
this.equipId = equipId;
}
public String getEquipId()
{
return equipId;
}
public void setIconCls(String iconCls)
{
this.iconCls = iconCls;
}
public String getIconCls()
{
return iconCls;
}
public void setNodeShapeType(String nodeShapeType)
{
this.nodeShapeType = nodeShapeType;
}
public String getNodeShapeType()
{
return nodeShapeType;
}
public void setNodeDefaultColor(String nodeDefaultColor)
{
this.nodeDefaultColor = nodeDefaultColor;
}
public String getNodeDefaultColor()
{
return nodeDefaultColor;
}
public void setNodeAlarmColor(String nodeAlarmColor)
{
this.nodeAlarmColor = nodeAlarmColor;
}
public String getNodeAlarmColor()
{
return nodeAlarmColor;
}
public void setIsAlarm(String isAlarm)
{
this.isAlarm = isAlarm;
}
public String getIsAlarm()
{
return isAlarm;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public String getAlarmRuleConfigId() {
return alarmRuleConfigId;
}
public void setAlarmRuleConfigId(String alarmRuleConfigId) {
this.alarmRuleConfigId = alarmRuleConfigId;
}
public String getAlarmRuleConfigDescription() {
return alarmRuleConfigDescription;
}
public void setAlarmRuleConfigDescription(String alarmRuleConfigDescription) {
this.alarmRuleConfigDescription = alarmRuleConfigDescription;
}
public String getIsLeaf() {
return isLeaf;
}
public void setIsLeaf(String isLeaf) {
this.isLeaf = isLeaf;
}
public IpcFaultTreeConfig() {
}
public IpcFaultTreeConfig(String equipId) {
this.equipId = equipId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("nodeId", getNodeId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("nodeName", getNodeName())
.append("orderNum", getOrderNum())
.append("equipId", getEquipId())
.append("iconCls", getIconCls())
.append("nodeShapeType", getNodeShapeType())
.append("nodeDefaultColor", getNodeDefaultColor())
.append("nodeAlarmColor", getNodeAlarmColor())
.append("isAlarm", getIsAlarm())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,131 @@
package com.inspur.industrial.domain;
import com.inspur.common.core.domain.TreeEntity;
/**
* 故障树配置对象 ipc_fault_tree_config
*
* @author inspur
* @date 2024-04-02
*/
public class IpcFaultTreeShow extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
* 节点id
*/
private Long nodeId;
/**
* 节点名称
*/
private String label;
/**
* 节点内容
*/
private String content;
/**
* 节点描述
*/
private String nodeDsc;
/**
* 节点图标
*/
private String iconCls;
/**
* 节点边框颜色
*/
private String nodeBorderColor;
/**
* 节点形状
*/
private String nodeShapeType;
/**
* 节点文字颜色
*/
private String nodeFontColor;
public Long getNodeId() {
return nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getNodeDsc() {
return nodeDsc;
}
public void setNodeDsc(String nodeDsc) {
this.nodeDsc = nodeDsc;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public String getNodeBorderColor() {
return nodeBorderColor;
}
public void setNodeBorderColor(String nodeBorderColor) {
this.nodeBorderColor = nodeBorderColor;
}
public String getNodeShapeType() {
return nodeShapeType;
}
public void setNodeShapeType(String nodeShapeType) {
this.nodeShapeType = nodeShapeType;
}
public String getNodeFontColor() {
return nodeFontColor;
}
public void setNodeFontColor(String nodeFontColor) {
this.nodeFontColor = nodeFontColor;
}
@Override
public String toString() {
return "IpcFaultTreeShow{" +
"nodeId=" + nodeId +
", label='" + label + '\'' +
", content='" + content + '\'' +
", nodeDsc='" + nodeDsc + '\'' +
", iconCls='" + iconCls + '\'' +
", nodeBorderColor='" + nodeBorderColor + '\'' +
", nodeShapeType='" + nodeShapeType + '\'' +
", nodeFontColor='" + nodeFontColor + '\'' +
'}';
}
}

View File

@ -0,0 +1,75 @@
package com.inspur.industrial.mapper;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import java.util.List;
/**
* 故障树配置Mapper接口
*
* @author inspur
* @date 2024-04-02
*/
public interface IpcFaultTreeConfigMapper
{
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public int hasChild(Long nodeId);
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置集合
*/
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 删除故障树配置
*
* @param nodeId 故障树配置主键
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds);
/**
* 查询故障树查询
*/
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId);
}

View File

@ -64,5 +64,13 @@ public interface IIpcAlarmRulesService
* @return 结果
*/
public int deleteIpcAlarmRulesById(String id);
/**
* 获取告警规则缓存
*
* @param part 监测部位
* @return 告警规则配置集合
*/
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId);
}

View File

@ -0,0 +1,76 @@
package com.inspur.industrial.service;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import java.util.List;
/**
* 故障树配置Service接口
*
* @author inspur
* @date 2024-04-02
*/
public interface IIpcFaultTreeConfigService
{
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public boolean hasChild(Long nodeId);
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置集合
*/
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的故障树配置主键集合
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds);
/**
* 删除故障树配置信息
*
* @param nodeId 故障树配置主键
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 查询故障树查询
*/
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId);
}

View File

@ -412,6 +412,8 @@ public class DataQueryService implements IDataQueryService {
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
//TODO 获取系统液位高值和低值
resMap.put("levelmax", list.get(0).get("level_max"));
resMap.put("levelmin", list.get(0).get("level_min"));
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度

View File

@ -4,7 +4,11 @@ import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import com.inspur.common.constant.CacheConstants;
import com.inspur.common.core.redis.RedisCache;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.equip.domain.IpcEquipInfo;
import com.inspur.equip.service.IIpcEquipInfoService;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
import com.inspur.industrial.service.IIpcMonitorDataInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +17,7 @@ import com.inspur.industrial.mapper.IpcAlarmRulesMapper;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
@ -30,6 +35,23 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
@Resource
private IIpcMonitorDataInfoService ipcMonitorDataInfoService;
@Resource
private RedisCache redisCache;
@Resource
private IIpcEquipInfoService ipcEquipInfoService;
//加载规则到缓存
@PostConstruct
public void init(){
List<IpcAlarmRules> rules = selectIpcAlarmRulesList(null);
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
for (IpcEquipInfo equip : equips) {
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY+equip.getId(),rulesByEquipId);
}
}
/**
* 查询设备报警规则
*
@ -86,7 +108,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
//
// });
// }
//TODO 新增删除更新redis
/**
* 新增设备报警规则
*
@ -108,7 +130,12 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
@Override
public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules)
{
return ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules);
int num = ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules);
if (num > 0){
List<IpcAlarmRules> rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(),rules);
}
return num;
}
/**
@ -134,5 +161,22 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
{
return ipcAlarmRulesMapper.deleteIpcAlarmRulesById(id);
}
/**
* 获取告警规则缓存
*
* @param part 监测部位
* @return 告警规则配置集合
*/
@Override
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId){
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
if (rules == null || rules.size() == 0){
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
redisCache.setCacheList(CacheConstants.IPC_RULES_KEY + equipId,rulesList);
return rulesList;
}
return rules;
}
}

View File

@ -0,0 +1,123 @@
package com.inspur.industrial.service.impl;
import com.inspur.common.constant.UserConstants;
import com.inspur.common.exception.ServiceException;
import com.inspur.common.utils.DateUtils;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.mapper.IpcFaultTreeConfigMapper;
import com.inspur.industrial.service.IIpcFaultTreeConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 故障树配置Service业务层处理
*
* @author inspur
* @date 2024-04-02
*/
@Service
public class IpcFaultTreeConfigServiceImpl implements IIpcFaultTreeConfigService
{
@Autowired
private IpcFaultTreeConfigMapper ipcFaultTreeConfigMapper;
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
@Override
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId)
{
return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigByNodeId(nodeId);
}
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
@Override
public boolean hasChild(Long nodeId){
return ipcFaultTreeConfigMapper.hasChild(nodeId) > 0;
}
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置
*/
@Override
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig)
{
return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
}
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
@Override
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig)
{
IpcFaultTreeConfig parentInfo = ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigByNodeId(ipcFaultTreeConfig.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(parentInfo.getStatus()))
{
throw new ServiceException("父节点停用,不允许新增");
}
ipcFaultTreeConfig.setAncestors(parentInfo.getAncestors()+","+ipcFaultTreeConfig.getParentId());
ipcFaultTreeConfig.setCreateTime(DateUtils.getNowDate());
return ipcFaultTreeConfigMapper.insertIpcFaultTreeConfig(ipcFaultTreeConfig);
}
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
@Override
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig)
{
ipcFaultTreeConfig.setUpdateTime(DateUtils.getNowDate());
return ipcFaultTreeConfigMapper.updateIpcFaultTreeConfig(ipcFaultTreeConfig);
}
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的故障树配置主键
* @return 结果
*/
@Override
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds)
{
return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeIds(nodeIds);
}
/**
* 删除故障树配置信息
*
* @param nodeId 故障树配置主键
* @return 结果
*/
@Override
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId)
{
return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeId(nodeId);
}
/**
* 查询故障树
*/
@Override
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId){
return ipcFaultTreeConfigMapper.getFaultTreeShow(equipId);
}
}

View File

@ -81,6 +81,7 @@ public class IpcUtil {
String name = rule.getAlarmNameKey();
double value = (double) map.get(name);
ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf(value));
ipcAlarmRecord.setNameKey(name);
ipcAlarmRecord.setContent(rule.getReferenceName());
ipcAlarmRecord.setStatus(0);
ipcAlarmRecord.setOperator(1L);

View File

@ -8,6 +8,7 @@
<result property="alarmRulesId" column="alarm_rules_id" />
<result property="equipId" column="equip_id" />
<result property="sensorId" column="sensor_id" />
<result property="nameKey" column="name_key" />
<result property="content" column="content" />
<result property="alarmValue" column="alarm_value" />
<result property="alarmTime" column="alarm_time" />
@ -48,7 +49,7 @@
</resultMap>
<sql id="selectIpcAlarmRecordVo">
select a.id, a.alarm_rules_id, a.equip_id, a.sensor_id, a.content, a.alarm_value, a.alarm_time, a.result, a.status, a.operator, a.alarm_level,
select a.id, a.alarm_rules_id, a.equip_id, a.sensor_id,a.name_key, a.content, a.alarm_value, a.alarm_time, a.result, a.status, a.operator, a.alarm_level,
b.equip_name,b.equip_num,
c.alarm_name,c.alarm_info_unit
from ipc_alarm_record a
@ -62,6 +63,7 @@
<if test="alarmRulesId != null and alarmRulesId != ''"> and a.alarm_rules_id = #{alarmRulesId}</if>
<if test="equipId != null and equipId != ''"> and a.equip_id = #{equipId}</if>
<if test="sensorId != null and sensorId != ''"> and a.sensor_id = #{sensorId}</if>
<if test="nameKey != null and nameKey != ''"> and a.name_key = #{nameKey}</if>
<if test="content != null and content != ''"> and a.content = #{content}</if>
<if test="alarmValue != null "> and a.alarm_value = #{alarmValue}</if>
<if test="result != null and result != ''"> and a.result = #{result}</if>
@ -85,6 +87,7 @@
<if test="alarmRulesId != null">alarm_rules_id,</if>
<if test="equipId != null">equip_id,</if>
<if test="sensorId != null">sensor_id,</if>
<if test="nameKey != null">name_key,</if>
<if test="content != null">content,</if>
<if test="alarmValue != null">alarm_value,</if>
<if test="alarmTime != null">alarm_time,</if>
@ -97,6 +100,7 @@
<if test="alarmRulesId != null">#{alarmRulesId},</if>
<if test="equipId != null">#{equipId},</if>
<if test="sensorId != null">#{sensorId},</if>
<if test="nameKey != null">#{nameKey},</if>
<if test="content != null">#{content},</if>
<if test="alarmValue != null">#{alarmValue},</if>
<if test="alarmTime != null">#{alarmTime},</if>
@ -109,21 +113,20 @@
<!-- 批量新增报警记录 batchInsertIpcAlarmRecord-->
<insert id="batchInsertIpcAlarmRecord" parameterType="java.util.List">
insert into ipc_alarm_record
(alarm_rules_id,equip_id,sensor_id,content,alarm_value,alarm_time,status,operator,alarm_level)
insert into ipc_alarm_record(alarm_rules_id,equip_id,sensor_id,name_key,content,alarm_value,alarm_time,status,operator,alarm_level)
values
<foreach collection="list" item="item" separator=",">
(#{item.alarmRulesId},
#{item.equipId},
#{item.sensorId},
#{item.nameKey},
#{item.content},
#{item.alarmValue},
#{item.alarmTime},
#{item.status},
#{item.operator}
#{item.operator},
#{item.alarmLevel})
</foreach>
;
</insert>
<update id="updateIpcAlarmRecord" parameterType="IpcAlarmRecord">
@ -132,6 +135,7 @@
<if test="alarmRulesId != null">alarm_rules_id = #{alarmRulesId},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="sensorId != null">sensor_id = #{sensorId},</if>
<if test="nameKey != null">name_key = #{nameKey},</if>
<if test="content != null">content = #{content},</if>
<if test="alarmValue != null">alarm_value = #{alarmValue},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>

View File

@ -42,8 +42,8 @@
<if test="referenceCon != null and referenceCon != ''"> and reference_con = #{referenceCon}</if>
<if test="alarmLevel != null "> and alarm_level = #{alarmLevel}</if>
<if test="sort != null "> and sort = #{sort}</if>
order by type
</where>
order by type
</select>
<select id="selectIpcAlarmRulesById" parameterType="String" resultMap="IpcAlarmRulesResult">

View File

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.industrial.mapper.IpcFaultTreeConfigMapper">
<resultMap type="com.inspur.industrial.domain.IpcFaultTreeConfig" id="IpcFaultTreeConfigResult">
<result property="nodeId" column="node_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="nodeName" column="node_name"/>
<result property="orderNum" column="order_num"/>
<result property="equipId" column="equip_id"/>
<result property="iconCls" column="icon_cls"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="nodeDefaultColor" column="node_default_color"/>
<result property="nodeAlarmColor" column="node_alarm_color"/>
<result property="isLeaf" column="is_leaf"/>
<result property="isAlarm" column="is_alarm"/>
<result property="alarmRuleConfigId" column="alarm_rule_config_id"/>
<result property="alarmRuleConfigDescription" column="alarm_rule_config_description"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectIpcFaultTreeConfigVo">
select node_id,
parent_id,
ancestors,
node_name,
order_num,
equip_id,
icon_cls,
node_shape_type,
node_default_color,
node_alarm_color,
is_leaf,
is_alarm,
status,
del_flag,
create_by,
create_time,
update_by,
update_time,
alarm_rule_config_id,
alarm_rule_config_description
from ipc_fault_tree_config
</sql>
<select id="selectIpcFaultTreeConfigList" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig"
resultMap="IpcFaultTreeConfigResult">
<include refid="selectIpcFaultTreeConfigVo"/>
<where>
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="nodeName != null and nodeName != ''">and node_name like concat('%', #{nodeName}, '%')</if>
<if test="orderNum != null ">and order_num = #{orderNum}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="iconCls != null and iconCls != ''">and icon_cls = #{iconCls}</if>
<if test="nodeShapeType != null and nodeShapeType != ''">and node_shape_type = #{nodeShapeType}</if>
<if test="nodeDefaultColor != null and nodeDefaultColor != ''">and node_default_color =
#{nodeDefaultColor}
</if>
<if test="nodeAlarmColor != null and nodeAlarmColor != ''">and node_alarm_color = #{nodeAlarmColor}</if>
<if test="isAlarm != null and isAlarm != ''">and is_alarm = #{isAlarm}</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
order by parent_id,order_num
</select>
<select id="selectIpcFaultTreeConfigByNodeId" parameterType="Long" resultMap="IpcFaultTreeConfigResult">
<include refid="selectIpcFaultTreeConfigVo"/>
where node_id = #{nodeId}
</select>
<select id="hasChild" parameterType="Long" resultType="int">
select count(0)
from ipc_fault_tree_config
where parent_id = #{nodeId}
</select>
<insert id="insertIpcFaultTreeConfig" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig"
useGeneratedKeys="true" keyProperty="nodeId">
insert into ipc_fault_tree_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="nodeName != null">node_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="equipId != null">equip_id,</if>
<if test="iconCls != null">icon_cls,</if>
<if test="nodeShapeType != null">node_shape_type,</if>
<if test="nodeDefaultColor != null">node_default_color,</if>
<if test="nodeAlarmColor != null">node_alarm_color,</if>
<if test="isLeaf != null">is_leaf,</if>
<if test="isAlarm != null">is_alarm,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="alarmRuleConfigId != null">alarm_rule_config_id,</if>
<if test="alarmRuleConfigDescription != null">alarm_rule_config_description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="equipId != null">#{equipId},</if>
<if test="iconCls != null">#{iconCls},</if>
<if test="nodeShapeType != null">#{nodeShapeType},</if>
<if test="nodeDefaultColor != null">#{nodeDefaultColor},</if>
<if test="nodeAlarmColor != null">#{nodeAlarmColor},</if>
<if test="isLeaf != null">#{isLeaf},</if>
<if test="isAlarm != null">#{isAlarm},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="alarmRuleConfigId != null">#{alarmRuleConfigId},</if>
<if test="alarmRuleConfigDescription != null">#{alarmRuleConfigDescription},</if>
</trim>
</insert>
<update id="updateIpcFaultTreeConfig" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig">
update ipc_fault_tree_config
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="iconCls != null">icon_cls = #{iconCls},</if>
<if test="nodeShapeType != null">node_shape_type = #{nodeShapeType},</if>
<if test="nodeDefaultColor != null">node_default_color = #{nodeDefaultColor},</if>
<if test="nodeAlarmColor != null">node_alarm_color = #{nodeAlarmColor},</if>
<if test="isLeaf != null">is_leaf = #{isLeaf},</if>
<if test="isAlarm != null">is_alarm = #{isAlarm},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alarmRuleConfigId != null">alarm_rule_config_id = #{alarmRuleConfigId},</if>
<if test="alarmRuleConfigDescription != null">alarm_rule_config_description =
#{alarmRuleConfigDescription},
</if>
</trim>
where node_id = #{nodeId}
</update>
<delete id="deleteIpcFaultTreeConfigByNodeId" parameterType="Long">
delete
from ipc_fault_tree_config
where node_id = #{nodeId}
</delete>
<delete id="deleteIpcFaultTreeConfigByNodeIds" parameterType="String">
delete from ipc_fault_tree_config where node_id in
<foreach item="nodeId" collection="array" open="(" separator="," close=")">
#{nodeId}
</foreach>
</delete>
<!-- 故障树显示数据-->
<resultMap type="com.inspur.industrial.domain.IpcFaultTreeShow" id="IpcFaultTreeShowResult">
<result property="nodeId" column="node_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="label" column="label"/>
<result property="orderNum" column="order_num"/>
<result property="iconCls" column="icon_cls"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="content" column="content"/>
<result property="nodeDsc" column="nodeDsc"/>
<result property="nodeBorderColor" column="nodeBorderColor"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="nodeFontColor" column="nodeFontColor"/>
</resultMap>
<select id="getFaultTreeShow" parameterType="string" resultMap="IpcFaultTreeConfigResult">
SELECT a.node_id,
a.parent_id,
a.ancestors,
a.node_name,
a.order_num,
a.equip_id,
a.icon_cls,
a.node_shape_type,
a.node_default_color,
a.node_alarm_color,
a.is_leaf,
a.status,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.alarm_rule_config_id,
a.alarm_rule_config_description,
CASE
WHEN b.num > 0 AND c.type= 0 THEN
'1'
ELSE '0'
END is_alarm
FROM (SELECT * FROM ipc_fault_tree_config WHERE STATUS = '0' AND equip_id = #{equipId}) a
LEFT JOIN (SELECT alarm_rules_id, count(0) num
FROM `ipc_alarm_record`
WHERE status = 0
AND equip_id = #{equipId}
GROUP BY alarm_rules_id) b ON a.alarm_rule_config_id = b.alarm_rules_id
LEFT JOIN ipc_alarm_rules c ON b.alarm_rules_id = c.id
</select>
</mapper>

View File

@ -9,6 +9,15 @@ export function listRecord(query) {
});
}
// 不分页查询所有报警记录列表
export function listAllRecord(query) {
return request({
url: "/alarm/record/listAll",
method: "get",
params: query,
});
}
// 查询报警记录详细
export function getRecord(id) {
return request({

View File

@ -143,8 +143,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="sjyltxWarning"></lbCompents>
<!-- <div class="warn">{{ sjyltxWarning }} </div>-->
<!-- <lbCompents :showData="sjyltxWarning"></lbCompents> -->
<div class="warn">{{ sjyltxWarning }} </div>
</el-footer>
</el-container>
</el-col>
@ -164,11 +164,8 @@
id="xtyl"
style="height: 90%"
></div>
<div
@click="trendClick('sys_press'
,'系统压力','bar')"
style="height:10%;text-align: center;font-size: 16px;color:#26DE86"
>系统压力</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span @click="trendClick('sys_press'
,'系统压力','bar')">系统压力</span></div>
</el-col>
<el-col
:span="8"
@ -178,11 +175,8 @@
id="xtyw"
style="height: 90%"
></div>
<div
@click="trendClick('sys_temp'
,'系统液温','℃')"
style="height:10%;text-align: center;font-size: 16px;color:#109CFB"
>系统液温</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#109CFB"><span @click="trendClick('sys_temp'
,'系统液温','℃')">系统液温</span></div>
</el-col>
<el-col
:span="8"
@ -203,11 +197,8 @@
<div>最大值<span class="yeweiSpan">{{ xtyweimax }}</span></div>
</div>
</div>
<div
@click="trendClick('sys_level'
,'系统液位','cP')"
style="height:10%;text-align: center;font-size: 16px;color:#109CFB;position:relative;z-index: 999;top:-110%;"
>系统液位(CP)</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#109CFB;position:relative;z-index: 999;top:-110%;"><span @click="trendClick('sys_level'
,'系统液位','cP')">系统液位(CP)</span></div>
</el-col>
</el-row>
@ -220,11 +211,8 @@
id="bscll"
style="height: 90%"
></div>
<div
@click="trendClick('sys_flw'
,'泵输出流量','L/min')"
style="height:10%;text-align: center;font-size: 16px;color:#2ACDDE"
>泵输出流量</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#2ACDDE"><span @click="trendClick('sys_flw'
,'泵输出流量','L/min')">泵输出流量</span></div>
</el-col>
<el-col
:span="8"
@ -250,8 +238,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="mainWarning"></lbCompents>
<!-- <div class="warn">{{mainWarning}}</div> -->
<!-- <lbCompents :showData="mainWarning"></lbCompents> -->
<div class="warn">{{mainWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -281,8 +269,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="sysecWarning"></lbCompents>
<!-- <div class="warn">{{sysecWarning}}</div> -->
<!-- <lbCompents :showData="sysecWarning"></lbCompents> -->
<div class="warn">{{sysecWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -389,8 +377,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="llyltxWarning"></lbCompents>
<!-- <div class="warn">{{llyltxWarning}}</div> -->
<!-- <lbCompents :showData="llyltxWarning"></lbCompents> -->
<div class="warn">{{llyltxWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -465,8 +453,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="ylkldWarning"></lbCompents>
<!-- <div class="warn">{{ylkldWarning}}</div> -->
<!-- <lbCompents :showData="ylkldWarning"></lbCompents> -->
<div class="warn">{{ylkldWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -795,6 +783,8 @@ import {
getStatusByEquipName,
getMonitorInfoByEquipName,
} from "@/api/industrial/sysStatus.js";
import { listAllRecord } from "@/api/industrial/record";
export default {
name: "yxjk",
components: { lbCompents },
@ -943,7 +933,6 @@ export default {
//
this.queryData();
}, 1000);
this.queryHistoryData();
//
// this.historyIntervalTask = setInterval(() => {
// //
@ -954,6 +943,7 @@ export default {
getSysStatusData(query) {
getStatusByEquipName(query).then((response) => {
this.sysStatus = response.data;
this.queryAlarmRecordData(this.sysStatus.equipId);
});
},
getMonitorData(query) {
@ -1173,29 +1163,88 @@ export default {
this.initchart([], [], "", "");
this.handleQuery();
},
queryHistoryData() {
cydgdataHistory().then((response) => {
queryAlarmRecordData(equipId) {
let query = {
equipId: equipId,
};
listAllRecord(query).then((response) => {
//
this.mainWarning = response.data.filter((item) => item.type == "1");
// .map((obj) => obj.alarmDetail + obj.alarmTime)
this.mainWarning = response.data
.filter(
(item) =>
item.nameKey == "sys_press" ||
item.nameKey == "sys_flw" ||
item.nameKey == "sys_level" ||
item.nameKey == "sys_temp"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4P/Q
this.sjyltxWarning = response.data.filter((item) => item.type == "3");
// .map((obj) => obj.alarmDetail)
this.sjyltxWarning = response.data
.filter(
(item) =>
item.nameKey == "opr_soft_real_press" ||
item.nameKey == "opr_soft_bond_press" ||
item.nameKey == "opr_soft_act_press" ||
item.nameKey == "opr_hot_real_press" ||
item.nameKey == "opr_hot_bond_press" ||
item.nameKey == "opr_hot_act_press" ||
item.nameKey == "driven_soft_real_press" ||
item.nameKey == "driven_soft_bond_press" ||
item.nameKey == "driven_soft_act_press" ||
item.nameKey == "driven_hot_real_press" ||
item.nameKey == "driven_hot_bond_press" ||
item.nameKey == "driven_hot_act_press" ||
item.nameKey == "opr_soft_flw" ||
item.nameKey == "opr_hot_flw" ||
item.nameKey == "driven_soft_flw" ||
item.nameKey == "driven_hot_flw"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
//
this.sysecWarning = response.data.filter(
(item) => item.alarmNameKey == "zdjdl"
);
// .map((obj) => obj.alarmDetail)
this.sysecWarning = response.data
.filter((item) => item.nameKey == "sys_cur")
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4P/Q
this.llyltxWarning = response.data.filter((item) => item.type == "5");
// .map((obj) => obj.alarmDetail)
this.llyltxWarning = response.data
.filter(
(item) =>
item.nameKey == "opr_bottom_press" ||
item.nameKey == "driven_bottom_press" ||
item.nameKey == "opr_bottom_set_press" ||
item.nameKey == "driven_bottom_set_press"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4
this.ylkldWarning = response.data.filter((item) => item.type == "2");
// .map((obj) => obj.alarmDetail)
this.ylkldWarning = response.data
.filter(
(item) =>
item.nameKey == "oil_water" ||
item.nameKey == "visc" ||
item.nameKey == "gran4" ||
item.nameKey == "gran6" ||
item.nameKey == "gran14" ||
item.nameKey == "gran21"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
});
},
@ -3016,7 +3065,7 @@ export default {
font-size: 18px;
/*text-overflow: unset;*/
/* 调整动画时长和效果 */
animation: marquee 5s linear infinite;
animation: marquee 300s linear infinite;
}
@keyframes marquee {
0% {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff