Commit 8ee2ece2af5474e9fd1d47595144783c995c78ea

Authored by 王通
1 parent 1389ef6b

1.发布进出停车场轨迹接口

src/main/java/com/bsth/CXFConfig.java
... ... @@ -4,6 +4,7 @@ package com.bsth;
4 4 import com.bsth.server_rs.AuthorizeInterceptor_IN;
5 5 import com.bsth.server_rs.base_info.car.CarRestService;
6 6 import com.bsth.server_rs.base_info.carpark.CarparkRestService;
  7 +import com.bsth.server_rs.base_info.iocarpark.IoCarparkRestService;
7 8 import com.bsth.server_rs.base_info.line.LineRestService;
8 9 import com.bsth.server_rs.base_info.person.PersonRestService;
9 10 import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService;
... ... @@ -138,6 +139,8 @@ public class CXFConfig {
138 139 private WhiteIpRestService whiteIpRestService;
139 140 @Autowired
140 141 private ManHoursRestService manHoursRestService;
  142 + @Autowired
  143 + private IoCarparkRestService ioCarparkRestService;
141 144  
142 145 @Bean
143 146 public Server rsServer() {
... ... @@ -167,7 +170,8 @@ public class CXFConfig {
167 170 departureRestService,
168 171 dksRestService,
169 172 whiteIpRestService,
170   - manHoursRestService));
  173 + manHoursRestService,
  174 + ioCarparkRestService));
171 175 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper()));
172 176 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
173 177 endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN());
... ...
src/main/java/com/bsth/server_rs/base_info/section/buffer/LD_SectionRefreshThread.java
1   -package com.bsth.server_rs.base_info.section.buffer;
2   -
3   -import com.bsth.server_rs.base_info.section.entity.LD_Section;
4   -import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;
5   -import com.bsth.server_rs.base_info.section.entity.RoadSpeed;
6   -import org.slf4j.Logger;
7   -import org.slf4j.LoggerFactory;
8   -import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.jdbc.core.BeanPropertyRowMapper;
10   -import org.springframework.jdbc.core.JdbcTemplate;
11   -import org.springframework.stereotype.Component;
12   -
13   -import java.util.ArrayList;
14   -import java.util.HashMap;
15   -import java.util.List;
16   -import java.util.Map;
17   -
18   -/**
19   - * Created by panzhao on 2017/3/27.
20   - */
21   -@Component
22   -public class LD_SectionRefreshThread extends Thread{
23   -
24   - @Autowired
25   - JdbcTemplate jdbcTemplate;
26   -
27   - Logger logger = LoggerFactory.getLogger(this.getClass());
28   -
29   - @Override
30   - public void run() {
31   -
32   - try {
33   -
34   - //路段信息
35   - List<LD_Section> sectionList = jdbcTemplate.query("select section_code,section_name,section_type,ST_AsText(gsection_vector) as gsection_vector,croses_road,versions from bsth_c_section ",
36   - BeanPropertyRowMapper.newInstance(LD_Section.class));
37   -
38   - if(sectionList == null || sectionList.size() == 0)
39   - return;
40   -
41   - LD_SectionBufferData.replaceAll(sectionList);
42   -
43   - //路段路由信息
44   - List<LD_SectionRoute> routeList = jdbcTemplate.query("select line_code,section_code,directions,sectionroute_code,versions from bsth_c_sectionroute where destroy=0",
45   - BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
46   -
47   - for(LD_SectionRoute sr : routeList){
48   - sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
49   - }
50   -
51   - LD_SectionBufferData.replaceRoutes(routeList);
52   -
53   - //查询路段限速信息
54   - List<RoadSpeed> roadSpeedList = jdbcTemplate.query("select id,name,ST_AsText(g_road_vector) as g_road_vector,speed,speed_start_date,speed_end_date,line,is_start,create_date,update_date from bsth_c_road_speed where is_start=0", BeanPropertyRowMapper.newInstance(RoadSpeed.class));
55   - if(roadSpeedList.size() > 0)
56   - LD_SectionBufferData.putRoadSpeeds(roadSpeedList);
57   -
58   - //查询最新版本路段信息
59   - List<LD_SectionRoute> sectionRoutes = jdbcTemplate.query("select b.line_name,a.line_code,a.section_code,a.directions,a.sectionroute_code,a.versions from (select l.name line_name,l.line_code line_code,max(versions) versions from bsth_c_line l left join bsth_c_line_versions v on l.line_code = v.line_code where l.destroy = 0 group by l.name,l.line_code) b left join bsth_c_ls_sectionroute a on a.line_code = b.line_code and a.versions = b.versions where a.destroy = 0 order by a.line_code,a.directions,a.sectionroute_code", BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
60   - Map<String, List<LD_SectionRoute>> name2sections = new HashMap<>();
61   - List<LD_SectionRoute> routes = null;
62   - String lastedLineName = "";
63   - for (LD_SectionRoute sr : sectionRoutes) {
64   - if ("".equals(lastedLineName) || !lastedLineName.equals(sr.getLineName())) {
65   - name2sections.put(lastedLineName, routes);
66   - lastedLineName = sr.getLineName();
67   - routes = new ArrayList<>();
68   - }
69   - sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
70   - routes.add(sr);
71   - }
72   - LD_SectionBufferData.putLastedRoute(name2sections);
73   - }catch (Exception e){
74   - logger.error("", e);
75   - }
76   - }
77   -}
  1 +package com.bsth.server_rs.base_info.section.buffer;
  2 +
  3 +import com.bsth.server_rs.base_info.iocarpark.buffer.IoCarparkBufferData;
  4 +import com.bsth.server_rs.base_info.iocarpark.entity.IoCarparkSectionRoute;
  5 +import com.bsth.server_rs.base_info.section.entity.LD_Section;
  6 +import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;
  7 +import com.bsth.server_rs.base_info.section.entity.RoadSpeed;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.ArrayList;
  16 +import java.util.HashMap;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +
  20 +/**
  21 + * Created by panzhao on 2017/3/27.
  22 + */
  23 +@Component
  24 +public class LD_SectionRefreshThread extends Thread{
  25 +
  26 + @Autowired
  27 + JdbcTemplate jdbcTemplate;
  28 +
  29 + Logger logger = LoggerFactory.getLogger(this.getClass());
  30 +
  31 + @Override
  32 + public void run() {
  33 +
  34 + try {
  35 +
  36 + //路段信息
  37 + List<LD_Section> sectionList = jdbcTemplate.query("select section_code,section_name,section_type,ST_AsText(gsection_vector) as gsection_vector,croses_road,versions from bsth_c_section ",
  38 + BeanPropertyRowMapper.newInstance(LD_Section.class));
  39 +
  40 + if(sectionList == null || sectionList.size() == 0)
  41 + return;
  42 +
  43 + LD_SectionBufferData.replaceAll(sectionList);
  44 +
  45 + //路段路由信息
  46 + List<LD_SectionRoute> routeList = jdbcTemplate.query("select line_code,section_code,directions,sectionroute_code,versions from bsth_c_sectionroute where destroy=0",
  47 + BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
  48 +
  49 + for(LD_SectionRoute sr : routeList){
  50 + sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
  51 + }
  52 +
  53 + LD_SectionBufferData.replaceRoutes(routeList);
  54 +
  55 + //进出场路段路由信息
  56 + List<IoCarparkSectionRoute> routeList1 = jdbcTemplate.query("select a.line_code,a.`start`,a.`end`,a.section_code,a.directions,a.sectionroute_code,a.versions from bsth_c_ls_inout_sectionroute a join bsth_c_line_versions b on a.line = b.line and a.versions = b.versions where a.destroy=0 and b.status = 1 ORDER BY a.line_code, versions, `start`, `end`, sectionroute_code",
  57 + BeanPropertyRowMapper.newInstance(IoCarparkSectionRoute.class));
  58 +
  59 + for(IoCarparkSectionRoute sr : routeList1){
  60 + sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
  61 + }
  62 +
  63 + IoCarparkBufferData.replaceRoutes(routeList1);
  64 +
  65 + //查询路段限速信息
  66 + List<RoadSpeed> roadSpeedList = jdbcTemplate.query("select id,name,ST_AsText(g_road_vector) as g_road_vector,speed,speed_start_date,speed_end_date,line,is_start,create_date,update_date from bsth_c_road_speed where is_start=0", BeanPropertyRowMapper.newInstance(RoadSpeed.class));
  67 + if(roadSpeedList.size() > 0)
  68 + LD_SectionBufferData.putRoadSpeeds(roadSpeedList);
  69 +
  70 + //查询最新版本路段信息
  71 + List<LD_SectionRoute> sectionRoutes = jdbcTemplate.query("select b.line_name,a.line_code,a.section_code,a.directions,a.sectionroute_code,a.versions from (select l.name line_name,l.line_code line_code,max(versions) versions from bsth_c_line l left join bsth_c_line_versions v on l.line_code = v.line_code where l.destroy = 0 group by l.name,l.line_code) b left join bsth_c_ls_sectionroute a on a.line_code = b.line_code and a.versions = b.versions where a.destroy = 0 order by a.line_code,a.directions,a.sectionroute_code", BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
  72 + Map<String, List<LD_SectionRoute>> name2sections = new HashMap<>();
  73 + List<LD_SectionRoute> routes = null;
  74 + String lastedLineName = "";
  75 + for (LD_SectionRoute sr : sectionRoutes) {
  76 + if ("".equals(lastedLineName) || !lastedLineName.equals(sr.getLineName())) {
  77 + name2sections.put(lastedLineName, routes);
  78 + lastedLineName = sr.getLineName();
  79 + routes = new ArrayList<>();
  80 + }
  81 + sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
  82 + routes.add(sr);
  83 + }
  84 + LD_SectionBufferData.putLastedRoute(name2sections);
  85 + }catch (Exception e){
  86 + logger.error("", e);
  87 + }
  88 + }
  89 +}
... ...