Commit e46ea76c authored by wujiang's avatar wujiang

修改预警生成

parent aebda8e7
......@@ -77,7 +77,6 @@ public class KafkaConsumerService {
// 相关性
@Value("${base.url.XGX:http://10.20.1.29:8052/intelligent-analysis/correlation}")
private String baseUrlXGX;
// 工况划分
@Value("${base.url.GKHF:http://10.20.1.29:8052/intelligent-analysis/working-condition-division}")
private String baseUrlGKHF;
......
......@@ -2115,8 +2115,6 @@ public class CommonServiceImpl {
"------------------------------------------调用风机健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------开始计算预警----------------------------------------");
// healthStatusIndicatorService.healthWarningMinute(calendar, time);
// ++++++++++
healthStatusIndicatorService.healthWarningMinute(time);
} catch (Exception e) {
......
......@@ -713,11 +713,10 @@ public class HealthStatusIndicatorServiceImpl {
/***
* 每五小时获取一次最大粒度内的指数异常数据
* 判断五小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
*
* TdengineTimeServiceImpl计算完调用
*/
@Scheduled(cron = "0 0 0/1 * * ?")
// @Scheduled(cron = "0 0/5 * * * ?")
//@Scheduled(cron = "0 0 0/1 * * ?")
@Async("async")
public void healthWarningHourGF() {
if (!openHealth) {
......@@ -1093,10 +1092,10 @@ public class HealthStatusIndicatorServiceImpl {
/***
* 每三天取一次最大粒度内的指数异常数据
* 判断三天内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
*
* TdengineTimeServiceImpl计算完调用
*/
@Scheduled(cron = "0 0 0 0/1 * ? ")
//@Scheduled(cron = "0 0 0 0/1 * ? ")
@Async("async")
public void healthWarningDayGF() {
if (!openHealth) {
......@@ -1475,7 +1474,6 @@ public class HealthStatusIndicatorServiceImpl {
// @Scheduled(cron = "0 0 */1 * * ?")
@Async("async")
//@PostConstruct
public void healthWarningMinute(Date time) {
if (!openHealth) {
return;
......@@ -1483,9 +1481,8 @@ public class HealthStatusIndicatorServiceImpl {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date time=null;
// try {
// time = simpleDateFormat.parse("2024-03-14 13:50:00");
// time = simpleDateFormat.parse("2024-06-04 17:00:00");
// } catch (ParseException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// Calendar calendar = Calendar.getInstance();
......@@ -1887,16 +1884,25 @@ public class HealthStatusIndicatorServiceImpl {
/***
* 每五小时获取一次最大粒度内的指数异常数据
* 判断五小时内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
*
* TdengineTimeServiceImpl计算完调用
*/
@Scheduled(cron = "0 0 0/1 * * ?")
//@Scheduled(cron = "0 0 0/1 * * ?")
@Async("async")
@PostConstruct
public void healthWarningHour() {
if (!openHealth) {
return;
}
Date time = new Date();
// if (!openHealth) {
// return;
// }
// Date time = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date time=null;
try {
time = simpleDateFormat.parse("2024-06-04 17:00:00");
} catch (ParseException e1) {
e1.printStackTrace();
}
String format = DateUtil.format(time, "yyyy-MM-dd HH:00:00");
// Date date = DateUtils.dateAddHours(time, -13);
// Calendar calendar = Calendar.getInstance();
......@@ -1937,6 +1943,12 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<FanHealthIndexHour>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) {
//桨叶目标位置B
if(!"22046".equals(address))
{
continue;
}
List<FanHealthIndexHour> idxBizFanHealthIndices = healthDataMaps.get(address);
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRules.stream().filter(t -> t.getAnalysisPointId().equals(idxBizFanHealthIndices.get(0).getAnalysisObjSeq())).collect(Collectors.toList());
......@@ -2070,9 +2082,10 @@ public class HealthStatusIndicatorServiceImpl {
// tdengine插入
fanWaringRecordMapper.saveBatchWarningRecords(tdFanWarningRecordList);
// 触发风险模型生成预警处置模块的预警记录
fetchDataFan(tdFanWarningRecordList, stationMap);
}
// 触发风险模型生成预警处置模块的预警记录
fetchDataFan(tdFanWarningRecordList, stationMap);
}
// @Scheduled(cron = "0 0 0/1 * * ?")
......@@ -2270,10 +2283,10 @@ public class HealthStatusIndicatorServiceImpl {
/***
* 每三天取一次最大粒度内的指数异常数据
* 判断三天内数据是否符合预警规则 符合则报警并在redis中缓存 同一级别的预警记录下次不生成
*
* TdengineTimeServiceImpl计算完调用
*/
@Scheduled(cron = "0 0 0 0/1 * ? ")
//@Scheduled(cron = "0 0 0 0/1 * ? ")
@Async("async")
public void healthWarningDay() {
if (!openHealth) {
......
......@@ -50,6 +50,9 @@ public class TdengineTimeServiceImpl {
@Value("${openHealth:true}")
Boolean openHealth;
@Autowired
private HealthStatusIndicatorServiceImpl healthStatusIndicatorServiceImpl;
/**
* 风电 - 按时刻生成子系统、设备、场站、区域 数据
......@@ -118,6 +121,9 @@ public class TdengineTimeServiceImpl {
List<IdxBizFanHealthLevel> levelListQg = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQg = fanHealthIndexMapper.getInfoListByGroupByQgFan(startTime, "fan_health_index_moment", "片区");
saveBatchFan(fanHealthIndicesQg, "fan_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), levelListQg);
//预警生成
healthStatusIndicatorServiceImpl.healthWarningHour();
}
/**
......@@ -157,6 +163,9 @@ public class TdengineTimeServiceImpl {
List<IdxBizFanHealthLevel> levelListQg = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQg = fanHealthIndexMapper.getInfoListByGroupByQgFan(startTime, "fan_health_index_hour", "片区");
saveBatchFan(fanHealthIndicesQg, "fan_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), levelListQg);
//预警生成
healthStatusIndicatorServiceImpl.healthWarningDay();
}
......@@ -224,6 +233,8 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_moment", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListQg);
}
/**
......@@ -262,6 +273,9 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_moment", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), levelListQg);
//预警生成
healthStatusIndicatorServiceImpl.healthWarningHourGF();
}
/**
......@@ -300,6 +314,9 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_hour", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), levelListQg);
//预警生成
healthStatusIndicatorServiceImpl.healthWarningDayGF();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment