Commit d80b9172a0e4aa72e934e29b67c670c5bc841c3b

Authored by 潘钊
2 parents 316f67ab 27c0d50e

Merge branch 'minhang' into qingpu

# Conflicts:
#	src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
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/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
... ... @@ -37,7 +37,7 @@ public class DBHelper implements CommandLineRunner{
37 37  
38 38 @Override
39 39 public void run() {
40   - //persistence.batchSave(buffer);
  40 + persistence.batchSave(buffer);
41 41 }
42 42 }
43 43  
... ...
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/repository/SectionRepository.java
... ... @@ -58,7 +58,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
58 58  
59 59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
60 60  
61   - "?6 , GEOMFROMTEXT(?7) , GEOMFROMTEXT(?8) , ?9 , ?10 ,"+
  61 + "?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+
62 62  
63 63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+
64 64  
... ... @@ -83,8 +83,8 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
83 83 @Transactional
84 84 @Modifying
85 85 @Query(value="UPDATE bsth_c_section SET " +
86   - "gsection_vector = GEOMFROMTEXT(?2) , " +
87   - "bsection_vector = GEOMFROMTEXT(?3)," +
  86 + "gsection_vector = ST_GeomFromText(?2) , " +
  87 + "bsection_vector = ST_GeomFromText(?3)," +
88 88 "section_code = ?4," +
89 89 "section_name = ?5," +
90 90 "croses_road = ?6," +
... ...
src/main/java/com/bsth/repository/StationRepository.java
... ... @@ -61,7 +61,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
61 61 "create_by,update_by,id) " +
62 62 " VALUES(" +
63 63 "?1 , ?2 , ?3 , ?4 , ?5," +
64   - "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
  64 + "?6 , ?7 , ?8 , ?9 , ST_GeomFromText(?10),ST_GeomFromText(?11)," +
65 65 "?12 ,?13, ?14, ?15, ?16," +
66 66 "?17,?18,?19)", nativeQuery=true)
67 67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints,
... ... @@ -93,8 +93,8 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
93 93 "g_laty = ?7 , " +
94 94 "x = ?8 , " +
95 95 "y = ?9 , " +
96   - "b_polygon_grid = GeomFromText(?10) , " +
97   - "g_polygon_grid = GeomFromText(?11) , " +
  96 + "b_polygon_grid = ST_GeomFromText(?10) , " +
  97 + "g_polygon_grid = ST_GeomFromText(?11) , " +
98 98 "destroy = ?12 , " +
99 99 "radius = ?13 , " +
100 100 "shapes_type = ?14 , " +
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -274,8 +274,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; 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/impl/SectionServiceImpl.java
... ... @@ -181,10 +181,14 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
181 181 Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
182 182  
183 183 // WGS坐标点集合
184   - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  184 + String gsectionVector = null;
  185 + if(!sectionsWJPpoints.equals(""))
  186 + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
185 187  
186 188 // 原坐标点集合
187   - String bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
  189 + String bsectionVectorS = null;
  190 + if(!sectionsBpoints.equals(""))
  191 + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
188 192  
189 193 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
190 194  
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -1029,6 +1029,16 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1029 1029  
1030 1030 }
1031 1031  
  1032 + if(bPloygonGrid.equals(""))
  1033 + bPloygonGrid = null;
  1034 + else
  1035 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1036 +
  1037 + if(gPloygonGrid.equals(""))
  1038 + gPloygonGrid = null;
  1039 + else
  1040 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
  1041 +
1032 1042 // 保存站点
1033 1043 repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints,
1034 1044  
... ... @@ -1219,9 +1229,16 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1219 1229  
1220 1230 }
1221 1231  
1222   - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1232 + if(bPloygonGrid.equals(""))
  1233 + bPloygonGrid = null;
  1234 + else
  1235 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1236 +
  1237 + if(gPloygonGrid.equals(""))
  1238 + gPloygonGrid = null;
  1239 + else
  1240 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
1223 1241  
1224   - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
1225 1242  
1226 1243 // 是否撤销
1227 1244 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
... ...
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&lt;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&lt;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  
... ...