From b704541bf3785fc50e94d20e75af45f3055cc299 Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 9 Jul 2024 16:38:32 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=A4=84=E7=90=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmsRecordAlarmDataController.java | 12 +++++ .../ems/record/domain/EmsRecordAlarmData.java | 35 ++++++++------ .../service/IEmsRecordAlarmDataService.java | 7 +++ .../impl/EmsRecordAlarmDataServiceImpl.java | 20 ++++++++ .../ems/record/EmsRecordAlarmDataMapper.xml | 48 +++++++++---------- 5 files changed, 84 insertions(+), 38 deletions(-) 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 index f810b5d..f5fd610 100644 --- 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 @@ -103,4 +103,16 @@ public class EmsRecordAlarmDataController extends BaseController { return toAjax(emsRecordAlarmDataService.deleteEmsRecordAlarmDataByObjIds(objIds)); } + + /** + * 处理异常数据 + * @param objIds + * @return + */ + @PostMapping("/handleExceptions/{objIds}") + public AjaxResult handleExceptions(@PathVariable Long[] objIds) + { + return toAjax(emsRecordAlarmDataService.handleExceptionsAlarmData(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 index bf01891..2d0c4f6 100644 --- 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 @@ -23,13 +23,19 @@ public class EmsRecordAlarmData extends BaseEntity /** 计量设备编号 */ @Excel(name = "计量设备编号") private String monitorId; - private String monitorCode; + + /** 计量设备名称 */ + @Excel(name = "计量设备名称") private String monitorName; /** 采集设备编号 */ @Excel(name = "采集设备编号") private String collectDeviceId; + /** 采集设备名称 */ + @Excel(name = "采集设备名称") + private String collectDeviceName; + /** 记录时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @@ -67,7 +73,8 @@ public class EmsRecordAlarmData extends BaseEntity @Excel(name = "通知用户") private String notifyUser; - private String nickName; + /** 统一设备名称 */ + private String deviceName; public String getBeginOperationTime() { return beginOperationTime; @@ -85,14 +92,6 @@ public class EmsRecordAlarmData extends BaseEntity this.endOperationTime = endOperationTime; } - public String getMonitorCode() { - return monitorCode; - } - - public void setMonitorCode(String monitorCode) { - this.monitorCode = monitorCode; - } - public String getMonitorName() { return monitorName; } @@ -101,12 +100,20 @@ public class EmsRecordAlarmData extends BaseEntity this.monitorName = monitorName; } - public String getNickName() { - return nickName; + public String getCollectDeviceName() { + return collectDeviceName; + } + + public void setCollectDeviceName(String collectDeviceName) { + this.collectDeviceName = collectDeviceName; + } + + public String getDeviceName() { + return deviceName; } - public void setNickName(String nickName) { - this.nickName = nickName; + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; } public void setObjId(Long objId) 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 index bdbbddb..c0ee589 100644 --- 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 @@ -58,4 +58,11 @@ public interface IEmsRecordAlarmDataService * @return 结果 */ public int deleteEmsRecordAlarmDataByObjId(Long objId); + + /** + * 处理异常数据 + * @param objIds + * @return + */ + public int handleExceptionsAlarmData(Long[] objIds); } 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 index 07d9a7a..3b200fd 100644 --- 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 @@ -8,6 +8,8 @@ import com.os.ems.record.mapper.EmsRecordAlarmDataMapper; import com.os.ems.record.domain.EmsRecordAlarmData; import com.os.ems.record.service.IEmsRecordAlarmDataService; +import static com.os.common.utils.SecurityUtils.getUsername; + /** * 异常数据记录Service业务层处理 * @@ -93,4 +95,22 @@ public class EmsRecordAlarmDataServiceImpl implements IEmsRecordAlarmDataService { return emsRecordAlarmDataMapper.deleteEmsRecordAlarmDataByObjId(objId); } + + /** + * 处理异常数据 + * @param objIds + * @return + */ + @Override + public int handleExceptionsAlarmData(Long[] objIds) { + for (Long objId : objIds) { + EmsRecordAlarmData alarmData = new EmsRecordAlarmData(); + alarmData.setObjId(objId); + alarmData.setAlarmStatus(0L); + alarmData.setOperationName(getUsername()); + alarmData.setOperationTime(DateUtils.getNowDate()); + emsRecordAlarmDataMapper.updateEmsRecordAlarmData(alarmData); + } + return 1; + } } diff --git a/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml index 6b61e52..f8e197a 100644 --- a/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml +++ b/os-ems/src/main/resources/mapper/ems/record/EmsRecordAlarmDataMapper.xml @@ -22,33 +22,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + - 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 + 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_name, + ebcdi.collect_device_name, + IIF(rad.monitor_id is null, ebcdi.collect_device_name, bmi.monitor_name) device_name + FROM ems_record_alarm_data rad + LEFT JOIN ems_base_monitor_info bmi ON rad.monitor_id = bmi.monitor_code + LEFT JOIN ems_base_collect_device_info ebcdi on rad.collect_device_id = ebcdi.collect_device_id +