Commit 151ce8c8743670ef60f3f12c45c6c998efda945d

Authored by panzhaov5
1 parent d7e44dc6

update...

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -635,6 +635,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, @@ -635,6 +635,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
635 } 635 }
636 636
637 int code = dayOfSchedule.reloadSch(lineCode); 637 int code = dayOfSchedule.reloadSch(lineCode);
  638 +
  639 + //重新按公司编码索引数据
  640 + dayOfSchedule.groupByGsbm();
638 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); 641 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
639 return rs; 642 return rs;
640 } 643 }
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
@@ -103,7 +103,7 @@ public class ServiceDataInterface { @@ -103,7 +103,7 @@ public class ServiceDataInterface {
103 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) 103 if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
104 return null; 104 return null;
105 105
106 - List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>(); 106 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findByGsbm(companyId)), rs = new ArrayList<>();
107 for (ScheduleRealInfo sch : all) { 107 for (ScheduleRealInfo sch : all) {
108 if (sch.getGsBm() != null 108 if (sch.getGsBm() != null
109 && sch.getGsBm().equals(companyId) 109 && sch.getGsBm().equals(companyId)
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -132,8 +132,6 @@ public class InStationProcess { @@ -132,8 +132,6 @@ public class InStationProcess {
132 132
133 sch.setZdsjActualAll(rsT); 133 sch.setZdsjActualAll(rsT);
134 sch.setSiginCompate(2); 134 sch.setSiginCompate(2);
135 - //通知误点停靠程序,有车辆到站  
136 - LateAdjustHandle.carArrive(gps);  
137 135
138 //持久化 136 //持久化
139 dayOfSchedule.save(sch); 137 dayOfSchedule.save(sch);
@@ -147,6 +145,10 @@ public class InStationProcess { @@ -147,6 +145,10 @@ public class InStationProcess {
147 else 145 else
148 dayOfSchedule.removeExecPlan(nbbm); 146 dayOfSchedule.removeExecPlan(nbbm);
149 147
  148 + //通知误点停靠程序,有车辆到站
  149 + //LateAdjustHandle.carArrive(gps, next);
  150 + LateAdjustHandle.carArrive(gps);
  151 +
150 //路牌的下一个班次,页面显示起点实际到达时间 152 //路牌的下一个班次,页面显示起点实际到达时间
151 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); 153 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
152 if (lpNext != null) { 154 if (lpNext != null) {
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -56,13 +56,16 @@ public class DayOfSchedule { @@ -56,13 +56,16 @@ public class DayOfSchedule {
56 //按线路分组的 “原始计划” 排班数据 56 //按线路分组的 “原始计划” 排班数据
57 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; 57 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap;
58 58
59 - // 按车辆分组的班次数据 59 + // 按车辆索引的班次数据
60 private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; 60 private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
61 61
62 - //按线路分组计划用车 62 + // 按营运公司索引的班次数据
  63 + private static ListMultimap<String, ScheduleRealInfo> gsBmScheduleMap;
  64 +
  65 + //按线路索引计划用车
63 private static HashMultimap<String, String> lineNbbmsMap; 66 private static HashMultimap<String, String> lineNbbmsMap;
64 67
65 - //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list 68 + //按路牌索引班次数据 线路编码_路牌名称 ——> 班次list
66 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; 69 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
67 70
68 // 班次主键映射 71 // 班次主键映射
@@ -108,6 +111,7 @@ public class DayOfSchedule { @@ -108,6 +111,7 @@ public class DayOfSchedule {
108 nbbmScheduleMap = ArrayListMultimap.create(); 111 nbbmScheduleMap = ArrayListMultimap.create();
109 nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap); 112 nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap);
110 113
  114 + gsBmScheduleMap = ArrayListMultimap.create();
111 lpScheduleMap = ArrayListMultimap.create(); 115 lpScheduleMap = ArrayListMultimap.create();
112 lineNbbmsMap = HashMultimap.create(); 116 lineNbbmsMap = HashMultimap.create();
113 117
@@ -1135,4 +1139,26 @@ public class DayOfSchedule { @@ -1135,4 +1139,26 @@ public class DayOfSchedule {
1135 public String sizeString(){ 1139 public String sizeString(){
1136 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size(); 1140 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
1137 } 1141 }
  1142 +
  1143 +
  1144 + /**
  1145 + * 按公司编码分组数据
  1146 + */
  1147 + public void groupByGsbm(){
  1148 + Collection<ScheduleRealInfo> all = findAll();
  1149 + ListMultimap<String, ScheduleRealInfo> gsBmMaps = ArrayListMultimap.create();
  1150 +
  1151 + for(ScheduleRealInfo sch : all){
  1152 + gsBmMaps.put(sch.getGsBm(), sch);
  1153 + }
  1154 +
  1155 + if(gsBmMaps.size() > 0){
  1156 + gsBmScheduleMap = null;
  1157 + gsBmScheduleMap = gsBmMaps;
  1158 + }
  1159 + }
  1160 +
  1161 + public Collection<ScheduleRealInfo> findByGsbm(String gsbm){
  1162 + return gsBmScheduleMap.get(gsbm);
  1163 + }
1138 } 1164 }
1139 \ No newline at end of file 1165 \ No newline at end of file
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -70,7 +70,7 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -70,7 +70,7 @@ public class LateAdjustHandle implements ApplicationContextAware {
70 //班次被压入 70 //班次被压入
71 if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) { 71 if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) {
72 72
73 - logger.info("【应发未到 -多个(" + lateSchMaps.get(sch.getClZbh()).size() + ")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); 73 + logger.info("21【应发未到 -多个(" + lateSchMaps.get(sch.getClZbh()).size() + ")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
74 //通知客户端 74 //通知客户端
75 sch.setLate2(true); 75 sch.setLate2(true);
76 sendUtils.sendAutoWdtz(sch, old); 76 sendUtils.sendAutoWdtz(sch, old);
@@ -170,8 +170,7 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -170,8 +170,7 @@ public class LateAdjustHandle implements ApplicationContextAware {
170 return; 170 return;
171 171
172 172
173 - String key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()  
174 - , name1 = BasicData.stationCode2NameMap.get(key)//站点名称 173 + String key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo(), name1 = BasicData.stationCode2NameMap.get(key)//站点名称
175 , name2 = null; 174 , name2 = null;
176 if (StringUtils.isNotEmpty(gps.getCarparkNo())) { 175 if (StringUtils.isNotEmpty(gps.getCarparkNo())) {
177 name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo()); 176 name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo());
@@ -196,7 +195,8 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -196,7 +195,8 @@ public class LateAdjustHandle implements ApplicationContextAware {
196 } 195 }
197 196
198 if (gps.getStationName().equals(sch.getQdzName()) 197 if (gps.getStationName().equals(sch.getQdzName())
199 - || gps.getStopNo().equals(sch.getQdzCode())) { 198 + || gps.getStopNo().equals(sch.getQdzCode())
  199 + || sch.getQdzName().equals(name2)) {
200 200
201 //自动调整待发 到达时间 + 停靠时间 201 //自动调整待发 到达时间 + 停靠时间
202 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); 202 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
@@ -215,6 +215,48 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -215,6 +215,48 @@ public class LateAdjustHandle implements ApplicationContextAware {
215 } 215 }
216 } 216 }
217 217
  218 +
  219 + /**
  220 + * 车辆到站, 进站 进 的哪个班次,就调该车辆的下一个班次
  221 + *
  222 + * @param gps
  223 + * @param sch public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) {
  224 + * try {
  225 + * if (gps.getInstation() <= 0 || null == sch) {
  226 + * return;
  227 + * }
  228 + * <p>
  229 + * List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm());
  230 + * <p>
  231 + * if (null == list || list.size() == 0 || !list.contains(sch)) {
  232 + * return;
  233 + * }
  234 + * <p>
  235 + * //可能是延迟信号,gps时间没有误点
  236 + * if (gps.getTimestamp() <= sch.getDfsjT()) {
  237 + * sch.setLate2(false);
  238 + * lateSchMaps.remove(sch.getClZbh(), sch);
  239 + * return;
  240 + * }
  241 + * <p>
  242 + * <p>
  243 + * //自动调整待发 到达时间 + 停靠时间
  244 + * long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
  245 + * <p>
  246 + * sch.setDfsjAll(dt);
  247 + * sch.setDfAuto(true);
  248 + * //取消应发未到标记
  249 + * sch.setLate2(false);
  250 + * <p>
  251 + * lateSchMaps.remove(sch.getClZbh(), sch);
  252 + * logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
  253 + * } catch (Exception e) {
  254 + * e.printStackTrace();
  255 + * logger.error("late2 car arrive", e);
  256 + * }
  257 + * }
  258 + */
  259 +
218 @Override 260 @Override
219 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 261 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
220 lineConfigData = applicationContext.getBean(LineConfigData.class); 262 lineConfigData = applicationContext.getBean(LineConfigData.class);
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
@@ -77,6 +77,9 @@ public class ScheduleRefreshThread extends Thread{ @@ -77,6 +77,9 @@ public class ScheduleRefreshThread extends Thread{
77 } 77 }
78 } 78 }
79 79
  80 + //按公司编码索引数据
  81 + dayOfSchedule.groupByGsbm();
  82 +
80 //首末班入库(给网关用的数据) 83 //首末班入库(给网关用的数据)
81 FirstAndLastHandler.saveAll(); 84 FirstAndLastHandler.saveAll();
82 } catch (Exception e) { 85 } catch (Exception e) {
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -5146,6 +5146,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5146,6 +5146,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5146 List<String> leftList = Splitter.on(",").splitToList(leftIdx); 5146 List<String> leftList = Splitter.on(",").splitToList(leftIdx);
5147 List<String> rightList = Splitter.on(",").splitToList(rightIdx); 5147 List<String> rightList = Splitter.on(",").splitToList(rightIdx);
5148 Set<String> lpSet = new HashSet<>(); 5148 Set<String> lpSet = new HashSet<>();
  5149 + Set<String> carSet = new HashSet<>();
5149 5150
5150 List<ScheduleRealInfo> largeList, smallList; 5151 List<ScheduleRealInfo> largeList, smallList;
5151 if (leftList.size() > rightList.size()) { 5152 if (leftList.size() > rightList.size()) {
@@ -5176,6 +5177,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5176,6 +5177,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5176 5177
5177 lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); 5178 lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName());
5178 lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); 5179 lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName());
  5180 +
  5181 + carSet.add(leftSch.getClZbh());
  5182 + carSet.add(rightSch.getClZbh());
5179 } 5183 }
5180 5184
5181 //重新计算路牌的起点应到时间 5185 //重新计算路牌的起点应到时间
@@ -5183,6 +5187,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5183,6 +5187,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5183 ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); 5187 ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName));
5184 } 5188 }
5185 5189
  5190 + //重新就算车辆当前执行班次
  5191 + for(String nbbm : carSet){
  5192 + dayOfSchedule.reCalcExecPlan(nbbm);
  5193 + }
  5194 +
  5195 +
5186 for (ScheduleRealInfo sch : ts) { 5196 for (ScheduleRealInfo sch : ts) {
5187 dayOfSchedule.save(sch); 5197 dayOfSchedule.save(sch);
5188 } 5198 }
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html
@@ -659,9 +659,10 @@ @@ -659,9 +659,10 @@
659 else if(ai==-1 && bi!=-1) 659 else if(ai==-1 && bi!=-1)
660 return 1; 660 return 1;
661 else 661 else
662 - return a.name.localeCompare(b.name); 662 + return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN');
663 }); 663 });
664 664
  665 + /**
665 /*var rs = {}; 666 /*var rs = {};
666 $.each(array, function () { 667 $.each(array, function () {
667 rs[this.code]=this.name; 668 rs[this.code]=this.name;
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/main.html
@@ -300,7 +300,7 @@ @@ -300,7 +300,7 @@
300 else if(ai==-1 && bi!=-1) 300 else if(ai==-1 && bi!=-1)
301 return 1; 301 return 1;
302 else 302 else
303 - return a.name.localeCompare(b.name); 303 + return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN');
304 }); 304 });
305 return array; 305 return array;
306 } 306 }
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -144,7 +144,7 @@ var gb_schedule_context_menu = (function () { @@ -144,7 +144,7 @@ var gb_schedule_context_menu = (function () {
144 jgtz: function (schArray) { 144 jgtz: function (schArray) {
145 //忽略进出场班次 145 //忽略进出场班次
146 schArray = schArray.filter(function (sch) { 146 schArray = schArray.filter(function (sch) {
147 - return sch.bcType != 'in' && sch.bcType != 'out'; 147 + return sch.bcType != 'in' && sch.bcType != 'out' && sch.status!=-1;
148 }); 148 });
149 149
150 var idArr = [], qdz = schArray[0].qdzCode; 150 var idArr = [], qdz = schArray[0].qdzCode;
@@ -153,7 +153,7 @@ var gb_schedule_context_menu = (function () { @@ -153,7 +153,7 @@ var gb_schedule_context_menu = (function () {
153 idArr.push(this.id); 153 idArr.push(this.id);
154 }); 154 });
155 155
156 - var ps = '<div class="ps-help-panel"><small>1、忽略进出场班次</small><small>2、与选中的第一个班次起点站不同的也将被忽略</small></div>'; 156 + var ps = '<div class="ps-help-panel"><small>1、忽略进出场班次</small><small>2、与选中的第一个班次起点站不同的也将被忽略</small><small>3、忽略烂班</small></div>';
157 var elem = UIkit.modal.prompt('请输入间隔(分钟)' + ps, 0, function (newValue) { 157 var elem = UIkit.modal.prompt('请输入间隔(分钟)' + ps, 0, function (newValue) {
158 if (!isNaN(newValue) && newValue > 0) { 158 if (!isNaN(newValue) && newValue > 0) {
159 gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) { 159 gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) {