Commit ca0939c40586d084ccec13349c00ce5c70450caa
1 parent
ec6480bb
update...
Showing
2 changed files
with
11 additions
and
4 deletions
src/main/java/com/bsth/data/gpsdata_v2/handlers/ReverseRouteProcess.java
| @@ -35,6 +35,7 @@ public class ReverseRouteProcess { | @@ -35,6 +35,7 @@ public class ReverseRouteProcess { | ||
| 35 | LineConfig config = lineConfigData.get(gps.getLineId()); | 35 | LineConfig config = lineConfigData.get(gps.getLineId()); |
| 36 | if(null != config && config.isReadReverse() && | 36 | if(null != config && config.isReadReverse() && |
| 37 | reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ | 37 | reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ |
| 38 | + | ||
| 38 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | 39 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 39 | if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) | 40 | if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) |
| 40 | return; | 41 | return; |
src/main/java/com/bsth/data/gpsdata_v2/utils/SignalSchPlanMatcher.java
| @@ -41,11 +41,15 @@ public class SignalSchPlanMatcher { | @@ -41,11 +41,15 @@ public class SignalSchPlanMatcher { | ||
| 41 | try{ | 41 | try{ |
| 42 | //晚于待发时间 10 分钟 ,匹配一下最佳的班次 | 42 | //晚于待发时间 10 分钟 ,匹配一下最佳的班次 |
| 43 | if(t - sch.getDfsjT() > 1000 * 60 * 10){ | 43 | if(t - sch.getDfsjT() > 1000 * 60 * 10){ |
| 44 | - ScheduleRealInfo near = searchNearOut(gps); | 44 | + ScheduleRealInfo near = searchNearOut(gps, sch.getXlDir()); |
| 45 | 45 | ||
| 46 | if(null != near && !near.getId().equals(sch.getId())){ | 46 | if(null != near && !near.getId().equals(sch.getId())){ |
| 47 | - dayOfSchedule.addExecPlan(near); | ||
| 48 | - return false; | 47 | + |
| 48 | + if(Math.abs(t - near.getDfsjT()) < Math.abs((t - sch.getDfsjT()))){ | ||
| 49 | + | ||
| 50 | + dayOfSchedule.addExecPlan(near); | ||
| 51 | + return false; | ||
| 52 | + } | ||
| 49 | } | 53 | } |
| 50 | } | 54 | } |
| 51 | 55 | ||
| @@ -101,7 +105,7 @@ public class SignalSchPlanMatcher { | @@ -101,7 +105,7 @@ public class SignalSchPlanMatcher { | ||
| 101 | * @param gps | 105 | * @param gps |
| 102 | * @return | 106 | * @return |
| 103 | */ | 107 | */ |
| 104 | - private ScheduleRealInfo searchNearOut(GpsEntity gps) { | 108 | + private ScheduleRealInfo searchNearOut(GpsEntity gps, String upDown) { |
| 105 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(gps.getNbbm()); | 109 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(gps.getNbbm()); |
| 106 | //排序 | 110 | //排序 |
| 107 | Collections.sort(list, schComp); | 111 | Collections.sort(list, schComp); |
| @@ -109,6 +113,8 @@ public class SignalSchPlanMatcher { | @@ -109,6 +113,8 @@ public class SignalSchPlanMatcher { | ||
| 109 | ScheduleRealInfo near = null; | 113 | ScheduleRealInfo near = null; |
| 110 | int diff, minDiff=-1; | 114 | int diff, minDiff=-1; |
| 111 | for(ScheduleRealInfo sch : list){ | 115 | for(ScheduleRealInfo sch : list){ |
| 116 | + if(!sch.getXlDir().equals(upDown)) | ||
| 117 | + continue; | ||
| 112 | 118 | ||
| 113 | if(StringUtils.isNotEmpty(sch.getFcsjActual())) | 119 | if(StringUtils.isNotEmpty(sch.getFcsjActual())) |
| 114 | continue; | 120 | continue; |