From 1736f9b4911802863504f3642d7c3166f71c81a4 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 20 Dec 2023 11:51:52 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=BC=80=E5=85=B3=E6=9C=BA=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/constant/MainConstants.java | 3 ++ .../scheduled/scheduled/AlarmScheduledTask.java | 41 ++++++++++++++++++++++ .../scheduled/service/alarm/AlarmQueryService.java | 3 ++ .../service/alarm/impl/AlarmQueryServiceImpl.java | 10 +++++- 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index 5ac0d97..1edaf29 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -68,6 +68,9 @@ public interface MainConstants { // 集中监控数据处理 String CENTRALIZED_MONITORING = "centralizedMonitoring"; + // 开停机告警 + String START_STOP_ALARM = "startStopAlarm"; + // realId获取 String REAL_ID_DATA = "realIdData"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java new file mode 100644 index 0000000..0f6c56d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; + +import static com.hnac.hzims.operational.main.constant.MainConstants.START_STOP_ALARM; + + +/** + * 告警定时任务 + * @author ysj + */ +@Slf4j +@Component +public class AlarmScheduledTask { + + @Autowired + private AlarmQueryService service; + + /** + * 开停机告警 + * @return ReturnT + */ + @XxlJob(START_STOP_ALARM) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT startStopAlarm(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.startStopAlarm(param); + return new ReturnT<>("SUCCESS"); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java index b0b2ad2..37b1314 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java @@ -10,6 +10,9 @@ import java.util.List; */ public interface AlarmQueryService extends BaseService { + // 开停机告警 + void startStopAlarm(String param); + List bells(List codes); List aborts(List codes); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java index d9ac8fe..f31a20f 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java @@ -1,6 +1,5 @@ package com.hnac.hzims.scheduled.service.alarm.impl; -import cn.hutool.core.stream.CollectorUtil; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.alarm.constants.AlarmConstants; @@ -28,6 +27,15 @@ import java.util.stream.Collectors; public class AlarmQueryServiceImpl extends BaseServiceImpl implements AlarmQueryService { /** + * 开停机告警 + * @param param + */ + @Override + public void startStopAlarm(String param) { + + } + + /** * 查询站点铃铛 * @param codes * @return