定时任务-修改文本状态

This commit is contained in:
zhaokaiyao@91isoft.com
2021-08-27 15:24:32 +08:00
parent 016e7e9003
commit c22db5b063
6 changed files with 41 additions and 9 deletions
@@ -0,0 +1,32 @@
package com.adc.da.scheduled;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@EnableScheduling
@Component
@Slf4j
public class ImplementScheduledJob {
@Autowired
private SarStandardsInfoDao sarStandardsInfoDao;
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
// @Scheduled(cron="*/5 * * * * ?")
@Async
public void schedulingTasks() {
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
}
}
@@ -21,7 +21,7 @@ import java.util.List;
@EnableScheduling @EnableScheduling
@Component @Component
@Slf4j @Slf4j
public class ScheduledJob { public class WarningScheduledJob {
/** /**
* 根据配置文件设置是否开启定时器 * 根据配置文件设置是否开启定时器
@@ -84,7 +84,7 @@ public class ScheduledJob {
LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合 LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
//分解单(条款) 新车型 mark=1 //分解单(条款) 新车型 mark=1
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.select(term, "XCXSSRQ"); List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.selectWithinTerm(term, "XCXSSRQ");
for (WarningEO warningEO : itemForXCXSSRQ) { for (WarningEO warningEO : itemForXCXSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
@@ -94,7 +94,7 @@ public class ScheduledJob {
warningList.addAll(itemForXCXSSRQ); warningList.addAll(itemForXCXSSRQ);
//分解单(条款) 在产车型 mark=2 //分解单(条款) 在产车型 mark=2
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.select(term, "ZCCSSRQ"); List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.selectWithinTerm(term, "ZCCSSRQ");
for (WarningEO warningEO : itemForZCCSSRQ) { for (WarningEO warningEO : itemForZCCSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
@@ -104,7 +104,7 @@ public class ScheduledJob {
warningList.addAll(itemForZCCSSRQ); warningList.addAll(itemForZCCSSRQ);
//标准 新车型 预警 mark=3 //标准 新车型 预警 mark=3
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.select(term, "XCXSSRQ"); List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
for (WarningEO warningEO : standInfoXCXSSRQ) { for (WarningEO warningEO : standInfoXCXSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
@@ -115,7 +115,7 @@ public class ScheduledJob {
//标准 在产车型 mark=4 //标准 在产车型 mark=4
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.select(term, "ZCCSSRQ"); List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
for (WarningEO warningEO : standInfoZCCSSRQ) { for (WarningEO warningEO : standInfoZCCSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
@@ -12,6 +12,6 @@ import java.util.List;
@Repository @Repository
public interface SarStandardInfoDao{ public interface SarStandardInfoDao{
public List<WarningEO> select(DataDTO date, String str); public List<WarningEO> selectWithinTerm(DataDTO date, String str);
} }
@@ -12,6 +12,6 @@ import java.util.List;
@Repository @Repository
public interface SarStandardItemDao extends BaseMapper{ public interface SarStandardItemDao extends BaseMapper{
public List<WarningEO> select(DataDTO date, String str); public List<WarningEO> selectWithinTerm(DataDTO date, String str);
} }
@@ -15,7 +15,7 @@
</resultMap> </resultMap>
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO"> <select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
SELECT SELECT
info.ID, info.ID,
info.STAND_NUMBER, info.STAND_NUMBER,
@@ -17,7 +17,7 @@
<result column="ZRGCS" property="dutyEngineer"/> <result column="ZRGCS" property="dutyEngineer"/>
</resultMap> </resultMap>
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO"> <select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
SELECT SELECT
items.ID, items.ID,
STAND_ID, STAND_ID,