diff --git a/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmDataController.java b/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmDataController.java new file mode 100644 index 0000000..f810b5d --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmDataController.java @@ -0,0 +1,106 @@ +package com.os.ems.record.controller; + +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.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +import com.os.common.enums.BusinessType; +import com.os.ems.record.domain.EmsRecordAlarmData; +import com.os.ems.record.service.IEmsRecordAlarmDataService; +import com.os.common.utils.poi.ExcelUtil; +import com.os.common.core.page.TableDataInfo; + +/** + * 异常数据记录Controller + * + * @author Yinq + * @date 2024-05-15 + */ +@RestController +@RequestMapping("/ems/record/recordAlarmData") +public class EmsRecordAlarmDataController extends BaseController +{ + @Autowired + private IEmsRecordAlarmDataService emsRecordAlarmDataService; + + /** + * 查询异常数据记录列表 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:list')") + @GetMapping("/list") + public TableDataInfo list(EmsRecordAlarmData emsRecordAlarmData) + { + startPage(); + List list = emsRecordAlarmDataService.selectEmsRecordAlarmDataList(emsRecordAlarmData); + return getDataTable(list); + } + + /** + * 导出异常数据记录列表 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:export')") + @Log(title = "异常数据记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EmsRecordAlarmData emsRecordAlarmData) + { + List list = emsRecordAlarmDataService.selectEmsRecordAlarmDataList(emsRecordAlarmData); + ExcelUtil util = new ExcelUtil(EmsRecordAlarmData.class); + util.exportExcel(response, list, "异常数据记录数据"); + } + + /** + * 获取异常数据记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) + { + return success(emsRecordAlarmDataService.selectEmsRecordAlarmDataByObjId(objId)); + } + + /** + * 新增异常数据记录 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:add')") + @Log(title = "异常数据记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EmsRecordAlarmData emsRecordAlarmData) + { + emsRecordAlarmData.setCreateBy(getUsername()); + return toAjax(emsRecordAlarmDataService.insertEmsRecordAlarmData(emsRecordAlarmData)); + } + + /** + * 修改异常数据记录 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:edit')") + @Log(title = "异常数据记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmsRecordAlarmData emsRecordAlarmData) + { + emsRecordAlarmData.setUpdateBy(getUsername()); + return toAjax(emsRecordAlarmDataService.updateEmsRecordAlarmData(emsRecordAlarmData)); + } + + /** + * 删除异常数据记录 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:remove')") + @Log(title = "异常数据记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) + { + return toAjax(emsRecordAlarmDataService.deleteEmsRecordAlarmDataByObjIds(objIds)); + } +} diff --git a/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmRuleController.java b/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmRuleController.java new file mode 100644 index 0000000..c252d6e --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/controller/EmsRecordAlarmRuleController.java @@ -0,0 +1,106 @@ +package com.os.ems.record.controller; + +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.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +import com.os.common.enums.BusinessType; +import com.os.ems.record.domain.EmsRecordAlarmRule; +import com.os.ems.record.service.IEmsRecordAlarmRuleService; +import com.os.common.utils.poi.ExcelUtil; +import com.os.common.core.page.TableDataInfo; + +/** + * 异常告警规则Controller + * + * @author Yinq + * @date 2024-05-15 + */ +@RestController +@RequestMapping("/ems/record/recordAlarmRule") +public class EmsRecordAlarmRuleController extends BaseController +{ + @Autowired + private IEmsRecordAlarmRuleService emsRecordAlarmRuleService; + + /** + * 查询异常告警规则列表 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:list')") + @GetMapping("/list") + public TableDataInfo list(EmsRecordAlarmRule emsRecordAlarmRule) + { + startPage(); + List list = emsRecordAlarmRuleService.selectEmsRecordAlarmRuleList(emsRecordAlarmRule); + return getDataTable(list); + } + + /** + * 导出异常告警规则列表 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:export')") + @Log(title = "异常告警规则", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EmsRecordAlarmRule emsRecordAlarmRule) + { + List list = emsRecordAlarmRuleService.selectEmsRecordAlarmRuleList(emsRecordAlarmRule); + ExcelUtil util = new ExcelUtil(EmsRecordAlarmRule.class); + util.exportExcel(response, list, "异常告警规则数据"); + } + + /** + * 获取异常告警规则详细信息 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) + { + return success(emsRecordAlarmRuleService.selectEmsRecordAlarmRuleByObjId(objId)); + } + + /** + * 新增异常告警规则 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:add')") + @Log(title = "异常告警规则", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EmsRecordAlarmRule emsRecordAlarmRule) + { + emsRecordAlarmRule.setCreateBy(getUsername()); + return toAjax(emsRecordAlarmRuleService.insertEmsRecordAlarmRule(emsRecordAlarmRule)); + } + + /** + * 修改异常告警规则 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:edit')") + @Log(title = "异常告警规则", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmsRecordAlarmRule emsRecordAlarmRule) + { + emsRecordAlarmRule.setUpdateBy(getUsername()); + return toAjax(emsRecordAlarmRuleService.updateEmsRecordAlarmRule(emsRecordAlarmRule)); + } + + /** + * 删除异常告警规则 + */ + @PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:remove')") + @Log(title = "异常告警规则", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) + { + return toAjax(emsRecordAlarmRuleService.deleteEmsRecordAlarmRuleByObjIds(objIds)); + } +} diff --git a/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmData.java b/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmData.java new file mode 100644 index 0000000..bf01891 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmData.java @@ -0,0 +1,232 @@ +package com.os.ems.record.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.os.common.annotation.Excel; +import com.os.common.core.domain.BaseEntity; + +/** + * 异常数据记录对象 ems_record_alarm_data + * + * @author Yinq + * @date 2024-05-15 + */ +public class EmsRecordAlarmData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 自增标识 */ + private Long objId; + + /** 计量设备编号 */ + @Excel(name = "计量设备编号") + private String monitorId; + private String monitorCode; + private String monitorName; + + /** 采集设备编号 */ + @Excel(name = "采集设备编号") + private String collectDeviceId; + + /** 记录时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date collectTime; + + /** 异常类型(0超过阈值 1设备离线) */ + @Excel(name = "异常类型", readConverterExp = "0=超过阈值,1=设备离线") + private Long alarmType; + + /** 异常状态(0已处理 1未处理) */ + @Excel(name = "异常状态", readConverterExp = "0=已处理,1=未处理") + private Long alarmStatus; + + /** 异常数据 */ + @Excel(name = "异常数据") + private String alarmData; + + /** 操作人员 */ + @Excel(name = "操作人员") + private String operationName; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date operationTime; + + private String beginOperationTime; + private String endOperationTime; + + /** 备注 */ + @Excel(name = "备注") + private String cause; + + /** 通知用户 */ + @Excel(name = "通知用户") + private String notifyUser; + + private String nickName; + + public String getBeginOperationTime() { + return beginOperationTime; + } + + public void setBeginOperationTime(String beginOperationTime) { + this.beginOperationTime = beginOperationTime; + } + + public String getEndOperationTime() { + return endOperationTime; + } + + public void setEndOperationTime(String endOperationTime) { + this.endOperationTime = endOperationTime; + } + + public String getMonitorCode() { + return monitorCode; + } + + public void setMonitorCode(String monitorCode) { + this.monitorCode = monitorCode; + } + + public String getMonitorName() { + return monitorName; + } + + public void setMonitorName(String monitorName) { + this.monitorName = monitorName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public void setObjId(Long objId) + { + this.objId = objId; + } + + public Long getObjId() + { + return objId; + } + public void setMonitorId(String monitorId) + { + this.monitorId = monitorId; + } + + public String getMonitorId() + { + return monitorId; + } + public void setCollectDeviceId(String collectDeviceId) + { + this.collectDeviceId = collectDeviceId; + } + + public String getCollectDeviceId() + { + return collectDeviceId; + } + public void setCollectTime(Date collectTime) + { + this.collectTime = collectTime; + } + + public Date getCollectTime() + { + return collectTime; + } + public void setAlarmType(Long alarmType) + { + this.alarmType = alarmType; + } + + public Long getAlarmType() + { + return alarmType; + } + public void setAlarmStatus(Long alarmStatus) + { + this.alarmStatus = alarmStatus; + } + + public Long getAlarmStatus() + { + return alarmStatus; + } + public void setAlarmData(String alarmData) + { + this.alarmData = alarmData; + } + + public String getAlarmData() + { + return alarmData; + } + public void setOperationName(String operationName) + { + this.operationName = operationName; + } + + public String getOperationName() + { + return operationName; + } + public void setOperationTime(Date operationTime) + { + this.operationTime = operationTime; + } + + public Date getOperationTime() + { + return operationTime; + } + public void setCause(String cause) + { + this.cause = cause; + } + + public String getCause() + { + return cause; + } + public void setNotifyUser(String notifyUser) + { + this.notifyUser = notifyUser; + } + + public String getNotifyUser() + { + return notifyUser; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("monitorId", getMonitorId()) + .append("collectDeviceId", getCollectDeviceId()) + .append("collectTime", getCollectTime()) + .append("alarmType", getAlarmType()) + .append("alarmStatus", getAlarmStatus()) + .append("alarmData", getAlarmData()) + .append("operationName", getOperationName()) + .append("operationTime", getOperationTime()) + .append("cause", getCause()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("notifyUser", getNotifyUser()) + .toString(); + } +} diff --git a/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmRule.java b/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmRule.java new file mode 100644 index 0000000..93f3986 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/domain/EmsRecordAlarmRule.java @@ -0,0 +1,226 @@ +package com.os.ems.record.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.os.common.annotation.Excel; +import com.os.common.core.domain.BaseEntity; + +/** + * 异常告警规则对象 ems_record_alarm_rule + * + * @author Yinq + * @date 2024-05-15 + */ +public class EmsRecordAlarmRule extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 自增标识 */ + private Long objId; + + /** 规则编号 */ + @Excel(name = "规则编号") + private String ruleId; + + /** 规则名称 */ + @Excel(name = "规则名称") + private String ruleName; + + /** 计量设备编号 */ + @Excel(name = "计量设备编号") + private String monitorId; + private String monitorCode; + private String monitorName; + + /** 记录时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date collectTime; + + /** 能源类型 */ + @Excel(name = "能源类型") + private Long energyType; + + /** 触发规则(0超过阈值 1设备报警) */ + @Excel(name = "触发规则", readConverterExp = "0=超过阈值,1=设备报警") + private Long triggerRule; + + /** 触发阈值次数 */ + @Excel(name = "触发阈值次数") + private Long triggerNumber; + + /** 时间范围(分) */ + @Excel(name = "时间范围(分)") + private Long timeRange; + + /** 设备离线时间(分) */ + @Excel(name = "设备离线时间(分)") + private Long deviceOfflineTime; + + /** 通知用户 */ + @Excel(name = "通知用户") + private String notifyUser; + + /** 备注 */ + @Excel(name = "备注") + private String cause; + + private String nickName; + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getMonitorCode() { + return monitorCode; + } + + public void setMonitorCode(String monitorCode) { + this.monitorCode = monitorCode; + } + + public String getMonitorName() { + return monitorName; + } + + public void setMonitorName(String monitorName) { + this.monitorName = monitorName; + } + + public void setObjId(Long objId) + { + this.objId = objId; + } + + public Long getObjId() + { + return objId; + } + public void setRuleId(String ruleId) + { + this.ruleId = ruleId; + } + + public String getRuleId() + { + return ruleId; + } + public void setRuleName(String ruleName) + { + this.ruleName = ruleName; + } + + public String getRuleName() + { + return ruleName; + } + public void setMonitorId(String monitorId) + { + this.monitorId = monitorId; + } + + public String getMonitorId() + { + return monitorId; + } + public void setCollectTime(Date collectTime) + { + this.collectTime = collectTime; + } + + public Date getCollectTime() + { + return collectTime; + } + public void setEnergyType(Long energyType) + { + this.energyType = energyType; + } + + public Long getEnergyType() + { + return energyType; + } + public void setTriggerRule(Long triggerRule) + { + this.triggerRule = triggerRule; + } + + public Long getTriggerRule() + { + return triggerRule; + } + public void setTriggerNumber(Long triggerNumber) + { + this.triggerNumber = triggerNumber; + } + + public Long getTriggerNumber() + { + return triggerNumber; + } + public void setTimeRange(Long timeRange) + { + this.timeRange = timeRange; + } + + public Long getTimeRange() + { + return timeRange; + } + public void setDeviceOfflineTime(Long deviceOfflineTime) + { + this.deviceOfflineTime = deviceOfflineTime; + } + + public Long getDeviceOfflineTime() + { + return deviceOfflineTime; + } + public void setNotifyUser(String notifyUser) + { + this.notifyUser = notifyUser; + } + + public String getNotifyUser() + { + return notifyUser; + } + public void setCause(String cause) + { + this.cause = cause; + } + + public String getCause() + { + return cause; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("ruleId", getRuleId()) + .append("ruleName", getRuleName()) + .append("monitorId", getMonitorId()) + .append("collectTime", getCollectTime()) + .append("energyType", getEnergyType()) + .append("triggerRule", getTriggerRule()) + .append("triggerNumber", getTriggerNumber()) + .append("timeRange", getTimeRange()) + .append("deviceOfflineTime", getDeviceOfflineTime()) + .append("notifyUser", getNotifyUser()) + .append("cause", getCause()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmDataMapper.java b/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmDataMapper.java new file mode 100644 index 0000000..3a77070 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmDataMapper.java @@ -0,0 +1,61 @@ +package com.os.ems.record.mapper; + +import java.util.List; +import com.os.ems.record.domain.EmsRecordAlarmData; + +/** + * 异常数据记录Mapper接口 + * + * @author Yinq + * @date 2024-05-15 + */ +public interface EmsRecordAlarmDataMapper +{ + /** + * 查询异常数据记录 + * + * @param objId 异常数据记录主键 + * @return 异常数据记录 + */ + public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId); + + /** + * 查询异常数据记录列表 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 异常数据记录集合 + */ + public List selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 新增异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 修改异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 删除异常数据记录 + * + * @param objId 异常数据记录主键 + * @return 结果 + */ + public int deleteEmsRecordAlarmDataByObjId(Long objId); + + /** + * 批量删除异常数据记录 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds); +} diff --git a/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmRuleMapper.java b/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmRuleMapper.java new file mode 100644 index 0000000..2a9c2fe --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/mapper/EmsRecordAlarmRuleMapper.java @@ -0,0 +1,61 @@ +package com.os.ems.record.mapper; + +import java.util.List; +import com.os.ems.record.domain.EmsRecordAlarmRule; + +/** + * 异常告警规则Mapper接口 + * + * @author Yinq + * @date 2024-05-15 + */ +public interface EmsRecordAlarmRuleMapper +{ + /** + * 查询异常告警规则 + * + * @param objId 异常告警规则主键 + * @return 异常告警规则 + */ + public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId); + + /** + * 查询异常告警规则列表 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 异常告警规则集合 + */ + public List selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 新增异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 修改异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 删除异常告警规则 + * + * @param objId 异常告警规则主键 + * @return 结果 + */ + public int deleteEmsRecordAlarmRuleByObjId(Long objId); + + /** + * 批量删除异常告警规则 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds); +} diff --git a/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmDataService.java b/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmDataService.java new file mode 100644 index 0000000..bdbbddb --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmDataService.java @@ -0,0 +1,61 @@ +package com.os.ems.record.service; + +import java.util.List; +import com.os.ems.record.domain.EmsRecordAlarmData; + +/** + * 异常数据记录Service接口 + * + * @author Yinq + * @date 2024-05-15 + */ +public interface IEmsRecordAlarmDataService +{ + /** + * 查询异常数据记录 + * + * @param objId 异常数据记录主键 + * @return 异常数据记录 + */ + public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId); + + /** + * 查询异常数据记录列表 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 异常数据记录集合 + */ + public List selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 新增异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 修改异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData); + + /** + * 批量删除异常数据记录 + * + * @param objIds 需要删除的异常数据记录主键集合 + * @return 结果 + */ + public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds); + + /** + * 删除异常数据记录信息 + * + * @param objId 异常数据记录主键 + * @return 结果 + */ + public int deleteEmsRecordAlarmDataByObjId(Long objId); +} diff --git a/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmRuleService.java b/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmRuleService.java new file mode 100644 index 0000000..94e08bd --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/service/IEmsRecordAlarmRuleService.java @@ -0,0 +1,61 @@ +package com.os.ems.record.service; + +import java.util.List; +import com.os.ems.record.domain.EmsRecordAlarmRule; + +/** + * 异常告警规则Service接口 + * + * @author Yinq + * @date 2024-05-15 + */ +public interface IEmsRecordAlarmRuleService +{ + /** + * 查询异常告警规则 + * + * @param objId 异常告警规则主键 + * @return 异常告警规则 + */ + public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId); + + /** + * 查询异常告警规则列表 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 异常告警规则集合 + */ + public List selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 新增异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 修改异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule); + + /** + * 批量删除异常告警规则 + * + * @param objIds 需要删除的异常告警规则主键集合 + * @return 结果 + */ + public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds); + + /** + * 删除异常告警规则信息 + * + * @param objId 异常告警规则主键 + * @return 结果 + */ + public int deleteEmsRecordAlarmRuleByObjId(Long objId); +} diff --git a/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmDataServiceImpl.java b/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmDataServiceImpl.java new file mode 100644 index 0000000..07d9a7a --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmDataServiceImpl.java @@ -0,0 +1,96 @@ +package com.os.ems.record.service.impl; + +import java.util.List; +import com.os.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.os.ems.record.mapper.EmsRecordAlarmDataMapper; +import com.os.ems.record.domain.EmsRecordAlarmData; +import com.os.ems.record.service.IEmsRecordAlarmDataService; + +/** + * 异常数据记录Service业务层处理 + * + * @author Yinq + * @date 2024-05-15 + */ +@Service +public class EmsRecordAlarmDataServiceImpl implements IEmsRecordAlarmDataService +{ + @Autowired + private EmsRecordAlarmDataMapper emsRecordAlarmDataMapper; + + /** + * 查询异常数据记录 + * + * @param objId 异常数据记录主键 + * @return 异常数据记录 + */ + @Override + public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId) + { + return emsRecordAlarmDataMapper.selectEmsRecordAlarmDataByObjId(objId); + } + + /** + * 查询异常数据记录列表 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 异常数据记录 + */ + @Override + public List selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData) + { + return emsRecordAlarmDataMapper.selectEmsRecordAlarmDataList(emsRecordAlarmData); + } + + /** + * 新增异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + @Override + public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData) + { + emsRecordAlarmData.setCreateTime(DateUtils.getNowDate()); + return emsRecordAlarmDataMapper.insertEmsRecordAlarmData(emsRecordAlarmData); + } + + /** + * 修改异常数据记录 + * + * @param emsRecordAlarmData 异常数据记录 + * @return 结果 + */ + @Override + public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData) + { + emsRecordAlarmData.setUpdateTime(DateUtils.getNowDate()); + return emsRecordAlarmDataMapper.updateEmsRecordAlarmData(emsRecordAlarmData); + } + + /** + * 批量删除异常数据记录 + * + * @param objIds 需要删除的异常数据记录主键 + * @return 结果 + */ + @Override + public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds) + { + return emsRecordAlarmDataMapper.deleteEmsRecordAlarmDataByObjIds(objIds); + } + + /** + * 删除异常数据记录信息 + * + * @param objId 异常数据记录主键 + * @return 结果 + */ + @Override + public int deleteEmsRecordAlarmDataByObjId(Long objId) + { + return emsRecordAlarmDataMapper.deleteEmsRecordAlarmDataByObjId(objId); + } +} diff --git a/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmRuleServiceImpl.java b/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmRuleServiceImpl.java new file mode 100644 index 0000000..34310bb --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/record/service/impl/EmsRecordAlarmRuleServiceImpl.java @@ -0,0 +1,96 @@ +package com.os.ems.record.service.impl; + +import java.util.List; +import com.os.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.os.ems.record.mapper.EmsRecordAlarmRuleMapper; +import com.os.ems.record.domain.EmsRecordAlarmRule; +import com.os.ems.record.service.IEmsRecordAlarmRuleService; + +/** + * 异常告警规则Service业务层处理 + * + * @author Yinq + * @date 2024-05-15 + */ +@Service +public class EmsRecordAlarmRuleServiceImpl implements IEmsRecordAlarmRuleService +{ + @Autowired + private EmsRecordAlarmRuleMapper emsRecordAlarmRuleMapper; + + /** + * 查询异常告警规则 + * + * @param objId 异常告警规则主键 + * @return 异常告警规则 + */ + @Override + public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId) + { + return emsRecordAlarmRuleMapper.selectEmsRecordAlarmRuleByObjId(objId); + } + + /** + * 查询异常告警规则列表 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 异常告警规则 + */ + @Override + public List selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule) + { + return emsRecordAlarmRuleMapper.selectEmsRecordAlarmRuleList(emsRecordAlarmRule); + } + + /** + * 新增异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + @Override + public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule) + { + emsRecordAlarmRule.setCreateTime(DateUtils.getNowDate()); + return emsRecordAlarmRuleMapper.insertEmsRecordAlarmRule(emsRecordAlarmRule); + } + + /** + * 修改异常告警规则 + * + * @param emsRecordAlarmRule 异常告警规则 + * @return 结果 + */ + @Override + public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule) + { + emsRecordAlarmRule.setUpdateTime(DateUtils.getNowDate()); + return emsRecordAlarmRuleMapper.updateEmsRecordAlarmRule(emsRecordAlarmRule); + } + + /** + * 批量删除异常告警规则 + * + * @param objIds 需要删除的异常告警规则主键 + * @return 结果 + */ + @Override + public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds) + { + return emsRecordAlarmRuleMapper.deleteEmsRecordAlarmRuleByObjIds(objIds); + } + + /** + * 删除异常告警规则信息 + * + * @param objId 异常告警规则主键 + * @return 结果 + */ + @Override + public int deleteEmsRecordAlarmRuleByObjId(Long objId) + { + return emsRecordAlarmRuleMapper.deleteEmsRecordAlarmRuleByObjId(objId); + } +} diff --git a/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml new file mode 100644 index 0000000..6b61e52 --- /dev/null +++ b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + RAD.obj_id, + RAD.monitor_id, + RAD.collect_device_id, + RAD.collect_time, + RAD.alarm_type, + RAD.alarm_status, + RAD.alarm_data, + RAD.operation_name, + RAD.operation_time, + RAD.cause, + RAD.create_by, + RAD.create_time, + RAD.update_by, + RAD.update_time, + RAD.notify_user, + BMI.monitor_code, + BMI.monitor_name, + SUSER.nick_name + FROM + ems_record_alarm_data AS RAD + LEFT JOIN ems_base_monitor_info AS BMI ON RAD.monitor_id = BMI.obj_id + LEFT JOIN sys_user AS SUSER ON RAD.notify_user = SUSER.user_id + + + + + + + insert into ems_record_alarm_data + + monitor_id, + collect_device_id, + collect_time, + alarm_type, + alarm_status, + alarm_data, + operation_name, + operation_time, + cause, + create_by, + create_time, + update_by, + update_time, + notify_user, + + + #{monitorId}, + #{collectDeviceId}, + #{collectTime}, + #{alarmType}, + #{alarmStatus}, + #{alarmData}, + #{operationName}, + #{operationTime}, + #{cause}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{notifyUser}, + + + + + update ems_record_alarm_data + + monitor_id = #{monitorId}, + collect_device_id = #{collectDeviceId}, + collect_time = #{collectTime}, + alarm_type = #{alarmType}, + alarm_status = #{alarmStatus}, + alarm_data = #{alarmData}, + operation_name = #{operationName}, + operation_time = #{operationTime}, + cause = #{cause}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + notify_user = #{notifyUser}, + + where obj_id = #{objId} + + + + delete from ems_record_alarm_data where obj_id = #{objId} + + + + delete from ems_record_alarm_data where obj_id in + + #{objId} + + + diff --git a/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmRuleMapper.xml b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmRuleMapper.xml new file mode 100644 index 0000000..304dca7 --- /dev/null +++ b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmRuleMapper.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + RAL.obj_id, + RAL.rule_id, + RAL.rule_name, + RAL.monitor_id, + RAL.collect_time, + RAL.energy_type, + RAL.trigger_rule, + RAL.trigger_number, + RAL.time_range, + RAL.device_offline_time, + RAL.notify_user, + RAL.cause, + RAL.create_by, + RAL.create_time, + RAL.update_by, + RAL.update_time, + BMI.monitor_code, + BMI.monitor_name, + SUSER.nick_name + FROM + ems_record_alarm_rule as RAL + left join ems_base_monitor_info as BMI on RAL.monitor_id = BMI.obj_id + left join sys_user as SUSER on RAL.notify_user = SUSER.user_id + + + + + + + + insert into ems_record_alarm_rule + + rule_id, + rule_name, + monitor_id, + collect_time, + energy_type, + trigger_rule, + trigger_number, + time_range, + device_offline_time, + notify_user, + cause, + create_by, + create_time, + update_by, + update_time, + + + #{ruleId}, + #{ruleName}, + #{monitorId}, + #{collectTime}, + #{energyType}, + #{triggerRule}, + #{triggerNumber}, + #{timeRange}, + #{deviceOfflineTime}, + #{notifyUser}, + #{cause}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update ems_record_alarm_rule + + rule_id = #{ruleId}, + rule_name = #{ruleName}, + monitor_id = #{monitorId}, + collect_time = #{collectTime}, + energy_type = #{energyType}, + trigger_rule = #{triggerRule}, + trigger_number = #{triggerNumber}, + time_range = #{timeRange}, + device_offline_time = #{deviceOfflineTime}, + notify_user = #{notifyUser}, + cause = #{cause}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where obj_id = #{objId} + + + + delete from ems_record_alarm_rule where obj_id = #{objId} + + + + delete from ems_record_alarm_rule where obj_id in + + #{objId} + + +