Commit bd209a0e6c49c366b8e795178c92b8eb59a4fb54

Authored by 王通
1 parent 71c3e232

1.一阶段

Too many changes to show.

To preserve performance only 23 of 148 files are displayed.

... ... @@ -407,6 +407,11 @@
407 407 <artifactId>jts-core</artifactId>
408 408 <version>1.16.1</version>
409 409 </dependency>
  410 +
  411 + <dependency>
  412 + <groupId>org.hibernate</groupId>
  413 + <artifactId>hibernate-spatial</artifactId>
  414 + </dependency>
410 415 </dependencies>
411 416  
412 417 <dependencyManagement>
... ...
src/main/java/com/bsth/controller/InoutCarparkController.java
... ... @@ -2,16 +2,15 @@ package com.bsth.controller;
2 2  
3 3 import com.bsth.common.ResponseCode;
4 4 import com.bsth.entity.LsInoutSectionRoute;
5   -import com.bsth.repository.StationRouteCacheRepository;
6   -import com.bsth.repository.StationRouteRepository;
7 5 import com.bsth.service.InoutCarparkService;
8   -import com.bsth.service.StationRouteService;
9   -import com.fasterxml.jackson.core.JsonProcessingException;
10 6 import org.slf4j.Logger;
11 7 import org.slf4j.LoggerFactory;
12 8 import org.springframework.beans.factory.annotation.Autowired;
13 9 import org.springframework.util.StringUtils;
14   -import org.springframework.web.bind.annotation.*;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
15 14  
16 15 import java.util.HashMap;
17 16 import java.util.Map;
... ...
src/main/java/com/bsth/controller/LsSectionRouteController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.SectionRoute;
  5 +import com.bsth.service.LsSectionRouteService;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.Arrays;
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + *
  21 + * @ClassName: SectionRouteController(路段路由控制器)
  22 + *
  23 + * @Extends : BaseController
  24 + *
  25 + * @Description: TODO(路段路由控制层)
  26 + *
  27 + * @Author bsth@lq
  28 + *
  29 + * @Date 2016年05月03日 上午9:21:17
  30 + *
  31 + * @Version 公交调度系统BS版 0.1
  32 + *
  33 + */
  34 +
  35 +@RestController
  36 +@RequestMapping("/api/lssectionroute")
  37 +public class LsSectionRouteController extends BaseController<SectionRoute, Integer> {
  38 +
  39 + private final static Logger log = LoggerFactory.getLogger(LsSectionRouteController.class);
  40 +
  41 + @Autowired
  42 + private LsSectionRouteService lsSectionRouteService;
  43 +
  44 + /**
  45 + * @param id
  46 + * @throws
  47 + * @Description: TODO(批量撤销路段)
  48 + */
  49 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  50 + public Map<String, Object> destroy(Integer id) {
  51 + Map<String, Object> result = new HashMap<>();
  52 + try {
  53 + lsSectionRouteService.batchDestroy(Arrays.asList(id));
  54 + result.put("status", ResponseCode.SUCCESS);
  55 + } catch (Exception e) {
  56 + result.put("status", ResponseCode.ERROR);
  57 + log.error("", e);
  58 + }
  59 +
  60 + return result;
  61 + }
  62 +
  63 + /**
  64 + * @param ids
  65 + * @throws
  66 + * @Description: TODO(批量撤销路段)
  67 + */
  68 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
  69 + public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) {
  70 + Map<String, Object> result = new HashMap<>();
  71 + try {
  72 + lsSectionRouteService.batchDestroy(ids);
  73 + result.put("status", ResponseCode.SUCCESS);
  74 + } catch (Exception e) {
  75 + result.put("status", ResponseCode.ERROR);
  76 + log.error("", e);
  77 + }
  78 +
  79 + return result;
  80 + }
  81 +}
... ...
src/main/java/com/bsth/controller/LsStationRouteController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.LsStationRoute;
  5 +import com.bsth.entity.StationRoute;
  6 +import com.bsth.service.LsStationRouteService;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.Arrays;
  16 +import java.util.HashMap;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +
  20 +/**
  21 + * @author Hill
  22 + */
  23 +@RestController
  24 +@RequestMapping("/api/lsstationroute")
  25 +public class LsStationRouteController extends BaseController<LsStationRoute, Integer> {
  26 +
  27 + @Autowired
  28 + private LsStationRouteService lsStationRouteService;
  29 +
  30 + private static final Logger log = LoggerFactory.getLogger(LsStationRouteController.class);
  31 +
  32 +
  33 + @RequestMapping(value = "/findAllByParams", method = RequestMethod.GET)
  34 + public Iterable<LsStationRoute> findAllByParams(@RequestParam Map<String, Object> params) {
  35 + return lsStationRouteService.findAllByParams(params);
  36 + }
  37 +
  38 + /**
  39 + * @param id
  40 + * @throws
  41 + * @Description: TODO(批量撤销站点)
  42 + */
  43 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  44 + public Map<String, Object> destroy(Integer id) {
  45 + Map<String, Object> result = new HashMap<>();
  46 + try {
  47 + lsStationRouteService.batchDestroy(Arrays.asList(id));
  48 + result.put("status", ResponseCode.SUCCESS);
  49 + } catch (Exception e) {
  50 + result.put("status", ResponseCode.ERROR);
  51 + result.put("msg", e.getMessage());
  52 + log.error("", e);
  53 + }
  54 +
  55 + return result;
  56 + }
  57 +
  58 + /**
  59 + * @param ids
  60 + * @throws
  61 + * @Description: TODO(批量撤销站点)
  62 + */
  63 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
  64 + public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) {
  65 + Map<String, Object> result = new HashMap<>();
  66 + try {
  67 + lsStationRouteService.batchDestroy(ids);
  68 + result.put("status", ResponseCode.SUCCESS);
  69 + } catch (Exception e) {
  70 + result.put("status", ResponseCode.ERROR);
  71 + result.put("msg", e.getMessage());
  72 + log.error("", e);
  73 + }
  74 +
  75 + return result;
  76 + }
  77 +
  78 + @RequestMapping(method = RequestMethod.POST)
  79 + @Override
  80 + public Map<String, Object> save(LsStationRoute stationRoute) {
  81 + Map<String, Object> result = new HashMap<>();
  82 + try {
  83 + lsStationRouteService.save(stationRoute);
  84 + result.put("status", ResponseCode.SUCCESS);
  85 + } catch (Exception e) {
  86 + result.put("status", ResponseCode.ERROR);
  87 + result.put("msg", e.getMessage());
  88 + log.error("", e);
  89 + }
  90 +
  91 + return result;
  92 + }
  93 +}
... ...
src/main/java/com/bsth/controller/SectionController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.util.Map;
4   -
  3 +import com.bsth.entity.Section;
  4 +import com.bsth.repository.SectionRepository;
  5 +import com.bsth.service.SectionService;
5 6 import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.web.bind.annotation.RequestMapping;
7 8 import org.springframework.web.bind.annotation.RequestMethod;
8 9 import org.springframework.web.bind.annotation.RequestParam;
9 10 import org.springframework.web.bind.annotation.RestController;
10 11  
11   -import com.bsth.entity.Section;
12   -import com.bsth.repository.SectionRepository;
13   -import com.bsth.service.SectionService;
14   -import com.bsth.util.GetUIDAndCode;
  12 +import java.util.Map;
15 13  
16 14 /**
17 15 *
... ... @@ -64,44 +62,6 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
64 62 *
65 63 * @return Map<String, Object> <SUCCESS ; ERROR>
66 64 */
67   - @RequestMapping(value="sectionCut" , method = RequestMethod.POST)
68   - public Map<String, Object> sectionCut(@RequestParam Map<String, Object> map) {
69   -
70   - map.put("updateBy", "");
71   -
72   - map.put("createBy", "");
73   -
74   - map.put("createDate", "");
75   -
76   - return service.sectionCut(map);
77   -
78   - }
79   -
80   - /**
81   - * @Description :TODO(编辑线路走向保存到线路历史表)
82   - *
83   - * @param map <sectionId:路段ID; sectionJSON:路段信息>
84   - *
85   - * @return Map<String, Object> <SUCCESS ; ERROR>
86   - */
87   - @RequestMapping(value="sectionCutSaveLineLS" , method = RequestMethod.POST)
88   - public Map<String, Object> sectionCutSaveLineLS(@RequestParam Map<String, Object> map) {
89   -
90   - map.put("updateBy", "");
91   -
92   - map.put("createBy", "");
93   -
94   - return service.sectionCutSaveLineLS(map);
95   -
96   - }
97   -
98   - /**
99   - * @Description :TODO(编辑线路走向)
100   - *
101   - * @param map <sectionId:路段ID; sectionJSON:路段信息>
102   - *
103   - * @return Map<String, Object> <SUCCESS ; ERROR>
104   - */
105 65 @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
106 66 public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) {
107 67  
... ... @@ -114,23 +74,7 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
114 74 return service.sectionUpdate(map);
115 75  
116 76 }
117   -
118   - /**
119   - * @Description :TODO(编辑缓存线路走向)
120   - */
121   - @RequestMapping(value="sectionCacheUpdate" , method = RequestMethod.POST)
122   - public Map<String, Object> sectionCacheUpdate(@RequestParam Map<String, Object> map) {
123   -
124   - map.put("updateBy", "");
125   -
126   - map.put("createBy", "");
127   -
128   - map.put("createDate", "");
129   -
130   - return service.sectionCacheUpdate(map);
131   -
132   - }
133   -
  77 +
134 78 /**
135 79 * @Description :TODO(查询路段编码)
136 80 *
... ...
src/main/java/com/bsth/controller/SectionRouteController.java
1   -package com.bsth.controller;
2   -
3   -import java.util.List;
4   -import java.util.Map;
5   -
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RequestMethod;
9   -import org.springframework.web.bind.annotation.RequestParam;
10   -import org.springframework.web.bind.annotation.RestController;
11   -
12   -import com.bsth.entity.SectionRoute;
13   -import com.bsth.entity.StationRouteCache;
14   -import com.bsth.service.SectionRouteService;
15   -
16   -/**
17   - *
18   - * @ClassName: SectionRouteController(路段路由控制器)
19   - *
20   - * @Extends : BaseController
21   - *
22   - * @Description: TODO(路段路由控制层)
23   - *
24   - * @Author bsth@lq
25   - *
26   - * @Date 2016年05月03日 上午9:21:17
27   - *
28   - * @Version 公交调度系统BS版 0.1
29   - *
30   - */
31   -
32   -@RestController
33   -@RequestMapping("sectionroute")
34   -public class SectionRouteController extends BaseController<SectionRoute, Integer> {
35   -
36   - @Autowired
37   - SectionRouteService routeService;
38   -
39   - @RequestMapping(value = "/allls", method = RequestMethod.GET)
40   - public Map allls(@RequestParam Map<String, Object> map) {
41   -
42   - return routeService.pageLs(map);
43   - }
44   -
45   -
46   - /**
47   - * @param map
48   - * @throws
49   - * @Description: TODO(批量撤销路段)
50   - */
51   - @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
52   - public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
53   - return routeService.updateSectionRouteInfoFormId(map);
54   - }
55   - /**
56   - * @param id //路段路由id
57   - * @Description: TODO(撤销路段)
58   - */
59   - @RequestMapping(value = "/destroy", method = RequestMethod.POST)
60   - public Map<String, Object> destroy(@RequestParam Map<String, Object> map) {
61   -
62   - int id = Integer.parseInt(map.get("id").toString());
63   -
64   - if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) {
65   - return routeService.destroy(id);
66   - }else if(Integer.parseInt(map.get("status").toString()) == 2){
67   - return routeService.destroyHistory(id);
68   - }else {
69   - return map;
70   - }
71   - }
72   -
73   - /**
74   - * @param @param map
75   - * @throws
76   - * @Title: list
77   - * @Description: TODO(多条件查询)
78   - */
79   - @RequestMapping(value = "/all", method = RequestMethod.GET)
80   - public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) {
81   - return routeService.list(map);
82   - }
83   -
84   - @RequestMapping(value = "/cacheList", method = RequestMethod.GET)
85   - public List<StationRouteCache> cacheList(@RequestParam Map<String, Object> map) {
86   -// routeService.cacheList(map)
87   - return null;
88   - }
89   -
90   - /**
91   - * @Description :TODO(查询路段信息)
92   - *
93   - * @param map <line.id_eq:线路ID; directions_eq:方向>
94   - *
95   - * @return Map<String, Object>
96   - */
97   - @RequestMapping(value = "/findSection" , method = RequestMethod.GET)
98   - public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
99   - return routeService.getSectionRoute(map);
100   - }
101   -
102   -
103   - /**
104   - * @Description :TODO(查询路段信息)
105   - *
106   - * @param map <line.id_eq:线路ID; directions_eq:方向>
107   - *
108   - * @return Map<String, Object>
109   - */
110   - @RequestMapping(value = "/findCacheSection" , method = RequestMethod.GET)
111   - public List<Map<String, Object>> getSectionRouteCache(@RequestParam Map<String, Object> map) {
112   - return routeService.getSectionRouteCache(map);
113   - }
114   -
115   - /**
116   - * @Description : TODO(根据路段路由Id查询详情)
117   - *
118   - * @param map <id:路段路由ID>
119   - *
120   - * @return List<Map<String, Object>>
121   - */
122   - @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET)
123   - public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) {
124   - return routeService.findSectionRouteInfoFormId(map);
125   - }
126   -
127   - /**
128   - * @Description :TODO(查询线路某方向下的上一个路段序号)
129   - *
130   - * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码>
131   - *
132   - * @return List<Map<String, Object>>
133   - */
134   - @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET)
135   - public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
136   - return routeService.findUpSectionRouteCode(map);
137   - }
138   -
139   - @RequestMapping(value = "/findCacheUpSectionRouteCode" , method = RequestMethod.GET)
140   - public List<Map<String, Object>> findCacheUpSectionRouteCode(@RequestParam Map<String, Object> map) {
141   - return routeService.findCacheUpSectionRouteCode(map);
142   - }
143   -
144   - /**
145   - * @Description :TODO(引用路段)
146   - *
147   - * @return List<Map<String, Object>>
148   - */
149   - @RequestMapping(value = "/quoteSection" , method = RequestMethod.POST)
150   - public Map<String, Object> quoteSection(@RequestParam Map<String, Object> map) {
151   - return routeService.quoteSection(map);
152   - }
153   -}
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.entity.SectionRoute;
  13 +import com.bsth.service.SectionRouteService;
  14 +
  15 +/**
  16 + *
  17 + * @ClassName: SectionRouteController(路段路由控制器)
  18 + *
  19 + * @Extends : BaseController
  20 + *
  21 + * @Description: TODO(路段路由控制层)
  22 + *
  23 + * @Author bsth@lq
  24 + *
  25 + * @Date 2016年05月03日 上午9:21:17
  26 + *
  27 + * @Version 公交调度系统BS版 0.1
  28 + *
  29 + */
  30 +
  31 +@RestController
  32 +@RequestMapping("sectionroute")
  33 +public class SectionRouteController extends BaseController<SectionRoute, Integer> {
  34 +
  35 + @Autowired
  36 + SectionRouteService routeService;
  37 +
  38 + @RequestMapping(value = "/allls", method = RequestMethod.GET)
  39 + public Map allls(@RequestParam Map<String, Object> map) {
  40 +
  41 + return routeService.pageLs(map);
  42 + }
  43 +
  44 +
  45 + /**
  46 + * @param map
  47 + * @throws
  48 + * @Description: TODO(批量撤销路段)
  49 + */
  50 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
  51 + public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
  52 + return routeService.updateSectionRouteInfoFormId(map);
  53 + }
  54 +
  55 + /**
  56 + * @param @param map
  57 + * @throws
  58 + * @Title: list
  59 + * @Description: TODO(多条件查询)
  60 + */
  61 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  62 + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) {
  63 + return routeService.list(map);
  64 + }
  65 +
  66 + /**
  67 + * @Description :TODO(查询路段信息)
  68 + *
  69 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  70 + *
  71 + * @return Map<String, Object>
  72 + */
  73 + @RequestMapping(value = "/findSection" , method = RequestMethod.GET)
  74 + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
  75 + return routeService.getSectionRoute(map);
  76 + }
  77 +
  78 + /**
  79 + * @Description : TODO(根据路段路由Id查询详情)
  80 + *
  81 + * @param map <id:路段路由ID>
  82 + *
  83 + * @return List<Map<String, Object>>
  84 + */
  85 + @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET)
  86 + public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) {
  87 + return routeService.findSectionRouteInfoFormId(map);
  88 + }
  89 +
  90 + /**
  91 + * @Description :TODO(查询线路某方向下的上一个路段序号)
  92 + *
  93 + * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码>
  94 + *
  95 + * @return List<Map<String, Object>>
  96 + */
  97 + @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET)
  98 + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
  99 + return routeService.findUpSectionRouteCode(map);
  100 + }
  101 +
  102 + /**
  103 + * @Description :TODO(引用路段)
  104 + *
  105 + * @return List<Map<String, Object>>
  106 + */
  107 + @RequestMapping(value = "/quoteSection" , method = RequestMethod.POST)
  108 + public Map<String, Object> quoteSection(@RequestParam Map<String, Object> map) {
  109 + return routeService.quoteSection(map);
  110 + }
  111 +}
... ...
src/main/java/com/bsth/controller/StationController.java
1 1 package com.bsth.controller;
2 2  
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.LsSectionRoute;
  6 +import com.bsth.entity.LsStationRoute;
3 7 import com.bsth.entity.Station;
4 8 import com.bsth.repository.StationRepository;
5 9 import com.bsth.service.StationService;
6 10 import com.bsth.util.GetUIDAndCode;
  11 +import com.fasterxml.jackson.databind.ObjectMapper;
7 12 import org.slf4j.Logger;
8 13 import org.slf4j.LoggerFactory;
9 14 import org.springframework.beans.factory.annotation.Autowired;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RequestMethod;
12   -import org.springframework.web.bind.annotation.RequestParam;
13   -import org.springframework.web.bind.annotation.RestController;
  15 +import org.springframework.util.StringUtils;
  16 +import org.springframework.web.bind.annotation.*;
14 17  
15   -import java.util.Map;
  18 +import java.util.*;
16 19  
17 20 /**
18 21 *
... ... @@ -40,138 +43,75 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
40 43 @Autowired
41 44 StationRepository stationRepository;
42 45  
  46 + private ObjectMapper mapper = new ObjectMapper();
  47 +
43 48 /** 日志记录器 */
44   - private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class);
  49 + private static final Logger log = LoggerFactory.getLogger(StationController.class);
45 50  
46 51 /**
47 52 * @Description :TODO(根据坐标点匹配数据库中的站点)
48   - *
49   - * @param map: <point:坐标点; name:站点名>
50   - *
51   - */
52   - @RequestMapping(value="matchStation" , method = RequestMethod.GET)
53   - public Map<String, Object> matchStation(@RequestParam Map<String, Object> map) {
54   - return service.matchStation(map);
55   - }
56   -
57   - /**
58   - * @Description :TODO(系统规划保存数据)
59   - *
60   - * @param map <stationJSON:站点信息;
61   - *
62   - * - - - - - - sectionJSON:路段信息;
63   - *
64   - * - - - - - - dbType:坐标类型;
65   - *
66   - * - - - - - - destroy:是否撤销;
67   - *
68   - * - - - - - - directions:方向;
69   - *
70   - * - - - - - - lineId:线路ID;
71   - *
72   - * - - - - - - radius:圆半径
73   - *
74   - * - - - - - - shapesType:图形类型
75   - *
76   - * - - - - - - speedLimit:限速>
77   - *
78   - * @return Map<String, Object> <SUCCESS ; ERROR>
79 53 */
80   - @RequestMapping(value="collectionSave" , method = RequestMethod.POST)
81   - public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
82   - return service.systemSaveStations(map);
83   - }
84   -
85   - @RequestMapping(value="manualSave" , method = RequestMethod.POST)
86   - public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) {
87   - return service.manualSave(map);
88   - }
89   -
90   - @RequestMapping(value="cacheSave" , method = RequestMethod.POST)
91   - public Map<String, Object> cacheSave(@RequestParam Map<String, Object> map) {
92   - return service.cacheSave(map);
  54 + @RequestMapping(value="matchStation")
  55 + public Map<String, Object> matchStation(@RequestBody List<Station> stations) {
  56 + Map<String, Object> result = new HashMap<>();
  57 + try {
  58 + service.matchStation(stations);
  59 + result.put("status", ResponseCode.SUCCESS);
  60 + result.put("data", stations);
  61 + } catch (Exception e) {
  62 + result.put("status", ResponseCode.ERROR);
  63 + log.error("", e);
  64 + }
  65 +
  66 + return result;
93 67 }
94   -
  68 +
95 69 /**
96   - * @Description :TODO(新增站点保存)
97   - *
98   - * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
99   - *
100   - * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
101   - *
102   - * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
103   - *
104   - * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
105   - *
106   - * versions:版本号;x:城建坐标x;y:城建坐标y>
107   - *
108   - * @return Map<String, Object> <SUCCESS ; ERROR>
  70 + * 保存线路某个版本下单行的站点和路段路由
  71 + * 常规使用在根据百度地图生成数据或者模板导入的批量保存
  72 + * @param map
  73 + * @return
109 74 */
110   - @RequestMapping(value="stationSave" , method = RequestMethod.POST)
111   - public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) {
112   - map.put("createBy", "");
113   - map.put("updateBy", "");
114   - return service.stationSaveMap(map);
  75 + @RequestMapping(value="saveRoutes" , method = RequestMethod.POST)
  76 + public Map<String, Object> saveRoutes(@RequestBody Map<String, Object> map) {
  77 + Map<String, Object> result = new HashMap<>();
  78 + try {
  79 + if (map.get("lineId") == null || map.get("versions") == null || map.get("directions") == null) {
  80 + throw new IllegalArgumentException("需正确传入线路、方向、版本参数");
  81 + }
  82 + Integer versions = Integer.parseInt(map.get("versions").toString()), directions = Integer.parseInt(map.get("directions").toString()), lineId = Integer.parseInt(map.get("lineId").toString());
  83 + List<LsStationRoute> stationRoutes = mapper.convertValue(map.get("stationRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsStationRoute.class)));
  84 + List<LsSectionRoute> sectionRoutes = mapper.convertValue(map.get("sectionRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsSectionRoute.class)));
  85 +
  86 + result.putAll(service.saveRoutes(lineId, versions, directions, stationRoutes, sectionRoutes));
  87 + result.put("status", ResponseCode.SUCCESS);
  88 + } catch (Exception e) {
  89 + result.put("status", ResponseCode.ERROR);
  90 + log.error("", e);
  91 + }
  92 +
  93 + return result;
115 94 }
116   -
  95 +
117 96 /**
118   - * @Description :TODO(更新站点保存)
119   - *
120   - * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
121   - *
122   - * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
123   - *
124   - * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
125   - *
126   - * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
127   - *
128   - * versions:版本号;x:城建坐标x;y:城建坐标y>
129   - *
130   - * @return Map<String, Object> <SUCCESS ; ERROR>
  97 + * 更新站点、站点路由信息
  98 + * @param stationRoute
  99 + * @return
131 100 */
132 101 @RequestMapping(value="stationUpdate" , method = RequestMethod.POST)
133   - public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) {
134   - map.put("updateBy", ""); //??
135   - return service.stationUpdate(map);
136   - }
137   -
138   - /**
139   - * @Description :TODO(更新缓存站点保存)
140   - *
141   - * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
142   - *
143   - * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
144   - *
145   - * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
146   - *
147   - * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
148   - *
149   - * versions:版本号;x:城建坐标x;y:城建坐标y>
150   - *
151   - * @return Map<String, Object> <SUCCESS ; ERROR>
152   - */
153   - @RequestMapping(value="stationCacheUpdate" , method = RequestMethod.POST)
154   - public Map<String, Object> stationCacheUpdate(@RequestParam Map<String, Object> map) {
155   - map.put("updateBy", "");
156   - return service.stationCacheUpdate(map);
157   - }
158   - /**
159   - * @Description :TODO(更新内部编码)
160   - * @param stationCount,sectionCount 更新数
161   - */
162   - @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET)
163   - public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
164   -// System.out.println(stationCount+" _ "+ sectionCount );
165   -// for(int i = 0; i < stationCount; i++) {
166   -//// System.out.println(i);
167   -// stationRepository.stationMaxId() + 1;
168   -// }
169   -// for(int j = 0; j < sectionCount; j++) {
170   -//// System.out.println(j);
171   -// sectionRepository.sectionMaxId() + 1;
172   -// }
173   - return 1;
  102 + public Map<String, Object> stationUpdate(LsStationRoute stationRoute) {
  103 + Map<String, Object> result = new HashMap<>();
  104 + try {
  105 + service.stationUpdate(stationRoute);
  106 + result.put("status", ResponseCode.SUCCESS);
  107 + } catch (Exception e) {
  108 + result.put("status", ResponseCode.ERROR);
  109 + throw new RuntimeException(e);
  110 + }
  111 +
  112 + return result;
174 113 }
  114 +
175 115 /**
176 116 * @Description :TODO(查询站点编码)
177 117 *
... ... @@ -180,17 +120,15 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
180 120 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
181 121 public long getStationCode() {
182 122 return stationRepository.stationMaxId() + 1;
183   -
184 123 }
  124 +
185 125 /**
186   - * @Description :TODO(查询站点编码)
187   - *
188   - * @return int <stationCode站点编码>
  126 + * 根据站名模糊搜索站点信息
  127 + * @param stationName
  128 + * @return 站点列表
189 129 */
190   - @RequestMapping(value="stationCacheSave" , method = RequestMethod.POST)
191   - public Map<String, Object> stationCacheSave(@RequestParam Map<String, Object> map) {
192   - map.put("createBy", "");
193   - map.put("updateBy", "");
194   - return service.stationCacheSave(map);
  130 + @RequestMapping(value="getStationByName" , method = RequestMethod.GET)
  131 + public List<Station> getStationByName(String stationName) {
  132 + return service.getStationByName(stationName);
195 133 }
196 134 }
... ...
src/main/java/com/bsth/controller/StationRouteController.java
1   -package com.bsth.controller;
2   -
3   -import java.util.List;
4   -import java.util.Map;
5   -
6   -import javax.servlet.http.HttpServletResponse;
7   -
8   -import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.web.bind.annotation.RequestMapping;
10   -import org.springframework.web.bind.annotation.RequestMethod;
11   -import org.springframework.web.bind.annotation.RequestParam;
12   -import org.springframework.web.bind.annotation.RestController;
13   -
14   -import com.bsth.entity.LsStationRoute;
15   -import com.bsth.entity.StationRoute;
16   -import com.bsth.entity.StationRouteCache;
17   -import com.bsth.repository.StationRouteCacheRepository;
18   -import com.bsth.repository.StationRouteRepository;
19   -import com.bsth.service.StationRouteService;
20   -
21   -/**
22   - *
23   - * @ClassName: StationRouteController(站点路由控制器)
24   - *
25   - * @Extends : BaseController
26   - *
27   - * @Description: TODO(站点路由控制层)
28   - *
29   - * @Author bsth@lq
30   - *
31   - * @Date 2016年5月03日 上午9:21:17
32   - *
33   - * @Dersion 公交调度系统BS版 0.1
34   - *
35   - */
36   -@RestController
37   -@RequestMapping("stationroute")
38   -public class StationRouteController extends BaseController<StationRoute, Integer> {
39   -
40   - @Autowired
41   - StationRouteService service;
42   - @Autowired
43   - StationRouteRepository stationRouteRepository;
44   - @Autowired
45   - StationRouteCacheRepository stationRouteCacheRepository;
46   -
47   -
48   - @RequestMapping(value = "/allls", method = RequestMethod.GET)
49   - public Map allls(@RequestParam Map<String, Object> map) {
50   -
51   - return service.pageLs(map);
52   - }
53   -
54   - @RequestMapping(value = "/all_ls", method = RequestMethod.GET)
55   - public Iterable<LsStationRoute> list_ls(@RequestParam Map<String, Object> map) {
56   - return service.list_ls(map);
57   - }
58   -
59   -
60   - @RequestMapping(value = "/all", method = RequestMethod.GET)
61   - public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) {
62   - return service.list(map);
63   - }
64   -
65   - @RequestMapping(value = "/cacheList", method = RequestMethod.GET)
66   - public List<StationRouteCache> cacheList(@RequestParam Map<String, Object> map) {
67   - return service.cacheList(map);
68   - }
69   -
70   - /**
71   - * @Description :TODO(查询路段信息)
72   - *
73   - * @param id
74   - *
75   - * @return Map<String, Object>
76   - */
77   - @RequestMapping(value = "/export" , method = RequestMethod.GET)
78   - public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) {
79   - return service.getSectionRouteExport(id, resp);
80   - }
81   -
82   - /**
83   - * @param map
84   - * @throws
85   - * @Description: TODO(批量撤销站点)
86   - */
87   - @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
88   - public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
89   - return service.updateStationRouteInfoFormId(map);
90   - }
91   -
92   - /**
93   - * @Description :TODO(查询树站点与路段数据)
94   - *
95   - * @param map <line.id_eq:线路ID; directions_eq:方向>
96   - *
97   - * @return List<Map<String, Object>>
98   - */
99   - @RequestMapping(value = "/findStations" , method = RequestMethod.GET)
100   - public List<Map<String, Object>> findStations(@RequestParam Map<String, Object> map) {
101   - return service.findPoints(map);
102   - }
103   -
104   - @RequestMapping(value = "/systemQuote" , method = RequestMethod.POST)
105   - public Map<String, Object> systemQuote(@RequestParam Map<String, Object> map) {
106   - return service.systemQuote(map);
107   - }
108   -
109   - /**
110   - * @Description :TODO(查询线路某方向下的站点序号与类型)
111   - *
112   - * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
113   - *
114   - * @return List<Map<String, Object>>
115   - */
116   - @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET)
117   - public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
118   - return service.findUpStationRouteCode(map);
119   - }
120   -
121   - /**
122   - * @Description :TODO(查询线路某方向下的站点序号与类型)
123   - */
124   - @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET)
125   - public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) {
126   - return service.findCacheUpStationRouteCode(map);
127   - }
128   -
129   - /**
130   - * @Description :TODO(查询站点的下一个缓存站点)
131   - */
132   - @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET)
133   - public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) {
134   - return service.findDownStationRoute(map);
135   - }
136   -
137   - /**
138   - * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
139   - *
140   - * @param map <lineId:线路ID; direction:方向>
141   - *
142   - * @return List<Map<String, Object>>
143   - */
144   - @RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET)
145   - public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
146   - return service.getStationRouteCenterPoints(map);
147   - }
148   -
149   - /**
150   - * @Description :TODO(查询线路某方向下所有站点)
151   - *
152   - * @param map <lineId:线路ID; direction:方向>
153   - *
154   - * @return List<Map<String, Object>>
155   - */
156   - @RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET)
157   - public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) {
158   - return service.getStationRouteList(map);
159   - }
160   -
161   - /**
162   - * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
163   - *
164   - * @param map <lineId:线路ID; direction:方向>
165   - *
166   - * @return List<Map<String, Object>>
167   - */
168   - @RequestMapping(value = "/getStationRouteCacheCenterPoints" , method = RequestMethod.GET)
169   - public List<Map<String, Object>> getStationRouteCacheCenterPoints(@RequestParam Map<String, Object> map) {
170   - return service.getStationRouteCacheCenterPoints(map);
171   - }
172   -
173   - /**
174   - * @Description :TODO(撤销站点)
175   - *
176   - * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)>
177   - *
178   - * @return Map<String, Object> <SUCCESS ; ERROR>
179   - */
180   - @RequestMapping(value = "/stationRouteIsDestroy" , method = RequestMethod.POST)
181   - public Map<String, Object> stationRouteIsDestroy(@RequestParam Map<String, Object> map) {
182   - return service.stationRouteIsDestroy(map);
183   - }
184   -
185   - /**
186   - * @Description : TODO(根据线路ID生成行单)
187   - *
188   - * @param map <id:线路ID>
189   - *
190   - * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
191   - */
192   - @RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
193   - public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
194   - return service.usingSingle(map);
195   - }
196   -
197   -
198   - /**
199   - * @Description : TODO(根据站点路由Id查询详情)
200   - *
201   - * @param map <id:站点路由ID>
202   - *
203   - * @return List<Map<String, Object>>
204   - */
205   - @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET)
206   - public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) {
207   - return service.findStationRouteInfo(map);
208   - }
209   -
210   - @RequestMapping(value = "/stations", method = RequestMethod.GET)
211   - public List<Map<String, Object>> findStations(Integer xlid, Integer xldir) {
212   - return stationRouteRepository.findStations(xlid, xldir);
213   - }
214   -
215   - /**
216   - *
217   - * @Title: findByMultiLine
218   - * @Description: TODO(多线路路由查询)
219   - */
220   - @RequestMapping(value = "/multiLine", method = RequestMethod.GET)
221   - public Map<String, Object> findByMultiLine(@RequestParam String lineIds){
222   - return service.findByMultiLine(lineIds);
223   - }
224   -
225   - /**
226   - *
227   - * @Title: updSwitchDir
228   - * @Description: TODO(上下行切换)
229   - */
230   - @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST)
231   - public Map<String, Object> updSwitchDir(@RequestParam String lineIds, @RequestParam(value = "status", required = false)int status){
232   - return service.updSwitchDir(lineIds,status);
233   - }
234   -
235   - /**
236   - *
237   - * @Title: upddis
238   - * @Description: TODO(更新站距)
239   - */
240   - @RequestMapping(value = "/upddis",method = RequestMethod.POST)
241   - public Map<String, Object> upddis(@RequestParam Map<String, Object> map) {
242   - return service.upddis(map);
243   - }
244   -
245   - /**
246   - *
247   - * @Title: findCacheStationRoute
248   - * @Description: TODO(查询缓存路由)
249   - */
250   - @RequestMapping(value = "/findCacheStationRoute",method = RequestMethod.GET)
251   - public List<StationRouteCache> findCacheStationRoute(@RequestParam Map<String, Object> map) {
252   - int lineId = Integer.parseInt(map.get("lineId").toString());
253   - int dir = Integer.parseInt(map.get("dir").toString());
254   - return stationRouteCacheRepository.findstationRoute(lineId, dir);
255   - }
256   -
257   - /**
258   - *
259   - * @Title: findCachePoint
260   - *
261   - * @param map <lineId:线路ID; dir:方向>
262   - *
263   - * @Description: TODO(查询缓存路由)
264   - */
265   - @RequestMapping(value = "/findCachePoint",method = RequestMethod.GET)
266   - public List<Map<String, Object>> findCachePoint(@RequestParam Map<String, Object> map) {
267   - int lineId = Integer.parseInt(map.get("lineId").toString());
268   - int dir = Integer.parseInt(map.get("dir").toString());
269   - return service.findCachePoint(lineId, dir);
270   - }
271   -
272   -
273   - /**
274   - * 查询博协站点
275   - * @param map
276   - * @return
277   - */
278   - @RequestMapping(value = "/findMatchStation", method = RequestMethod.GET)
279   - public Map<String, Object> findMatchStation(@RequestParam Map<String, Object> map){
280   - return service.findMatchStation(map);
281   - }
282   -
283   - /**
284   - * 批量修改行业编码
285   - * @param map
286   - * @return
287   - */
288   - @RequestMapping(value = "/updIndustryCode",method = RequestMethod.POST)
289   - public Map<String, Object> updIndustryCode(@RequestParam Map<String, Object> map) {
290   - return service.updIndustryCode(map);
291   - }
292   -
293   - /**
294   - * 匹配外部站点行业编码
295   - * @param map
296   - * @return
297   - */
298   - @RequestMapping(value = "/matchIndustryCode",method = RequestMethod.POST)
299   - public Map<String, Object> matchIndustryCode(@RequestParam Map<String, Object> map) {
300   - return service.matchIndustryCode(map);
301   - }
302   - /**
303   - * 匹配附近站点行业编码
304   - * @param map
305   - * @return
306   - */
307   - @RequestMapping(value = "/matchNearbyStation",method = RequestMethod.GET)
308   - public Map<String, Object> matchNearbyStation(@RequestParam Map<String, Object> map) {
309   - return service.matchNearbyStation(map);
310   - }
311   -}
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.StationRoute;
  4 +import com.bsth.repository.StationRouteRepository;
  5 +import com.bsth.service.StationRouteService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import javax.servlet.http.HttpServletResponse;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + *
  18 + * @ClassName: StationRouteController(站点路由控制器)
  19 + *
  20 + * @Extends : BaseController
  21 + *
  22 + * @Description: TODO(站点路由控制层)
  23 + *
  24 + * @Author bsth@lq
  25 + *
  26 + * @Date 2016年5月03日 上午9:21:17
  27 + *
  28 + * @Dersion 公交调度系统BS版 0.1
  29 + *
  30 + */
  31 +@RestController
  32 +@RequestMapping("stationroute")
  33 +public class StationRouteController extends BaseController<StationRoute, Integer> {
  34 +
  35 + @Autowired
  36 + StationRouteService service;
  37 + @Autowired
  38 + StationRouteRepository stationRouteRepository;
  39 +
  40 + @RequestMapping(value = "/allls", method = RequestMethod.GET)
  41 + public Map allls(@RequestParam Map<String, Object> map) {
  42 +
  43 + return service.pageLs(map);
  44 + }
  45 +
  46 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  47 + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) {
  48 + return service.list(map);
  49 + }
  50 +
  51 + /**
  52 + * @Description :TODO(查询路段信息)
  53 + *
  54 + * @param id
  55 + *
  56 + * @return Map<String, Object>
  57 + */
  58 + @RequestMapping(value = "/export" , method = RequestMethod.GET)
  59 + public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) {
  60 + return service.getSectionRouteExport(id, resp);
  61 + }
  62 +
  63 + /**
  64 + * @Description :TODO(查询树站点与路段数据)
  65 + *
  66 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  67 + *
  68 + * @return List<Map<String, Object>>
  69 + */
  70 + @RequestMapping(value = "/findStations" , method = RequestMethod.GET)
  71 + public List<Map<String, Object>> findStations(@RequestParam Map<String, Object> map) {
  72 + return service.findPoints(map);
  73 + }
  74 +
  75 + @RequestMapping(value = "/systemQuote" , method = RequestMethod.POST)
  76 + public Map<String, Object> systemQuote(@RequestParam Map<String, Object> map) {
  77 + return service.systemQuote(map);
  78 + }
  79 +
  80 + /**
  81 + * @Description :TODO(查询线路某方向下的站点序号与类型)
  82 + *
  83 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  84 + *
  85 + * @return List<Map<String, Object>>
  86 + */
  87 + @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET)
  88 + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
  89 + return service.findUpStationRouteCode(map);
  90 + }
  91 +
  92 + /**
  93 + * @Description :TODO(查询站点的下一个缓存站点)
  94 + */
  95 + @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET)
  96 + public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) {
  97 + return service.findDownStationRoute(map);
  98 + }
  99 +
  100 + /**
  101 + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
  102 + *
  103 + * @param map <lineId:线路ID; direction:方向>
  104 + *
  105 + * @return List<Map<String, Object>>
  106 + */
  107 + @RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET)
  108 + public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
  109 + return service.getStationRouteCenterPoints(map);
  110 + }
  111 +
  112 + /**
  113 + * @Description :TODO(查询线路某方向下所有站点)
  114 + *
  115 + * @param map <lineId:线路ID; direction:方向>
  116 + *
  117 + * @return List<Map<String, Object>>
  118 + */
  119 + @RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET)
  120 + public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) {
  121 + return service.getStationRouteList(map);
  122 + }
  123 +
  124 + /**
  125 + * @Description : TODO(根据线路ID生成行单)
  126 + *
  127 + * @param map <id:线路ID>
  128 + *
  129 + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
  130 + */
  131 + @RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
  132 + public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
  133 + return service.usingSingle(map);
  134 + }
  135 +
  136 +
  137 + /**
  138 + * @Description : TODO(根据站点路由Id查询详情)
  139 + *
  140 + * @param map <id:站点路由ID>
  141 + *
  142 + * @return List<Map<String, Object>>
  143 + */
  144 + @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET)
  145 + public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) {
  146 + return service.findStationRouteInfo(map);
  147 + }
  148 +
  149 + @RequestMapping(value = "/stations", method = RequestMethod.GET)
  150 + public List<Map<String, Object>> findStations(Integer xlid, Integer xldir) {
  151 + return stationRouteRepository.findStations(xlid, xldir);
  152 + }
  153 +
  154 + /**
  155 + *
  156 + * @Title: findByMultiLine
  157 + * @Description: TODO(多线路路由查询)
  158 + */
  159 + @RequestMapping(value = "/multiLine", method = RequestMethod.GET)
  160 + public Map<String, Object> findByMultiLine(@RequestParam String lineIds){
  161 + return service.findByMultiLine(lineIds);
  162 + }
  163 +
  164 + /**
  165 + *
  166 + * @Title: updSwitchDir
  167 + * @Description: TODO(上下行切换)
  168 + */
  169 + @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST)
  170 + public Map<String, Object> updSwitchDir(@RequestParam String lineIds, @RequestParam(value = "status", required = false)int status){
  171 + return service.updSwitchDir(lineIds,status);
  172 + }
  173 +
  174 + /**
  175 + *
  176 + * @Title: upddis
  177 + * @Description: TODO(更新站距)
  178 + */
  179 + @RequestMapping(value = "/upddis",method = RequestMethod.POST)
  180 + public Map<String, Object> upddis(@RequestParam Map<String, Object> map) {
  181 + return service.upddis(map);
  182 + }
  183 +
  184 + /**
  185 + * 查询博协站点
  186 + * @param map
  187 + * @return
  188 + */
  189 + @RequestMapping(value = "/findMatchStation", method = RequestMethod.GET)
  190 + public Map<String, Object> findMatchStation(@RequestParam Map<String, Object> map){
  191 + return service.findMatchStation(map);
  192 + }
  193 +
  194 + /**
  195 + * 批量修改行业编码
  196 + * @param map
  197 + * @return
  198 + */
  199 + @RequestMapping(value = "/updIndustryCode",method = RequestMethod.POST)
  200 + public Map<String, Object> updIndustryCode(@RequestParam Map<String, Object> map) {
  201 + return service.updIndustryCode(map);
  202 + }
  203 +
  204 + /**
  205 + * 匹配外部站点行业编码
  206 + * @param map
  207 + * @return
  208 + */
  209 + @RequestMapping(value = "/matchIndustryCode",method = RequestMethod.POST)
  210 + public Map<String, Object> matchIndustryCode(@RequestParam Map<String, Object> map) {
  211 + return service.matchIndustryCode(map);
  212 + }
  213 + /**
  214 + * 匹配附近站点行业编码
  215 + * @param map
  216 + * @return
  217 + */
  218 + @RequestMapping(value = "/matchNearbyStation",method = RequestMethod.GET)
  219 + public Map<String, Object> matchNearbyStation(@RequestParam Map<String, Object> map) {
  220 + return service.matchNearbyStation(map);
  221 + }
  222 +}
... ...
src/main/java/com/bsth/controller/geo_data/GeoDataController.java deleted 100644 → 0
1   -package com.bsth.controller.geo_data;
2   -
3   -import com.bsth.entity.geo_data.GeoRoad;
4   -import com.bsth.entity.geo_data.GeoStation;
5   -import com.bsth.service.geo_data.GeoDataService;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RequestMethod;
9   -import org.springframework.web.bind.annotation.RequestParam;
10   -import org.springframework.web.bind.annotation.RestController;
11   -
12   -import java.util.Map;
13   -
14   -/**
15   - * Created by panzhao on 2017/12/7.
16   - */
17   -@RestController
18   -@RequestMapping("/_geo_data")
19   -public class GeoDataController {
20   -
21   - @Autowired
22   - GeoDataService geoDataService;
23   -
24   - @RequestMapping("findGeoStations")
25   - public Map<String, Object> findGeoStations(@RequestParam String lineCode, Integer version){
26   - return geoDataService.findGeoStations(lineCode, version);
27   - }
28   -
29   -
30   - @RequestMapping("findGeoRoad")
31   - public Map<String, Object> findGeoRoad(@RequestParam String lineCode,Integer version){
32   - return geoDataService.findGeoRoad(lineCode, version);
33   - }
34   -
35   - @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST)
36   - public Map<String, Object> updateBufferInfo(GeoStation station){
37   - return geoDataService.updateBufferInfo(station);
38   - }
39   -
40   - @RequestMapping(value = "updateStationName",method = RequestMethod.POST)
41   - public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){
42   - return geoDataService.updateStationName(map);
43   - }
44   -
45   - @RequestMapping(value = "addNewStationRoute",method = RequestMethod.POST)
46   - public Map<String, Object> addNewStationRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown
47   - ,@RequestParam String stationName,@RequestParam Float lat,@RequestParam Float lng,@RequestParam int prevRouteId){
48   - return geoDataService.addNewStationRoute(lineCode, upDown, versions, stationName, lat, lng, prevRouteId);
49   - }
50   -
51   - @RequestMapping(value = "addNewRoadRoute",method = RequestMethod.POST)
52   - public Map<String, Object> addNewRoadRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown
53   - ,@RequestParam String sectionName,@RequestParam String crosesRoad,@RequestParam String coords,@RequestParam int prevRouteId){
54   - return geoDataService.addNewRoadRoute(lineCode, upDown, versions, sectionName, crosesRoad, coords, prevRouteId);
55   - }
56   -
57   - @RequestMapping(value = "destroyStation",method = RequestMethod.POST)
58   - public Map<String, Object> destroyStation(GeoStation station){
59   - return geoDataService.destroyStation(station);
60   - }
61   -
62   - @RequestMapping(value = "updateRoadInfo",method = RequestMethod.POST)
63   - public Map<String, Object> updateRoadInfo(GeoRoad road){
64   - return geoDataService.updateRoadInfo(road);
65   - }
66   -
67   - @RequestMapping(value = "destroyRoad",method = RequestMethod.POST)
68   - public Map<String, Object> destroyRoad(GeoRoad road){
69   - return geoDataService.destroyRoad(road);
70   - }
71   -
72   - @RequestMapping("findVersionInfo")
73   - public Map<String, Object> findVersionInfo(@RequestParam String lineCode){
74   - return geoDataService.findVersionInfo(lineCode);
75   - }
76   -
77   - @RequestMapping(value = "addNewLineVersion",method = RequestMethod.POST)
78   - public Map<String, Object> addNewLineVersion(@RequestParam Map<String, Object> map){
79   - return geoDataService.addNewLineVersion(map);
80   - }
81   -
82   - @RequestMapping(value = "deleteLineVersion",method = RequestMethod.POST)
83   - public Map<String, Object> deleteLineVersion(@RequestParam String lineCode,@RequestParam int version){
84   - return geoDataService.deleteLineVersion(lineCode, version);
85   - }
86   -
87   - @RequestMapping("findFutureVersion")
88   - public Map<String, Object> findFutureVersion(@RequestParam String lineCode){
89   - return geoDataService.findFutureVersion(lineCode);
90   - }
91   -
92   - @RequestMapping(value = "addEnableInfo",method = RequestMethod.POST)
93   - public Map<String, Object> addEnableInfo(@RequestParam String lineCode,@RequestParam int versions, @RequestParam String startDate){
94   - return geoDataService.addEnableInfo(lineCode, versions, startDate);
95   - }
96   -}
97 0 \ No newline at end of file
src/main/java/com/bsth/controller/gps/GpsController.java
1   -package com.bsth.controller.gps;
2   -
3   -import com.bsth.data.BasicData;
4   -import com.bsth.data.gpsdata_v2.GpsRealData;
5   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6   -import com.bsth.data.gpsdata_v2.handlers.overspeed.GpsOverspeed;
7   -import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
8   -import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
9   -import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
10   -import com.bsth.service.gps.GpsService;
11   -import com.bsth.service.gps.entity.GpsSpeed;
12   -import com.google.common.base.Splitter;
13   -import org.springframework.beans.factory.annotation.Autowired;
14   -import org.springframework.web.bind.annotation.*;
15   -
16   -import javax.servlet.http.HttpServletResponse;
17   -import java.text.ParseException;
18   -import java.util.ArrayList;
19   -import java.util.HashMap;
20   -import java.util.List;
21   -import java.util.Map;
22   -
23   -@RestController
24   -@RequestMapping("gps")
25   -public class GpsController {
26   -
27   - @Autowired
28   - GpsRealData gpsRealData;
29   -
30   - @Autowired
31   - GpsService gpsService;
32   -
33   - @Autowired
34   - OverspeedProcess overspeedProcess;
35   -
36   - @RequestMapping(value = "/real/all")
37   - public Map<String, Object> search(@RequestParam Map<String, Object> map,
38   - @RequestParam(defaultValue = "0") int page,
39   - @RequestParam(defaultValue = "15") int size,
40   - @RequestParam(defaultValue = "timestamp") String order,
41   - @RequestParam(defaultValue = "DESC") String direction) {
42   -
43   -
44   - return gpsService.search(map, page, size, order, direction);
45   - }
46   -
47   - @RequestMapping(value = "/real/line/{lineCode}")
48   - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
49   - return gpsRealData.getByLine(lineCode);
50   - }
51   -
52   - @RequestMapping(value = "/real/line")
53   - public Map<String, Object> findByLineCodes(@RequestParam String lineCodes) {
54   - Map<String, Object> rs = new HashMap();
55   - List<String> lineArray = Splitter.on(",").splitToList(lineCodes);
56   - //实时gps
57   - List<GpsEntity> gpsList = gpsRealData.get(lineArray);
58   -
59   - //超速信息
60   - List<GpsOverspeed> overspeedList = overspeedProcess.findByLines(lineArray);
61   -
62   - //班次站点检查信息
63   - List<SCodeInfo> scis = ScheduleStationCodeChecker.findByLineIdx(lineArray);
64   -
65   - rs.put("gpsList", gpsList);
66   - rs.put("overspeedList", overspeedList);
67   - rs.put("scis", scis);
68   - return rs;
69   - }
70   -
71   - @RequestMapping(value = "/allDevices")
72   - public Iterable<String> allDevices() {
73   - return gpsRealData.allDevices();
74   - }
75   -
76   - @RequestMapping(value = "/removeRealGps", method = RequestMethod.POST)
77   - public Map<String, Object> removeRealGps(@RequestParam String device) {
78   - return gpsService.removeRealGps(device);
79   - }
80   -
81   - /**
82   - * @Title: history @Description: TODO(这个方法给测试页面用) @throws
83   - */
84   - @RequestMapping(value = "/history/{device}")
85   - public List<Map<String, Object>> history(@PathVariable("device") String device, @RequestParam Long startTime,
86   - @RequestParam Long endTime, @RequestParam int directions) {
87   -
88   - return gpsService.history(device, startTime, endTime, directions);
89   - }
90   -
91   - @RequestMapping(value = "/gpsHistory/multiple")
92   - public List<Map<String, Object>> gpsHistory(@RequestParam String[] nbbmArray, @RequestParam Long st,
93   - @RequestParam Long et) {
94   - return (List<Map<String, Object>>) gpsService.history(nbbmArray, st, et).get("list");
95   - }
96   -
97   - /*@RequestMapping(value = "/analyse/ram")
98   - public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
99   - return ArrivalDataBuffer.allMap.get(nbbm);
100   - }*/
101   -
102   - @RequestMapping(value = "/Car2DeviceId")
103   - public Map<String, String> findCarDeviceIdMap() {
104   - return BasicData.deviceId2NbbmMap.inverse();
105   - }
106   -
107   - @RequestMapping(value = "/buffAera")
108   - public Map<String, Object> findBuffAeraByCode(@RequestParam String code, @RequestParam String type) {
109   - return gpsService.findBuffAeraByCode(code, type);
110   - }
111   -
112   - @RequestMapping(value = "/findRoadSpeed")
113   - public Map<String, Object> findRoadSpeed(@RequestParam String lineCode) {
114   - return gpsService.findRoadSpeed(lineCode);
115   - }
116   -
117   - /**
118   - * gps补全
119   - * type 0 : 实时GPS 1:走补传
120   - * @return
121   - */
122   - @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST)
123   - public Map<String, Object> gpsCompletion(@RequestParam long schId, @RequestParam int type) {
124   - return gpsService.gpsCompletion(schId, type);
125   - }
126   -
127   - /**
128   - * 历史GPS查询 ,第二版轨迹回放用
129   - * @param nbbm
130   - * @param st
131   - * @param et
132   - * @return
133   - */
134   - @RequestMapping(value = "/history_v2/{nbbm}")
135   - public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
136   - return gpsService.history_v2(nbbm, st, et);
137   - }
138   -
139   - /**
140   - * 历史GPS查询 ,第三版轨迹回放用
141   - * @param nbbm
142   - * @param st
143   - * @param et
144   - * @return
145   - */
146   - @RequestMapping(value = "/history_v3/{nbbm}")
147   - public Map<String, Object> history_v3(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
148   - return gpsService.history_v3(nbbm, st, et);
149   - }
150   -
151   - /**
152   - * 轨迹导出
153   - * @param nbbm
154   - * @param st
155   - * @param et
156   - * @return
157   - */
158   - @RequestMapping(value = "/history_v3/excel/{nbbm}")
159   - public void trailExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
160   - gpsService.trailExcel(nbbm, st, et, resp);
161   - }
162   -
163   - /**
164   - * 轨迹异常数据导出
165   - * @param nbbm
166   - * @param st
167   - * @param et
168   - * @return
169   - */
170   - @RequestMapping(value = "/history_v3/excel_abnormal/{nbbm}")
171   - public void abnormalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
172   - gpsService.abnormalExcel(nbbm, st, et, resp);
173   - }
174   -
175   - /**
176   - * 到离站数据导出
177   - * @param nbbm
178   - * @param st
179   - * @param et
180   - * @return
181   - */
182   - @RequestMapping(value = "/history_v3/excel_arrival/{nbbm}")
183   - public void arrivalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
184   - gpsService.arrivalExcel(nbbm, st, et, resp);
185   - }
186   -
187   -
188   -
189   -
190   - /**
191   - * 安全驾驶数据 分页查询
192   - * @param map
193   - * @param page
194   - * @param size
195   - * @param order
196   - * @param direction
197   - * @return
198   - */
199   - @RequestMapping(value = "/safeDriv")
200   - public Map<String, Object> safeDrivList(@RequestParam Map<String, Object> map,
201   - @RequestParam(defaultValue = "0") int page,
202   - @RequestParam(defaultValue = "15") int size,
203   - @RequestParam(defaultValue = "timestamp") String order,
204   - @RequestParam(defaultValue = "DESC") String direction){
205   - return gpsService.safeDrivList(map , page, size, order, direction);
206   - }
207   -
208   - @RequestMapping(value = "/findPosition", method = RequestMethod.GET)
209   - public List<GpsSpeed> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
210   - String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
211   - List<GpsSpeed> listGpsSpeed = new ArrayList<GpsSpeed>();
212   - listGpsSpeed = gpsService.findPosition(deviceid,startdate,enddate);
213   - return listGpsSpeed;
214   - }
215   -
216   - @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
217   - public Map<String, Object> pagequery(@RequestParam Map<String, Object> map){
218   - map.put("curPage", map.get("page").toString());
219   - map.put("pageData","10");
220   - return gpsService.Pagequery(map);
221   - }
222   -
223   - /**
224   - * 获取线路下所有车辆,包括实时设备 和 计划排班
225   - * @param lineCode
226   - * @return
227   - */
228   - @RequestMapping(value = "/allCarsByLine",method = RequestMethod.GET)
229   - public Map<String, Object> allCarsByLine(String lineCode){
230   - return gpsService.allCarsByLine(lineCode);
231   - }
232   -
233   -}
  1 +package com.bsth.controller.gps;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.gpsdata_v2.GpsRealData;
  5 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  6 +import com.bsth.data.gpsdata_v2.handlers.overspeed.GpsOverspeed;
  7 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  8 +import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
  9 +import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
  10 +import com.bsth.service.gps.GpsService;
  11 +import com.bsth.service.gps.entity.GpsSpeed;
  12 +import com.google.common.base.Splitter;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import javax.servlet.http.HttpServletResponse;
  17 +import java.text.ParseException;
  18 +import java.util.ArrayList;
  19 +import java.util.HashMap;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +
  23 +@RestController
  24 +@RequestMapping("gps")
  25 +public class GpsController {
  26 +
  27 + @Autowired
  28 + GpsRealData gpsRealData;
  29 +
  30 + @Autowired
  31 + GpsService gpsService;
  32 +
  33 + @Autowired
  34 + OverspeedProcess overspeedProcess;
  35 +
  36 + @RequestMapping(value = "/real/all")
  37 + public Map<String, Object> search(@RequestParam Map<String, Object> map,
  38 + @RequestParam(defaultValue = "0") int page,
  39 + @RequestParam(defaultValue = "15") int size,
  40 + @RequestParam(defaultValue = "timestamp") String order,
  41 + @RequestParam(defaultValue = "DESC") String direction) {
  42 +
  43 +
  44 + return gpsService.search(map, page, size, order, direction);
  45 + }
  46 +
  47 + @RequestMapping(value = "/real/line/{lineCode}")
  48 + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
  49 + return gpsRealData.getByLine(lineCode);
  50 + }
  51 +
  52 + @RequestMapping(value = "/real/line")
  53 + public Map<String, Object> findByLineCodes(@RequestParam String lineCodes) {
  54 + Map<String, Object> rs = new HashMap();
  55 + List<String> lineArray = Splitter.on(",").splitToList(lineCodes);
  56 + //实时gps
  57 + List<GpsEntity> gpsList = gpsRealData.get(lineArray);
  58 +
  59 + //超速信息
  60 + List<GpsOverspeed> overspeedList = overspeedProcess.findByLines(lineArray);
  61 +
  62 + //班次站点检查信息
  63 + List<SCodeInfo> scis = ScheduleStationCodeChecker.findByLineIdx(lineArray);
  64 +
  65 + rs.put("gpsList", gpsList);
  66 + rs.put("overspeedList", overspeedList);
  67 + rs.put("scis", scis);
  68 + return rs;
  69 + }
  70 +
  71 + @RequestMapping(value = "/allDevices")
  72 + public Iterable<String> allDevices() {
  73 + return gpsRealData.allDevices();
  74 + }
  75 +
  76 + @RequestMapping(value = "/removeRealGps", method = RequestMethod.POST)
  77 + public Map<String, Object> removeRealGps(@RequestParam String device) {
  78 + return gpsService.removeRealGps(device);
  79 + }
  80 +
  81 + /**
  82 + * @Title: history @Description: TODO(这个方法给测试页面用) @throws
  83 + */
  84 + @RequestMapping(value = "/history/{device}")
  85 + public List<Map<String, Object>> history(@PathVariable("device") String device, @RequestParam Long startTime,
  86 + @RequestParam Long endTime, @RequestParam int directions) {
  87 +
  88 + return gpsService.history(device, startTime, endTime, directions);
  89 + }
  90 +
  91 + @RequestMapping(value = "/gpsHistory/multiple")
  92 + public List<Map<String, Object>> gpsHistory(@RequestParam String[] nbbmArray, @RequestParam Long st,
  93 + @RequestParam Long et) {
  94 + return (List<Map<String, Object>>) gpsService.history(nbbmArray, st, et).get("list");
  95 + }
  96 +
  97 + /*@RequestMapping(value = "/analyse/ram")
  98 + public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
  99 + return ArrivalDataBuffer.allMap.get(nbbm);
  100 + }*/
  101 +
  102 + @RequestMapping(value = "/Car2DeviceId")
  103 + public Map<String, String> findCarDeviceIdMap() {
  104 + return BasicData.deviceId2NbbmMap.inverse();
  105 + }
  106 +
  107 + @RequestMapping(value = "/buffAera")
  108 + public Map<String, Object> findBuffAeraByCode(@RequestParam String lineCode, @RequestParam String code, @RequestParam String type) {
  109 + return gpsService.findBuffAeraByCode(lineCode, code, type);
  110 + }
  111 +
  112 + @RequestMapping(value = "/findRoadSpeed")
  113 + public Map<String, Object> findRoadSpeed(@RequestParam String lineCode) {
  114 + return gpsService.findRoadSpeed(lineCode);
  115 + }
  116 +
  117 + /**
  118 + * gps补全
  119 + * type 0 : 实时GPS 1:走补传
  120 + * @return
  121 + */
  122 + @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST)
  123 + public Map<String, Object> gpsCompletion(@RequestParam long schId, @RequestParam int type) {
  124 + return gpsService.gpsCompletion(schId, type);
  125 + }
  126 +
  127 + /**
  128 + * 历史GPS查询 ,第二版轨迹回放用
  129 + * @param nbbm
  130 + * @param st
  131 + * @param et
  132 + * @return
  133 + */
  134 + @RequestMapping(value = "/history_v2/{nbbm}")
  135 + public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
  136 + return gpsService.history_v2(nbbm, st, et);
  137 + }
  138 +
  139 + /**
  140 + * 历史GPS查询 ,第三版轨迹回放用
  141 + * @param nbbm
  142 + * @param st
  143 + * @param et
  144 + * @return
  145 + */
  146 + @RequestMapping(value = "/history_v3/{nbbm}")
  147 + public Map<String, Object> history_v3(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
  148 + return gpsService.history_v3(nbbm, st, et);
  149 + }
  150 +
  151 + /**
  152 + * 轨迹导出
  153 + * @param nbbm
  154 + * @param st
  155 + * @param et
  156 + * @return
  157 + */
  158 + @RequestMapping(value = "/history_v3/excel/{nbbm}")
  159 + public void trailExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
  160 + gpsService.trailExcel(nbbm, st, et, resp);
  161 + }
  162 +
  163 + /**
  164 + * 轨迹异常数据导出
  165 + * @param nbbm
  166 + * @param st
  167 + * @param et
  168 + * @return
  169 + */
  170 + @RequestMapping(value = "/history_v3/excel_abnormal/{nbbm}")
  171 + public void abnormalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
  172 + gpsService.abnormalExcel(nbbm, st, et, resp);
  173 + }
  174 +
  175 + /**
  176 + * 到离站数据导出
  177 + * @param nbbm
  178 + * @param st
  179 + * @param et
  180 + * @return
  181 + */
  182 + @RequestMapping(value = "/history_v3/excel_arrival/{nbbm}")
  183 + public void arrivalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){
  184 + gpsService.arrivalExcel(nbbm, st, et, resp);
  185 + }
  186 +
  187 +
  188 +
  189 +
  190 + /**
  191 + * 安全驾驶数据 分页查询
  192 + * @param map
  193 + * @param page
  194 + * @param size
  195 + * @param order
  196 + * @param direction
  197 + * @return
  198 + */
  199 + @RequestMapping(value = "/safeDriv")
  200 + public Map<String, Object> safeDrivList(@RequestParam Map<String, Object> map,
  201 + @RequestParam(defaultValue = "0") int page,
  202 + @RequestParam(defaultValue = "15") int size,
  203 + @RequestParam(defaultValue = "timestamp") String order,
  204 + @RequestParam(defaultValue = "DESC") String direction){
  205 + return gpsService.safeDrivList(map , page, size, order, direction);
  206 + }
  207 +
  208 + @RequestMapping(value = "/findPosition", method = RequestMethod.GET)
  209 + public List<GpsSpeed> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
  210 + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
  211 + List<GpsSpeed> listGpsSpeed = new ArrayList<GpsSpeed>();
  212 + listGpsSpeed = gpsService.findPosition(deviceid,startdate,enddate);
  213 + return listGpsSpeed;
  214 + }
  215 +
  216 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  217 + public Map<String, Object> pagequery(@RequestParam Map<String, Object> map){
  218 + map.put("curPage", map.get("page").toString());
  219 + map.put("pageData","10");
  220 + return gpsService.Pagequery(map);
  221 + }
  222 +
  223 + /**
  224 + * 获取线路下所有车辆,包括实时设备 和 计划排班
  225 + * @param lineCode
  226 + * @return
  227 + */
  228 + @RequestMapping(value = "/allCarsByLine",method = RequestMethod.GET)
  229 + public Map<String, Object> allCarsByLine(String lineCode){
  230 + return gpsService.allCarsByLine(lineCode);
  231 + }
  232 +
  233 +}
... ...
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
... ... @@ -94,7 +94,7 @@ public class GeoCacheData {
94 94 }
95 95  
96 96 private void loadStationRoutesData(){
97   - String sql = "select r.LINE_CODE,r.DIRECTIONS,r.STATION_CODE,r.STATION_MARK,s.SHAPES_TYPE,s.G_LONX,s.G_LATY,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID,s.RADIUS, r.STATION_ROUTE_CODE,s.STATION_NAME from bsth_c_stationroute r left join bsth_c_station s on r.station=s.id where r.destroy=0 order by r.station_route_code";
  97 + String sql = "select r.LINE_CODE,r.DIRECTIONS,r.STATION_CODE,r.STATION_MARK,r.SHAPED_TYPE,ST_X(s.CENTER_POINT_WGS) G_LONX, ST_Y(s.CENTER_POINT_WGS) G_LATY,ST_AsText(r.BUFFER_POLYGON_WGS) as G_POLYGON_GRID,r.RADIUS, r.STATION_ROUTE_CODE,r.STATION_NAME from bsth_c_stationroute r left join bsth_c_station s on r.station=s.id where r.destroy=0 order by r.station_route_code";
98 98 List<StationRoute> routeList = jdbcTemplate.query(sql, new RowMapper() {
99 99  
100 100 @Override
... ... @@ -109,10 +109,11 @@ public class GeoCacheData {
109 109 sRoute.setMark(rs.getString("STATION_MARK"));
110 110 sRoute.setName(rs.getString("STATION_NAME"));
111 111  
112   - String shapesType = rs.getString("SHAPES_TYPE");
  112 + String shapesType = rs.getString("SHAPED_TYPE");
113 113 //多边形电子围栏
114   - if (StringUtils.isNotEmpty(shapesType) && shapesType.equals("d"))
  114 + if (StringUtils.isNotEmpty(shapesType) && shapesType.equals("d")) {
115 115 sRoute.setPolygon(parsePolygon(rs.getString("G_POLYGON_GRID")));
  116 + }
116 117 return sRoute;
117 118 }
118 119 });
... ...
src/main/java/com/bsth/entity/LsSectionRoute.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +
3 5 import java.util.Date;
4 6  
5 7 import javax.persistence.Column;
... ... @@ -26,6 +28,7 @@ import javax.persistence.Table;
26 28  
27 29 @Entity
28 30 @Table(name = "bsth_c_ls_sectionroute")
  31 +@JsonIgnoreProperties(ignoreUnknown = true)
29 32 public class LsSectionRoute {
30 33  
31 34 @Id
... ... @@ -45,10 +48,10 @@ public class LsSectionRoute {
45 48 private Integer directions;
46 49  
47 50 // 版本号
48   - private Integer versions;
  51 + private Integer versions = 1;
49 52  
50 53 // 是否撤销
51   - private Integer destroy;
  54 + private Integer destroy = 0;
52 55  
53 56 /** 是否有路段限速数据 <0:分段;1:未分段>*/
54 57 private Integer isRoadeSpeed;
... ...
src/main/java/com/bsth/entity/LsStationRoute.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5 +import org.geolatte.geom.Polygon;
  6 +import org.hibernate.annotations.DynamicInsert;
  7 +import org.hibernate.annotations.DynamicUpdate;
  8 +
3 9 import javax.persistence.*;
4 10 import java.util.Date;
5 11  
... ... @@ -17,6 +23,9 @@ import java.util.Date;
17 23  
18 24 @Entity
19 25 @Table(name = "bsth_c_ls_stationroute")
  26 +@DynamicInsert
  27 +@DynamicUpdate
  28 +@JsonIgnoreProperties(ignoreUnknown = true)
20 29 @NamedEntityGraphs({
21 30 @NamedEntityGraph(name = "ls_stationRoute_station", attributeNodes = {
22 31 @NamedAttributeNode("station"),
... ... @@ -64,10 +73,10 @@ public class LsStationRoute {
64 73 private Integer outStationNmber;
65 74  
66 75 // 站点路由到站距离
67   - private Double distances;
  76 + private Double distances = 0.;
68 77  
69 78 // 站点路由到站时间
70   - private Double toTime;
  79 + private Double toTime = 0.;
71 80  
72 81 // 首班时间
73 82 private String firstTime;
... ... @@ -79,10 +88,10 @@ public class LsStationRoute {
79 88 private Integer directions;
80 89  
81 90 // 版本号
82   - private Integer versions;
  91 + private Integer versions = 1;
83 92  
84 93 // 是否撤销
85   - private Integer destroy;
  94 + private Integer destroy = 0;
86 95  
87 96 // 描述
88 97 private String descriptions;
... ... @@ -102,13 +111,41 @@ public class LsStationRoute {
102 111 private Date updateDate;
103 112  
104 113 // 站点信息
105   - @ManyToOne(fetch = FetchType.LAZY)
  114 + @ManyToOne(fetch = FetchType.EAGER)
106 115 private Station station;
107 116  
108 117 // 线路信息
109 118 @ManyToOne
110 119 private Line line;
111 120  
  121 + /**
  122 + * 缓冲区几何图形类型 d 多边形 r 圆形
  123 + */
  124 + private String shapedType = "r";
  125 +
  126 + /**
  127 + * 缓冲区为圆形时的半径(米)
  128 + */
  129 + private Integer radius = 80;
  130 +
  131 + /**
  132 + * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat))
  133 + */
  134 + @JsonIgnore
  135 + private Polygon bufferPolygon;
  136 +
  137 + /**
  138 + * 多边形缓冲区坐标 数字格式
  139 + */
  140 + @Transient
  141 + private String bufferPolygonWkt;
  142 +
  143 + @JsonIgnore
  144 + private Polygon bufferPolygonWgs;
  145 +
  146 + @Transient
  147 + private String bufferPolygonWgsWkt;
  148 +
112 149 public Integer getId() {
113 150 return id;
114 151 }
... ... @@ -292,5 +329,52 @@ public class LsStationRoute {
292 329 public void setStationNameEn(String stationNameEn) {
293 330 this.stationNameEn = stationNameEn;
294 331 }
295   -
  332 +
  333 + public String getShapedType() {
  334 + return shapedType;
  335 + }
  336 +
  337 + public void setShapedType(String shapedType) {
  338 + this.shapedType = shapedType;
  339 + }
  340 +
  341 + public Integer getRadius() {
  342 + return radius;
  343 + }
  344 +
  345 + public void setRadius(Integer radius) {
  346 + this.radius = radius;
  347 + }
  348 +
  349 + public Polygon getBufferPolygon() {
  350 + return bufferPolygon;
  351 + }
  352 +
  353 + public void setBufferPolygon(Polygon bufferPolygon) {
  354 + this.bufferPolygon = bufferPolygon;
  355 + }
  356 +
  357 + public String getBufferPolygonWkt() {
  358 + return bufferPolygonWkt;
  359 + }
  360 +
  361 + public void setBufferPolygonWkt(String bufferPolygonWkt) {
  362 + this.bufferPolygonWkt = bufferPolygonWkt;
  363 + }
  364 +
  365 + public Polygon getBufferPolygonWgs() {
  366 + return bufferPolygonWgs;
  367 + }
  368 +
  369 + public void setBufferPolygonWgs(Polygon bufferPolygonWgs) {
  370 + this.bufferPolygonWgs = bufferPolygonWgs;
  371 + }
  372 +
  373 + public String getBufferPolygonWgsWkt() {
  374 + return bufferPolygonWgsWkt;
  375 + }
  376 +
  377 + public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) {
  378 + this.bufferPolygonWgsWkt = bufferPolygonWgsWkt;
  379 + }
296 380 }
297 381 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/Section.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5 +import org.geolatte.geom.LineString;
3 6 import org.hibernate.annotations.Formula;
4 7  
5 8 import java.util.Date;
6 9  
7   -import javax.persistence.Column;
8   -import javax.persistence.Entity;
9   -import javax.persistence.GeneratedValue;
10   -import javax.persistence.GenerationType;
11   -import javax.persistence.Id;
12   -import javax.persistence.Table;
  10 +import javax.persistence.*;
13 11  
14 12 /**
15 13 *
... ... @@ -27,78 +25,130 @@ import javax.persistence.Table;
27 25  
28 26 @Entity
29 27 @Table(name = "bsth_c_section")
  28 +@JsonIgnoreProperties(ignoreUnknown = true)
30 29 public class Section{
31 30  
32 31 @Id
33 32 /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
34 33 private Integer id;
35   -
36   - // 路段编码
  34 +
  35 + /**
  36 + * 路段编码
  37 + */
37 38 private String sectionCode;
38   -
39   - // 道路编码
  39 +
  40 + /**
  41 + * 道路编码
  42 + */
40 43 private String roadCoding;
41   -
42   - // 路段名称
  44 +
  45 + /**
  46 + * 路段名称
  47 + */
43 48 private String sectionName;
44   -
45   - // 路段距离
  49 +
  50 + /**
  51 + * 路段距离
  52 + */
46 53 private Double sectionDistance;
47   -
48   - // 路段时间
  54 +
  55 + /**
  56 + * 路段时间
  57 + */
49 58 private Double sectionTime;
50   -
51   - // 经纬坐标类型
  59 +
  60 + /**
  61 + * 经纬坐标类型
  62 + */
52 63 private String dbType;
53   -
54   - // 路段类型
  64 +
  65 + /**
  66 + * 路段类型
  67 + */
55 68 private String sectionType;
56   -
57   - // 路段矢量(空间坐标点集合)--GPS坐标点
58   - @Formula("ST_AsText(gsection_vector)")
59   - private String gsectionVector;
60   -
61   - // 路段矢量(空间坐标点集合)--百度原始坐标坐标点
62   - @Formula("ST_AsText(bsection_vector)")
63   - private String bsectionVector;
64   -
65   - // 路段矢量(空间坐标点集合)--城建坐标点
66   - @Formula("ST_AsText(csection_vector)")
67   - private String csectionVector;
68   -
69   - // 交叉路
  69 +
  70 + /**
  71 + * 路段矢量(空间坐标点集合)--GPS坐标点
  72 + */
  73 + @JsonIgnore
  74 + private LineString gsectionVector;
  75 +
  76 + @Transient
  77 + private String gsectionVectorWkt;
  78 +
  79 + /**
  80 + * 路段矢量(空间坐标点集合)--百度原始坐标坐标点
  81 + */
  82 + @JsonIgnore
  83 + private LineString bsectionVector;
  84 +
  85 + @Transient
  86 + private String bsectionVectorWkt;
  87 +
  88 + /**
  89 + * 路段矢量(空间坐标点集合)--城建坐标点
  90 + */
  91 + @JsonIgnore
  92 + private LineString csectionVector;
  93 +
  94 + @Transient
  95 + private String csectionVectorWkt;
  96 +
  97 + /**
  98 + * 交叉路
  99 + */
70 100 private String crosesRoad;
71   -
72   - // 起始节点
  101 +
  102 + /**
  103 + * 起始节点
  104 + */
73 105 private String startNode;
74   -
75   - // 中间节点
  106 +
  107 + /**
  108 + * 中间节点
  109 + */
76 110 private String middleNode;
77   -
78   - // 终止节点
  111 +
  112 + /**
  113 + * 终止节点
  114 + */
79 115 private String endNode;
80   -
81   - // 限速
  116 +
  117 + /**
  118 + * 限速
  119 + */
82 120 private Double speedLimit;
83   -
84   - // 版本号
  121 +
  122 + /**
  123 + * 版本号
  124 + */
85 125 private Integer versions;
86   -
87   - // 描述
  126 +
  127 + /**
  128 + * 描述
  129 + */
88 130 private String descriptions;
89   -
90   - // 创建人
  131 +
  132 + /**
  133 + * 创建人
  134 + */
91 135 private Integer createBy;
92   -
93   - // 修改人
  136 +
  137 + /**
  138 + * 修改人
  139 + */
94 140 private Integer updateBy;
95   -
96   - // 创建日期
  141 +
  142 + /**
  143 + * 创建日期
  144 + */
97 145 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
98 146 private Date createDate;
99   -
100   - // 修改日期
101   - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  147 +
  148 + /**
  149 + * 修改日期
  150 + */
  151 + @Column(insertable = false, name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
102 152 private Date updateDate;
103 153  
104 154 public Integer getId() {
... ... @@ -165,30 +215,66 @@ public class Section{
165 215 this.sectionType = sectionType;
166 216 }
167 217  
168   - public String getGsectionVector() {
  218 + public LineString getGsectionVector() {
169 219 return gsectionVector;
170 220 }
171 221  
172   - public void setGsectionVector(String gsectionVector) {
  222 + public void setGsectionVector(LineString gsectionVector) {
173 223 this.gsectionVector = gsectionVector;
174 224 }
175   -
176   - public String getBsectionVector() {
  225 +
  226 + public String getGsectionVectorWkt() {
  227 + if (gsectionVectorWkt == null && gsectionVector != null) {
  228 + this.gsectionVectorWkt = this.gsectionVector.toString();
  229 + }
  230 +
  231 + return gsectionVectorWkt;
  232 + }
  233 +
  234 + public void setGsectionVectorWkt(String gsectionVectorWkt) {
  235 + this.gsectionVectorWkt = gsectionVectorWkt;
  236 + }
  237 +
  238 + public LineString getBsectionVector() {
177 239 return bsectionVector;
178 240 }
179 241  
180   - public void setBsectionVector(String bsectionVector) {
  242 + public void setBsectionVector(LineString bsectionVector) {
181 243 this.bsectionVector = bsectionVector;
182 244 }
183 245  
184   - public String getCsectionVector() {
  246 + public String getBsectionVectorWkt() {
  247 + if (bsectionVectorWkt == null && bsectionVector != null) {
  248 + this.bsectionVectorWkt = this.bsectionVector.toString();
  249 + }
  250 +
  251 + return bsectionVectorWkt;
  252 + }
  253 +
  254 + public void setBsectionVectorWkt(String bsectionVectorWkt) {
  255 + this.bsectionVectorWkt = bsectionVectorWkt;
  256 + }
  257 +
  258 + public LineString getCsectionVector() {
185 259 return csectionVector;
186 260 }
187 261  
188   - public void setCsectionVector(String csectionVector) {
  262 + public void setCsectionVector(LineString csectionVector) {
189 263 this.csectionVector = csectionVector;
190 264 }
191 265  
  266 + public String getCsectionVectorWkt() {
  267 + if (csectionVectorWkt == null && csectionVector != null) {
  268 + this.csectionVectorWkt = this.csectionVector.toString();
  269 + }
  270 +
  271 + return csectionVectorWkt;
  272 + }
  273 +
  274 + public void setCsectionVectorWkt(String csectionVectorWkt) {
  275 + this.csectionVectorWkt = csectionVectorWkt;
  276 + }
  277 +
192 278 public String getCrosesRoad() {
193 279 return crosesRoad;
194 280 }
... ...
src/main/java/com/bsth/entity/SectionRouteCache.java deleted 100644 → 0
1   -package com.bsth.entity;
2   -
3   -import java.util.Date;
4   -
5   -import javax.persistence.Column;
6   -import javax.persistence.Entity;
7   -import javax.persistence.GeneratedValue;
8   -import javax.persistence.GenerationType;
9   -import javax.persistence.Id;
10   -import javax.persistence.ManyToOne;
11   -import javax.persistence.OneToOne;
12   -import javax.persistence.Table;
13   -
14   -
15   -/**
16   - *
17   - * @ClassName : SectionRoute(路段路由缓存实体类)
18   - *
19   - * @Author : bsth@lq
20   - *
21   - * @Description : TODO(路段路由)
22   - *
23   - * @Data :2016-04-21
24   - *
25   - * @Version 公交调度系统BS版 0.1
26   - *
27   - */
28   -
29   -@Entity
30   -@Table(name = "bsth_c_sectionroute_cache")
31   -public class SectionRouteCache {
32   -
33   - @Id
34   - @GeneratedValue(strategy = GenerationType.IDENTITY)
35   - private Integer id;
36   -
37   - // 路段路由序号
38   - private Integer sectionrouteCode;
39   -
40   - // 线路编号
41   - private String lineCode;
42   -
43   - // 路段编号
44   - private String sectionCode;
45   -
46   - // 路段路由方向
47   - private Integer directions;
48   -
49   - // 版本号
50   - private Integer versions;
51   -
52   - // 是否撤销
53   - private Integer destroy;
54   -
55   - /** 是否有路段限速数据 <0:分段;1:未分段>*/
56   - private Integer isRoadeSpeed;
57   -
58   - // 描述
59   - private String descriptions;
60   -
61   - // 创建人
62   - private Integer createBy;
63   -
64   - // 修改人
65   - private Integer updateBy;
66   -
67   - // 创建日期
68   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
69   - private Date createDate;
70   -
71   - // 修改日期
72   - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
73   - private Date updateDate;
74   -
75   - // 路段信息
76   - @OneToOne
77   - private Section section;
78   -
79   - // 线路信息
80   - @ManyToOne
81   - private Line line;
82   -
83   - public Integer getIsRoadeSpeed() {
84   - return isRoadeSpeed;
85   - }
86   -
87   - public void setIsRoadeSpeed(Integer isRoadeSpeed) {
88   - this.isRoadeSpeed = isRoadeSpeed;
89   - }
90   -
91   - public Integer getId() {
92   - return id;
93   - }
94   -
95   - public void setId(Integer id) {
96   - this.id = id;
97   - }
98   -
99   - public Integer getSectionrouteCode() {
100   - return sectionrouteCode;
101   - }
102   -
103   - public void setSectionrouteCode(Integer sectionrouteCode) {
104   - this.sectionrouteCode = sectionrouteCode;
105   - }
106   -
107   - public String getLineCode() {
108   - return lineCode;
109   - }
110   -
111   - public void setLineCode(String lineCode) {
112   - this.lineCode = lineCode;
113   - }
114   -
115   - public String getSectionCode() {
116   - return sectionCode;
117   - }
118   -
119   - public void setSectionCode(String sectionCode) {
120   - this.sectionCode = sectionCode;
121   - }
122   -
123   - public Integer getDirections() {
124   - return directions;
125   - }
126   -
127   - public void setDirections(Integer directions) {
128   - this.directions = directions;
129   - }
130   -
131   - public Integer getVersions() {
132   - return versions;
133   - }
134   -
135   - public void setVersions(Integer versions) {
136   - this.versions = versions;
137   - }
138   -
139   - public Integer getDestroy() {
140   - return destroy;
141   - }
142   -
143   - public void setDestroy(Integer destroy) {
144   - this.destroy = destroy;
145   - }
146   -
147   - public String getDescriptions() {
148   - return descriptions;
149   - }
150   -
151   - public void setDescriptions(String descriptions) {
152   - this.descriptions = descriptions;
153   - }
154   -
155   - public Integer getCreateBy() {
156   - return createBy;
157   - }
158   -
159   - public void setCreateBy(Integer createBy) {
160   - this.createBy = createBy;
161   - }
162   -
163   - public Integer getUpdateBy() {
164   - return updateBy;
165   - }
166   -
167   - public void setUpdateBy(Integer updateBy) {
168   - this.updateBy = updateBy;
169   - }
170   -
171   - public Date getCreateDate() {
172   - return createDate;
173   - }
174   -
175   - public void setCreateDate(Date createDate) {
176   - this.createDate = createDate;
177   - }
178   -
179   - public Date getUpdateDate() {
180   - return updateDate;
181   - }
182   -
183   - public void setUpdateDate(Date updateDate) {
184   - this.updateDate = updateDate;
185   - }
186   -
187   - public Section getSection() {
188   - return section;
189   - }
190   -
191   - public void setSection(Section section) {
192   - this.section = section;
193   - }
194   -
195   - public Line getLine() {
196   - return line;
197   - }
198   -
199   - public void setLine(Line line) {
200   - this.line = line;
201   - }
202   -}
src/main/java/com/bsth/entity/Station.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.util.Geo.Point;
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
4 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5 +import org.geolatte.geom.Point;
  6 +import org.hibernate.annotations.DynamicInsert;
  7 +import org.hibernate.annotations.DynamicUpdate;
5 8 import org.hibernate.annotations.Formula;
6 9 import org.locationtech.jts.geom.Geometry;
7 10 import org.locationtech.jts.io.WKBReader;
  11 +import org.springframework.util.StringUtils;
8 12  
9 13 import javax.persistence.*;
10 14  
11   -import java.util.Arrays;
12 15 import java.util.Date;
13   -import java.util.List;
14   -
15 16  
16 17 /**
17 18 *
... ... @@ -29,83 +30,48 @@ import java.util.List;
29 30  
30 31 @Entity
31 32 @Table(name = "bsth_c_station")
32   -@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
  33 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}, ignoreUnknown = true)
  34 +@DynamicInsert
  35 +@DynamicUpdate
33 36 public class Station {
34 37  
35 38 @Id
36 39 // @GeneratedValue(strategy = GenerationType.IDENTITY)
37 40 private Integer id;
38   -
39   - // 站点编码
40   - private String stationCod;
41   -
42   - // 站点名称
43   - private String stationName;
44   -
45   - // 所在道路编码
46   - private String roadCoding;
47   -
48   - // 站点的具体地址
49   - private String addr;
50   -
  41 +
51 42 /**
52   - * 经纬坐标类型
53   - *
54   - * --------- b:百度坐标系
55   - *
56   - * --------- d:高德坐标系
  43 + * 站点编码
57 44 */
58   - private String dbType;
59   -
60   - // 百度经纬度坐标
61   - private String bJwpoints;
62   -
63   - // 站点地理位置WGS坐标经度
64   - private Float gLonx;
65   -
66   - // 站点地理位置WGS坐标纬度
67   - private Float gLaty;
68   -
69   - // 城建坐标 x
70   - private Float x;
71   -
72   - // 城建坐标 y
73   - private Float y;
74   -
  45 + private String stationCode;
  46 +
75 47 /**
76   - * 图形类型
77   - *
78   - * ------ r:圆形
79   - *
80   - * ------ p:多边形
  48 + * 站点名称
81 49 */
82   - private String shapesType;
83   -
84   - // 圆形半径
85   - private Integer radius;
86   -
87   - // 多边形空间WGS坐标点集合
88   - private byte[] gPolygonGrid;
89   -
90   - // 多边形空间原坐标坐标点集合
91   - private byte[] bPolygonGrid;
  50 + private String stationName;
  51 +
  52 + /**
  53 + * 所在道路编码
  54 + */
  55 + private String roadCoding;
  56 +
  57 + /**
  58 + * 站点的具体地址
  59 + */
  60 + private String address;
92 61  
93   - @Transient
94   - private String bdPolygon;
95   -
96 62 /**
97   - * 是否撤销
98   - *
99   - * ------ 1:撤销
100   - *
101   - * ------ 0:不撤销
  63 + * 是否撤销 1:撤销 0:未撤销
102 64 */
103   - private Integer destroy;
104   -
105   - // 版本号
  65 + private Integer destroy = 0;
  66 +
  67 + /**
  68 + * 版本号
  69 + */
106 70 private Integer versions;
107 71  
108   - /** 是否有电子站牌 这里是老调度系统的原始字段,暂时保留该字段。 */
  72 + /**
  73 + * 是否有电子站牌 这里是老调度系统的原始字段,暂时保留该字段。
  74 + */
109 75 private Integer isHaveLed;
110 76  
111 77 /** 是否有候车亭 这里是老调度系统的原始字段,暂时保留该字段。*/
... ... @@ -113,55 +79,57 @@ public class Station {
113 79  
114 80 /** 是否港湾式公交站 这里是老调度系统的原始字段,暂时保留该字段。*/
115 81 private Integer isHarbourStation;
116   -
117   - // 描述
  82 +
  83 + /**
  84 + * 描述
  85 + */
118 86 private String descriptions;
119   -
120   - // 创建人
  87 +
  88 + /**
  89 + * 创建人
  90 + */
121 91 private Integer createBy;
122   -
123   - // 修改人
  92 +
  93 + /**
  94 + * 修改人
  95 + */
124 96 private Integer updateBy;
125   -
126   - // 创建日期
  97 +
  98 + /**
  99 + * 创建日期
  100 + */
127 101 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
128 102 private Date createDate;
129   -
130   - // 修改日期
  103 +
  104 + /**
  105 + * 修改日期
  106 + */
131 107 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
132 108 private Date updateDate;
133   -
134   - public Integer getIsHaveLed() {
135   - return isHaveLed;
136   - }
137   -
138   - public void setIsHaveLed(Integer isHaveLed) {
139   - this.isHaveLed = isHaveLed;
140   - }
141   -
142   - public Integer getIsHaveShelter() {
143   - return isHaveShelter;
144   - }
145 109  
146   - public void setIsHaveShelter(Integer isHaveShelter) {
147   - this.isHaveShelter = isHaveShelter;
148   - }
  110 + /**
  111 + * 中心点 字符格式 Point(lon, lat)
  112 + */
  113 + @JsonIgnore
  114 + private Point centerPoint;
149 115  
150   - public Integer getIsHarbourStation() {
151   - return isHarbourStation;
152   - }
  116 + /**
  117 + * 中心点 数字格式
  118 + */
  119 + @Transient
  120 + private String centerPointWkt;
153 121  
154   - public void setIsHarbourStation(Integer isHarbourStation) {
155   - this.isHarbourStation = isHarbourStation;
156   - }
  122 + @JsonIgnore
  123 + private Point centerPointWgs;
157 124  
158   - public String getAddr() {
159   - return addr;
160   - }
  125 + @Transient
  126 + private String centerPointWgsWkt;
161 127  
162   - public void setAddr(String addr) {
163   - this.addr = addr;
164   - }
  128 + /**
  129 + * 途经线路
  130 + */
  131 + @Transient
  132 + private String passLines;
165 133  
166 134 public Integer getId() {
167 135 return id;
... ... @@ -171,12 +139,12 @@ public class Station {
171 139 this.id = id;
172 140 }
173 141  
174   - public String getStationCod() {
175   - return stationCod;
  142 + public String getStationCode() {
  143 + return stationCode;
176 144 }
177 145  
178   - public void setStationCod(String stationCod) {
179   - this.stationCod = stationCod;
  146 + public void setStationCode(String stationCode) {
  147 + this.stationCode = stationCode;
180 148 }
181 149  
182 150 public String getStationName() {
... ... @@ -195,111 +163,52 @@ public class Station {
195 163 this.roadCoding = roadCoding;
196 164 }
197 165  
198   - public String getDbType() {
199   - return dbType;
200   - }
201   -
202   - public void setDbType(String dbType) {
203   - this.dbType = dbType;
204   - }
205   -
206   - public String getbJwpoints() {
207   - return bJwpoints;
208   - }
209   -
210   - public void setbJwpoints(String bJwpoints) {
211   - this.bJwpoints = bJwpoints;
212   - }
213   -
214   - public Float getgLonx() {
215   - return gLonx;
216   - }
217   -
218   - public void setgLonx(Float gLonx) {
219   - this.gLonx = gLonx;
220   - }
221   -
222   - public Float getgLaty() {
223   - return gLaty;
224   - }
225   -
226   - public void setgLaty(Float gLaty) {
227   - this.gLaty = gLaty;
228   - }
229   -
230   - public Float getX() {
231   - return x;
232   - }
233   -
234   - public void setX(Float x) {
235   - this.x = x;
  166 + public String getAddress() {
  167 + return address;
236 168 }
237 169  
238   - public Float getY() {
239   - return y;
  170 + public void setAddress(String address) {
  171 + this.address = address;
240 172 }
241 173  
242   - public void setY(Float y) {
243   - this.y = y;
244   - }
245   -
246   - public String getShapesType() {
247   - return shapesType;
248   - }
249   -
250   - public void setShapesType(String shapesType) {
251   - this.shapesType = shapesType;
252   - }
253   -
254   - public Integer getRadius() {
255   - return radius;
  174 + public Integer getDestroy() {
  175 + return destroy;
256 176 }
257 177  
258   - public void setRadius(Integer radius) {
259   - this.radius = radius;
  178 + public void setDestroy(Integer destroy) {
  179 + this.destroy = destroy;
260 180 }
261 181  
262   - public byte[] getgPolygonGrid() {
263   - return gPolygonGrid;
  182 + public Integer getVersions() {
  183 + return versions;
264 184 }
265 185  
266   - public void setgPolygonGrid(byte[] gPolygonGrid) {
267   - this.gPolygonGrid = gPolygonGrid;
268   - }
269   -
270   - public byte[] getbPolygonGrid() {
271   - return bPolygonGrid;
  186 + public void setVersions(Integer versions) {
  187 + this.versions = versions;
272 188 }
273 189  
274   - public void setbPolygonGrid(byte[] bPolygonGrid) {
275   - this.bPolygonGrid = bPolygonGrid;
  190 + public Integer getIsHaveLed() {
  191 + return isHaveLed;
276 192 }
277 193  
278   - public String getBdPolygon() {
279   - if (bPolygonGrid == null) {
280   - return null;
281   - }
282   - Geometry geometry = getGeometryFromBytes(getbPolygonGrid());
283   - if (geometry == null) {
284   - return null;
285   - }
286   - return geometry.toString();
  194 + public void setIsHaveLed(Integer isHaveLed) {
  195 + this.isHaveLed = isHaveLed;
287 196 }
288 197  
289   - public Integer getDestroy() {
290   - return destroy;
  198 + public Integer getIsHaveShelter() {
  199 + return isHaveShelter;
291 200 }
292 201  
293   - public void setDestroy(Integer destroy) {
294   - this.destroy = destroy;
  202 + public void setIsHaveShelter(Integer isHaveShelter) {
  203 + this.isHaveShelter = isHaveShelter;
295 204 }
296 205  
297   - public Integer getVersions() {
298   - return versions;
  206 + public Integer getIsHarbourStation() {
  207 + return isHarbourStation;
299 208 }
300 209  
301   - public void setVersions(Integer versions) {
302   - this.versions = versions;
  210 + public void setIsHarbourStation(Integer isHarbourStation) {
  211 + this.isHarbourStation = isHarbourStation;
303 212 }
304 213  
305 214 public String getDescriptions() {
... ... @@ -342,58 +251,51 @@ public class Station {
342 251 this.updateDate = updateDate;
343 252 }
344 253  
345   - private static Geometry getGeometryFromBytes(byte[] geometryAsBytes) {
346   - Geometry geometry = null;
347   - try {
348   - // 字节数组小于5,说明geometry有问题
349   - if (geometryAsBytes.length < 5) {
350   - throw new Exception("Invalid geometry inputStream - less than five bytes");
351   - }
352   -
353   - //first four bytes of the geometry are the SRID,
354   - //followed by the actual WKB. Determine the SRID
355   - //这里是取字节数组的前4个来解析srid
356   - byte[] sridBytes = new byte[4];
357   - System.arraycopy(geometryAsBytes, 0, sridBytes, 0, 4);
358   - boolean bigEndian = (geometryAsBytes[4] == 0x00);
359   - // 解析srid
360   - int srid = 0;
361   - if (bigEndian) {
362   - for (int i = 0; i < sridBytes.length; i++) {
363   - srid = (srid << 8) + (sridBytes[i] & 0xff);
364   - }
365   - } else {
366   - for (int i = 0; i < sridBytes.length; i++) {
367   - srid += (sridBytes[i] & 0xff) << (8 * i);
368   - }
369   - }
370   -
371   - //use the JTS WKBReader for WKB parsing
372   - WKBReader wkbReader = new WKBReader();
373   - // 使用geotool的WKBReader 把字节数组转成geometry对象。
374   - //copy the byte array, removing the first four
375   - //SRID bytes
376   - byte[] wkb = new byte[geometryAsBytes.length - 4];
377   - System.arraycopy(geometryAsBytes, 4, wkb, 0, wkb.length);
378   - geometry = wkbReader.read(wkb);
379   - geometry.setSRID(srid);
380   - } catch (Exception e) {
381   - e.printStackTrace();
  254 + public Point getCenterPoint() {
  255 + return centerPoint;
  256 + }
  257 +
  258 + public void setCenterPoint(Point centerPoint) {
  259 + this.centerPoint = centerPoint;
  260 + }
  261 +
  262 + public String getCenterPointWkt() {
  263 + if (centerPointWkt == null && this.centerPoint != null) {
  264 + centerPointWkt = this.centerPoint.toString();
382 265 }
383 266  
384   - return geometry;
  267 + return centerPointWkt;
385 268 }
386 269  
387   - @Override
388   - public String toString() {
389   - return "Station [id=" + id + ", stationCod=" + stationCod + ", stationName=" + stationName + ", roadCoding="
390   - + roadCoding + ", addr=" + addr + ", dbType=" + dbType + ", bJwpoints=" + bJwpoints + ", gLonx=" + gLonx
391   - + ", gLaty=" + gLaty + ", x=" + x + ", y=" + y + ", shapesType=" + shapesType + ", radius=" + radius
392   - + ", gPolygonGrid=" + Arrays.toString(gPolygonGrid) + ", bPolygonGrid=" + Arrays.toString(bPolygonGrid)
393   - + ", destroy=" + destroy + ", versions=" + versions + ", isHaveLed=" + isHaveLed + ", isHaveShelter="
394   - + isHaveShelter + ", isHarbourStation=" + isHarbourStation + ", descriptions=" + descriptions
395   - + ", createBy=" + createBy + ", updateBy=" + updateBy + ", createDate=" + createDate + ", updateDate="
396   - + updateDate + "]";
  270 + public void setCenterPointWkt(String centerPointWkt) {
  271 + this.centerPointWkt = centerPointWkt;
  272 + }
  273 +
  274 + public Point getCenterPointWgs() {
  275 + return centerPointWgs;
  276 + }
  277 +
  278 + public void setCenterPointWgs(Point centerPointWgs) {
  279 + this.centerPointWgs = centerPointWgs;
  280 + }
  281 +
  282 + public String getCenterPointWgsWkt() {
  283 + if (centerPointWgsWkt == null && this.centerPointWgs != null) {
  284 + centerPointWgsWkt = this.centerPointWgs .toString();
  285 + }
  286 +
  287 + return centerPointWgsWkt;
  288 + }
  289 +
  290 + public void setCenterPointWgsWkt(String centerPointWgsWkt) {
  291 + this.centerPointWgsWkt = centerPointWgsWkt;
  292 + }
  293 +
  294 + public String getPassLines() {
  295 + return passLines;
  296 + }
  297 +
  298 + public void setPassLines(String passLines) {
  299 + this.passLines = passLines;
397 300 }
398   -
399 301 }
... ...
src/main/java/com/bsth/entity/StationRoute.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.bsth.util.Geo.Point;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import org.geolatte.geom.Polygon;
  6 +
3 7 import javax.persistence.*;
4 8 import java.util.Date;
  9 +import java.util.List;
5 10  
6 11 /**
7 12 *
... ... @@ -26,92 +31,156 @@ import java.util.Date;
26 31 })
27 32 })
28 33 public class StationRoute {
29   -
30   - //站点路由ID
  34 +
  35 + /**
  36 + * 站点路由ID
  37 + */
31 38 @Id
32 39 @GeneratedValue(strategy = GenerationType.IDENTITY)
33 40 private Integer id;
34   -
35   - // 站点路由序号
  41 +
  42 + /**
  43 + * 站点路由序号
  44 + */
36 45 private Integer stationRouteCode;
37   -
38   - // 站点编码
  46 +
  47 + /**
  48 + * 站点编码
  49 + */
39 50 private String stationCode;
40   -
41   - // 站点名称
  51 +
  52 + /**
  53 + * 站级名称
  54 + */
42 55 private String stationName;
43 56  
44   - // 站点名称
  57 + /**
  58 + * 站点名称
  59 + */
45 60 private String stationNameEn;
46   - // 线路编码
  61 +
  62 + /**
  63 + * 线路编码
  64 + */
47 65 private String lineCode;
48 66  
49   - // 行业编码
  67 + /**
  68 + * 行业编码
  69 + */
50 70 private String industryCode;
51 71  
52 72 /**
53   - * 站点类型
54   - *
55   - * ------ B:起点站
56   - *
57   - * ------ Z:中途站
58   - *
59   - * ------ E:终点站
60   - *
61   - * ------ T:停车场
62   - *
  73 + * 站点类型 B:起点站 Z:中途站 E:终点站
63 74 */
64 75 private String stationMark;
65   -
66   - // 站点路由出站序号
  76 +
  77 + /**
  78 + * 站点路由出站序号
  79 + */
67 80 private Integer outStationNmber;
68   -
69   - // 站点路由到站距离
  81 +
  82 + /**
  83 + * 站点路由到站距离
  84 + */
70 85 private Double distances;
71   -
72   - // 站点路由到站时间
  86 +
  87 + /**
  88 + * 站点路由到站时间
  89 + */
73 90 private Double toTime;
74   -
75   - // 首班时间
  91 +
  92 + /**
  93 + * 首班时间
  94 + */
76 95 private String firstTime;
77   -
78   - // 末班时间
  96 +
  97 + /**
  98 + * 末班时间
  99 + */
79 100 private String endTime;
80   -
81   - // 站点路由方向
  101 +
  102 + /**
  103 + * 站点路由方向
  104 + */
82 105 private Integer directions;
83   -
84   - // 版本号
  106 +
  107 + /**
  108 + * 版本号
  109 + */
85 110 private Integer versions;
86   -
87   - // 是否撤销
  111 +
  112 + /**
  113 + * 是否撤销
  114 + */
88 115 private Integer destroy;
89   -
90   - // 描述
  116 +
  117 + /**
  118 + * 描述
  119 + */
91 120 private String descriptions;
92   -
93   - // 创建人
  121 +
  122 + /**
  123 + * 创建人
  124 + */
94 125 private Integer createBy;
95   -
96   - // 修改人
  126 +
  127 + /**
  128 + * 修改人
  129 + */
97 130 private Integer updateBy;
98   -
99   - // 创建日期
  131 +
  132 + /**
  133 + * 创建日期
  134 + */
100 135 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
101 136 private Date createDate;
102   -
103   - // 修改日期
  137 +
  138 + /**
  139 + * 修改日期
  140 + */
104 141 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
105 142 private Date updateDate;
106   -
107   - // 站点信息
  143 +
  144 + /**
  145 + * 站点信息
  146 + */
108 147 @ManyToOne(fetch = FetchType.LAZY)
109 148 private Station station;
110   -
111   - // 线路信息
  149 +
  150 + /**
  151 + * 线路信息
  152 + */
112 153 @ManyToOne
113 154 private Line line;
114 155  
  156 + /**
  157 + * 缓冲区几何图形类型 d 多边形 r 圆形
  158 + */
  159 + private String shapedType;
  160 +
  161 + /**
  162 + * 缓冲区为圆形时的半径(米)
  163 + */
  164 + private Integer radius;
  165 +
  166 + /**
  167 + * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat))
  168 + */
  169 + @JsonIgnore
  170 + private Polygon bufferPolygon;
  171 +
  172 + /**
  173 + * 多边形缓冲区坐标 数字格式
  174 + */
  175 + @Transient
  176 + private String bufferPolygonWkt;
  177 +
  178 + @JsonIgnore
  179 + private Polygon bufferPolygonWgs;
  180 +
  181 + @Transient
  182 + private String bufferPolygonWgsWkt;
  183 +
115 184 public Integer getId() {
116 185 return id;
117 186 }
... ... @@ -144,6 +213,14 @@ public class StationRoute {
144 213 this.stationName = stationName;
145 214 }
146 215  
  216 + public String getStationNameEn() {
  217 + return stationNameEn;
  218 + }
  219 +
  220 + public void setStationNameEn(String stationNameEn) {
  221 + this.stationNameEn = stationNameEn;
  222 + }
  223 +
147 224 public String getLineCode() {
148 225 return lineCode;
149 226 }
... ... @@ -215,7 +292,7 @@ public class StationRoute {
215 292 public void setDirections(Integer directions) {
216 293 this.directions = directions;
217 294 }
218   -
  295 +
219 296 public Integer getVersions() {
220 297 return versions;
221 298 }
... ... @@ -223,7 +300,7 @@ public class StationRoute {
223 300 public void setVersions(Integer versions) {
224 301 this.versions = versions;
225 302 }
226   -
  303 +
227 304 public Integer getDestroy() {
228 305 return destroy;
229 306 }
... ... @@ -288,12 +365,51 @@ public class StationRoute {
288 365 this.line = line;
289 366 }
290 367  
291   - public String getStationNameEn() {
292   - return stationNameEn;
  368 + public String getShapedType() {
  369 + return shapedType;
293 370 }
294 371  
295   - public void setStationNameEn(String stationNameEn) {
296   - this.stationNameEn = stationNameEn;
  372 + public void setShapedType(String shapedType) {
  373 + this.shapedType = shapedType;
  374 + }
  375 +
  376 + public Integer getRadius() {
  377 + return radius;
  378 + }
  379 +
  380 + public void setRadius(Integer radius) {
  381 + this.radius = radius;
  382 + }
  383 +
  384 + public Polygon getBufferPolygon() {
  385 + return bufferPolygon;
  386 + }
  387 +
  388 + public void setBufferPolygon(Polygon bufferPolygon) {
  389 + this.bufferPolygon = bufferPolygon;
  390 + }
  391 +
  392 + public String getBufferPolygonWkt() {
  393 + return bufferPolygonWkt;
  394 + }
  395 +
  396 + public void setBufferPolygonWkt(String bufferPolygonWkt) {
  397 + this.bufferPolygonWkt = bufferPolygonWkt;
  398 + }
  399 +
  400 + public Polygon getBufferPolygonWgs() {
  401 + return bufferPolygonWgs;
  402 + }
  403 +
  404 + public void setBufferPolygonWgs(Polygon bufferPolygonWgs) {
  405 + this.bufferPolygonWgs = bufferPolygonWgs;
  406 + }
  407 +
  408 + public String getBufferPolygonWgsWkt() {
  409 + return bufferPolygonWgsWkt;
  410 + }
  411 +
  412 + public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) {
  413 + this.bufferPolygonWgsWkt = bufferPolygonWgsWkt;
297 414 }
298   -
299 415 }
300 416 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/StationRouteCache.java deleted 100644 → 0
1   -package com.bsth.entity;
2   -
3   -import javax.persistence.*;
4   -
5   -import java.util.Date;
6   -
7   -/**
8   - *
9   - * @ClassName : StationRouteCache(站点路由缓存实体类)
10   - *
11   - * @Author : bsth@lq
12   - *
13   - * @Description : TODO(站点路由)
14   - *
15   - * @Data :2016-04-19
16   - *
17   - * @Version 公交调度系统BS版 0.1
18   - *
19   - */
20   -
21   -@Entity
22   -@Table(name = "bsth_c_stationroute_cache")
23   -@NamedEntityGraphs({
24   - @NamedEntityGraph(name = "stationRoute_station_cache", attributeNodes = {
25   - @NamedAttributeNode("station"),
26   - @NamedAttributeNode("line")
27   - })
28   -})
29   -public class StationRouteCache {
30   -
31   - //站点路由ID
32   - @Id
33   - @GeneratedValue(strategy = GenerationType.IDENTITY)
34   - private Integer id;
35   -
36   - // 站点路由序号
37   - private Integer stationRouteCode;
38   -
39   - // 站点编码
40   - private String stationCode;
41   -
42   - // 站点名称
43   - private String stationName;
44   -
45   - // 线路编码
46   - private String lineCode;
47   -
48   - // 行业编码
49   - private String industryCode;
50   - /**
51   - * 站点类型
52   - *
53   - * ------ B:起点站
54   - *
55   - * ------ Z:中途站
56   - *
57   - * ------ E:终点站
58   - *
59   - * ------ T:停车场
60   - *
61   - */
62   - private String stationMark;
63   -
64   - // 站点路由出站序号
65   - private Integer outStationNmber;
66   -
67   - // 站点路由到站距离
68   - private Double distances;
69   -
70   - // 站点路由到站时间
71   - private Double toTime;
72   -
73   - // 首班时间
74   - private String firstTime;
75   -
76   - // 末班时间
77   - private String endTime;
78   -
79   - // 站点路由方向
80   - private Integer directions;
81   -
82   - // 版本号
83   - private Integer versions;
84   -
85   - // 是否撤销
86   - private Integer destroy;
87   -
88   - // 描述
89   - private String descriptions;
90   -
91   - // 创建人
92   - private Integer createBy;
93   -
94   - // 修改人
95   - private Integer updateBy;
96   -
97   - // 创建日期
98   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
99   - private Date createDate;
100   -
101   - // 修改日期
102   - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
103   - private Date updateDate;
104   -
105   - // 站点信息
106   - @ManyToOne(fetch = FetchType.LAZY)
107   - private Station station;
108   -
109   - // 线路信息
110   - @ManyToOne
111   - private Line line;
112   -
113   - public Integer getId() {
114   - return id;
115   - }
116   -
117   - public void setId(Integer id) {
118   - this.id = id;
119   - }
120   -
121   - public Integer getStationRouteCode() {
122   - return stationRouteCode;
123   - }
124   -
125   - public void setStationRouteCode(Integer stationRouteCode) {
126   - this.stationRouteCode = stationRouteCode;
127   - }
128   -
129   - public String getStationCode() {
130   - return stationCode;
131   - }
132   -
133   - public void setStationCode(String stationCode) {
134   - this.stationCode = stationCode;
135   - }
136   -
137   - public String getStationName() {
138   - return stationName;
139   - }
140   -
141   - public void setStationName(String stationName) {
142   - this.stationName = stationName;
143   - }
144   -
145   - public String getLineCode() {
146   - return lineCode;
147   - }
148   -
149   - public void setLineCode(String lineCode) {
150   - this.lineCode = lineCode;
151   - }
152   -
153   - public String getIndustryCode() {
154   - return industryCode;
155   - }
156   -
157   - public void setIndustryCode(String industryCode) {
158   - this.industryCode = industryCode;
159   - }
160   -
161   - public String getStationMark() {
162   - return stationMark;
163   - }
164   -
165   - public void setStationMark(String stationMark) {
166   - this.stationMark = stationMark;
167   - }
168   -
169   - public Integer getOutStationNmber() {
170   - return outStationNmber;
171   - }
172   -
173   - public void setOutStationNmber(Integer outStationNmber) {
174   - this.outStationNmber = outStationNmber;
175   - }
176   -
177   - public Double getDistances() {
178   - return distances;
179   - }
180   -
181   - public void setDistances(Double distances) {
182   - this.distances = distances;
183   - }
184   -
185   - public Double getToTime() {
186   - return toTime;
187   - }
188   -
189   - public void setToTime(Double toTime) {
190   - this.toTime = toTime;
191   - }
192   -
193   - public String getFirstTime() {
194   - return firstTime;
195   - }
196   -
197   - public void setFirstTime(String firstTime) {
198   - this.firstTime = firstTime;
199   - }
200   -
201   - public String getEndTime() {
202   - return endTime;
203   - }
204   -
205   - public void setEndTime(String endTime) {
206   - this.endTime = endTime;
207   - }
208   -
209   - public Integer getDirections() {
210   - return directions;
211   - }
212   -
213   - public void setDirections(Integer directions) {
214   - this.directions = directions;
215   - }
216   -
217   - public Integer getVersions() {
218   - return versions;
219   - }
220   -
221   - public void setVersions(Integer versions) {
222   - this.versions = versions;
223   - }
224   -
225   - public Integer getDestroy() {
226   - return destroy;
227   - }
228   -
229   - public void setDestroy(Integer destroy) {
230   - this.destroy = destroy;
231   - }
232   -
233   - public String getDescriptions() {
234   - return descriptions;
235   - }
236   -
237   - public void setDescriptions(String descriptions) {
238   - this.descriptions = descriptions;
239   - }
240   -
241   - public Integer getCreateBy() {
242   - return createBy;
243   - }
244   -
245   - public void setCreateBy(Integer createBy) {
246   - this.createBy = createBy;
247   - }
248   -
249   - public Integer getUpdateBy() {
250   - return updateBy;
251   - }
252   -
253   - public void setUpdateBy(Integer updateBy) {
254   - this.updateBy = updateBy;
255   - }
256   -
257   - public Date getCreateDate() {
258   - return createDate;
259   - }
260   -
261   - public void setCreateDate(Date createDate) {
262   - this.createDate = createDate;
263   - }
264   -
265   - public Date getUpdateDate() {
266   - return updateDate;
267   - }
268   -
269   - public void setUpdateDate(Date updateDate) {
270   - this.updateDate = updateDate;
271   - }
272   -
273   - public Station getStation() {
274   - return station;
275   - }
276   -
277   - public void setStation(Station station) {
278   - this.station = station;
279   - }
280   -
281   - public Line getLine() {
282   - return line;
283   - }
284   -
285   - public void setLine(Line line) {
286   - this.line = line;
287   - }
288   -}
289 0 \ No newline at end of file
src/main/java/com/bsth/repository/LineVersionsRepository.java
... ... @@ -101,4 +101,14 @@ public interface LineVersionsRepository extends BaseRepository&lt;LineVersions, Int
101 101 */
102 102 @Query(value = " SELECT lv FROM LineVersions lv where FROM_UNIXTIME(?1) between lv.startDate and lv.endDate")
103 103 public List<LineVersions> findLineVersionsByDate(int timestamp);
  104 +
  105 + /**
  106 + * 保存线路版本更新日志
  107 + * @param lineCode
  108 + * @param versions
  109 + * @param timestamp
  110 + */
  111 + @Modifying
  112 + @Query(value = "INSERT INTO bsth_c_line_versions_enablog(line_code,`line_versions`,`t`) VALUES (?1,?2,?3)", nativeQuery = true)
  113 + void saveEnablelog(String lineCode, int versions, long timestamp);
104 114 }
... ...
src/main/java/com/bsth/repository/LsSectionRouteRepository.java
1   -package com.bsth.repository;
2   -
3   -import java.util.List;
4   -
5   -import org.springframework.data.jpa.repository.Modifying;
6   -import org.springframework.data.jpa.repository.Query;
7   -import org.springframework.stereotype.Repository;
8   -import org.springframework.transaction.annotation.Transactional;
9   -
10   -import com.bsth.entity.Line;
11   -import com.bsth.entity.LsSectionRoute;
12   -import com.bsth.entity.LsStationRoute;
13   -
14   -/**
15   - *
16   - * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
17   - *
18   - * @Extends : BaseRepository
19   - *
20   - * @Description: TODO(路段路由Repository数据持久层接口)
21   - *
22   - * @Author bsth@lq
23   - *
24   - * @Version 公交调度系统BS版 0.1
25   - *
26   - */
27   -
28   -@Repository
29   -public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, Integer> {
30   -
31   - /**
32   - * 查询待更新线路的路段路由
33   - */
34   - @Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0")
35   - public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions);
36   -
37   - @Query(value ="SELECT a.sectionrouteId," +
38   - "a.sectionrouteLine," +
39   - " a.sectionrouteLineCode," +
40   - " a.sectionrouteSection," +
41   - " a.sectionrouteSectionCode," +
42   - " a.sectionrouteCode," +
43   - " a.sectionrouteDirections," +
44   - " b.id AS sectionId," +
45   - " b.section_code AS sectionCode," +
46   - " b.section_name AS sectionName," +
47   - " b.croses_road AS sectionRoad," +
48   - " b.end_node AS sectionEndNode," +
49   - " b.start_node AS sectionStartNode," +
50   - " b.middle_node AS sectionMiddleNode," +
51   - " b.section_type AS sectionType," +
52   - " b.csection_vector AS sectionCsectionVector," +
53   - " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
54   - " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
55   - " b.road_coding AS sectionRoadCoding," +
56   - " b.section_distance AS sectionDistance," +
57   - " b.section_time AS sectionTime," +
58   - " b.db_type AS sectiondbType," +
59   - " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" +
60   - "SELECT r.id AS sectionrouteId," +
61   - "r.line AS sectionrouteLine," +
62   - "r.line_code AS sectionrouteLineCode," +
63   - "r.section AS sectionrouteSection," +
64   - "r.section_code AS sectionrouteSectionCode," +
65   - "r.sectionroute_code AS sectionrouteCode," +
66   - "r.directions AS sectionrouteDirections," +
67   - "r.destroy AS destroy," +
68   - "r.versions AS versions," +
69   - "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" +
70   - " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0 ) a " +
71   - " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true)
72   - List<Object[]> getSectionRoute(int lineId, int directions,int version);
73   -
74   - /**
75   - * @Description :TODO(查询路段信息)
76   - *
77   - * @param map <id:路段路由ID>
78   - *
79   - * @return List<Object[]>
80   - */
81   - @Query(value ="SELECT a.sectionRouteId," +
82   - "a.sectionRouteLineCode," +
83   - "a.sectionRouteCode," +
84   - "a.sectionRouteDirections," +
85   - "a.sectionRouteLine," +
86   - "a.sectionRouteSection," +
87   - "a.sectionRouteDescriptions," +
88   - "a.sectionRouteCreateBy," +
89   - "a.sectionRouteCreateDate," +
90   - "a.sectionRouteUpdateBy," +
91   - "a.sectionRouteUpdateDate," +
92   - "a.sectionRouteVersions," +
93   - "a.sectionRouteDestroy," +
94   - "b.id AS sectionId," +
95   - "b.section_code AS sectionCode," +
96   - "b.section_name AS sectionName," +
97   - "b.road_coding AS sectionRoadCoding," +
98   - "b.end_node AS sectionEndCode," +
99   - "b.start_node AS sectionStartNode," +
100   - "b.middle_node AS sectionMiddleNode," +
101   - "b.section_type AS sectionType," +
102   - "ST_AsText(b.csection_vector) AS sectionCsectionVector," +
103   - "ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
104   - "ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
105   - "b.section_distance AS sectionDistance," +
106   - "b.section_time AS sectionTime," +
107   - "b.db_type AS sectionDbtype," +
108   - "b.speed_limit AS sectionSpeedLimit," +
109   - "b.descriptions AS sectionDescriptions," +
110   - "b.create_by AS sectionCreateBy," +
111   - "b.create_date AS sectionCreateDate," +
112   - "b.update_by AS sectionUpdateBy," +
113   - "b.update_date AS sectionUpdateDate," +
114   - "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" +
115   - " SELECT s.id AS sectionRouteId," +
116   - "s.line_code AS sectionRouteLineCode," +
117   - "s.sectionroute_code AS sectionRouteCode," +
118   - "s.directions AS sectionRouteDirections," +
119   - "s.line AS sectionRouteLine," +
120   - "s.section AS sectionRouteSection," +
121   - "s.descriptions AS sectionRouteDescriptions," +
122   - "s.create_by AS sectionRouteCreateBy," +
123   - "s.create_date AS sectionRouteCreateDate," +
124   - "s.update_by AS sectionRouteUpdateBy," +
125   - "s.update_date AS sectionRouteUpdateDate," +
126   - "s.versions AS sectionRouteVersions," +
127   - "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " +
128   - " FROM bsth_c_ls_sectionroute s where s.id =?1) a " +
129   - " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
130   - List<Object[]> findSectionRouteInfoFormId(int id);
131   - /**
132   - * 更新路线前删除线路版本下历史原有路段路由
133   - */
134   - @Modifying
135   - @Transactional
136   - @Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
137   - public void batchDelete(Integer line, Integer dir, Integer versions);
138   -
139   - /**
140   - * 更新路线前撤销线路版本下历史原有路段路由
141   - */
142   - @Modifying
143   - @Query(value="UPDATE bsth_c_ls_sectionroute set destroy = 1 where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
144   - public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
145   -
146   - @Modifying
147   - @Query(value="UPDATE bsth_c_ls_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
148   - public void sectionUpdSectionRouteCode(String lineCode, Integer directions, Integer sectionrouteCode);
149   -
150   - @Modifying
151   - @Query(value="update bsth_c_ls_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
152   - public void sectionRouteDir(Integer line);
153   -
154   - /**
155   - * @Description :TODO(查询路段信息)
156   - *
157   - * @param map <lineId:线路ID; directions:方向>
158   - *
159   - * @return List<Object[]>
160   - */
161   - @Query(value ="SELECT a.sectionrouteId," +
162   - "a.sectionrouteLine," +
163   - " a.sectionrouteLineCode," +
164   - " a.sectionrouteSection," +
165   - " a.sectionrouteSectionCode," +
166   - " a.sectionrouteCode," +
167   - " a.sectionrouteDirections," +
168   - " b.id AS sectionId," +
169   - " b.section_code AS sectionCode," +
170   - " b.section_name AS sectionName," +
171   - " b.croses_road AS sectionRoad," +
172   - " b.end_node AS sectionEndNode," +
173   - " b.start_node AS sectionStartNode," +
174   - " b.middle_node AS sectionMiddleNode," +
175   - " b.section_type AS sectionType," +
176   - " b.csection_vector AS sectionCsectionVector," +
177   - " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
178   - " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
179   - " b.road_coding AS sectionRoadCoding," +
180   - " b.section_distance AS sectionDistance," +
181   - " b.section_time AS sectionTime," +
182   - " b.db_type AS sectiondbType," +
183   - " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" +
184   - "SELECT r.id AS sectionrouteId," +
185   - "r.line AS sectionrouteLine," +
186   - "r.line_code AS sectionrouteLineCode," +
187   - "r.section AS sectionrouteSection," +
188   - "r.section_code AS sectionrouteSectionCode," +
189   - "r.sectionroute_code AS sectionrouteCode," +
190   - "r.directions AS sectionrouteDirections," +
191   - "r.destroy AS destroy," +
192   - "r.versions AS versions," +
193   - "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" +
194   - " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " +
195   - " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true)
196   - List<Object[]> getSectionRoute(int lineId, int directions);
197   -
198   - // 查询最大ID
199   - @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(sectionroute_code) as num FROM bsth_c_ls_sectionroute where line_code = 601010 and directions = 1 and destroy = 0) k" , nativeQuery=true)
200   - public int sectionRouteCodeMaxId();
201   -
202   -
203   - @Query(value="select * from bsth_c_ls_sectionroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true)
204   - public Iterable<LsSectionRoute> page(int i, int pageSize, int line, int dir, int version);
205   -
206   - @Query(value="select count(*) from bsth_c_ls_sectionroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true)
207   - int count(int line, int dir, int version);
208   -
209   -}
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.Line;
  11 +import com.bsth.entity.LsSectionRoute;
  12 +import com.bsth.entity.LsStationRoute;
  13 +
  14 +/**
  15 + *
  16 + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
  17 + *
  18 + * @Extends : BaseRepository
  19 + *
  20 + * @Description: TODO(路段路由Repository数据持久层接口)
  21 + *
  22 + * @Author bsth@lq
  23 + *
  24 + * @Version 公交调度系统BS版 0.1
  25 + *
  26 + */
  27 +
  28 +@Repository
  29 +public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, Integer> {
  30 +
  31 + /**
  32 + * 批量撤销路段路由
  33 + * @param ids
  34 + */
  35 + @Modifying
  36 + @Query(value = "UPDATE LsSectionRoute lsr set lsr.destroy = 1 where lsr.id in (?1)")
  37 + void batchDestroy(List<Integer> ids);
  38 +
  39 + /**
  40 + * 查询待更新线路的路段路由
  41 + */
  42 + @Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0")
  43 + public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions);
  44 +
  45 + @Query(value ="SELECT a.sectionrouteId," +
  46 + "a.sectionrouteLine," +
  47 + " a.sectionrouteLineCode," +
  48 + " a.sectionrouteSection," +
  49 + " a.sectionrouteSectionCode," +
  50 + " a.sectionrouteCode," +
  51 + " a.sectionrouteDirections," +
  52 + " b.id AS sectionId," +
  53 + " b.section_code AS sectionCode," +
  54 + " b.section_name AS sectionName," +
  55 + " b.croses_road AS sectionRoad," +
  56 + " b.end_node AS sectionEndNode," +
  57 + " b.start_node AS sectionStartNode," +
  58 + " b.middle_node AS sectionMiddleNode," +
  59 + " b.section_type AS sectionType," +
  60 + " b.csection_vector AS sectionCsectionVector," +
  61 + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
  62 + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
  63 + " b.road_coding AS sectionRoadCoding," +
  64 + " b.section_distance AS sectionDistance," +
  65 + " b.section_time AS sectionTime," +
  66 + " b.db_type AS sectiondbType," +
  67 + " b.speed_limit AS sectionSpeedLimit ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" +
  68 + "SELECT r.id AS sectionrouteId," +
  69 + "r.line AS sectionrouteLine," +
  70 + "r.line_code AS sectionrouteLineCode," +
  71 + "r.section AS sectionrouteSection," +
  72 + "r.section_code AS sectionrouteSectionCode," +
  73 + "r.sectionroute_code AS sectionrouteCode," +
  74 + "r.directions AS sectionrouteDirections," +
  75 + "r.destroy AS destroy," +
  76 + "r.versions AS versions," +
  77 + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" +
  78 + " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0 ) a " +
  79 + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true)
  80 + List<Object[]> getSectionRoute(int lineId, int directions,int version);
  81 +
  82 + /**
  83 + * @Description :TODO(查询路段信息)
  84 + *
  85 + * @param map <id:路段路由ID>
  86 + *
  87 + * @return List<Object[]>
  88 + */
  89 + @Query(value ="SELECT a.sectionRouteId," +
  90 + "a.sectionRouteLineCode," +
  91 + "a.sectionRouteCode," +
  92 + "a.sectionRouteDirections," +
  93 + "a.sectionRouteLine," +
  94 + "a.sectionRouteSection," +
  95 + "a.sectionRouteDescriptions," +
  96 + "a.sectionRouteCreateBy," +
  97 + "a.sectionRouteCreateDate," +
  98 + "a.sectionRouteUpdateBy," +
  99 + "a.sectionRouteUpdateDate," +
  100 + "a.sectionRouteVersions," +
  101 + "a.sectionRouteDestroy," +
  102 + "b.id AS sectionId," +
  103 + "b.section_code AS sectionCode," +
  104 + "b.section_name AS sectionName," +
  105 + "b.road_coding AS sectionRoadCoding," +
  106 + "b.end_node AS sectionEndCode," +
  107 + "b.start_node AS sectionStartNode," +
  108 + "b.middle_node AS sectionMiddleNode," +
  109 + "b.section_type AS sectionType," +
  110 + "ST_AsText(b.csection_vector) AS sectionCsectionVector," +
  111 + "ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
  112 + "ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
  113 + "b.section_distance AS sectionDistance," +
  114 + "b.section_time AS sectionTime," +
  115 + "b.db_type AS sectionDbtype," +
  116 + "b.speed_limit AS sectionSpeedLimit," +
  117 + "b.descriptions AS sectionDescriptions," +
  118 + "b.create_by AS sectionCreateBy," +
  119 + "b.create_date AS sectionCreateDate," +
  120 + "b.update_by AS sectionUpdateBy," +
  121 + "b.update_date AS sectionUpdateDate," +
  122 + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" +
  123 + " SELECT s.id AS sectionRouteId," +
  124 + "s.line_code AS sectionRouteLineCode," +
  125 + "s.sectionroute_code AS sectionRouteCode," +
  126 + "s.directions AS sectionRouteDirections," +
  127 + "s.line AS sectionRouteLine," +
  128 + "s.section AS sectionRouteSection," +
  129 + "s.descriptions AS sectionRouteDescriptions," +
  130 + "s.create_by AS sectionRouteCreateBy," +
  131 + "s.create_date AS sectionRouteCreateDate," +
  132 + "s.update_by AS sectionRouteUpdateBy," +
  133 + "s.update_date AS sectionRouteUpdateDate," +
  134 + "s.versions AS sectionRouteVersions," +
  135 + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " +
  136 + " FROM bsth_c_ls_sectionroute s where s.id =?1) a " +
  137 + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
  138 + List<Object[]> findSectionRouteInfoFormId(int id);
  139 + /**
  140 + * 更新路线前删除线路版本下历史原有路段路由
  141 + */
  142 + @Modifying
  143 + @Transactional
  144 + @Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
  145 + public void batchDelete(Integer line, Integer dir, Integer versions);
  146 +
  147 + /**
  148 + * 更新路线前撤销线路版本下历史原有路段路由
  149 + */
  150 + @Modifying
  151 + @Query(value="UPDATE bsth_c_ls_sectionroute set destroy = 1 where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
  152 + public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
  153 +
  154 + @Modifying
  155 + @Query(value="UPDATE bsth_c_ls_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
  156 + public void sectionUpdSectionRouteCode(String lineCode, Integer directions, Integer sectionrouteCode);
  157 +
  158 + @Modifying
  159 + @Query(value="update bsth_c_ls_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
  160 + public void sectionRouteDir(Integer line);
  161 +
  162 + /**
  163 + * @Description :TODO(查询路段信息)
  164 + *
  165 + * @param map <lineId:线路ID; directions:方向>
  166 + *
  167 + * @return List<Object[]>
  168 + */
  169 + @Query(value ="SELECT a.sectionrouteId," +
  170 + "a.sectionrouteLine," +
  171 + " a.sectionrouteLineCode," +
  172 + " a.sectionrouteSection," +
  173 + " a.sectionrouteSectionCode," +
  174 + " a.sectionrouteCode," +
  175 + " a.sectionrouteDirections," +
  176 + " b.id AS sectionId," +
  177 + " b.section_code AS sectionCode," +
  178 + " b.section_name AS sectionName," +
  179 + " b.croses_road AS sectionRoad," +
  180 + " b.end_node AS sectionEndNode," +
  181 + " b.start_node AS sectionStartNode," +
  182 + " b.middle_node AS sectionMiddleNode," +
  183 + " b.section_type AS sectionType," +
  184 + " b.csection_vector AS sectionCsectionVector," +
  185 + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
  186 + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
  187 + " b.road_coding AS sectionRoadCoding," +
  188 + " b.section_distance AS sectionDistance," +
  189 + " b.section_time AS sectionTime," +
  190 + " b.db_type AS sectiondbType," +
  191 + " b.speed_limit AS sectionSpeedLimit ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" +
  192 + "SELECT r.id AS sectionrouteId," +
  193 + "r.line AS sectionrouteLine," +
  194 + "r.line_code AS sectionrouteLineCode," +
  195 + "r.section AS sectionrouteSection," +
  196 + "r.section_code AS sectionrouteSectionCode," +
  197 + "r.sectionroute_code AS sectionrouteCode," +
  198 + "r.directions AS sectionrouteDirections," +
  199 + "r.destroy AS destroy," +
  200 + "r.versions AS versions," +
  201 + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" +
  202 + " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " +
  203 + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true)
  204 + List<Object[]> getSectionRoute(int lineId, int directions);
  205 +
  206 + // 查询最大ID
  207 + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(sectionroute_code) as num FROM bsth_c_ls_sectionroute where line_code = 601010 and directions = 1 and destroy = 0) k" , nativeQuery=true)
  208 + public int sectionRouteCodeMaxId();
  209 +
  210 +
  211 + @Query(value="select * from bsth_c_ls_sectionroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true)
  212 + public Iterable<LsSectionRoute> page(int i, int pageSize, int line, int dir, int version);
  213 +
  214 + @Query(value="select count(*) from bsth_c_ls_sectionroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true)
  215 + int count(int line, int dir, int version);
  216 +
  217 + /**
  218 + * 克隆历史版本变为新版本(版本恢复或近似恢复)
  219 + * @param lineId
  220 + * @param oldVersion
  221 + * @param newVersion
  222 + */
  223 + @Modifying
  224 + @Query(value="insert into bsth_c_ls_sectionroute (line_code,section_code,sectionroute_code,directions,line,section,descriptions,versions,destroy,is_roade_speed) select line_code,section_code,sectionroute_code,directions,line,section,descriptions,?3 as versions,destroy,is_roade_speed from bsth_c_ls_sectionroute where line = ?1 and versions = ?2 and destroy = 0", nativeQuery = true)
  225 + void cloneFromHistoryVersion(Integer lineId, Integer oldVersion, Integer newVersion);
  226 +}
... ...
src/main/java/com/bsth/repository/LsStationRouteRepository.java
... ... @@ -27,139 +27,22 @@ import com.bsth.entity.LsStationRoute;
27 27  
28 28 @Repository
29 29 public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> {
30   -
  30 +
  31 + /**
  32 + * 批量撤销站点路由
  33 + * @param ids
  34 + */
  35 + @Modifying
  36 + @Query(value = "UPDATE LsStationRoute lsr set lsr.destroy = 1 where lsr.id in (?1)")
  37 + void batchDestroy(List<Integer> ids);
  38 +
31 39 /**
32 40 * 查询待更新线路的站点路由
33 41 */
34 42 @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
35 43 @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0")
36 44 List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions);
37   -
38   - @Query(value = "SELECT a.`stationRoute.id`," +
39   - "a.`stationRoute.line`," +
40   - "a.`stationRoute.station`," +
41   - "a.`stationRoute.stationName`," +
42   - "a.`stationRoute.stationRouteCode`," +
43   - "a.`stationRoute.lineCode`," +
44   - "a.`stationRoute.stationMark`," +
45   - "a.`stationRoute.outStationNmber`," +
46   - "a.`stationRoute.directions`," +
47   - "a.`stationRoute.distances`," +
48   - "a.`stationRoute.toTime`," +
49   - "a.`stationRoute.firstTime`," +
50   - "a.`stationRoute.endTime`," +
51   - "a.`stationRoute.descriptions`," +
52   - "a.`stationRoute.versions`," +
53   - "b.id AS 'station.id'," +
54   - "b.station_cod AS 'station.stationCod'," +
55   - "b.station_name AS 'station.stationName'," +
56   - "b.road_coding AS 'station.roadCoding'," +
57   - "b.db_type AS 'station.dbType'," +
58   - "b.b_jwpoints AS 'station.bJwpoints'," +
59   - "b.g_lonx AS 'station.gLonx'," +
60   - "b.g_lonx AS 'station.gLaty'," +
61   - "b.x AS 'station.x'," +
62   - "b.y AS 'station.y'," +
63   - "b.shapes_type AS 'station.shapesType'," +
64   - "b.radius AS 'station.radius'," +
65   - "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," +
66   - "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," +
67   - "b.destroy AS 'station.destroy'," +
68   - "b.versions AS 'station.versions'," +
69   - "b.descriptions AS 'station.descriptions', " +
70   - "a.`stationRoute.industryCode`, " +
71   - "a.`stationRoute.stationNameEn` " +
72   - " FROM (" +
73   - "SELECT r.id AS 'stationRoute.id'," +
74   - " r.line AS 'stationRoute.line'," +
75   - "r.station AS 'stationRoute.station'," +
76   - "r.station_name AS 'stationRoute.stationName'," +
77   - "r.station_name_en AS 'stationRoute.stationNameEn'," +
78   - "r.station_route_code as 'stationRoute.stationRouteCode'," +
79   - "r.line_code AS 'stationRoute.lineCode'," +
80   - "r.station_mark AS 'stationRoute.stationMark'," +
81   - "r.out_station_nmber AS 'stationRoute.outStationNmber'," +
82   - "r.directions AS 'stationRoute.directions'," +
83   - "r.distances AS 'stationRoute.distances'," +
84   - "r.to_time AS 'stationRoute.toTime'," +
85   - "r.first_time AS 'stationRoute.firstTime'," +
86   - "r.end_time AS 'stationRoute.endTime'," +
87   - "r.descriptions AS 'stationRoute.descriptions'," +
88   - "r.versions AS 'stationRoute.versions', " +
89   - "r.industry_code AS 'stationRoute.industryCode' " +
90   - " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " +
91   - "LEFT JOIN bsth_c_station b " +
92   - "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true)
93   - List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions);
94 45  
95   -
96   - @Query(value = "SELECT a.stationRouteLine," +
97   - " a.stationRouteStation," +
98   - " a.stationRouteCode," +
99   - " a.stationRouteLIneCode," +
100   - " a.stationRouteStationMark," +
101   - " a.stationOutStationNmber," +
102   - " a.stationRoutedirections," +
103   - " a.stationRouteDistances," +
104   - " a.stationRouteToTime," +
105   - " a.staitonRouteFirstTime," +
106   - " a.stationRouteEndTime," +
107   - " a.stationRouteDescriptions," +
108   - " a.stationRouteDestroy," +
109   - " a.stationRouteVersions," +
110   - " a.stationRouteCreateBy," +
111   - " a.stationRouteCreateDate," +
112   - " a.stationRouteUpdateBy," +
113   - " a.stationRouteUpdateDate," +
114   - " b.id AS stationId," +
115   - " b.station_cod AS stationCode," +
116   - " a.stationRouteName," +
117   - " b.road_coding AS stationRoadCoding," +
118   - " b.db_type AS stationDbType," +
119   - " b.b_jwpoints AS stationJwpoints," +
120   - " b.g_lonx AS stationGlonx," +
121   - " b.g_laty AS stationGlaty," +
122   - " b.x AS stationX," +
123   - " b.y AS stationY," +
124   - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
125   - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
126   - " b.destroy AS stationDestroy," +
127   - " b.radius AS stationRadius," +
128   - " b.shapes_type AS stationShapesType," +
129   - " b.versions AS stationVersions," +
130   - " b.descriptions AS sttationDescriptions," +
131   - " b.create_by AS stationCreateBy," +
132   - " b.create_date AS stationCreateDate," +
133   - " b.update_by AS stationUpdateBy," +
134   - " b.update_date AS stationUpdateDate," +
135   - " a.stationRouteId," +
136   - "b.station_name as zdmc, "+
137   - "a.industryCode, "+
138   - "a.stationNameEn "+
139   - " FROM ( SELECT s.id AS stationRouteId," +
140   - " s.line AS stationRouteLine," +
141   - " s.station as stationRouteStation," +
142   - " s.station_name AS stationRouteName," +
143   - " s.station_name_en AS stationNameEn," +
144   - " s.station_route_code as stationRouteCode," +
145   - " s.industry_code as industryCode," +
146   - " s.line_code AS stationRouteLIneCode," +
147   - " s.station_mark AS stationRouteStationMark," +
148   - " s.out_station_nmber AS stationOutStationNmber," +
149   - " s.directions AS stationRoutedirections," +
150   - " s.distances AS stationRouteDistances," +
151   - " s.to_time AS stationRouteToTime," +
152   - " s.first_time AS staitonRouteFirstTime," +
153   - " s.end_time AS stationRouteEndTime," +
154   - " s.descriptions AS stationRouteDescriptions," +
155   - " s.destroy AS stationRouteDestroy," +
156   - " s.versions AS stationRouteVersions," +
157   - " s.create_by AS stationRouteCreateBy," +
158   - " s.create_date AS stationRouteCreateDate," +
159   - " s.update_by AS stationRouteUpdateBy," +
160   - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " +
161   - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true)
162   - List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version);
163 46 /**
164 47 * 更新路线前删除线路版本号历史原有站点路由
165 48 *
... ... @@ -197,89 +80,47 @@ public interface LsStationRouteRepository extends BaseRepository&lt;LsStationRoute,
197 80 "ORDER BY " +
198 81 "lineCode,directions,stationRouteCode")
199 82 List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion);
200   - /**
201   - * @Description : TODO(根据站点路由Id查询详情)
202   - *
203   - * @param id:站点路由ID
204   - *
205   - * @return List<Object[]>
206   - */
207   - @Query(value = "SELECT a.stationRouteLine," +
208   - " a.stationRouteStation," +
209   - " a.stationRouteCode," +
210   - " a.stationRouteLIneCode," +
211   - " a.stationRouteStationMark," +
212   - " a.stationOutStationNmber," +
213   - " a.stationRoutedirections," +
214   - " a.stationRouteDistances," +
215   - " a.stationRouteToTime," +
216   - " a.staitonRouteFirstTime," +
217   - " a.stationRouteEndTime," +
218   - " a.stationRouteDescriptions," +
219   - " a.stationRouteDestroy," +
220   - " a.stationRouteVersions," +
221   - " a.stationRouteCreateBy," +
222   - " a.stationRouteCreateDate," +
223   - " a.stationRouteUpdateBy," +
224   - " a.stationRouteUpdateDate," +
225   - " b.id AS stationId," +
226   - " b.station_cod AS stationCode," +
227   - " a.stationRouteName," +
228   - " b.road_coding AS stationRoadCoding," +
229   - " b.db_type AS stationDbType," +
230   - " b.b_jwpoints AS stationJwpoints," +
231   - " b.g_lonx AS stationGlonx," +
232   - " b.g_laty AS stationGlaty," +
233   - " b.x AS stationX," +
234   - " b.y AS stationY," +
235   - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
236   - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
237   - " b.destroy AS stationDestroy," +
238   - " b.radius AS stationRadius," +
239   - " b.shapes_type AS stationShapesType," +
240   - " b.versions AS stationVersions," +
241   - " b.descriptions AS sttationDescriptions," +
242   - " b.create_by AS stationCreateBy," +
243   - " b.create_date AS stationCreateDate," +
244   - " b.update_by AS stationUpdateBy," +
245   - " b.update_date AS stationUpdateDate," +
246   - " a.stationRouteId,b.station_name as zdmc, " +
247   - " a.industryCode, "+
248   - " a.stationNameEn "+
249   - " FROM " +
250   - "( SELECT s.id AS stationRouteId," +
251   - " s.line AS stationRouteLine," +
252   - " s.station as stationRouteStation," +
253   - " s.station_name AS stationRouteName," +
254   - " s.station_name_en AS stationNameEn," +
255   - " s.station_route_code as stationRouteCode," +
256   - " s.industry_code as industryCode," +
257   - " s.line_code AS stationRouteLIneCode," +
258   - " s.station_mark AS stationRouteStationMark," +
259   - " s.out_station_nmber AS stationOutStationNmber," +
260   - " s.directions AS stationRoutedirections," +
261   - " s.distances AS stationRouteDistances," +
262   - " s.to_time AS stationRouteToTime," +
263   - " s.first_time AS staitonRouteFirstTime," +
264   - " s.end_time AS stationRouteEndTime," +
265   - " s.descriptions AS stationRouteDescriptions," +
266   - " s.destroy AS stationRouteDestroy," +
267   - " s.versions AS stationRouteVersions," +
268   - " s.create_by AS stationRouteCreateBy," +
269   - " s.create_date AS stationRouteCreateDate," +
270   - " s.update_by AS stationRouteUpdateBy," +
271   - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " +
272   - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
273   - List<Object[]> findStationRouteInfo(Integer id);
274 83  
275 84 // 批量修改站点行业编码
276 85 @Modifying
277 86 @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true)
278 87 void updIndustryCode(Integer id, String industryCode);
279   -
280   - @Modifying
281   - @Query(value="UPDATE bsth_c_ls_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true)
282   - void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod);
  88 +
  89 + /**
  90 + * 将对应线路、版本、方向、未撤销的站点路由中
  91 + * 最小路由编号的路由改为'B'站点标记
  92 + * @param lsStationRoute
  93 + */
  94 + @Modifying
  95 + @Query(value="update bsth_c_ls_stationroute a join (select min(station_route_code) station_route_code from bsth_c_ls_stationroute where line = :#{#lsStationRoute.line.id} AND destroy = 0 AND versions = :#{#lsStationRoute.versions} AND directions = :#{#lsStationRoute.directions}) b ON a.station_route_code = b.station_route_code set a.station_mark = 'B' where line = :#{#lsStationRoute.line.id} AND destroy = 0 AND versions = :#{#lsStationRoute.versions} AND directions = :#{#lsStationRoute.directions}", nativeQuery=true)
  96 + void updateStartB(LsStationRoute lsStationRoute);
  97 +
  98 + /**
  99 + * 将对应线路、版本、方向、未撤销的站点路由中
  100 + * 路由编号的路由改为'Z'站点标记
  101 + * @param lsStationRoute
  102 + */
  103 + @Modifying
  104 + @Query(value="update bsth_c_ls_stationroute a set a.station_mark = 'Z' where line = :#{#lsStationRoute.line.id} AND destroy = 0 AND versions = :#{#lsStationRoute.versions} AND directions = :#{#lsStationRoute.directions}", nativeQuery=true)
  105 + void updateStartZ(LsStationRoute lsStationRoute);
  106 +
  107 + /**
  108 + * 将对应线路、版本、方向、未撤销的站点路由中
  109 + * 最大路由编号的路由改为'E'站点标记
  110 + * @param lsStationRoute
  111 + */
  112 + @Modifying(flushAutomatically = true)
  113 + @Query(value="update bsth_c_ls_stationroute a join (select max(station_route_code) station_route_code from bsth_c_ls_stationroute where line = :#{#lsStationRoute.line.id} AND destroy = 0 AND versions = :#{#lsStationRoute.versions} AND directions = :#{#lsStationRoute.directions}) b ON a.station_route_code = b.station_route_code set a.station_mark = 'E' where line = :#{#lsStationRoute.line.id} AND destroy = 0 AND versions = :#{#lsStationRoute.versions} AND directions = :#{#lsStationRoute.directions}", nativeQuery=true)
  114 + void updateStartE(LsStationRoute lsStationRoute);
  115 +
  116 + /**
  117 + * 在站点路由更新时(站点路由可能改变路由编号,如起点、改变上一站点)
  118 + * 将当前路由编号及以后的编号批量递增10
  119 + * @param lsStationRoute
  120 + */
  121 + @Modifying
  122 + @Query(value="UPDATE bsth_c_ls_stationroute set station_route_code = (station_route_code + 10) where line = :#{#lsStationRoute.line.id} and destroy = 0 and versions = :#{#lsStationRoute.versions} and directions = :#{#lsStationRoute.directions} and station_route_code >= :#{#lsStationRoute.stationRouteCode}", nativeQuery=true)
  123 + void updateStatiouRouteCode(LsStationRoute lsStationRoute);
283 124  
284 125 @Modifying
285 126 @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true)
... ... @@ -310,4 +151,14 @@ public interface LsStationRouteRepository extends BaseRepository&lt;LsStationRoute,
310 151  
311 152 @Query("select r from LsStationRoute r where r.line.id=?1 and r.versions=?2 and r.directions=?3 and r.destroy=0 order by r.stationRouteCode")
312 153 List<LsStationRoute> findByLineVersion(int lineId, int version, int dir);
  154 +
  155 + /**
  156 + * 克隆历史版本变为新版本(版本恢复或近似恢复)
  157 + * @param lineId
  158 + * @param oldVersion
  159 + * @param newVersion
  160 + */
  161 + @Modifying
  162 + @Query(value="insert into bsth_c_ls_stationroute (line,station,station_name,station_route_code,line_code,station_code,station_mark,out_station_nmber,directions,distances,to_time,first_time,end_time,descriptions,destroy,versions,industry_code,station_name_en,shaped_type,radius,buffer_polygon,buffer_polygon_wgs) select line,station,station_name,station_route_code,line_code,station_code,station_mark,out_station_nmber,directions,distances,to_time,first_time,end_time,descriptions,destroy,?3 as versions,industry_code,station_name_en,shaped_type,radius,buffer_polygon,buffer_polygon_wgs from bsth_c_ls_stationroute where line = ?1 and versions = ?2 and destroy = 0", nativeQuery = true)
  163 + void cloneFromHistoryVersion(Integer lineId, Integer oldVersion, Integer newVersion);
313 164 }
... ...
src/main/java/com/bsth/repository/SectionRepository.java
1   -package com.bsth.repository;
2   -
3   -import org.springframework.data.jpa.repository.Modifying;
4   -import org.springframework.data.jpa.repository.Query;
5   -import org.springframework.stereotype.Repository;
6   -import org.springframework.transaction.annotation.Transactional;
7   -
8   -import com.bsth.entity.Section;
9   -
10   -import java.util.List;
11   -
12   -/**
13   - *
14   - * @Interface: SectionRepository(路段Repository数据持久层接口)
15   - *
16   - * @Extends : BaseRepository
17   - *
18   - * @Description: TODO(路段Repository数据持久层接口)
19   - *
20   - * @Author bsth@lq
21   - *
22   - * @Date 2016年05月03日 上午9:21:17
23   - *
24   - * @Version 公交调度系统BS版 0.1
25   - *
26   - */
27   -
28   -@Repository
29   -public interface SectionRepository extends BaseRepository<Section, Integer> {
30   -
31   - // 查询最大ID
32   - @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k"
33   - , nativeQuery=true)
34   - public long sectionMaxId();
35   -
36   -
37   - /**
38   - * @Description :TODO(系统规划路段保存)
39   - *
40   - * @param map <sectionCode: 路段编码;sectionName:路段名称;crosesRoad:交叉路;endNode:终止节点;startNode:起始节点;
41   - *
42   - * middleNode:线路ID;gsectionVector:路段矢量(空间坐标点集合)WGS坐标点;bsectionVector:路段矢量(空间坐标点集合)--百度原始坐标坐标点;
43   - *
44   - * sectionType:路段类型 ;csectionVector:路段矢量(空间坐标点集合)--城建坐标点;roadCoding:路段编码;sectionDistance:路段距离;
45   - *
46   - * sectionTime:路段时间;dbType: 经纬坐标类型;speedLimit:限速;descriptions:描述;versions:版本号>
47   - */
48   - @Transactional
49   - @Modifying
50   - @Query(value="INSERT INTO bsth_c_section "+
51   -
52   - "(section_code , section_name , croses_road , end_node, start_node ,"+
53   -
54   - "middle_node , gsection_vector, bsection_vector , section_type , csection_vector,"+
55   -
56   - "road_coding , section_distance , section_time , db_type, speed_limit ,"+
57   -
58   - "descriptions , versions,id) "+
59   -
60   - "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
61   -
62   - "?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+
63   -
64   - "?11 , ?12 , ?13 , ?14 , ?15 ,"+
65   -
66   - "?16 , ?17, ?18"+
67   - ")", nativeQuery=true)
68   - public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode,
69   -
70   - String middleNode,String gsectionVector,String bsectionVector, String sectionType,String csectionVector,
71   -
72   - String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit,
73   -
74   - String descriptions, int versions,int id);
75   -
76   -
77   - @Transactional
78   - @Modifying
79   - @Query(value="insert into bsth_c_section(" +
80   - "id," +
81   - "section_code," +
82   - "section_name," +
83   - "croses_road," +
84   - "end_node," +
85   - "start_node," +
86   - "middle_node," +
87   - "section_type," +
88   - "csection_vector," +
89   - "bsection_vector," +
90   - "gsection_vector," +
91   - "road_coding," +
92   - "section_distance," +
93   - "section_time," +
94   - "db_type," +
95   - "speed_limit," +
96   - "descriptions," +
97   - "create_by," +
98   - "create_date," +
99   - "update_by," +
100   - "update_date," +
101   - "versions)" +
102   - "(select" +
103   - " ?2," +
104   - " ?2," +
105   - "section_name," +
106   - "croses_road," +
107   - "end_node," +
108   - "start_node," +
109   - "middle_node," +
110   - "section_type," +
111   - "csection_vector," +
112   - "bsection_vector," +
113   - "gsection_vector," +
114   - "road_coding," +
115   - "section_distance," +
116   - "section_time," +
117   - "db_type," +
118   - "speed_limit," +
119   - "descriptions," +
120   - "create_by," +
121   - "create_date," +
122   - "update_by," +
123   - "update_date," +
124   - "?1" +
125   - " from bsth_c_section where id = ?3)", nativeQuery=true)
126   - public void autoCopy(int versions,int id,int s_id);
127   -
128   -
129   - /**
130   - * @Description :TODO(编辑线路走向)
131   - *
132   - * @param map <sectionId:路段ID; gsectionVector:折线WGS坐标;bsectionVector:折线百度坐标>
133   - *
134   - * @return Map<String, Object> <SUCCESS ; ERROR>
135   - */
136   - @Transactional
137   - @Modifying
138   - @Query(value="UPDATE bsth_c_section SET " +
139   - " gsection_vector = ST_GeomFromText(?2) , " +
140   - " bsection_vector = ST_GeomFromText(?3)," +
141   - " section_code = ?4," +
142   - " section_name = ?5," +
143   - " croses_road = ?6," +
144   - " end_node = ?7," +
145   - " start_node = ?8," +
146   - " middle_node = ?9," +
147   - " section_type = ?10," +
148   - " road_coding = ?11," +
149   - " section_distance = ?12," +
150   - " section_time = ?13," +
151   - " db_type = ?14," +
152   - " speed_limit = ?15," +
153   - " descriptions = ?16," +
154   - " versions = ?17," +
155   - " create_by = ?18," +
156   - " create_date = str_to_date(?19,'%Y-%m-%d %H:%i:%s')," +
157   - " update_by = ?20," +
158   - " update_date = str_to_date(?21,'%Y-%m-%d %H:%i:%s')" +
159   - " WHERE id = ?1", nativeQuery=true)
160   - public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector,String sectionCode,String sectionName,
161   -
162   - String crosesRoad,String endNode,String startNode,String middleNode,String sectionType,
163   -
164   - String roadCoding,Double sectionDistance,Double sectionTime,String dbType,
165   -
166   - Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate,
167   -
168   - Integer updateBy,String updateDate);
169   -
170   - @Query(value = "SELECT AsText(s.bsection_vector) as section,r.directions as dir FROM bsth_c_section s left join bsth_c_sectionroute r on s.section_code = r.section_code " +
171   - "where r.line = ?1 and directions = ?2 ORDER BY r.directions,r.sectionroute_code ",nativeQuery = true)
172   - List<Object[]> getSectionDirByLineId(Integer lineId , Integer directions);
173   -}
  1 +package com.bsth.repository;
  2 +
  3 +import org.springframework.data.jpa.repository.Modifying;
  4 +import org.springframework.data.jpa.repository.Query;
  5 +import org.springframework.stereotype.Repository;
  6 +import org.springframework.transaction.annotation.Transactional;
  7 +
  8 +import com.bsth.entity.Section;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + *
  14 + * @Interface: SectionRepository(路段Repository数据持久层接口)
  15 + *
  16 + * @Extends : BaseRepository
  17 + *
  18 + * @Description: TODO(路段Repository数据持久层接口)
  19 + *
  20 + * @Author bsth@lq
  21 + *
  22 + * @Date 2016年05月03日 上午9:21:17
  23 + *
  24 + * @Version 公交调度系统BS版 0.1
  25 + *
  26 + */
  27 +
  28 +@Repository
  29 +public interface SectionRepository extends BaseRepository<Section, Integer> {
  30 +
  31 + /**
  32 + * 查询路段最大ID
  33 + * @return 最大ID值
  34 + */
  35 + @Query(value = "SELECT IFNULL(MAX(id), 0) FROM bsth_c_section", nativeQuery = true)
  36 + int sectionMaxId();
  37 +
  38 +
  39 + /**
  40 + * @Description :TODO(系统规划路段保存)
  41 + *
  42 + * @param map <sectionCode: 路段编码;sectionName:路段名称;crosesRoad:交叉路;endNode:终止节点;startNode:起始节点;
  43 + *
  44 + * middleNode:线路ID;gsectionVector:路段矢量(空间坐标点集合)WGS坐标点;bsectionVector:路段矢量(空间坐标点集合)--百度原始坐标坐标点;
  45 + *
  46 + * sectionType:路段类型 ;csectionVector:路段矢量(空间坐标点集合)--城建坐标点;roadCoding:路段编码;sectionDistance:路段距离;
  47 + *
  48 + * sectionTime:路段时间;dbType: 经纬坐标类型;speedLimit:限速;descriptions:描述;versions:版本号>
  49 + */
  50 + @Transactional
  51 + @Modifying
  52 + @Query(value="INSERT INTO bsth_c_section "+
  53 +
  54 + "(section_code , section_name , croses_road , end_node, start_node ,"+
  55 +
  56 + "middle_node , gsection_vector, bsection_vector , section_type , csection_vector,"+
  57 +
  58 + "road_coding , section_distance , section_time , db_type, speed_limit ,"+
  59 +
  60 + "descriptions , versions,id) "+
  61 +
  62 + "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
  63 +
  64 + "?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+
  65 +
  66 + "?11 , ?12 , ?13 , ?14 , ?15 ,"+
  67 +
  68 + "?16 , ?17, ?18"+
  69 + ")", nativeQuery=true)
  70 + public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode,
  71 +
  72 + String middleNode,String gsectionVector,String bsectionVector, String sectionType,String csectionVector,
  73 +
  74 + String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit,
  75 +
  76 + String descriptions, int versions,int id);
  77 +
  78 +
  79 + @Transactional
  80 + @Modifying
  81 + @Query(value="insert into bsth_c_section(" +
  82 + "id," +
  83 + "section_code," +
  84 + "section_name," +
  85 + "croses_road," +
  86 + "end_node," +
  87 + "start_node," +
  88 + "middle_node," +
  89 + "section_type," +
  90 + "csection_vector," +
  91 + "bsection_vector," +
  92 + "gsection_vector," +
  93 + "road_coding," +
  94 + "section_distance," +
  95 + "section_time," +
  96 + "db_type," +
  97 + "speed_limit," +
  98 + "descriptions," +
  99 + "create_by," +
  100 + "create_date," +
  101 + "update_by," +
  102 + "update_date," +
  103 + "versions)" +
  104 + "(select" +
  105 + " ?2," +
  106 + " ?2," +
  107 + "section_name," +
  108 + "croses_road," +
  109 + "end_node," +
  110 + "start_node," +
  111 + "middle_node," +
  112 + "section_type," +
  113 + "csection_vector," +
  114 + "bsection_vector," +
  115 + "gsection_vector," +
  116 + "road_coding," +
  117 + "section_distance," +
  118 + "section_time," +
  119 + "db_type," +
  120 + "speed_limit," +
  121 + "descriptions," +
  122 + "create_by," +
  123 + "create_date," +
  124 + "update_by," +
  125 + "update_date," +
  126 + "?1" +
  127 + " from bsth_c_section where id = ?3)", nativeQuery=true)
  128 + public void autoCopy(int versions,int id,int s_id);
  129 +
  130 +
  131 + /**
  132 + * @Description :TODO(编辑线路走向)
  133 + *
  134 + * @param map <sectionId:路段ID; gsectionVector:折线WGS坐标;bsectionVector:折线百度坐标>
  135 + *
  136 + * @return Map<String, Object> <SUCCESS ; ERROR>
  137 + */
  138 + @Transactional
  139 + @Modifying
  140 + @Query(value="UPDATE bsth_c_section SET " +
  141 + " gsection_vector = ST_GeomFromText(?2) , " +
  142 + " bsection_vector = ST_GeomFromText(?3)," +
  143 + " section_code = ?4," +
  144 + " section_name = ?5," +
  145 + " croses_road = ?6," +
  146 + " end_node = ?7," +
  147 + " start_node = ?8," +
  148 + " middle_node = ?9," +
  149 + " section_type = ?10," +
  150 + " road_coding = ?11," +
  151 + " section_distance = ?12," +
  152 + " section_time = ?13," +
  153 + " db_type = ?14," +
  154 + " speed_limit = ?15," +
  155 + " descriptions = ?16," +
  156 + " versions = ?17," +
  157 + " create_by = ?18," +
  158 + " create_date = str_to_date(?19,'%Y-%m-%d %H:%i:%s')," +
  159 + " update_by = ?20," +
  160 + " update_date = str_to_date(?21,'%Y-%m-%d %H:%i:%s')" +
  161 + " WHERE id = ?1", nativeQuery=true)
  162 + public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector,String sectionCode,String sectionName,
  163 +
  164 + String crosesRoad,String endNode,String startNode,String middleNode,String sectionType,
  165 +
  166 + String roadCoding,Double sectionDistance,Double sectionTime,String dbType,
  167 +
  168 + Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate,
  169 +
  170 + Integer updateBy,String updateDate);
  171 +
  172 + @Query(value = "SELECT AsText(s.bsection_vector) as section,r.directions as dir FROM bsth_c_section s left join bsth_c_sectionroute r on s.section_code = r.section_code " +
  173 + "where r.line = ?1 and directions = ?2 ORDER BY r.directions,r.sectionroute_code ",nativeQuery = true)
  174 + List<Object[]> getSectionDirByLineId(Integer lineId , Integer directions);
  175 +}
... ...
src/main/java/com/bsth/repository/SectionRouteCacheRepository.java deleted 100644 → 0
1   -package com.bsth.repository;
2   -
3   -import java.util.List;
4   -
5   -import org.springframework.data.jpa.repository.Modifying;
6   -import org.springframework.data.jpa.repository.Query;
7   -import org.springframework.stereotype.Repository;
8   -
9   -import com.bsth.entity.SectionRouteCache;
10   -
11   -/**
12   - *
13   - * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
14   - *
15   - * @Extends : BaseRepository
16   - *
17   - * @Description: TODO(路段路由Repository数据持久层接口)
18   - *
19   - * @Author bsth@lq
20   - *
21   - * @Date 2016年05月03日 上午9:21:17
22   - *
23   - * @Version 公交调度系统BS版 0.1
24   - *
25   - */
26   -
27   -@Repository
28   -public interface SectionRouteCacheRepository extends BaseRepository<SectionRouteCache, Integer> {
29   -
30   - /**
31   - * @Description :TODO(查询路段信息)
32   - *
33   - * @param map <lineId:线路ID; directions:方向>
34   - *
35   - * @return List<Object[]>
36   - */
37   - @Query(value ="SELECT a.sectionrouteId," +
38   - "a.sectionrouteLine," +
39   - " a.sectionrouteLineCode," +
40   - " a.sectionrouteSection," +
41   - " a.sectionrouteSectionCode," +
42   - " a.sectionrouteCode," +
43   - " a.sectionrouteDirections," +
44   - " b.id AS sectionId," +
45   - " b.section_code AS sectionCode," +
46   - " b.section_name AS sectionName," +
47   - " b.croses_road AS sectionRoad," +
48   - " b.end_node AS sectionEndNode," +
49   - " b.start_node AS sectionStartNode," +
50   - " b.middle_node AS sectionMiddleNode," +
51   - " b.section_type AS sectionType," +
52   - " b.csection_vector AS sectionCsectionVector," +
53   - " ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
54   - " ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
55   - " b.road_coding AS sectionRoadCoding," +
56   - " b.section_distance AS sectionDistance," +
57   - " b.section_time AS sectionTime," +
58   - " b.db_type AS sectiondbType," +
59   - " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" +
60   - "SELECT r.id AS sectionrouteId," +
61   - "r.line AS sectionrouteLine," +
62   - "r.line_code AS sectionrouteLineCode," +
63   - "r.section AS sectionrouteSection," +
64   - "r.section_code AS sectionrouteSectionCode," +
65   - "r.sectionroute_code AS sectionrouteCode," +
66   - "r.directions AS sectionrouteDirections," +
67   - "r.destroy AS destroy," +
68   - "r.versions AS versions," +
69   - "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" +
70   - " FROM bsth_c_sectionroute_cache r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " +
71   - " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true)
72   - List<Object[]> getSectionRouteCache(int lineId, int directions);
73   -
74   -
75   - /**
76   - * @Description :TODO(查询路段信息)
77   - *
78   - * @param map <id:路段路由ID>
79   - *
80   - * @return List<Object[]>
81   - */
82   - @Query(value ="SELECT a.sectionRouteId," +
83   - "a.sectionRouteLineCode," +
84   - "a.sectionRouteCode," +
85   - "a.sectionRouteDirections," +
86   - "a.sectionRouteLine," +
87   - "a.sectionRouteSection," +
88   - "a.sectionRouteDescriptions," +
89   - "a.sectionRouteCreateBy," +
90   - "a.sectionRouteCreateDate," +
91   - "a.sectionRouteUpdateBy," +
92   - "a.sectionRouteUpdateDate," +
93   - "a.sectionRouteVersions," +
94   - "a.sectionRouteDestroy," +
95   - "b.id AS sectionId," +
96   - "b.section_code AS sectionCode," +
97   - "b.section_name AS sectionName," +
98   - "b.road_coding AS sectionRoadCoding," +
99   - "b.end_node AS sectionEndCode," +
100   - "b.start_node AS sectionStartNode," +
101   - "b.middle_node AS sectionMiddleNode," +
102   - "b.section_type AS sectionType," +
103   - "ST_AsText(b.csection_vector) AS sectionCsectionVector," +
104   - "ST_AsText(b.bsection_vector) AS sectionBsectionVector," +
105   - "ST_AsText(b.gsection_vector) AS sectionGsectionVector," +
106   - "b.section_distance AS sectionDistance," +
107   - "b.section_time AS sectionTime," +
108   - "b.db_type AS sectionDbtype," +
109   - "b.speed_limit AS sectionSpeedLimit," +
110   - "b.descriptions AS sectionDescriptions," +
111   - "b.create_by AS sectionCreateBy," +
112   - "b.create_date AS sectionCreateDate," +
113   - "b.update_by AS sectionUpdateBy," +
114   - "b.update_date AS sectionUpdateDate," +
115   - "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" +
116   - " SELECT s.id AS sectionRouteId," +
117   - "s.line_code AS sectionRouteLineCode," +
118   - "s.sectionroute_code AS sectionRouteCode," +
119   - "s.directions AS sectionRouteDirections," +
120   - "s.line AS sectionRouteLine," +
121   - "s.section AS sectionRouteSection," +
122   - "s.descriptions AS sectionRouteDescriptions," +
123   - "s.create_by AS sectionRouteCreateBy," +
124   - "s.create_date AS sectionRouteCreateDate," +
125   - "s.update_by AS sectionRouteUpdateBy," +
126   - "s.update_date AS sectionRouteUpdateDate," +
127   - "s.versions AS sectionRouteVersions," +
128   - "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " +
129   - " FROM bsth_c_sectionroute s where s.id =?1) a " +
130   - " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
131   - List<Object[]> findSectionRouteInfoFormId(int id);
132   -
133   - /**
134   - * 更新路线删除线路缓存路段
135   - *
136   - * @param line
137   - * @param dir
138   - */
139   - @Modifying
140   - @Query(value="delete from bsth_c_sectionroute_cache where line_code = ?1 and directions = ?2", nativeQuery=true)
141   - public void sectionRouteCacheDel(String lineCode,Integer dir);
142   -
143   - @Modifying
144   - @Query(value="delete from bsth_c_sectionroute_cache where line = ?1 and directions = ?2", nativeQuery=true)
145   - public void sectionRouteCacheDel(Integer lineId,Integer dir);
146   -
147   - /**
148   - * @Description :TODO(查询线路某方向下的上一个路段序号)
149   - *
150   - * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码>
151   - *
152   - * @return List<Map<String, Object>>
153   - */
154   - @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute_cache r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3 and r.destroy = 0", nativeQuery=true)
155   - List<Object[]> findCacheUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
156   -}
157 0 \ No newline at end of file