change - 处理异常数据

main
yinq 4 months ago
parent 14bf709535
commit b704541bf3

@ -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));
}
}

@ -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)

@ -58,4 +58,11 @@ public interface IEmsRecordAlarmDataService
* @return
*/
public int deleteEmsRecordAlarmDataByObjId(Long objId);
/**
*
* @param objIds
* @return
*/
public int handleExceptionsAlarmData(Long[] objIds);
}

@ -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;
}
}

@ -22,33 +22,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="notifyUser" column="notify_user" />
<result property="nickName" column="nick_name" />
<result property="collectDeviceName" column="collect_device_name" />
<result property="deviceName" column="device_name" />
</resultMap>
<sql id="selectEmsRecordAlarmDataVo">
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</sql>
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
</sql>
<select id="selectEmsRecordAlarmDataList" parameterType="EmsRecordAlarmData" resultMap="EmsRecordAlarmDataResult">
<include refid="selectEmsRecordAlarmDataVo"/>

Loading…
Cancel
Save