Commit 2dcdf45625ba6c01d75bbda1c83a5a98007bb5fe

Authored by 潘钊
2 parents 4fbb34d8 221d3f90

Merge branch 'minhang' into jiading

Too many changes to show.

To preserve performance only 10 of 16 files are displayed.

src/main/java/com/bsth/data/LineConfigData.java
@@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner { @@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner {
77 public long applyIn(ScheduleRealInfo sch, Long timestamp){ 77 public long applyIn(ScheduleRealInfo sch, Long timestamp){
78 LineConfig config = lineConfMap.get(sch.getXlBm()); 78 LineConfig config = lineConfMap.get(sch.getXlBm());
79 int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff(); 79 int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff();
80 - return timestamp - (diff * 1000); 80 + return timestamp + (diff * 1000);
81 } 81 }
82 82
83 @Component 83 @Component
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -239,9 +239,14 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -239,9 +239,14 @@ public class InOutStationSignalHandle extends SignalHandle{
239 long t2 = gps.getTimestamp(); 239 long t2 = gps.getTimestamp();
240 long c = sch.getDfsjT(); 240 long c = sch.getDfsjT();
241 241
242 - if(c - t1 > 1000 * 60 * 15 && Math.abs(t2 - c) < 1000 * 60 * 5){ 242 + /*if(c - t1 > 1000 * 60 * 15 && Math.abs(t2 - c) < 1000 * 60 * 5){
  243 + return true;
  244 + }*/
  245 + int threshold = 1000 * 60 * 5;
  246 + if(Math.abs(t2 - c) < threshold && c - t1 > threshold){
243 return true; 247 return true;
244 } 248 }
  249 + //if(Math.abs(t2 - c) < 1000 * 60 * 5 && c - t1 > 1000 * 60 * 5)
245 return false; 250 return false;
246 } 251 }
247 252
@@ -255,7 +260,7 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -255,7 +260,7 @@ public class InOutStationSignalHandle extends SignalHandle{
255 if (config != null && config.getOutConfig() == 2) { 260 if (config != null && config.getOutConfig() == 2) {
256 //出站既出场 261 //出站既出场
257 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); 262 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
258 - if (schPrev != null && schPrev.getBcType().equals("out") 263 + if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().equals(0))
259 && (!limitPark || park.equals(schPrev.getQdzCode()))) { 264 && (!limitPark || park.equals(schPrev.getQdzCode()))) {
260 265
261 schPrev.setFcsjActualAll(sch.getFcsjActualTime()); 266 schPrev.setFcsjActualAll(sch.getFcsjActualTime());
@@ -447,7 +452,7 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -447,7 +452,7 @@ public class InOutStationSignalHandle extends SignalHandle{
447 boolean limitPark = StringUtils.isNotEmpty(park); 452 boolean limitPark = StringUtils.isNotEmpty(park);
448 453
449 454
450 - if (next.getBcType().equals("in") && config.getOutConfig() == 2 455 + if (next.getBcType().equals("in") && config.getOutConfig() == 2 && (next.getBcsj()==0 || next.getJhlcOrig().equals(0))
451 && (!limitPark || park.equals(next.getZdzCode()))) { 456 && (!limitPark || park.equals(next.getZdzCode()))) {
452 457
453 next.setFcsjActualAll(sch.getZdsjActualTime()); 458 next.setFcsjActualAll(sch.getZdsjActualTime());
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
@@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
60 for (String nbbm : keys) { 60 for (String nbbm : keys) {
61 Collections.sort(listMap.get(nbbm), comp); 61 Collections.sort(listMap.get(nbbm), comp);
62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); 62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count));
63 - /*if(nbbm.equals("W9H-088")) 63 + /*if(nbbm.equals("W09-164"))
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=207";// + dayOfYear; 87 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=241";// + 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() >= 1500942270000L){ 156 + /*if(gps.getTimestamp() >= 1503960000000L){
157 System.out.println("debugger..."); 157 System.out.println("debugger...");
158 }*/ 158 }*/
159 //是否有任务 159 //是否有任务
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -573,7 +573,7 @@ public class DayOfSchedule { @@ -573,7 +573,7 @@ public class DayOfSchedule {
573 continue; 573 continue;
574 574
575 //出站既出场,忽略出场班次 575 //出站既出场,忽略出场班次
576 - if (outConfig == 2 && temp.getBcType().equals("out") 576 + if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0))
577 && (!limitPark || park.equals(temp.getQdzCode()))) 577 && (!limitPark || park.equals(temp.getQdzCode())))
578 continue; 578 continue;
579 579
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
@@ -3,6 +3,8 @@ package com.bsth.data.schedule; @@ -3,6 +3,8 @@ package com.bsth.data.schedule;
3 import com.bsth.entity.realcontrol.ScheduleRealInfo; 3 import com.bsth.entity.realcontrol.ScheduleRealInfo;
4 4
5 import java.util.Comparator; 5 import java.util.Comparator;
  6 +import java.util.HashMap;
  7 +import java.util.Map;
6 8
7 /** 9 /**
8 * 10 *
@@ -20,20 +22,38 @@ public class ScheduleComparator { @@ -20,20 +22,38 @@ public class ScheduleComparator {
20 return s1.getFcno() - s2.getFcno(); 22 return s1.getFcno() - s2.getFcno();
21 } 23 }
22 }*/ 24 }*/
  25 +
  26 + static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
  27 +
  28 + static{
  29 + bcTypeOrderMap.put("out", 0);
  30 + bcTypeOrderMap.put("normal", 1);
  31 + bcTypeOrderMap.put("region", 2);
  32 + bcTypeOrderMap.put("major", 3);
  33 + bcTypeOrderMap.put("venting", 4);
  34 + bcTypeOrderMap.put("ldks", 5);
  35 + bcTypeOrderMap.put("in", 6);
  36 + }
23 37
24 public static class FCSJ implements Comparator<ScheduleRealInfo>{ 38 public static class FCSJ implements Comparator<ScheduleRealInfo>{
25 39
26 @Override 40 @Override
27 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 41 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
28 - return (int) (s1.getFcsjT() - s2.getFcsjT()); 42 + int diff = (int) (s1.getFcsjT() - s2.getFcsjT());
  43 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
29 } 44 }
30 } 45 }
31 46
  47 + private static int typeOrder(String bcType){
  48 + return bcTypeOrderMap.get(bcType)!=null?bcTypeOrderMap.get(bcType):0;
  49 + }
  50 +
32 public static class DFSJ implements Comparator<ScheduleRealInfo>{ 51 public static class DFSJ implements Comparator<ScheduleRealInfo>{
33 52
34 @Override 53 @Override
35 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 54 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
36 - return (int) (s1.getDfsjT() - s2.getDfsjT()); 55 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  56 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
37 } 57 }
38 } 58 }
39 } 59 }
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
@@ -124,7 +124,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -124,7 +124,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
124 // poi读 124 // poi读
125 String cellContent = PoiUtils.getStringValueFromCell( 125 String cellContent = PoiUtils.getStringValueFromCell(
126 poi_sheet.getRow(i).getCell(j) 126 poi_sheet.getRow(i).getCell(j)
127 - ); 127 + ).replaceAll("\\s*", "");
128 // jxl写 128 // jxl写
129 sheet1.addCell(new Label(j, i, cellContent)); 129 sheet1.addCell(new Label(j, i, cellContent));
130 } 130 }
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -278,6 +278,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -278,6 +278,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
278 Date start2 = new Date(); 278 Date start2 = new Date();
279 ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan, lpInfoResults_output); 279 ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan, lpInfoResults_output);
280 Date end2 = new Date(); 280 Date end2 = new Date();
  281 +
  282 + logger.info("规则计算结果={}", scheduleResults_output.showGuideboardDesc1());
  283 +
281 // 3、计划输出 284 // 3、计划输出
282 Date start3 = new Date(); 285 Date start3 = new Date();
283 PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); 286 PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output);
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -251,7 +251,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -251,7 +251,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
251 for (int i = 1; i < rowNums; i++) { // 从第2行开始验证数据 251 for (int i = 1; i < rowNums; i++) { // 从第2行开始验证数据
252 Row row = sheet.getRow(i); 252 Row row = sheet.getRow(i);
253 for (int j = 1; j < colNums; j++) { // 从第2列开始 253 for (int j = 1; j < colNums; j++) { // 从第2列开始
254 - String bcell_con = StringUtils.trimToEmpty(PoiUtils.getStringValueFromCell(row.getCell(j))); // trimToEmpty 254 + String bcell_con = StringUtils.trimToEmpty(PoiUtils.getStringValueFromCell(row.getCell(j))).replaceAll("\\s*", ""); // trimToEmpty
255 if (StringUtils.isNotEmpty(bcell_con)) { 255 if (StringUtils.isNotEmpty(bcell_con)) {
256 Matcher m1 = p1.matcher(bcell_con.trim()); 256 Matcher m1 = p1.matcher(bcell_con.trim());
257 Matcher m2 = p2.matcher(bcell_con.trim()); 257 Matcher m2 = p2.matcher(bcell_con.trim());
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfo_input.java
@@ -44,7 +44,7 @@ public class TTInfo_input implements Comparable&lt;TTInfo_input&gt; { @@ -44,7 +44,7 @@ public class TTInfo_input implements Comparable&lt;TTInfo_input&gt; {
44 this.ttInfoId = String.valueOf(ttInfo.getId()); 44 this.ttInfoId = String.valueOf(ttInfo.getId());
45 this.xlId = String.valueOf(ttInfo.getXl().getId()); 45 this.xlId = String.valueOf(ttInfo.getXl().getId());
46 String[] days = ttInfo.getRule_days().split(","); 46 String[] days = ttInfo.getRule_days().split(",");
47 - System.out.println(days.length); 47 +// System.out.println(days.length);
48 for (int i = 0; i < 7; i++) { 48 for (int i = 0; i < 7; i++) {
49 if ("1".equals(days[i])) { 49 if ("1".equals(days[i])) {
50 weekdays.add(true); 50 weekdays.add(true);
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java
@@ -47,14 +47,14 @@ public class ValidRepeatBcFunction implements AccumulateFunction { @@ -47,14 +47,14 @@ public class ValidRepeatBcFunction implements AccumulateFunction {
47 47
48 @Override 48 @Override
49 public Serializable createContext() { 49 public Serializable createContext() {
50 - System.out.println("create"); 50 +// System.out.println("create");
51 return new RepeatBcInfo(); 51 return new RepeatBcInfo();
52 } 52 }
53 53
54 @Override 54 @Override
55 public void init(Serializable serializable) throws Exception { 55 public void init(Serializable serializable) throws Exception {
56 // TODO: 56 // TODO:
57 - System.out.println("init"); 57 +// System.out.println("init");
58 } 58 }
59 59
60 @Override 60 @Override