diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRecordController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRecordController.java index 8e5117c..4cd7a2b 100644 --- a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRecordController.java +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRecordController.java @@ -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 list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord); + return AjaxResult.success(list); + } + /** * 导出报警记录列表 */ diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcFaultTreeConfigController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcFaultTreeConfigController.java new file mode 100644 index 0000000..6e0b55c --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcFaultTreeConfigController.java @@ -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 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 list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig); + ExcelUtil util = new ExcelUtil(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)); + } + +} diff --git a/zfipc-server/zfipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java b/zfipc-server/zfipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java index 40c054d..998ece2 100644 --- a/zfipc-server/zfipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java +++ b/zfipc-server/zfipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java @@ -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:"; } diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java index d6c6716..a16f1a3 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java @@ -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 tags = new TreeMap(); tags.put("equ_id","5d6c1a1374ea490a91e1361c1f5400aa"); Map fields = new TreeMap(); + IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class); + IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class); + IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class); + List 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 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); + } } diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java index cbf1ca0..7c6d81f 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData3SyncThread.java @@ -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 fields = new TreeMap(); + IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class); + IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class); + IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class); + + List 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 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); + } } diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java index fa362cc..abbbabc 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java @@ -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 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(); diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRecord.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRecord.java index 5f9915c..2722c3c 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRecord.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRecord.java @@ -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()) diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeConfig.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeConfig.java new file mode 100644 index 0000000..dbe137d --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeConfig.java @@ -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(); + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeShow.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeShow.java new file mode 100644 index 0000000..bce56c8 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcFaultTreeShow.java @@ -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 + '\'' + + '}'; + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java new file mode 100644 index 0000000..9f0ad3d --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java @@ -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 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 getFaultTreeShow(String equipId); +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java index b279a34..4755ba6 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java @@ -64,5 +64,13 @@ public interface IIpcAlarmRulesService * @return 结果 */ public int deleteIpcAlarmRulesById(String id); + + /** + * 获取告警规则缓存 + * + * @param part 监测部位 + * @return 告警规则配置集合 + */ + public List selectIpcAlarmRulesConfigListByCache(String equipId); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcFaultTreeConfigService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcFaultTreeConfigService.java new file mode 100644 index 0000000..f7518b5 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcFaultTreeConfigService.java @@ -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 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 getFaultTreeShow(String equipId); +} 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 4c4059a..5aa1966 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 @@ -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"));//系统湿度 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java index 005e2c1..f4223c2 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java @@ -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 rules = selectIpcAlarmRulesList(null); + List equips = ipcEquipInfoService.selectIpcEquipInfoList(null); + for (IpcEquipInfo equip : equips) { + List 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 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 selectIpcAlarmRulesConfigListByCache(String equipId){ + List rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId); + if (rules == null || rules.size() == 0){ + List rulesList = selectIpcAlarmRulesByEquipId(equipId); + redisCache.setCacheList(CacheConstants.IPC_RULES_KEY + equipId,rulesList); + return rulesList; + } + return rules; + } } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcFaultTreeConfigServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcFaultTreeConfigServiceImpl.java new file mode 100644 index 0000000..b3e885e --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcFaultTreeConfigServiceImpl.java @@ -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 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 getFaultTreeShow(String equipId){ + return ipcFaultTreeConfigMapper.getFaultTreeShow(equipId); + } +} 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 f1bd5e0..5a407a7 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 @@ -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); diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml index 1e6072e..1f4cfd9 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml @@ -8,6 +8,7 @@ + @@ -48,7 +49,7 @@ - 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 @@ and a.alarm_rules_id = #{alarmRulesId} and a.equip_id = #{equipId} and a.sensor_id = #{sensorId} + and a.name_key = #{nameKey} and a.content = #{content} and a.alarm_value = #{alarmValue} and a.result = #{result} @@ -85,6 +87,7 @@ alarm_rules_id, equip_id, sensor_id, + name_key, content, alarm_value, alarm_time, @@ -97,6 +100,7 @@ #{alarmRulesId}, #{equipId}, #{sensorId}, + #{nameKey}, #{content}, #{alarmValue}, #{alarmTime}, @@ -109,21 +113,20 @@ - 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 (#{item.alarmRulesId}, #{item.equipId}, #{item.sensorId}, + #{item.nameKey}, #{item.content}, #{item.alarmValue}, #{item.alarmTime}, #{item.status}, - #{item.operator} + #{item.operator}, #{item.alarmLevel}) - ; @@ -132,6 +135,7 @@ alarm_rules_id = #{alarmRulesId}, equip_id = #{equipId}, sensor_id = #{sensorId}, + name_key = #{nameKey}, content = #{content}, alarm_value = #{alarmValue}, alarm_time = #{alarmTime}, diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml index e991aa4..cc5ef01 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml @@ -42,8 +42,8 @@ and reference_con = #{referenceCon} and alarm_level = #{alarmLevel} and sort = #{sort} - order by type + order by type + + + and parent_id = #{parentId} + and ancestors = #{ancestors} + and node_name like concat('%', #{nodeName}, '%') + and order_num = #{orderNum} + and equip_id = #{equipId} + and icon_cls = #{iconCls} + and node_shape_type = #{nodeShapeType} + and node_default_color = + #{nodeDefaultColor} + + and node_alarm_color = #{nodeAlarmColor} + and is_alarm = #{isAlarm} + and status = #{status} + + order by parent_id,order_num + + + + + + + insert into ipc_fault_tree_config + + 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, + + + #{parentId}, + #{ancestors}, + #{nodeName}, + #{orderNum}, + #{equipId}, + #{iconCls}, + #{nodeShapeType}, + #{nodeDefaultColor}, + #{nodeAlarmColor}, + #{isLeaf}, + #{isAlarm}, + #{status}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmRuleConfigId}, + #{alarmRuleConfigDescription}, + + + + + update ipc_fault_tree_config + + parent_id = #{parentId}, + ancestors = #{ancestors}, + node_name = #{nodeName}, + order_num = #{orderNum}, + equip_id = #{equipId}, + icon_cls = #{iconCls}, + node_shape_type = #{nodeShapeType}, + node_default_color = #{nodeDefaultColor}, + node_alarm_color = #{nodeAlarmColor}, + is_leaf = #{isLeaf}, + is_alarm = #{isAlarm}, + status = #{status}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_rule_config_id = #{alarmRuleConfigId}, + alarm_rule_config_description = + #{alarmRuleConfigDescription}, + + + where node_id = #{nodeId} + + + + delete + from ipc_fault_tree_config + where node_id = #{nodeId} + + + + delete from ipc_fault_tree_config where node_id in + + #{nodeId} + + + + + + + + + + + + + + + + + + + + diff --git a/zfipc-ui/src/api/industrial/record.js b/zfipc-ui/src/api/industrial/record.js index d20a60b..d7b1827 100644 --- a/zfipc-ui/src/api/industrial/record.js +++ b/zfipc-ui/src/api/industrial/record.js @@ -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({ diff --git a/zfipc-ui/src/views/zf/cydg/yxjk.vue b/zfipc-ui/src/views/zf/cydg/yxjk.vue index b060af5..1365c3f 100644 --- a/zfipc-ui/src/views/zf/cydg/yxjk.vue +++ b/zfipc-ui/src/views/zf/cydg/yxjk.vue @@ -143,8 +143,8 @@
- - + +
{{ sjyltxWarning }}
@@ -164,11 +164,8 @@ id="xtyl" style="height: 90%" > -
系统压力
+
系统压力
-
系统液温
+
系统液温
最大值{{ xtyweimax }} -
系统液位(CP)
+
系统液位(CP)
@@ -220,11 +211,8 @@ id="bscll" style="height: 90%" > -
泵输出流量
+
泵输出流量
- - + +
{{mainWarning}}
@@ -281,8 +269,8 @@
- - + +
{{sysecWarning}}
@@ -389,8 +377,8 @@
- - + +
{{llyltxWarning}}
@@ -465,8 +453,8 @@
- - + +
{{ylkldWarning}}
@@ -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(","); // ZFSC4超压平衡缸P/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(","); // ZFSC4超压底缸加压压区P/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% { diff --git a/zfipc-ui/src/views/zf/zgdgBottom/index.vue b/zfipc-ui/src/views/zf/zgdgBottom/index.vue index 975463e..45528e6 100644 --- a/zfipc-ui/src/views/zf/zgdgBottom/index.vue +++ b/zfipc-ui/src/views/zf/zgdgBottom/index.vue @@ -14,7 +14,11 @@ :span="4" style="height: 100%" > - 一压区 + 一压区 {{sjylData[0]}} bar @@ -22,7 +26,11 @@ :span="4" style="height: 100%" > - 二压区 + 二压区 {{sjylData[1]}} bar @@ -30,7 +38,11 @@ :span="4" style="height: 100%" > - 三压区 + 三压区 {{sjylData[2]}} bar @@ -38,7 +50,11 @@ :span="4" style="height: 100%" > - 四压区 + 四压区 {{sjylData[2]}} bar @@ -46,7 +62,11 @@ :span="4" style="height: 100%" > - 五压区 + 五压区 {{sjylData[4]}} bar @@ -54,7 +74,11 @@ :span="4" style="height: 100%" > - 六压区 + 六压区 {{sjylData[5]}} bar @@ -64,7 +88,11 @@ :span="4" style="height: 100%" > - 七压区 + 七压区 {{sjylData[6]}} bar @@ -72,7 +100,11 @@ :span="4" style="height: 100%" > - 八压区 + 八压区 {{sjylData[7]}} bar @@ -80,15 +112,23 @@ :span="4" style="height: 100%" > - 九压区 + 九压区 {{sjylData[8]}} bar - 十压区 + 十压区 {{sjylData[9]}} bar @@ -96,7 +136,11 @@ :span="8" style="height: 100%" > - 十一压区 + 十一压区 {{sjylData[10]}} bar @@ -112,8 +156,8 @@
- - + +
{{sjyltxWarning}}
@@ -133,7 +177,8 @@ id="xtyl" style="height: 90%" > -
系统压力
+
系统压力
-
系统液温
+
系统液温
最大值{{ xtyweimax }} -
系统液位(CP)
+
系统液位(CP)
@@ -177,7 +224,8 @@ id="zbscll" style="height: 90%" > -
主泵流量
+
泵输出流量
- - + +
{{mainWarning}}
@@ -216,14 +264,12 @@ 系统状态信息
- 电机总耗电量{{powerConsumption}} - 电机实时电流{{zdjdl}}A + @click="trendClick('sys_cur' + ,'电机电流','A')" + >电机实时电流{{zdjdl}}A
- - + +
{{sysecWarning}}
@@ -252,7 +298,11 @@ :span="4" style="height: 100%" > - 一压区 + 一压区 {{llylData[0]}} L/min @@ -260,7 +310,11 @@ :span="4" style="height: 100%" > - 二压区 + 二压区 {{llylData[1]}} L/min @@ -268,7 +322,11 @@ :span="4" style="height: 100%" > - 三压区 + 三压区 {{llylData[2]}} L/min @@ -276,7 +334,11 @@ :span="4" style="height: 100%" > - 四压区 + 四压区 {{llylData[2]}} L/min @@ -284,7 +346,11 @@ :span="4" style="height: 100%" > - 五压区 + 五压区 {{llylData[4]}} L/min @@ -292,7 +358,11 @@ :span="4" style="height: 100%" > - 六压区 + 六压区 {{llylData[5]}} L/min @@ -302,7 +372,11 @@ :span="4" style="height: 100%" > - 七压区 + 七压区 {{llylData[6]}} L/min @@ -310,7 +384,11 @@ :span="4" style="height: 100%" > - 八压区 + 八压区 {{llylData[7]}} L/min @@ -318,7 +396,11 @@ :span="4" style="height: 100%" > - 九压区 + 九压区 {{llylData[8]}} L/min @@ -326,7 +408,11 @@ :span="4" style="height: 100%" > - 十压区 + 十压区 {{llylData[9]}} L/min @@ -334,7 +420,11 @@ :span="8" style="height: 100%" > - 十一压区 + 十一压区 {{llylData[10]}} L/min @@ -350,8 +440,8 @@
- - + +
{{ llyltxWarning }}
@@ -376,6 +466,10 @@ > + 4um {{ yykld4 }} @@ -410,8 +504,8 @@
- - + +
{{ylkldWarning}}
@@ -441,7 +535,7 @@ :span="15" class="device-card-content-value" > - 2023-10-12 11:20:23 + {{this.sysStatus.shutdownTime}}
2023-10-12 11:21:09 + > {{this.sysStatus.standbyTime}} 2023-10-13 10:52:08 + > {{this.sysStatus.trialTime}} @@ -499,7 +593,7 @@ 2023-10-21 12:03:54 + > {{this.sysStatus.normalTime}}
@@ -561,7 +655,7 @@ :span="15" class="col-flex" > - 中高顶辊 + {{ this.monitorInfo.equipName }} - S02-27-001 + {{ this.monitorInfo.equipNum }} @@ -605,7 +699,7 @@ style="height:100%" class="col-flex" > - 2023.10.12 11:20:23 + {{ this.monitorInfo.nowTime }} - 5小时60分30秒 + {{ this.monitorInfo.onlineTime }} @@ -649,7 +743,7 @@ 2023.10.12 11:20:23 至 2023-10-21 12:03:54 + >{{ this.monitorInfo.startTime }}
@@ -657,24 +751,98 @@
+ + +
+ 时间 + + + 查 询 + 重置 +
+ +
+ +