优化告警台账查询
This commit is contained in:
parent
e82ad7909b
commit
c6c8c6a1fa
@ -1,11 +1,20 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IDeviceAlarmRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 变电站-辅控设备-告警参数设置 前端控制器
|
||||
@ -19,4 +28,32 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(value = "DeviceAlarmParameterController", tags = "变电站辅控设备告警参数设置")
|
||||
public class DeviceAlarmParameterController {
|
||||
|
||||
@Resource
|
||||
private IDeviceAlarmRecordService deviceAlarmRecordService;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备告警记录
|
||||
* 参数说明
|
||||
* systemcode 所属系统
|
||||
* deviceName 告警设备名称
|
||||
* signalName 告警信号名称
|
||||
* startDate (开始日期)
|
||||
* endDate (结束日期)
|
||||
* alarmLevel 告警等级
|
||||
* status 告警状态
|
||||
* page 分页对象
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询变电站辅控设备告警记录")
|
||||
public ResponseResult getDeviceAlarmRecordPage(String systemcode, String deviceName, String signalName, String startDate, String endDate, String alarmLevel, String status, Page<DeviceAlarmRecord> page) {
|
||||
//参数校验 所属系统不能为空
|
||||
if (systemcode == null) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
//分页查询
|
||||
Page<DeviceAlarmRecord> deviceAlarmRecordPage = deviceAlarmRecordService.getDeviceAlarmRecordPage(systemcode, deviceName, signalName, startDate,endDate,alarmLevel,status,page);
|
||||
return ResponseResult.successData(deviceAlarmRecordPage);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
@ -156,5 +157,59 @@ public class DeviceAlarmRecord implements Serializable {
|
||||
*/
|
||||
private LocalDateTime operationTime;
|
||||
|
||||
/**
|
||||
* 告警分类:1-越限告警 2-设备报警 TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String alarmClassName;
|
||||
|
||||
|
||||
/**
|
||||
* 告警类型名称:如:温度过高、压力异常、电流过载 TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String alarmTypeName;
|
||||
|
||||
/**
|
||||
* 告警等级名称:一般、严重、危急 TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String alarmLevelName;
|
||||
|
||||
/**
|
||||
* 次数:TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String frequency;
|
||||
|
||||
/**
|
||||
* 开始时间:TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束时间:TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 区域名称:TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String regionName;
|
||||
|
||||
|
||||
/**
|
||||
* 告警状态名称:TODO 增加用于前端展示
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 告警通知方式名称:01-系统弹窗 ,02-邮件通知 ,03-触发联动 可多选:01,02
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String noticeTypeName;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface DeviceAlarmRecordMapper extends BaseMapper<DeviceAlarmRecord> {
|
||||
|
||||
Page<DeviceAlarmRecord> getDeviceAlarmRecordPage(Page<DeviceAlarmRecord> page, String systemcode, String deviceName, String signalName, String startDate, String endDate, String alarmLevel, String status);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -24,4 +25,20 @@ public interface IDeviceAlarmRecordService extends IService<DeviceAlarmRecord> {
|
||||
* 返回值说明: 无返回值
|
||||
***********************************/
|
||||
void doAlaramRecord(String from,String type,String slaveIp,String address,String value);
|
||||
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备告警记录
|
||||
* 参数说明
|
||||
* systemcode 所属系统
|
||||
* deviceName 告警设备名称
|
||||
* signalName 告警信号名称
|
||||
* startDate (开始日期)
|
||||
* endDate (结束日期)
|
||||
* alarmLevel 告警等级
|
||||
* status 告警状态
|
||||
* page 分页对象
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
Page<DeviceAlarmRecord> getDeviceAlarmRecordPage(String systemcode, String deviceName, String signalName, String startDate, String endDate, String alarmLevel, String status, Page<DeviceAlarmRecord> page);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
@ -10,6 +11,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmParameter;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
@ -21,6 +23,7 @@ import com.yfd.platform.modules.auxcontrol.mapper.MeterDeviceMapper;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IDeviceAlarmRecordService;
|
||||
import com.yfd.platform.system.domain.SysDictionaryItems;
|
||||
import com.yfd.platform.system.mapper.SysDictionaryItemsMapper;
|
||||
import com.yfd.platform.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -60,6 +63,26 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
@Resource
|
||||
private SysDictionaryItemsMapper sysDictionaryItemsMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备告警记录
|
||||
* 参数说明
|
||||
* systemcode 所属系统
|
||||
* deviceName 告警设备名称
|
||||
* signalName 告警信号名称
|
||||
* startDate (开始日期)
|
||||
* endDate (结束日期)
|
||||
* alarmLevel 告警等级
|
||||
* status 告警状态
|
||||
* page 分页对象
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<DeviceAlarmRecord> getDeviceAlarmRecordPage(String systemcode, String deviceName, String signalName,
|
||||
String startDate, String endDate, String alarmLevel,
|
||||
String status, Page<DeviceAlarmRecord> page) {
|
||||
return deviceAlarmRecordMapper.getDeviceAlarmRecordPage(page, systemcode, deviceName, signalName, startDate, endDate, alarmLevel, status);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 生成报警记录(IEC104)
|
||||
* 参数说明
|
||||
|
@ -72,7 +72,7 @@ logging:
|
||||
file:
|
||||
name: logs/projectname.log
|
||||
level:
|
||||
com.genersoft.iot: debug
|
||||
com.genersoft.iot: error
|
||||
com.genersoft.iot.vmp.storager.dao: info
|
||||
com.genersoft.iot.vmp.gb28181: info
|
||||
|
||||
|
@ -2,4 +2,55 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yfd.platform.modules.auxcontrol.mapper.DeviceAlarmRecordMapper">
|
||||
|
||||
<select id="getDeviceAlarmRecordPage"
|
||||
resultType="com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord">
|
||||
SELECT
|
||||
dar.*,
|
||||
sdi1.dictname AS alarmTypeName,
|
||||
sdi2.dictname AS alarmLevelName,
|
||||
sdi3.dictname AS alarmStatusName,
|
||||
COALESCE (
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( dictname ORDER BY itemcode SEPARATOR ',' )
|
||||
FROM
|
||||
sys_dictionary_items
|
||||
WHERE
|
||||
dictid = 'd3a5c69ef214012abcdb31495ef4e772'
|
||||
AND FIND_IN_SET( itemcode, dar.notice_action ) > 0
|
||||
),
|
||||
''
|
||||
) AS noticeTypeName
|
||||
FROM
|
||||
fk_device_alarm_record dar
|
||||
LEFT JOIN sys_dictionary_items sdi1 ON sdi1.dictid = 'aad92e9fd54d05e090b074f3e0666c8c'
|
||||
AND sdi1.itemcode = dar.alarm_type
|
||||
LEFT JOIN sys_dictionary_items sdi2 ON sdi2.dictid = '138d15a0ce89e5abd516389a1176db6e'
|
||||
AND sdi2.itemcode = dar.alarm_level
|
||||
LEFT JOIN sys_dictionary_items sdi3 ON sdi3.dictid = '1f0eb135658ed4c825021e2d5189efc0'
|
||||
AND sdi3.itemcode = dar.`status`
|
||||
where 1=1
|
||||
<if test="systemcode != null and systemcode != ''">
|
||||
and dar.systemcode= #{systemcode}
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
and dar.device_name like concat('%',#{deviceName},'%')
|
||||
</if>
|
||||
<if test="signalName != null and signalName != ''">
|
||||
and dar.signal_name like concat('%',#{signalName},'%')
|
||||
</if>
|
||||
<if test="alarmLevel != null and alarmLevel != ''">
|
||||
and dar.alarm_level = #{alarmLevel}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and dar.status = #{status}
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
and dar.alarm_time >= #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null and endDate != ''">
|
||||
and dar.alarm_time <= #{endDate}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user