# Conflicts:
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java
dev
YYD-YY 9 months ago
commit 0dedb8b8e3
  1. 16
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java
  2. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java
  3. 38
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/homeEquAlertMessage.java
  4. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertMessageMapper.java
  5. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertMessageService.java
  6. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertLaunchServiceImpl.java
  7. 7
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java
  8. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertRuleServiceImpl.java
  9. 20
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml

@ -13,6 +13,7 @@ import com.alops.common.utils.SecurityUtils;
import com.alops.common.utils.poi.ExcelUtil;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.service.IAlertLaunchService;
import com.alops.system.domain.AlertRule;
import com.alops.system.domain.EquInterface;
@ -84,6 +85,21 @@ public class AlertMessageController extends BaseController
/**
* 查询预警信息统计列表
*/
@PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:statistic:list')")
@GetMapping ("/statistic/list")
@ApiOperation("查询预警信息")
@Log(title = "查询预警信息", businessType = BusinessType.UPDATE)
public TableDataInfo homeList()
{
startPage();
List<homeEquAlertMessage> list = alertMessageService.selectStaticAlertMessageList();
return getDataTable(list);
}
/**
* 首页查询预警信息统计列表
*/
@PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:list')")
@GetMapping ("/list")
@ApiOperation("查询预警信息")

@ -9,6 +9,8 @@ import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.mail.Message;
/**
* 故障统计对象 alert_message
*
@ -23,7 +25,6 @@ public class AlertMessage
/** ID */
private Long id;
/** 设备ID */
@Excel(name = "设备ID")
private String equId;
@ -75,6 +76,8 @@ public class AlertMessage
public void setId(Long id)
{
this.id = id;

@ -0,0 +1,38 @@
package com.alops.system.domain.vo;
import com.alops.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class homeEquAlertMessage {
/** 预警级别(1-5级) */
@Excel(name = "预警级别(1-5级)")
private Long level;
/** 发生时间 */
@Excel(name = "发生时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date occurTime;
@Excel(name = "预警信息")
private String message;
/** 处理状态(open、in_progress_closed) */
@Excel(name = "处理状态")
private String status;
@Excel(name = "处理状态")
private String name;
@Excel(name = "处理状态")
private String location;
}

@ -2,6 +2,7 @@ package com.alops.system.mapper;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -44,6 +45,8 @@ public interface AlertMessageMapper
* @return 故障统计集合
*/
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage);
public List<homeEquAlertMessage> selectStaticAlertMessageList();
public ArrayList<AlertMessage> selectAlertMessageByEquId(Long Equid);
/**

@ -3,6 +3,7 @@ package com.alops.system.service;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import java.util.List;
@ -30,7 +31,7 @@ public interface IAlertMessageService
* @return 故障统计集合
*/
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage);
public List<homeEquAlertMessage> selectStaticAlertMessageList();
public List<AlertMessage> selectAlertMessageListByEquId(Long equId);
/**

@ -153,7 +153,7 @@ public class AlertLaunchServiceImpl implements IAlertLaunchService {
String msgdes = fillTemplate(rule.getAlertTemplate(), row, rule);
msg.setBatch(currentBatch);
msg.setMessage(msgdes);
messages.add(msg);
msgs.add(msgdes);

@ -12,6 +12,7 @@ import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.domain.dto.LevelCountDto;
import com.alops.system.domain.dto.TypeCountDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.mapper.AlertMessageMapper;
import com.alops.system.service.IAlertMessageService;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,6 +54,12 @@ public class AlertMessageServiceImpl implements IAlertMessageService
return alertMessageMapper.selectAlertMessageList(alertMessage);
}
@Override
public List<homeEquAlertMessage> selectStaticAlertMessageList(){
return alertMessageMapper.selectStaticAlertMessageList();
}
@Override
public List<AlertMessage> selectAlertMessageListByEquId(Long equId)
{

@ -56,7 +56,7 @@ public class AlertRuleServiceImpl implements IAlertRuleService
sql = buildSql(rule, conditions);
}
rule.setAlertSql(sql);
rule.setEnable(1);
// 插入规则
alertRuleMapper.insertAlertRule(rule);

@ -30,12 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO alert_message
(equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch)
(equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch,message)
VALUES
<foreach collection="list" item="msg" separator=",">
(#{msg.equId},#{msg.type}, #{msg.equType},
#{msg.solution}, #{msg.level}, #{msg.occurTime},
#{msg.handler}, #{msg.handleTime}, #{msg.status}, #{msg.batch})
#{msg.handler}, #{msg.handleTime}, #{msg.status}, #{msg.batch}, #{msg.message})
</foreach>
</insert>
@ -85,6 +85,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY am.batch DESC
</select>
<!-- 查询最新预警信息(按时间排序,取前N条) -->
<select id="selectStaticAlertMessageList" resultType="homeEquAlertMessage">
SELECT
a.level,
a.occur_time AS occurTime,
a.status,
a.message,
e.name,
e.location
FROM alert_message a
LEFT JOIN equ_base e ON a.equ_id = e.id
ORDER BY a.occur_time DESC
</select>
<select id="selectAlertMessageById" parameterType="Long" resultMap="AlertMessageResult">
<include refid="selectAlertMessageVo"/>
where am.id = #{id}

Loading…
Cancel
Save