Browse Source

update: 演练、会议、卫生自查模块定时任务

zhongwei
liwen 1 year ago
parent
commit
eabc134458
  1. 39
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java
  2. 39
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java
  3. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/RehearsalJob.java
  4. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferencePlanService.java
  5. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java
  6. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java
  7. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java

39
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java

@ -1,4 +1,43 @@
package com.hnac.hzims.safeproduct.jobs; 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 { public class ConferenceJob {
@Autowired
IConferencePlanService conferencePlanService;
@XxlJob("autoChangeConferencePlanStatus")
public ReturnT<String> 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<ConferencePlanEntity> list = conferencePlanService.getWaitingConferencePlanInTimeRange(yesterday, today);
list.forEach(x -> {
x.setConferenceStatus(ConferenceStatusEnum.UNFINISHED.getValue());
});
// 将状态置为未完成
boolean flag = conferencePlanService.updateBatchById(list);
return flag ? ReturnT.SUCCESS : ReturnT.FAIL;
}
} }

39
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java

@ -1,4 +1,43 @@
package com.hnac.hzims.safeproduct.jobs; 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 { public class HygieneJob {
@Autowired
IHygienePlanService hygienePlanService;
@XxlJob("autoChangeHygienePlanStatus")
public ReturnT<String> 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<HygienePlanEntity> list = hygienePlanService.getWaitingHygienePlanInTimeRange(yesterday, today);
list.forEach(x -> {
x.setHygienePlanStatus(TrainStatusEnum.UNFINISHED.getValue());
});
// 将状态置为未完成
boolean flag = hygienePlanService.updateBatchById(list);
return flag ? ReturnT.SUCCESS : ReturnT.FAIL;
}
} }

2
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); Date before = DateUtil.minusDays(current, 1);
String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss"); String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss");
String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss"); String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss");
// 查询前一天的超时未完成演练记录 // 查询前一天的超时未完成演练计划
List<RehearsalPlanEntity> list = rehearsalPlanService.getWaitingRehearsalInTimeRange(yesterday, today); List<RehearsalPlanEntity> list = rehearsalPlanService.getWaitingRehearsalInTimeRange(yesterday, today);
list.forEach(x -> { list.forEach(x -> {
x.setRehearsalStatus(RehearsalStatusEnum.UNFINISHED.getValue()); x.setRehearsalStatus(RehearsalStatusEnum.UNFINISHED.getValue());

9
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 org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -37,4 +38,12 @@ public interface IConferencePlanService extends IService<ConferencePlanEntity> {
* @param response 响应类 * @param response 响应类
*/ */
void exportConferenceData(Map<String, Object> param, HttpServletResponse response); void exportConferenceData(Map<String, Object> param, HttpServletResponse response);
/**
* 查询时间范围内未开始的会议计划数据
* @param startTime 开始时间
* @param endTime 结束时间
* @return 会议计划数据
*/
List<ConferencePlanEntity> getWaitingConferencePlanInTimeRange(String startTime, String endTime);
} }

9
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 org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -76,4 +77,12 @@ public interface IHygienePlanService extends IService<HygienePlanEntity> {
* 月度数据导出 * 月度数据导出
*/ */
void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response); void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response);
/**
* 查询时间范围内未开始的卫生自查计划数据
* @param startTime 开始时间
* @param endTime 结束时间
* @return 卫生自查计划数据
*/
List<HygienePlanEntity> getWaitingHygienePlanInTimeRange(String startTime, String endTime);
} }

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java

@ -147,6 +147,18 @@ public class ConferencePlanServiceImpl extends ServiceImpl<ConferencePlanMapper,
} }
/** /**
* 查询时间范围内未开始的会议计划数据
*/
@Override
public List<ConferencePlanEntity> getWaitingConferencePlanInTimeRange(String startTime, String endTime) {
QueryWrapper<ConferencePlanEntity> 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 unit 单位
* @param startTime 计划开始时间 * @param startTime 计划开始时间

13
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.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; 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.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
@ -284,4 +285,16 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
} }
} }
} }
/**
* 查询时间范围内未开始的卫生自查计划数据
*/
@Override
public List<HygienePlanEntity> getWaitingHygienePlanInTimeRange(String startTime, String endTime) {
QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.WAITING.getValue())
.ge(HygienePlanEntity::getScheduledEndTime, startTime)
.le(HygienePlanEntity::getScheduledEndTime, endTime);
return this.list(queryWrapper);
}
} }

Loading…
Cancel
Save