Commit 4c4f02761ab09b308666dc4d3b9cee08b296a302
1 parent
13d9784a
update...
Showing
2 changed files
with
12 additions
and
2 deletions
src/main/java/com/bsth/server_rs/base_info/car/buffer/CarRefreshThread.java
| @@ -8,7 +8,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | @@ -8,7 +8,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 8 | import org.springframework.jdbc.core.JdbcTemplate; | 8 | import org.springframework.jdbc.core.JdbcTemplate; |
| 9 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
| 10 | 10 | ||
| 11 | +import java.util.ArrayList; | ||
| 12 | +import java.util.HashMap; | ||
| 11 | import java.util.List; | 13 | import java.util.List; |
| 14 | +import java.util.Map; | ||
| 12 | 15 | ||
| 13 | /** | 16 | /** |
| 14 | * Created by panzhao on 2017/3/30. | 17 | * Created by panzhao on 2017/3/30. |
| @@ -28,8 +31,15 @@ public class CarRefreshThread extends Thread{ | @@ -28,8 +31,15 @@ public class CarRefreshThread extends Thread{ | ||
| 28 | 31 | ||
| 29 | List<Car> list = jdbcTemplate.query("SELECT DISTINCT t1.*,t2.line_code,t2.name as line_name FROM(SELECT c.inside_code as nbbm,c.business_code as company_code,c.branche_company_code,c.car_plate,c.equipment_code,c.car_type,c.vehicle_stats,c.sfdc,c.scrap_state,c.id_rfid,c.tag_rfid,c2.xl FROM bsth_c_cars c LEFT JOIN bsth_c_s_ccinfo c2 ON c.id = c2.cl ) t1 LEFT JOIN bsth_c_line t2 on t1.xl=t2.id" | 32 | List<Car> list = jdbcTemplate.query("SELECT DISTINCT t1.*,t2.line_code,t2.name as line_name FROM(SELECT c.inside_code as nbbm,c.business_code as company_code,c.branche_company_code,c.car_plate,c.equipment_code,c.car_type,c.vehicle_stats,c.sfdc,c.scrap_state,c.id_rfid,c.tag_rfid,c2.xl FROM bsth_c_cars c LEFT JOIN bsth_c_s_ccinfo c2 ON c.id = c2.cl ) t1 LEFT JOIN bsth_c_line t2 on t1.xl=t2.id" |
| 30 | , BeanPropertyRowMapper.newInstance(Car.class)); | 33 | , BeanPropertyRowMapper.newInstance(Car.class)); |
| 34 | + | ||
| 35 | + Map<String, Car> map = new HashMap<>(); | ||
| 36 | + //过滤数据,多条线路配车的保留一条 | ||
| 37 | + for(Car c : list){ | ||
| 38 | + map.put(c.getNbbm(), c); | ||
| 39 | + } | ||
| 40 | + | ||
| 31 | if(list != null && list.size() > 0) | 41 | if(list != null && list.size() > 0) |
| 32 | - CarBufferData.replaceAll(list); | 42 | + CarBufferData.replaceAll(new ArrayList(map.values())); |
| 33 | }catch (Exception e){ | 43 | }catch (Exception e){ |
| 34 | logger.error("", e); | 44 | logger.error("", e); |
| 35 | } | 45 | } |
src/main/java/com/bsth/server_rs/base_info/person/buffer/PersonRefreshThread.java
| @@ -32,7 +32,7 @@ public class PersonRefreshThread extends Thread{ | @@ -32,7 +32,7 @@ public class PersonRefreshThread extends Thread{ | ||
| 32 | ,BeanPropertyRowMapper.newInstance(Personnel.class)); | 32 | ,BeanPropertyRowMapper.newInstance(Personnel.class)); |
| 33 | 33 | ||
| 34 | Map<String, Personnel> map = new HashMap<>(); | 34 | Map<String, Personnel> map = new HashMap<>(); |
| 35 | - //过滤数据,多条线路配车的保留一条 | 35 | + //过滤数据,多条线路配人的保留一条 |
| 36 | for(Personnel p : list){ | 36 | for(Personnel p : list){ |
| 37 | map.put(p.getJobCode(), p); | 37 | map.put(p.getJobCode(), p); |
| 38 | } | 38 | } |