fllmoyu 4 lat temu
rodzic
commit
b793e103c6

+ 2 - 2
common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationSubInfo.java

@@ -25,9 +25,9 @@ public class StationSubInfo {
         @ApiModelProperty(value = "终点站点id")
     private String endStationId;
         @ApiModelProperty(value = "经度")
-    private BigDecimal longitude;
+    private Double longitude;
         @ApiModelProperty(value = "纬度")
-    private BigDecimal latitude;
+    private Double latitude;
         @ApiModelProperty(value = "创建人")
     private String createBy;
         @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")

+ 33 - 2
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -337,10 +337,13 @@ public class GpsServiceImpl implements GpsService {
                     frontToEnd = false;
                 }
 
+
                 if(frontToEnd){
                     int n = 0;
                     for (int i=0;i<stationInfoList.size();i++) {
                         StationInfo stationInfo = stationInfoList.get(i);
+
+
                         int distance = stationInfo.getRadius();
                         if (stationInfo.getRadius() == null){
                             distance = 100;
@@ -352,6 +355,19 @@ public class GpsServiceImpl implements GpsService {
                             continue;
                         }
 
+                        StationSubInfo stationSubInfo = stationSubInfoService.findByStationIdStartEnd(stationInfo.getId(),shiftInfo.getStartStationId(),shiftInfo.getEndStationId());
+                        if (stationSubInfo != null){
+                            StationInfo stationInfo1 = new StationInfo();
+                            stationInfo1.setLongitude(stationSubInfo.getLongitude());
+                            stationInfo1.setLatitude(stationSubInfo.getLatitude());
+                            if(matchDistance(stationInfo,vehicleInfo,20)){
+                                currentStationId = stationSubInfo.getStationId();
+                                break;
+                            }
+                        }
+
+
+
                         if(matchDistance(stationInfo,vehicleInfo,distance)){
                            currentStationId = stationInfo.getId();
                            break;
@@ -371,6 +387,10 @@ public class GpsServiceImpl implements GpsService {
                     int n = 0;
                     for (int i=stationInfoList.size() - 1;i>=0;i--) {
                         StationInfo stationInfo = stationInfoList.get(i);
+
+
+
+
                         int distance = stationInfo.getRadius();
                         if (stationInfo.getRadius() == null){
                             distance = 100;
@@ -381,6 +401,17 @@ public class GpsServiceImpl implements GpsService {
                             continue;
                         }
 
+                        StationSubInfo stationSubInfo = stationSubInfoService.findByStationIdStartEnd(stationInfo.getId(),shiftInfo.getStartStationId(),shiftInfo.getEndStationId());
+                        if (stationSubInfo != null){
+                            StationInfo stationInfo1 = new StationInfo();
+                            stationInfo1.setLongitude(stationSubInfo.getLongitude());
+                            stationInfo1.setLatitude(stationSubInfo.getLatitude());
+                            if(matchDistance(stationInfo,vehicleInfo,20)){
+                                currentStationId = stationSubInfo.getStationId();
+                                break;
+                            }
+                        }
+
                         if(matchDistance(stationInfo,vehicleInfo,distance)){
                             currentStationId = stationInfo.getId();
                             break;
@@ -397,7 +428,7 @@ public class GpsServiceImpl implements GpsService {
                 }
 
                 //gps修改站点时,查询是否有附属站点
-                if (!manual){
+                /*if (!manual){
 
                     Double lo = Double.valueOf(vehicleInfo.getLongitude());
                     Double la = Double.valueOf(vehicleInfo.getLatestAddress());
@@ -424,7 +455,7 @@ public class GpsServiceImpl implements GpsService {
                         StationSubInfo stationSubInfo = stationSubInfoList.get(0);
                         currentStationId = stationSubInfo.getStationId();
                     }
-                }
+                }*/
 
             }
         }

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

@@ -1119,13 +1119,13 @@ public class DriverApiController {
                     stationSubInfo1.setStationId(currentStationId);
                     stationSubInfo1.setStartStationId(shiftInfo.getStartStationId());
                     stationSubInfo1.setEndStationId(shiftInfo.getEndStationId());
-                    stationSubInfo1.setLongitude(new BigDecimal(vehicleInfo.getLongitude()));
-                    stationSubInfo1.setLatitude(new BigDecimal(vehicleInfo.getLatitude()));
+                    stationSubInfo1.setLongitude(new Double(vehicleInfo.getLongitude()));
+                    stationSubInfo1.setLatitude(new Double(vehicleInfo.getLatitude()));
                     stationSubInfo1.setCreateTime(new Date());
                     stationSubInfoService.insert(stationSubInfo1);
                 }else {
-                    stationSubInfo.setLongitude(new BigDecimal(vehicleInfo.getLongitude()));
-                    stationSubInfo.setLatitude(new BigDecimal(vehicleInfo.getLatitude()));
+                    stationSubInfo.setLongitude(new Double(vehicleInfo.getLongitude()));
+                    stationSubInfo.setLatitude(new Double(vehicleInfo.getLatitude()));
                     stationSubInfoService.update(stationSubInfo);
                 }
             }