1. 恢复状态查询和流量查询的频率
This commit is contained in:
parent
1a7634b9a6
commit
d873278da9
@ -1,6 +1,7 @@
|
|||||||
package com.imdroid.sideslope.task;
|
package com.imdroid.sideslope.task;
|
||||||
|
|
||||||
import com.alibaba.excel.util.StringUtils;
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import com.imdroid.common.util.ThreadManager;
|
||||||
import com.imdroid.secapi.dto.*;
|
import com.imdroid.secapi.dto.*;
|
||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
@ -47,40 +48,42 @@ public class SimStatusChecker {
|
|||||||
@Resource(name = "local")
|
@Resource(name = "local")
|
||||||
private DeviceService deviceService;
|
private DeviceService deviceService;
|
||||||
|
|
||||||
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
|
|
||||||
@Autowired
|
|
||||||
private SimCardQueryServiceImpl simCardQueryServiceImpl;
|
private SimCardQueryServiceImpl simCardQueryServiceImpl;
|
||||||
|
|
||||||
// 每小时执行一次状态检查调度
|
// 每小时执行一次状态检查调度
|
||||||
//@Scheduled(cron = "0 0 * * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
@Scheduled(cron = "0 */10 * * * ?")
|
//@Scheduled(cron = "0 */10 * * * ?")
|
||||||
private void scheduleSimCardStatusCheck() {
|
private void scheduleSimCardStatusCheck() {
|
||||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||||
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
||||||
|
|
||||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||||
//int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
||||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 600 );
|
|
||||||
logger.info("- 设备: {}, SIM状态查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
logger.info("- 设备: {}, SIM状态查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||||
|
|
||||||
scheduler.schedule(() -> checkDeviceSimCardStatus(onlineDevice.getDeviceid()),
|
ThreadManager.getScheduledThreadPool().schedule(
|
||||||
delay, TimeUnit.SECONDS);
|
() -> checkDeviceSimCardStatus(onlineDevice.getDeviceid()),
|
||||||
|
delay,
|
||||||
|
TimeUnit.SECONDS
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每两小时执行一次流量检查调度
|
// 每两小时执行一次流量检查调度
|
||||||
//@Scheduled(cron = "0 0 0/2 * * ?")
|
@Scheduled(cron = "0 0 0/2 * * ?")
|
||||||
@Scheduled(cron = "0 */20 * * * ?")
|
|
||||||
private void scheduleSimCardTrafficCheck() {
|
private void scheduleSimCardTrafficCheck() {
|
||||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||||
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
||||||
|
|
||||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 1200);
|
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 7200);
|
||||||
logger.debug("- 设备: {}, SIM流量查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
logger.debug("- 设备: {}, SIM流量查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||||
|
|
||||||
scheduler.schedule(() -> checkDeviceSimCardTraffic(onlineDevice.getDeviceid()),
|
ThreadManager.getScheduledThreadPool().schedule(
|
||||||
delay, TimeUnit.SECONDS);
|
() -> checkDeviceSimCardTraffic(onlineDevice.getDeviceid()),
|
||||||
|
delay,
|
||||||
|
TimeUnit.SECONDS
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user