🔨 告警记录.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,8 +49,8 @@ public interface AlarmEventDAO extends IMapper<AlarmEventDO> {
|
||||
* @param createTimeEnd createTimeEnd
|
||||
* @return count
|
||||
*/
|
||||
List<AlarmPolicyRuleCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
|
||||
@Param("createTimeStart") Date createTimeStart,
|
||||
@Param("createTimeEnd") Date createTimeEnd);
|
||||
List<AlarmEventCountPO> selectPolicyEventCount(@Param("policyIdList") List<Long> policyIdList,
|
||||
@Param("createTimeStart") Date createTimeStart,
|
||||
@Param("createTimeEnd") Date createTimeEnd);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user