From 8866a6b89036fcb0febe1e8a8df966219bb28783 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Tue, 9 Apr 2024 18:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E8=A7=84=E5=88=99=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../industrial/IpcAlarmRulesController.java | 105 +++ .../IpcMonitorDataInfoController.java | 118 +++ .../datasyn/modbus/IPCDataSyncTask.java | 6 + .../datasyn/modbus/IPCDataSyncThread.java | 8 +- .../industrial/domain/IpcAlarmRules.java | 222 +++++ .../industrial/domain/IpcMonitorDataInfo.java | 126 +++ .../mapper/IpcAlarmRulesMapper.java | 62 ++ .../mapper/IpcMonitorDataInfoMapper.java | 61 ++ .../service/IIpcAlarmRulesService.java | 64 ++ .../service/IIpcMonitorDataInfoService.java | 61 ++ .../impl/IpcAlarmRulesServiceImpl.java | 130 +++ .../impl/IpcMonitorDataInfoServiceImpl.java | 96 ++ .../mapper/industrial/IpcAlarmRulesMapper.xml | 122 +++ .../industrial/IpcMonitorDataInfoMapper.xml | 101 ++ zfipc-ui/src/api/industrial/rules.js | 44 + zfipc-ui/src/views/warn/alarm/index.vue | 884 ++++++++++++------ 16 files changed, 1907 insertions(+), 303 deletions(-) create mode 100644 zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRulesController.java create mode 100644 zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcMonitorDataInfoController.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRules.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcMonitorDataInfo.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcMonitorDataInfoService.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcMonitorDataInfoServiceImpl.java create mode 100644 zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml create mode 100644 zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcMonitorDataInfoMapper.xml create mode 100644 zfipc-ui/src/api/industrial/rules.js diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRulesController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRulesController.java new file mode 100644 index 0000000..6f387a6 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcAlarmRulesController.java @@ -0,0 +1,105 @@ +package com.inspur.web.controller.industrial; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +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.industrial.domain.IpcAlarmRules; +import com.inspur.industrial.service.IIpcAlarmRulesService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 设备报警规则Controller + * + * @Author zhangjunwen + * @create 2024/4/9 + */ +@RestController +@RequestMapping("/system/rules") +public class IpcAlarmRulesController extends BaseController +{ + @Autowired + private IIpcAlarmRulesService ipcAlarmRulesService; + + /** + * 查询设备报警规则列表 + */ + @PreAuthorize("@ss.hasPermi('system:rules:list')") + @GetMapping("/list") + public TableDataInfo list(IpcAlarmRules ipcAlarmRules) + { + startPage(); + List list = ipcAlarmRulesService.selectIpcAlarmRulesList(ipcAlarmRules); + return getDataTable(list); + } + + /** + * 导出设备报警规则列表 + */ + @PreAuthorize("@ss.hasPermi('system:rules:export')") + @Log(title = "设备报警规则", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcAlarmRules ipcAlarmRules) + { + List list = ipcAlarmRulesService.selectIpcAlarmRulesList(ipcAlarmRules); + ExcelUtil util = new ExcelUtil(IpcAlarmRules.class); + util.exportExcel(response, list, "设备报警规则数据"); + } + + /** + * 获取设备报警规则详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:rules:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return AjaxResult.success(ipcAlarmRulesService.selectIpcAlarmRulesById(id)); + } + + /** + * 新增设备报警规则 + */ + @PreAuthorize("@ss.hasPermi('system:rules:add')") + @Log(title = "设备报警规则", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcAlarmRules ipcAlarmRules) + { + return toAjax(ipcAlarmRulesService.insertIpcAlarmRules(ipcAlarmRules)); + } + + /** + * 修改设备报警规则 + */ + @PreAuthorize("@ss.hasPermi('system:rules:edit')") + @Log(title = "设备报警规则", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcAlarmRules ipcAlarmRules) + { + return toAjax(ipcAlarmRulesService.updateIpcAlarmRules(ipcAlarmRules)); + } + + /** + * 删除设备报警规则 + */ + @PreAuthorize("@ss.hasPermi('system:rules:remove')") + @Log(title = "设备报警规则", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(ipcAlarmRulesService.deleteIpcAlarmRulesByIds(ids)); + } +} + diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcMonitorDataInfoController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcMonitorDataInfoController.java new file mode 100644 index 0000000..7f8ebb1 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcMonitorDataInfoController.java @@ -0,0 +1,118 @@ +package com.inspur.web.controller.industrial; + + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +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.industrial.domain.IpcMonitorDataInfo; +import com.inspur.industrial.service.IIpcMonitorDataInfoService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 监控数据信息Controller + * + * @author inspur + * @date 2024-04-09 + */ +@RestController +@RequestMapping("/monitorData/info") +public class IpcMonitorDataInfoController extends BaseController +{ + @Autowired + private IIpcMonitorDataInfoService ipcMonitorDataInfoService; + + /** + * 查询监控数据信息列表 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:list')") + @GetMapping("/list") + public TableDataInfo list(IpcMonitorDataInfo ipcMonitorDataInfo) + { + startPage(); + List list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo); + return getDataTable(list); + } + + /** + * 根据条件查询所有数据 + * @param ipcMonitorDataInfo + * @return + */ + @GetMapping("/getAll") + public AjaxResult getAllData(IpcMonitorDataInfo ipcMonitorDataInfo) + { + List list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo); + return AjaxResult.success(list); + } + + /** + * 导出监控数据信息列表 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:export')") + @Log(title = "监控数据信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcMonitorDataInfo ipcMonitorDataInfo) + { + List list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo); + ExcelUtil util = new ExcelUtil(IpcMonitorDataInfo.class); + util.exportExcel(response, list, "监控数据信息数据"); + } + + /** + * 获取监控数据信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(ipcMonitorDataInfoService.selectIpcMonitorDataInfoById(id)); + } + + /** + * 新增监控数据信息 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:add')") + @Log(title = "监控数据信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcMonitorDataInfo ipcMonitorDataInfo) + { + return toAjax(ipcMonitorDataInfoService.insertIpcMonitorDataInfo(ipcMonitorDataInfo)); + } + + /** + * 修改监控数据信息 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:edit')") + @Log(title = "监控数据信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcMonitorDataInfo ipcMonitorDataInfo) + { + return toAjax(ipcMonitorDataInfoService.updateIpcMonitorDataInfo(ipcMonitorDataInfo)); + } + + /** + * 删除监控数据信息 + */ + @PreAuthorize("@ss.hasPermi('monitorData:info:remove')") + @Log(title = "监控数据信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(ipcMonitorDataInfoService.deleteIpcMonitorDataInfoByIds(ids)); + } +} + diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java index c63ae78..702b38f 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncTask.java @@ -1,5 +1,6 @@ package com.inspur.datasyn.modbus; +import com.inspur.industrial.service.IIpcAlarmRulesService; import com.serotonin.modbus4j.ModbusFactory; import com.serotonin.modbus4j.ModbusMaster; import com.serotonin.modbus4j.ip.IpParameters; @@ -27,6 +28,9 @@ public class IPCDataSyncTask implements ApplicationRunner { @Autowired private ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Autowired + private IIpcAlarmRulesService ipcAlarmRulesService; + @Value("${datasyn.modbus.host}") private String host; @Value("${datasyn.modbus.port}") @@ -76,6 +80,8 @@ public class IPCDataSyncTask implements ApplicationRunner { threadPoolTaskExecutor.execute(new IPCData3SyncThread(null,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()))); } },1000,1000); + + ipcAlarmRulesService.tran(); } } } 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 60fc59c..5823751 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 @@ -70,9 +70,9 @@ public class IPCDataSyncThread implements Runnable { fields.put("sys_press",(float) 0 + Math.random()); // 系统液位 fields.put("sys_level",(float) 0 + Math.random()); - fields.put("ywcsz",0.5); - fields.put("ywmin",0.3); - fields.put("ywmax",1); +// fields.put("ywcsz",0.5); +// fields.put("ywmin",0.3); +// fields.put("ywmax",1); // 系统温度 fields.put("sys_temp",(float) 0 + Math.random()); // 油液颗粒度 @@ -91,7 +91,7 @@ public class IPCDataSyncThread implements Runnable { // 传动侧软辊流量 fields.put("driven_soft_flw",(float) 0 + Math.random()); // 传动侧热辊流量 - fields.put("driven_hot_flw",(float) 0 + Math.random()); + fields.put("[driven_hot_flw]",(float) 0 + Math.random()); //操作侧底缸比例换向阀 fields.put("opr_servo",(float) 0 + Math.random()); //传动侧比例换向阀 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRules.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRules.java new file mode 100644 index 0000000..929f6ba --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcAlarmRules.java @@ -0,0 +1,222 @@ +package com.inspur.industrial.domain; + +import java.math.BigDecimal; +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 设备报警规则对象 ipc_alarm_rules + * + * @author inspur + * @date 2024-04-09 + */ +public class IpcAlarmRules extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警规则信息id */ + private String id; + + /** 报警规则信息名称 */ + @Excel(name = "报警规则信息名称") + private String alarmName; + + /** 报警信息key */ + @Excel(name = "报警信息Key") + private String alarmNameKey; + + /** 报警规则信息单位 */ + @Excel(name = "报警规则信息单位") + private String alarmInfoUnit; + + /** 设备id */ + @Excel(name = "设备id") + private String equipId; + + /** 传感器id */ + @Excel(name = "传感器id") + private String sensorId; + + /** 报警规则上限值 */ + @Excel(name = "报警规则上限值") + private BigDecimal alertUpperBound; + + /** 报警规则下限值 */ + @Excel(name = "报警规则下限值") + private BigDecimal alertLowerBound; + + /** 报警规则信息的类型(0:开机状态,1:待机状态) */ + @Excel(name = "报警规则信息的类型", readConverterExp = "0=:开机状态,1:待机状态") + private Integer type; + + /** 报警描述 */ + @Excel(name = "报警描述") + private String description; + + /** 规则描述 */ + @Excel(name = "规则描述") + private String referenceName; + + /** 判断规则 */ + @Excel(name = "判断规则") + private String referenceCon; + + /** 等级 */ + @Excel(name = "等级") + private Integer alarmLevel; + + /** 排序 */ + @Excel(name = "排序") + private Integer sort; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setAlarmName(String alarmName) + { + this.alarmName = alarmName; + } + + public String getAlarmName() + { + return alarmName; + } + + public String getAlarmNameKey() { + return alarmNameKey; + } + + public void setAlarmNameKey(String alarmNameKey) { + this.alarmNameKey = alarmNameKey; + } + + public void setAlarmInfoUnit(String alarmInfoUnit) + { + this.alarmInfoUnit = alarmInfoUnit; + } + + public String getAlarmInfoUnit() + { + return alarmInfoUnit; + } + public void setEquipId(String equipId) + { + this.equipId = equipId; + } + + public String getEquipId() + { + return equipId; + } + public void setSensorId(String sensorId) + { + this.sensorId = sensorId; + } + + public String getSensorId() + { + return sensorId; + } + public void setAlertUpperBound(BigDecimal alertUpperBound) + { + this.alertUpperBound = alertUpperBound; + } + + public BigDecimal getAlertUpperBound() + { + return alertUpperBound; + } + public void setAlertLowerBound(BigDecimal alertLowerBound) + { + this.alertLowerBound = alertLowerBound; + } + + public BigDecimal getAlertLowerBound() + { + return alertLowerBound; + } + public void setType(Integer type) + { + this.type = type; + } + + public Integer getType() + { + return type; + } + public void setDescription(String description) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + public void setReferenceName(String referenceName) + { + this.referenceName = referenceName; + } + + public String getReferenceName() + { + return referenceName; + } + public void setReferenceCon(String referenceCon) + { + this.referenceCon = referenceCon; + } + + public String getReferenceCon() + { + return referenceCon; + } + public void setAlarmLevel(Integer alarmLevel) + { + this.alarmLevel = alarmLevel; + } + + public Integer getAlarmLevel() + { + return alarmLevel; + } + public void setSort(Integer sort) + { + this.sort = sort; + } + + public Integer getSort() + { + return sort; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("alarmName", getAlarmName()) + .append("alarmNameKey", getAlarmNameKey()) + .append("alarmInfoUnit", getAlarmInfoUnit()) + .append("equipId", getEquipId()) + .append("sensorId", getSensorId()) + .append("alertUpperBound", getAlertUpperBound()) + .append("alertLowerBound", getAlertLowerBound()) + .append("type", getType()) + .append("description", getDescription()) + .append("remark", getRemark()) + .append("referenceName", getReferenceName()) + .append("referenceCon", getReferenceCon()) + .append("alarmLevel", getAlarmLevel()) + .append("sort", getSort()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcMonitorDataInfo.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcMonitorDataInfo.java new file mode 100644 index 0000000..dccf293 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/IpcMonitorDataInfo.java @@ -0,0 +1,126 @@ +package com.inspur.industrial.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 监控数据信息对象 ipc_monitor_data_info + * + * @author inspur + * @date 2024-04-09 + */ +public class IpcMonitorDataInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 监控数据id */ + private Long id; + + /** 所属设备id */ + @Excel(name = "所属设备id") + private String equipId; + + /** 传感器id */ + @Excel(name = "传感器id") + private String sensorId; + + /** 监控数据的名称 */ + @Excel(name = "监控数据的名称") + private String dataName; + + /** 监控数据单位 */ + @Excel(name = "监控数据单位") + private String dataUnit; + + /** 监控数据对应数据字段Key */ + @Excel(name = "监控数据对应数据字段Key") + private String dataKey; + + /** 状态 */ + @Excel(name = "状态") + private Integer status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setEquipId(String equipId) + { + this.equipId = equipId; + } + + public String getEquipId() + { + return equipId; + } + public void setSensorId(String sensorId) + { + this.sensorId = sensorId; + } + + public String getSensorId() + { + return sensorId; + } + public void setDataName(String dataName) + { + this.dataName = dataName; + } + + public String getDataName() + { + return dataName; + } + public void setDataUnit(String dataUnit) + { + this.dataUnit = dataUnit; + } + + public String getDataUnit() + { + return dataUnit; + } + public void setDataKey(String dataKey) + { + this.dataKey = dataKey; + } + + public String getDataKey() + { + return dataKey; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("equipId", getEquipId()) + .append("sensorId", getSensorId()) + .append("dataName", getDataName()) + .append("dataUnit", getDataUnit()) + .append("dataKey", getDataKey()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java new file mode 100644 index 0000000..14f662d --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java @@ -0,0 +1,62 @@ +package com.inspur.industrial.mapper; + +import java.util.List; +import com.inspur.industrial.domain.IpcAlarmRules; + +/** + * 设备报警规则Mapper接口 + * + * @Author zhangjunwen + * @create 2024/4/9 + */ +public interface IpcAlarmRulesMapper +{ + /** + * 查询设备报警规则 + * + * @param id 设备报警规则主键 + * @return 设备报警规则 + */ + public IpcAlarmRules selectIpcAlarmRulesById(String id); + + /** + * 查询设备报警规则列表 + * + * @param ipcAlarmRules 设备报警规则 + * @return 设备报警规则集合 + */ + public List selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules); + + /** + * 新增设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules); + + /** + * 修改设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules); + + /** + * 删除设备报警规则 + * + * @param id 设备报警规则主键 + * @return 结果 + */ + public int deleteIpcAlarmRulesById(String id); + + /** + * 批量删除设备报警规则 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcAlarmRulesByIds(String[] ids); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java new file mode 100644 index 0000000..aa52ef2 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java @@ -0,0 +1,61 @@ +package com.inspur.industrial.mapper; + +import java.util.List; +import com.inspur.industrial.domain.IpcMonitorDataInfo; + +/** + * 监控数据信息Mapper接口 + * + * @author inspur + * @date 2024-04-09 + */ +public interface IpcMonitorDataInfoMapper +{ + /** + * 查询监控数据信息 + * + * @param id 监控数据信息主键 + * @return 监控数据信息 + */ + public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id); + + /** + * 查询监控数据信息列表 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 监控数据信息集合 + */ + public List selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 新增监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 修改监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 删除监控数据信息 + * + * @param id 监控数据信息主键 + * @return 结果 + */ + public int deleteIpcMonitorDataInfoById(Long id); + + /** + * 批量删除监控数据信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcMonitorDataInfoByIds(Long[] ids); +} 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 new file mode 100644 index 0000000..0061540 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRulesService.java @@ -0,0 +1,64 @@ +package com.inspur.industrial.service; + +import java.util.List; +import com.inspur.industrial.domain.IpcAlarmRules; + +/** + * 设备报警规则Service接口 + * + * @Author zhangjunwen + * @create 2024/4/9 + */ +public interface IIpcAlarmRulesService +{ + /** + * 查询设备报警规则 + * + * @param id 设备报警规则主键 + * @return 设备报警规则 + */ + public IpcAlarmRules selectIpcAlarmRulesById(String id); + + /** + * 查询设备报警规则列表 + * + * @param ipcAlarmRules 设备报警规则 + * @return 设备报警规则集合 + */ + public List selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules); + + public void tran(); + + /** + * 新增设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules); + + /** + * 修改设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules); + + /** + * 批量删除设备报警规则 + * + * @param ids 需要删除的设备报警规则主键集合 + * @return 结果 + */ + public int deleteIpcAlarmRulesByIds(String[] ids); + + /** + * 删除设备报警规则信息 + * + * @param id 设备报警规则主键 + * @return 结果 + */ + public int deleteIpcAlarmRulesById(String id); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcMonitorDataInfoService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcMonitorDataInfoService.java new file mode 100644 index 0000000..6091831 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcMonitorDataInfoService.java @@ -0,0 +1,61 @@ +package com.inspur.industrial.service; + +import java.util.List; +import com.inspur.industrial.domain.IpcMonitorDataInfo; + +/** + * 监控数据信息Service接口 + * + * @author inspur + * @date 2024-04-09 + */ +public interface IIpcMonitorDataInfoService +{ + /** + * 查询监控数据信息 + * + * @param id 监控数据信息主键 + * @return 监控数据信息 + */ + public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id); + + /** + * 查询监控数据信息列表 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 监控数据信息集合 + */ + public List selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 新增监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 修改监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo); + + /** + * 批量删除监控数据信息 + * + * @param ids 需要删除的监控数据信息主键集合 + * @return 结果 + */ + public int deleteIpcMonitorDataInfoByIds(Long[] ids); + + /** + * 删除监控数据信息信息 + * + * @param id 监控数据信息主键 + * @return 结果 + */ + public int deleteIpcMonitorDataInfoById(Long id); +} 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 new file mode 100644 index 0000000..ed86d0f --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java @@ -0,0 +1,130 @@ +package com.inspur.industrial.service.impl; + +import java.math.BigDecimal; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import com.inspur.common.utils.uuid.IdUtils; +import com.inspur.industrial.domain.IpcMonitorDataInfo; +import com.inspur.industrial.service.IIpcMonitorDataInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.industrial.mapper.IpcAlarmRulesMapper; +import com.inspur.industrial.domain.IpcAlarmRules; +import com.inspur.industrial.service.IIpcAlarmRulesService; + +import javax.annotation.Resource; + +/** + * 设备报警规则Service业务层处理 + * + * @Author zhangjunwen + * @create 2024/4/9 + */ +@Service +public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService +{ + @Autowired + private IpcAlarmRulesMapper ipcAlarmRulesMapper; + + @Resource + private IIpcMonitorDataInfoService ipcMonitorDataInfoService; + + /** + * 查询设备报警规则 + * + * @param id 设备报警规则主键 + * @return 设备报警规则 + */ + @Override + public IpcAlarmRules selectIpcAlarmRulesById(String id) + { + return ipcAlarmRulesMapper.selectIpcAlarmRulesById(id); + } + + /** + * 查询设备报警规则列表 + * + * @param ipcAlarmRules 设备报警规则 + * @return 设备报警规则 + */ + @Override + public List selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules) + { + return ipcAlarmRulesMapper.selectIpcAlarmRulesList(ipcAlarmRules); + } + + public void tran(){ + List list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(null); + AtomicInteger num = new AtomicInteger(1); + list.forEach(data ->{ + for(int t = 0; t <=1; t++){ + IpcAlarmRules ipcAlarmRules = new IpcAlarmRules(); + ipcAlarmRules.setId(IdUtils.simpleUUID()); + ipcAlarmRules.setAlarmName(data.getDataName()); + ipcAlarmRules.setEquipId(data.getEquipId()); + ipcAlarmRules.setAlarmInfoUnit(data.getDataUnit()); + ipcAlarmRules.setAlarmNameKey(data.getDataKey()); + ipcAlarmRules.setAlertLowerBound(BigDecimal.valueOf(0.81)); + ipcAlarmRules.setAlertUpperBound(BigDecimal.valueOf(1.52)); + ipcAlarmRules.setReferenceCon("区间外"); + ipcAlarmRules.setReferenceName(data.getDataName() + "超出 " + ipcAlarmRules.getAlertLowerBound() + "~" + ipcAlarmRules.getAlertUpperBound()); + ipcAlarmRules.setAlarmLevel(1); + ipcAlarmRules.setType(t); + ipcAlarmRules.setSort(num.get()); + ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules); + } + num.getAndIncrement(); + + }); + } + + /** + * 新增设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + @Override + public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules) + { + return ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules); + } + + /** + * 修改设备报警规则 + * + * @param ipcAlarmRules 设备报警规则 + * @return 结果 + */ + @Override + public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules) + { + return ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules); + } + + /** + * 批量删除设备报警规则 + * + * @param ids 需要删除的设备报警规则主键 + * @return 结果 + */ + @Override + public int deleteIpcAlarmRulesByIds(String[] ids) + { + return ipcAlarmRulesMapper.deleteIpcAlarmRulesByIds(ids); + } + + /** + * 删除设备报警规则信息 + * + * @param id 设备报警规则主键 + * @return 结果 + */ + @Override + public int deleteIpcAlarmRulesById(String id) + { + return ipcAlarmRulesMapper.deleteIpcAlarmRulesById(id); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcMonitorDataInfoServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcMonitorDataInfoServiceImpl.java new file mode 100644 index 0000000..c4cf69b --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcMonitorDataInfoServiceImpl.java @@ -0,0 +1,96 @@ +package com.inspur.industrial.service.impl; + +import java.util.List; +import com.inspur.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.industrial.mapper.IpcMonitorDataInfoMapper; +import com.inspur.industrial.domain.IpcMonitorDataInfo; +import com.inspur.industrial.service.IIpcMonitorDataInfoService; + +/** + * 监控数据信息Service业务层处理 + * + * @author inspur + * @date 2024-04-09 + */ +@Service +public class IpcMonitorDataInfoServiceImpl implements IIpcMonitorDataInfoService +{ + @Autowired + private IpcMonitorDataInfoMapper ipcMonitorDataInfoMapper; + + /** + * 查询监控数据信息 + * + * @param id 监控数据信息主键 + * @return 监控数据信息 + */ + @Override + public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id) + { + return ipcMonitorDataInfoMapper.selectIpcMonitorDataInfoById(id); + } + + /** + * 查询监控数据信息列表 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 监控数据信息 + */ + @Override + public List selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo) + { + return ipcMonitorDataInfoMapper.selectIpcMonitorDataInfoList(ipcMonitorDataInfo); + } + + /** + * 新增监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + @Override + public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo) + { + ipcMonitorDataInfo.setCreateTime(DateUtils.getNowDate()); + return ipcMonitorDataInfoMapper.insertIpcMonitorDataInfo(ipcMonitorDataInfo); + } + + /** + * 修改监控数据信息 + * + * @param ipcMonitorDataInfo 监控数据信息 + * @return 结果 + */ + @Override + public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo) + { + ipcMonitorDataInfo.setUpdateTime(DateUtils.getNowDate()); + return ipcMonitorDataInfoMapper.updateIpcMonitorDataInfo(ipcMonitorDataInfo); + } + + /** + * 批量删除监控数据信息 + * + * @param ids 需要删除的监控数据信息主键 + * @return 结果 + */ + @Override + public int deleteIpcMonitorDataInfoByIds(Long[] ids) + { + return ipcMonitorDataInfoMapper.deleteIpcMonitorDataInfoByIds(ids); + } + + /** + * 删除监控数据信息信息 + * + * @param id 监控数据信息主键 + * @return 结果 + */ + @Override + public int deleteIpcMonitorDataInfoById(Long id) + { + return ipcMonitorDataInfoMapper.deleteIpcMonitorDataInfoById(id); + } +} 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 new file mode 100644 index 0000000..1266c08 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRulesMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, alarm_name, alarm_name_key, alarm_info_unit, equip_id, sensor_id, alert_upper_bound, alert_lower_bound, type, description, remark, reference_name, reference_con, alarm_level, sort from ipc_alarm_rules + + + + + + + + insert into ipc_alarm_rules + + id, + alarm_name, + alarm_name_key, + alarm_info_unit, + equip_id, + sensor_id, + alert_upper_bound, + alert_lower_bound, + type, + description, + remark, + reference_name, + reference_con, + alarm_level, + sort, + + + #{id}, + #{alarmName}, + #{alarmNameKey}, + #{alarmInfoUnit}, + #{equipId}, + #{sensorId}, + #{alertUpperBound}, + #{alertLowerBound}, + #{type}, + #{description}, + #{remark}, + #{referenceName}, + #{referenceCon}, + #{alarmLevel}, + #{sort}, + + + + + update ipc_alarm_rules + + alarm_name = #{alarmName}, + alarm_name_key = #{alarmNameKey}, + alarm_info_unit = #{alarmInfoUnit}, + equip_id = #{equipId}, + sensor_id = #{sensorId}, + alert_upper_bound = #{alertUpperBound}, + alert_lower_bound = #{alertLowerBound}, + type = #{type}, + description = #{description}, + remark = #{remark}, + reference_name = #{referenceName}, + reference_con = #{referenceCon}, + alarm_level = #{alarmLevel}, + sort = #{sort}, + + where id = #{id} + + + + delete from ipc_alarm_rules where id = #{id} + + + + delete from ipc_alarm_rules where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcMonitorDataInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcMonitorDataInfoMapper.xml new file mode 100644 index 0000000..a7ac45f --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcMonitorDataInfoMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + select id, equip_id, sensor_id, data_name, data_unit, data_key, status, create_by, create_time, update_by, update_time, remark from ipc_monitor_data_info + + + + + + + + insert into ipc_monitor_data_info + + equip_id, + sensor_id, + data_name, + data_unit, + data_key, + status, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{equipId}, + #{sensorId}, + #{dataName}, + #{dataUnit}, + #{dataKey}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update ipc_monitor_data_info + + equip_id = #{equipId}, + sensor_id = #{sensorId}, + data_name = #{dataName}, + data_unit = #{dataUnit}, + data_key = #{dataKey}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from ipc_monitor_data_info where id = #{id} + + + + delete from ipc_monitor_data_info where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-ui/src/api/industrial/rules.js b/zfipc-ui/src/api/industrial/rules.js new file mode 100644 index 0000000..ba44ab8 --- /dev/null +++ b/zfipc-ui/src/api/industrial/rules.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询设备报警规则列表 +export function listRules(query) { + return request({ + url: "/system/rules/list", + method: "get", + params: query, + }); +} + +// 查询设备报警规则详细 +export function getRules(id) { + return request({ + url: "/system/rules/" + id, + method: "get", + }); +} + +// 新增设备报警规则 +export function addRules(data) { + return request({ + url: "/system/rules", + method: "post", + data: data, + }); +} + +// 修改设备报警规则 +export function updateRules(data) { + return request({ + url: "/system/rules", + method: "put", + data: data, + }); +} + +// 删除设备报警规则 +export function delRules(id) { + return request({ + url: "/system/rules/" + id, + method: "delete", + }); +} diff --git a/zfipc-ui/src/views/warn/alarm/index.vue b/zfipc-ui/src/views/warn/alarm/index.vue index 427ab65..4f0568a 100644 --- a/zfipc-ui/src/views/warn/alarm/index.vue +++ b/zfipc-ui/src/views/warn/alarm/index.vue @@ -1,233 +1,410 @@