|
@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
|
|
|
+import javax.transaction.Transactional;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -40,6 +41,7 @@ public class WarningParameterTask {
|
|
@Autowired
|
|
@Autowired
|
|
private WarningParameterEntityRepo warningParameterEntityRepo;
|
|
private WarningParameterEntityRepo warningParameterEntityRepo;
|
|
|
|
|
|
|
|
+ @Transactional(rollbackOn = Throwable.class)
|
|
@Scheduled(cron = "0 0 0/12 * * ?")
|
|
@Scheduled(cron = "0 0 0/12 * * ?")
|
|
// @Scheduled(cron = "0 41 17 * * ?")
|
|
// @Scheduled(cron = "0 41 17 * * ?")
|
|
public void warningTask() {
|
|
public void warningTask() {
|
|
@@ -63,11 +65,14 @@ public class WarningParameterTask {
|
|
.anyMatch(warningParameter -> warningParameter.getParameterName().equals(s.getName()) && warningParameter.getThresholdValue() >= Double.parseDouble(s.getData())))
|
|
.anyMatch(warningParameter -> warningParameter.getParameterName().equals(s.getName()) && warningParameter.getThresholdValue() >= Double.parseDouble(s.getData())))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
+
|
|
for (IndexParameter2Entity indexParameter2Entity : collect1) {
|
|
for (IndexParameter2Entity indexParameter2Entity : collect1) {
|
|
WarningInfoEntity warningInfoEntity = new WarningInfoEntity();
|
|
WarningInfoEntity warningInfoEntity = new WarningInfoEntity();
|
|
warningInfoEntity.setUploadTime(new Date());
|
|
warningInfoEntity.setUploadTime(new Date());
|
|
warningInfoEntity.setWarningType(3);
|
|
warningInfoEntity.setWarningType(3);
|
|
- warningInfoEntity.setType("本地数据的 " + indexParameter2Entity.getName() + " 参数小于阈值,请核查!");
|
|
|
|
|
|
+ String type = "本地数据的 " + indexParameter2Entity.getName() + " 参数小于阈值";
|
|
|
|
+ warningInfoEntity.setType(type);
|
|
|
|
+ warningInfoEntityRepo.updatePreviousShowStatusByType(type);
|
|
warningInfoEntityRepo.save(warningInfoEntity);
|
|
warningInfoEntityRepo.save(warningInfoEntity);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -75,7 +80,7 @@ public class WarningParameterTask {
|
|
|
|
|
|
List<WarningInfoEntity> list = new ArrayList<>();
|
|
List<WarningInfoEntity> list = new ArrayList<>();
|
|
for (IndexParameter2Entity indexParameter2Entity : collect) {
|
|
for (IndexParameter2Entity indexParameter2Entity : collect) {
|
|
- List<WarningInfoEntity> warningInfoEntityList = warningInfoEntityRepo.findDataTypeLikeLeNow("本地数据的 " + indexParameter2Entity.getName(),date);
|
|
|
|
|
|
+ List<WarningInfoEntity> warningInfoEntityList = warningInfoEntityRepo.findDataTypeLikeLeNow("本地数据的 " + indexParameter2Entity.getName(), date);
|
|
list.addAll(warningInfoEntityList);
|
|
list.addAll(warningInfoEntityList);
|
|
}
|
|
}
|
|
for (WarningInfoEntity warningInfoEntity : list) {
|
|
for (WarningInfoEntity warningInfoEntity : list) {
|
|
@@ -99,7 +104,9 @@ public class WarningParameterTask {
|
|
WarningInfoEntity warningInfoEntity = new WarningInfoEntity();
|
|
WarningInfoEntity warningInfoEntity = new WarningInfoEntity();
|
|
warningInfoEntity.setUploadTime(new Date());
|
|
warningInfoEntity.setUploadTime(new Date());
|
|
warningInfoEntity.setWarningType(3);
|
|
warningInfoEntity.setWarningType(3);
|
|
- warningInfoEntity.setType("ERP数据的 " + indexParameter2Entity.getName() + " 参数小于阈值,请核查!");
|
|
|
|
|
|
+ String type = "ERP数据的 " + indexParameter2Entity.getName() + " 参数小于阈值!";
|
|
|
|
+ warningInfoEntity.setType(type);
|
|
|
|
+ warningInfoEntityRepo.updatePreviousShowStatusByType(type);
|
|
warningInfoEntityRepo.save(warningInfoEntity);
|
|
warningInfoEntityRepo.save(warningInfoEntity);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -107,7 +114,7 @@ public class WarningParameterTask {
|
|
|
|
|
|
List<WarningInfoEntity> list = new ArrayList<>();
|
|
List<WarningInfoEntity> list = new ArrayList<>();
|
|
for (IndexParameterEntity indexParameterEntity : collect) {
|
|
for (IndexParameterEntity indexParameterEntity : collect) {
|
|
- List<WarningInfoEntity> warningInfoEntityList = warningInfoEntityRepo.findDataTypeLikeLeNow("ERP数据的 " + indexParameterEntity.getName(),date);
|
|
|
|
|
|
+ List<WarningInfoEntity> warningInfoEntityList = warningInfoEntityRepo.findDataTypeLikeLeNow("ERP数据的 " + indexParameterEntity.getName(), date);
|
|
list.addAll(warningInfoEntityList);
|
|
list.addAll(warningInfoEntityList);
|
|
}
|
|
}
|
|
for (WarningInfoEntity warningInfoEntity : list) {
|
|
for (WarningInfoEntity warningInfoEntity : list) {
|