浏览代码

账单经纬度修改

zhengqiang 4 年之前
父节点
当前提交
89338a06ca
共有 1 个文件被更改,包括 23 次插入22 次删除
  1. 23 22
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

+ 23 - 22
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -1110,30 +1110,32 @@ public class DriverApiController {
                 sysLog.setRemoteIp(HttpUtil.getIpAddress(request));
                 sysLog.setCreateTime(new Date());
                 logService.insert(sysLog);
-
-                //创建一个站点附属站点
-                StationSubInfo stationSubInfo = stationSubInfoService.findByStationIdStartEnd(currentStationId,shiftInfo.getStartStationId(),shiftInfo.getEndStationId());
-                if (stationSubInfo == null){
-                    StationSubInfo stationSubInfo1 = new StationSubInfo();
-                    stationSubInfo1.setId(UUID.randomUUID().toString());
-                    stationSubInfo1.setStationId(currentStationId);
-                    stationSubInfo1.setStartStationId(shiftInfo.getStartStationId());
-                    stationSubInfo1.setEndStationId(shiftInfo.getEndStationId());
-                    stationSubInfo1.setLongitude(new Double(vehicleInfo.getLongitude()));
-                    stationSubInfo1.setLatitude(new Double(vehicleInfo.getLatitude()));
-                    stationSubInfo1.setRadius(20);
-                    stationSubInfo1.setCreateTime(new Date());
-                    stationSubInfoService.insert(stationSubInfo1);
-                }else {
-                    stationSubInfo.setLongitude(new Double(vehicleInfo.getLongitude()));
-                    stationSubInfo.setLatitude(new Double(vehicleInfo.getLatitude()));
-                    stationSubInfo.setUpdateTime(new Date());
-                    stationSubInfoService.update(stationSubInfo);
-                }
             }
 
-            //重新计算当前乘客状态
             if(vehicleInfo.getLongitude()!=null && vehicleInfo.getLatitude()!=null) {
+                if(currentStation!=null) {
+                    //创建一个站点附属站点
+                    StationSubInfo stationSubInfo = stationSubInfoService.findByStationIdStartEnd(currentStationId, shiftInfo.getStartStationId(), shiftInfo.getEndStationId());
+                    if (stationSubInfo == null) {
+                        StationSubInfo stationSubInfo1 = new StationSubInfo();
+                        stationSubInfo1.setId(UUID.randomUUID().toString());
+                        stationSubInfo1.setStationId(currentStationId);
+                        stationSubInfo1.setStartStationId(shiftInfo.getStartStationId());
+                        stationSubInfo1.setEndStationId(shiftInfo.getEndStationId());
+                        stationSubInfo1.setLongitude(new Double(vehicleInfo.getLongitude()));
+                        stationSubInfo1.setLatitude(new Double(vehicleInfo.getLatitude()));
+                        stationSubInfo1.setRadius(20);
+                        stationSubInfo1.setCreateTime(new Date());
+                        stationSubInfoService.insert(stationSubInfo1);
+                    } else {
+                        stationSubInfo.setLongitude(new Double(vehicleInfo.getLongitude()));
+                        stationSubInfo.setLatitude(new Double(vehicleInfo.getLatitude()));
+                        stationSubInfo.setUpdateTime(new Date());
+                        stationSubInfoService.update(stationSubInfo);
+                    }
+                }
+
+                //重新计算当前乘客状态
                 gpsDataCallback.receive(vehicleInfo.getGpsDeviceNo(),
                         String.valueOf(vehicleInfo.getLongitude()),
                         String.valueOf(vehicleInfo.getLatitude()),
@@ -1146,7 +1148,6 @@ public class DriverApiController {
 //                        String.valueOf(currentStation.getLatitude()),
 //                        true);
 //            }
-
             shiftInfo.setCurrentStationId(currentStationId);
             shiftInfo.setUpdateTime(new Date());
             shiftInfo.setUpdateBy(subject);