|
|
|
@ -83,6 +83,8 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
private static final String STATION_ON_LINE_KEY = "iot:real:data:"; |
|
|
|
|
|
|
|
|
|
private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 2L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); |
|
|
|
|
|
|
|
|
|
private static boolean isSendMail = true; |
|
|
|
@ -247,6 +249,37 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 站点在线状态刷新 |
|
|
|
|
* @param param |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void loadStationOnLine(String param) { |
|
|
|
|
// 查询接入站点
|
|
|
|
|
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.eq(StationEntity::getDataOrigin,0) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
stations.forEach(station->{ |
|
|
|
|
// 在线
|
|
|
|
|
if(redisTemplate.hasKey(STATION_ON_LINE_KEY + station.getCode()) && station.getOnLine() == 1){ |
|
|
|
|
stationService.update(Wrappers.<StationEntity>lambdaUpdate() |
|
|
|
|
.set(StationEntity::getOnLine,0) |
|
|
|
|
.eq(StationEntity::getId,station.getId()) |
|
|
|
|
); |
|
|
|
|
// 离线
|
|
|
|
|
}else if(!redisTemplate.hasKey(STATION_ON_LINE_KEY + station.getCode()) && station.getOnLine() == 0){ |
|
|
|
|
stationService.update(Wrappers.<StationEntity>lambdaUpdate() |
|
|
|
|
.set(StationEntity::getOnLine,1) |
|
|
|
|
.eq(StationEntity::getId,station.getId()) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 计算切分次数 |
|
|
|
|
*/ |
|
|
|
|
private static Integer countStep(Integer size) { |
|
|
|
|