预警性能 不使用转列改为使用正则
This commit is contained in:
@@ -5,6 +5,7 @@ import com.adc.da.scheduled.dao.SarStandardItemDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardWarningDao;
|
||||
import com.adc.da.scheduled.entity.TermDTO;
|
||||
|
||||
import com.adc.da.slrs.ActivityDatas.entity.DataList;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
|
||||
@@ -17,8 +18,10 @@ import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -28,8 +31,10 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -68,8 +73,9 @@ public class ScheduledJob {
|
||||
// @PostConstruct //程序启动时执行一次
|
||||
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
// @Scheduled(fixedDelay = 120000)
|
||||
@Async
|
||||
public void WarningSchedulingTasks() {
|
||||
public void warningSchedulingTasks() {
|
||||
Logger logger = LoggerFactory.getLogger(ScheduledJob.class);
|
||||
|
||||
/**
|
||||
@@ -93,6 +99,16 @@ public class ScheduledJob {
|
||||
mark:标识预警的种类 stand 标准 item 条款
|
||||
*/
|
||||
|
||||
|
||||
// Runnable runnable = () -> {
|
||||
// try {
|
||||
// Thread.sleep(60000);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// runnable.run();
|
||||
//删除不在预警范围的标准
|
||||
int remove = sarStandardWarningDao.autoCancelWarning();
|
||||
|
||||
@@ -100,17 +116,39 @@ public class ScheduledJob {
|
||||
logger.info("取消"+remove+"条预警");
|
||||
logger.info("开始执行预警!!!");
|
||||
logger.info("==========================================================================");
|
||||
//预警期限(当前日期至3个月后)
|
||||
TermDTO term = new TermDTO();
|
||||
//查询符合预警期限的标准 多个
|
||||
List<WarningDate> warningDateList = sarStandardWarningDao.getWarningDate(term);
|
||||
|
||||
TermDTO term = new TermDTO(); //预警期限(当前日期至3个月后)
|
||||
|
||||
List<WarningDate> warningDateList = sarStandardWarningDao.getWarningDate(term); //查询符合预警期限的标准 多个
|
||||
|
||||
ArrayList<WarningDate> data = new ArrayList<>();
|
||||
warningDateList.forEach(item->{
|
||||
item.setId(UUIDUtils.randomUUID20());
|
||||
|
||||
for (String s : item.getSSRQ().split(",")) {
|
||||
|
||||
String pattern = "^\\d{4}-\\d{1,2}-\\d{1,2}";
|
||||
|
||||
Pattern r = Pattern.compile(pattern);
|
||||
Matcher m = r.matcher(s);
|
||||
//判断是否是日期格式
|
||||
if (m.matches()) {
|
||||
WarningDate warningDate = new WarningDate();
|
||||
BeanUtils.copyProperties(item, warningDate);
|
||||
|
||||
warningDate.setId(UUIDUtils.randomUUID20());
|
||||
warningDate.setSSRQ(s);
|
||||
data.add(warningDate);
|
||||
}
|
||||
}
|
||||
});
|
||||
iWarningDateService.remove(null); //清空标准的日期子表
|
||||
iWarningDateService.saveBatch(warningDateList); // 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
|
||||
List<EarlyWarningEO> warningList = sarStandardWarningDao.getWarningId(term); //联接标准的日期子表 和分解单表 查询符合预警期限的标准和分解项
|
||||
|
||||
|
||||
//清空标准的日期子表
|
||||
iWarningDateService.remove(null);
|
||||
// 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
|
||||
iWarningDateService.saveBatch(data);
|
||||
//联接标准的日期子表 和分解单表 查询符合预警期限的标准和分解项
|
||||
List<EarlyWarningEO> warningList = sarStandardWarningDao.getWarningId(term);
|
||||
|
||||
warningList.forEach(item->{
|
||||
item.setId(UUIDUtils.randomUUID20());
|
||||
|
||||
Reference in New Issue
Block a user