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