预警 定时任务
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
+9
-13
@@ -34,19 +34,19 @@ public class EarlyWarningEO extends BaseEntity {
|
||||
private String standId;
|
||||
|
||||
@ApiModelProperty("标准类别")
|
||||
@TableField("STAND_TYPE")
|
||||
@TableField(exist = false)
|
||||
private String standType;
|
||||
|
||||
@ApiModelProperty("标准号")
|
||||
@TableField("STAND_CODE")
|
||||
@TableField(exist = false)
|
||||
private String standCode;
|
||||
|
||||
@ApiModelProperty("标准名称")
|
||||
@TableField("STAND_NAME")
|
||||
@TableField(exist = false)
|
||||
private String standName;
|
||||
|
||||
@ApiModelProperty("发布日期")
|
||||
@TableField("PUT_TIME")
|
||||
@TableField(exist = false)
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date putTime;
|
||||
|
||||
@@ -54,30 +54,26 @@ public class EarlyWarningEO extends BaseEntity {
|
||||
private Date lastTime;
|
||||
|
||||
@ApiModelProperty("适用车型")
|
||||
@TableField("APPLY_TYPE")
|
||||
@TableField(exist = false)
|
||||
private String applyType;
|
||||
|
||||
@ApiModelProperty("责任工程师")
|
||||
@TableField("DUTY_ENGINEER")
|
||||
@TableField(exist = false)
|
||||
private String dutyEngineer;
|
||||
|
||||
@ApiModelProperty("条款(分解单)id")
|
||||
@TableField("ITEMS_ID")
|
||||
@TableField(exist = false)
|
||||
private String itemsId;
|
||||
|
||||
@ApiModelProperty("条款(分解单)编号")
|
||||
@TableField("ITEMS_NUM")
|
||||
@TableField(exist = false)
|
||||
private String itemsNum;
|
||||
|
||||
@ApiModelProperty("条款(分解单)名称")
|
||||
@TableField("ITEMS_NAME")
|
||||
private String itemsName;
|
||||
|
||||
|
||||
@TableField("POLICY_ID")
|
||||
private String policyId;
|
||||
|
||||
@TableField("POLICY_NAME")
|
||||
private String policyName;
|
||||
|
||||
@TableField("MARK")
|
||||
private String mark;
|
||||
|
||||
Reference in New Issue
Block a user