[alerter,manager] 告警信息入库,监控状态变更联动

This commit is contained in:
tomsun28
2021-12-10 16:56:39 +08:00
parent 370224f5cf
commit ab2d4511ec
15 changed files with 247 additions and 27 deletions

View File

@@ -0,0 +1,29 @@
package com.usthe.alert.service;
import com.usthe.alert.pojo.entity.Alert;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
/**
* 告警信息管理接口
* @author tom
* @date 2021/12/9 10:06
*/
public interface AlertService {
/**
* 新增告警
* @param alert 告警实体
* @throws RuntimeException 新增过程异常抛出
*/
void addAlert(Alert alert) throws RuntimeException;
/**
* 动态条件查询
* @param specification 查询条件
* @param pageRequest 分页参数
* @return 查询结果
*/
Page<Alert> getAlerts(Specification<Alert> specification, PageRequest pageRequest);
}

View File

@@ -0,0 +1,32 @@
package com.usthe.alert.service.impl;
import com.usthe.alert.dao.AlertDao;
import com.usthe.alert.pojo.entity.Alert;
import com.usthe.alert.service.AlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
/**
* 告警信息服务实现
* @author tom
* @date 2021/12/10 15:39
*/
@Service
public class AlertServiceImpl implements AlertService {
@Autowired
private AlertDao alertDao;
@Override
public void addAlert(Alert alert) throws RuntimeException {
alertDao.save(alert);
}
@Override
public Page<Alert> getAlerts(Specification<Alert> specification, PageRequest pageRequest) {
return alertDao.findAll(specification, pageRequest);
}
}