diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java index 83ea0fa..26e40c5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java @@ -1,4 +1,43 @@ package com.hnac.hzims.safeproduct.jobs; +import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; +import com.hnac.hzims.safeproduct.enums.ConferenceStatusEnum; +import com.hnac.hzims.safeproduct.service.IConferencePlanService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * 会议管理模块定时任务 + * + * @author liwen + * @date 2024-01-15 + */ +@Component public class ConferenceJob { + + @Autowired + IConferencePlanService conferencePlanService; + + @XxlJob("autoChangeConferencePlanStatus") + public ReturnT autoChangeConferencePlanStatus(String param) { + // 获取时间范围 + Date current = DateUtil.now(); + Date before = DateUtil.minusDays(current, 1); + String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss"); + String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss"); + // 查询前一天的超时未完成会议计划 + List list = conferencePlanService.getWaitingConferencePlanInTimeRange(yesterday, today); + list.forEach(x -> { + x.setConferenceStatus(ConferenceStatusEnum.UNFINISHED.getValue()); + }); + // 将状态置为未完成 + boolean flag = conferencePlanService.updateBatchById(list); + return flag ? ReturnT.SUCCESS : ReturnT.FAIL; + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java index 745ae01..4a8aabf 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java @@ -1,4 +1,43 @@ package com.hnac.hzims.safeproduct.jobs; +import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; +import com.hnac.hzims.safeproduct.enums.TrainStatusEnum; +import com.hnac.hzims.safeproduct.service.IHygienePlanService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * 卫生自查模块定时任务 + * + * @author liwen + * @date 2024-01-15 + */ +@Component public class HygieneJob { + + @Autowired + IHygienePlanService hygienePlanService; + + @XxlJob("autoChangeHygienePlanStatus") + public ReturnT autoChangeHygienePlanStatus(String param) { + // 获取时间范围 + Date current = DateUtil.now(); + Date before = DateUtil.minusDays(current, 1); + String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss"); + String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss"); + // 查询前一天的超时未完成卫生自查计划 + List list = hygienePlanService.getWaitingHygienePlanInTimeRange(yesterday, today); + list.forEach(x -> { + x.setHygienePlanStatus(TrainStatusEnum.UNFINISHED.getValue()); + }); + // 将状态置为未完成 + boolean flag = hygienePlanService.updateBatchById(list); + return flag ? ReturnT.SUCCESS : ReturnT.FAIL; + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/RehearsalJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/RehearsalJob.java index 44ff7d8..d6eda46 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/RehearsalJob.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/RehearsalJob.java @@ -31,7 +31,7 @@ public class RehearsalJob { Date before = DateUtil.minusDays(current, 1); String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss"); String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss"); - // 查询前一天的超时未完成演练记录 + // 查询前一天的超时未完成演练计划 List list = rehearsalPlanService.getWaitingRehearsalInTimeRange(yesterday, today); list.forEach(x -> { x.setRehearsalStatus(RehearsalStatusEnum.UNFINISHED.getValue()); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferencePlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferencePlanService.java index 2c3581d..dc916b6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferencePlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferencePlanService.java @@ -6,6 +6,7 @@ import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; /** @@ -37,4 +38,12 @@ public interface IConferencePlanService extends IService { * @param response 响应类 */ void exportConferenceData(Map param, HttpServletResponse response); + + /** + * 查询时间范围内未开始的会议计划数据 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 会议计划数据 + */ + List getWaitingConferencePlanInTimeRange(String startTime, String endTime); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java index 0846fbb..5337d07 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java @@ -10,6 +10,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; /** @@ -76,4 +77,12 @@ public interface IHygienePlanService extends IService { * 月度数据导出 */ void exportMonthData(Map param, Query query, HttpServletResponse response); + + /** + * 查询时间范围内未开始的卫生自查计划数据 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 卫生自查计划数据 + */ + List getWaitingHygienePlanInTimeRange(String startTime, String endTime); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java index 08255fc..6a2dcf8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java @@ -147,6 +147,18 @@ public class ConferencePlanServiceImpl extends ServiceImpl getWaitingConferencePlanInTimeRange(String startTime, String endTime) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(ConferencePlanEntity::getConferenceStatus, ConferenceStatusEnum.WAITING.getValue()) + .ge(ConferencePlanEntity::getScheduledEndTime, startTime) + .le(ConferencePlanEntity::getScheduledEndTime, endTime); + return this.list(queryWrapper); + } + + /** * 根据单位和计划时间查询会议记录 * @param unit 单位 * @param startTime 计划开始时间 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index 3292edd..4cf06fd 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -13,6 +13,7 @@ import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; +import com.hnac.hzims.safeproduct.enums.HygieneStatusEnum; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService; @@ -284,4 +285,16 @@ public class HygienePlanServiceImpl extends ServiceImpl getWaitingHygienePlanInTimeRange(String startTime, String endTime) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.WAITING.getValue()) + .ge(HygienePlanEntity::getScheduledEndTime, startTime) + .le(HygienePlanEntity::getScheduledEndTime, endTime); + return this.list(queryWrapper); + } }