|
@@ -1,6 +1,10 @@
|
|
|
package com.jpsoft.bus.modules.bus.callback;
|
|
|
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.ShiftInfo;
|
|
|
+import com.jpsoft.bus.modules.bus.service.GpsService;
|
|
|
+import com.jpsoft.bus.modules.bus.service.ShiftInfoService;
|
|
|
+import com.jpsoft.bus.modules.common.utils.CommonUtil;
|
|
|
import com.jpsoft.gps.callback.GpsDataCallback;
|
|
|
import com.jpsoft.gps.utils.GPSUtil;
|
|
|
import com.jpsoft.bus.config.GpsParamConfig;
|
|
@@ -17,6 +21,7 @@ import org.springframework.data.redis.core.ValueOperations;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Slf4j
|
|
@@ -28,6 +33,12 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
|
|
|
@Autowired
|
|
|
private GpsDataInfoService gpsDataInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GpsService gpsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ShiftInfoService shiftInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private VehicleInfoService vehicleInfoService;
|
|
|
|
|
@@ -98,6 +109,22 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
|
|
|
v.setLatitude(latitude);//纬度
|
|
|
|
|
|
vehicleInfoService.updateGps(v);
|
|
|
+
|
|
|
+
|
|
|
+ //更新车辆的当前站点
|
|
|
+ try{
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(v.getId(),"1");
|
|
|
+ if (shiftInfoList.size()>0){
|
|
|
+ ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
+ String stationId = gpsService.getLatelyStation(v.getId());
|
|
|
+ if (!shiftInfo.getCurrentStationId().equals(stationId)){
|
|
|
+ shiftInfo.setCurrentStationId(stationId);
|
|
|
+ shiftInfoService.update(shiftInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception ex){
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|