liwen
1 year ago
7 changed files with 122 additions and 1 deletions
@ -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; |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -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; |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue