Commit 2e169c96f0c9680432c2c49159d86548a4c2cdd9

Authored by 潘钊
1 parent c667f4ec

update...

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -488,7 +488,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, @@ -488,7 +488,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
488 long t = new Date().getTime(); 488 long t = new Date().getTime();
489 if(c != 1) 489 if(c != 1)
490 t -= ONE_DAY - (1000 * 60 * 60 * 2); 490 t -= ONE_DAY - (1000 * 60 * 60 * 2);
491 - for(int i = 0; i < 10; i ++){ 491 + for(int i = 0; i < 3; i ++){
492 rs.add(fmtyyyyMMdd.print(t)); 492 rs.add(fmtyyyyMMdd.print(t));
493 t -= ONE_DAY; 493 t -= ONE_DAY;
494 } 494 }
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
11 * @date 2016年5月11日 下午4:32:07 11 * @date 2016年5月11日 下午4:32:07
12 * 12 *
13 */ 13 */
14 -public class GpsEntity { 14 +public class GpsEntity implements Cloneable{
15 15
16 /** 公司代码 */ 16 /** 公司代码 */
17 private Short companyCode; 17 private Short companyCode;
@@ -98,6 +98,14 @@ public class GpsEntity { @@ -98,6 +98,14 @@ public class GpsEntity {
98 */ 98 */
99 private int source = -1; 99 private int source = -1;
100 100
  101 + public Object clone() {
  102 + try {
  103 + return super.clone();
  104 + } catch (CloneNotSupportedException e) {
  105 + return null;
  106 + }
  107 + }
  108 +
101 public String getDeviceId() { 109 public String getDeviceId() {
102 return deviceId; 110 return deviceId;
103 } 111 }
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
@@ -41,7 +41,7 @@ public class GpsRealAnalyse { @@ -41,7 +41,7 @@ public class GpsRealAnalyse {
41 @Autowired 41 @Autowired
42 GpsRealData gpsRealData; 42 GpsRealData gpsRealData;
43 43
44 - static ExecutorService threadPool = Executors.newFixedThreadPool(20); 44 + static ExecutorService threadPool = Executors.newFixedThreadPool(25);
45 45
46 public static long st; 46 public static long st;
47 public static CountDownLatch count; 47 public static CountDownLatch count;
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -90,6 +90,11 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -90,6 +90,11 @@ public class InOutStationSignalHandle extends SignalHandle{
90 if(prev.getInstation() > 0 && gps.getInstation() > 0 90 if(prev.getInstation() > 0 && gps.getInstation() > 0
91 && !prev.getStopNo().equals(gps.getStopNo())) 91 && !prev.getStopNo().equals(gps.getStopNo()))
92 return true; 92 return true;
  93 +
  94 + //在被起点站覆盖的情况下出场
  95 + if(isOutPark(gps, prev)){
  96 + return true;
  97 + }
93 return false; 98 return false;
94 } 99 }
95 100
@@ -110,11 +115,15 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -110,11 +115,15 @@ public class InOutStationSignalHandle extends SignalHandle{
110 if(prev.getInstation() == 2 && gps.getInstation() == 1){ 115 if(prev.getInstation() == 2 && gps.getInstation() == 1){
111 return true; 116 return true;
112 } 117 }
  118 +
  119 + //被起点站覆盖的情况下进场
  120 + if(isInPark(gps, prev))
  121 + return true;
113 return false; 122 return false;
114 } 123 }
115 124
116 /** 125 /**
117 - * 出站 126 + * 出站/出场
118 * @param gps 当前点 127 * @param gps 当前点
119 * @param prev 上一个点 128 * @param prev 上一个点
120 */ 129 */
@@ -133,7 +142,9 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -133,7 +142,9 @@ public class InOutStationSignalHandle extends SignalHandle{
133 return; 142 return;
134 143
135 //起点发车 144 //起点发车
136 - if(qdzCode != null && prev.getStopNo().equals(qdzCode) 145 + if(qdzCode != null
  146 + && prev.getStopNo().equals(qdzCode)
  147 + && gps.getInstation()==0
137 && !willDepart(gps, prev, sch)){ 148 && !willDepart(gps, prev, sch)){
138 149
139 //发车班次匹配 150 //发车班次匹配
@@ -168,6 +179,21 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -168,6 +179,21 @@ public class InOutStationSignalHandle extends SignalHandle{
168 logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); 179 logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
169 } 180 }
170 else if(sch.getBcType().equals("out")){ 181 else if(sch.getBcType().equals("out")){
  182 + //有出场动作(起点站覆盖停车场时,并且不设置出站既出场,逻辑可能会走到这里)
  183 + try{
  184 + if(isOutPark(gps, prev)){
  185 + if(prev.getCarparkNo().equals(sch.getQdzCode())){
  186 + //再试一下出场
  187 + GpsEntity prevClone = (GpsEntity) prev.clone(),
  188 + gpsClone = (GpsEntity) gps.clone();
  189 + prevClone.setStopNo(prevClone.getCarparkNo());
  190 + gpsClone.setInstation(0);
  191 + outStation(gpsClone, prevClone);
  192 + return;
  193 + }
  194 + }
  195 + }catch (Exception e){logger.error("",e);}
  196 +
171 ScheduleRealInfo next = dayOfSchedule.nextSame(sch); 197 ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
172 //如果下一个班次是区间,并且是环线 198 //如果下一个班次是区间,并且是环线
173 if(next != null && next.getBcType().equals("region")){ 199 if(next != null && next.getBcType().equals("region")){
@@ -255,7 +281,8 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -255,7 +281,8 @@ public class InOutStationSignalHandle extends SignalHandle{
255 private void inStation(GpsEntity gps, GpsEntity prev){ 281 private void inStation(GpsEntity gps, GpsEntity prev){
256 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); 282 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
257 283
258 - if(gps.getStopNo().equals(sch.getZdzCode())){ 284 + if(gps.getStopNo().equals(sch.getZdzCode())
  285 + && !gps.getStopNo().equals(prev.getStopNo())){
259 286
260 int diff = 0; 287 int diff = 0;
261 try{ 288 try{
@@ -336,6 +363,25 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -336,6 +363,25 @@ public class InOutStationSignalHandle extends SignalHandle{
336 scheduleSignalState.signalRetrospect(gps, sch); 363 scheduleSignalState.signalRetrospect(gps, sch);
337 } 364 }
338 */ 365 */
  366 + //被起点站覆盖的情况下进场,没有设置出站既是出场,逻辑会走到这里(模拟进站信号)
  367 + if(sch.getBcType().equals("in")){
  368 + try{
  369 + if(isInPark(gps, prev)){
  370 + if(gps.getCarparkNo().equals(sch.getZdzCode())){
  371 + //再试一下进场
  372 + GpsEntity gpsClone = (GpsEntity) gps.clone(),
  373 + prevClone = (GpsEntity) prev.clone();
  374 + gpsClone.setStopNo(gpsClone.getCarparkNo());
  375 + prevClone.setStopNo(null);
  376 + inStation(gpsClone, prevClone);
  377 + return;
  378 + }
  379 + }
  380 + }catch (Exception e){
  381 + logger.error("", e);
  382 + }
  383 + }
  384 +
339 //如果当前班次是出场,并且进的是下一个班次的终点 385 //如果当前班次是出场,并且进的是下一个班次的终点
340 if(sch.getBcType().equals("out")){ 386 if(sch.getBcType().equals("out")){
341 ScheduleRealInfo next = dayOfSchedule.next(sch); 387 ScheduleRealInfo next = dayOfSchedule.next(sch);
@@ -447,4 +493,16 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -447,4 +493,16 @@ public class InOutStationSignalHandle extends SignalHandle{
447 }*/ 493 }*/
448 return false; 494 return false;
449 } 495 }
  496 +
  497 + private boolean isOutPark(GpsEntity gps, GpsEntity prve){
  498 + if(StringUtils.isNotEmpty(prve.getCarparkNo()) && StringUtils.isEmpty(gps.getCarparkNo()))
  499 + return true;
  500 + return false;
  501 + }
  502 +
  503 + private boolean isInPark(GpsEntity gps, GpsEntity prve){
  504 + if(StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo()))
  505 + return true;
  506 + return false;
  507 + }
450 } 508 }
451 \ No newline at end of file 509 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/arrival/handlers/StationInsideHandle.java
@@ -25,6 +25,7 @@ public class StationInsideHandle extends SignalHandle { @@ -25,6 +25,7 @@ public class StationInsideHandle extends SignalHandle {
25 if (parkCode != null) { 25 if (parkCode != null) {
26 gps.setInstation(2); 26 gps.setInstation(2);
27 gps.setStopNo(parkCode); 27 gps.setStopNo(parkCode);
  28 + gps.setCarparkNo(parkCode);
28 } 29 }
29 30
30 //是否在站内 31 //是否在站内
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
@@ -48,8 +48,8 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -48,8 +48,8 @@ public class GpsDataRecovery implements ApplicationContextAware {
48 //按线路分组数据 48 //按线路分组数据
49 ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create(); 49 ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create();
50 for (GpsEntity gps : list) { 50 for (GpsEntity gps : list) {
51 - if (gps.getLineId() != null)  
52 - listMap.put(gps.getLineId(), gps); 51 + if (gps.getNbbm() != null)
  52 + listMap.put(gps.getNbbm(), gps);
53 } 53 }
54 54
55 55
@@ -57,10 +57,10 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -57,10 +57,10 @@ public class GpsDataRecovery implements ApplicationContextAware {
57 57
58 CountDownLatch count = new CountDownLatch(keys.size()); 58 CountDownLatch count = new CountDownLatch(keys.size());
59 GpsComp comp = new GpsComp(); 59 GpsComp comp = new GpsComp();
60 - for (String lineId : keys) {  
61 - Collections.sort(listMap.get(lineId), comp);  
62 - threadPool.execute(new RecoveryThread(listMap.get(lineId), count));  
63 - /*if(nbbm.equals("W7E-016")) 60 + for (String nbbm : keys) {
  61 + Collections.sort(listMap.get(nbbm), comp);
  62 + threadPool.execute(new RecoveryThread(listMap.get(nbbm), count));
  63 + /*if(nbbm.equals("W9H-088"))
64 new RecoveryThread(listMap.get(nbbm), count).run();*/ 64 new RecoveryThread(listMap.get(nbbm), count).run();*/
65 /*if(lineId.equals("60028")) 65 /*if(lineId.equals("60028"))
66 new RecoveryThread(listMap.get(lineId), count).run();*/ 66 new RecoveryThread(listMap.get(lineId), count).run();*/
@@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
84 Calendar calendar = Calendar.getInstance(); 84 Calendar calendar = Calendar.getInstance();
85 int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); 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=194";// + dayOfYear; 87 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=206";// + dayOfYear;
88 JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); 88 JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
89 89
90 List<GpsEntity> list = 90 List<GpsEntity> list =
@@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
153 boolean task; 153 boolean task;
154 for (GpsEntity gps : list) { 154 for (GpsEntity gps : list) {
155 try { 155 try {
156 - /*if(gps.getTimestamp() >= 1495512240000L){ 156 + /*if(gps.getTimestamp() >= 1500942270000L){
157 System.out.println("debugger..."); 157 System.out.println("debugger...");
158 }*/ 158 }*/
159 //是否有任务 159 //是否有任务
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -884,8 +884,12 @@ public class DayOfSchedule { @@ -884,8 +884,12 @@ public class DayOfSchedule {
884 } 884 }
885 885
886 public void addExecPlan(ScheduleRealInfo sch) { 886 public void addExecPlan(ScheduleRealInfo sch) {
887 - if (sch != null)  
888 - carExecutePlanMap.put(sch.getClZbh(), sch); 887 + if (sch != null){
  888 + if(sch.getStatus()==2)
  889 + reCalcExecPlan(sch.getClZbh());
  890 + else
  891 + carExecutePlanMap.put(sch.getClZbh(), sch);
  892 + }
889 else 893 else
890 carExecutePlanMap.remove(sch.getClZbh()); 894 carExecutePlanMap.remove(sch.getClZbh());
891 } 895 }
src/main/resources/static/real_control_v2/js/common.js
@@ -232,8 +232,8 @@ var gb_common = (function () { @@ -232,8 +232,8 @@ var gb_common = (function () {
232 data.push({ 232 data.push({
233 value: name, 233 value: name,
234 code: code, 234 code: code,
235 - fullChars: pinyin.getFullChars(name).toLocaleLowerCase(),  
236 - camelChars: pinyin.getCamelChars(name).toLocaleLowerCase() 235 + fullChars: pinyin.getFullChars(name),
  236 + camelChars: pinyin.getCamelChars(name)
237 }); 237 });
238 } 238 }
239 init_autocom_pinyin(element, data); 239 init_autocom_pinyin(element, data);
@@ -271,7 +271,7 @@ var gb_common = (function () { @@ -271,7 +271,7 @@ var gb_common = (function () {
271 minLength: 1, 271 minLength: 1,
272 delay: 50, 272 delay: 50,
273 source: function (release) { 273 source: function (release) {
274 - var q = $('input', element).val().toLocaleLowerCase(), 274 + var q = $('input', element).val().toUpperCase(),
275 rs = [], 275 rs = [],
276 count = 0; 276 count = 0;
277 277
@@ -295,7 +295,7 @@ var gb_common = (function () { @@ -295,7 +295,7 @@ var gb_common = (function () {
295 minLength: 1, 295 minLength: 1,
296 delay: 50, 296 delay: 50,
297 source: function (release) { 297 source: function (release) {
298 - var q = $('input', element).val().toLocaleLowerCase(), 298 + var q = $('input', element).val().toUpperCase(),
299 rs = [], 299 rs = [],
300 count = 0; 300 count = 0;
301 301
src/main/resources/static/real_control_v2/js/data/data_basic.js
@@ -63,8 +63,8 @@ var gb_data_basic = (function () { @@ -63,8 +63,8 @@ var gb_data_basic = (function () {
63 code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId']; 63 code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId'];
64 data.push({ 64 data.push({
65 value: code + '/' + p.name, 65 value: code + '/' + p.name,
66 - fullChars: p.fullChars,  
67 - camelChars: p.camelChars 66 + fullChars: p.fullChars.toUpperCase(),
  67 + camelChars: p.camelChars.toUpperCase()
68 }); 68 });
69 } 69 }
70 cb && cb(data); 70 cb && cb(data);