Commit 56f15b1c59a760aea98e1e44bff9833aba0ba81e
1 parent
961be0ac
update...
Showing
1 changed file
with
15 additions
and
11 deletions
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| @@ -9,6 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | @@ -9,6 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | import com.bsth.util.Arith; | 9 | import com.bsth.util.Arith; |
| 10 | import com.bsth.websocket.handler.SendUtils; | 10 | import com.bsth.websocket.handler.SendUtils; |
| 11 | import com.google.common.collect.ArrayListMultimap; | 11 | import com.google.common.collect.ArrayListMultimap; |
| 12 | +import org.apache.commons.lang3.StringUtils; | ||
| 12 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.BeansException; | 15 | import org.springframework.beans.BeansException; |
| @@ -64,7 +65,11 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -64,7 +65,11 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 64 | && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ | 65 | && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ |
| 65 | 66 | ||
| 66 | ScheduleRealInfo old = popLateSch(sch); | 67 | ScheduleRealInfo old = popLateSch(sch); |
| 67 | - if(null != old){ | 68 | + |
| 69 | + //班次被压入 | ||
| 70 | + if(lateSchMaps.containsEntry(sch.getClZbh(), sch)){ | ||
| 71 | + | ||
| 72 | + logger.info("【应发未到 -多个("+lateSchMaps.get(sch.getClZbh()).size()+")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 68 | //通知客户端 | 73 | //通知客户端 |
| 69 | sch.setLate2(true); | 74 | sch.setLate2(true); |
| 70 | sendUtils.sendAutoWdtz(sch, old); | 75 | sendUtils.sendAutoWdtz(sch, old); |
| @@ -84,24 +89,19 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -84,24 +89,19 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 84 | private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) { | 89 | private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) { |
| 85 | List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh()); | 90 | List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh()); |
| 86 | 91 | ||
| 87 | - if(null == list || list.size() == 0){ | 92 | + if(null == list || list.size() == 0) |
| 88 | lateSchMaps.put(sch.getClZbh(), sch); | 93 | lateSchMaps.put(sch.getClZbh(), sch); |
| 89 | - logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 90 | - } | ||
| 91 | else { | 94 | else { |
| 92 | ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName()); | 95 | ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName()); |
| 93 | 96 | ||
| 94 | - if(null == old){ | 97 | + if(null == old) |
| 95 | lateSchMaps.put(sch.getClZbh(), sch); | 98 | lateSchMaps.put(sch.getClZbh(), sch); |
| 96 | - logger.info("【应发未到 -多个("+lateSchMaps.get(sch.getClZbh()).size()+")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 97 | - } | ||
| 98 | - //同一个起点,保留时间最大的班次 | ||
| 99 | else if(old.getDfsjT() < sch.getDfsjT()){ | 99 | else if(old.getDfsjT() < sch.getDfsjT()){ |
| 100 | + //同一个起点,保留时间最大的班次 | ||
| 100 | lateSchMaps.remove(old.getClZbh(), old); | 101 | lateSchMaps.remove(old.getClZbh(), old); |
| 101 | lateSchMaps.put(sch.getClZbh(), sch); | 102 | lateSchMaps.put(sch.getClZbh(), sch); |
| 102 | 103 | ||
| 103 | logger.info(sch.getClZbh() + "【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | 104 | logger.info(sch.getClZbh() + "【应发未到】old 班次 " + old.getId() + " -被覆盖!"); |
| 104 | - logger.info("【应发未到 -多个("+lateSchMaps.get(sch.getClZbh()).size()+")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 105 | return old; | 105 | return old; |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| @@ -160,8 +160,12 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -160,8 +160,12 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 160 | return; | 160 | return; |
| 161 | 161 | ||
| 162 | String key = gps.getStopNo(); | 162 | String key = gps.getStopNo(); |
| 163 | - if(gps.getInstation()==1)//站点名称 | ||
| 164 | - key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo(); | 163 | + if(gps.getInstation()==1){ |
| 164 | + if(StringUtils.isNotEmpty(gps.getCarparkNo())) | ||
| 165 | + key = gps.getCarparkNo();//停车场名称 | ||
| 166 | + else | ||
| 167 | + key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo();//站点名称 | ||
| 168 | + } | ||
| 165 | 169 | ||
| 166 | gps.setStationName(BasicData.stationCode2NameMap.get(key)); | 170 | gps.setStationName(BasicData.stationCode2NameMap.get(key)); |
| 167 | //根据起点站获取误点班次 | 171 | //根据起点站获取误点班次 |