Commit 1eb98e1e8420ac5b5d6ca1b91fa03a641af78828

Authored by ljq
1 parent 839283e5

进站逻辑判断

src/main/java/com/bsth/XDApplication.java
@@ -208,7 +208,7 @@ public class XDApplication implements CommandLineRunner { @@ -208,7 +208,7 @@ public class XDApplication implements CommandLineRunner {
208 //智能调度 208 //智能调度
209 sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); 209 sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS);
210 //响应式公交自动对接订单 210 //响应式公交自动对接订单
211 - sexec.scheduleWithFixedDelay(orderListThread, 60, 60 * 30, TimeUnit.SECONDS); 211 + sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS);
212 GpsDataLoaderThread.setFlag(-1); 212 GpsDataLoaderThread.setFlag(-1);
213 /** 线调业务 */ 213 /** 线调业务 */
214 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 214 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
@@ -258,7 +258,7 @@ public class XDApplication implements CommandLineRunner { @@ -258,7 +258,7 @@ public class XDApplication implements CommandLineRunner {
258 //智能调度 258 //智能调度
259 sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); 259 sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS);
260 //响应式公交自动对接订单 260 //响应式公交自动对接订单
261 - sexec.scheduleWithFixedDelay(orderListThread, 60, 60 * 30, TimeUnit.SECONDS); 261 + sexec.scheduleWithFixedDelay(orderListThread, 120, 60 * 30, TimeUnit.SECONDS);
262 262
263 GpsDataLoaderThread.setFlag(-1); 263 GpsDataLoaderThread.setFlag(-1);
264 //dayOfSchedule.dataRecovery(); 264 //dayOfSchedule.dataRecovery();
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
1 package com.bsth.data.gpsdata_v2.cache; 1 package com.bsth.data.gpsdata_v2.cache;
2 2
  3 +import com.bsth.data.BasicData;
3 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 4 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
4 import com.bsth.data.gpsdata_v2.entity.StationRoute; 5 import com.bsth.data.gpsdata_v2.entity.StationRoute;
5 import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail; 6 import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail;
6 import com.bsth.data.gpsdata_v2.utils.CircleQueue; 7 import com.bsth.data.gpsdata_v2.utils.CircleQueue;
7 -import com.google.common.collect.ArrayListMultimap; 8 +import com.bsth.entity.Line;
8 import org.slf4j.Logger; 9 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
10 11
@@ -134,8 +135,29 @@ public class GpsCacheData { @@ -134,8 +135,29 @@ public class GpsCacheData {
134 if(gs.isEnd()) 135 if(gs.isEnd())
135 return 0; 136 return 0;
136 137
  138 + Boolean hx = false;
  139 + //判断是否为环线
  140 + Line line = BasicData.nbbm2LineMap.get(gps.getNbbm());
  141 + if (line.getLinePlayType() == 1)
  142 + hx = true;
  143 + else {
  144 + //已经确认都是双向或者双环线获取站点路由
  145 + List<StationRoute> upRoute = GeoCacheData.getStationRoute(line.getLineCode(), 0); //上行
  146 + List<StationRoute> downRoute = GeoCacheData.getStationRoute(line.getLineCode(), 0); //下行
  147 + String up1= upRoute.get(0).getCode(),down1= downRoute.get(0).getCode(),
  148 + up2= upRoute.get(upRoute.size()-1).getCode(),down2 =downRoute.get(downRoute.size() - 1).getCode();
  149 + if (up1.equals(up2) && down1.equals(down2))
  150 + hx = true;
  151 +
  152 + }
137 Set<String> set = new HashSet<>(); 153 Set<String> set = new HashSet<>();
138 for(GpsEntity g : gs.getSrs()){ 154 for(GpsEntity g : gs.getSrs()){
  155 + //清除经过的起点站和终点站 只保留中途站用于判断 //只判断环线
  156 + StationRoute r = GeoCacheData.getRouteCode(g);
  157 + if (hx && (r.getMark().equals("E") || r.getMark().equals("B"))){
  158 + continue;
  159 + }
  160 +
139 if(g.getInstation() == 1) 161 if(g.getInstation() == 1)
140 set.add(g.getStation().getName()); 162 set.add(g.getStation().getName());
141 } 163 }
src/main/java/com/bsth/data/zndd/outer_car/Ordehttp.java
@@ -63,7 +63,8 @@ public class Ordehttp { @@ -63,7 +63,8 @@ public class Ordehttp {
63 headers.put("token",token); 63 headers.put("token",token);
64 StringBuilder sb = HttpClientUtils.post(urll, jsonBody,headers); 64 StringBuilder sb = HttpClientUtils.post(urll, jsonBody,headers);
65 JSONObject obj = JSON.parseObject(sb.toString()); 65 JSONObject obj = JSON.parseObject(sb.toString());
66 - mapList= JSON.parseArray(obj.getString("data"), Map.class); 66 + if (obj.getString("data") != null)
  67 + mapList= JSON.parseArray(obj.getString("data"), Map.class);
67 }catch (Exception e){ 68 }catch (Exception e){
68 logger.error("历史订单获取失败-",e); 69 logger.error("历史订单获取失败-",e);
69 } 70 }
src/main/java/com/bsth/data/zndd/outer_car/OrderListThread.java
@@ -91,7 +91,7 @@ public class OrderListThread extends Thread{ @@ -91,7 +91,7 @@ public class OrderListThread extends Thread{
91 List ls = new ArrayList(); 91 List ls = new ArrayList();
92 for (Map m : list) { 92 for (Map m : list) {
93 //同一线路并且订单结束 93 //同一线路并且订单结束
94 - if (t.getValue().contains(m.get("AreaName").toString())) { 94 + if (m.get("AreaName") != null && t.getValue().contains(m.get("AreaName").toString())) {
95 if (Integer.parseInt(m.get("TravelStatus").toString()) == 3) 95 if (Integer.parseInt(m.get("TravelStatus").toString()) == 3)
96 ls.add(m); 96 ls.add(m);
97 } 97 }