更新老模块没有卫星信号,导致没有定位的问题

This commit is contained in:
磷叶 2025-06-07 22:02:49 +08:00
parent 17eaba3846
commit 1753133e4f

View File

@ -87,7 +87,7 @@ public class DeviceUtil {
if (device == null || info == null) { if (device == null || info == null) {
return; return;
} }
// 设置设备信息 // 设置设备信息
if (info.containsKey(DeviceCacheKey.VOLTAGE)) { if (info.containsKey(DeviceCacheKey.VOLTAGE)) {
device.setVoltage(JsonUtils.getBigDecimal(info.get(DeviceCacheKey.VOLTAGE))); device.setVoltage(JsonUtils.getBigDecimal(info.get(DeviceCacheKey.VOLTAGE)));
@ -186,11 +186,13 @@ public class DeviceUtil {
/** /**
* 卫星信号弱 * 卫星信号弱
* 仅卫星信号不为空才判断若为空则不判断是否弱信号
* 因为老模块没有卫星信号
* @param s * @param s
* @return * @return
*/ */
public static boolean isLowSatelliteSignal(Integer s) { public static boolean isLowSatelliteSignal(Integer s) {
return s == null || s <= 5; return s != null && s <= 5;
} }
/** /**
@ -212,7 +214,7 @@ public class DeviceUtil {
* @return * @return
*/ */
public static boolean validMobileLocation(BigDecimal lon, BigDecimal lat) { public static boolean validMobileLocation(BigDecimal lon, BigDecimal lat) {
return lon != null && lat != null return lon != null && lat != null
&& !MathUtils.equals(lon, BigDecimal.ZERO) && !MathUtils.equals(lat, BigDecimal.ZERO) && !MathUtils.equals(lon, BigDecimal.ZERO) && !MathUtils.equals(lat, BigDecimal.ZERO)
&& lon.scale() >= 6 && lat.scale() >= 6; && lon.scale() >= 6 && lat.scale() >= 6;
} }