调高状态查询和流量查询的频率,检查是否会出现问题
This commit is contained in:
parent
efff574eb1
commit
6a30a8a572
@ -52,14 +52,16 @@ public class SimStatusChecker {
|
||||
private SimCardQueryServiceImpl simCardQueryServiceImpl;
|
||||
|
||||
// 每小时执行一次状态检查调度
|
||||
@Scheduled(cron = "0 0 * * * ?")
|
||||
//@Scheduled(cron = "0 0 * * * ?")
|
||||
@Scheduled(cron = "0 */10 * * * ?")
|
||||
private void scheduleSimCardStatusCheck() {
|
||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||
//logger.debug("当前在线设备数量: {}", onlineDevices.size());
|
||||
logger.debug("当前在线设备数量: {}", onlineDevices.size());
|
||||
|
||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
||||
//logger.debug("设备: {}, SIM状态查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
//int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 600 );
|
||||
logger.debug("设备: {}, SIM状态查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
|
||||
scheduler.schedule(() -> checkDeviceSimCardStatus(onlineDevice.getDeviceid()),
|
||||
delay, TimeUnit.SECONDS);
|
||||
@ -67,14 +69,15 @@ public class SimStatusChecker {
|
||||
}
|
||||
|
||||
// 每两小时执行一次流量检查调度
|
||||
@Scheduled(cron = "0 0 0/2 * * ?")
|
||||
//@Scheduled(cron = "0 0 0/2 * * ?")
|
||||
@Scheduled(cron = "0 */20 * * * ?")
|
||||
private void scheduleSimCardTrafficCheck() {
|
||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||
//logger.debug("当前在线设备数量: {}", onlineDevices.size());
|
||||
logger.debug("当前在线设备数量: {}", onlineDevices.size());
|
||||
|
||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 7200);
|
||||
//logger.debug("设备: {}, SIM流量查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 1200);
|
||||
logger.debug("设备: {}, SIM流量查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
|
||||
scheduler.schedule(() -> checkDeviceSimCardTraffic(onlineDevice.getDeviceid()),
|
||||
delay, TimeUnit.SECONDS);
|
||||
@ -137,8 +140,8 @@ public class SimStatusChecker {
|
||||
simCard.setMsisdn(info.getMsisdn());
|
||||
simCardsMapper.updateSimCardInfo(simCard);
|
||||
|
||||
// logger.debug("更新SIM卡基本信息 - imsi: {}, msisdn: {}, iccid: {}",
|
||||
// info.getImsi(), info.getMsisdn(), info.getIccid());
|
||||
logger.info("更新SIM卡基本信息 - imsi: {}, msisdn: {}, iccid: {}",
|
||||
info.getImsi(), info.getMsisdn(), info.getIccid());
|
||||
} catch (Exception e) {
|
||||
logger.error("更新设备{}的SIM卡基本信息失败: ", device.getDeviceId(), e);
|
||||
throw e;
|
||||
@ -158,8 +161,8 @@ public class SimStatusChecker {
|
||||
|
||||
warningService.checkSimCardStatus(device, simCard);
|
||||
|
||||
// logger.debug("更新SIM卡状态 - Code: {}, 描述: {}",
|
||||
// status.getStatusCode(), status.getStatusDesc());
|
||||
logger.info("更新SIM卡状态 - Code: {}, 描述: {}",
|
||||
status.getStatusCode(), status.getStatusDesc());
|
||||
} catch (Exception e) {
|
||||
logger.error("更新设备{}的SIM卡状态失败: ", device.getDeviceId(), e);
|
||||
throw e;
|
||||
@ -188,11 +191,11 @@ public class SimStatusChecker {
|
||||
|
||||
warningService.checkSimCardTraffic(device, simCard);
|
||||
|
||||
// logger.info("更新流量信息成功 - deviceId: {}, 剩余: {}MB, 总量: {}MB, 已用: {}MB",
|
||||
// device.getIccid(),
|
||||
// simCard.getRemaining(),
|
||||
// simCard.getTotal(),
|
||||
// simCard.getUsed());
|
||||
logger.info("更新流量信息成功 - deviceId: {}, 剩余: {}MB, 总量: {}MB, 已用: {}MB",
|
||||
device.getIccid(),
|
||||
simCard.getRemaining(),
|
||||
simCard.getTotal(),
|
||||
simCard.getUsed());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("设备{}更新SIM卡流量失败: ", device.getDeviceId(), e);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user