Commit d6c6b5d3d4dac937803525a7dd5137cc1ef6b567
Update
Showing
36 changed files
with
1495 additions
and
148 deletions
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -125,7 +125,7 @@ public class XDApplication implements CommandLineRunner { |
| 125 | 125 | //检查班次误点 |
| 126 | 126 | sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); |
| 127 | 127 | //调度指令延迟入库 |
| 128 | - sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | |
| 128 | + sexec.scheduleWithFixedDelay(directivesPstThread, 180, 100, TimeUnit.SECONDS); | |
| 129 | 129 | |
| 130 | 130 | //运管处静态数据提交 |
| 131 | 131 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ... | ... |
src/main/java/com/bsth/controller/directive/DirectiveController.java
| ... | ... | @@ -31,7 +31,7 @@ public class DirectiveController { |
| 31 | 31 | |
| 32 | 32 | @Autowired |
| 33 | 33 | DirectiveService directiveService; |
| 34 | - | |
| 34 | + | |
| 35 | 35 | /** |
| 36 | 36 | * |
| 37 | 37 | * @Title: send60 |
| ... | ... | @@ -106,7 +106,7 @@ public class DirectiveController { |
| 106 | 106 | @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) |
| 107 | 107 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ |
| 108 | 108 | SysUser user = SecurityUtils.getCurrentUser(); |
| 109 | - return directiveService.upDownChange(nbbm, upDown, user.getUserName()); | |
| 109 | + return directiveService.send60Operation(nbbm, 0, upDown, user.getUserName()); | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| ... | ... | @@ -120,7 +120,7 @@ public class DirectiveController { |
| 120 | 120 | @RequestMapping(value = "/stateChange", method = RequestMethod.POST) |
| 121 | 121 | public int stateChange(@RequestParam String nbbm, @RequestParam Integer upDown, @RequestParam Integer state){ |
| 122 | 122 | SysUser user = SecurityUtils.getCurrentUser(); |
| 123 | - return directiveService.stateChange(nbbm, upDown, state, user.getUserName()); | |
| 123 | + return directiveService.send60Operation(nbbm, state, upDown, user.getUserName()); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** | ... | ... |
src/main/java/com/bsth/data/directive/DayOfDirectives.java
| ... | ... | @@ -166,7 +166,8 @@ public class DayOfDirectives { |
| 166 | 166 | if(null != d60Map.remove(d60.getMsgId())) |
| 167 | 167 | c60 ++; |
| 168 | 168 | } |
| 169 | - logger.info("清除60数据 ," + c60); | |
| 169 | + if(c60 > 0) | |
| 170 | + logger.info("清除60数据 ," + c60); | |
| 170 | 171 | |
| 171 | 172 | //找到该设备的64数据 |
| 172 | 173 | Collection<D64> d64s = d64Map.values(); |
| ... | ... | @@ -184,8 +185,9 @@ public class DayOfDirectives { |
| 184 | 185 | if(null != d64Map.remove(d64.getKey())) |
| 185 | 186 | c64 ++; |
| 186 | 187 | } |
| 187 | - | |
| 188 | - logger.info("清除64数据 ," + c64); | |
| 188 | + | |
| 189 | + if(c64 > 0) | |
| 190 | + logger.info("清除64数据 ," + c64); | |
| 189 | 191 | } |
| 190 | 192 | |
| 191 | 193 | public Collection<D60> all60(){ | ... | ... |
src/main/java/com/bsth/data/directive/DirectiveCreator.java
| ... | ... | @@ -42,7 +42,7 @@ public class DirectiveCreator { |
| 42 | 42 | * @return Directive60 返回类型 |
| 43 | 43 | * @throws |
| 44 | 44 | */ |
| 45 | - public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { | |
| 45 | + public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state,String lineCode) { | |
| 46 | 46 | Long timestamp = System.currentTimeMillis(); |
| 47 | 47 | |
| 48 | 48 | Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); |
| ... | ... | @@ -66,6 +66,7 @@ public class DirectiveCreator { |
| 66 | 66 | data.setCompanyCode(company); |
| 67 | 67 | data.setMsgId(msgId); |
| 68 | 68 | directive.setData(data); |
| 69 | + directive.setLineCode(lineCode); | |
| 69 | 70 | long serviceState; |
| 70 | 71 | try { |
| 71 | 72 | serviceState = Consts.SERVICE_STATE[upDown][state]; | ... | ... |
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
| ... | ... | @@ -47,6 +47,10 @@ public class DirectivesPstThread extends Thread { |
| 47 | 47 | if(d60.isDispatch()){ |
| 48 | 48 | ScheduleRealInfo sch = d60.getSch(); |
| 49 | 49 | //如果关联的班次已经不存在了,放弃入库 |
| 50 | + if(sch.isDeleted()){ | |
| 51 | + logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId()); | |
| 52 | + continue; | |
| 53 | + } | |
| 50 | 54 | if(dayOfSchedule.get(sch.getId()) == null){ |
| 51 | 55 | logger.warn("班次:" + sch.getId() + "不存在了,调度指令放弃入库。"); |
| 52 | 56 | continue; | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -40,9 +40,12 @@ public class GpsEntity { |
| 40 | 40 | /** 纬度 */ |
| 41 | 41 | private Float lat; |
| 42 | 42 | |
| 43 | - /** 发送时间戳 */ | |
| 43 | + /** GPS发送时间戳 */ | |
| 44 | 44 | private Long timestamp; |
| 45 | 45 | |
| 46 | + /** 网关收到时间 */ | |
| 47 | + private Long serverTimestamp; | |
| 48 | + | |
| 46 | 49 | /** 速度 */ |
| 47 | 50 | private Float speed; |
| 48 | 51 | |
| ... | ... | @@ -318,17 +321,33 @@ public class GpsEntity { |
| 318 | 321 | |
| 319 | 322 | long t = System.currentTimeMillis(); |
| 320 | 323 | |
| 321 | - if((t - this.getTimestamp()) > 1000 * 60){ | |
| 324 | + if((t - this.getServerTimestamp()) > 1000 * 60 * 2){ | |
| 322 | 325 | return false; |
| 323 | 326 | } |
| 324 | 327 | |
| 325 | - if((this.getTimestamp() - t) > 1000 * 60 * 3){ | |
| 328 | + if((this.getServerTimestamp() - t) > 1000 * 60 * 3){ | |
| 326 | 329 | return false; |
| 327 | 330 | } |
| 328 | 331 | return true; |
| 329 | 332 | } |
| 330 | 333 | |
| 334 | + /** | |
| 335 | + * 是否营运 | |
| 336 | + * @return | |
| 337 | + */ | |
| 338 | + public boolean isService(){ | |
| 339 | + return state!=null && state==0; | |
| 340 | + } | |
| 341 | + | |
| 331 | 342 | public boolean isOffline(){ |
| 332 | 343 | return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline"); |
| 333 | 344 | } |
| 345 | + | |
| 346 | + public Long getServerTimestamp() { | |
| 347 | + return serverTimestamp; | |
| 348 | + } | |
| 349 | + | |
| 350 | + public void setServerTimestamp(Long serverTimestamp) { | |
| 351 | + this.serverTimestamp = serverTimestamp; | |
| 352 | + } | |
| 334 | 353 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -110,6 +110,14 @@ public class GpsRealData { |
| 110 | 110 | return rs; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | + public GpsEntity getByNbbm(String nbbm){ | |
| 114 | + String device = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 115 | + if(StringUtils.isNotBlank(device)) | |
| 116 | + return get(device); | |
| 117 | + else | |
| 118 | + return null; | |
| 119 | + } | |
| 120 | + | |
| 113 | 121 | /** |
| 114 | 122 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws |
| 115 | 123 | */ | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
| ... | ... | @@ -3,8 +3,8 @@ package com.bsth.data.gpsdata.arrival.handlers; |
| 3 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | 4 | import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 5 | 5 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 6 | +import com.bsth.data.gpsdata.status_manager.GpsStatusManager; | |
| 6 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 8 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 9 | import com.bsth.service.directive.DirectiveService; |
| 10 | 10 | import org.slf4j.Logger; |
| ... | ... | @@ -24,28 +24,45 @@ public class CorrectSignalHandle extends SignalHandle { |
| 24 | 24 | @Autowired |
| 25 | 25 | DirectiveService directiveService; |
| 26 | 26 | |
| 27 | + @Autowired | |
| 28 | + GpsStatusManager gpsStatusManager; | |
| 29 | + | |
| 27 | 30 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 28 | 31 | |
| 29 | 32 | @Override |
| 30 | 33 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 31 | - Object task = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 34 | + ScheduleRealInfo task = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 32 | 35 | if(task == null) |
| 33 | 36 | return false; |
| 34 | - ScheduleRealInfo sch; | |
| 37 | + //ScheduleRealInfo sch; | |
| 35 | 38 | |
| 36 | 39 | //子任务 |
| 37 | - if(task.getClass().isAssignableFrom(ChildTaskPlan.class)){ | |
| 40 | + /*if(task.getClass().isAssignableFrom(ChildTaskPlan.class)){ | |
| 38 | 41 | ChildTaskPlan childTask = (ChildTaskPlan) task; |
| 39 | 42 | sch = childTask.getSchedule(); |
| 40 | 43 | } |
| 41 | 44 | else |
| 42 | - sch = (ScheduleRealInfo) task; | |
| 45 | + sch = (ScheduleRealInfo) task;*/ | |
| 43 | 46 | |
| 44 | - byte updown = Byte.parseByte(sch.getXlDir()); | |
| 47 | + byte updown = Byte.parseByte(task.getXlDir()); | |
| 45 | 48 | //走向 |
| 46 | 49 | if(gps.getUpDown() != updown){ |
| 47 | 50 | gps.setUpDown(updown); |
| 48 | - gps.setState(0); | |
| 51 | + //gps.setState(0); | |
| 52 | + } | |
| 53 | + | |
| 54 | + //(转发的数据不管) | |
| 55 | + if(gps.getSource() != 0){ | |
| 56 | + //gps=非营运 && 班次=非空驶 ;切换到营运状态 | |
| 57 | + if(!gps.isService() && | |
| 58 | + !dayOfSchedule.emptyService(task)){ | |
| 59 | + gpsStatusManager.changeServiceState(gps.getNbbm(), updown, 0, null); | |
| 60 | + } | |
| 61 | + | |
| 62 | + //需要切换线路 | |
| 63 | + if(!task.getXlBm().equals(gps.getLineId())){ | |
| 64 | + gpsStatusManager.changeLine(gps.getNbbm(), task.getXlBm(), null); | |
| 65 | + } | |
| 49 | 66 | } |
| 50 | 67 | |
| 51 | 68 | return true; | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -6,6 +6,7 @@ import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 6 | 6 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 7 | 7 | import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| 8 | 8 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; |
| 9 | +import com.bsth.data.gpsdata.status_manager.GpsStatusManager; | |
| 9 | 10 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 10 | 11 | import com.bsth.data.schedule.DayOfSchedule; |
| 11 | 12 | import com.bsth.data.schedule.ScheduleComparator; |
| ... | ... | @@ -46,6 +47,9 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 46 | 47 | @Autowired |
| 47 | 48 | SignalSchPlanMatcher signalSchPlanMatcher; |
| 48 | 49 | |
| 50 | + @Autowired | |
| 51 | + GpsStatusManager gpsStatusManager; | |
| 52 | + | |
| 49 | 53 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 120; |
| 50 | 54 | |
| 51 | 55 | //最大的班次时间差,防止异常的GPS时间打乱数据 |
| ... | ... | @@ -57,10 +61,11 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 57 | 61 | if(isGpsOffline(gps)) |
| 58 | 62 | return false; |
| 59 | 63 | |
| 60 | - //从异常状态恢复的第一个信号 | |
| 64 | + /*//从异常状态恢复的第一个信号*/ | |
| 61 | 65 | if(abnormalRecovery(gps, prevs)){ |
| 62 | 66 | //回溯一下之前的轨迹 |
| 63 | - scheduleSignalState.signalRetrospect(gps); | |
| 67 | + //scheduleSignalState.signalRetrospect(gps); | |
| 68 | + return false; | |
| 64 | 69 | } |
| 65 | 70 | |
| 66 | 71 | if(isNotEmpty(prevs)){ |
| ... | ... | @@ -154,10 +159,9 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 154 | 159 | //清理应发未发标记 |
| 155 | 160 | LateAdjustHandle.remove(sch); |
| 156 | 161 | |
| 157 | - if(sch.getBcType().equals("out")){ | |
| 158 | - //出场时,切换成营运状态 | |
| 159 | - DirectivePushQueue.put6003(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); | |
| 160 | - //directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); | |
| 162 | + if(!gps.isService()){ | |
| 163 | + //切换成营运状态 | |
| 164 | + gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统"); | |
| 161 | 165 | } |
| 162 | 166 | //出站既出场 |
| 163 | 167 | outStationAndOutPark(sch); |
| ... | ... | @@ -232,11 +236,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 232 | 236 | sendUtils.refreshSch(schPrev); |
| 233 | 237 | dayOfSchedule.save(schPrev); |
| 234 | 238 | |
| 235 | - if(schPrev.getBcType().equals("out")){ | |
| 239 | + /*if(schPrev.getBcType().equals("out")){ | |
| 236 | 240 | //出场时,切换成营运状态 |
| 237 | - DirectivePushQueue.put6003(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); | |
| 241 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); | |
| 242 | + gpsStatusManager.changeServiceState(deviceId, schPrev.getXlDir(), 0, "出场@系统"); | |
| 243 | + //DirectivePushQueue.put6003(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), "出场@系统"); | |
| 238 | 244 | //directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); |
| 239 | - } | |
| 245 | + }*/ | |
| 240 | 246 | } |
| 241 | 247 | } |
| 242 | 248 | } |
| ... | ... | @@ -265,6 +271,15 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 265 | 271 | if(Math.abs(diff) > MAX_NORMAL_DIFF) |
| 266 | 272 | return; |
| 267 | 273 | |
| 274 | + //环线或内外圈 ,飘出去再回来 | |
| 275 | + if(sch.getQdzCode().equals(sch.getZdzCode()) | |
| 276 | + && StringUtils.isNotEmpty(sch.getFcsjActual()) | |
| 277 | + && gps.getTimestamp() - sch.getFcsjActualTime() < 1000 * 60 * 3){ | |
| 278 | + sch.clearFcsjActual(); | |
| 279 | + sendUtils.refreshSch(sch); | |
| 280 | + return; | |
| 281 | + } | |
| 282 | + | |
| 268 | 283 | //实达时间不覆盖 |
| 269 | 284 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) |
| 270 | 285 | return; |
| ... | ... | @@ -304,26 +319,23 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 304 | 319 | transformUpdown(gps, next); |
| 305 | 320 | //下发调度指令 |
| 306 | 321 | DirectivePushQueue.put6002(next, doneSum, "到站@系统"); |
| 307 | - //directiveService.send60Dispatch(next, doneSum, "到站@系统"); | |
| 308 | 322 | |
| 309 | 323 | //套跑 -下发线路切换指令 |
| 310 | 324 | if(!next.getXlBm().equals(sch.getXlBm())){ |
| 311 | - DirectivePushQueue.put64(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 312 | - //directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 325 | + gpsStatusManager.changeLine(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 313 | 326 | } |
| 314 | 327 | } |
| 315 | 328 | else if(sch.getBcType().equals("in")){ |
| 316 | - //终班进场,切换成非营运状态 | |
| 317 | - DirectivePushQueue.put6003(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统"); | |
| 318 | - //directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统"); | |
| 329 | + //进场,切换成非营运状态 | |
| 330 | + gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统"); | |
| 319 | 331 | } |
| 320 | 332 | } |
| 321 | 333 | else { |
| 322 | - if(sch.getFcsjActual() == null){ | |
| 334 | + /*if(sch.getFcsjActual() == null){ | |
| 323 | 335 | //有进站,但班次没有实发,向前追溯一下信号 |
| 324 | 336 | scheduleSignalState.signalRetrospect(gps, sch); |
| 325 | 337 | } |
| 326 | - | |
| 338 | +*/ | |
| 327 | 339 | //如果当前班次是出场,并且进的是下一个班次的终点 |
| 328 | 340 | if(sch.getBcType().equals("out")){ |
| 329 | 341 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| ... | ... | @@ -397,6 +409,9 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 397 | 409 | next = dayOfSchedule.next(next); |
| 398 | 410 | if(next != null) |
| 399 | 411 | dayOfSchedule.addExecPlan(next); |
| 412 | + | |
| 413 | + //进场,切换成非营运状态 | |
| 414 | + gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 1, "进场@系统"); | |
| 400 | 415 | } |
| 401 | 416 | } |
| 402 | 417 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
| ... | ... | @@ -23,7 +23,7 @@ public class OfflineSignalHandle extends SignalHandle{ |
| 23 | 23 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 24 | 24 | //掉线信号不管 |
| 25 | 25 | if(isGpsOffline(gps)){ |
| 26 | - gps.setSignalState("drift"); | |
| 26 | + gps.setSignalState("gps-offline"); | |
| 27 | 27 | gps.setAbnormalStatus("gps-offline"); |
| 28 | 28 | return true; |
| 29 | 29 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| ... | ... | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 84 | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | |
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=" + dayOfYear; | |
| 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=194";// + dayOfYear; | |
| 88 | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | |
| 90 | 90 | List<GpsEntity> list = | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/GpsStatusManager.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.status_manager; | |
| 2 | + | |
| 3 | +import com.bsth.Application; | |
| 4 | +import com.bsth.data.gpsdata.status_manager.gps_line_state.LineStateHandle; | |
| 5 | +import com.bsth.data.gpsdata.status_manager.gps_service_state.ServiceStateHandle; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.boot.CommandLineRunner; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +import java.util.concurrent.TimeUnit; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * GPS 状态管理 | |
| 14 | + * Created by panzhao on 2017/7/13. | |
| 15 | + */ | |
| 16 | +@Component | |
| 17 | +public class GpsStatusManager implements CommandLineRunner { | |
| 18 | + | |
| 19 | + @Autowired | |
| 20 | + StatusCheckThread checkThread; | |
| 21 | + | |
| 22 | + @Autowired | |
| 23 | + LineStateHandle lineStateHandle; | |
| 24 | + | |
| 25 | + @Autowired | |
| 26 | + ServiceStateHandle serviceStateHandle; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 切换线路 | |
| 30 | + * @param nbbm | |
| 31 | + * @param lineCode | |
| 32 | + * @param sender | |
| 33 | + */ | |
| 34 | + public void changeLine(String nbbm, String lineCode, String sender){ | |
| 35 | + lineStateHandle.changeLine(nbbm, lineCode, sender); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 切换营运状态 | |
| 40 | + * @param nbbm | |
| 41 | + * @param state 0 营运, 1:非营运 | |
| 42 | + * @param sender | |
| 43 | + */ | |
| 44 | + public void changeServiceState(String nbbm, String upDown,int state, String sender){ | |
| 45 | + changeServiceState(nbbm, Integer.parseInt(upDown), state, sender); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 切换营运状态 | |
| 50 | + * @param nbbm | |
| 51 | + * @param state 0 营运, 1:非营运 | |
| 52 | + * @param sender | |
| 53 | + */ | |
| 54 | + public void changeServiceState(String nbbm, int upDown,int state, String sender){ | |
| 55 | + serviceStateHandle.changeState(nbbm, upDown, state, sender); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + public void run(String... strings) throws Exception { | |
| 60 | + Application.mainServices.scheduleWithFixedDelay(checkThread, 120, 120, TimeUnit.SECONDS); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Component | |
| 64 | + public static class StatusCheckThread extends Thread{ | |
| 65 | + | |
| 66 | + @Autowired | |
| 67 | + LineStateHandle lineStateHandle; | |
| 68 | + | |
| 69 | + @Autowired | |
| 70 | + ServiceStateHandle serviceStateHandle; | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public void run() { | |
| 74 | + /** 检查线路切换结果 */ | |
| 75 | + lineStateHandle.checkResultAll(); | |
| 76 | + /** 检查营运状态切换结果 */ | |
| 77 | + serviceStateHandle.checkResultAll(); | |
| 78 | + } | |
| 79 | + } | |
| 80 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_line_state/ChangeBean.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.status_manager.gps_line_state; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2017/7/13. | |
| 5 | + */ | |
| 6 | +public class ChangeBean { | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * 车辆自编号 | |
| 10 | + */ | |
| 11 | + private String nbbm; | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 要切换到的线路 | |
| 15 | + */ | |
| 16 | + private String lineCode; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 指令发送次数 | |
| 20 | + */ | |
| 21 | + private int sendCount; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 上次指令时间 | |
| 25 | + */ | |
| 26 | + private long st; | |
| 27 | + | |
| 28 | + /**发送人 */ | |
| 29 | + private String sender; | |
| 30 | + | |
| 31 | + public static ChangeBean getInstance(String nbbm, String lineCode, String sender){ | |
| 32 | + ChangeBean cb = new ChangeBean(); | |
| 33 | + cb.setNbbm(nbbm); | |
| 34 | + cb.setLineCode(lineCode); | |
| 35 | + cb.setSendCount(0); | |
| 36 | + cb.setSender(sender); | |
| 37 | + return cb; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void countPlus(){ | |
| 41 | + sendCount ++; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getLineCode() { | |
| 45 | + return lineCode; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setLineCode(String lineCode) { | |
| 49 | + this.lineCode = lineCode; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public int getSendCount() { | |
| 53 | + return sendCount; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setSendCount(int sendCount) { | |
| 57 | + this.sendCount = sendCount; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public long getSt() { | |
| 61 | + return st; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setSt(long st) { | |
| 65 | + this.st = st; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getSender() { | |
| 69 | + return sender; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setSender(String sender) { | |
| 73 | + this.sender = sender; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public String getNbbm() { | |
| 77 | + return nbbm; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setNbbm(String nbbm) { | |
| 81 | + this.nbbm = nbbm; | |
| 82 | + } | |
| 83 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_line_state/LineStateHandle.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.status_manager.gps_line_state; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 4 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 5 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 6 | +import com.bsth.service.directive.DirectiveService; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import java.util.Collection; | |
| 13 | +import java.util.concurrent.ConcurrentHashMap; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 设备线路状态处理 | |
| 17 | + * Created by panzhao on 2017/7/13. | |
| 18 | + */ | |
| 19 | +@Component | |
| 20 | +public class LineStateHandle { | |
| 21 | + | |
| 22 | + private static ConcurrentHashMap<String, ChangeBean> map; | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + DirectiveService directiveService; | |
| 26 | + @Autowired | |
| 27 | + GpsRealData gpsRealData; | |
| 28 | + | |
| 29 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 30 | + | |
| 31 | + /** 重发次数 */ | |
| 32 | + private final static int MAX_SEND_COUNT=3; | |
| 33 | + /** 重发间隔 */ | |
| 34 | + private final static int SEND_SPACE=1000 * 60 * 5; | |
| 35 | + /** 最大有效时间 */ | |
| 36 | + private final static int MAX_AVAIL_TIME=1000 * 60 * 60 * 2; | |
| 37 | + | |
| 38 | + static{ | |
| 39 | + map = new ConcurrentHashMap(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void changeLine(String nbbm, String lineCode, String sender){ | |
| 43 | + ChangeBean cb = map.get(nbbm); | |
| 44 | + if(cb != null && cb.getLineCode().equals(lineCode)){ | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + | |
| 48 | + cb = ChangeBean.getInstance(nbbm, lineCode, sender); | |
| 49 | + map.put(nbbm, cb); | |
| 50 | + | |
| 51 | + changeLine(cb); | |
| 52 | + } | |
| 53 | + | |
| 54 | + private void changeLine(ChangeBean cb){ | |
| 55 | + cb.setSt(System.currentTimeMillis()); | |
| 56 | + cb.countPlus(); | |
| 57 | + DirectivePushQueue.put64(cb.getNbbm(), cb.getLineCode(), cb.getSender()); | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + public void checkResultAll(){ | |
| 62 | + Collection<ChangeBean> cbs = map.values(); | |
| 63 | + for(ChangeBean cb : cbs){ | |
| 64 | + checkResult(cb); | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + private void checkResult(ChangeBean cb){ | |
| 69 | + try{ | |
| 70 | + GpsEntity gps = gpsRealData.getByNbbm(cb.getNbbm()); | |
| 71 | + if(gps == null) | |
| 72 | + return; | |
| 73 | + | |
| 74 | + if(cb.getLineCode().equals(gps.getLineId())){ | |
| 75 | + map.remove(cb.getNbbm()); | |
| 76 | + logger.info("线路切换成功," + cb.getNbbm() + "、" + cb.getLineCode()); | |
| 77 | + } | |
| 78 | + else{ | |
| 79 | + reSend(cb); | |
| 80 | + } | |
| 81 | + }catch (Exception e){ | |
| 82 | + logger.error("", e); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + private void reSend(ChangeBean cb){ | |
| 87 | + if(cb.getSendCount() >= MAX_SEND_COUNT){ | |
| 88 | + map.remove(cb.getNbbm()); | |
| 89 | + logger.info("超过重发次数," + cb.getNbbm() + "、" + cb.getLineCode()); | |
| 90 | + return; | |
| 91 | + } | |
| 92 | + | |
| 93 | + long diff = System.currentTimeMillis() - cb.getSt(); | |
| 94 | + if(diff >= MAX_AVAIL_TIME){ | |
| 95 | + map.remove(cb.getNbbm()); | |
| 96 | + logger.info("超过有效时间," + cb.getNbbm() + "、" + cb.getLineCode() + "、" + cb.getSt()); | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + | |
| 100 | + if(diff >= SEND_SPACE){ | |
| 101 | + cb.setSender("补发@系统"); | |
| 102 | + changeLine(cb); | |
| 103 | + logger.info("重发线路切换指令," + cb.getNbbm() + "、" + cb.getLineCode()); | |
| 104 | + return; | |
| 105 | + } | |
| 106 | + } | |
| 107 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_service_state/ServiceStateHandle.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.status_manager.gps_service_state; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 4 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 5 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 6 | +import com.bsth.service.directive.DirectiveService; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import java.util.Collection; | |
| 13 | +import java.util.concurrent.ConcurrentHashMap; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 设备营运状态处理 | |
| 17 | + * Created by panzhao on 2017/7/13. | |
| 18 | + */ | |
| 19 | +@Component | |
| 20 | +public class ServiceStateHandle { | |
| 21 | + | |
| 22 | + private static ConcurrentHashMap<String, StateBean> map; | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + DirectiveService directiveService; | |
| 26 | + @Autowired | |
| 27 | + GpsRealData gpsRealData; | |
| 28 | + | |
| 29 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 30 | + | |
| 31 | + /** 重发次数 */ | |
| 32 | + private final static int MAX_SEND_COUNT=3; | |
| 33 | + /** 重发间隔 */ | |
| 34 | + private final static int SEND_SPACE=1000 * 60 * 4; | |
| 35 | + /** 最大有效时间 */ | |
| 36 | + private final static int MAX_AVAIL_TIME=1000 * 60 * 60; | |
| 37 | + | |
| 38 | + static{ | |
| 39 | + map = new ConcurrentHashMap(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void changeState(String nbbm, int upDown ,int state, String sender){ | |
| 43 | + if(map.containsKey(nbbm)){ | |
| 44 | + return; | |
| 45 | + } | |
| 46 | + StateBean sb = StateBean.getInstance(nbbm, upDown, state, sender); | |
| 47 | + map.put(nbbm, sb); | |
| 48 | + changeState(sb); | |
| 49 | + } | |
| 50 | + | |
| 51 | + private void changeState(StateBean sb){ | |
| 52 | + sb.setSt(System.currentTimeMillis()); | |
| 53 | + sb.countPlus(); | |
| 54 | + DirectivePushQueue.put6003(sb.getNbbm(), sb.getState(), sb.getUpDown(), sb.getSender()); | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void checkResultAll(){ | |
| 58 | + Collection<StateBean> sbs = map.values(); | |
| 59 | + for(StateBean sb : sbs){ | |
| 60 | + checkResult(sb); | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + private void checkResult(StateBean sb){ | |
| 65 | + try{ | |
| 66 | + GpsEntity gps = gpsRealData.getByNbbm(sb.getNbbm()); | |
| 67 | + if(gps == null) | |
| 68 | + return; | |
| 69 | + | |
| 70 | + if(gps.getState().equals(sb.getState())){ | |
| 71 | + map.remove(sb.getNbbm()); | |
| 72 | + logger.info("营运状态切换成功," + sb.getNbbm() + "、" + sb.getState()); | |
| 73 | + } | |
| 74 | + else | |
| 75 | + reSend(sb); | |
| 76 | + }catch (Exception e){ | |
| 77 | + logger.error("", e); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + private void reSend(StateBean sb){ | |
| 82 | + if(sb.getSendCount() >= MAX_SEND_COUNT){ | |
| 83 | + map.remove(sb.getNbbm()); | |
| 84 | + logger.info("超过重发次数," + sb.getNbbm() + "、" + sb.getState()); | |
| 85 | + return; | |
| 86 | + } | |
| 87 | + | |
| 88 | + long diff = System.currentTimeMillis() - sb.getSt(); | |
| 89 | + if(diff >= MAX_AVAIL_TIME){ | |
| 90 | + map.remove(sb.getNbbm()); | |
| 91 | + logger.info("营运状态切换超过有效时间," + sb.getNbbm() + "、" + sb.getState() + "、" + sb.getSt()); | |
| 92 | + return; | |
| 93 | + } | |
| 94 | + | |
| 95 | + if(diff >= SEND_SPACE){ | |
| 96 | + sb.setSender("补发@系统"); | |
| 97 | + changeState(sb); | |
| 98 | + logger.info("重发营运状态切换指令," + sb.getNbbm() + "、" + sb.getState()); | |
| 99 | + return; | |
| 100 | + } | |
| 101 | + } | |
| 102 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/status_manager/gps_service_state/StateBean.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.status_manager.gps_service_state; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2017/7/13. | |
| 5 | + */ | |
| 6 | +public class StateBean { | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * 车辆自编号 | |
| 10 | + */ | |
| 11 | + private String nbbm; | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 要切换到营运状态 | |
| 15 | + */ | |
| 16 | + private int state; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 要切换到的上下行 | |
| 20 | + */ | |
| 21 | + private int upDown; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 指令发送次数 | |
| 25 | + */ | |
| 26 | + private int sendCount; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 上次指令时间 | |
| 30 | + */ | |
| 31 | + private long st; | |
| 32 | + | |
| 33 | + /**发送人 */ | |
| 34 | + private String sender; | |
| 35 | + | |
| 36 | + public static StateBean getInstance(String nbbm, int upDown, int state, String sender){ | |
| 37 | + StateBean sb = new StateBean(); | |
| 38 | + sb.setNbbm(nbbm); | |
| 39 | + sb.setState(state); | |
| 40 | + sb.setSendCount(0); | |
| 41 | + sb.setSender(sender); | |
| 42 | + sb.setUpDown(upDown); | |
| 43 | + return sb; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public int getState() { | |
| 47 | + return state; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setState(int state) { | |
| 51 | + this.state = state; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public int getSendCount() { | |
| 55 | + return sendCount; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setSendCount(int sendCount) { | |
| 59 | + this.sendCount = sendCount; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public long getSt() { | |
| 63 | + return st; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setSt(long st) { | |
| 67 | + this.st = st; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getSender() { | |
| 71 | + return sender; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setSender(String sender) { | |
| 75 | + this.sender = sender; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void countPlus(){ | |
| 79 | + sendCount ++; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public int getUpDown() { | |
| 83 | + return upDown; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setUpDown(int upDown) { | |
| 87 | + this.upDown = upDown; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public String getNbbm() { | |
| 91 | + return nbbm; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setNbbm(String nbbm) { | |
| 95 | + this.nbbm = nbbm; | |
| 96 | + } | |
| 97 | +} | ... | ... |
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
| ... | ... | @@ -39,12 +39,12 @@ public class DirectivePushQueue implements CommandLineRunner, ApplicationContext |
| 39 | 39 | linkedList.add(qd6002); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public static void put6003(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender){ | |
| 42 | + public static void put6003(String nbbm, int state, int upDown, String sender){ | |
| 43 | 43 | QueueData_Directive qd6003 = new QueueData_Directive(); |
| 44 | 44 | qd6003.setNbbm(nbbm); |
| 45 | 45 | qd6003.setState(state); |
| 46 | 46 | qd6003.setUpDown(upDown); |
| 47 | - qd6003.setSch(sch); | |
| 47 | + //qd6003.setSch(sch); | |
| 48 | 48 | qd6003.setSender(sender); |
| 49 | 49 | |
| 50 | 50 | qd6003.setCode("60_03"); |
| ... | ... | @@ -111,7 +111,7 @@ public class DirectivePushQueue implements CommandLineRunner, ApplicationContext |
| 111 | 111 | log.info("directive 60_02 sch id: " + qd.getSch().getId()); |
| 112 | 112 | } |
| 113 | 113 | else if(code.equals("60_03")){ |
| 114 | - directiveService.send60Operation(qd.getNbbm(), qd.getState(), qd.getUpDown(), null, qd.getSender()); | |
| 114 | + directiveService.send60Operation(qd.getNbbm(), qd.getState(), qd.getUpDown(), qd.getSender()); | |
| 115 | 115 | log.info("directive 60_03 nbbm: " + qd.getNbbm()); |
| 116 | 116 | } |
| 117 | 117 | else if(code.equals("64")){ | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -2,7 +2,9 @@ package com.bsth.data.pilot80; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.LineConfigData; |
| 5 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 5 | 6 | import com.bsth.data.gpsdata.GpsRealData; |
| 7 | +import com.bsth.data.gpsdata.status_manager.GpsStatusManager; | |
| 6 | 8 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 7 | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | 10 | import com.bsth.entity.Line; |
| ... | ... | @@ -51,6 +53,9 @@ public class PilotReport { |
| 51 | 53 | @Autowired |
| 52 | 54 | DC0A4Repository dc0A4Repository; |
| 53 | 55 | |
| 56 | + @Autowired | |
| 57 | + GpsStatusManager gpsStatusManager; | |
| 58 | + | |
| 54 | 59 | //private static ArrayListMultimap<String, D80> d80MultiMap; |
| 55 | 60 | |
| 56 | 61 | private static ConcurrentHashMap<Integer, D80> d80Maps; |
| ... | ... | @@ -80,14 +85,26 @@ public class PilotReport { |
| 80 | 85 | ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out"); |
| 81 | 86 | //如果有对应出场班次 |
| 82 | 87 | if (outSch != null) { |
| 83 | - //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令 | |
| 88 | + //没有计划里程的出场班次,出场既是首发站,发送下一班次的调度指令 | |
| 84 | 89 | if (outSch.getJhlc() == null) |
| 85 | 90 | outSch = dayOfSchedule.next(outSch); |
| 86 | 91 | |
| 87 | 92 | //下发调度指令 |
| 93 | + String deviceId = d80.getDeviceId(); | |
| 88 | 94 | DirectivePushQueue.put6002(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); |
| 95 | + | |
| 89 | 96 | //下发线路切换指令 |
| 90 | 97 | DirectivePushQueue.put64(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); |
| 98 | + | |
| 99 | + try { | |
| 100 | + GpsEntity gps = gpsRealData.get(deviceId); | |
| 101 | + if(gps != null && !gps.isService()){ | |
| 102 | + //切换到营运状态 | |
| 103 | + gpsStatusManager.changeServiceState(nbbm, outSch.getXlDir() ,0, "请出@系统"); | |
| 104 | + } | |
| 105 | + }catch (Exception e){ | |
| 106 | + logger.error("请出切换营运状态异常", e); | |
| 107 | + } | |
| 91 | 108 | } |
| 92 | 109 | break; |
| 93 | 110 | } | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -4,12 +4,9 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.bsth.common.Constants; |
| 6 | 6 | import com.bsth.common.ResponseCode; |
| 7 | -import com.bsth.data.BasicData; | |
| 8 | 7 | import com.bsth.data.LineConfigData; |
| 9 | -import com.bsth.data.gpsdata.GpsEntity; | |
| 10 | 8 | import com.bsth.data.gpsdata.GpsRealData; |
| 11 | 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 12 | -import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 13 | 10 | import com.bsth.entity.realcontrol.LineConfig; |
| 14 | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 15 | 12 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -181,7 +178,7 @@ public class DayOfSchedule { |
| 181 | 178 | |
| 182 | 179 | |
| 183 | 180 | Set<String> lps = searchAllLP(list); |
| 184 | - for(String lp : lps){ | |
| 181 | + for (String lp : lps) { | |
| 185 | 182 | //计算“起点站应到”时间 |
| 186 | 183 | schAttrCalculator.calcQdzTimePlan(lpScheduleMap.get(lineCode + "_" + lp)); |
| 187 | 184 | } |
| ... | ... | @@ -201,14 +198,14 @@ public class DayOfSchedule { |
| 201 | 198 | return 0; |
| 202 | 199 | } |
| 203 | 200 | |
| 204 | - public int reloadSch(String lineCode){ | |
| 201 | + public int reloadSch(String lineCode) { | |
| 205 | 202 | return reloadSch(lineCode, calcSchDate(lineCode), true); |
| 206 | 203 | } |
| 207 | 204 | |
| 208 | 205 | /** |
| 209 | 206 | * @Title: searchAllCars |
| 210 | 207 | * @Description: TODO(搜索班次集合中的车辆) |
| 211 | - */ | |
| 208 | + */ | |
| 212 | 209 | private Set<String> searchAllCars(List<ScheduleRealInfo> list) { |
| 213 | 210 | Set<String> cars = new HashSet<>(); |
| 214 | 211 | for (ScheduleRealInfo sch : list) |
| ... | ... | @@ -277,12 +274,12 @@ public class DayOfSchedule { |
| 277 | 274 | //清理路牌对照 |
| 278 | 275 | List<String> lprms = new ArrayList<>(); |
| 279 | 276 | Set<String> lps = lpScheduleMap.keySet(); |
| 280 | - for(String lp : lps){ | |
| 281 | - if(lp.indexOf(lineCode + "_") != -1) | |
| 277 | + for (String lp : lps) { | |
| 278 | + if (lp.indexOf(lineCode + "_") != -1) | |
| 282 | 279 | lprms.add(lp); |
| 283 | 280 | } |
| 284 | 281 | |
| 285 | - for(String lp : lprms) | |
| 282 | + for (String lp : lprms) | |
| 286 | 283 | lpScheduleMap.removeAll(lp); |
| 287 | 284 | |
| 288 | 285 | logger.info(lineCode + "排班清理 " + count); |
| ... | ... | @@ -336,10 +333,10 @@ public class DayOfSchedule { |
| 336 | 333 | if (StringUtils.isEmpty(sch.getFcsj())) |
| 337 | 334 | sch.setFcsj("00:00"); |
| 338 | 335 | |
| 339 | - if(sch.getFcsj().equals("24:00")) | |
| 336 | + if (sch.getFcsj().equals("24:00")) | |
| 340 | 337 | sch.setFcsj("23:59"); |
| 341 | 338 | |
| 342 | - if(sch.getFcsj().substring(0, 2).equals("24")){ | |
| 339 | + if (sch.getFcsj().substring(0, 2).equals("24")) { | |
| 343 | 340 | sch.setFcsj("00" + sch.getFcsj().substring(2)); |
| 344 | 341 | } |
| 345 | 342 | |
| ... | ... | @@ -364,13 +361,13 @@ public class DayOfSchedule { |
| 364 | 361 | } |
| 365 | 362 | |
| 366 | 363 | //售票员为空设置为""字符串 |
| 367 | - if(StringUtils.isEmpty(sch.getsGh())){ | |
| 364 | + if (StringUtils.isEmpty(sch.getsGh())) { | |
| 368 | 365 | sch.setsGh(""); |
| 369 | 366 | sch.setsName(""); |
| 370 | 367 | } |
| 371 | 368 | sch.setJhlcOrig(sch.getJhlc()); |
| 372 | 369 | //保留备注 |
| 373 | - if(StringUtils.isNotEmpty(sch.getRemark())) | |
| 370 | + if (StringUtils.isNotEmpty(sch.getRemark())) | |
| 374 | 371 | sch.setRemarks(sch.getRemark()); |
| 375 | 372 | } |
| 376 | 373 | } catch (Exception e) { |
| ... | ... | @@ -440,7 +437,7 @@ public class DayOfSchedule { |
| 440 | 437 | |
| 441 | 438 | Collection<ScheduleRealInfo> schs = id2SchedulMap.values(); |
| 442 | 439 | for (ScheduleRealInfo sch : schs) { |
| 443 | - if(lineList.contains(sch.getXlBm())){ | |
| 440 | + if (lineList.contains(sch.getXlBm())) { | |
| 444 | 441 | mMap.put(sch.getXlBm(), sch); |
| 445 | 442 | } |
| 446 | 443 | } |
| ... | ... | @@ -497,12 +494,13 @@ public class DayOfSchedule { |
| 497 | 494 | |
| 498 | 495 | /** |
| 499 | 496 | * 下一个相同走向的班次 |
| 497 | + * | |
| 500 | 498 | * @param sch |
| 501 | 499 | * @return |
| 502 | 500 | */ |
| 503 | - public ScheduleRealInfo nextSame(final ScheduleRealInfo sch){ | |
| 501 | + public ScheduleRealInfo nextSame(final ScheduleRealInfo sch) { | |
| 504 | 502 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 505 | - Collection<ScheduleRealInfo> subList = Collections2.filter(list, new Predicate<ScheduleRealInfo>(){ | |
| 503 | + Collection<ScheduleRealInfo> subList = Collections2.filter(list, new Predicate<ScheduleRealInfo>() { | |
| 506 | 504 | |
| 507 | 505 | @Override |
| 508 | 506 | public boolean apply(ScheduleRealInfo item) { |
| ... | ... | @@ -544,11 +542,12 @@ public class DayOfSchedule { |
| 544 | 542 | |
| 545 | 543 | /** |
| 546 | 544 | * 下一个班次 |
| 545 | + * | |
| 547 | 546 | * @param list 班次集合 |
| 548 | - * @param sch 当前班次 | |
| 547 | + * @param sch 当前班次 | |
| 549 | 548 | * @return |
| 550 | 549 | */ |
| 551 | - private ScheduleRealInfo next(Collection<ScheduleRealInfo> list , ScheduleRealInfo sch){ | |
| 550 | + private ScheduleRealInfo next(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | |
| 552 | 551 | int outConfig = -1; |
| 553 | 552 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 554 | 553 | if (config != null) |
| ... | ... | @@ -583,11 +582,12 @@ public class DayOfSchedule { |
| 583 | 582 | |
| 584 | 583 | /** |
| 585 | 584 | * 下一个班次 |
| 585 | + * | |
| 586 | 586 | * @param list 班次集合 |
| 587 | - * @param sch 当前班次 | |
| 587 | + * @param sch 当前班次 | |
| 588 | 588 | * @return |
| 589 | 589 | */ |
| 590 | - private ScheduleRealInfo next2(Collection<ScheduleRealInfo> list , ScheduleRealInfo sch){ | |
| 590 | + private ScheduleRealInfo next2(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | |
| 591 | 591 | int outConfig = -1; |
| 592 | 592 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 593 | 593 | if (config != null) |
| ... | ... | @@ -639,13 +639,14 @@ public class DayOfSchedule { |
| 639 | 639 | |
| 640 | 640 | /** |
| 641 | 641 | * 是否是首班出场 |
| 642 | + * | |
| 642 | 643 | * @param sch |
| 643 | 644 | * @return |
| 644 | 645 | */ |
| 645 | - public boolean isFirstOut(ScheduleRealInfo sch){ | |
| 646 | + public boolean isFirstOut(ScheduleRealInfo sch) { | |
| 646 | 647 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 647 | 648 | try { |
| 648 | - if(list.get(0) == sch && sch.getBcType().equals("out")) | |
| 649 | + if (list.get(0) == sch && sch.getBcType().equals("out")) | |
| 649 | 650 | return true; |
| 650 | 651 | } catch (IndexOutOfBoundsException e) { |
| 651 | 652 | logger.error("小小的数组越界,无伤大雅!"); |
| ... | ... | @@ -671,7 +672,7 @@ public class DayOfSchedule { |
| 671 | 672 | save(sch); |
| 672 | 673 | } |
| 673 | 674 | |
| 674 | - public void addLPMapp(ScheduleRealInfo sch){ | |
| 675 | + public void addLPMapp(ScheduleRealInfo sch) { | |
| 675 | 676 | lpScheduleMap.put(sch.getXlBm() + "_" + sch.getLpName(), sch); |
| 676 | 677 | } |
| 677 | 678 | |
| ... | ... | @@ -685,7 +686,7 @@ public class DayOfSchedule { |
| 685 | 686 | lpScheduleMap.remove(sch.getXlBm() + "_" + sch.getLpName(), sch); |
| 686 | 687 | |
| 687 | 688 | //如果正在执行该班次 |
| 688 | - if(carExecutePlanMap.get(sch.getClZbh()) == sch){ | |
| 689 | + if (carExecutePlanMap.get(sch.getClZbh()) == sch) { | |
| 689 | 690 | //重新计算车辆当前执行班次 |
| 690 | 691 | reCalcExecPlan(sch.getClZbh()); |
| 691 | 692 | } |
| ... | ... | @@ -823,12 +824,12 @@ public class DayOfSchedule { |
| 823 | 824 | Collections.sort(list, schFCSJComparator); |
| 824 | 825 | |
| 825 | 826 | boolean flag = false; |
| 826 | - for(ScheduleRealInfo temp : list){ | |
| 827 | + for (ScheduleRealInfo temp : list) { | |
| 827 | 828 | |
| 828 | - if(flag && temp.getBcType().equals(bcType)) | |
| 829 | + if (flag && temp.getBcType().equals(bcType)) | |
| 829 | 830 | return temp; |
| 830 | 831 | |
| 831 | - if(temp == sch){ | |
| 832 | + if (temp == sch) { | |
| 832 | 833 | flag = true; |
| 833 | 834 | } |
| 834 | 835 | } |
| ... | ... | @@ -837,21 +838,22 @@ public class DayOfSchedule { |
| 837 | 838 | |
| 838 | 839 | /** |
| 839 | 840 | * 搜索离当前时间最近的一个指定类型的班次 |
| 841 | + * | |
| 840 | 842 | * @param nbbm |
| 841 | 843 | * @param bcType |
| 842 | 844 | * @return |
| 843 | 845 | */ |
| 844 | - public ScheduleRealInfo searchNearByBcType(String nbbm, String bcType){ | |
| 846 | + public ScheduleRealInfo searchNearByBcType(String nbbm, String bcType) { | |
| 845 | 847 | List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); |
| 846 | 848 | Collections.sort(list, schFCSJComparator); |
| 847 | 849 | |
| 848 | 850 | long t = System.currentTimeMillis(); |
| 849 | - int distance=-1, diff; | |
| 851 | + int distance = -1, diff; | |
| 850 | 852 | |
| 851 | 853 | ScheduleRealInfo sch = null; |
| 852 | - for(ScheduleRealInfo temp : list){ | |
| 854 | + for (ScheduleRealInfo temp : list) { | |
| 853 | 855 | diff = (int) Math.abs(temp.getDfsjT() - t); |
| 854 | - if(diff < distance || distance == -1){ | |
| 856 | + if (diff < distance || distance == -1) { | |
| 855 | 857 | sch = temp; |
| 856 | 858 | distance = diff; |
| 857 | 859 | } |
| ... | ... | @@ -878,7 +880,7 @@ public class DayOfSchedule { |
| 878 | 880 | } |
| 879 | 881 | |
| 880 | 882 | public void addExecPlan(ScheduleRealInfo sch) { |
| 881 | - if(sch != null) | |
| 883 | + if (sch != null) | |
| 882 | 884 | carExecutePlanMap.put(sch.getClZbh(), sch); |
| 883 | 885 | else |
| 884 | 886 | carExecutePlanMap.remove(sch.getClZbh()); |
| ... | ... | @@ -915,7 +917,7 @@ public class DayOfSchedule { |
| 915 | 917 | nbbmScheduleMap.remove(sch.getClZbh(), sch); |
| 916 | 918 | |
| 917 | 919 | sch.setClZbh(newClZbh); |
| 918 | - if(!nbbmScheduleMap.containsEntry(newClZbh, sch)){ | |
| 920 | + if (!nbbmScheduleMap.containsEntry(newClZbh, sch)) { | |
| 919 | 921 | nbbmScheduleMap.put(newClZbh, sch); |
| 920 | 922 | } |
| 921 | 923 | |
| ... | ... | @@ -929,52 +931,90 @@ public class DayOfSchedule { |
| 929 | 931 | return ups; |
| 930 | 932 | } |
| 931 | 933 | |
| 932 | - public void removeNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){ | |
| 934 | + public void removeNbbm2SchMapp(ScheduleRealInfo sch, String nbbm) { | |
| 933 | 935 | nbbmScheduleMap.remove(nbbm, sch); |
| 934 | 936 | } |
| 935 | 937 | |
| 936 | - public void addNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){ | |
| 938 | + public void addNbbm2SchMapp(ScheduleRealInfo sch, String nbbm) { | |
| 937 | 939 | nbbmScheduleMap.put(nbbm, sch); |
| 938 | 940 | } |
| 939 | 941 | |
| 940 | - public void reCalcExecPlan(String nbbm){ | |
| 942 | + public void reCalcExecPlan(String nbbm) { | |
| 941 | 943 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); |
| 942 | 944 | Collections.sort(list, schFCSJComparator); |
| 943 | 945 | |
| 944 | 946 | ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list); |
| 945 | 947 | carExecutePlanMap.put(nbbm, sch); |
| 946 | 948 | |
| 947 | - if(sch==null){ | |
| 948 | - logger.info("车辆" + nbbm + "无可执行任务,切换至非营运状态"); | |
| 949 | - DirectivePushQueue.put6003(nbbm, 1, Integer.parseInt(sch.getXlDir()), null, "系统"); | |
| 950 | - return; | |
| 951 | - } | |
| 952 | - try { | |
| 949 | + | |
| 950 | + /* try{ | |
| 953 | 951 | GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); |
| 954 | - if(gps != null && gps.isOnline()){ | |
| 955 | - if(StringUtils.isNotEmpty(gps.getLineId()) && !gps.getLineId().equals(sch.getXlBm())){ | |
| 956 | - //下发线路切换指令 | |
| 957 | - DirectivePushQueue.put64(nbbm, sch.getXlBm(), "系统"); | |
| 958 | - logger.info("车辆" + nbbm + "切换至" + sch.getXlBm() + " -原" + gps.getLineId() + " --重新计算当前执行班次!"); | |
| 952 | + if (gps == null || !gps.isOnline()) | |
| 953 | + return;//设备不在线 | |
| 954 | + | |
| 955 | + *//*if(sch == null && gps.isService()) | |
| 956 | + DirectivePushQueue.put6003(nbbm, 1, 0, null, "系统");//无任务*//* | |
| 957 | + | |
| 958 | + //String bcType = sch.getBcType(); | |
| 959 | + *//*if(bcType.equals("normal") | |
| 960 | + || bcType.equals("region") | |
| 961 | + || bcType.equals("major")){ | |
| 962 | + //全程、区间、放站,切换到营运状态 | |
| 963 | + if(!gps.isService()){ | |
| 964 | + DirectivePushQueue.put6003(nbbm, 0, Integer.parseInt(sch.getXlDir()), sch, "系统"); | |
| 959 | 965 | } |
| 960 | 966 | } |
| 967 | + else if(gps.isService()){ | |
| 968 | + DirectivePushQueue.put6003(nbbm, 1, 0, null, "系统");//空驶任务 | |
| 969 | + }*//* | |
| 961 | 970 | }catch (Exception e){ |
| 962 | 971 | logger.error("", e); |
| 963 | 972 | } |
| 973 | + *//*try { | |
| 974 | + //切换设备状态 | |
| 975 | + GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | |
| 976 | + if (gps == null || !gps.isOnline()) | |
| 977 | + return; | |
| 978 | + if (sch == null) { | |
| 979 | + logger.info("车辆" + nbbm + "无可执行任务,切换至非营运状态"); | |
| 980 | + DirectivePushQueue.put6003(nbbm, 1, 0, null, "系统"); | |
| 981 | + return; | |
| 982 | + } | |
| 983 | + | |
| 984 | + if (StringUtils.isNotEmpty(gps.getLineId()) && !gps.getLineId().equals(sch.getXlBm())) { | |
| 985 | + //下发线路切换指令 | |
| 986 | + DirectivePushQueue.put64(nbbm, sch.getXlBm(), "系统"); | |
| 987 | + logger.info("车辆" + nbbm + "切换至" + sch.getXlBm() + " -原" + gps.getLineId() + " --重新计算当前执行班次!"); | |
| 988 | + } | |
| 989 | + } catch (Exception e) { | |
| 990 | + logger.error("", e); | |
| 991 | + }*/ | |
| 992 | + } | |
| 993 | + | |
| 994 | + /** | |
| 995 | + * 空驶任务? | |
| 996 | + * 出场、进场、直放、两点间空驶 | |
| 997 | + * @param sch | |
| 998 | + * @return | |
| 999 | + */ | |
| 1000 | + public static boolean emptyService(ScheduleRealInfo sch){ | |
| 1001 | + String type = sch.getBcType(); | |
| 1002 | + return type.equals("out") || type.equals("in") || type.equals("venting") || type.equals("ldks"); | |
| 964 | 1003 | } |
| 965 | 1004 | |
| 966 | 1005 | /** |
| 967 | 1006 | * 是否在执行首班出场 |
| 1007 | + * | |
| 968 | 1008 | * @param nbbm |
| 969 | 1009 | * @return |
| 970 | - */ | |
| 971 | - public boolean isExecFirstOut(String nbbm, long time){ | |
| 1010 | + | |
| 1011 | + public boolean isExecFirstOut(String nbbm, long time) { | |
| 972 | 1012 | try { |
| 973 | 1013 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); |
| 974 | 1014 | ScheduleRealInfo second = list.get(2), |
| 975 | 1015 | first = executeCurr(nbbm); |
| 976 | 1016 | |
| 977 | - if(first.getBcType().equals("out") | |
| 1017 | + if (first.getBcType().equals("out") | |
| 978 | 1018 | && first.getDfsjT() < second.getDfsjT() |
| 979 | 1019 | && doneSum(nbbm) == 0 && second.getDfsjT() > time) |
| 980 | 1020 | return true; |
| ... | ... | @@ -983,13 +1023,15 @@ public class DayOfSchedule { |
| 983 | 1023 | } |
| 984 | 1024 | |
| 985 | 1025 | return false; |
| 986 | - } | |
| 1026 | + }*/ | |
| 987 | 1027 | |
| 988 | 1028 | |
| 989 | 1029 | @Autowired |
| 990 | 1030 | JdbcTemplate jdbcTemplate; |
| 1031 | + | |
| 991 | 1032 | /** |
| 992 | 1033 | * 删除实际排班 |
| 1034 | + * | |
| 993 | 1035 | * @param lineCode |
| 994 | 1036 | * @return |
| 995 | 1037 | */ |
| ... | ... | @@ -998,16 +1040,16 @@ public class DayOfSchedule { |
| 998 | 1040 | |
| 999 | 1041 | try { |
| 1000 | 1042 | String rq = currSchDateMap.get(lineCode); |
| 1001 | - if(StringUtils.isNotEmpty(rq)){ | |
| 1043 | + if (StringUtils.isNotEmpty(rq)) { | |
| 1002 | 1044 | List<ScheduleRealInfo> all = findByLineCode(lineCode); |
| 1003 | 1045 | //解除gps 和班次之间的关联 |
| 1004 | 1046 | List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values()); |
| 1005 | - for(ScheduleRealInfo sch : unions){ | |
| 1047 | + for (ScheduleRealInfo sch : unions) { | |
| 1006 | 1048 | removeExecPlan(sch.getClZbh()); |
| 1007 | 1049 | } |
| 1008 | 1050 | //解除调度指令和班次的外键约束 |
| 1009 | 1051 | StringBuilder inStr = new StringBuilder("("); |
| 1010 | - for(ScheduleRealInfo sch : all){ | |
| 1052 | + for (ScheduleRealInfo sch : all) { | |
| 1011 | 1053 | inStr.append(sch.getId() + ","); |
| 1012 | 1054 | } |
| 1013 | 1055 | inStr.deleteCharAt(inStr.length() - 1).append(")"); |
| ... | ... | @@ -1019,10 +1061,10 @@ public class DayOfSchedule { |
| 1019 | 1061 | |
| 1020 | 1062 | } |
| 1021 | 1063 | rs.put("status", ResponseCode.SUCCESS); |
| 1022 | - }catch (Exception e){ | |
| 1064 | + } catch (Exception e) { | |
| 1023 | 1065 | logger.error("", e); |
| 1024 | 1066 | rs.put("status", ResponseCode.ERROR); |
| 1025 | - if(e instanceof DataIntegrityViolationException) | |
| 1067 | + if (e instanceof DataIntegrityViolationException) | |
| 1026 | 1068 | rs.put("msg", "失败,违反数据约束!!"); |
| 1027 | 1069 | else |
| 1028 | 1070 | rs.put("msg", e.getMessage()); |
| ... | ... | @@ -1042,7 +1084,7 @@ public class DayOfSchedule { |
| 1042 | 1084 | List<ScheduleRealInfo> rs = new ArrayList<>(); |
| 1043 | 1085 | |
| 1044 | 1086 | for (ScheduleRealInfo sch : c1) { |
| 1045 | - if(c2.contains(sch)){ | |
| 1087 | + if (c2.contains(sch)) { | |
| 1046 | 1088 | rs.add(sch); |
| 1047 | 1089 | } |
| 1048 | 1090 | } |
| ... | ... | @@ -1051,16 +1093,18 @@ public class DayOfSchedule { |
| 1051 | 1093 | |
| 1052 | 1094 | /** |
| 1053 | 1095 | * 覆盖一辆车的所有班次 |
| 1096 | + * | |
| 1054 | 1097 | * @param nbbm |
| 1055 | 1098 | * @param sets |
| 1056 | 1099 | */ |
| 1057 | - public void replaceByNbbm(String nbbm, Collection<ScheduleRealInfo> sets){ | |
| 1100 | + public void replaceByNbbm(String nbbm, Collection<ScheduleRealInfo> sets) { | |
| 1058 | 1101 | nbbmScheduleMap.removeAll(nbbm); |
| 1059 | 1102 | nbbmScheduleMap.putAll(nbbm, sets); |
| 1060 | 1103 | } |
| 1061 | 1104 | |
| 1062 | 1105 | /** |
| 1063 | 1106 | * 获取该班次所在路牌的下一个班次 |
| 1107 | + * | |
| 1064 | 1108 | * @param sch |
| 1065 | 1109 | * @return |
| 1066 | 1110 | */ |
| ... | ... | @@ -1072,6 +1116,7 @@ public class DayOfSchedule { |
| 1072 | 1116 | |
| 1073 | 1117 | /** |
| 1074 | 1118 | * 获取该班次所在路牌的下一个班次,不考虑场既是站 |
| 1119 | + * | |
| 1075 | 1120 | * @param sch |
| 1076 | 1121 | * @return |
| 1077 | 1122 | */ |
| ... | ... | @@ -1081,7 +1126,7 @@ public class DayOfSchedule { |
| 1081 | 1126 | return next2(list, sch); |
| 1082 | 1127 | } |
| 1083 | 1128 | |
| 1084 | - public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap(){ | |
| 1129 | + public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() { | |
| 1085 | 1130 | return lpScheduleMap; |
| 1086 | 1131 | } |
| 1087 | 1132 | } |
| 1088 | 1133 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| ... | ... | @@ -36,6 +36,11 @@ public class SchedulePstThread extends Thread { |
| 36 | 36 | if (null == schedule) |
| 37 | 37 | break; |
| 38 | 38 | |
| 39 | + if(schedule.isDeleted()){ | |
| 40 | + logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId()); | |
| 41 | + continue; | |
| 42 | + } | |
| 43 | + | |
| 39 | 44 | try { |
| 40 | 45 | scheduleRepository.save(schedule); |
| 41 | 46 | } | ... | ... |
src/main/java/com/bsth/entity/directive/D60.java
| ... | ... | @@ -62,6 +62,11 @@ public class D60 extends Directive { |
| 62 | 62 | private boolean isDispatch; |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | + * 线路编码 | |
| 66 | + */ | |
| 67 | + private String lineCode; | |
| 68 | + | |
| 69 | + /** | |
| 65 | 70 | * 相关联的班次 |
| 66 | 71 | */ |
| 67 | 72 | @JsonIgnore |
| ... | ... | @@ -84,6 +89,14 @@ public class D60 extends Directive { |
| 84 | 89 | this.reply47Time = reply47Time; |
| 85 | 90 | } |
| 86 | 91 | |
| 92 | + public String getLineCode() { | |
| 93 | + return lineCode; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setLineCode(String lineCode) { | |
| 97 | + this.lineCode = lineCode; | |
| 98 | + } | |
| 99 | + | |
| 87 | 100 | @Embeddable |
| 88 | 101 | public static class D60Data { |
| 89 | 102 | // 公司代码 | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -204,6 +204,11 @@ public class ScheduleRealInfo { |
| 204 | 204 | @Transient |
| 205 | 205 | private int fcpSn; |
| 206 | 206 | |
| 207 | + /** 标记班次已被删除 */ | |
| 208 | + @Transient | |
| 209 | + @JsonIgnore | |
| 210 | + private boolean deleted; | |
| 211 | + | |
| 207 | 212 | public boolean isDfAuto() { |
| 208 | 213 | return dfAuto; |
| 209 | 214 | } |
| ... | ... | @@ -912,4 +917,12 @@ public class ScheduleRealInfo { |
| 912 | 917 | public boolean _isInout(){ |
| 913 | 918 | return this.getBcType().equals("out") || this.getBcType().equals("in"); |
| 914 | 919 | } |
| 920 | + | |
| 921 | + public boolean isDeleted() { | |
| 922 | + return deleted; | |
| 923 | + } | |
| 924 | + | |
| 925 | + public void setDeleted(boolean deleted) { | |
| 926 | + this.deleted = deleted; | |
| 927 | + } | |
| 915 | 928 | } | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleType.java deleted
100644 → 0
src/main/java/com/bsth/service/directive/DirectiveService.java
| ... | ... | @@ -44,7 +44,7 @@ public interface DirectiveService extends BaseService<D60, Integer>{ |
| 44 | 44 | int send60Dispatch(Long id, String sender); |
| 45 | 45 | |
| 46 | 46 | //60营运指令 |
| 47 | - int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender); | |
| 47 | + int send60Operation(String nbbm, int state, int upDown, String sender); | |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * |
| ... | ... | @@ -66,7 +66,7 @@ public interface DirectiveService extends BaseService<D60, Integer>{ |
| 66 | 66 | * @param @param upDonw 上下行 0 上行 1 下行 |
| 67 | 67 | * @throws |
| 68 | 68 | */ |
| 69 | - int upDownChange(String nbbm, Integer upDown, String sender); | |
| 69 | + //int upDownChange(String nbbm, Integer upDown, String sender); | |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * |
| ... | ... | @@ -94,7 +94,7 @@ public interface DirectiveService extends BaseService<D60, Integer>{ |
| 94 | 94 | |
| 95 | 95 | int refreshLineFile(String deviceId); |
| 96 | 96 | |
| 97 | - int stateChange(String nbbm, Integer upDown, Integer state, String userName); | |
| 97 | + //int stateChange(String nbbm, Integer upDown, Integer state, String userName); | |
| 98 | 98 | |
| 99 | 99 | Map<String,Object> deviceCofigList(Map<String, String> map, int page, int size); |
| 100 | 100 | } | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -119,6 +119,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 119 | 119 | |
| 120 | 120 | d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) |
| 121 | 121 | , 0, new Date(alarmTime)); |
| 122 | + | |
| 123 | + d60.setLineCode(sch.getXlBm()); | |
| 122 | 124 | } catch (Exception e) { |
| 123 | 125 | logger.error("生成调度指令时出现异常", e); |
| 124 | 126 | return -1; |
| ... | ... | @@ -186,11 +188,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 186 | 188 | } |
| 187 | 189 | |
| 188 | 190 | @Override |
| 189 | - public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | |
| 191 | + public int send60Operation(String nbbm, int state, int upDown, String sender) { | |
| 190 | 192 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); |
| 191 | 193 | |
| 192 | 194 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); |
| 193 | - D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state); | |
| 195 | + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state, null); | |
| 194 | 196 | |
| 195 | 197 | if (null == d60) |
| 196 | 198 | return -1; |
| ... | ... | @@ -202,9 +204,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 202 | 204 | int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); |
| 203 | 205 | // 添加到缓存,等待入库 |
| 204 | 206 | d60.setHttpCode(code); |
| 205 | - if (null != sch) | |
| 207 | + /*if (null != sch){ | |
| 206 | 208 | d60.setSch(sch); |
| 207 | - | |
| 209 | + d60.setLineCode(sch.getXlBm()); | |
| 210 | + }*/ | |
| 208 | 211 | |
| 209 | 212 | if (code == 0) { |
| 210 | 213 | dayOfDirectives.put60(d60, true); |
| ... | ... | @@ -257,6 +260,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 257 | 260 | public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) { |
| 258 | 261 | |
| 259 | 262 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); |
| 263 | + String lineCode = null; | |
| 260 | 264 | if (null == deviceId) { |
| 261 | 265 | logger.error("没有设备号对照的车辆:" + nbbm); |
| 262 | 266 | return null; |
| ... | ... | @@ -281,19 +285,20 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 281 | 285 | } else { |
| 282 | 286 | upDown = gpsData.getUpDown(); |
| 283 | 287 | state = gpsData.getState(); |
| 288 | + lineCode = gpsData.getLineId(); | |
| 284 | 289 | } |
| 285 | 290 | } else { |
| 286 | 291 | upDown = Byte.parseByte(sch.getXlDir()); |
| 287 | 292 | state = 0; |
| 288 | 293 | } |
| 289 | 294 | |
| 290 | - return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state); | |
| 295 | + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state, lineCode); | |
| 291 | 296 | } |
| 292 | 297 | |
| 293 | - @Override | |
| 298 | +/* @Override | |
| 294 | 299 | public int upDownChange(String nbbm, Integer upDown, String sender) { |
| 295 | - return send60Operation(nbbm, 0, upDown, null, sender); | |
| 296 | - } | |
| 300 | + return send60Operation(nbbm, 0, upDown, sender); | |
| 301 | + }*/ | |
| 297 | 302 | |
| 298 | 303 | |
| 299 | 304 | @Override |
| ... | ... | @@ -536,10 +541,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 536 | 541 | return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId())); |
| 537 | 542 | } |
| 538 | 543 | |
| 539 | - @Override | |
| 544 | +/* @Override | |
| 540 | 545 | public int stateChange(String nbbm, Integer upDown, Integer state, String userName) { |
| 541 | - return send60Operation(nbbm, state, upDown, null, userName); | |
| 542 | - } | |
| 546 | + return send60Operation(nbbm, state, upDown, userName); | |
| 547 | + }*/ | |
| 543 | 548 | |
| 544 | 549 | @Override |
| 545 | 550 | public Map<String, Object> deviceCofigList(Map<String, String> map, int page, int size) { | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -155,6 +155,17 @@ public class GpsServiceImpl implements GpsService { |
| 155 | 155 | return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | + /** | |
| 159 | + * 获取运营状态 | |
| 160 | + * | |
| 161 | + * @return -1无效 0运营 1未运营 | |
| 162 | + */ | |
| 163 | + public static byte getService(long serviceState) { | |
| 164 | + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | |
| 165 | + return -1; | |
| 166 | + return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 167 | + } | |
| 168 | + | |
| 158 | 169 | @Override |
| 159 | 170 | public List<Map<String, Object>> history(String[] nbbmArray, Long st, Long et) { |
| 160 | 171 | List<Map<String, Object>> list = new ArrayList<>(); |
| ... | ... | @@ -242,10 +253,11 @@ public class GpsServiceImpl implements GpsService { |
| 242 | 253 | rs = ps.executeQuery(); |
| 243 | 254 | Float lon, lat; |
| 244 | 255 | Location bdLoc, gdLoc; |
| 245 | - int upDown, inOutStop; | |
| 256 | + int inOutStop; | |
| 257 | + long serviceState; | |
| 246 | 258 | ArrivalEntity arrival; |
| 247 | 259 | while (rs.next()) { |
| 248 | - upDown = getUpOrDown(rs.getLong("SERVICE_STATE")); | |
| 260 | + serviceState = rs.getLong("SERVICE_STATE"); | |
| 249 | 261 | map = new HashMap<>(); |
| 250 | 262 | |
| 251 | 263 | lon = rs.getFloat("LON"); |
| ... | ... | @@ -281,9 +293,9 @@ public class GpsServiceImpl implements GpsService { |
| 281 | 293 | } |
| 282 | 294 | |
| 283 | 295 | map.put("nbbm", BasicData.deviceId2NbbmMap.get(rs.getString("DEVICE_ID"))); |
| 284 | - map.put("state", 0); | |
| 296 | + map.put("state", getService(serviceState)); | |
| 285 | 297 | // 上下行 |
| 286 | - map.put("upDown", upDown); | |
| 298 | + map.put("upDown", getUpOrDown(serviceState)); | |
| 287 | 299 | //路段编码 |
| 288 | 300 | map.put("section_code", rs.getString("SECTION_CODE")); |
| 289 | 301 | list.add(map); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -643,8 +643,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 643 | 643 | Map<String, Object> rs = new HashMap<>(); |
| 644 | 644 | rs.put("status", ResponseCode.ERROR); |
| 645 | 645 | |
| 646 | + ScheduleRealInfo sch = null; | |
| 646 | 647 | try { |
| 647 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 648 | + sch = dayOfSchedule.get(id); | |
| 648 | 649 | if (sch == null) { |
| 649 | 650 | rs.put("msg", "无效的id号"); |
| 650 | 651 | return rs; |
| ... | ... | @@ -655,6 +656,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 655 | 656 | return rs; |
| 656 | 657 | } |
| 657 | 658 | |
| 659 | + sch.setDeleted(true); | |
| 658 | 660 | //解除和调度指令的外键约束 |
| 659 | 661 | jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); |
| 660 | 662 | |
| ... | ... | @@ -674,9 +676,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 674 | 676 | rs.put("ts", ts); |
| 675 | 677 | rs.put("delete", sch); |
| 676 | 678 | } |
| 679 | + else | |
| 680 | + sch.setDeleted(false); | |
| 677 | 681 | }catch (Exception e){ |
| 678 | 682 | logger.error("", e); |
| 679 | 683 | rs.put("msg", e.getMessage()); |
| 684 | + sch.setDeleted(false); | |
| 680 | 685 | } |
| 681 | 686 | |
| 682 | 687 | return rs; | ... | ... |
src/main/resources/logback.xml
| ... | ... | @@ -186,6 +186,28 @@ |
| 186 | 186 | <appender-ref ref="GPS_COUNT" /> |
| 187 | 187 | </logger> |
| 188 | 188 | |
| 189 | + <!-- 设备状态指令 --> | |
| 190 | + <appender name="GPS_STATUS_DIRECTIVE" | |
| 191 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 192 | + <file>${LOG_BASE}/gps_state/state_directive.log</file> | |
| 193 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 194 | + <fileNamePattern>${LOG_BASE}/gps_state/state_directive-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 195 | + <timeBasedFileNamingAndTriggeringPolicy | |
| 196 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 197 | + <maxFileSize>100MB</maxFileSize> | |
| 198 | + </timeBasedFileNamingAndTriggeringPolicy> | |
| 199 | + </rollingPolicy> | |
| 200 | + | |
| 201 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
| 202 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%file:%line] %-5level -%msg%n | |
| 203 | + </pattern> | |
| 204 | + </layout> | |
| 205 | + </appender> | |
| 206 | + <logger name="com.bsth.data.gpsdata.status_manager" | |
| 207 | + level="INFO" additivity="false"> | |
| 208 | + <appender-ref ref="GPS_STATUS_DIRECTIVE" /> | |
| 209 | + </logger> | |
| 210 | + | |
| 189 | 211 | <!-- 消息队列纪录 --> |
| 190 | 212 | <appender name="QUEUE_WEB_SOCKET" |
| 191 | 213 | class="ch.qos.logback.core.rolling.RollingFileAppender"> | ... | ... |
src/main/resources/static/pages/forms/mould/countByBus1s.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/countByBus2s.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/countByLines.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/report/countMileage/countBus/company/countBusMileage.html
0 → 100644
| 1 | +<style type="text/css"> | |
| 2 | + .table-bordered { | |
| 3 | + border: 1px solid; } | |
| 4 | + .table-bordered > thead > tr > th, | |
| 5 | + .table-bordered > thead > tr > td, | |
| 6 | + .table-bordered > tbody > tr > th, | |
| 7 | + .table-bordered > tbody > tr > td, | |
| 8 | + .table-bordered > tfoot > tr > th, | |
| 9 | + .table-bordered > tfoot > tr > td { | |
| 10 | + border: 1px solid; } | |
| 11 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + | |
| 15 | + .table > tbody + tbody { | |
| 16 | + border-top: 1px solid; } | |
| 17 | + | |
| 18 | + #forms > thead > tr> td >span{ | |
| 19 | + width: 5px; | |
| 20 | + word-wrap: break-word; | |
| 21 | + letter-spacing: 20px; | |
| 22 | + } | |
| 23 | + | |
| 24 | + #forms > thead > tr> td >label{ | |
| 25 | + word-break: keep-all;white-space:nowrap; | |
| 26 | + } | |
| 27 | +</style> | |
| 28 | + | |
| 29 | +<div class="page-head"> | |
| 30 | + <div class="page-title"> | |
| 31 | + <h1>路单数据统计表</h1> | |
| 32 | + </div> | |
| 33 | +</div> | |
| 34 | + | |
| 35 | +<div class="row"> | |
| 36 | + <div class="col-md-12"> | |
| 37 | + <div class="portlet light porttlet-fit bordered"> | |
| 38 | + <div class="portlet-title"> | |
| 39 | + <form class="form-inline" action=""> | |
| 40 | + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv"> | |
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | |
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | |
| 43 | + </div> | |
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | |
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | |
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | |
| 47 | + </div> | |
| 48 | + <div style="display: inline-block;margin-left: 43px;"> | |
| 49 | + <span class="item-label" style="width: 80px;">线路: </span> | |
| 50 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | |
| 51 | + </div> | |
| 52 | + <div style="margin-top: 2px"></div> | |
| 53 | + | |
| 54 | + <div style="display: inline-block;"> | |
| 55 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 56 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | |
| 57 | + </div> | |
| 58 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 59 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 60 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | |
| 61 | + </div> | |
| 62 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 63 | + <span class="item-label" style="width: 80px;">显示分类: </span> | |
| 64 | + <select class="form-control" style="width: 120px;" id="zt"> | |
| 65 | + <option value="zbh">车辆</option> | |
| 66 | + <option value="js">驾/售</option> | |
| 67 | + </select> | |
| 68 | + </div> | |
| 69 | + <div class="form-group" style="margin-left: 55px;"> | |
| 70 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | |
| 71 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 72 | + </div> | |
| 73 | + </form> | |
| 74 | + </div> | |
| 75 | + <div class="portlet-body"> | |
| 76 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | |
| 77 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | |
| 78 | + | |
| 79 | + | |
| 80 | + </table> | |
| 81 | + </div> | |
| 82 | + </div> | |
| 83 | + </div> | |
| 84 | + </div> | |
| 85 | +</div> | |
| 86 | + | |
| 87 | +<script> | |
| 88 | + $(function(){ | |
| 89 | + $('#export').attr('disabled', "true"); | |
| 90 | + | |
| 91 | + // 关闭左侧栏 | |
| 92 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 93 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 94 | + | |
| 95 | + $("#date").datetimepicker({ | |
| 96 | + format : 'YYYY-MM-DD', | |
| 97 | + locale : 'zh-cn' | |
| 98 | + }); | |
| 99 | + | |
| 100 | + $("#date2").datetimepicker({ | |
| 101 | + format : 'YYYY-MM-DD', | |
| 102 | + locale : 'zh-cn' | |
| 103 | + }); | |
| 104 | + var d = new Date(); | |
| 105 | + var year = d.getFullYear(); | |
| 106 | + var month = d.getMonth() + 1; | |
| 107 | + var day = d.getDate(); | |
| 108 | + if(month < 10) | |
| 109 | + month = "0" + month; | |
| 110 | + if(day < 10) | |
| 111 | + day = "0" + day; | |
| 112 | + $("#date").val(year + "-" + month + "-" + day); | |
| 113 | + | |
| 114 | + $("#date2").val(year + "-" + month + "-" + day); | |
| 115 | + | |
| 116 | + var fage=false; | |
| 117 | + var obj = []; | |
| 118 | + var xlList; | |
| 119 | + $.get('/report/lineList',function(result){ | |
| 120 | + xlList=result; | |
| 121 | + $.get('/user/companyData', function(result){ | |
| 122 | + obj = result; | |
| 123 | + var options = ''; | |
| 124 | + for(var i = 0; i < obj.length; i++){ | |
| 125 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 126 | + } | |
| 127 | + | |
| 128 | + if(obj.length ==0){ | |
| 129 | + $("#gsdmDiv").css('display','none'); | |
| 130 | + }else if(obj.length ==1){ | |
| 131 | + $("#gsdmDiv").css('display','none'); | |
| 132 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | |
| 133 | + $('#fgsdmDiv').css('display','none'); | |
| 134 | + } | |
| 135 | + $('#gsdm').html(options); | |
| 136 | + updateCompany(); | |
| 137 | + }); | |
| 138 | + }) | |
| 139 | + $("#gsdm").on("change",updateCompany); | |
| 140 | + function updateCompany(){ | |
| 141 | + var company = $('#gsdm').val(); | |
| 142 | + var options = ''; | |
| 143 | + for(var i = 0; i < obj.length; i++){ | |
| 144 | + if(obj[i].companyCode == company){ | |
| 145 | + var children = obj[i].children; | |
| 146 | + for(var j = 0; j < children.length; j++){ | |
| 147 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 148 | + } | |
| 149 | + } | |
| 150 | + } | |
| 151 | + $('#fgsdm').html(options); | |
| 152 | + } | |
| 153 | + | |
| 154 | + | |
| 155 | + var tempData = {}; | |
| 156 | + $.get('/report/lineList',function(xlList){ | |
| 157 | + var data = []; | |
| 158 | + data.push({id: " ", text: "全部线路"}); | |
| 159 | + $.get('/user/companyData', function(result){ | |
| 160 | + for(var i = 0; i < result.length; i++){ | |
| 161 | + var companyCode = result[i].companyCode; | |
| 162 | + var children = result[i].children; | |
| 163 | + for(var j = 0; j < children.length; j++){ | |
| 164 | + var code = children[j].code; | |
| 165 | + for(var k=0;k < xlList.length;k++ ){ | |
| 166 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | |
| 167 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | |
| 168 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | |
| 169 | + } | |
| 170 | + } | |
| 171 | + } | |
| 172 | + } | |
| 173 | + initPinYinSelect2('#line',data,''); | |
| 174 | + | |
| 175 | + }); | |
| 176 | + }); | |
| 177 | + | |
| 178 | + $("#line").on("change", function(){ | |
| 179 | + if($("#line").val() == " "){ | |
| 180 | + $("#gsdm").attr("disabled", false); | |
| 181 | + $("#fgsdm").attr("disabled", false); | |
| 182 | + } else { | |
| 183 | + var temp = tempData[$("#line").val()].split(":"); | |
| 184 | + $("#gsdm").val(temp[0]); | |
| 185 | + updateCompany(); | |
| 186 | + $("#fgsdm").val(temp[1]); | |
| 187 | + $("#gsdm").attr("disabled", true); | |
| 188 | + $("#fgsdm").attr("disabled", true); | |
| 189 | + } | |
| 190 | + }); | |
| 191 | + | |
| 192 | + var line =""; | |
| 193 | + var xlName =""; | |
| 194 | + var date = ""; | |
| 195 | + var date2 =""; | |
| 196 | + var gsdm=""; | |
| 197 | + var fgsdm=""; | |
| 198 | + var zt=""; | |
| 199 | + $("#countLine").height($(window).height()-280); | |
| 200 | + $("#query").on("click",function(){ | |
| 201 | + $("#countLine").height($(window).height()-280); | |
| 202 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 203 | + layer.msg("请选择时间范围!"); | |
| 204 | + return; | |
| 205 | + } | |
| 206 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | |
| 207 | + layer.msg("请选择时间范围!"); | |
| 208 | + return; | |
| 209 | + } | |
| 210 | + line = $("#line").val(); | |
| 211 | + xlName = $("#select2-line-container").html(); | |
| 212 | + date = $("#date").val(); | |
| 213 | + date2 =$("#date2").val(); | |
| 214 | + gsdm =$("#gsdm").val(); | |
| 215 | + fgsdm=$("#fgsdm").val(); | |
| 216 | + zt=$("#zt").val(); | |
| 217 | + if(line=="请选择"){ | |
| 218 | + line=""; | |
| 219 | + } | |
| 220 | + if(date==null || date =="" ||date2==null || date2 ==""){ | |
| 221 | + layer.msg('请选择时间段.'); | |
| 222 | + }else{ | |
| 223 | + var params = {}; | |
| 224 | + params['gsdm'] = gsdm; | |
| 225 | + params['fgsdm'] =fgsdm ; | |
| 226 | + params['line'] = line; | |
| 227 | + params['date'] = date; | |
| 228 | + params['date2'] = date2; | |
| 229 | + params['xlName'] = xlName; | |
| 230 | + params['zt']=zt; | |
| 231 | + params['type'] = "query"; | |
| 232 | + var tbodyHtml = template('countBusDaily',{list:""}); | |
| 233 | + var i = layer.load(2); | |
| 234 | + $get('/report/countBusMileage',params,function(result){ | |
| 235 | + layer.close(i); | |
| 236 | + // 把数据填充到模版中 | |
| 237 | + var tbodyHtml = template('countBusDaily',{list:result,zt:zt}); | |
| 238 | + // 把渲染好的模版html文本追加到表格中 | |
| 239 | + $('#forms').html(tbodyHtml); | |
| 240 | + | |
| 241 | + if(result.length == 0) | |
| 242 | + $("#export").attr('disabled',"true"); | |
| 243 | + else | |
| 244 | + $("#export").removeAttr("disabled"); | |
| 245 | + }); | |
| 246 | + } | |
| 247 | + | |
| 248 | + }); | |
| 249 | + | |
| 250 | + $("#export").on("click",function(){ | |
| 251 | + var params = {}; | |
| 252 | + params['gsdm'] = gsdm; | |
| 253 | + params['fgsdm'] =fgsdm ; | |
| 254 | + params['line'] = line; | |
| 255 | + params['date'] = date; | |
| 256 | + params['date2'] = date2; | |
| 257 | + params['xlName'] = xlName; | |
| 258 | + params['zt']=zt; | |
| 259 | + params['type'] = "export"; | |
| 260 | + params['by']='gs'; | |
| 261 | + $get('/report/countBusMileage',params,function(result){ | |
| 262 | + window.open("/downloadFile/download?fileName=路单数据统计表"); | |
| 263 | + }); | |
| 264 | + }); | |
| 265 | + | |
| 266 | + }); | |
| 267 | +</script> | |
| 268 | +<script type="text/html" id="countBusDaily"> | |
| 269 | + <thead> | |
| 270 | + <tr> | |
| 271 | + <th colspan="31">路单数据统计表</th> | |
| 272 | + </tr> | |
| 273 | + <tr> | |
| 274 | + <td>序号</td> | |
| 275 | + <td>日期</td> | |
| 276 | + <td>所属公司</td> | |
| 277 | + <td>线路</td> | |
| 278 | + <td>车号</td> | |
| 279 | + {{if zt=='js'}} | |
| 280 | + <td>司机职号</td> | |
| 281 | + <td>司机姓名</td> | |
| 282 | + <td>售票员职号</td> | |
| 283 | + <td>售票员姓名</td> | |
| 284 | + {{/if}} | |
| 285 | + <td>行驶里程(包括空放)</td> | |
| 286 | + <td>计划内营运里程</td> | |
| 287 | + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td> | |
| 288 | + <td><label>计划内</label><label>进出场</label><label>空驶</label></td> | |
| 289 | + <td><label>计划外</label><label>进出场</label><label>空驶</label></td> | |
| 290 | + <td>空放空驶</td> | |
| 291 | + <td><label>故障</label><label>进出场</label><label>空驶</label></td> | |
| 292 | + <td><label>肇事</label><label>进出场</label><label>空驶</label></td> | |
| 293 | + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td> | |
| 294 | + <td><label>其他</label><label>进出场</label><label>空驶</label></td> | |
| 295 | + <td>临加营运公里</td> | |
| 296 | + <td>临加进出场空驶</td> | |
| 297 | + <td>临加空放空驶</td> | |
| 298 | + <td>电耗量</td> | |
| 299 | + <td>加电量</td> | |
| 300 | + <td>耗油量</td> | |
| 301 | + <td>加注量</td> | |
| 302 | + <td>非营业用油</td> | |
| 303 | + <td>计划总公里</td> | |
| 304 | + </tr> | |
| 305 | + </thead> | |
| 306 | + <tbody > | |
| 307 | + {{each list as obj i}} | |
| 308 | + <tr> | |
| 309 | + <td>{{i+1}}</td> | |
| 310 | + <td>{{obj.rq}}</td> | |
| 311 | + <td>{{obj.fgs}}</td> | |
| 312 | + <td>{{obj.xlName}}</td> | |
| 313 | + <td>{{obj.nbbm}}</td> | |
| 314 | + {{if zt=='js'}} | |
| 315 | + <td>{{obj.jGh}}</td> | |
| 316 | + <td>{{obj.jName}}</td> | |
| 317 | + <td>{{obj.sGh}}</td> | |
| 318 | + <td>{{obj.sName}}</td> | |
| 319 | + {{/if}} | |
| 320 | + <td>{{obj.zlc}}</td> | |
| 321 | + <td>{{obj.jhnlc}}</td> | |
| 322 | + <td>{{obj.jhwlc}}</td> | |
| 323 | + <td>{{obj.jhnjcclc}}</td> | |
| 324 | + <td>{{obj.jhwjcclc}}</td> | |
| 325 | + <td>{{obj.kfks}}</td> | |
| 326 | + <td>{{obj.zrwjcclc}}</td> | |
| 327 | + <td>{{obj.zrwjcclc1}}</td> | |
| 328 | + <td>{{obj.zrwjcclc2}}</td> | |
| 329 | + <td>{{obj.zrwjcclcqt}}</td> | |
| 330 | + <td>{{obj.ljyy}}</td> | |
| 331 | + <td>{{obj.ljjcc}}</td> | |
| 332 | + <td>{{obj.ljkfks}}</td> | |
| 333 | + <td>{{obj.dhl}}</td> | |
| 334 | + <td>{{obj.cdl}}</td> | |
| 335 | + <td>{{obj.yhl}}</td> | |
| 336 | + <td>{{obj.hyl}}</td> | |
| 337 | + <td>{{obj.jzl}}</td> | |
| 338 | + <td>{{obj.jhzlc}}</td> | |
| 339 | + </tr> | |
| 340 | + {{/each}} | |
| 341 | + {{if list.length == 0}} | |
| 342 | + <tr> | |
| 343 | + <td colspan="28"><h6 class="muted">没有找到相关数据</h6></td> | |
| 344 | + </tr> | |
| 345 | + {{/if}} | |
| 346 | +</tbody> | |
| 347 | +</script> | |
| 0 | 348 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/report/countMileage/countLine/company/countLineMileage.html
0 → 100644
| 1 | +<style type="text/css"> | |
| 2 | + .table-bordered { | |
| 3 | + border: 1px solid; } | |
| 4 | + .table-bordered > thead > tr > th, | |
| 5 | + .table-bordered > thead > tr > td, | |
| 6 | + .table-bordered > tbody > tr > th, | |
| 7 | + .table-bordered > tbody > tr > td, | |
| 8 | + .table-bordered > tfoot > tr > th, | |
| 9 | + .table-bordered > tfoot > tr > td { | |
| 10 | + border: 1px solid; } | |
| 11 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + | |
| 15 | + .table > tbody + tbody { | |
| 16 | + border-top: 1px solid; } | |
| 17 | + | |
| 18 | + #forms > thead > tr> td >span{ | |
| 19 | + width: 5px; | |
| 20 | + word-wrap: break-word; | |
| 21 | + letter-spacing: 20px; | |
| 22 | + } | |
| 23 | + | |
| 24 | + #forms > thead > tr> td >label{ | |
| 25 | + word-break: keep-all;white-space:nowrap; | |
| 26 | + } | |
| 27 | +</style> | |
| 28 | + | |
| 29 | +<div class="page-head"> | |
| 30 | + <div class="page-title"> | |
| 31 | + <h1>线路公里统计表</h1> | |
| 32 | + </div> | |
| 33 | +</div> | |
| 34 | + | |
| 35 | +<div class="row"> | |
| 36 | + <div class="col-md-12"> | |
| 37 | + <div class="portlet light porttlet-fit bordered"> | |
| 38 | + <div class="portlet-title"> | |
| 39 | + <form class="form-inline" action=""> | |
| 40 | + <div style="display: inline-block; " id="gsdmDiv"> | |
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | |
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | |
| 43 | + </div> | |
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | |
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | |
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | |
| 47 | + </div> | |
| 48 | + <div style="margin-top: 2px"></div> | |
| 49 | + <div style="display: inline-block;"> | |
| 50 | + <span class="item-label" style="width: 80px;">线路: </span> | |
| 51 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | |
| 52 | + </div> | |
| 53 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 55 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | |
| 56 | + </div> | |
| 57 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 59 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | |
| 60 | + </div> | |
| 61 | + <div class="form-group"> | |
| 62 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | |
| 63 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 64 | + </div> | |
| 65 | + </form> | |
| 66 | + </div> | |
| 67 | + <div class="portlet-body"> | |
| 68 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | |
| 69 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | |
| 70 | + <thead> | |
| 71 | + <tr> | |
| 72 | + <th colspan="31"><label id="datetodate"></label>线路公里统计表</th> | |
| 73 | + </tr> | |
| 74 | + <tr> | |
| 75 | + <td rowspan="2"><span>公司</span></td> | |
| 76 | + <td rowspan="2"><span>分公司</span></td> | |
| 77 | + <td rowspan="2"><span>路线别</span></td> | |
| 78 | + <td rowspan="2"><label>计划</label><label>总公里</label></td> | |
| 79 | + <td rowspan="2"><label>计划营</label><label>运公里</label></td> | |
| 80 | + <td rowspan="2"><label>计划空</label><label>驶公里</label></td> | |
| 81 | + <td rowspan="2"><label>实际</label><label>总公里</label></td> | |
| 82 | + <td colspan="2"><label>实际营</label><label>运公里</label></td> | |
| 83 | + <td colspan="7"><label>实际空</label><label>驶公里</label></td> | |
| 84 | + <td rowspan="2"><label>少驶营</label><label>运里程</label></td> | |
| 85 | + <td colspan="11">少驶原因(公里)</td> | |
| 86 | + <td colspan="3">临加公里</td> | |
| 87 | + </tr> | |
| 88 | + <tr> | |
| 89 | + <td><label>计划内</label><label>营运</label><label>里程</label></td> | |
| 90 | + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td> | |
| 91 | + <td><label>计划内</label><label>进出场</label><label>空驶</label></td> | |
| 92 | + <td><label>计划外</label><label>进出场</label><label>空驶</label></td> | |
| 93 | + <td><label>故障</label><label>进出场</label><label>空驶</label></td> | |
| 94 | + <td><label>肇事</label><label>进出场</label><label>空驶</label></td> | |
| 95 | + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td> | |
| 96 | + <td><label>其他</label><label>进出场</label><label>空驶</label></td> | |
| 97 | + <td><label>空放 </label><label>空驶</label></td> | |
| 98 | + <td><span>路阻</span></td> | |
| 99 | + <td><span>吊慢</span></td> | |
| 100 | + <td><span>故障</span></td> | |
| 101 | + <td><span>纠纷</span></td> | |
| 102 | + <td><span>肇事</span></td> | |
| 103 | + <td><span>缺人</span></td> | |
| 104 | + <td><span>缺车</span></td> | |
| 105 | + <td><span>客稀</span></td> | |
| 106 | + <td><span>气候</span></td> | |
| 107 | + <td><span>援外</span></td> | |
| 108 | + <td><span>其他</span></td> | |
| 109 | + <td><label>临加营</label><label>运公里</label></td> | |
| 110 | + <td><label>临加进出</label><label>场空驶</label></td> | |
| 111 | + <td><label>临加</label><label>空放</label><label>空驶</label></td> | |
| 112 | + </tr> | |
| 113 | + | |
| 114 | + </thead> | |
| 115 | + <tbody class="countLine"> | |
| 116 | + | |
| 117 | + </tbody> | |
| 118 | + </table> | |
| 119 | + </div> | |
| 120 | + </div> | |
| 121 | + </div> | |
| 122 | + </div> | |
| 123 | +</div> | |
| 124 | + | |
| 125 | +<script> | |
| 126 | + $(function(){ | |
| 127 | + $('#export').attr('disabled', "true"); | |
| 128 | + | |
| 129 | + // 关闭左侧栏 | |
| 130 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 131 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 132 | + | |
| 133 | + $("#date").datetimepicker({ | |
| 134 | + format : 'YYYY-MM-DD', | |
| 135 | + locale : 'zh-cn' | |
| 136 | + }); | |
| 137 | + | |
| 138 | + $("#date2").datetimepicker({ | |
| 139 | + format : 'YYYY-MM-DD', | |
| 140 | + locale : 'zh-cn' | |
| 141 | + }); | |
| 142 | + var d = new Date(); | |
| 143 | + var year = d.getFullYear(); | |
| 144 | + var month = d.getMonth() + 1; | |
| 145 | + var day = d.getDate(); | |
| 146 | + if(month < 10) | |
| 147 | + month = "0" + month; | |
| 148 | + if(day < 10) | |
| 149 | + day = "0" + day; | |
| 150 | + $("#date").val(year + "-" + month + "-" + day); | |
| 151 | + | |
| 152 | + $("#date2").val(year + "-" + month + "-" + day); | |
| 153 | + | |
| 154 | + var fage=false; | |
| 155 | + var obj = []; | |
| 156 | + var xlList; | |
| 157 | + $.get('/report/lineList',function(result){ | |
| 158 | + xlList=result; | |
| 159 | + $.get('/user/companyData', function(result){ | |
| 160 | + obj = result; | |
| 161 | + var options = ''; | |
| 162 | + for(var i = 0; i < obj.length; i++){ | |
| 163 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 164 | + } | |
| 165 | + | |
| 166 | + if(obj.length ==0){ | |
| 167 | + $("#gsdmDiv").css('display','none'); | |
| 168 | + }else if(obj.length ==1){ | |
| 169 | + $("#gsdmDiv").css('display','none'); | |
| 170 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | |
| 171 | + $('#fgsdmDiv').css('display','none'); | |
| 172 | + } | |
| 173 | + $('#gsdm').html(options); | |
| 174 | + updateCompany(); | |
| 175 | + }); | |
| 176 | + }) | |
| 177 | + $("#gsdm").on("change",updateCompany); | |
| 178 | + function updateCompany(){ | |
| 179 | + var company = $('#gsdm').val(); | |
| 180 | + var options = ''; | |
| 181 | + for(var i = 0; i < obj.length; i++){ | |
| 182 | + if(obj[i].companyCode == company){ | |
| 183 | + var children = obj[i].children; | |
| 184 | + for(var j = 0; j < children.length; j++){ | |
| 185 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 186 | + } | |
| 187 | + } | |
| 188 | + } | |
| 189 | + $('#fgsdm').html(options); | |
| 190 | + } | |
| 191 | + | |
| 192 | + | |
| 193 | + var tempData = {}; | |
| 194 | + $.get('/report/lineList',function(xlList){ | |
| 195 | + var data = []; | |
| 196 | + data.push({id: " ", text: "全部线路"}); | |
| 197 | + $.get('/user/companyData', function(result){ | |
| 198 | + for(var i = 0; i < result.length; i++){ | |
| 199 | + var companyCode = result[i].companyCode; | |
| 200 | + var children = result[i].children; | |
| 201 | + for(var j = 0; j < children.length; j++){ | |
| 202 | + var code = children[j].code; | |
| 203 | + for(var k=0;k < xlList.length;k++ ){ | |
| 204 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | |
| 205 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | |
| 206 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + initPinYinSelect2('#line',data,''); | |
| 212 | + | |
| 213 | + }); | |
| 214 | + }); | |
| 215 | + | |
| 216 | + $("#line").on("change", function(){ | |
| 217 | + if($("#line").val() == " "){ | |
| 218 | + $("#gsdm").attr("disabled", false); | |
| 219 | + $("#fgsdm").attr("disabled", false); | |
| 220 | + } else { | |
| 221 | + var temp = tempData[$("#line").val()].split(":"); | |
| 222 | + $("#gsdm").val(temp[0]); | |
| 223 | + updateCompany(); | |
| 224 | + $("#fgsdm").val(temp[1]); | |
| 225 | + $("#gsdm").attr("disabled", true); | |
| 226 | + $("#fgsdm").attr("disabled", true); | |
| 227 | + } | |
| 228 | + }); | |
| 229 | + | |
| 230 | + var line =""; | |
| 231 | + var xlName =""; | |
| 232 | + var date = ""; | |
| 233 | + var date2 =""; | |
| 234 | + var gsdm=""; | |
| 235 | + var fgsdm=""; | |
| 236 | + $("#query").on("click",function(){ | |
| 237 | + $("#countLine").height($(window).height()-280); | |
| 238 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 239 | + layer.msg("请选择时间范围!"); | |
| 240 | + return; | |
| 241 | + } | |
| 242 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | |
| 243 | + layer.msg("请选择时间范围!"); | |
| 244 | + return; | |
| 245 | + } | |
| 246 | + line = $("#line").val(); | |
| 247 | + xlName = $("#select2-line-container").html(); | |
| 248 | + date = $("#date").val(); | |
| 249 | + date2 =$("#date2").val(); | |
| 250 | + gsdm =$("#gsdm").val(); | |
| 251 | + fgsdm=$("#fgsdm").val(); | |
| 252 | + if(line=="请选择"){ | |
| 253 | + line=""; | |
| 254 | + } | |
| 255 | + if(date==null || date =="" ||date2==null || date2 ==""){ | |
| 256 | + layer.msg('请选择时间段.'); | |
| 257 | + }else{ | |
| 258 | + var params = {}; | |
| 259 | + params['gsdm'] = gsdm; | |
| 260 | + params['fgsdm'] =fgsdm ; | |
| 261 | + params['line'] = line; | |
| 262 | + params['date'] = date; | |
| 263 | + params['date2'] = date2; | |
| 264 | + params['xlName'] = xlName; | |
| 265 | + params['type'] = "query"; | |
| 266 | + var i = layer.load(2); | |
| 267 | + $get('/report/countLineMileage',params,function(result){ | |
| 268 | + layer.close(i); | |
| 269 | + $("#datetodate").html(date+"至"+date2); | |
| 270 | + // 把数据填充到模版中 | |
| 271 | + var tbodyHtml = template('countLineList',{list:result}); | |
| 272 | + // 把渲染好的模版html文本追加到表格中 | |
| 273 | + $('#forms .countLine').html(tbodyHtml); | |
| 274 | + | |
| 275 | + if(result.length == 0) | |
| 276 | + $("#export").attr('disabled',"true"); | |
| 277 | + else | |
| 278 | + $("#export").removeAttr("disabled"); | |
| 279 | + }); | |
| 280 | + } | |
| 281 | + | |
| 282 | + }); | |
| 283 | + $("#countLine").height($(window).height()-280); | |
| 284 | + $("#export").on("click",function(){ | |
| 285 | + var params = {}; | |
| 286 | + params['gsdm'] = gsdm; | |
| 287 | + params['fgsdm'] =fgsdm ; | |
| 288 | + params['line'] = line; | |
| 289 | + params['date'] = date; | |
| 290 | + params['date2'] = date2; | |
| 291 | + params['xlName'] = xlName; | |
| 292 | + params['type'] = "export"; | |
| 293 | + params['by']='gs'; | |
| 294 | + $get('/report/countLineMileage',params,function(result){ | |
| 295 | + window.open("/downloadFile/download?fileName=线路公里统计表"); | |
| 296 | + }); | |
| 297 | + }); | |
| 298 | + }); | |
| 299 | +</script> | |
| 300 | +<script type="text/html" id="countLineList"> | |
| 301 | + {{each list as obj i}} | |
| 302 | + <tr> | |
| 303 | + <td>{{obj.gs}}</td> | |
| 304 | + <td>{{obj.fgs}}</td> | |
| 305 | + <td>{{obj.xlName}}</td> | |
| 306 | + <td>{{obj.jhzlc}}</td> | |
| 307 | + <td>{{obj.jhlc}}</td> | |
| 308 | + <td>{{obj.jcclc}}</td> | |
| 309 | + <td>{{obj.zlc}}</td> | |
| 310 | + <td>{{obj.jhnlc}}</td> | |
| 311 | + <td>{{obj.jhwlc}}</td> | |
| 312 | + <td>{{obj.jhnjcclc}}</td> | |
| 313 | + <td>{{obj.jhwjcclc}}</td> | |
| 314 | + <td>{{obj.zrwjcclc}}</td> | |
| 315 | + <td>{{obj.zrwjcclc1}}</td> | |
| 316 | + <td>{{obj.zrwjcclc2}}</td> | |
| 317 | + <td>{{obj.zrwjcclcqt}}</td> | |
| 318 | + <td>{{obj.kfks}}</td> | |
| 319 | + <td>{{obj.lbss}}</td> | |
| 320 | + <td>{{obj.ssgl_lz}}</td> | |
| 321 | + <td>{{obj.ssgl_dm}}</td> | |
| 322 | + <td>{{obj.ssgl_gz}}</td> | |
| 323 | + <td>{{obj.ssgl_jf}}</td> | |
| 324 | + <td>{{obj.ssgl_zs}}</td> | |
| 325 | + <td>{{obj.ssgl_qr}}</td> | |
| 326 | + <td>{{obj.ssgl_qc}}</td> | |
| 327 | + <td>{{obj.ssgl_kx}}</td> | |
| 328 | + <td>{{obj.ssgl_qh}}</td> | |
| 329 | + <td>{{obj.ssgl_yw}}</td> | |
| 330 | + <td>{{obj.ssgl_other}}</td> | |
| 331 | + <td>{{obj.ljyy}}</td> | |
| 332 | + <td>{{obj.ljjcc}}</td> | |
| 333 | + <td>{{obj.ljkfks}}</td> | |
| 334 | + </tr> | |
| 335 | + {{/each}} | |
| 336 | + {{if list.length == 0}} | |
| 337 | + <tr> | |
| 338 | + <td colspan="30"><h6 class="muted">没有找到相关数据</h6></td> | |
| 339 | + </tr> | |
| 340 | + {{/if}} | |
| 341 | +</script> | |
| 0 | 342 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_in_out.html
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | |
| 112 | 112 | //起点改变 |
| 113 | 113 | $f('startStation', f).on('change', function () { |
| 114 | - $f('endStation', outf).val($(this).val());//.trigger('change'); | |
| 114 | + $f('endStation', outf).val($(this).val()).trigger('change'); | |
| 115 | 115 | }).trigger('change'); |
| 116 | 116 | } |
| 117 | 117 | |
| ... | ... | @@ -149,13 +149,14 @@ |
| 149 | 149 | } |
| 150 | 150 | if(eCode==sch.qdzCode || eCode==sch.zdzCode){ |
| 151 | 151 | $f('startStation',inf).val(eCode).trigger('change'); |
| 152 | - $f('type2',outf).trigger('change'); | |
| 152 | + //$f('type2',outf).trigger('change'); | |
| 153 | + $f('endStation',outf).val(eCode).trigger('change'); | |
| 153 | 154 | return; |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | 157 | //进场起点 |
| 157 | 158 | $f('startStation',inf).val(eCode);//.trigger('change'); |
| 158 | - //终点trigger change 出发重计算 | |
| 159 | + //终点trigger change 触发重计算 | |
| 159 | 160 | $f('endStation',inf).trigger('change'); |
| 160 | 161 | |
| 161 | 162 | //中途进场 | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/main.html
| ... | ... | @@ -115,7 +115,7 @@ |
| 115 | 115 | zdz.trigger('change'); |
| 116 | 116 | f.trigger('ct_callback'); |
| 117 | 117 | } |
| 118 | - | |
| 118 | + | |
| 119 | 119 | function reCalcInputs_station() { |
| 120 | 120 | var f = $(this).parents('form'), |
| 121 | 121 | bcType = $('[name=bcType]', f).val(), |
| ... | ... | @@ -151,18 +151,19 @@ |
| 151 | 151 | default: |
| 152 | 152 | |
| 153 | 153 | var qc_time=upDown==0?information.upTravelTime:information.downTravelTime, |
| 154 | - qc_mileage=upDown==0?information.upMileage:information.downMileage; | |
| 154 | + qc_mileage=upDown==0?information.upMileage:information.downMileage, _type; | |
| 155 | 155 | if(is_normal_sch(f)){ |
| 156 | - bcType='normal'; | |
| 156 | + _type='normal'; | |
| 157 | 157 | mileage=qc_mileage; |
| 158 | 158 | } |
| 159 | 159 | else{ |
| 160 | - bcType='region'; | |
| 160 | + _type='region'; | |
| 161 | 161 | mileage = calcMileage(stationRoutes[upDown], qdzCode, zdzCode); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | time = gb_common.mul(gb_common.accDiv(qc_time, qc_mileage), mileage); |
| 165 | - $('[name=bcType]', f).val(bcType); | |
| 165 | + if(bcType!='ldks' && bcType!='major' && bcType!='venting') | |
| 166 | + $('[name=bcType]', f).val(_type); | |
| 166 | 167 | } |
| 167 | 168 | } |
| 168 | 169 | |
| ... | ... | @@ -172,7 +173,7 @@ |
| 172 | 173 | f.trigger('ct_callback'); |
| 173 | 174 | } |
| 174 | 175 | |
| 175 | - | |
| 176 | + | |
| 176 | 177 | function reCalcEndTime() { |
| 177 | 178 | var f = $(this).parents('.add-sch-form') |
| 178 | 179 | , startDate = $f('fcsj', f).val()//开始时间 |
| ... | ... | @@ -197,7 +198,7 @@ |
| 197 | 198 | var qc_time=upDown==0?information.upTravelTime:information.downTravelTime, |
| 198 | 199 | qc_mileage=upDown==0?information.upMileage:information.downMileage; |
| 199 | 200 | |
| 200 | - time = gb_common.mul(gb_common.accDiv(qc_time, qc_mileage), mileage); | |
| 201 | + time = gb_common.mul(gb_common.accDiv(qc_time, qc_mileage), mileage); | |
| 201 | 202 | } |
| 202 | 203 | } |
| 203 | 204 | |
| ... | ... | @@ -339,4 +340,4 @@ |
| 339 | 340 | } |
| 340 | 341 | })(); |
| 341 | 342 | </script> |
| 342 | -</div> | |
| 343 | +</div> | |
| 343 | 344 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/js/main.js
| ... | ... | @@ -47,7 +47,7 @@ var gb_main_ep = new EventProxy(), |
| 47 | 47 | $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); |
| 48 | 48 | }, 1000); |
| 49 | 49 | //弹出更新说明 |
| 50 | - showUpdateDescription(); | |
| 50 | + //showUpdateDescription(); | |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | 53 | function g_emit(id) { |
| ... | ... | @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) { |
| 169 | 169 | function showUpdateDescription() { |
| 170 | 170 | //更新说明 |
| 171 | 171 | var updateDescription = { |
| 172 | - date: '2017-07-05', | |
| 173 | - text: '<h5>稍微调整了添加子任务的界面</h5><h5>1、现在进出场子任务也必须选择进场原因</h5><h5>2、现在进出场子任务可以勾选 “无售票员” 如果是无人售票线路,请忽略这个选项</h5><h5>3、现在做中途进场子任务时,可以勾选“换车出场至中途站继续营运”</h5>' | |
| 172 | + date: '2017-07-14', | |
| 173 | + text: '<h5></h5>' | |
| 174 | 174 | }; |
| 175 | 175 | |
| 176 | 176 | var storage = window.localStorage | ... | ... |