Commit 1eb98e1e8420ac5b5d6ca1b91fa03a641af78828
1 parent
839283e5
进站逻辑判断
Showing
4 changed files
with
28 additions
and
5 deletions
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -208,7 +208,7 @@ public class XDApplication implements CommandLineRunner { |
| 208 | 208 | //智能调度 |
| 209 | 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 | 212 | GpsDataLoaderThread.setFlag(-1); |
| 213 | 213 | /** 线调业务 */ |
| 214 | 214 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| ... | ... | @@ -258,7 +258,7 @@ public class XDApplication implements CommandLineRunner { |
| 258 | 258 | //智能调度 |
| 259 | 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 | 263 | GpsDataLoaderThread.setFlag(-1); |
| 264 | 264 | //dayOfSchedule.dataRecovery(); | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.cache; |
| 2 | 2 | |
| 3 | +import com.bsth.data.BasicData; | |
| 3 | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 4 | 5 | import com.bsth.data.gpsdata_v2.entity.StationRoute; |
| 5 | 6 | import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail; |
| 6 | 7 | import com.bsth.data.gpsdata_v2.utils.CircleQueue; |
| 7 | -import com.google.common.collect.ArrayListMultimap; | |
| 8 | +import com.bsth.entity.Line; | |
| 8 | 9 | import org.slf4j.Logger; |
| 9 | 10 | import org.slf4j.LoggerFactory; |
| 10 | 11 | |
| ... | ... | @@ -134,8 +135,29 @@ public class GpsCacheData { |
| 134 | 135 | if(gs.isEnd()) |
| 135 | 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 | 153 | Set<String> set = new HashSet<>(); |
| 138 | 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 | 161 | if(g.getInstation() == 1) |
| 140 | 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 | 63 | headers.put("token",token); |
| 64 | 64 | StringBuilder sb = HttpClientUtils.post(urll, jsonBody,headers); |
| 65 | 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 | 68 | }catch (Exception e){ |
| 68 | 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 | 91 | List ls = new ArrayList(); |
| 92 | 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 | 95 | if (Integer.parseInt(m.get("TravelStatus").toString()) == 3) |
| 96 | 96 | ls.add(m); |
| 97 | 97 | } | ... | ... |