wlzboy
2025-11-16 f67945d53b20f6a45ae50b27d74c966eb1355bb4
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/GpsSyncTask.java
@@ -3,6 +3,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,8 +46,11 @@
            // 1. 获取所有车辆信息
            List<VehicleInfo> vehicleList = vehicleInfoService.selectVehicleInfoList(new VehicleInfo());
            List<String> deviceIds = vehicleList.stream().map(VehicleInfo::getDeviceId).collect(Collectors.toList());
            // 2. 获取所有车辆的GPS最后位置
            GpsLastPositionResponse gpsLastPositionResponse = gpsCollectService.getLastPosition(new GpsLastPositionRequest());
            GpsLastPositionRequest request = new GpsLastPositionRequest();
//            request.setDeviceids(deviceIds);
            GpsLastPositionResponse gpsLastPositionResponse = gpsCollectService.getLastPosition(request);
            // 3. 遍历车辆列表,获取每个车辆的GPS位置
            for (VehicleInfo vehicle : vehicleList) {
@@ -114,9 +118,9 @@
            // 保存GPS位置信息
            vehicleGpsService.insertVehicleGps(gps);
            log.info("车辆[{}]GPS位置已更新: 经度={}, 纬度={}, 设备时间={}, 处理时间={}",
                    vehicle.getVehicleNo(), position.getCallon(), position.getCallat(),
                    gps.getDeviceReportTime(), gps.getPlatformProcessTime());
//            log.info("车辆[{}]GPS位置已更新: 经度={}, 纬度={}, 设备时间={}, 处理时间={}",
//                    vehicle.getVehicleNo(), position.getCallon(), position.getCallat(),
//                    gps.getDeviceReportTime(), gps.getPlatformProcessTime());
        } catch (Exception e) {
            log.error("更新车辆[{}]GPS位置失败: {}", vehicle.getVehicleNo(), e.getMessage());
        }