Commit bd6c4281de1a057fb5cc1f9f1de3f7eadbece365

Authored by 潘钊
1 parent 669bdf18

update...

src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
@@ -45,7 +45,7 @@ public class CarOutInfoHandler { @@ -45,7 +45,7 @@ public class CarOutInfoHandler {
45 bcTypeMap.put("ldks", "两点间空驶"); 45 bcTypeMap.put("ldks", "两点间空驶");
46 } 46 }
47 47
48 - private static ScheduleComparator.DFSJ schDFSJComparator = new ScheduleComparator.DFSJ(); 48 + private static ScheduleComparator.DFSJ2 schDFSJComparator = new ScheduleComparator.DFSJ2();
49 49
50 @Autowired 50 @Autowired
51 JdbcTemplate jdbcTemplate; 51 JdbcTemplate jdbcTemplate;
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 import com.bsth.entity.realcontrol.ScheduleRealInfo; 3 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
4 6
5 import java.util.Comparator; 7 import java.util.Comparator;
6 import java.util.HashMap; 8 import java.util.HashMap;
@@ -23,6 +25,7 @@ public class ScheduleComparator { @@ -23,6 +25,7 @@ public class ScheduleComparator {
23 } 25 }
24 }*/ 26 }*/
25 27
  28 +
26 static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); 29 static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
27 30
28 static{ 31 static{
@@ -50,10 +53,44 @@ public class ScheduleComparator { @@ -50,10 +53,44 @@ public class ScheduleComparator {
50 53
51 public static class DFSJ implements Comparator<ScheduleRealInfo>{ 54 public static class DFSJ implements Comparator<ScheduleRealInfo>{
52 55
  56 + static Logger logger = LoggerFactory.getLogger(DFSJ.class);
  57 +
53 @Override 58 @Override
54 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 59 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
55 - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());  
56 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); 60 + try{
  61 +
  62 + if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){
  63 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  64 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  65 + }
  66 + else{
  67 + /**
  68 + * 按时刻表发车顺序号
  69 + */
  70 + Integer fc1 = s1.getFcno();
  71 + Integer fc2 = s2.getFcno();
  72 + if(null != fc1 && null != fc2){
  73 + return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue();
  74 + }
  75 + else{
  76 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  77 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  78 + }
  79 + }
  80 + }catch (Exception e){
  81 + logger.error("排序异常", e);
  82 + return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1;
  83 + }
57 } 84 }
58 } 85 }
  86 +
  87 + public static class DFSJ2 implements Comparator<ScheduleRealInfo>{
  88 +
  89 +
  90 + @Override
  91 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  92 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  93 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  94 + }
  95 + }
59 } 96 }
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
@@ -35,7 +35,7 @@ public class ScheduleLateThread extends Thread{ @@ -35,7 +35,7 @@ public class ScheduleLateThread extends Thread{
35 35
36 Logger logger = LoggerFactory.getLogger(this.getClass()); 36 Logger logger = LoggerFactory.getLogger(this.getClass());
37 37
38 - private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ(); 38 + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ2();
39 39
40 @Override 40 @Override
41 public void run() { 41 public void run() {