Commit fc605612890c9193f33d1d97dda5d0e60251ec1c

Authored by 潘钊
1 parent 72c5e34b

update..

src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
... ... @@ -123,7 +123,13 @@ public class GpsRealData {
123 123 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws
124 124 */
125 125 public List<GpsEntity> getByLine(String lineCode) {
126   - NavigableSet<String> set = lineCode2Devices.get(lineCode);
  126 + NavigableSet<String> set = lineCode2Devices.get(lineCode);//实际车载
  127 + Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
  128 +
  129 + Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  130 + for(String nbbm : nbbmSet){
  131 + set.add(nbbm2deviceMap.get(nbbm));
  132 + }
127 133  
128 134 List<GpsEntity> rs = new ArrayList<>();
129 135 GpsEntity gps;
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -15,6 +15,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
15 15 import com.bsth.service.schedule.SchedulePlanInfoService;
16 16 import com.bsth.websocket.handler.SendUtils;
17 17 import com.google.common.collect.ArrayListMultimap;
  18 +import com.google.common.collect.HashMultimap;
18 19 import org.apache.commons.lang3.StringUtils;
19 20 import org.joda.time.format.DateTimeFormat;
20 21 import org.joda.time.format.DateTimeFormatter;
... ... @@ -55,6 +56,9 @@ public class DayOfSchedule {
55 56 // 按车辆分组的班次数据
56 57 private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
57 58  
  59 + //按线路分组计划用车
  60 + private static HashMultimap<String, String> lineNbbmsMap;
  61 +
58 62 //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list
59 63 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
60 64  
... ... @@ -199,6 +203,8 @@ public class DayOfSchedule {
199 203 reCalcExecPlan(nbbm);
200 204 }
201 205  
  206 + //分组计划用车
  207 + reCalcLineNbbms();
202 208 // 页面 翻班通知
203 209 //sendUtils.shiftSchedule(lineCode);
204 210 } catch (Exception e) {
... ... @@ -543,15 +549,15 @@ public class DayOfSchedule {
543 549 * @Description: TODO(线路下运营的车辆)
544 550 */
545 551 public Set<String> findCarByLineCode(String lineCode) {
546   - Set<String> rs = new HashSet<>();
  552 + /*Set<String> rs = new HashSet<>();
547 553  
548 554 Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
549 555 for (ScheduleRealInfo sch : schs) {
550 556 if (sch.getXlBm().equals(lineCode))
551 557 rs.add(sch.getClZbh());
552 558 }
553   -
554   - return rs;
  559 +*/
  560 + return lineNbbmsMap.get(lineCode);
555 561 }
556 562  
557 563 public List<ScheduleRealInfo> findByNbbm(String nbbm) {
... ... @@ -908,6 +914,8 @@ public class DayOfSchedule {
908 914 //重新计算车辆当前执行班次
909 915 reCalcExecPlan(newClZbh);
910 916 reCalcExecPlan(sch.getClZbh());
  917 + //重新分组计划用车
  918 + reCalcLineNbbms();
911 919 return ups;
912 920 }
913 921  
... ... @@ -1082,6 +1090,20 @@ public class DayOfSchedule {
1082 1090 return id2SchedulMap.size();
1083 1091 }
1084 1092  
  1093 + /**
  1094 + * 重新计算线路计划用车
  1095 + */
  1096 + public void reCalcLineNbbms(){
  1097 + HashMultimap<String, String> multimap = HashMultimap.create();
  1098 +
  1099 + Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
  1100 + for (ScheduleRealInfo sch : schs) {
  1101 + multimap.put(sch.getXlBm(), sch.getClZbh());
  1102 + }
  1103 +
  1104 + lineNbbmsMap = multimap;
  1105 + }
  1106 +
1085 1107 public String sizeString(){
1086 1108 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
1087 1109 }
... ...