Commit 48ce81c7136e158d07ae16961025567b9c2fc727
1 parent
4a5801f4
update...
Showing
13 changed files
with
129 additions
and
34 deletions
src/main/java/com/bsth/ServiceStateTest.java
| ... | ... | @@ -3,8 +3,8 @@ package com.bsth; |
| 3 | 3 | public class ServiceStateTest { |
| 4 | 4 | |
| 5 | 5 | public static void main(String[] args) { |
| 6 | - System.out.println("运营状态:" + getService(268435456)); | |
| 7 | - System.out.println("上下行:" + getUpOrDown(268435456)); | |
| 6 | + System.out.println("运营状态:" + getService(603979776)); | |
| 7 | + System.out.println("上下行:" + getUpOrDown(603979776)); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** | ... | ... |
src/main/java/com/bsth/WebAppConfiguration.java
| ... | ... | @@ -25,8 +25,8 @@ import com.bsth.websocket.handler.RealControlSocketHandler; |
| 25 | 25 | @ComponentScan |
| 26 | 26 | public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{ |
| 27 | 27 | |
| 28 | - @Autowired | |
| 29 | - HttpOpLogInterceptor httpOpLogInterceptor; | |
| 28 | +// @Autowired | |
| 29 | +// HttpOpLogInterceptor httpOpLogInterceptor; | |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @Title: httpPutFormContentFilter |
| ... | ... | @@ -63,11 +63,11 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 63 | 63 | * |
| 64 | 64 | * @Title: addInterceptors |
| 65 | 65 | * @Description: TODO(HTTP结构化访问日志记录 ) |
| 66 | - */ | |
| 66 | + | |
| 67 | 67 | @Override |
| 68 | 68 | public void addInterceptors(InterceptorRegistry registry) { |
| 69 | 69 | registry.addInterceptor(httpOpLogInterceptor); |
| 70 | - } | |
| 70 | + }*/ | |
| 71 | 71 | |
| 72 | 72 | @Override |
| 73 | 73 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | ... | ... |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| ... | ... | @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 51 | 51 | @Override |
| 52 | 52 | public void run(String... arg0) throws Exception { |
| 53 | 53 | logger.info("ArrivalData_GPS,30,10"); |
| 54 | - //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS); | |
| 54 | + Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 600, TimeUnit.SECONDS); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | @Component | ... | ... |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| ... | ... | @@ -3,7 +3,9 @@ package com.bsth.data.match; |
| 3 | 3 | import java.text.SimpleDateFormat; |
| 4 | 4 | import java.util.ArrayList; |
| 5 | 5 | import java.util.Collections; |
| 6 | +import java.util.HashMap; | |
| 6 | 7 | import java.util.List; |
| 8 | +import java.util.Map; | |
| 7 | 9 | import java.util.Set; |
| 8 | 10 | |
| 9 | 11 | import org.slf4j.Logger; |
| ... | ... | @@ -42,6 +44,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 42 | 44 | |
| 43 | 45 | private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); |
| 44 | 46 | |
| 47 | + private static Map<String, ExpectArrivalEnd> expectMap = new HashMap<>(); | |
| 48 | + | |
| 45 | 49 | /** |
| 46 | 50 | * |
| 47 | 51 | * @Title: start |
| ... | ... | @@ -209,14 +213,29 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 209 | 213 | * @Description: TODO(车辆发出) |
| 210 | 214 | */ |
| 211 | 215 | public void carOut(MatchResult mr){ |
| 216 | + ScheduleRealInfo sch = mr.sch; | |
| 217 | + | |
| 218 | + if(expectMap.containsKey(nbbm)){ | |
| 219 | + ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 220 | + if(mr.ts < ead.getEndTime()) | |
| 221 | + return; | |
| 222 | + else | |
| 223 | + expectMap.remove(nbbm); | |
| 224 | + } | |
| 212 | 225 | //设置发车时间 |
| 213 | - mr.sch.setFcsjActualAll(mr.ts); | |
| 226 | + sch.setFcsjActualAll(mr.ts); | |
| 214 | 227 | //通知客户端 |
| 215 | - sendUtils.sendFcsj(mr.sch); | |
| 228 | + sendUtils.sendFcsj(sch); | |
| 216 | 229 | //持久化 |
| 217 | - dayOfSchedule.save(mr.sch); | |
| 230 | + dayOfSchedule.save(sch); | |
| 218 | 231 | //车辆当前执行班次 |
| 219 | - dayOfSchedule.addExecPlan(mr.sch); | |
| 232 | + dayOfSchedule.addExecPlan(sch); | |
| 233 | + //期望车辆到达的终点 | |
| 234 | + ExpectArrivalEnd ead = new ExpectArrivalEnd(); | |
| 235 | + ead.setNbbm(sch.getClZbh()); | |
| 236 | + ead.setEndStation(sch.getZdzCode()); | |
| 237 | + ead.setEndTime(sch.getZdsjT()); | |
| 238 | + expectMap.put(ead.getNbbm(), ead); | |
| 220 | 239 | } |
| 221 | 240 | |
| 222 | 241 | /** |
| ... | ... | @@ -225,12 +244,23 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 225 | 244 | * @Description: TODO(车辆进入终点站) |
| 226 | 245 | */ |
| 227 | 246 | public void carInStop(MatchResult mr){ |
| 228 | - mr.sch.setZdsjActualAll(mr.ts); | |
| 247 | + ScheduleRealInfo sch = mr.sch; | |
| 248 | + String nbbm=sch.getClZbh(); | |
| 249 | + if(expectMap.containsKey(nbbm)){ | |
| 250 | + ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 251 | + if(mr.ts < ead.getEndTime() | |
| 252 | + && !mr.sch.getZdzCode().equals(ead.getEndStation())){ | |
| 253 | + return; | |
| 254 | + } | |
| 255 | + else | |
| 256 | + expectMap.remove(nbbm); | |
| 257 | + } | |
| 258 | + sch.setZdsjActualAll(mr.ts); | |
| 229 | 259 | |
| 230 | - int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh()); | |
| 231 | - ScheduleRealInfo next = dayOfSchedule.next(mr.sch); | |
| 260 | + int doneSum = dayOfSchedule.doneSum(nbbm); | |
| 261 | + ScheduleRealInfo next = dayOfSchedule.next(sch); | |
| 232 | 262 | if(null != next){ |
| 233 | - next.setQdzArrDateSJ(mr.sch.getZdsjActual()); | |
| 263 | + next.setQdzArrDateSJ(sch.getZdsjActual()); | |
| 234 | 264 | //下发调度指令 |
| 235 | 265 | directiveService.send60Dispatch(next, doneSum, "到站@系统"); |
| 236 | 266 | |
| ... | ... | @@ -239,18 +269,18 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 239 | 269 | next.setFcsjActualAll(mr.ts); |
| 240 | 270 | |
| 241 | 271 | //套跑 -下发线路切换指令 |
| 242 | - if(!next.getXlBm().equals(mr.sch.getXlBm())) | |
| 243 | - directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 272 | + if(!next.getXlBm().equals(sch.getXlBm())) | |
| 273 | + directiveService.lineChange(nbbm, next.getXlBm(), "套跑@系统"); | |
| 244 | 274 | } |
| 245 | 275 | else//下发文本指令(已结束运营) |
| 246 | - directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统"); | |
| 276 | + directiveService.send60Phrase(nbbm, "到达终点 " + sch.getZdzName() + ",已完成当日所有排班。", "系统"); | |
| 247 | 277 | //通知客户端 |
| 248 | - sendUtils.sendZdsj(mr.sch, next, doneSum); | |
| 278 | + sendUtils.sendZdsj(sch, next, doneSum); | |
| 249 | 279 | //持久化 |
| 250 | - dayOfSchedule.save(mr.sch); | |
| 251 | - logger.info(mr.sch.getClZbh() + "移除正在执行班次," + mr.sch.getFcsj()); | |
| 280 | + dayOfSchedule.save(sch); | |
| 281 | + logger.info(sch.getClZbh() + "移除正在执行班次," + sch.getFcsj()); | |
| 252 | 282 | //移除车辆正在执行班次索引 |
| 253 | - dayOfSchedule.removeExecPlan(mr.sch.getClZbh()); | |
| 283 | + dayOfSchedule.removeExecPlan(nbbm); | |
| 254 | 284 | } |
| 255 | 285 | |
| 256 | 286 | /** |
| ... | ... | @@ -334,4 +364,14 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 334 | 364 | dayOfSchedule = arg0.getBean(DayOfSchedule.class); |
| 335 | 365 | directiveService = arg0.getBean(DirectiveService.class); |
| 336 | 366 | } |
| 367 | + | |
| 368 | + /** | |
| 369 | + * | |
| 370 | + * @Title: removeExpect | |
| 371 | + * @Description: TODO(清除预期站点) | |
| 372 | + * @param @param nbbm | |
| 373 | + */ | |
| 374 | + public void removeExpect(String nbbm){ | |
| 375 | + expectMap.remove(nbbm); | |
| 376 | + } | |
| 337 | 377 | } | ... | ... |
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
0 → 100644
| 1 | +package com.bsth.data.match; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * @ClassName: ExpectArrivalEnd | |
| 6 | + * @Description: TODO(期望车辆在某个时间段到达某个终点........) | |
| 7 | + * @author PanZhao | |
| 8 | + * @date 2016年11月2日 下午8:04:43 | |
| 9 | + * | |
| 10 | + */ | |
| 11 | +public class ExpectArrivalEnd { | |
| 12 | + | |
| 13 | + private String nbbm; | |
| 14 | + | |
| 15 | + private String endStation; | |
| 16 | + | |
| 17 | + private Long endTime; | |
| 18 | + | |
| 19 | + public String getNbbm() { | |
| 20 | + return nbbm; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setNbbm(String nbbm) { | |
| 24 | + this.nbbm = nbbm; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getEndStation() { | |
| 28 | + return endStation; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setEndStation(String endStation) { | |
| 32 | + this.endStation = endStation; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public Long getEndTime() { | |
| 36 | + return endTime; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setEndTime(Long endTime) { | |
| 40 | + this.endTime = endTime; | |
| 41 | + } | |
| 42 | +} | ... | ... |
src/main/java/com/bsth/oplog/db/DBHelper.java
src/main/java/com/bsth/oplog/http/HttpOpLogInterceptor.java
| ... | ... | @@ -19,7 +19,7 @@ import org.springframework.web.servlet.ModelAndView; |
| 19 | 19 | * @date 2016年10月20日 上午12:03:11 |
| 20 | 20 | * |
| 21 | 21 | */ |
| 22 | -@Component | |
| 22 | +//@Component | |
| 23 | 23 | public class HttpOpLogInterceptor implements HandlerInterceptor { |
| 24 | 24 | |
| 25 | 25 | private final PathMatcher pathMatcher = new AntPathMatcher(); | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -274,8 +274,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 274 | 274 | return null; |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | - upDown = gpsData.getUpDown(); | |
| 278 | - state = gpsData.getState(); | |
| 277 | + else{ | |
| 278 | + upDown = gpsData.getUpDown(); | |
| 279 | + state = gpsData.getState(); | |
| 280 | + } | |
| 279 | 281 | } else { |
| 280 | 282 | upDown = Integer.parseInt(sch.getXlDir()); |
| 281 | 283 | state = 0; | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.stereotype.Service; |
| 9 | 9 | |
| 10 | 10 | import com.bsth.data.BasicData; |
| 11 | +import com.bsth.data.match.Arrival2Schedule; | |
| 11 | 12 | import com.bsth.data.schedule.DayOfSchedule; |
| 12 | 13 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 13 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -27,6 +28,9 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 27 | 28 | @Autowired |
| 28 | 29 | DayOfSchedule dayOfSchedule; |
| 29 | 30 | |
| 31 | + @Autowired | |
| 32 | + Arrival2Schedule arrival2Schedule; | |
| 33 | + | |
| 30 | 34 | @Transactional |
| 31 | 35 | @Override |
| 32 | 36 | public Map<String, Object> save(ChildTaskPlan t) { |
| ... | ... | @@ -44,6 +48,9 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 44 | 48 | dayOfSchedule.save(sch); |
| 45 | 49 | |
| 46 | 50 | rs.put("t", sch); |
| 51 | + | |
| 52 | + if(sch.getZdsjActual() == null) | |
| 53 | + arrival2Schedule.removeExpect(sch.getClZbh()); | |
| 47 | 54 | return rs; |
| 48 | 55 | } |
| 49 | 56 | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= true |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201:3306/qp_control | |
| 11 | +spring.datasource.url= jdbc:mysql://127.0.0.1:3306/qp_control | |
| 12 | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= 123456 | |
| 13 | +spring.datasource.password= panzhao | |
| 14 | 14 | #DATASOURCE |
| 15 | 15 | spring.datasource.max-active=100 |
| 16 | 16 | spring.datasource.max-idle=8 |
| ... | ... | @@ -26,7 +26,7 @@ spring.datasource.validation-query=select 1 |
| 26 | 26 | ## |
| 27 | 27 | #222.66.0.204:5555 |
| 28 | 28 | ##\u5B9E\u65F6gps |
| 29 | -http.gps.real.url= http://192.168.168.192:8080/transport_server/rtgps/ | |
| 29 | +http.gps.real.url= http://192.168.168.201:9090/transport_server/rtgps/ | |
| 30 | 30 | #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ |
| 31 | 31 | ##\u6D88\u606F\u4E0B\u53D1 |
| 32 | -http.send.directive = http://192.168.168.192:8080/transport_server/message/ | |
| 32 | +http.send.directive = http://192.168.168.201:9090/transport_server/message/ | ... | ... |
src/main/resources/ms-jdbc.properties
| ... | ... | @@ -4,6 +4,6 @@ |
| 4 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | |
| 6 | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 7 | +ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 8 | 8 | ms.mysql.username= root |
| 9 | -ms.mysql.password= 123456 | |
| 9 | +ms.mysql.password= panzhao | ... | ... |
src/main/resources/static/real_control_v2/css/line_schedule.css
| ... | ... | @@ -511,11 +511,14 @@ dl.relevance-active.intimity dd.tl-zzzx span.fcsj-diff { |
| 511 | 511 | color: #5e5a5a |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | -dl.relevance-active dd span.fcsj-diff, | |
| 515 | 514 | dl.relevance-active.intimity dd span.fcsj-diff { |
| 516 | 515 | color: #d7d6d6; |
| 517 | 516 | } |
| 518 | 517 | |
| 518 | +dl.relevance-active dd span.fcsj-diff{ | |
| 519 | + color: #aba6a6; | |
| 520 | +} | |
| 521 | + | |
| 519 | 522 | /*dl.relevance-active a { |
| 520 | 523 | color: #dff0ff; |
| 521 | 524 | }*/ | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| ... | ... | @@ -275,7 +275,7 @@ var gb_schedule_table = (function() { |
| 275 | 275 | |
| 276 | 276 | //计算应发未发数量 |
| 277 | 277 | var calc_yfwf_num = function(lineCode){ |
| 278 | - console.log('calc_yfwf_num...', lineCode); | |
| 278 | + | |
| 279 | 279 | var schArr=line2Schedule[lineCode] |
| 280 | 280 | ,yfwf_num=0 |
| 281 | 281 | ,t = new Date().valueOf(); |
| ... | ... | @@ -288,6 +288,7 @@ var gb_schedule_table = (function() { |
| 288 | 288 | yfwf_num ++; |
| 289 | 289 | }); |
| 290 | 290 | |
| 291 | + console.log('calc_yfwf_num...', lineCode, yfwf_num); | |
| 291 | 292 | $('#badge_yfwf_num_'+lineCode).text(yfwf_num); |
| 292 | 293 | } |
| 293 | 294 | ... | ... |