From b49f336dc199e7d27082db58f5b229f9faf6db17 Mon Sep 17 00:00:00 2001 From: liwen Date: Wed, 27 Mar 2024 20:21:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=9C=88=E5=BA=A6=E6=9F=A5=E8=AF=A2=E9=80=BE=E6=9C=9F=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/constants/RedisKeyConstants.java | 4 ++-- .../maintenance/scheduled/MaintenanceTaskRemindHandler.java | 5 ++--- .../maintenance/scheduled/MaintenanceTaskSchedule.java | 10 ++++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java index c0f0cad..8e30eb7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java @@ -11,8 +11,8 @@ import org.springframework.stereotype.Component; @Data public class RedisKeyConstants { - public static String MAINTENANCE_TASK_DELAY_LIST = "hzims:operation:maintenance:end:delay:tasks"; - public static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:end:delay:tasks"; + public static String MAINTENANCE_TASK_DELAY_LIST = "hzims:operation:maintenance:delay:tasks"; + public static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:end:tasks"; /**根据realId获取实时数据**/ @Value("${hzims.operation.realIdKey}") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java index 5c38569..cf754f5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java @@ -1,6 +1,5 @@ package com.hnac.hzims.operational.maintenance.scheduled; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.google.common.collect.Lists; import com.hnac.hzims.common.constant.CommonConstant; import com.hnac.hzims.message.MessageConstants; @@ -17,7 +16,6 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; -import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.data.redis.core.RedisTemplate; @@ -31,6 +29,7 @@ import java.util.Set; import java.util.stream.Collectors; import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.REMIND_MAINTENANCE_BECOME_TASK; + @Component @Slf4j @AllArgsConstructor @@ -56,7 +55,7 @@ public class MaintenanceTaskRemindHandler { else if(Lists.newArrayList("待领用","待执行").contains(taskEntity.getFlowTaskName())) { XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L)); //日常维护任务到期消息提醒,提醒对象:执行人、项目经理角色 取出 - //this.sendMessage(taskEntity); + this.sendMessage(taskEntity); redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity); } }); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java index a2c8afa..d16208a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java @@ -61,10 +61,12 @@ public class MaintenanceTaskSchedule { @XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE) public ReturnT execute(String param) throws Exception { - Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); - Date endDate = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(startDate, 1)), DateUtil.PATTERN_DATE); - LambdaQueryWrapper planQW = Wrappers.lambdaQuery().isNull(OperMaintenancePlanEntity::getCreateTaskTime) - .ge(OperMaintenancePlanEntity::getDisposeTime, startDate).lt(OperMaintenancePlanEntity::getDisposeTime, endDate); + String startDate = DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String endDate = DateUtil.format(DateUtil.plusDays(DateUtil.now(), 1), DateUtil.PATTERN_DATE) + " 00:00:00"; + LambdaQueryWrapper planQW = Wrappers.lambdaQuery() + .isNull(OperMaintenancePlanEntity::getCreateTaskTime) + .ge(OperMaintenancePlanEntity::getDisposeTime, startDate) + .lt(OperMaintenancePlanEntity::getDisposeTime, endDate); List planList = planService.list(planQW); XxlJobLogger.log("日常维护任务生成开始!计划ID为:"+planList.stream().map(OperMaintenancePlanEntity::getId).map(String::valueOf).collect(Collectors.joining(","))); //分页插入日常维护计划