Compare commits

..

No commits in common. "82c547d77886b86e4a8b08bb0a6aca559d26efff" and "9c830759b349652d88280dabc7c5245ba9b96e21" have entirely different histories.

4 changed files with 13 additions and 27 deletions

View File

@ -50,7 +50,4 @@ public class DeviceCacheInfo {
// 最后在线时间
private LocalDateTime lastOnlineTime;
// 定位类型
private String locationType;
}

View File

@ -361,9 +361,6 @@ public class DeviceIotServiceImpl implements DeviceIotService {
if (device.getSoftwareVersion() != null) {
info.setSoftwareVersion(device.getSoftwareVersion());
}
if (device.getLocationType() != null) {
info.setLocationType(device.getLocationType());
}
String key = CacheConstants.DEVICE_CACHE_INFO + device.getMac();
redisCache.setCacheObject(key, info);

View File

@ -134,9 +134,6 @@ public class DeviceUtil {
if (info.getSoftwareVersion() != null) {
device.setSoftwareVersion(info.getSoftwareVersion());
}
if (info.getLocationType() != null) {
device.setLocationType(info.getLocationType());
}
// 在线状态
if (info.getOnlineStatus() != null) {

View File

@ -494,28 +494,26 @@ public class OrderServiceImpl implements OrderService {
// 异步使用手机定位更新设备定位
private void handleDeviceLocationAsync(DeviceVO device, BigDecimal lon, BigDecimal lat) {
if (device != null && device.getId() != null && StringUtils.isNotBlank(device.getMac()) && DeviceUtil.validLocation(lon, lat)) {
if (device != null && device.getId() != null && DeviceUtil.isLowSatelliteSignal(device) && DeviceUtil.validLocation(lon, lat)) {
scheduledExecutorService.execute(() -> {
device.setLongitude(lon);
device.setLatitude(lat);
device.setLocationType(DeviceLocationType.PHONE.getCode());
device.setLastLocationTime(LocalDateTime.now());
// 若卫星信号弱则更新设备定位
if (DeviceUtil.isLowSatelliteSignal(device)) {
// 更新设备定位
Device data = new Device();
data.setMac(device.getMac());
data.setId(device.getId());
data.setLongitude(device.getLongitude());
data.setLatitude(device.getLatitude());
data.setLocationType(device.getLocationType());
data.setLastLocationTime(LocalDateTime.now());
int rows = deviceIotService.updateIot(data);
int rows = deviceService.updateDevice(data);
if (rows != 1) {
log.error("通过手机定位修改设备定位失败deviceMac={}", device.getMac());
}
log.error("通过手机定位修改设备定位失败deviceId={}", device.getId());
}
// 直接保存定位日志
// 转为定位日志
LocationLog locationLog = locationLogConverter.toPo(device);
if (locationLog == null) {
log.error("通过手机定位转换定位日志失败: {}", device.getMac());
@ -656,10 +654,7 @@ public class OrderServiceImpl implements OrderService {
if (device == null) {
return null;
}
// 设置日志参数
this.setLogParam(device);
// 处理设备位置
this.handleDeviceLocationAsync(device, dto.getLon(), dto.getLat());
// 查询运营区
AreaVO area = areaService.selectAreaById(order.getAreaId());