|
@@ -31,13 +31,19 @@ public class MonitorServiceImpl implements MonitorService {
|
|
LocalTime endTime = LocalTime.of(23, 0);
|
|
LocalTime endTime = LocalTime.of(23, 0);
|
|
boolean isWarnTime = !currentTime.isBefore(startTime) && !currentTime.isAfter(endTime);
|
|
boolean isWarnTime = !currentTime.isBefore(startTime) && !currentTime.isAfter(endTime);
|
|
String serviceStatus = stringRedisTemplate.boundValueOps(CommonConstant.SERVICE_STATUS).get();
|
|
String serviceStatus = stringRedisTemplate.boundValueOps(CommonConstant.SERVICE_STATUS).get();
|
|
|
|
+ if (null == serviceStatus) {
|
|
|
|
+ stringRedisTemplate.boundValueOps(CommonConstant.SERVICE_STATUS).set(CommonConstant.SERVICE_AVAILABLE);
|
|
|
|
+ serviceStatus = CommonConstant.SERVICE_AVAILABLE;
|
|
|
|
+ }
|
|
|
|
|
|
// 业务可用状态,并且时间在8-23点之间,做业务异常判断
|
|
// 业务可用状态,并且时间在8-23点之间,做业务异常判断
|
|
if (CommonConstant.SERVICE_AVAILABLE.equals(serviceStatus) && isWarnTime) {
|
|
if (CommonConstant.SERVICE_AVAILABLE.equals(serviceStatus) && isWarnTime) {
|
|
|
|
+ log.info("业务当前状态为:可用");
|
|
warn();
|
|
warn();
|
|
}
|
|
}
|
|
// 业务不可用状态,做业务恢复判断
|
|
// 业务不可用状态,做业务恢复判断
|
|
if (CommonConstant.SERVICE_UN_AVAILABLE.equals(serviceStatus)) {
|
|
if (CommonConstant.SERVICE_UN_AVAILABLE.equals(serviceStatus)) {
|
|
|
|
+ log.info("业务当前状态为:不可用");
|
|
recover();
|
|
recover();
|
|
}
|
|
}
|
|
|
|
|