Commit a1ee3de678317793166208ef52fa5a28d18d84a4

Authored by zq
1 parent 3af89ead

运管处时刻表调整

src/main/java/com/bsth/data/BasicData.java
@@ -70,7 +70,7 @@ public class BasicData implements CommandLineRunner { @@ -70,7 +70,7 @@ public class BasicData implements CommandLineRunner {
70 public static Map<String, String> allPerson; 70 public static Map<String, String> allPerson;
71 71
72 //站点名和运管处编号 对照 72 //站点名和运管处编号 对照
73 - public static Map<String, Map<String, Map>> stationName2YgcNumber; 73 + public static Map<String,Integer> stationName2YgcNumber;
74 74
75 75
76 static Logger logger = LoggerFactory.getLogger(BasicData.class); 76 static Logger logger = LoggerFactory.getLogger(BasicData.class);
@@ -233,13 +233,6 @@ public class BasicData implements CommandLineRunner { @@ -233,13 +233,6 @@ public class BasicData implements CommandLineRunner {
233 * @Description: TODO(加载线路相关信息) 233 * @Description: TODO(加载线路相关信息)
234 */ 234 */
235 public void loadLineInfo(){ 235 public void loadLineInfo(){
236 - List<StationRoute> stationsList = null;// 站点路由集  
237 - StationRoute stationRoute = null;  
238 - int size = 0;  
239 - Map<String, Integer> station2Number ;  
240 - Map<String, Map> dirs2Statioin ;  
241 - int[] dirs = {0,1};// 运行方向 上下行  
242 - int num = 1;  
243 Iterator<Line> iterator = lineRepository.findAll().iterator(); 236 Iterator<Line> iterator = lineRepository.findAll().iterator();
244 237
245 Line line; 238 Line line;
@@ -247,7 +240,7 @@ public class BasicData implements CommandLineRunner { @@ -247,7 +240,7 @@ public class BasicData implements CommandLineRunner {
247 Map<String, String> code2name = new HashMap<>(); 240 Map<String, String> code2name = new HashMap<>();
248 Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); 241 Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
249 Map<String, String> code2SHcode = new HashMap<String, String>(); 242 Map<String, String> code2SHcode = new HashMap<String, String>();
250 - Map<String, Map<String, Map>> tempStationName2YgcNumber = new HashMap<String, Map<String, Map>>(); 243 + Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
251 244
252 while(iterator.hasNext()){ 245 while(iterator.hasNext()){
253 line = iterator.next(); 246 line = iterator.next();
@@ -259,27 +252,26 @@ public class BasicData implements CommandLineRunner { @@ -259,27 +252,26 @@ public class BasicData implements CommandLineRunner {
259 /** 252 /**
260 * 加载运管处的站点及序号 253 * 加载运管处的站点及序号
261 * 上行从1开始,下行顺序续编 254 * 上行从1开始,下行顺序续编
262 -  
263 - num = 1;  
264 - dirs2Statioin = new HashMap<String, Map>();  
265 - for (int i = 0; i < dirs.length; i++) {  
266 - // 分别取得上下行的站点  
267 - stationsList = stationRouteRepository.findByLine(line.getLineCode(), dirs[i]);  
268 - size = stationsList == null ? 0 :stationsList.size();  
269 - if(size > 0 ){  
270 - station2Number = new HashMap<String, Integer>();  
271 - for (int j = 0; j < size; j++) {  
272 - stationRoute = stationsList.get(j);  
273 - // map保存为(站点名称 -->序号)  
274 - station2Number.put(stationRoute.getStationName(), num++); 255 + */
  256 + List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
  257 + if(ygcLines != null && ygcLines.size() > 0){
  258 + int size = ygcLines.size();
  259 + Object[] tempArray ;
  260 + int num = 1;
  261 + String key;
  262 + String lineCode = "";
  263 + for (int i = 0; i < size; i ++){
  264 + tempArray = ygcLines.get(i);
  265 + if(lineCode.equals("")){
  266 + lineCode = tempArray[0]+"";
  267 + }else if(!lineCode.equals(tempArray[0]+"")){
  268 + num = 1;
  269 + lineCode = tempArray[0]+"";
275 } 270 }
276 - // 保存两个数据,(0 --> station2Number)(1 --> station2Number) 0上行 1 下行  
277 - dirs2Statioin.put(dirs[i]+"", station2Number); 271 + key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
  272 + tempStationName2YgcNumber.put(key,num++);
278 } 273 }
279 } 274 }
280 - // 保存(站点编码 --> dirs2Statioin)  
281 - tempStationName2YgcNumber.put(line.getLineCode(), dirs2Statioin);  
282 - */  
283 } 275 }
284 276
285 lineId2CodeMap = biMap; 277 lineId2CodeMap = biMap;