Commit 8f184fc6438829908b11d93c38e7a5f4ab0663b3
1 parent
090ef089
1.车、线、站点、路段接口微调
Showing
1 changed file
with
46 additions
and
46 deletions
src/main/java/com/bsth/server_rs/base_info/line/buffer/LineRefreshThread.java
| 1 | -package com.bsth.server_rs.base_info.line.buffer; | ||
| 2 | - | ||
| 3 | -import com.bsth.server_rs.base_info.line.Line; | ||
| 4 | -import org.slf4j.Logger; | ||
| 5 | -import org.slf4j.LoggerFactory; | ||
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | -import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 8 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 9 | -import org.springframework.stereotype.Component; | ||
| 10 | - | ||
| 11 | -import java.util.ArrayList; | ||
| 12 | -import java.util.HashMap; | ||
| 13 | -import java.util.List; | ||
| 14 | -import java.util.Map; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * Created by panzhao on 2017/3/27. | ||
| 18 | - */ | ||
| 19 | -@Component | ||
| 20 | -public class LineRefreshThread extends Thread{ | ||
| 21 | - | ||
| 22 | - @Autowired | ||
| 23 | - JdbcTemplate jdbcTemplate; | ||
| 24 | - | ||
| 25 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 26 | - | ||
| 27 | - @Override | ||
| 28 | - public void run() { | ||
| 29 | - | ||
| 30 | - try { | ||
| 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,t1.shanghai_linecode, t1.line_play_type, t1.region, t3.business_name company_name FROM bsth_c_line t1 LEFT JOIN bsth_c_line_information t2 ON t1.id = t2.line LEFT JOIN bsth_c_business t3 on t1.company = t3.business_code where t1.destroy=0", | ||
| 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 | - | ||
| 40 | - if(list != null && list.size() > 0) | ||
| 41 | - LineBufferData.replaceAll(new ArrayList(map.values())); | ||
| 42 | - }catch (Exception e){ | ||
| 43 | - logger.error("", e); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | -} | 1 | +package com.bsth.server_rs.base_info.line.buffer; |
| 2 | + | ||
| 3 | +import com.bsth.server_rs.base_info.line.Line; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 8 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +import java.util.ArrayList; | ||
| 12 | +import java.util.HashMap; | ||
| 13 | +import java.util.List; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * Created by panzhao on 2017/3/27. | ||
| 18 | + */ | ||
| 19 | +@Component | ||
| 20 | +public class LineRefreshThread extends Thread{ | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + JdbcTemplate jdbcTemplate; | ||
| 24 | + | ||
| 25 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public void run() { | ||
| 29 | + | ||
| 30 | + try { | ||
| 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,t1.shanghai_linecode, t1.line_play_type, t1.region, t1.in_use, t3.business_name company_name FROM bsth_c_line t1 LEFT JOIN bsth_c_line_information t2 ON t1.id = t2.line LEFT JOIN bsth_c_business t3 on t1.company = t3.business_code where t1.destroy=0", | ||
| 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 | + | ||
| 40 | + if(list != null && list.size() > 0) | ||
| 41 | + LineBufferData.replaceAll(new ArrayList(map.values())); | ||
| 42 | + }catch (Exception e){ | ||
| 43 | + logger.error("", e); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | +} |