From aa5a25c691b758eb3bf8dc394d9a8d9529600c8d Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 30 Aug 2024 17:01:37 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=BC=80=E5=81=9C=E6=9C=BA=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/alarm/show/vo/AlarmHistoryParamVo.java | 9 ++--- .../main/constant/ScheduledConstant.java | 2 ++ .../hnac/hzims/alarm/show/mapper/AlarmMapper.xml | 7 ++-- .../scheduled/StartStopScheduledTask.java | 40 ++++++++++++++++++++++ .../service/startstop/StratStopService.java | 9 +++++ .../startstop/impl/StartStopServiceImpl.java | 24 +++++++++++++ 6 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/StratStopService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/impl/StartStopServiceImpl.java diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java index 5660404..c2a6738 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java @@ -3,8 +3,6 @@ package com.hnac.hzims.alarm.show.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * @author ysj * @date 2023/03/17 10:02:33 @@ -16,8 +14,11 @@ public class AlarmHistoryParamVo { @ApiModelProperty(value = "站点编号") private String stationId; - @ApiModelProperty(value = "告警日期 : yyyy-MM-dd") - private String alarmTime; + @ApiModelProperty(value = "告警开始日期 : yyyy-MM-dd") + private String startTime; + + @ApiModelProperty(value = "告警结束日期 : yyyy-MM-dd") + private String endTime; @ApiModelProperty(value = "告警类型") private Integer alarmType; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java index 5dee662..9c3b265 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java @@ -13,4 +13,6 @@ public interface ScheduledConstant { String THIS_DAY_POWER_GENERATION = "thisDayPowerGeneration"; String LOAD_THREE_YEAR_POWER_GENERATION = "loadThreeYearPowerGeneration"; + + String THIS_DAY_START_STOP_RECORD = "thisDayStartStopRecord"; } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml index f583dc7..a0fae3d 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml @@ -14,8 +14,11 @@ AND ALARM.STATION_ID = #{param.stationId} - - AND ALARM.ALARM_TIME like CONCAT('%',#{param.alarmTime}, '%') + + AND ALARM.ALARM_TIME >= #{param.startTime} + + + AND ALARM.ALARM_TIME <= #{param.endTime} AND ALARM.ALARM_TYPE = #{param.alarmType} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java new file mode 100644 index 0000000..cb02315 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java @@ -0,0 +1,40 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.hnac.hzims.scheduled.service.startstop.StratStopService; +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.ScheduledConstant.THIS_DAY_START_STOP_RECORD; + + +/** + * 开停机定时任务 + * @author ysj + */ +@Slf4j +@Component +public class StartStopScheduledTask { + + @Autowired + private StratStopService service; + + /** + * 单日开停机记录 + */ + @XxlJob(THIS_DAY_START_STOP_RECORD) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT thisDayStartStopRecord(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.thisDayStartStopRecord(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/startstop/StratStopService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/StratStopService.java new file mode 100644 index 0000000..c958aa4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/StratStopService.java @@ -0,0 +1,9 @@ +package com.hnac.hzims.scheduled.service.startstop; + +/** + * @author ysj + */ +public interface StratStopService { + + void thisDayStartStopRecord(String param); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/impl/StartStopServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/impl/StartStopServiceImpl.java new file mode 100644 index 0000000..2957df5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/startstop/impl/StartStopServiceImpl.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.scheduled.service.startstop.impl; + +import com.hnac.hzims.scheduled.service.startstop.StratStopService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class StartStopServiceImpl implements StratStopService { + + /** + * 单日开停机记录 + * @param param + */ + @Override + public void thisDayStartStopRecord(String param) { + + } +} \ No newline at end of file