Commit 2ab5ad10d4389cf25cbbf60c3f5d744dae0ce8fb

Authored by 潘钊
1 parent bd859681

update...

src/main/java/com/bsth/server_rs/base_info/line/buffer/LineRefreshThread.java
... ... @@ -8,7 +8,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
8 8 import org.springframework.jdbc.core.JdbcTemplate;
9 9 import org.springframework.stereotype.Component;
10 10  
  11 +import java.util.ArrayList;
  12 +import java.util.HashMap;
11 13 import java.util.List;
  14 +import java.util.Map;
12 15  
13 16 /**
14 17 * Created by panzhao on 2017/3/27.
... ... @@ -27,8 +30,15 @@ public class LineRefreshThread extends Thread{
27 30 try {
28 31 List<Line> list = jdbcTemplate.query("SELECT t1. NAME,t1.line_code,t1.start_station_name,t1.end_station_name,t1.start_station_first_time,t1.start_station_end_time,t1.end_station_first_time,t1.end_station_end_time,t1.company,t1.branche_company,t1.nature,t1.`level`,t1.destroy,t1.supper_line,t1.eq_linecode,t1.create_date,t2.total_mileage,t2.early_interval_lg,t2.late_interval_lg,t2.interval_lg,t2.speed_limit,t2.lag_station,t2.skip,t2.speeding,t2.crossed_line,t2.overflights FROM bsth_c_line t1 LEFT JOIN bsth_c_line_information t2 ON t1.id = t2.line where t1.destroy=0",
29 32 BeanPropertyRowMapper.newInstance(Line.class));
  33 +
  34 + Map<String, Line> map = new HashMap<>();
  35 + //过滤数据,多条线路配人的保留一条
  36 + for(Line line : list){
  37 + map.put(line.getLineCode(), line);
  38 + }
  39 +
30 40 if(list != null && list.size() > 0)
31   - LineBufferData.replaceAll(list);
  41 + LineBufferData.replaceAll(new ArrayList(map.values()));
32 42 }catch (Exception e){
33 43 logger.error("", e);
34 44 }
... ...