优化检查设备 SIM 卡 ICCID 的代码

This commit is contained in:
fengyarnom 2025-02-21 11:55:47 +08:00
parent 2cf8cd9479
commit faff19e006

View File

@ -44,6 +44,8 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
@Autowired @Autowired
private DataPersistService dataPersistService; private DataPersistService dataPersistService;
@Autowired @Autowired
private GnssDeviceMapper gnssDeviceMapper;
@Autowired
GnssMsgMapper msgMapper; GnssMsgMapper msgMapper;
@Autowired @Autowired
@ -186,7 +188,14 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
void checkAndAskICCID(Device device){ void checkAndAskICCID(Device device){
// 如果设备的 ICCID 存在那么就不用发送 "AT+ICCID" 指令 // 如果设备的 ICCID 存在那么就不用发送 "AT+ICCID" 指令
if(device.getIccid() != null && !device.getIccid().trim().isEmpty()){ if(device.getIccid() != null && !device.getIccid().trim().isEmpty()){
GnssDevice gnssDevice = gnssDeviceMapper.queryByDeviceId(device.getDeviceId());
if(gnssDevice.getIccid() != null && !gnssDevice.getIccid().trim().isEmpty()){
// 状态和流量查询更新需要 1-2 小时期间 DataPersistService 更新可能不及时
// 若是数据库的设备已经更新了 iccid 将它同步到 DataPersistService 缓存中
device.setIccid(gnssDevice.getIccid());
}
return; return;
} }
String sendCmd = "AT+ICCID"; String sendCmd = "AT+ICCID";