报警菜单和大屏修改
This commit is contained in:
parent
6824071083
commit
d19de99ff4
@ -46,6 +46,13 @@ public class IpcEquipInfoController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll(IpcEquipInfo ipcEquipInfo)
|
||||
{
|
||||
List<IpcEquipInfo> list = ipcEquipInfoService.selectIpcEquipInfoList(ipcEquipInfo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备信息列表
|
||||
*/
|
||||
|
@ -0,0 +1,114 @@
|
||||
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.IpcAlarmRecord;
|
||||
import com.inspur.industrial.service.IIpcAlarmRecordService;
|
||||
import com.inspur.common.utils.poi.ExcelUtil;
|
||||
import com.inspur.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 报警记录Controller
|
||||
*
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/4/10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/alarm/record")
|
||||
public class IpcAlarmRecordController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IIpcAlarmRecordService ipcAlarmRecordService;
|
||||
|
||||
/**
|
||||
* 查询报警记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
startPage();
|
||||
List<IpcAlarmRecord> list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出报警记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:export')")
|
||||
@Log(title = "报警记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
List<IpcAlarmRecord> list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord);
|
||||
ExcelUtil<IpcAlarmRecord> util = new ExcelUtil<IpcAlarmRecord>(IpcAlarmRecord.class);
|
||||
util.exportExcel(response, list, "报警记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(ipcAlarmRecordService.selectIpcAlarmRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报警记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:add')")
|
||||
@Log(title = "报警记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return toAjax(ipcAlarmRecordService.insertIpcAlarmRecord(ipcAlarmRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报警记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:edit')")
|
||||
@Log(title = "报警记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return toAjax(ipcAlarmRecordService.updateIpcAlarmRecord(ipcAlarmRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改报警记录
|
||||
*/
|
||||
@PostMapping("/batchUpdate")
|
||||
public AjaxResult batchUpdate( @RequestBody IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return toAjax(ipcAlarmRecordService.batchUpdateIpcAlarmRecord(ipcAlarmRecord.getIds(),ipcAlarmRecord.getResult()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报警记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:record:remove')")
|
||||
@Log(title = "报警记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(ipcAlarmRecordService.deleteIpcAlarmRecordByIds(ids));
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.inspur.common.core.page.TableDataInfo;
|
||||
* @create 2024/4/9
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/rules")
|
||||
@RequestMapping("/alarm/rules")
|
||||
public class IpcAlarmRulesController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@ -46,6 +46,13 @@ public class IpcAlarmRulesController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll(IpcAlarmRules ipcAlarmRules)
|
||||
{
|
||||
List<IpcAlarmRules> list = ipcAlarmRulesService.selectIpcAlarmRulesList(ipcAlarmRules);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备报警规则列表
|
||||
*/
|
||||
|
@ -1,7 +1,14 @@
|
||||
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.ISysConfigService;
|
||||
import com.inspur.system.service.influx.InfluxDBService;
|
||||
import com.serotonin.modbus4j.BatchRead;
|
||||
import com.serotonin.modbus4j.BatchResults;
|
||||
@ -15,10 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.*;
|
||||
|
||||
public class IPCDataSyncThread implements Runnable {
|
||||
private static final Logger logger = LoggerFactory.getLogger(IPCDataSyncThread.class);
|
||||
@ -26,6 +30,8 @@ public class IPCDataSyncThread implements Runnable {
|
||||
private ModbusMaster master;
|
||||
private String time;
|
||||
|
||||
private static final String EQUIP_ID = "e2ae4710b516419c84d1d4a819429348";
|
||||
|
||||
public IPCDataSyncThread(ModbusMaster master, String time){
|
||||
this.master = master;
|
||||
this.time = time;
|
||||
@ -57,22 +63,33 @@ public class IPCDataSyncThread implements Runnable {
|
||||
// BatchResults<Integer> results = master.send(batch);
|
||||
//超压底缸加压液压系统
|
||||
String measurement = "zfipc_industrial_monitor_data1";
|
||||
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
|
||||
IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class);
|
||||
IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
|
||||
IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class);
|
||||
|
||||
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
|
||||
|
||||
Map<String,String> tags = new TreeMap();
|
||||
tags.put("equ_id","e2ae4710b516419c84d1d4a819429348");
|
||||
tags.put("equ_id",EQUIP_ID);
|
||||
Map<String,Object> fields = new TreeMap();
|
||||
|
||||
|
||||
// 系统电流
|
||||
fields.put("sys_cur",(float) 0 + Math.random());
|
||||
// 系统流量
|
||||
fields.put("sys_flw",(float) 0 + Math.random());
|
||||
fields.put("sys_flw",(float) 0 + Math.random());
|
||||
// 系统压力
|
||||
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);
|
||||
|
||||
//液位最小和最大值通过报警参数设置获取
|
||||
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());
|
||||
// 油液颗粒度
|
||||
@ -91,7 +108,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());
|
||||
//传动侧比例换向阀
|
||||
@ -100,6 +117,10 @@ public class IPCDataSyncThread implements Runnable {
|
||||
fields.put("opr_bottom_press",(float) 0 + Math.random());
|
||||
//传动侧底缸压力
|
||||
fields.put("driven_bottom_press",(float) 0 + Math.random());
|
||||
//操作侧底缸设定压力
|
||||
fields.put("opr_bottom_set_press",(float) 0 + Math.random());
|
||||
//传动侧底缸设定压力
|
||||
fields.put("driven_bottom_set_press",(float) 0 + Math.random());
|
||||
//操作侧软辊压力
|
||||
fields.put("opr_soft_real_press",(float) 0 + Math.random());//实际压力
|
||||
fields.put("opr_soft_bond_press",(float) 0 + Math.random());//合辊压力
|
||||
@ -161,13 +182,31 @@ public class IPCDataSyncThread implements Runnable {
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
|
||||
String format = simpleDateFormat.format(new Date());
|
||||
fields.put("insertTime",format);
|
||||
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
|
||||
// 判断并处理报警数据
|
||||
// JudgeUtil.judgeAndSaveAlarmData(fields,"1");
|
||||
tags.put("insertTime",format);
|
||||
|
||||
//报警处理
|
||||
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
|
||||
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags, Constant.RUNNING,rulesList));
|
||||
i.insert(measurement,tags,fields);
|
||||
|
||||
if (!alarmRecordList.isEmpty()){//运行需放开
|
||||
//alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,214 @@
|
||||
package com.inspur.industrial.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.inspur.common.annotation.Excel;
|
||||
import com.inspur.common.core.domain.BaseEntity;
|
||||
import com.inspur.equip.domain.IpcEquipInfo;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 报警记录对象 ipc_alarm_record
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-10
|
||||
*/
|
||||
public class IpcAlarmRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 设备报警记录id */
|
||||
private Long id;
|
||||
|
||||
/** 报警信息id */
|
||||
@Excel(name = "报警信息id")
|
||||
private String alarmRulesId;
|
||||
|
||||
/** 设备id */
|
||||
@Excel(name = "设备id")
|
||||
private String equipId;
|
||||
|
||||
/** 传感器id */
|
||||
@Excel(name = "传感器id")
|
||||
private String sensorId;
|
||||
|
||||
/** 报警内容 */
|
||||
@Excel(name = "报警内容")
|
||||
private String content;
|
||||
|
||||
/** 报警值 */
|
||||
@Excel(name = "报警值")
|
||||
private BigDecimal alarmValue;
|
||||
|
||||
/** 报警时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date alarmTime;
|
||||
|
||||
/** 处理结果 */
|
||||
@Excel(name = "处理结果")
|
||||
private String result;
|
||||
|
||||
/** 报警记录的状态(0:未处理,1:已处理) */
|
||||
@Excel(name = "报警记录的状态", readConverterExp = "0=:未处理,1:已处理")
|
||||
private Integer status;
|
||||
|
||||
/** 处理人 */
|
||||
@Excel(name = "处理人")
|
||||
private Long operator;
|
||||
|
||||
/**
|
||||
* 报警等级
|
||||
*/
|
||||
private Integer alarmLevel;
|
||||
|
||||
private IpcEquipInfo equipInfo;
|
||||
|
||||
private String[] ids;
|
||||
|
||||
|
||||
private IpcAlarmRules alarmRules;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setAlarmRulesId(String alarmRulesId)
|
||||
{
|
||||
this.alarmRulesId = alarmRulesId;
|
||||
}
|
||||
|
||||
public String getAlarmRulesId()
|
||||
{
|
||||
return alarmRulesId;
|
||||
}
|
||||
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 setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
public void setAlarmValue(BigDecimal alarmValue)
|
||||
{
|
||||
this.alarmValue = alarmValue;
|
||||
}
|
||||
|
||||
public BigDecimal getAlarmValue()
|
||||
{
|
||||
return alarmValue;
|
||||
}
|
||||
public void setAlarmTime(Date alarmTime)
|
||||
{
|
||||
this.alarmTime = alarmTime;
|
||||
}
|
||||
|
||||
public Date getAlarmTime()
|
||||
{
|
||||
return alarmTime;
|
||||
}
|
||||
public void setResult(String result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setOperator(Long operator)
|
||||
{
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public Long getOperator()
|
||||
{
|
||||
return operator;
|
||||
}
|
||||
|
||||
public Integer getAlarmLevel() {
|
||||
return alarmLevel;
|
||||
}
|
||||
|
||||
public void setAlarmLevel(Integer alarmLevel) {
|
||||
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 String[] getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(String[] ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("alarmRulesId", getAlarmRulesId())
|
||||
.append("equipId", getEquipId())
|
||||
.append("sensorId", getSensorId())
|
||||
.append("content", getContent())
|
||||
.append("alarmValue", getAlarmValue())
|
||||
.append("alarmTime", getAlarmTime())
|
||||
.append("result", getResult())
|
||||
.append("status", getStatus())
|
||||
.append("operator", getOperator())
|
||||
.append("alarmLevel", getAlarmLevel())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
package com.inspur.industrial.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.inspur.industrial.domain.IpcAlarmRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 报警记录Mapper接口
|
||||
*
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/4/10
|
||||
*/
|
||||
public interface IpcAlarmRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询报警记录
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 报警记录
|
||||
*/
|
||||
public IpcAlarmRecord selectIpcAlarmRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询报警记录列表
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 报警记录集合
|
||||
*/
|
||||
public List<IpcAlarmRecord> selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 批量新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecordList 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertIpcAlarmRecord(@Param("list") List<IpcAlarmRecord> ipcAlarmRecordList);
|
||||
|
||||
/**
|
||||
* 修改报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 批量修改报警记录
|
||||
*
|
||||
* @param ids 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateIpcAlarmRecord(@Param("ids") String[] ids,@Param("alarmResult") String alarmResult,@Param("operator") String operotor);
|
||||
|
||||
/**
|
||||
* 删除报警记录
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIpcAlarmRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除报警记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIpcAlarmRecordByIds(Long[] ids);
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ public interface IpcAlarmRulesMapper
|
||||
*/
|
||||
public List<IpcAlarmRules> selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules);
|
||||
|
||||
/**
|
||||
* 根据设备id获取设备报警规则
|
||||
*/
|
||||
public List<IpcAlarmRules> selectIpcAlarmRulesByEquipId(String equipId);
|
||||
|
||||
/**
|
||||
* 新增设备报警规则
|
||||
*
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.inspur.industrial.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.inspur.industrial.domain.IpcAlarmRecord;
|
||||
|
||||
/**
|
||||
* 报警记录Service接口
|
||||
*
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/4/10
|
||||
*/
|
||||
public interface IIpcAlarmRecordService
|
||||
{
|
||||
/**
|
||||
* 查询报警记录
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 报警记录
|
||||
*/
|
||||
public IpcAlarmRecord selectIpcAlarmRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询报警记录列表
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 报警记录集合
|
||||
*/
|
||||
public List<IpcAlarmRecord> selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 批量新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecordList 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertIpcAlarmRecord(List<IpcAlarmRecord> ipcAlarmRecordList);
|
||||
|
||||
/**
|
||||
* 修改报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord);
|
||||
|
||||
/**
|
||||
* 批量修改报警记录
|
||||
*
|
||||
* @param ids 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateIpcAlarmRecord(String[] ids,String alarmResult);
|
||||
|
||||
/**
|
||||
* 批量删除报警记录
|
||||
*
|
||||
* @param ids 需要删除的报警记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIpcAlarmRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除报警记录信息
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIpcAlarmRecordById(Long id);
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ public interface IIpcAlarmRulesService
|
||||
*/
|
||||
public List<IpcAlarmRules> selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules);
|
||||
|
||||
/**
|
||||
* 根据设备id获取设备报警规则
|
||||
*/
|
||||
public List<IpcAlarmRules> selectIpcAlarmRulesByEquipId(String equipId);
|
||||
// public void tran();
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,9 @@ public class DataQueryService implements IDataQueryService {
|
||||
resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量
|
||||
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力
|
||||
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位
|
||||
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
|
||||
//TODO 获取系统液位高值和低值
|
||||
resMap.put("syslevelinit", Float.parseFloat(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
|
||||
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"));//系统湿度
|
||||
@ -73,12 +74,19 @@ public class DataQueryService implements IDataQueryService {
|
||||
double power = (double) resMap.get("syspower");
|
||||
double sysflw = (double)resMap.get("sysflw");
|
||||
double pressure = (double)resMap.get("sysprs");
|
||||
resMap.put("syseff",pressure * sysflw/power);
|
||||
resMap.put("syseff",pressure * sysflw/power*100);
|
||||
|
||||
List<Object> syscur = new ArrayList<>();//系统电流
|
||||
|
||||
List<Object> oprsoftflw = new ArrayList<>();//操作侧软辊流量
|
||||
List<Object> oprhotflw = new ArrayList<>();//操作侧热辊流量
|
||||
List<Object> drivensoftflw = new ArrayList<>();//传动侧软辊流量
|
||||
List<Object> drivenhotflw = new ArrayList<>();//传动侧热辊流量
|
||||
|
||||
List<Object> oprbottompress = new ArrayList<>();//底缸操作侧压力
|
||||
List<Object> drivenbottompress = new ArrayList<>();//底缸传动侧压力
|
||||
List<Object> oprbottomsetpress = new ArrayList<>();//底缸操作侧设定压力
|
||||
List<Object> drivenbottomsetpress = new ArrayList<>();//底缸传动侧设定压力
|
||||
|
||||
List<Object> oprsoftrealpress = new ArrayList<>();//操作侧软辊压力
|
||||
List<Object> oprsoftbondpress = new ArrayList<>();//操作侧软辊合辊压力
|
||||
@ -104,8 +112,15 @@ public class DataQueryService implements IDataQueryService {
|
||||
|
||||
syscur.add(data.get("sys_cur"));
|
||||
|
||||
oprsoftflw.add(data.get("opr_soft_flw") == null ? 0 : data.get("opr_soft_flw"));
|
||||
oprhotflw.add(data.get("opr_hot_flw") == null ? 0 : data.get("opr_hot_flw"));
|
||||
drivensoftflw.add(data.get("driven_soft_flw") == null ? 0 : data.get("driven_soft_flw"));
|
||||
drivenhotflw.add(data.get("driven_hot_flw") == null ? 0 : data.get("driven_hot_flw"));
|
||||
|
||||
oprbottompress.add(data.get("opr_bottom_press") == null ? 0 : data.get("opr_bottom_press"));
|
||||
drivenbottompress.add(data.get("driven_bottom_press") == null ? 0 : data.get("driven_bottom_press"));
|
||||
oprbottomsetpress.add(data.get("opr_bottom_set_press") == null ? 0 : data.get("opr_bottom_set_press"));
|
||||
drivenbottomsetpress.add(data.get("driven_bottom_set_press") == null ? 0 : data.get("driven_bottom_set_press"));
|
||||
|
||||
oprsoftrealpress.add(data.get("opr_soft_real_press") == null ? 0 : data.get("opr_soft_real_press"));
|
||||
oprsoftbondpress.add(data.get("opr_soft_bond_press") == null ? 0 : data.get("opr_soft_bond_press"));
|
||||
@ -130,8 +145,15 @@ public class DataQueryService implements IDataQueryService {
|
||||
|
||||
resMap.put("syscur",syscur);
|
||||
|
||||
resMap.put("oprsoftflw",oprsoftflw);
|
||||
resMap.put("oprhotflw",oprhotflw);
|
||||
resMap.put("drivensoftflw",drivensoftflw);
|
||||
resMap.put("drivenhotflw",drivenhotflw);
|
||||
|
||||
resMap.put("oprbottompress",oprbottompress);
|
||||
resMap.put("drivenbottompress",drivenbottompress);
|
||||
resMap.put("oprbottomsetpress",oprbottomsetpress);
|
||||
resMap.put("drivenbottomsetpress",drivenbottomsetpress);
|
||||
|
||||
resMap.put("oprsoftrealpress",oprsoftrealpress);
|
||||
resMap.put("oprsoftbondpress",oprsoftbondpress);
|
||||
|
@ -0,0 +1,128 @@
|
||||
package com.inspur.industrial.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.inspur.industrial.mapper.IpcAlarmRecordMapper;
|
||||
import com.inspur.industrial.domain.IpcAlarmRecord;
|
||||
import com.inspur.industrial.service.IIpcAlarmRecordService;
|
||||
|
||||
/**
|
||||
* 报警记录Service业务层处理
|
||||
*
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/4/10
|
||||
*/
|
||||
@Service
|
||||
public class IpcAlarmRecordServiceImpl implements IIpcAlarmRecordService
|
||||
{
|
||||
@Autowired
|
||||
private IpcAlarmRecordMapper ipcAlarmRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询报警记录
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 报警记录
|
||||
*/
|
||||
@Override
|
||||
public IpcAlarmRecord selectIpcAlarmRecordById(Long id)
|
||||
{
|
||||
return ipcAlarmRecordMapper.selectIpcAlarmRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报警记录列表
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 报警记录
|
||||
*/
|
||||
@Override
|
||||
public List<IpcAlarmRecord> selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return ipcAlarmRecordMapper.selectIpcAlarmRecordList(ipcAlarmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return ipcAlarmRecordMapper.insertIpcAlarmRecord(ipcAlarmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增报警记录
|
||||
*
|
||||
* @param ipcAlarmRecordList 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchInsertIpcAlarmRecord(List<IpcAlarmRecord> ipcAlarmRecordList){
|
||||
int num = 0;
|
||||
CompletableFuture<Integer> resultData = CompletableFuture.supplyAsync(() -> ipcAlarmRecordMapper.batchInsertIpcAlarmRecord(ipcAlarmRecordList));
|
||||
try {
|
||||
num = resultData.get();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报警记录
|
||||
*
|
||||
* @param ipcAlarmRecord 报警记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateIpcAlarmRecord(IpcAlarmRecord ipcAlarmRecord)
|
||||
{
|
||||
return ipcAlarmRecordMapper.updateIpcAlarmRecord(ipcAlarmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改报警记录
|
||||
*
|
||||
* @param ids 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateIpcAlarmRecord(String[] ids,String alarmResult){
|
||||
return ipcAlarmRecordMapper.batchUpdateIpcAlarmRecord(ids, alarmResult, SecurityUtils.getUserId().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除报警记录
|
||||
*
|
||||
* @param ids 需要删除的报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteIpcAlarmRecordByIds(Long[] ids)
|
||||
{
|
||||
return ipcAlarmRecordMapper.deleteIpcAlarmRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报警记录信息
|
||||
*
|
||||
* @param id 报警记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteIpcAlarmRecordById(Long id)
|
||||
{
|
||||
return ipcAlarmRecordMapper.deleteIpcAlarmRecordById(id);
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,14 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
|
||||
return ipcAlarmRulesMapper.selectIpcAlarmRulesList(ipcAlarmRules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备id获取设备报警规则
|
||||
*/
|
||||
@Override
|
||||
public List<IpcAlarmRules> selectIpcAlarmRulesByEquipId(String equipId){
|
||||
return ipcAlarmRulesMapper.selectIpcAlarmRulesByEquipId(equipId);
|
||||
}
|
||||
|
||||
// public void tran(){
|
||||
// List<IpcMonitorDataInfo> list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(null);
|
||||
// AtomicInteger num = new AtomicInteger(1);
|
||||
|
@ -36,4 +36,14 @@ public class Constant {
|
||||
* 区间外
|
||||
*/
|
||||
public static final String OUTSIDE_INTERVAL = "区间外";
|
||||
|
||||
/**
|
||||
* 运行中
|
||||
*/
|
||||
public static final Integer RUNNING = 0;
|
||||
|
||||
/**
|
||||
* 试运行
|
||||
*/
|
||||
public static final Integer TRY_RUNNING = 1;
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.inspur.industrial.utils;
|
||||
|
||||
import com.inspur.common.utils.DateUtils;
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import com.inspur.common.utils.uuid.IdUtils;
|
||||
import com.inspur.industrial.domain.IpcAlarmRecord;
|
||||
import com.inspur.industrial.domain.IpcAlarmRules;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class IpcUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 根据报警规则判断是否正常
|
||||
*
|
||||
* @param realValueObj 实际值
|
||||
* @param referenceValue1 上限值
|
||||
* @param referenceValue2 下限值
|
||||
* @param referenceCon 比较标准
|
||||
* @return 是否报警
|
||||
*/
|
||||
public static Boolean judgeAlarm(Object realValueObj, BigDecimal referenceValue1, BigDecimal referenceValue2, String referenceCon) {
|
||||
// 是否报警
|
||||
Boolean flag = false;
|
||||
BigDecimal realValue;
|
||||
// 无法转为数字即异常数据
|
||||
if (realValueObj instanceof String || realValueObj instanceof Number) {
|
||||
try {
|
||||
realValue = new BigDecimal(String.valueOf(realValueObj));
|
||||
} catch (Exception e) {
|
||||
flag = true;
|
||||
return flag;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
return flag;
|
||||
}
|
||||
if (Constant.GREATER.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) > 0;
|
||||
} else if (Constant.GREATER_EQUAL.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) >= 0;
|
||||
} else if (Constant.LESS.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) < 0;
|
||||
} else if (Constant.LESS_EQUAL.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) <= 0;
|
||||
} else if (Constant.EQUAL.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) == 0;
|
||||
} else if (Constant.WIDTHIN_INTERVAL.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) >= 0 && realValue.compareTo(referenceValue2) <= 0;
|
||||
} else if (Constant.OUTSIDE_INTERVAL.equals(referenceCon)) {
|
||||
flag = realValue.compareTo(referenceValue1) <= 0 || realValue.compareTo(referenceValue2) >= 0;
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理实时数据
|
||||
*/
|
||||
public List<IpcAlarmRecord> dealRealTimeData(Map<String, Object> map, Map<String, String> tags,int type, List<IpcAlarmRules> rulesList) {
|
||||
|
||||
List<IpcAlarmRecord> returnList = new ArrayList<>();
|
||||
for (IpcAlarmRules rule : rulesList) {
|
||||
// 判断是否当前参数类型 0:运行中 1:待机
|
||||
if (type == rule.getType()) {
|
||||
if (judgeAlarm(map.get(rule.getAlarmNameKey()), rule.getAlertLowerBound(), rule.getAlertUpperBound(), rule.getReferenceCon())) {
|
||||
// 报警数据
|
||||
tags.put("isAlarm", "1");
|
||||
IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord();
|
||||
ipcAlarmRecord.setAlarmRulesId(rule.getId());
|
||||
ipcAlarmRecord.setAlarmTime(DateUtils.getNowDate());
|
||||
ipcAlarmRecord.setEquipId(rule.getEquipId());
|
||||
ipcAlarmRecord.setSensorId(rule.getSensorId());
|
||||
String name = rule.getAlarmNameKey();
|
||||
double value = (double) map.get(name);
|
||||
ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf(value));
|
||||
ipcAlarmRecord.setContent(rule.getReferenceName());
|
||||
ipcAlarmRecord.setStatus(0);
|
||||
ipcAlarmRecord.setOperator(1L);
|
||||
ipcAlarmRecord.setAlarmLevel(rule.getAlarmLevel());
|
||||
returnList.add(ipcAlarmRecord);
|
||||
} else {
|
||||
// 正常数据
|
||||
tags.put("isAlarm", "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
<?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.IpcAlarmRecordMapper">
|
||||
<resultMap type="IpcAlarmRecord" id="IpcAlarmRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="alarmRulesId" column="alarm_rules_id" />
|
||||
<result property="equipId" column="equip_id" />
|
||||
<result property="sensorId" column="sensor_id" />
|
||||
<result property="content" column="content" />
|
||||
<result property="alarmValue" column="alarm_value" />
|
||||
<result property="alarmTime" column="alarm_time" />
|
||||
<result property="result" column="result" />
|
||||
<result property="status" column="status" />
|
||||
<result property="operator" column="operator" />
|
||||
<result property="alarmLevel" column="alarm_level" />
|
||||
<association property="equipInfo" javaType="IpcEquipInfo" resultMap="IpcEquipInfoResult"/>
|
||||
<association property="alarmRules" javaType="IpcAlarmRules" resultMap="IpcAlarmRulesResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="IpcEquipInfo" id="IpcEquipInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="equipNum" column="equip_num" />
|
||||
<result property="equipName" column="equip_name" />
|
||||
<result property="equipManufacturer" column="equip_manufacturer" />
|
||||
<result property="equipSerialNum" column="equip_serial_num" />
|
||||
<result property="equipProductionDate" column="equip_production_date" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="IpcAlarmRules" id="IpcAlarmRulesResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="alarmName" column="alarm_name" />
|
||||
<result property="alarmNameKey" column="alarm_name_key" />
|
||||
<result property="alarmInfoUnit" column="alarm_info_unit" />
|
||||
<result property="equipId" column="equip_id" />
|
||||
<result property="sensorId" column="sensor_id" />
|
||||
<result property="alertUpperBound" column="alert_upper_bound" />
|
||||
<result property="alertLowerBound" column="alert_lower_bound" />
|
||||
<result property="type" column="type" />
|
||||
<result property="description" column="description" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="referenceName" column="reference_name" />
|
||||
<result property="referenceCon" column="reference_con" />
|
||||
<result property="alarmLevel" column="alarm_level" />
|
||||
<result property="sort" column="sort" />
|
||||
</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,
|
||||
b.equip_name,b.equip_num,
|
||||
c.alarm_name,c.alarm_info_unit
|
||||
from ipc_alarm_record a
|
||||
left join ipc_equip_info b on a.equip_id = b.id
|
||||
left join ipc_alarm_rules c on a.alarm_rules_id = c.id
|
||||
</sql>
|
||||
|
||||
<select id="selectIpcAlarmRecordList" parameterType="IpcAlarmRecord" resultMap="IpcAlarmRecordResult">
|
||||
<include refid="selectIpcAlarmRecordVo"/>
|
||||
<where>
|
||||
<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="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>
|
||||
<if test="status != null "> and a.status = #{status}</if>
|
||||
<if test="operator != null "> and a.operator = #{operator}</if>
|
||||
<if test="alarmLevel != null "> and a.alarm_level = #{alarmLevel}</if>
|
||||
<if test="params.startTime != null and params.endTime != null">and a.alarm_time between #{params.startTime}
|
||||
and #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectIpcAlarmRecordById" parameterType="Long" resultMap="IpcAlarmRecordResult">
|
||||
<include refid="selectIpcAlarmRecordVo"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertIpcAlarmRecord" parameterType="IpcAlarmRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ipc_alarm_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmRulesId != null">alarm_rules_id,</if>
|
||||
<if test="equipId != null">equip_id,</if>
|
||||
<if test="sensorId != null">sensor_id,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="alarmValue != null">alarm_value,</if>
|
||||
<if test="alarmTime != null">alarm_time,</if>
|
||||
<if test="result != null">result,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="opeartor != null">opeartor,</if>
|
||||
<if test="alarmLevel != null">alarm_level,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmRulesId != null">#{alarmRulesId},</if>
|
||||
<if test="equipId != null">#{equipId},</if>
|
||||
<if test="sensorId != null">#{sensorId},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="alarmValue != null">#{alarmValue},</if>
|
||||
<if test="alarmTime != null">#{alarmTime},</if>
|
||||
<if test="result != null">#{result},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="operator != null">#{operator},</if>
|
||||
<if test="alarmLevel != null">#{alarmLevel},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 批量新增报警记录 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)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.alarmRulesId},
|
||||
#{item.equipId},
|
||||
#{item.sensorId},
|
||||
#{item.content},
|
||||
#{item.alarmValue},
|
||||
#{item.alarmTime},
|
||||
#{item.status},
|
||||
#{item.operator}
|
||||
#{item.alarmLevel})
|
||||
</foreach>
|
||||
;
|
||||
</insert>
|
||||
|
||||
<update id="updateIpcAlarmRecord" parameterType="IpcAlarmRecord">
|
||||
update ipc_alarm_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<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="content != null">content = #{content},</if>
|
||||
<if test="alarmValue != null">alarm_value = #{alarmValue},</if>
|
||||
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
|
||||
<if test="result != null">result = #{result},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
<if test="alarmLevel != null">alarm_level = #{alarmLevel},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateIpcAlarmRecord" parameterType="String">
|
||||
update ipc_alarm_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
status = 1,
|
||||
<if test="alarmResult != null">result = #{alarmResult},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteIpcAlarmRecordById" parameterType="Long">
|
||||
delete from ipc_alarm_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteIpcAlarmRecordByIds" parameterType="String">
|
||||
delete from ipc_alarm_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -42,6 +42,7 @@
|
||||
<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>
|
||||
</select>
|
||||
|
||||
@ -50,6 +51,11 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据设备id获取设备报警规则 selectIpcAlarmRulesByEquipId-->
|
||||
<select id="selectIpcAlarmRulesByEquipId" parameterType="String" resultMap="IpcAlarmRulesResult">
|
||||
<include refid="selectIpcAlarmRulesVo"/>
|
||||
where equip_id = #{equipId}
|
||||
</select>
|
||||
<insert id="insertIpcAlarmRules" parameterType="IpcAlarmRules">
|
||||
insert into ipc_alarm_rules
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -3,7 +3,16 @@ import request from "@/utils/request";
|
||||
// 查询设备报警规则列表
|
||||
export function listRules(query) {
|
||||
return request({
|
||||
url: "/system/rules/list",
|
||||
url: "/alarm/rules/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询所有设备报警规则列表
|
||||
export function listAllRules(query) {
|
||||
return request({
|
||||
url: "/alarm/rules/listAll",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
@ -12,7 +21,7 @@ export function listRules(query) {
|
||||
// 查询设备报警规则详细
|
||||
export function getRules(id) {
|
||||
return request({
|
||||
url: "/system/rules/" + id,
|
||||
url: "/alarm/rules/" + id,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
@ -20,7 +29,7 @@ export function getRules(id) {
|
||||
// 新增设备报警规则
|
||||
export function addRules(data) {
|
||||
return request({
|
||||
url: "/system/rules",
|
||||
url: "/alarm/rules",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
@ -29,7 +38,7 @@ export function addRules(data) {
|
||||
// 修改设备报警规则
|
||||
export function updateRules(data) {
|
||||
return request({
|
||||
url: "/system/rules",
|
||||
url: "/alarm/rules",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
@ -38,7 +47,7 @@ export function updateRules(data) {
|
||||
// 删除设备报警规则
|
||||
export function delRules(id) {
|
||||
return request({
|
||||
url: "/system/rules/" + id,
|
||||
url: "/alarm/rules/" + id,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择报警规则类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.rule_type"
|
||||
@ -39,7 +40,7 @@
|
||||
prop="alarmNameKey"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.nameKey"
|
||||
v-model="queryParams.alarmNameKey"
|
||||
placeholder="请选择参数"
|
||||
clearable
|
||||
>
|
||||
@ -58,7 +59,8 @@
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.alarmLevel"
|
||||
placeholder="请选择报警规则类型"
|
||||
placeholder="请选择报警等级"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alarm_level"
|
||||
@ -83,7 +85,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row
|
||||
<!-- <el-row
|
||||
:gutter="10"
|
||||
class="mb8"
|
||||
>
|
||||
@ -133,17 +135,15 @@
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
</el-row> -->
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="rulesList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
type="index"
|
||||
width="50"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则描述"
|
||||
@ -227,11 +227,337 @@
|
||||
<el-tab-pane
|
||||
label="可控中高辊顶辊液压系统"
|
||||
name="topScoller"
|
||||
></el-tab-pane>
|
||||
>
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
style="text-align:right"
|
||||
>
|
||||
<el-form-item
|
||||
label="规则类型"
|
||||
prop="type"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择报警规则类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.rule_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="参数名称"
|
||||
prop="alarmNameKey"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.alarmNameKey"
|
||||
placeholder="请选择参数"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="field in monitorList"
|
||||
:key="field.value"
|
||||
:label="field.label"
|
||||
:value="field.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="报警等级"
|
||||
prop="alarmLevel"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.alarmLevel"
|
||||
placeholder="请选择报警等级"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alarm_level"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
icon="el-icon-refresh"
|
||||
size="mini"
|
||||
@click="resetQuery"
|
||||
>重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="rulesList"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="50"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则描述"
|
||||
align="center"
|
||||
prop="referenceName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则类型"
|
||||
align="center"
|
||||
prop="type"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<dict-tag
|
||||
:options="dict.type.rule_type"
|
||||
:value="scope.row.type"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="参数名称"
|
||||
align="center"
|
||||
prop="alarmName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="参数单位"
|
||||
align="center"
|
||||
prop="alarmInfoUnit"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警上限值"
|
||||
align="center"
|
||||
prop="alertUpperBound"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警下限值"
|
||||
align="center"
|
||||
prop="alertLowerBound"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警规则"
|
||||
align="center"
|
||||
prop="referenceCon"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警描述"
|
||||
align="center"
|
||||
prop="description"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:rules:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:rules:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="可控中高辊底辊液压系统"
|
||||
name="bottomScoller"
|
||||
></el-tab-pane>
|
||||
>
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
style="text-align:right"
|
||||
>
|
||||
<el-form-item
|
||||
label="规则类型"
|
||||
prop="type"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择报警规则类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.rule_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="参数名称"
|
||||
prop="alarmNameKey"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.alarmNameKey"
|
||||
placeholder="请选择参数"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="field in monitorList"
|
||||
:key="field.value"
|
||||
:label="field.label"
|
||||
:value="field.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="报警等级"
|
||||
prop="alarmLevel"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.alarmLevel"
|
||||
placeholder="请选择报警等级"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.alarm_level"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
icon="el-icon-refresh"
|
||||
size="mini"
|
||||
@click="resetQuery"
|
||||
>重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="rulesList"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="50"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则描述"
|
||||
align="center"
|
||||
prop="referenceName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则类型"
|
||||
align="center"
|
||||
prop="type"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<dict-tag
|
||||
:options="dict.type.rule_type"
|
||||
:value="scope.row.type"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="参数名称"
|
||||
align="center"
|
||||
prop="alarmName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="参数单位"
|
||||
align="center"
|
||||
prop="alarmInfoUnit"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警上限值"
|
||||
align="center"
|
||||
prop="alertUpperBound"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警下限值"
|
||||
align="center"
|
||||
prop="alertLowerBound"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警规则"
|
||||
align="center"
|
||||
prop="referenceCon"
|
||||
/>
|
||||
<el-table-column
|
||||
label="报警描述"
|
||||
align="center"
|
||||
prop="description"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:rules:edit']"
|
||||
>修改</el-button>
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:rules:remove']"
|
||||
>删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 添加或修改设备报警规则对话框 -->
|
||||
<el-dialog
|
||||
@ -548,6 +874,7 @@ export default {
|
||||
}
|
||||
},
|
||||
handleTabClick() {
|
||||
this.queryParams = {};
|
||||
this.getList();
|
||||
},
|
||||
/** 查询设备报警规则列表 */
|
||||
@ -582,6 +909,7 @@ export default {
|
||||
});
|
||||
},
|
||||
getMonitorData(equipId) {
|
||||
this.monitorList = [];
|
||||
this.monitorQuery.equipId = equipId;
|
||||
getAllMonitorData(this.monitorQuery).then((response) => {
|
||||
console.log("monitor:", response);
|
||||
|
Loading…
Reference in New Issue
Block a user