|
@@ -101,11 +101,111 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
return page.setRecords(baseMapper.selectPage(page, rtuWarningInfoDTO));
|
|
return page.setRecords(baseMapper.selectPage(page, rtuWarningInfoDTO));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectClockPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectClockPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectOfflinePage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectOfflinePage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectHourMissOutPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectHourMissOutPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectRainHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectRainHourMissOutPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectRiverHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectRiverHourMissOutPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectMinUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectMinUpDelayPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectHourUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectHourUpDelayPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectRainHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectRainHourUpDelayPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectRiverHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectRiverHourUpDelayPage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<RtuWarningInfoVO> selectOutlierValuePage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return page.setRecords(baseMapper.selectOutlierValuePage(page, rtuWarningInfoDTO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Long warningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
public Long warningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
return baseMapper.warningRtuCount(rtuWarningInfoDTO);
|
|
return baseMapper.warningRtuCount(rtuWarningInfoDTO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningOfflineRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return baseMapper.warningOfflineRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningClockRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningClockRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return baseMapper.warningHourMissOutRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningRainHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningRainHourMissOutRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningRiverHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningRiverHourMissOutRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningMinUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return baseMapper.warningMinUpDelayRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningRainHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningRainHourUpDelayRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningRiverHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long warningOutlierValueRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
|
|
|
|
|
+ return this.baseMapper.warningOutlierValueRtuCount(rtuWarningInfoDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 时钟预警
|
|
* 时钟预警
|
|
|
*
|
|
*
|
|
@@ -281,7 +381,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
clockWarnRecovery(rtuInfoEntity, checkTm);
|
|
clockWarnRecovery(rtuInfoEntity, checkTm);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -291,7 +390,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkRtuRainUpHourDelayStatus(EtlRainDataEntity etlRainDataEntity) {
|
|
public boolean checkRtuRainUpHourDelayStatus(EtlRainDataEntity etlRainDataEntity) {
|
|
|
Date checkTm = new Date();
|
|
Date checkTm = new Date();
|
|
|
- //HashOperations<String,String,String> hashOperations= redisTemplate.opsForHash();
|
|
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int delayWarn = 0;
|
|
int delayWarn = 0;
|
|
@@ -337,14 +435,11 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
|
|
|
- entity.setWarningDesc("雨情整点上报延时,上报时间:" + Func.formatDateTime(fromDate) + "," + "测站采集时间:" + Func.formatDateTime(upTime) + ",上报延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟");
|
|
|
|
|
|
|
+ entity.setWarningDesc("雨情整点上报延时异常,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
@@ -353,8 +448,8 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
-
|
|
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("雨情整点上报延时恢复,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -371,7 +466,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkRtuRiverUpHourDelayStatus(EtlRiverDataEntity etlRiverDataEntity) {
|
|
public boolean checkRtuRiverUpHourDelayStatus(EtlRiverDataEntity etlRiverDataEntity) {
|
|
|
Date checkTm = new Date();
|
|
Date checkTm = new Date();
|
|
|
- //HashOperations<String,String,String> hashOperations= redisTemplate.opsForHash();
|
|
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int delayWarn = 0;
|
|
int delayWarn = 0;
|
|
@@ -417,14 +511,11 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
|
- entity.setWarningDesc("水位整点上报延时,上报时间:" + Func.formatDateTime(fromDate) + "," + "测站采集时间:" + Func.formatDateTime(upTime) + ",上报延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟");
|
|
|
|
|
|
|
+ entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
@@ -433,8 +524,8 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
-
|
|
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -451,7 +542,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkRtuRsvrUpHourDelayStatus(EtlRsvrDataEntity etlRsvrDataEntity) {
|
|
public boolean checkRtuRsvrUpHourDelayStatus(EtlRsvrDataEntity etlRsvrDataEntity) {
|
|
|
Date checkTm = new Date();
|
|
Date checkTm = new Date();
|
|
|
- //HashOperations<String,String,String> hashOperations= redisTemplate.opsForHash();
|
|
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int delayWarn = 0;
|
|
int delayWarn = 0;
|
|
@@ -497,13 +587,11 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
|
- entity.setWarningDesc("水位整点上报延时,上报时间:" + Func.formatDateTime(fromDate) + "," + "测站采集时间:" + Func.formatDateTime(upTime) + ",上报延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟");
|
|
|
|
|
|
|
+ entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
//没有检测到预警发生,进行预警恢复操作
|
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
@@ -512,8 +600,8 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
-
|
|
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnDelayDuration) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -553,22 +641,24 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
if (delayWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (delayWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
boolean isBeforeWarn = false;
|
|
boolean isBeforeWarn = false;
|
|
|
- Date upTime = Func.parseDate(beforeUpInfo.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- Date fromDate = Func.parseDate(beforeUpInfo.getString("from"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- if (upTime.before(fromDate)) {
|
|
|
|
|
|
|
+ Date firstUpTime = Func.parseDate(beforeUpInfo.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ Date firstFromTime = Func.parseDate(beforeUpInfo.getString("from"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ long firstDelayDuration = 0;
|
|
|
|
|
+ if (firstUpTime.before(firstFromTime)) {
|
|
|
//延时时长,秒
|
|
//延时时长,秒
|
|
|
- long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L;
|
|
|
|
|
- if (delayDuration > rainWarnDelayDuration * 60) {
|
|
|
|
|
|
|
+ firstDelayDuration = (firstFromTime.getTime() - firstUpTime.getTime()) / 1000L;
|
|
|
|
|
+ if (firstDelayDuration > rainWarnDelayDuration * 60) {
|
|
|
isBeforeWarn = true;
|
|
isBeforeWarn = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
boolean isNowWarn = false;
|
|
boolean isNowWarn = false;
|
|
|
- upTime = Func.parseDate(nowUpInfo.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- fromDate = Func.parseDate(nowUpInfo.getString("from"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- if (upTime.before(fromDate)) {
|
|
|
|
|
|
|
+ Date secondUpTime = Func.parseDate(nowUpInfo.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ Date secondFromTime = Func.parseDate(nowUpInfo.getString("from"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ long secondDelayDuration = 0;
|
|
|
|
|
+ if (secondUpTime.before(secondFromTime)) {
|
|
|
//延时时长,秒
|
|
//延时时长,秒
|
|
|
- long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L;
|
|
|
|
|
- if (delayDuration > rainWarnDelayDuration * 60) {
|
|
|
|
|
|
|
+ secondDelayDuration = (secondFromTime.getTime() - secondUpTime.getTime()) / 1000L;
|
|
|
|
|
+ if (secondDelayDuration > rainWarnDelayDuration * 60) {
|
|
|
isNowWarn = true;
|
|
isNowWarn = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -581,7 +671,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
|
|
warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
- //warningInfoEntity.setWarningDesc("雨情5分钟上报延时,上报时间:" + Func.formatDateTime(fromDate) + "," + "测站采集时间:" + Func.formatDateTime(upTime) + ",上报延时设定参数:" + Func.toStr(rainWarnDelayDuration) + "分钟");
|
|
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
|
this.updateById(warningInfoEntity);
|
|
this.updateById(warningInfoEntity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
@@ -591,7 +680,10 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
|
|
|
- entity.setWarningDesc("雨情5分钟上报延时,上报时间:" + Func.formatDateTime(fromDate) + "," + "测站采集时间:" + Func.formatDateTime(upTime) + ",上报延时设定参数:" + Func.toStr(rainWarnDelayDuration) + "分钟");
|
|
|
|
|
|
|
+ String desc = "雨情5分钟上报延时异常,延时设定参数:" + Func.toStr(rainWarnDelayDuration) + "分钟";
|
|
|
|
|
+ desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
|
|
|
|
|
+ desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
|
|
|
|
|
+ entity.setWarningDesc(desc);
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
@@ -605,6 +697,10 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ String desc = "雨情5分钟上报延时恢复,延时设定参数:" + Func.toStr(rainWarnDelayDuration) + "分钟";
|
|
|
|
|
+ desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
|
|
|
|
|
+ desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc(desc);
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -720,7 +816,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
|
- //warningInfoEntity.setWarningDesc("测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",测站最后上线时间:" + Func.formatDateTime(tm) + ",离线延时设定参数:" + Func.toStr(groundWarnOfflineDuration) + "小时");
|
|
|
|
|
this.updateById(warningInfoEntity);
|
|
this.updateById(warningInfoEntity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
} else {
|
|
} else {
|
|
@@ -729,7 +824,8 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
|
- entity.setWarningDesc("测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",测站最后上线时间:" + Func.formatDateTime(tm) + ",离线延时设定参数:" + Func.toStr(groundWarnOfflineDuration) + "小时");
|
|
|
|
|
|
|
+ entity.setWarningDesc("测站离线异常,判断时间:" + Func.formatDateTime(checkTm) + ",测站最后上线时间:" + Func.formatDateTime(tm) + ",离线时长设定参数:" + Func.toStr(rainWarnOfflineDuration) + "小时");
|
|
|
|
|
+ entity.setRtuLastTime(tm);
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
@@ -742,6 +838,27 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ String warningRecoveryDesc = "";
|
|
|
|
|
+ Date lastTime = warningInfoEntity.getRtuLastTime();
|
|
|
|
|
+ if (null != lastTime) {
|
|
|
|
|
+ String offlineDesc = "";
|
|
|
|
|
+ long offlineTime = (tm.getTime() - lastTime.getTime()) / 1000L / 60L;
|
|
|
|
|
+ if (offlineTime > 60L * 24L) {
|
|
|
|
|
+ offlineDesc = "测站离线时长" + Func.toStr(offlineTime / (60L * 24L)) + "天";
|
|
|
|
|
+ offlineTime = offlineTime - (60L * 24L);
|
|
|
|
|
+ if (offlineTime >= 60L) {
|
|
|
|
|
+ offlineDesc += Func.toStr(offlineTime / 60L) + "小时";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (offlineTime > 60L) {
|
|
|
|
|
+ offlineDesc = "测站离线时长" + Func.toStr(offlineTime / 60L) + "小时";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ offlineDesc = "测站离线时长" + Func.toStr(offlineTime) + "分";
|
|
|
|
|
+ }
|
|
|
|
|
+ warningRecoveryDesc = "测站离线异常恢复,判断时间:" + Func.formatDateTime(checkTm) + ",测站恢复上线时间:" + Func.formatDateTime(tm) + ",离线时长阀值:" + Func.toStr(rainWarnOfflineDuration) + "小时," + offlineDesc;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ warningRecoveryDesc = "测站离线异常恢复,判断时间:" + Func.formatDateTime(checkTm) + ",测站恢复上线时间:" + Func.formatDateTime(tm) + ",离线时长阀值:" + Func.toStr(rainWarnOfflineDuration) + "小时";
|
|
|
|
|
+ }
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc(warningRecoveryDesc);
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -768,7 +885,8 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
|
- entity.setWarningDesc("未检测到历史上报数据,测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",离线延时设定参数:" + Func.toStr(groundWarnOfflineDuration) + "小时");
|
|
|
|
|
|
|
+ entity.setWarningDesc("未检测到上报数据,测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",离线延时设定参数:" + Func.toStr(rainWarnOfflineDuration) + "小时");
|
|
|
|
|
+
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
@@ -791,7 +909,7 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
entity.setWarningHappenTime(checkTm);
|
|
entity.setWarningHappenTime(checkTm);
|
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
|
|
|
- entity.setWarningDesc("未检测到历史上报数据,测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",离线延时设定参数:" + Func.toStr(groundWarnOfflineDuration) + "小时");
|
|
|
|
|
|
|
+ entity.setWarningDesc("未检测到上报数据,测站离线异常" + "," + "判断时间:" + Func.formatDateTime(checkTm) + ",离线延时设定参数:" + Func.toStr(rainWarnOfflineDuration) + "小时");
|
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
}
|
|
}
|
|
@@ -803,7 +921,14 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkRtuRainMissOutStatus(RtuInfoEntity rtuInfoEntity) {
|
|
public boolean checkRtuRainMissOutStatus(RtuInfoEntity rtuInfoEntity) {
|
|
|
- Date checkTm = new Date();
|
|
|
|
|
|
|
+ //判断测站类型
|
|
|
|
|
+ boolean checkSiteKind = false;
|
|
|
|
|
+ if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
|
|
|
|
|
+ checkSiteKind = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!checkSiteKind) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int missOutWarn = 0;
|
|
int missOutWarn = 0;
|
|
@@ -828,7 +953,7 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
nowDate.set(Calendar.MINUTE, 0);
|
|
nowDate.set(Calendar.MINUTE, 0);
|
|
|
nowDate.set(Calendar.SECOND, 0);
|
|
nowDate.set(Calendar.SECOND, 0);
|
|
|
if (nowDate.after(checkDate)) {
|
|
if (nowDate.after(checkDate)) {
|
|
|
- checkTm = checkDate.getTime();
|
|
|
|
|
|
|
+ Date checkTm = checkDate.getTime();
|
|
|
//每天8点以后判断上一天的漏报情况
|
|
//每天8点以后判断上一天的漏报情况
|
|
|
String key = "etl.rain." + rtuInfoEntity.getRtuCode() + ".up.hour";
|
|
String key = "etl.rain." + rtuInfoEntity.getRtuCode() + ".up.hour";
|
|
|
ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
@@ -839,7 +964,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
JSONArray array = JSONArray.parseArray(value);
|
|
JSONArray array = JSONArray.parseArray(value);
|
|
|
checkDate.add(Calendar.DAY_OF_MONTH, -1);
|
|
checkDate.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
for (int i = 0; i < 24; i++) {
|
|
for (int i = 0; i < 24; i++) {
|
|
|
- checkDate.add(Calendar.HOUR_OF_DAY, i);
|
|
|
|
|
for (int j = 0; j < array.size(); j++) {
|
|
for (int j = 0; j < array.size(); j++) {
|
|
|
JSONObject object = array.getJSONObject(j);
|
|
JSONObject object = array.getJSONObject(j);
|
|
|
String tm1 = Func.formatDateTime(checkDate.getTime());
|
|
String tm1 = Func.formatDateTime(checkDate.getTime());
|
|
@@ -853,6 +977,7 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ checkDate.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
}
|
|
}
|
|
|
//漏报的报文数量
|
|
//漏报的报文数量
|
|
|
int missCount = 24 - upCount;
|
|
int missCount = 24 - upCount;
|
|
@@ -866,11 +991,11 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
|
- String warnHappenTime = Func.formatDateTime(warningInfoEntity.getWarningHappenTime());
|
|
|
|
|
- String warnHappenTime2 =Func.formatDateTime(checkTm);
|
|
|
|
|
- if (!warnHappenTime.equals(warnHappenTime2)){
|
|
|
|
|
- warningInfoEntity.setWarningDesc("测站雨量漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// String warnHappenTime = Func.formatDateTime(warningInfoEntity.getWarningHappenTime());
|
|
|
|
|
+// String warnHappenTime2 = Func.formatDateTime(checkTm);
|
|
|
|
|
+// if (!warnHappenTime.equals(warnHappenTime2)) {
|
|
|
|
|
+// warningInfoEntity.setWarningDesc("测站雨量漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+// }
|
|
|
this.updateById(warningInfoEntity);
|
|
this.updateById(warningInfoEntity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
} else {
|
|
} else {
|
|
@@ -893,6 +1018,7 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
//恢复
|
|
//恢复
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("测站雨量漏报恢复,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
@@ -908,8 +1034,15 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean checkRtuRiverMissOutStatus(EtlRiverDataEntity etlRiverDataEntity) {
|
|
|
|
|
- Date checkTm = new Date();
|
|
|
|
|
|
|
+ public boolean checkRtuRiverMissOutStatus(RtuInfoEntity rtuInfoEntity) {
|
|
|
|
|
+ //判断测站类型
|
|
|
|
|
+ boolean checkSiteKind = false;
|
|
|
|
|
+ if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
|
|
|
|
|
+ checkSiteKind = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!checkSiteKind) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int missOutWarn = 0;
|
|
int missOutWarn = 0;
|
|
@@ -926,129 +1059,88 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
if (missOutWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (missOutWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
- String key = "etl.river." + etlRiverDataEntity.getRtuCode() + ".up.hour";
|
|
|
|
|
- ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
|
|
|
- if (redisTemplate.hasKey(key)) {
|
|
|
|
|
- String value = ops.get(key);
|
|
|
|
|
- JSONArray array = JSONArray.parseArray(value);
|
|
|
|
|
- if (array.size() > 0) {
|
|
|
|
|
- log.info(" up time size is {}", array.size());
|
|
|
|
|
- JSONObject lastobject = array.getJSONObject(array.size() - 1);
|
|
|
|
|
- Date hourTime = Func.parseDate(lastobject.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- Calendar lastDate = Calendar.getInstance();
|
|
|
|
|
- lastDate.setTime(hourTime);
|
|
|
|
|
- lastDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- lastDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- Calendar nowDate = Calendar.getInstance();
|
|
|
|
|
- nowDate.setTime(etlRiverDataEntity.getTm());
|
|
|
|
|
- nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- if (lastDate.get(Calendar.YEAR) == nowDate.get(Calendar.YEAR) && lastDate.get(Calendar.MONTH) == nowDate.get(Calendar.MONTH) && lastDate.get(Calendar.DAY_OF_MONTH) == nowDate.get(Calendar.DAY_OF_MONTH) && lastDate.get(Calendar.HOUR_OF_DAY) == nowDate.get(Calendar.HOUR_OF_DAY)) {
|
|
|
|
|
- log.info(" up time is no process!!");
|
|
|
|
|
- } else {
|
|
|
|
|
- if (array.size() >= 24) {
|
|
|
|
|
- log.info(" up time remove!!");
|
|
|
|
|
- array.remove(0);
|
|
|
|
|
- }
|
|
|
|
|
- log.info("add up time !");
|
|
|
|
|
- //添加上报时间
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRiverDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRiverDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- }
|
|
|
|
|
- if (array.size() >= 24) {
|
|
|
|
|
- log.info(" up time is 24");
|
|
|
|
|
- int upCount = 0;
|
|
|
|
|
- String upTimeMessage = "";
|
|
|
|
|
- Date lastUpTime = etlRiverDataEntity.getTm();
|
|
|
|
|
- nowDate = Calendar.getInstance();
|
|
|
|
|
- nowDate.setTime(lastUpTime);
|
|
|
|
|
- nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- for (int i = 0; i < 24; i++) {
|
|
|
|
|
- for (int j = 1; j <= 24; j++) {
|
|
|
|
|
- JSONObject object = array.getJSONObject(24 - j);
|
|
|
|
|
- hourTime = Func.parseDate(object.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- Calendar beforeDate = Calendar.getInstance();
|
|
|
|
|
- beforeDate.setTime(hourTime);
|
|
|
|
|
- beforeDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- beforeDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- if (beforeDate.get(Calendar.YEAR) == nowDate.get(Calendar.YEAR) && beforeDate.get(Calendar.MONTH) == nowDate.get(Calendar.MONTH) && beforeDate.get(Calendar.DAY_OF_MONTH) == nowDate.get(Calendar.DAY_OF_MONTH) && beforeDate.get(Calendar.HOUR_OF_DAY) == nowDate.get(Calendar.HOUR_OF_DAY)) {
|
|
|
|
|
- log.info(" before time {} now time {}", beforeDate.getTime(), nowDate.getTime());
|
|
|
|
|
- upCount++;
|
|
|
|
|
- if (upTimeMessage.length() > 0) {
|
|
|
|
|
- upTimeMessage += ",";
|
|
|
|
|
- }
|
|
|
|
|
- upTimeMessage += Func.formatDateTime(beforeDate.getTime());
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ Calendar checkDate = Calendar.getInstance();
|
|
|
|
|
+ checkDate.set(Calendar.HOUR_OF_DAY, 8);
|
|
|
|
|
+ checkDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ checkDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ Calendar nowDate = Calendar.getInstance();
|
|
|
|
|
+ nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ if (nowDate.after(checkDate)) {
|
|
|
|
|
+ Date checkTm = checkDate.getTime();
|
|
|
|
|
+ //每天8点以后判断上一天的漏报情况
|
|
|
|
|
+ String key = "etl.river." + rtuInfoEntity.getRtuCode() + ".up.hour";
|
|
|
|
|
+ ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
|
|
|
+ if (redisTemplate.hasKey(key)) {
|
|
|
|
|
+ int upCount = 0;
|
|
|
|
|
+ String upTimeMessage = "";
|
|
|
|
|
+ String value = ops.get(key);
|
|
|
|
|
+ JSONArray array = JSONArray.parseArray(value);
|
|
|
|
|
+ checkDate.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
|
|
|
+ for (int j = 0; j < array.size(); j++) {
|
|
|
|
|
+ JSONObject object = array.getJSONObject(j);
|
|
|
|
|
+ String tm1 = Func.formatDateTime(checkDate.getTime());
|
|
|
|
|
+ String tm2 = object.getString("tm");
|
|
|
|
|
+ if (tm1.equals(tm2)) {
|
|
|
|
|
+ upCount++;
|
|
|
|
|
+ if (upTimeMessage.length() > 0) {
|
|
|
|
|
+ upTimeMessage += ",";
|
|
|
}
|
|
}
|
|
|
|
|
+ upTimeMessage += tm1;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- nowDate.add(Calendar.HOUR_OF_DAY, -1);
|
|
|
|
|
}
|
|
}
|
|
|
- log.info(" find size is {}", upCount);
|
|
|
|
|
- //漏报的报文数量
|
|
|
|
|
- int missCount = 24 - upCount;
|
|
|
|
|
- if (missCount >= missout) {
|
|
|
|
|
- //触发预警
|
|
|
|
|
- LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
- if (null != warningInfoEntity) {
|
|
|
|
|
- warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
- //warningInfoEntity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
- this.updateById(warningInfoEntity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
|
|
- } else {
|
|
|
|
|
- RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
|
|
|
|
|
- entity.setRtuCode(etlRiverDataEntity.getRtuCode());
|
|
|
|
|
- entity.setWarningHappenTime(checkTm);
|
|
|
|
|
- entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- entity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
- this.save(entity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ checkDate.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ //漏报的报文数量
|
|
|
|
|
+ int missCount = 24 - upCount;
|
|
|
|
|
+ if (missCount >= missout) {
|
|
|
|
|
+ //触发预警
|
|
|
|
|
+ LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
+ if (null != warningInfoEntity) {
|
|
|
|
|
+ warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
+// String warnHappenTime = Func.formatDateTime(warningInfoEntity.getWarningHappenTime());
|
|
|
|
|
+// String warnHappenTime2 = Func.formatDateTime(checkTm);
|
|
|
|
|
+// if (!warnHappenTime.equals(warnHappenTime2)) {
|
|
|
|
|
+// warningInfoEntity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+// }
|
|
|
|
|
+ this.updateById(warningInfoEntity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
|
|
|
|
|
+ entity.setRtuCode(rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ entity.setWarningHappenTime(checkTm);
|
|
|
|
|
+ entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ entity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+ this.save(entity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //恢复
|
|
|
|
|
+ LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
+ if (null != warningInfoEntity) {
|
|
|
//恢复
|
|
//恢复
|
|
|
- LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
- if (null != warningInfoEntity) {
|
|
|
|
|
- //恢复
|
|
|
|
|
- warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
|
|
- warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
|
|
- warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
- this.updateById(warningInfoEntity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
|
|
+ warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
|
|
+ warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
+ this.updateById(warningInfoEntity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
- //更新缓存
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
- } else {
|
|
|
|
|
- log.info(" up time size is 0");
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRiverDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRiverDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- log.info("no up time");
|
|
|
|
|
- JSONArray array = new JSONArray();
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRiverDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRiverDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1056,8 +1148,15 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean checkRtuRsvrMissOutStatus(EtlRsvrDataEntity etlRsvrDataEntity) {
|
|
|
|
|
- Date checkTm = new Date();
|
|
|
|
|
|
|
+ public boolean checkRtuRsvrMissOutStatus(RtuInfoEntity rtuInfoEntity) {
|
|
|
|
|
+ //判断测站类型
|
|
|
|
|
+ boolean checkSiteKind = false;
|
|
|
|
|
+ if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
|
|
|
|
|
+ checkSiteKind = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!checkSiteKind) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
//测站检测参数
|
|
//测站检测参数
|
|
|
int warnActive = 0;
|
|
int warnActive = 0;
|
|
|
int missOutWarn = 0;
|
|
int missOutWarn = 0;
|
|
@@ -1074,124 +1173,88 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (warnActive == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
if (missOutWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
if (missOutWarn == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
|
|
|
- String key = "etl.rsvr." + etlRsvrDataEntity.getRtuCode() + ".up.hour";
|
|
|
|
|
- ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
|
|
|
- if (redisTemplate.hasKey(key)) {
|
|
|
|
|
- String value = ops.get(key);
|
|
|
|
|
- JSONArray array = JSONArray.parseArray(value);
|
|
|
|
|
- if (array.size() > 0) {
|
|
|
|
|
- JSONObject lastobject = array.getJSONObject(array.size() - 1);
|
|
|
|
|
- Date hourTime = Func.parseDate(lastobject.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- Calendar lastDate = Calendar.getInstance();
|
|
|
|
|
- lastDate.setTime(hourTime);
|
|
|
|
|
- lastDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- lastDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- Calendar nowDate = Calendar.getInstance();
|
|
|
|
|
- nowDate.setTime(etlRsvrDataEntity.getTm());
|
|
|
|
|
- nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- // if (!lastDate.equals(nowDate)) {
|
|
|
|
|
- if (lastDate.get(Calendar.YEAR) == nowDate.get(Calendar.YEAR) && lastDate.get(Calendar.MONTH) == nowDate.get(Calendar.MONTH) && lastDate.get(Calendar.DAY_OF_MONTH) == nowDate.get(Calendar.DAY_OF_MONTH) && lastDate.get(Calendar.HOUR_OF_DAY) == nowDate.get(Calendar.HOUR_OF_DAY)) {
|
|
|
|
|
- log.info(" up time is no process!!");
|
|
|
|
|
- } else {
|
|
|
|
|
- if (array.size() >= 24) {
|
|
|
|
|
- array.remove(0);
|
|
|
|
|
- }
|
|
|
|
|
- //添加上报时间
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRsvrDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRsvrDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- }
|
|
|
|
|
- if (array.size() >= 24) {
|
|
|
|
|
- int upCount = 0;
|
|
|
|
|
- String upTimeMessage = "";
|
|
|
|
|
- Date lastUpTime = etlRsvrDataEntity.getTm();
|
|
|
|
|
- nowDate = Calendar.getInstance();
|
|
|
|
|
- nowDate.setTime(lastUpTime);
|
|
|
|
|
- nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- for (int i = 0; i < 24; i++) {
|
|
|
|
|
- for (int j = 1; j <= 24; j++) {
|
|
|
|
|
- JSONObject object = array.getJSONObject(24 - j);
|
|
|
|
|
- hourTime = Func.parseDate(object.getString("tm"), "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- Calendar beforeDate = Calendar.getInstance();
|
|
|
|
|
- beforeDate.setTime(hourTime);
|
|
|
|
|
- beforeDate.set(Calendar.SECOND, 0);
|
|
|
|
|
- beforeDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
- if (beforeDate.get(Calendar.YEAR) == nowDate.get(Calendar.YEAR) && beforeDate.get(Calendar.MONTH) == nowDate.get(Calendar.MONTH) && beforeDate.get(Calendar.DAY_OF_MONTH) == nowDate.get(Calendar.DAY_OF_MONTH) && beforeDate.get(Calendar.HOUR_OF_DAY) == nowDate.get(Calendar.HOUR_OF_DAY)) {
|
|
|
|
|
- log.info(" before time {} now time {}", beforeDate.getTime(), nowDate.getTime());
|
|
|
|
|
- upCount++;
|
|
|
|
|
- if (upTimeMessage.length() > 0) {
|
|
|
|
|
- upTimeMessage += ",";
|
|
|
|
|
- }
|
|
|
|
|
- upTimeMessage += Func.formatDateTime(beforeDate.getTime());
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ Calendar checkDate = Calendar.getInstance();
|
|
|
|
|
+ checkDate.set(Calendar.HOUR_OF_DAY, 8);
|
|
|
|
|
+ checkDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ checkDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ Calendar nowDate = Calendar.getInstance();
|
|
|
|
|
+ nowDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ nowDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ if (nowDate.after(checkDate)) {
|
|
|
|
|
+ Date checkTm = checkDate.getTime();
|
|
|
|
|
+ //每天8点以后判断上一天的漏报情况
|
|
|
|
|
+ String key = "etl.rsvr." + rtuInfoEntity.getRtuCode() + ".up.hour";
|
|
|
|
|
+ ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
|
|
|
+ if (redisTemplate.hasKey(key)) {
|
|
|
|
|
+ int upCount = 0;
|
|
|
|
|
+ String upTimeMessage = "";
|
|
|
|
|
+ String value = ops.get(key);
|
|
|
|
|
+ JSONArray array = JSONArray.parseArray(value);
|
|
|
|
|
+ checkDate.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
|
|
|
+ for (int j = 0; j < array.size(); j++) {
|
|
|
|
|
+ JSONObject object = array.getJSONObject(j);
|
|
|
|
|
+ String tm1 = Func.formatDateTime(checkDate.getTime());
|
|
|
|
|
+ String tm2 = object.getString("tm");
|
|
|
|
|
+ if (tm1.equals(tm2)) {
|
|
|
|
|
+ upCount++;
|
|
|
|
|
+ if (upTimeMessage.length() > 0) {
|
|
|
|
|
+ upTimeMessage += ",";
|
|
|
}
|
|
}
|
|
|
|
|
+ upTimeMessage += tm1;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- nowDate.add(Calendar.HOUR_OF_DAY, -1);
|
|
|
|
|
}
|
|
}
|
|
|
- log.info(" find size is {}", upCount);
|
|
|
|
|
- //漏报的报文数量
|
|
|
|
|
- int missCount = 24 - upCount;
|
|
|
|
|
- if (missCount >= missout) {
|
|
|
|
|
- //触发预警
|
|
|
|
|
- LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
- if (null != warningInfoEntity) {
|
|
|
|
|
- warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
- //warningInfoEntity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
- this.updateById(warningInfoEntity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
|
|
- } else {
|
|
|
|
|
- RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
|
|
|
|
|
- entity.setRtuCode(etlRsvrDataEntity.getRtuCode());
|
|
|
|
|
- entity.setWarningHappenTime(checkTm);
|
|
|
|
|
- entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- entity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
- this.save(entity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ checkDate.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ //漏报的报文数量
|
|
|
|
|
+ int missCount = 24 - upCount;
|
|
|
|
|
+ if (missCount >= missout) {
|
|
|
|
|
+ //触发预警
|
|
|
|
|
+ LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
+ if (null != warningInfoEntity) {
|
|
|
|
|
+ warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
+// String warnHappenTime = Func.formatDateTime(warningInfoEntity.getWarningHappenTime());
|
|
|
|
|
+// String warnHappenTime2 = Func.formatDateTime(checkTm);
|
|
|
|
|
+// if (!warnHappenTime.equals(warnHappenTime2)) {
|
|
|
|
|
+// warningInfoEntity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+// }
|
|
|
|
|
+ this.updateById(warningInfoEntity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
|
|
|
|
|
+ entity.setRtuCode(rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ entity.setWarningHappenTime(checkTm);
|
|
|
|
|
+ entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ entity.setWarningDesc("测站水位漏报异常,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+ this.save(entity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //恢复
|
|
|
|
|
+ LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
+ warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
+ RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
+ if (null != warningInfoEntity) {
|
|
|
//恢复
|
|
//恢复
|
|
|
- LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
|
|
|
|
|
- warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
|
|
|
|
|
- RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
|
|
- if (null != warningInfoEntity) {
|
|
|
|
|
- //恢复
|
|
|
|
|
- warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
|
|
- warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
|
|
- warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
- this.updateById(warningInfoEntity);
|
|
|
|
|
- kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,判断时间:" + Func.formatDateTime(checkTm) + ",24小时采集时间:" + upTimeMessage + ",漏报数量:" + missCount);
|
|
|
|
|
+ warningInfoEntity.setWarningRecoveryTime(checkTm);
|
|
|
|
|
+ warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
|
|
|
|
|
+ warningInfoEntity.setUpdateTime(checkTm);
|
|
|
|
|
+ this.updateById(warningInfoEntity);
|
|
|
|
|
+ kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
- //更新缓存
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
- } else {
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRsvrDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRsvrDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- JSONArray array = new JSONArray();
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
- object.put("tm", Func.formatDateTime(etlRsvrDataEntity.getTm()));
|
|
|
|
|
- object.put("from", Func.formatDateTime(etlRsvrDataEntity.getFromDate()));
|
|
|
|
|
- array.add(object);
|
|
|
|
|
- ops.set(key, array.toJSONString());
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1213,9 +1276,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
calendar.setTime(surfTm);
|
|
calendar.setTime(surfTm);
|
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
calendar.set(Calendar.SECOND, 0);
|
|
|
-
|
|
|
|
|
- //surfTm = calendar.getTime();
|
|
|
|
|
-
|
|
|
|
|
ListOperations<String, String> listOps = redisTemplate.opsForList();
|
|
ListOperations<String, String> listOps = redisTemplate.opsForList();
|
|
|
String hourCacheKey = "etl.rain." + rtuCode + ".hour.cache";
|
|
String hourCacheKey = "etl.rain." + rtuCode + ".hour.cache";
|
|
|
if (!redisTemplate.hasKey(hourCacheKey)) {
|
|
if (!redisTemplate.hasKey(hourCacheKey)) {
|
|
@@ -1229,25 +1289,19 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
calendar2.setTime(etlRainDataEntity.getTm());
|
|
calendar2.setTime(etlRainDataEntity.getTm());
|
|
|
calendar2.set(Calendar.MINUTE, 0);
|
|
calendar2.set(Calendar.MINUTE, 0);
|
|
|
calendar2.set(Calendar.SECOND, 0);
|
|
calendar2.set(Calendar.SECOND, 0);
|
|
|
-
|
|
|
|
|
if (calendar.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY) && calendar.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE) && calendar.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND)) {
|
|
if (calendar.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY) && calendar.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE) && calendar.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND)) {
|
|
|
-
|
|
|
|
|
String value1 = ops.get(surfkey, "lefttop.value");
|
|
String value1 = ops.get(surfkey, "lefttop.value");
|
|
|
// String ltLon = ops.get(key,"lefttop.lon");
|
|
// String ltLon = ops.get(key,"lefttop.lon");
|
|
|
// String ltLat = ops.get(key,"lefttop.lat");
|
|
// String ltLat = ops.get(key,"lefttop.lat");
|
|
|
-
|
|
|
|
|
String value2 = ops.get(surfkey, "leftbottom.value");
|
|
String value2 = ops.get(surfkey, "leftbottom.value");
|
|
|
// String lbLon = ops.get(key,"leftbottom.lon");
|
|
// String lbLon = ops.get(key,"leftbottom.lon");
|
|
|
// String lbLat = ops.get(key,"leftbottom.lat");
|
|
// String lbLat = ops.get(key,"leftbottom.lat");
|
|
|
-
|
|
|
|
|
String value3 = ops.get(surfkey, "righttop.value");
|
|
String value3 = ops.get(surfkey, "righttop.value");
|
|
|
// String rtLon = ops.get(key,"righttop.lon");
|
|
// String rtLon = ops.get(key,"righttop.lon");
|
|
|
// String rtLat = ops.get(key,"righttop.lat");
|
|
// String rtLat = ops.get(key,"righttop.lat");
|
|
|
-
|
|
|
|
|
String value4 = ops.get(surfkey, "rightbottom.value");
|
|
String value4 = ops.get(surfkey, "rightbottom.value");
|
|
|
// String rbLon = ops.get(key,"rightbottom.lon");
|
|
// String rbLon = ops.get(key,"rightbottom.lon");
|
|
|
// String rbLat = ops.get(key,"rightbottom.lat");
|
|
// String rbLat = ops.get(key,"rightbottom.lat");
|
|
|
-
|
|
|
|
|
if (null != value1 && null != value2 && null != value3 && null != value4) {
|
|
if (null != value1 && null != value2 && null != value3 && null != value4) {
|
|
|
float count = Func.toFloat(value1) + Func.toFloat(value2) + Func.toFloat(value3) + Func.toFloat(value4);
|
|
float count = Func.toFloat(value1) + Func.toFloat(value2) + Func.toFloat(value3) + Func.toFloat(value4);
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
@@ -1259,7 +1313,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
// log.info("网格右上角 值 {} 纬度 {} 经度 {} ", value3, rtLat, rtLon);
|
|
// log.info("网格右上角 值 {} 纬度 {} 经度 {} ", value3, rtLat, rtLon);
|
|
|
// log.info("网格右下角 值 {} 纬度 {} 经度 {} ", value4, rbLat, rbLon);
|
|
// log.info("网格右下角 值 {} 纬度 {} 经度 {} ", value4, rbLat, rbLon);
|
|
|
// log.info("网格内降雨平均值 {}", count);
|
|
// log.info("网格内降雨平均值 {}", count);
|
|
|
-
|
|
|
|
|
Double drp = etlRainDataEntity.getDrp();
|
|
Double drp = etlRainDataEntity.getDrp();
|
|
|
if (drp != null) {
|
|
if (drp != null) {
|
|
|
double baseValue = drp.doubleValue() - count;
|
|
double baseValue = drp.doubleValue() - count;
|
|
@@ -1273,11 +1326,6 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
|
|
|
if (null != warningInfoEntity) {
|
|
if (null != warningInfoEntity) {
|
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
warningInfoEntity.setUpdateTime(checkTm);
|
|
|
-// String desc="测站采集雨量大于面雨量20%,疑似异常值,";
|
|
|
|
|
-// desc += "雨量采集时间:"+Func.formatDateTime(etlRainDataEntity.getTm());
|
|
|
|
|
-// desc += ",时段降雨:"+Func.toStr(etlRainDataEntity.getDrp());
|
|
|
|
|
-// desc += ",平均面雨量:"+Func.toStr(count);
|
|
|
|
|
-// warningInfoEntity.setWarningDesc(desc);
|
|
|
|
|
this.updateById(warningInfoEntity);
|
|
this.updateById(warningInfoEntity);
|
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
|
|
|
} else {
|
|
} else {
|
|
@@ -1297,15 +1345,12 @@ public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, Rtu
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
log.info("no surf info");
|
|
log.info("no surf info");
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|