|
@@ -305,7 +305,18 @@ public class GpsServiceImpl implements GpsService {
|
|
RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
|
|
RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
|
|
|
|
|
|
List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeInfo.getId());
|
|
List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeInfo.getId());
|
|
- currentStationId = shiftInfo.getStartStationId();
|
|
|
|
|
|
+ currentStationId = shiftInfo.getCurrentStationId();
|
|
|
|
+
|
|
|
|
+ //当前站点
|
|
|
|
+ StationInfo currentStation = stationInfoService.get(currentStationId);
|
|
|
|
+
|
|
|
|
+ int currentIndex = stationInfoList.indexOf(currentStation);
|
|
|
|
+ //线路始站
|
|
|
|
+ StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
|
|
|
|
+ //线路终点站
|
|
|
|
+ StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
|
|
|
|
+
|
|
|
|
+
|
|
if (stationInfoList.size() > 0) {
|
|
if (stationInfoList.size() > 0) {
|
|
for (StationInfo stationInfo : stationInfoList) {
|
|
for (StationInfo stationInfo : stationInfoList) {
|
|
GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
|
|
GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
|
|
@@ -313,8 +324,21 @@ public class GpsServiceImpl implements GpsService {
|
|
|
|
|
|
double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
if (meter1 <= Double.valueOf(50)) {
|
|
if (meter1 <= Double.valueOf(50)) {
|
|
- currentStationId = stationInfo.getId();
|
|
|
|
- break;
|
|
|
|
|
|
+ int indexStation = stationInfoList.indexOf(stationInfo);
|
|
|
|
+ //线路的开始站是站点集合的第一个站点则是顺线路运行
|
|
|
|
+ if (shiftInfo.getStartStationId().equals(stationInfoList.get(0).getId())){
|
|
|
|
+ if (indexStation > currentIndex){
|
|
|
|
+ currentStationId = stationInfo.getId();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (shiftInfo.getEndStationId().equals(stationInfoList.get(0).getId())){
|
|
|
|
+ if (indexStation < currentIndex){
|
|
|
|
+ currentStationId = stationInfo.getId();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|