Commit 4fad74194ced518ed7ec734d03bea1c821589f70

Authored by 廖磊
2 parents 8a1d0ab4 020ed47d

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
src/main/java/com/bsth/data/BasicData.java
... ... @@ -257,7 +257,7 @@ public class BasicData {
257 257 * @Description: TODO(加载线路相关信息)
258 258 */
259 259 public void loadLineInfo() {
260   - Iterator<Line> iterator = lineRepository.findAll().iterator();
  260 + Iterator<Line> iterator = lineRepository.findAllService().iterator();
261 261  
262 262 Line line;
263 263 BiMap<Integer, String> biMap = HashBiMap.create();
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -164,6 +164,9 @@ public class InOutStationSignalHandle extends SignalHandle{
164 164 //实发时间
165 165 sch.setFcsjActualAll(rsT);
166 166 sch.setSiginCompate(1);
  167 +
  168 + //出站既出场
  169 + outStationAndOutPark(sch);
167 170 //通知客户端
168 171 sendUtils.sendFcsj(sch);
169 172 //持久化
... ... @@ -172,12 +175,11 @@ public class InOutStationSignalHandle extends SignalHandle{
172 175 //清理应发未发标记
173 176 LateAdjustHandle.remove(sch);
174 177  
175   - if(!gps.isService()){
  178 + if(!gps.isService() && !dayOfSchedule.emptyService(sch)){
176 179 //切换成营运状态
177 180 gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统");
178 181 }
179   - //出站既出场
180   - outStationAndOutPark(sch);
  182 +
181 183 logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
182 184 }
183 185 else if(isOutSch(sch)){
... ... @@ -252,31 +254,29 @@ public class InOutStationSignalHandle extends SignalHandle{
252 254  
253 255  
254 256 private void outStationAndOutPark(ScheduleRealInfo sch){
255   - LineConfig config = lineConfigData.get(sch.getXlBm());
256   - //限定出站既出场的停车场
257   - String park = config.getTwinsPark();
258   - boolean limitPark = StringUtils.isNotEmpty(park);
259   -
260   - if (config != null && config.getOutConfig() == 2) {
261   - //出站既出场
262   - ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
263   - if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().intValue()==0)
264   - && (!limitPark || park.equals(schPrev.getQdzCode()))) {
265   -
266   - schPrev.setFcsjActualAll(sch.getFcsjActualTime());
267   - schPrev.setZdsjActualAll(sch.getFcsjActualTime());
268   -
269   - sendUtils.refreshSch(schPrev);
270   - dayOfSchedule.save(schPrev);
271   -
272   - /*if(schPrev.getBcType().equals("out")){
273   - //出场时,切换成营运状态
274   - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh());
275   - gpsStatusManager.changeServiceState(deviceId, schPrev.getXlDir(), 0, "出场@系统");
276   - //DirectivePushQueue.put6003(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), "出场@系统");
277   - //directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统");
278   - }*/
  257 + try{
  258 + LineConfig config = lineConfigData.get(sch.getXlBm());
  259 + //限定出站既出场的停车场
  260 + String park = config.getTwinsPark();
  261 + boolean limitPark = StringUtils.isNotEmpty(park);
  262 +
  263 + if (config != null && config.getOutConfig() == 2) {
  264 + //出站既出场
  265 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  266 + if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().intValue()==0)
  267 + && (!limitPark || park.equals(schPrev.getQdzCode()))) {
  268 +
  269 + schPrev.setFcsjActualAll(sch.getFcsjActualTime());
  270 + schPrev.setZdsjActualAll(sch.getFcsjActualTime());
  271 + //起点实到
  272 + sch.setQdzArrDatesj(schPrev.getZdsjActual());
  273 +
  274 + sendUtils.refreshSch(schPrev);
  275 + dayOfSchedule.save(schPrev);
  276 + }
279 277 }
  278 + }catch (Exception e){
  279 + logger.error("", e);
280 280 }
281 281 }
282 282  
... ... @@ -343,9 +343,6 @@ public class InOutStationSignalHandle extends SignalHandle{
343 343 if(lpNext != null){
344 344 lpNext.setQdzArrDatesj(sch.getZdsjActual());
345 345 }
346   - else{
347   - logger.info(sch.getClZbh() + " 到终点,无下一班");
348   - }
349 346  
350 347 //通知客户端
351 348 sendUtils.sendZdsj(sch, lpNext, doneSum);
... ... @@ -361,11 +358,12 @@ public class InOutStationSignalHandle extends SignalHandle{
361 358 if(!next.getXlBm().equals(sch.getXlBm())){
362 359 gpsStatusManager.changeLine(next.getClZbh(), next.getXlBm(), "套跑@系统");
363 360 }
364   - }
365   - else if(sch.getBcType().equals("in")){
366   - //进场,切换成非营运状态
367   - gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统");
368   - }
  361 +
  362 + //下一个班次是空驶班次
  363 + if(dayOfSchedule.emptyService(next))
  364 + nonService(sch, "空驶@系统");
  365 + } else
  366 + nonService(sch, "结束@系统");
369 367 }
370 368 else {
371 369 /*if(sch.getFcsjActual() == null){
... ... @@ -466,7 +464,7 @@ public class InOutStationSignalHandle extends SignalHandle{
466 464 dayOfSchedule.addExecPlan(next);
467 465  
468 466 //进场,切换成非营运状态
469   - gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统");
  467 + nonService(sch, "进场@系统");
470 468 }
471 469 }
472 470  
... ... @@ -522,4 +520,13 @@ public class InOutStationSignalHandle extends SignalHandle{
522 520 private boolean isInSch(ScheduleRealInfo sch){
523 521 return sch.getBcType().equals("in") || GeoCacheData.tccMap.keySet().contains(sch.getZdzCode());
524 522 }
  523 +
  524 + /**
  525 + * 切换为非营运状态
  526 + * @param sch
  527 + * @param sender
  528 + */
  529 + private void nonService(ScheduleRealInfo sch, String sender){
  530 + gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, sender);
  531 + }
525 532 }
526 533 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
... ... @@ -49,25 +49,34 @@ public class ScheduleRefreshThread extends Thread{
49 49 Collection<LineConfig> confs = lineConfs.getAll();
50 50  
51 51 String currSchDate, oldSchDate;
52   - String lineCode;
  52 + String lineCode = null;
53 53 for(LineConfig conf : confs){
54   - lineCode = conf.getLine().getLineCode();
55   - oldSchDate = dayOfSchedule.getCurrSchDate().get(lineCode);
56   - currSchDate = dayOfSchedule.calcSchDate(lineCode);
57   -
58   - if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
  54 + try{
  55 + lineCode = conf.getLine().getLineCode();
  56 + oldSchDate = dayOfSchedule.getCurrSchDate().get(lineCode);
  57 + currSchDate = dayOfSchedule.calcSchDate(lineCode);
59 58  
60   - logger.info(lineCode + "开始翻班, " + currSchDate);
61   - //清除指令数据
62   - Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
63   - for(String car : cars)
64   - dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car));
65   - //清除驾驶员上报数据
66   - pilotReport.clear(lineCode);
67   -
68   - //重载排班数据
69   - dayOfSchedule.reloadSch(lineCode, currSchDate, false);
70   - logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
  59 + if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
  60 +
  61 + logger.info(lineCode + "开始翻班, " + currSchDate);
  62 +
  63 + try{
  64 + //清除指令数据
  65 + Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
  66 + for(String car : cars)
  67 + dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car));
  68 + //清除驾驶员上报数据
  69 + pilotReport.clear(lineCode);
  70 + }catch (Exception e){
  71 + logger.error("清理 60 和 80出现问题", e);
  72 + }
  73 +
  74 + //重载排班数据
  75 + dayOfSchedule.reloadSch(lineCode, currSchDate, false);
  76 + logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
  77 + }
  78 + }catch (Exception e){
  79 + logger.error("班次更新失败!! -" + lineCode, e);
71 80 }
72 81 }
73 82  
... ...
src/main/java/com/bsth/repository/LineRepository.java
... ... @@ -41,4 +41,7 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
41 41  
42 42 @Query(value = " SELECT l FROM Line l where l.company like %?1% and l.brancheCompany like %?2% and l.lineCode like ?3")
43 43 public List<Line> findLineBygsBm(String gsBm, String fgsBm, String line);
  44 +
  45 + @Query("SELECT L FROM Line L where L.destroy=0")
  46 + List<Line> findAllService();
44 47 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -16,8 +16,6 @@ import com.bsth.repository.StationRepository;
16 16 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
17 17 import com.bsth.service.gps.entity.*;
18 18 import com.bsth.util.DateUtils;
19   -import com.bsth.util.PageHelper;
20   -import com.bsth.util.PageObject;
21 19 import com.bsth.util.TransGPS;
22 20 import com.bsth.util.TransGPS.Location;
23 21 import com.bsth.util.db.DBUtils_MS;
... ... @@ -985,11 +983,18 @@ public class GpsServiceImpl implements GpsService {
985 983  
986 984 public boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {
987 985 try {
  986 + String fv, v;
988 987 for (Field f : fs) {
989 988 if (StringUtils.isEmpty(map.get(f.getName()).toString()))
990 989 continue;
991 990  
992   - if (f.get(obj) == null || f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1)
  991 + if(f.get(obj) == null)
  992 + return false;
  993 +
  994 + fv = f.get(obj).toString();
  995 + v = map.get(f.getName()).toString();
  996 +
  997 + if(!fv.startsWith(v) && !fv.endsWith(v))
993 998 return false;
994 999 }
995 1000 } catch (Exception e) {
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
... ... @@ -36,8 +36,6 @@ public class SendUtils{
36 36 * TODO(推送发车信息)
37 37 */
38 38 public void sendFcsj(ScheduleRealInfo sch) {
39   - //处理出站即出场的班次
40   - //connectOutSchTime(sch);
41 39  
42 40 Map<String, Object> map = new HashMap<>();
43 41 map.put("fn", "faChe");
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -271,7 +271,7 @@ svg.line-chart g.merge-item text {
271 271 }
272 272  
273 273 .qtip-multi-gps {
274   - max-width: 716px !important;
  274 + max-width: 720px !important;
275 275 }
276 276  
277 277 .qtip-bootstrap.qtip-multi-gps .qtip-content {
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
... ... @@ -7,12 +7,12 @@
7 7 <div class="uk-panel uk-panel-box uk-panel-box-primary">
8 8 <form class="uk-form search-form">
9 9 <fieldset data-uk-margin>
10   - <legend>
  10 + <!--<legend>
11 11 数据检索
12   - <!-- <div class="legend-tools">
  12 + &lt;!&ndash; <div class="legend-tools">
13 13 <a class="uk-icon-small uk-icon-hover uk-icon-file-excel-o" data-uk-tooltip title="导出excel"></a>
14   - </div> -->
15   - </legend>
  14 + </div> &ndash;&gt;
  15 + </legend>-->
16 16 <span class="horizontal-field">线路</span>
17 17 <div class="uk-autocomplete uk-form autocomplete-line" >
18 18 <input type="text" name="lineId" placeholder="线路">
... ...