add 未符合项更新整改状态定时任务
This commit is contained in:
@@ -55,6 +55,14 @@ public class AssessCommon {
|
|||||||
* 已关闭
|
* 已关闭
|
||||||
*/
|
*/
|
||||||
public final static String CLOSED = "5";
|
public final static String CLOSED = "5";
|
||||||
|
/**
|
||||||
|
* 警示
|
||||||
|
*/
|
||||||
|
public final static String WARNING = "6";
|
||||||
|
/**
|
||||||
|
* 超期
|
||||||
|
*/
|
||||||
|
public final static String OVERDUE = "7";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.jero.modules.projectLibrary.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.jero.modules.projectLibrary.common.AssessCommon;
|
||||||
|
import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet;
|
||||||
|
import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未符合项更新整改状态
|
||||||
|
* @author liJiaRao
|
||||||
|
* @date 2023-12-25 17:34
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class UpdateStatusJob implements Job {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ILawsEvaluationNotMetService lawsEvaluationNotMetService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
DateTime date = DateUtil.parseDateTime(DateUtil.formatDateTime(new Date()));
|
||||||
|
date = date.setField(DateField.SECOND,0);
|
||||||
|
//预计整改完成日期前一天
|
||||||
|
DateTime theDayBefore = DateUtil.offsetDay(date, 1);
|
||||||
|
LambdaQueryWrapper<LawsEvaluationNotMet> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(LawsEvaluationNotMet::getExpectedTime,theDayBefore);
|
||||||
|
List<LawsEvaluationNotMet> list = lawsEvaluationNotMetService.list(wrapper);
|
||||||
|
for (LawsEvaluationNotMet lawsEvaluationNotMet : list) {
|
||||||
|
LambdaUpdateWrapper<LawsEvaluationNotMet> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.set(LawsEvaluationNotMet::getState, AssessCommon.WARNING);
|
||||||
|
updateWrapper.eq(LawsEvaluationNotMet::getId,lawsEvaluationNotMet.getId());
|
||||||
|
lawsEvaluationNotMetService.update(updateWrapper);
|
||||||
|
}
|
||||||
|
//预计整改完成日期后一天
|
||||||
|
DateTime theDayAfter = DateUtil.offsetDay(date, -1);
|
||||||
|
LambdaQueryWrapper<LawsEvaluationNotMet> wrapper1 = new LambdaQueryWrapper<>();
|
||||||
|
wrapper1.eq(LawsEvaluationNotMet::getExpectedTime,theDayAfter);
|
||||||
|
List<LawsEvaluationNotMet> list1 = lawsEvaluationNotMetService.list(wrapper1);
|
||||||
|
for (LawsEvaluationNotMet lawsEvaluationNotMet : list1) {
|
||||||
|
LambdaUpdateWrapper<LawsEvaluationNotMet> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.set(LawsEvaluationNotMet::getState, AssessCommon.OVERDUE);
|
||||||
|
updateWrapper.eq(LawsEvaluationNotMet::getId,lawsEvaluationNotMet.getId());
|
||||||
|
lawsEvaluationNotMetService.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user