预警 定时任务

This commit is contained in:
zhaokaiyao@91isoft.com
2021-12-01 19:08:59 +08:00
parent 90d84a7443
commit 960ea90b4a
4 changed files with 25 additions and 35 deletions
@@ -23,6 +23,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.*;
@@ -62,7 +63,7 @@ public class ScheduledJob {
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
@Scheduled(cron="*/5 * * * * ?")
@Async
// @Async
public void WarningSchedulingTasks() {
Logger logger = LoggerFactory.getLogger(ScheduledJob.class);
@@ -88,7 +89,7 @@ public class ScheduledJob {
*/
//删除不在预警范围的标准
int remove = sarStandardWarningDao.cancelWarning();
int remove = sarStandardWarningDao.autoCancelWarning();
logger.info("==========================================================================");
logger.info("取消"+remove+"条预警");
@@ -100,6 +101,9 @@ public class ScheduledJob {
List<EarlyWarningEO> warningList = sarStandardWarningDao.getWarningId(term);
warningList.forEach(item->{
item.setId(UUIDUtils.randomUUID20());
});
//持久化至预警表 忽略标准id和标志位都一样的数据
if (warningList.size()!=0){
//此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
@@ -16,7 +16,7 @@ public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
public int ignoreInsert(@Param(value = "warningEOS") List<EarlyWarningEO> warningEOS);
public int cancelWarning();
public int autoCancelWarning();
public List<EarlyWarningEO> getWarningId(TermDTO term);
}