Commit 806c3b99242577e825e19991bc133656af37da92

Authored by 潘钊
1 parent a16b07b2

update...

src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -50,6 +50,8 @@ public class CarOutInfoHandler {
50 50  
51 51 Logger logger = LoggerFactory.getLogger(this.getClass());
52 52  
  53 +
  54 + ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
53 55 /**
54 56 * 全量更新发车信息表
55 57 */
... ... @@ -57,7 +59,6 @@ public class CarOutInfoHandler {
57 59 try{
58 60 //将班次按线路分组
59 61 List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
60   - ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
61 62 for(ScheduleRealInfo sch : all){
62 63 xlMaps.put(sch.getXlBm(), sch);
63 64 }
... ... @@ -66,6 +67,9 @@ public class CarOutInfoHandler {
66 67 for (String k : ks) {
67 68 update(xlMaps.get(k));
68 69 }
  70 +
  71 + xlMaps.clear();
  72 + logger.info("更新发车信息表!!");
69 73 }catch (Exception e){
70 74 logger.error("", e);
71 75 }
... ... @@ -159,8 +163,8 @@ public class CarOutInfoHandler {
159 163 ScheduleRealInfo[] array = new ScheduleRealInfo[3];
160 164 Collections.sort(list, schDFSJComparator);
161 165  
162   - int count = 0, threshold = 1000 * 60 * 60 * 4;
163   - long t = System.currentTimeMillis();
  166 + int count = 0;//, threshold = 1000 * 60 * 60 * 4;
  167 + //long t = System.currentTimeMillis();
164 168 for (ScheduleRealInfo sch : list) {
165 169 if (count == 3)
166 170 break;
... ... @@ -180,8 +184,8 @@ public class CarOutInfoHandler {
180 184 || StringUtils.isNotEmpty(sch.getZdsjActual()))
181 185 continue;
182 186  
183   - if (t - sch.getDfsjT() > threshold)
184   - continue;
  187 + /*if (t - sch.getDfsjT() > threshold)
  188 + continue;*/
185 189  
186 190 array[count] = sch;
187 191 count++;
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/SignalSchPlanMatcher.java
... ... @@ -45,7 +45,8 @@ public class SignalSchPlanMatcher {
45 45  
46 46 if(null != near && !near.getId().equals(sch.getId())){
47 47  
48   - if(Math.abs(t - near.getDfsjT()) < Math.abs((t - sch.getDfsjT()))){
  48 + int nearDiff = (int) Math.abs(t - near.getDfsjT());
  49 + if(nearDiff < 1000 * 60 * 8 && nearDiff < Math.abs((t - sch.getDfsjT()))){
49 50  
50 51 dayOfSchedule.addExecPlan(near);
51 52 return false;
... ... @@ -57,47 +58,6 @@ public class SignalSchPlanMatcher {
57 58 log.error("", e);
58 59 }
59 60 return true;
60   - /*try{
61   - //会不会是分班没有完成
62   - if(sch.getBcType().equals("in") && t - sch.getDfsjT() > 1000 * 60 * 20){
63   - ScheduleRealInfo fbFirst = dayOfSchedule.nextByBcType(sch, "normal");
64   -
65   - if(fbFirst == null || !fbFirst.getQdzCode().equals(gps.getStopNo()))
66   - return;
67   -
68   - long dt = fbFirst.getDfsjT();
69   - //晚于待发前4分钟 -执行分班的首个营运
70   - if(dt - t < 1000 * 60 * 4){
71   - dayOfSchedule.addExecPlan(fbFirst);
72   - return;
73   - }
74   - }
75   -
76   - //线路编码不匹配
77   - if("out".equals(sch.getBcType()) && !sch.getXlBm().equals(gps.getLineId())){
78   - ScheduleRealInfo nextOut = dayOfSchedule.nextByBcType(sch, "out");
79   - if(nextOut != null && nextOut.getXlBm().equals(gps.getLineId())
80   - && fcSpace(sch, gps) > fcSpace(nextOut, gps)){
81   - dayOfSchedule.addExecPlan(nextOut);
82   - return;
83   - }
84   - }
85   - }catch (Exception e){
86   - log.error("", e);
87   - }
88   -
89   - //下一个相同走向的班次
90   - ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
91   - if(next == null || !next.getQdzCode().equals(sch.getQdzCode()))
92   - return;
93   -
94   - //晚于班次间隔百分之70,跳下一个班次
95   - double s = (int) (next.getDfsjT() - sch.getDfsjT());
96   - double r = (int) (t - sch.getDfsjT());
97   - if(r / s > 0.7){
98   - if(dayOfSchedule.addExecPlan(next))
99   - outMatch(gps, next);
100   - }*/
101 61 }
102 62  
103 63 /**
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -825,7 +825,7 @@ public class DayOfSchedule {
825 825 }
826 826  
827 827 public Collection<ScheduleRealInfo> findAll() {
828   - return nbbmScheduleMap.values();
  828 + return id2SchedulMap.values();
829 829 }
830 830  
831 831 public boolean addExecPlan(ScheduleRealInfo sch) {
... ...