Commit d2d815f5e61fa1628c352dc34b611d7f41725208
1 parent
9ceb896e
add ojdbc jar
Showing
12 changed files
with
301 additions
and
19 deletions
Too many changes to show.
To preserve performance only 12 of 31 files are displayed.
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -543,4 +543,25 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 543 | 543 | rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); |
| 544 | 544 | return rs; |
| 545 | 545 | } |
| 546 | + | |
| 547 | + /** | |
| 548 | + * 误点调整 | |
| 549 | + * @param idx | |
| 550 | + * @param minute | |
| 551 | + * @return | |
| 552 | + */ | |
| 553 | + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST) | |
| 554 | + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){ | |
| 555 | + return scheduleRealInfoService.lateAdjust(idx, minute); | |
| 556 | + } | |
| 557 | + | |
| 558 | + /** | |
| 559 | + * 获取所有应发未到的班次 | |
| 560 | + * @param idx | |
| 561 | + * @return | |
| 562 | + */ | |
| 563 | + @RequestMapping(value = "allLate2") | |
| 564 | + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | |
| 565 | + return scheduleRealInfoService.allLate2(idx); | |
| 566 | + } | |
| 546 | 567 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| 8 | 8 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; |
| 9 | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 10 | 10 | import com.bsth.data.schedule.ScheduleComparator; |
| 11 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 11 | 12 | import com.bsth.entity.realcontrol.LineConfig; |
| 12 | 13 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 13 | 14 | import com.bsth.service.directive.DirectiveService; |
| ... | ... | @@ -145,6 +146,9 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 145 | 146 | //持久化 |
| 146 | 147 | dayOfSchedule.save(sch); |
| 147 | 148 | |
| 149 | + //清理应发未发标记 | |
| 150 | + LateAdjustHandle.remove(sch); | |
| 151 | + | |
| 148 | 152 | if(sch.getBcType().equals("out")){ |
| 149 | 153 | //出场时,切换成营运状态 |
| 150 | 154 | directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); |
| ... | ... | @@ -242,6 +246,10 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 242 | 246 | long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); |
| 243 | 247 | |
| 244 | 248 | sch.setZdsjActualAll(rsT); |
| 249 | + | |
| 250 | + //通知误点停靠程序,有车辆到站 | |
| 251 | + LateAdjustHandle.carArrive(gps); | |
| 252 | + | |
| 245 | 253 | //已完成班次数 |
| 246 | 254 | int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); |
| 247 | 255 | ScheduleRealInfo next = dayOfSchedule.next(sch); | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -154,10 +154,10 @@ public class DayOfSchedule implements CommandLineRunner { |
| 154 | 154 | diff += (1000 * 60 * 60 * 24); |
| 155 | 155 | |
| 156 | 156 | logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); |
| 157 | - //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 157 | + //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 158 | 158 | |
| 159 | 159 | //计算油、公里加注 |
| 160 | - Application.mainServices.scheduleWithFixedDelay(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 160 | + Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 161 | 161 | |
| 162 | 162 | //指令持久化线程 |
| 163 | 163 | Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | ... | ... |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| 1 | 1 | |
| 2 | 2 | package com.bsth.data.schedule.late_adjust; |
| 3 | 3 | |
| 4 | +import com.bsth.data.LineConfigData; | |
| 5 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 4 | 7 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | +import com.bsth.websocket.handler.SendUtils; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.beans.BeansException; | |
| 12 | +import org.springframework.context.ApplicationContext; | |
| 13 | +import org.springframework.context.ApplicationContextAware; | |
| 14 | +import org.springframework.stereotype.Component; | |
| 5 | 15 | |
| 16 | +import java.util.Collection; | |
| 17 | +import java.util.HashMap; | |
| 6 | 18 | import java.util.Map; |
| 7 | 19 | |
| 8 | 20 | /** |
| 9 | - * 误点调整处理程序 | |
| 21 | + * 误点自动调整待发 处理程序 | |
| 22 | + * | |
| 23 | + * 注意 :这里的误点是指应发未到 | |
| 10 | 24 | * Created by panzhao on 2017/4/16. |
| 11 | 25 | */ |
| 12 | -public class LateAdjustHandle { | |
| 26 | +@Component | |
| 27 | +public class LateAdjustHandle implements ApplicationContextAware{ | |
| 28 | + | |
| 29 | + static LineConfigData lineConfigData; | |
| 30 | + static SendUtils sendUtils; | |
| 31 | + | |
| 32 | + static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class); | |
| 13 | 33 | |
| 14 | 34 | /** |
| 15 | - * 误点的车辆 和 班次 | |
| 35 | + * 应发未到车辆 和 班次 | |
| 16 | 36 | */ |
| 17 | 37 | private static Map<String, ScheduleRealInfo> lateSchMap; |
| 18 | 38 | |
| 19 | 39 | |
| 40 | + static { | |
| 41 | + lateSchMap = new HashMap<>(); | |
| 42 | + } | |
| 43 | + | |
| 20 | 44 | /** |
| 21 | - * 误点的班次ID 和 停靠时间(秒) | |
| 45 | + * 新增一个误点班次 | |
| 46 | + * @param sch | |
| 22 | 47 | */ |
| 23 | - private static Map<Long, Integer> stopTimeMap; | |
| 48 | + public static void putLate(ScheduleRealInfo sch){ | |
| 49 | + try { | |
| 50 | + //线路配置 | |
| 51 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 52 | + if(sch.getLateMinute() == 0){ | |
| 53 | + if(config.isEnableYjtk()){ | |
| 54 | + sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute()); | |
| 55 | + } | |
| 56 | + else | |
| 57 | + return; | |
| 58 | + } | |
| 59 | + | |
| 60 | + if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0 | |
| 61 | + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ | |
| 62 | + | |
| 63 | + ScheduleRealInfo cancel = null; | |
| 64 | + //之前存在误点班次没有发出 | |
| 65 | + ScheduleRealInfo old = lateSchMap.get(sch.getClZbh()); | |
| 66 | + if(old != null && old.getDfsjT() < sch.getDfsjT()){ | |
| 67 | + remove(old); | |
| 68 | + cancel = old; | |
| 69 | + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | |
| 70 | + } | |
| 71 | + | |
| 72 | + lateSchMap.put(sch.getClZbh(), sch); | |
| 73 | + //通知客户端 | |
| 74 | + sch.setLate2(true); | |
| 75 | + sendUtils.sendAutoWdtz(sch, cancel); | |
| 76 | + | |
| 77 | + logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | |
| 78 | + } | |
| 79 | + }catch (Exception e){ | |
| 80 | + logger.error("", e); | |
| 81 | + } | |
| 82 | + } | |
| 24 | 83 | |
| 25 | 84 | |
| 26 | 85 | /** |
| 27 | - * 班次误点(考虑停靠时间) | |
| 28 | - * @param sch | |
| 86 | + * 获取所有应发未到的班次 | |
| 87 | + * @return | |
| 29 | 88 | */ |
| 30 | - public static void schLate(ScheduleRealInfo sch){ | |
| 89 | + public static Collection<ScheduleRealInfo> allLateSch(){ | |
| 90 | + return lateSchMap.values(); | |
| 91 | + } | |
| 92 | + | |
| 93 | + public static void remove(ScheduleRealInfo sch){ | |
| 94 | + try { | |
| 95 | + if(lateSchMap.get(sch.getClZbh()) == sch){ | |
| 96 | + lateSchMap.remove(sch.getClZbh()); | |
| 97 | + sch.setLate2(false); | |
| 98 | + sch.setLateMinute(0); | |
| 99 | + } | |
| 100 | + }catch (Exception e){ | |
| 101 | + logger.error("", e); | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 车辆到站 | |
| 107 | + * @param gps | |
| 108 | + */ | |
| 109 | + public static void carArrive(GpsEntity gps){ | |
| 110 | + try{ | |
| 111 | + if(gps.getInstation() != 1) | |
| 112 | + return; | |
| 113 | + | |
| 114 | + ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm()); | |
| 115 | + if(sch == null) | |
| 116 | + return; | |
| 117 | + | |
| 118 | + //进的是班次起点 | |
| 119 | + if(gps.getStopNo().equals(sch.getQdzCode()) | |
| 120 | + && sch.getLateMinute() > 0){ | |
| 121 | + //自动调整待发 到达时间 + 停靠时间 | |
| 122 | + long dt = gps.getTimestamp() + (Long.parseLong(String.valueOf(sch.getLateMinute() * 60 * 1000))); | |
| 123 | + sch.setDfsjAll(dt); | |
| 124 | + sch.setDfAuto(true); | |
| 125 | + | |
| 126 | + lateSchMap.remove(sch.getClZbh()); | |
| 127 | + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); | |
| 128 | + } | |
| 129 | + }catch (Exception e){ | |
| 130 | + logger.error("", e); | |
| 131 | + } | |
| 132 | + } | |
| 31 | 133 | |
| 134 | + @Override | |
| 135 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | |
| 136 | + lineConfigData = applicationContext.getBean(LineConfigData.class); | |
| 137 | + sendUtils = applicationContext.getBean(SendUtils.class); | |
| 32 | 138 | } |
| 33 | 139 | } | ... | ... |
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
| ... | ... | @@ -5,6 +5,7 @@ import com.bsth.data.schedule.DayOfSchedule; |
| 5 | 5 | import com.bsth.data.schedule.ScheduleComparator; |
| 6 | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 7 | 7 | import com.bsth.websocket.handler.SendUtils; |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 10 | import org.springframework.stereotype.Component; |
| 10 | 11 | |
| ... | ... | @@ -43,12 +44,22 @@ public class ScheduleLateThread extends Thread{ |
| 43 | 44 | ScheduleRealInfo sch; |
| 44 | 45 | for(int i = 0; i < size; i ++){ |
| 45 | 46 | sch = all.get(i); |
| 46 | - if(sch.getDfsjT() > t) | |
| 47 | + if(sch.getDfsjT() > t || sch.isLate()) | |
| 47 | 48 | break; |
| 48 | - | |
| 49 | - if(sch.isLate() == false | |
| 50 | - && sch.getStatus() == 0 | |
| 49 | + | |
| 50 | + if(sch.getStatus() == 0 | |
| 51 | 51 | && sch.getFcsjActual() == null){ |
| 52 | + | |
| 53 | + //检查应发未到 当前班次无起点到达时间 | |
| 54 | + if(StringUtils.isEmpty(sch.getQdzArrDateSJ())){ | |
| 55 | + ScheduleRealInfo prev = dayOfSchedule.prev(sch); | |
| 56 | + //上一个班次也没有实际终点到达时间 | |
| 57 | + if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){ | |
| 58 | + //进入误点调整程序 | |
| 59 | + LateAdjustHandle.putLate(sch); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 52 | 63 | //应发未发 |
| 53 | 64 | sch.setLate(true); |
| 54 | 65 | //通知客户端 | ... | ... |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java
| ... | ... | @@ -21,6 +21,11 @@ public class OilStationSociety { |
| 21 | 21 | private String stationName; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | + * 加油站编码(为空则默认社会加油站) | |
| 25 | + */ | |
| 26 | + private String stationCode; | |
| 27 | + | |
| 28 | + /** | |
| 24 | 29 | * 上行进场距离 |
| 25 | 30 | */ |
| 26 | 31 | private Double upInMile; |
| ... | ... | @@ -137,4 +142,12 @@ public class OilStationSociety { |
| 137 | 142 | public void setDownOutTime(int downOutTime) { |
| 138 | 143 | this.downOutTime = downOutTime; |
| 139 | 144 | } |
| 145 | + | |
| 146 | + public String getStationCode() { | |
| 147 | + return stationCode; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public void setStationCode(String stationCode) { | |
| 151 | + this.stationCode = stationCode; | |
| 152 | + } | |
| 140 | 153 | } | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -139,10 +139,17 @@ public class ScheduleRealInfo { |
| 139 | 139 | /** 是否是临加班次 */ |
| 140 | 140 | private boolean sflj; |
| 141 | 141 | |
| 142 | - /** 是否误点*/ | |
| 142 | + /** 是否误点 (应发未发)*/ | |
| 143 | 143 | @Transient |
| 144 | 144 | private boolean late; |
| 145 | 145 | |
| 146 | + /** 是否误点 (应发未到) */ | |
| 147 | + @Transient | |
| 148 | + private boolean late2; | |
| 149 | + /** 误点停靠时间 */ | |
| 150 | + @Transient | |
| 151 | + private float lateMinute; | |
| 152 | + | |
| 146 | 153 | /** 备注*/ |
| 147 | 154 | private String remarks; |
| 148 | 155 | |
| ... | ... | @@ -887,4 +894,20 @@ public class ScheduleRealInfo { |
| 887 | 894 | public void setRemark(String remark) { |
| 888 | 895 | this.remark = remark; |
| 889 | 896 | } |
| 897 | + | |
| 898 | + public float getLateMinute() { | |
| 899 | + return lateMinute; | |
| 900 | + } | |
| 901 | + | |
| 902 | + public void setLateMinute(float lateMinute) { | |
| 903 | + this.lateMinute = lateMinute; | |
| 904 | + } | |
| 905 | + | |
| 906 | + public boolean isLate2() { | |
| 907 | + return late2; | |
| 908 | + } | |
| 909 | + | |
| 910 | + public void setLate2(boolean late2) { | |
| 911 | + this.late2 = late2; | |
| 912 | + } | |
| 890 | 913 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -161,4 +161,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 161 | 161 | void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type); |
| 162 | 162 | |
| 163 | 163 | Map<String,Object> revokeRealArrive(Long id); |
| 164 | + | |
| 165 | + Map<String,Object> lateAdjust(String idx, float minute); | |
| 166 | + | |
| 167 | + List<ScheduleRealInfo> allLate2(String idx); | |
| 164 | 168 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -13,6 +13,7 @@ import com.bsth.data.LineConfigData; |
| 13 | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 14 | 14 | import com.bsth.data.schedule.SchAttrCalculator; |
| 15 | 15 | import com.bsth.data.schedule.ScheduleComparator; |
| 16 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 16 | 17 | import com.bsth.entity.Cars; |
| 17 | 18 | import com.bsth.entity.Line; |
| 18 | 19 | import com.bsth.entity.Personnel; |
| ... | ... | @@ -176,6 +177,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 176 | 177 | schedule.setDfsjAll(dfsj); |
| 177 | 178 | schedule.addRemarks(remarks); |
| 178 | 179 | |
| 180 | + //取消应发未到标记 | |
| 181 | + if(schedule.isLate2()){ | |
| 182 | + schedule.setLate2(false); | |
| 183 | + LateAdjustHandle.remove(schedule); | |
| 184 | + } | |
| 185 | + | |
| 179 | 186 | List<ScheduleRealInfo> ts = new ArrayList<>(); |
| 180 | 187 | ts.add(schedule); |
| 181 | 188 | //调整终点时间和下一个班次的应到时间 |
| ... | ... | @@ -826,9 +833,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 826 | 833 | sch.setFcsjActualAll(fcsjActual); |
| 827 | 834 | sch.addRemarks(remarks); |
| 828 | 835 | sch.calcStatus(); |
| 836 | + if(sch.isLate2()){ | |
| 837 | + //取消应发未到标记 | |
| 838 | + sch.setLate2(false); | |
| 839 | + LateAdjustHandle.remove(sch); | |
| 840 | + } | |
| 829 | 841 | |
| 830 | 842 | dayOfSchedule.save(sch); |
| 831 | - //scheduleRealInfoRepository.save(sch); | |
| 832 | 843 | |
| 833 | 844 | ts.add(sch); |
| 834 | 845 | |
| ... | ... | @@ -1015,8 +1026,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1015 | 1026 | t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual); |
| 1016 | 1027 | |
| 1017 | 1028 | //调整实发 |
| 1018 | - if (!fcsjActual.equals(sch.getFcsjActual())) | |
| 1029 | + if (!fcsjActual.equals(sch.getFcsjActual())){ | |
| 1019 | 1030 | sch.setFcsjActualAll(t); |
| 1031 | + | |
| 1032 | + //取消应发未到标记 | |
| 1033 | + if(sch.isLate2()){ | |
| 1034 | + sch.setLate2(false); | |
| 1035 | + LateAdjustHandle.remove(sch); | |
| 1036 | + } | |
| 1037 | + } | |
| 1020 | 1038 | } else { |
| 1021 | 1039 | //撤销实发 |
| 1022 | 1040 | if (sch.getFcsjActual() != null) |
| ... | ... | @@ -1107,6 +1125,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1107 | 1125 | //重新计算是否误点 |
| 1108 | 1126 | schedule.reCalcLate(); |
| 1109 | 1127 | |
| 1128 | + //取消应发未到标记 | |
| 1129 | + if(schedule.isLate2()){ | |
| 1130 | + schedule.setLate2(false); | |
| 1131 | + LateAdjustHandle.remove(schedule); | |
| 1132 | + } | |
| 1110 | 1133 | dayOfSchedule.save(schedule); |
| 1111 | 1134 | } |
| 1112 | 1135 | |
| ... | ... | @@ -4093,4 +4116,53 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4093 | 4116 | } |
| 4094 | 4117 | return rs; |
| 4095 | 4118 | } |
| 4119 | + | |
| 4120 | + @Override | |
| 4121 | + public Map<String, Object> lateAdjust(String idx, float minute) { | |
| 4122 | + Map<String, Object> rs = new HashMap<>(); | |
| 4123 | + try { | |
| 4124 | + int count = 0; | |
| 4125 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 4126 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 4127 | + | |
| 4128 | + ScheduleRealInfo sch; | |
| 4129 | + for(String id : ids){ | |
| 4130 | + sch = dayOfSchedule.get(Long.parseLong(id)); | |
| 4131 | + if(sch != null && sch.getStatus() == 0){ | |
| 4132 | + if(minute > 0){ | |
| 4133 | + sch.setLateMinute(minute); | |
| 4134 | + } | |
| 4135 | + else if(minute == 0){ | |
| 4136 | + LateAdjustHandle.remove(sch); | |
| 4137 | + } | |
| 4138 | + count ++; | |
| 4139 | + list.add(sch); | |
| 4140 | + } | |
| 4141 | + } | |
| 4142 | + | |
| 4143 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4144 | + rs.put("count", count); | |
| 4145 | + rs.put("ts", list); | |
| 4146 | + }catch (Exception e){ | |
| 4147 | + logger.error("", e); | |
| 4148 | + rs.put("status", ResponseCode.ERROR); | |
| 4149 | + rs.put("msg", e.getMessage()); | |
| 4150 | + } | |
| 4151 | + | |
| 4152 | + return rs; | |
| 4153 | + } | |
| 4154 | + | |
| 4155 | + @Override | |
| 4156 | + public List<ScheduleRealInfo> allLate2(String idx) { | |
| 4157 | + List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 4158 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 4159 | + | |
| 4160 | + Collection<ScheduleRealInfo> all = LateAdjustHandle.allLateSch(); | |
| 4161 | + for(ScheduleRealInfo sch : all){ | |
| 4162 | + if(ids.indexOf(sch.getXlBm()) != -1){ | |
| 4163 | + rs.add(sch); | |
| 4164 | + } | |
| 4165 | + } | |
| 4166 | + return rs; | |
| 4167 | + } | |
| 4096 | 4168 | } |
| 4097 | 4169 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -176,7 +176,7 @@ public class SendUtils{ |
| 176 | 176 | public void deviceOffline(GpsEntity gps){ |
| 177 | 177 | Map<String, Object> map = new HashMap<>(); |
| 178 | 178 | map.put("fn", "deviceOffline"); |
| 179 | - map.put("gps", gps);; | |
| 179 | + map.put("gps", gps); | |
| 180 | 180 | ObjectMapper mapper = new ObjectMapper(); |
| 181 | 181 | |
| 182 | 182 | try { |
| ... | ... | @@ -199,4 +199,26 @@ public class SendUtils{ |
| 199 | 199 | logger.error("", e); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | + | |
| 203 | + /** | |
| 204 | + * 通知客户端,开始进行误点调整 | |
| 205 | + * @param sch | |
| 206 | + */ | |
| 207 | + public void sendAutoWdtz(ScheduleRealInfo sch, ScheduleRealInfo cancel){ | |
| 208 | + Map<String, Object> map = new HashMap<>(); | |
| 209 | + map.put("fn", "auto_wdtz"); | |
| 210 | + map.put("id", sch.getId()); | |
| 211 | + if(cancel != null) | |
| 212 | + map.put("cancelId", cancel.getId()); | |
| 213 | + map.put("lineCode", sch.getXlBm()); | |
| 214 | + map.put("minute", sch.getLateMinute()); | |
| 215 | + ObjectMapper mapper = new ObjectMapper(); | |
| 216 | + | |
| 217 | + try { | |
| 218 | + socketHandler.sendMessageToLine(sch.getXlBm() ,mapper.writeValueAsString(map)); | |
| 219 | + | |
| 220 | + } catch (JsonProcessingException e) { | |
| 221 | + logger.error("", e); | |
| 222 | + } | |
| 223 | + } | |
| 202 | 224 | } | ... | ... |