🔨 告警记录.

This commit is contained in:
lijiahangmax
2025-09-29 13:35:47 +08:00
parent 32d60a4d43
commit 86abf4f634
7 changed files with 14 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
spring:
datasource:
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}
password: ${MYSQL_PASSWORD:Data@123456}
initial-size: 0

View File

@@ -1,7 +1,7 @@
spring:
datasource:
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}
password: ${MYSQL_PASSWORD:Data@123456}
# 初始连接数

View File

@@ -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.dto.AlarmEventTriggerDTO;
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.vo.AlarmEventVO;
import org.mapstruct.Mapper;
@@ -51,7 +51,7 @@ public interface AlarmEventConvert {
AlarmEventTriggerDTO toTrigger(AlarmEventDO domain);
AlarmPolicyAlarmCountDTO toCount(AlarmPolicyAlarmCountPO domain);
AlarmPolicyAlarmCountDTO toCount(AlarmEventCountPO domain);
List<AlarmEventVO> to(List<AlarmEventDO> list);

View File

@@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
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.po.AlarmPolicyRuleCountPO;
import org.dromara.visor.module.monitor.entity.po.AlarmEventCountPO;
import java.util.Date;
import java.util.List;
@@ -49,7 +49,7 @@ public interface AlarmEventDAO extends IMapper<AlarmEventDO> {
* @param createTimeEnd createTimeEnd
* @return count
*/
List<AlarmPolicyRuleCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
List<AlarmEventCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
@Param("createTimeStart") Date createTimeStart,
@Param("createTimeEnd") Date createTimeEnd);

View File

@@ -41,8 +41,8 @@ import java.io.Serializable;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "AlarmPolicyAlarmCountPO", description = "监控告警事件数量对象")
public class AlarmPolicyAlarmCountPO implements Serializable {
@Schema(name = "AlarmEventCountPO", description = "监控告警事件数量对象")
public class AlarmEventCountPO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@@ -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.entity.domain.AlarmEventDO;
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.AlarmEventHandleRequest;
import org.dromara.visor.module.monitor.entity.request.alarm.AlarmEventQueryRequest;
@@ -198,7 +198,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
if (!queryIdList.isEmpty()) {
Map<Long, Integer> countMap = alarmEventDAO.selectPolicyEventCount(queryIdList, startDate, endDate)
.stream()
.collect(Collectors.toMap(AlarmPolicyRuleCountPO::getPolicyId, AlarmPolicyRuleCountPO::getCount));
.collect(Collectors.toMap(AlarmEventCountPO::getPolicyId, AlarmEventCountPO::getCount));
// 设置缓存
for (Long policyId : queryIdList) {
Integer count = Objects1.def(countMap.get(policyId), 0);

View File

@@ -34,7 +34,7 @@
</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="total_count" property="count"/>
</resultMap>
@@ -48,6 +48,7 @@
SELECT policy_id, COUNT(1) total_count
FROM monitor_alarm_event
WHERE deleted = 0
AND false_alarm = 0
AND policy_id IN
<foreach collection="policyIdList" item="item" open="(" separator="," close=")">
#{item}