🔨 告警记录.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:orion_visor}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:orion_visor}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true&useServerPrepStmts=false
|
||||||
username: ${MYSQL_USER:root}
|
username: ${MYSQL_USER:root}
|
||||||
password: ${MYSQL_PASSWORD:Data@123456}
|
password: ${MYSQL_PASSWORD:Data@123456}
|
||||||
initial-size: 0
|
initial-size: 0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:orion_visor}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:orion_visor}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true&useServerPrepStmts=false
|
||||||
username: ${MYSQL_USER:root}
|
username: ${MYSQL_USER:root}
|
||||||
password: ${MYSQL_PASSWORD:Data@123456}
|
password: ${MYSQL_PASSWORD:Data@123456}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.monitor.convert;
|
|||||||
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
||||||
import org.dromara.visor.module.monitor.entity.dto.AlarmEventTriggerDTO;
|
import org.dromara.visor.module.monitor.entity.dto.AlarmEventTriggerDTO;
|
||||||
import org.dromara.visor.module.monitor.entity.dto.AlarmPolicyAlarmCountDTO;
|
import org.dromara.visor.module.monitor.entity.dto.AlarmPolicyAlarmCountDTO;
|
||||||
import org.dromara.visor.module.monitor.entity.po.AlarmPolicyAlarmCountPO;
|
import org.dromara.visor.module.monitor.entity.po.AlarmEventCountPO;
|
||||||
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventQueryRequest;
|
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventQueryRequest;
|
||||||
import org.dromara.visor.module.monitor.entity.vo.AlarmEventVO;
|
import org.dromara.visor.module.monitor.entity.vo.AlarmEventVO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@@ -51,7 +51,7 @@ public interface AlarmEventConvert {
|
|||||||
|
|
||||||
AlarmEventTriggerDTO toTrigger(AlarmEventDO domain);
|
AlarmEventTriggerDTO toTrigger(AlarmEventDO domain);
|
||||||
|
|
||||||
AlarmPolicyAlarmCountDTO toCount(AlarmPolicyAlarmCountPO domain);
|
AlarmPolicyAlarmCountDTO toCount(AlarmEventCountPO domain);
|
||||||
|
|
||||||
List<AlarmEventVO> to(List<AlarmEventDO> list);
|
List<AlarmEventVO> to(List<AlarmEventDO> list);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||||
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
||||||
import org.dromara.visor.module.monitor.entity.po.AlarmPolicyRuleCountPO;
|
import org.dromara.visor.module.monitor.entity.po.AlarmEventCountPO;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -49,8 +49,8 @@ public interface AlarmEventDAO extends IMapper<AlarmEventDO> {
|
|||||||
* @param createTimeEnd createTimeEnd
|
* @param createTimeEnd createTimeEnd
|
||||||
* @return count
|
* @return count
|
||||||
*/
|
*/
|
||||||
List<AlarmPolicyRuleCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
|
List<AlarmEventCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
|
||||||
@Param("createTimeStart") Date createTimeStart,
|
@Param("createTimeStart") Date createTimeStart,
|
||||||
@Param("createTimeEnd") Date createTimeEnd);
|
@Param("createTimeEnd") Date createTimeEnd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ import java.io.Serializable;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Schema(name = "AlarmPolicyAlarmCountPO", description = "监控告警事件数量对象")
|
@Schema(name = "AlarmEventCountPO", description = "监控告警事件数量对象")
|
||||||
public class AlarmPolicyAlarmCountPO implements Serializable {
|
public class AlarmEventCountPO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ import org.dromara.visor.module.monitor.dao.AlarmEventDAO;
|
|||||||
import org.dromara.visor.module.monitor.define.cache.AlarmEventCacheKeyDefine;
|
import org.dromara.visor.module.monitor.define.cache.AlarmEventCacheKeyDefine;
|
||||||
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
import org.dromara.visor.module.monitor.entity.domain.AlarmEventDO;
|
||||||
import org.dromara.visor.module.monitor.entity.dto.AlarmPolicyAlarmCountDTO;
|
import org.dromara.visor.module.monitor.entity.dto.AlarmPolicyAlarmCountDTO;
|
||||||
import org.dromara.visor.module.monitor.entity.po.AlarmPolicyRuleCountPO;
|
import org.dromara.visor.module.monitor.entity.po.AlarmEventCountPO;
|
||||||
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventClearRequest;
|
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventClearRequest;
|
||||||
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventHandleRequest;
|
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventHandleRequest;
|
||||||
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventQueryRequest;
|
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventQueryRequest;
|
||||||
@@ -198,7 +198,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
|
|||||||
if (!queryIdList.isEmpty()) {
|
if (!queryIdList.isEmpty()) {
|
||||||
Map<Long, Integer> countMap = alarmEventDAO.selectPolicyEventCount(queryIdList, startDate, endDate)
|
Map<Long, Integer> countMap = alarmEventDAO.selectPolicyEventCount(queryIdList, startDate, endDate)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(AlarmPolicyRuleCountPO::getPolicyId, AlarmPolicyRuleCountPO::getCount));
|
.collect(Collectors.toMap(AlarmEventCountPO::getPolicyId, AlarmEventCountPO::getCount));
|
||||||
// 设置缓存
|
// 设置缓存
|
||||||
for (Long policyId : queryIdList) {
|
for (Long policyId : queryIdList) {
|
||||||
Integer count = Objects1.def(countMap.get(policyId), 0);
|
Integer count = Objects1.def(countMap.get(policyId), 0);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 操作数量映射结果 -->
|
<!-- 操作数量映射结果 -->
|
||||||
<resultMap id="CountResultMap" type="org.dromara.visor.module.monitor.entity.po.AlarmPolicyRuleCountPO">
|
<resultMap id="CountResultMap" type="org.dromara.visor.module.monitor.entity.po.AlarmEventCountPO">
|
||||||
<result column="policy_id" property="policyId"/>
|
<result column="policy_id" property="policyId"/>
|
||||||
<result column="total_count" property="count"/>
|
<result column="total_count" property="count"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@@ -48,6 +48,7 @@
|
|||||||
SELECT policy_id, COUNT(1) total_count
|
SELECT policy_id, COUNT(1) total_count
|
||||||
FROM monitor_alarm_event
|
FROM monitor_alarm_event
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
|
AND false_alarm = 0
|
||||||
AND policy_id IN
|
AND policy_id IN
|
||||||
<foreach collection="policyIdList" item="item" open="(" separator="," close=")">
|
<foreach collection="policyIdList" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
|
|||||||
Reference in New Issue
Block a user