Commit a683dca8aaed72d911001121a5a813cbb009cd68

Authored by 潘钊
1 parent dea79286

update

src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -54,9 +54,9 @@ public class GpsRealData implements CommandLineRunner {
54 54  
55 55 @Override
56 56 public void run(String... arg0) throws Exception {
57   - logger.info("gpsDataLoader,20,5");
  57 + logger.info("gpsDataLoader,20,3");
58 58 //定时从网关获取GPS数据
59   - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS);
  59 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS);
60 60 //定时扫描掉离线
61 61 //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);
62 62 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -148,7 +148,7 @@ public class InOutStationSignalHandle extends SignalHandle{
148 148 }
149 149 //出站既出场
150 150 outStationAndOutPark(sch);
151   - logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
  151 + logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
152 152 }
153 153 else if(sch.getBcType().equals("out")){
154 154 ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
... ... @@ -217,14 +217,6 @@ public class InOutStationSignalHandle extends SignalHandle{
217 217 sendUtils.sendZdsj(sch, next, doneSum);
218 218 //持久化
219 219 dayOfSchedule.save(sch);
220   - if(next != null){
221   - //下发调度指令
222   - directiveService.send60Dispatch(next, doneSum, "到站@系统");
223   - }
224   - else if(sch.getBcType().equals("in")){
225   - //终班进场,切换成非营运状态
226   - directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统");
227   - }
228 220  
229 221 //准备执行下一个班次
230 222 if (next != null) {
... ... @@ -234,6 +226,13 @@ public class InOutStationSignalHandle extends SignalHandle{
234 226 inStationAndInPark(sch, next);
235 227 //将gps转换为下一个班次走向的站内信号
236 228 transformUpdown(gps, next);
  229 +
  230 + //下发调度指令
  231 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
  232 + }
  233 + else if(sch.getBcType().equals("in")){
  234 + //终班进场,切换成非营运状态
  235 + directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统");
237 236 }
238 237 }
239 238 else {
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
... ... @@ -13,8 +13,8 @@ import org.springframework.stereotype.Component;
13 13 @Component
14 14 public class OfflineSignalHandle extends SignalHandle{
15 15  
16   - //断开2分钟,标记为重连信号
17   - private final static int OFFLINE_TIME = 1000 * 60 * 2;
  16 + //断开4分钟,标记为重连信号
  17 + private final static int OFFLINE_TIME = 1000 * 60 * 4;
18 18  
19 19 //断开70分钟,之前的信号不再有参考价值
20 20 private final static int CLEAR_TIME = 1000 * 60 * 70;
... ...
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
... ... @@ -148,22 +148,28 @@ public class GpsDataRecovery implements ApplicationContextAware {
148 148 try {
149 149 //循环gps恢复数据
150 150 CircleQueue<GpsEntity> prevs;
151   -
  151 + boolean task;
152 152 for (GpsEntity gps : list) {
153 153  
  154 + //是否有任务
  155 +
154 156 prevs = GeoCacheData.getGps(gps.getNbbm());
155 157 //掉线处理
156 158 offlineSignalHandle.handle(gps, prevs);
157 159 //状态处理
158   - if (!correctSignalHandle.handle(gps, prevs))
159   - continue;
  160 + task = correctSignalHandle.handle(gps, prevs);
160 161 //场,站内外判断
161 162 stationInsideHandle.handle(gps, prevs);
  163 + //异常判定(越界/超速)
  164 + //abnormalStateHandle.handle(gps, prevs);
  165 +
  166 + if(!task)
  167 + return; //无任务的,到这里就结束
  168 +
162 169 //反向处理
163 170 reverseSignalHandle.handle(gps, prevs);
164 171 //进出站动作处理
165 172 inOutStationSignalHandle.handle(gps, prevs);
166   -
167 173 GeoCacheData.putGps(gps);
168 174 }
169 175 } catch (Exception e) {
... ...
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
... ... @@ -95,7 +95,9 @@ public class GpsDataLoaderThread extends Thread {
95 95  
96 96 old = gpsRealData.get(gps.getDeviceId());
97 97 if (old != null &&
98   - old.getTimestamp() == gps.getTimestamp())
  98 + old.getTimestamp() == gps.getTimestamp() &&
  99 + old.getLat() == gps.getLat() &&
  100 + old.getLon() == gps.getLon())
99 101 continue;
100 102  
101 103 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
... ...
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
1 1 package com.bsth.websocket.handler;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.common.Constants;
4 5 import com.bsth.data.BasicData;
5 6 import com.google.common.base.Splitter;
6 7 import com.google.common.collect.ArrayListMultimap;
... ... @@ -107,6 +108,10 @@ public class RealControlSocketHandler implements WebSocketHandler {
107 108 user.sendMessage(message);
108 109 }
109 110 } catch (Exception e) {
  111 + try{
  112 + logger.error("error user...."+user.getAttributes().get(Constants.SESSION_USERNAME));
  113 + }
  114 + catch(Exception e2){}
110 115 logger.error("sendMessageToLine error ...."+msg);
111 116 logger.error("sendMessageToLine error ....", e);
112 117 }
... ...