Commit 8f5618c66cb9338521278e37b90beab511c829d3

Authored by 潘钊
2 parents 5a34d353 7c74f45f

合并浦东分支 0124

Showing 82 changed files with 2726 additions and 428 deletions

Too many changes to show.

To preserve performance only 82 of 292 files are displayed.

src/main/java/com/bsth/XDApplication.java
1 package com.bsth; 1 package com.bsth;
2 2
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
4 -import com.bsth.data.LineVersionsData;  
5 import com.bsth.data.ThreadMonotor; 4 import com.bsth.data.ThreadMonotor;
6 import com.bsth.data.car_out_info.UpdateDBThread; 5 import com.bsth.data.car_out_info.UpdateDBThread;
7 import com.bsth.data.directive.DirectivesPstThread; 6 import com.bsth.data.directive.DirectivesPstThread;
8 import com.bsth.data.forecast.SampleTimeDataLoader; 7 import com.bsth.data.forecast.SampleTimeDataLoader;
9 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; 8 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
10 import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; 9 import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread;
  10 +import com.bsth.data.line_version.thread.FixedEnableVerionsThread;
11 import com.bsth.data.msg_queue.DirectivePushQueue; 11 import com.bsth.data.msg_queue.DirectivePushQueue;
12 import com.bsth.data.msg_queue.WebSocketPushQueue; 12 import com.bsth.data.msg_queue.WebSocketPushQueue;
  13 +import com.bsth.data.safe_driv.SafeDrivDataLoadThread;
13 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
14 import com.bsth.data.schedule.auto_exec.AutoExecScanThread; 15 import com.bsth.data.schedule.auto_exec.AutoExecScanThread;
15 import com.bsth.data.schedule.edit_logs.SeiPstThread; 16 import com.bsth.data.schedule.edit_logs.SeiPstThread;
@@ -72,8 +73,14 @@ public class XDApplication implements CommandLineRunner { @@ -72,8 +73,14 @@ public class XDApplication implements CommandLineRunner {
72 @Autowired 73 @Autowired
73 OfflineMonitorThread offlineMonitorThread; 74 OfflineMonitorThread offlineMonitorThread;
74 75
  76 + //@Autowired
  77 + //LineVersionsData lineVersionsData;
  78 +
  79 + @Autowired
  80 + FixedEnableVerionsThread fixedEnableVerionsThread;
  81 +
75 @Autowired 82 @Autowired
76 - LineVersionsData lineVersionsData; 83 + SafeDrivDataLoadThread safeDrivDataLoadThread;
77 84
78 private static long timeDiff; 85 private static long timeDiff;
79 private static long timeDiffTraffic; 86 private static long timeDiffTraffic;
@@ -131,11 +138,18 @@ public class XDApplication implements CommandLineRunner { @@ -131,11 +138,18 @@ public class XDApplication implements CommandLineRunner {
131 //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); 138 //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
132 //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) 139 //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
133 //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); 140 //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);
  141 +
  142 + //安全驾驶
  143 + //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);
  144 +
  145 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);
134 } 146 }
135 147
136 public void prodInit(){ 148 public void prodInit(){
137 log.info("prodInit..."); 149 log.info("prodInit...");
138 ScheduledExecutorService sexec = Application.mainServices; 150 ScheduledExecutorService sexec = Application.mainServices;
  151 + //安全驾驶
  152 + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
139 153
140 /** 线调业务 */ 154 /** 线调业务 */
141 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 155 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
@@ -167,6 +181,9 @@ public class XDApplication implements CommandLineRunner { @@ -167,6 +181,9 @@ public class XDApplication implements CommandLineRunner {
167 sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 181 sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
168 182
169 //线路版本更新 183 //线路版本更新
170 - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); 184 + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  185 +
  186 + //线路版本更新
  187 + sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
171 } 188 }
172 } 189 }
src/main/java/com/bsth/common/Constants.java
@@ -38,6 +38,7 @@ public class Constants { @@ -38,6 +38,7 @@ public class Constants {
38 38
39 public static final String SESSION_USERNAME = "sessionUserName"; 39 public static final String SESSION_USERNAME = "sessionUserName";
40 public static final String COMPANY_AUTHORITYS = "cmyAuths"; 40 public static final String COMPANY_AUTHORITYS = "cmyAuths";
  41 + public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode";
41 42
42 /** 43 /**
43 * 解除调度指令和班次的外键约束 44 * 解除调度指令和班次的外键约束
src/main/java/com/bsth/controller/BusIntervalController.java
@@ -52,5 +52,10 @@ public class BusIntervalController { @@ -52,5 +52,10 @@ public class BusIntervalController {
52 public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ 52 public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){
53 return busIntervalService.correctStatis(map); 53 return busIntervalService.correctStatis(map);
54 } 54 }
55 - 55 +
  56 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  57 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  58 + return busIntervalService.exportWaybillMore(map);
  59 + }
  60 +
56 } 61 }
src/main/java/com/bsth/controller/LineController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 -import java.text.ParseException;  
4 -import java.text.SimpleDateFormat;  
5 -import java.util.Date;  
6 -import java.util.HashMap;  
7 -import java.util.Map;  
8 -  
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 com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
16 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
17 import com.bsth.entity.LineVersions; 5 import com.bsth.entity.LineVersions;
18 import com.bsth.service.LineService; 6 import com.bsth.service.LineService;
19 import com.bsth.service.LineVersionsService; 7 import com.bsth.service.LineVersionsService;
20 import com.bsth.util.GetUIDAndCode; 8 import com.bsth.util.GetUIDAndCode;
  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.text.ParseException;
  16 +import java.text.SimpleDateFormat;
  17 +import java.util.Date;
  18 +import java.util.HashMap;
  19 +import java.util.Map;
21 20
22 /** 21 /**
23 * 22 *
@@ -123,4 +122,14 @@ public class LineController extends BaseController&lt;Line, Integer&gt; { @@ -123,4 +122,14 @@ public class LineController extends BaseController&lt;Line, Integer&gt; {
123 Line findByID(@RequestParam(defaultValue = "id") Integer id){ 122 Line findByID(@RequestParam(defaultValue = "id") Integer id){
124 return service.findById(id); 123 return service.findById(id);
125 } 124 }
  125 +
  126 + /**
  127 + * 删除线路
  128 + * @param id
  129 + * @return
  130 + */
  131 + @RequestMapping(value ="/remove" , method = RequestMethod.POST)
  132 + public Map<String, Object> remove(Integer id){
  133 + return service.remove(id);
  134 + }
126 } 135 }
src/main/java/com/bsth/controller/SectionController.java
@@ -135,7 +135,16 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; { @@ -135,7 +135,16 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
135 @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) 135 @RequestMapping(value="getSectionCode" , method = RequestMethod.GET)
136 public long getSectionCode() { 136 public long getSectionCode() {
137 return GetUIDAndCode.getSectionId(); 137 return GetUIDAndCode.getSectionId();
138 - 138 + }
  139 +
  140 + /**
  141 + * @Description :TODO(把路段截取位双路名路段)
  142 + *
  143 + * @return int <sectionCode路段编码>
  144 + */
  145 + @RequestMapping(value="doubleName" , method = RequestMethod.GET)
  146 + public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) {
  147 + return service.doubleName(map);
139 } 148 }
140 149
141 } 150 }
src/main/java/com/bsth/controller/StationController.java
@@ -148,14 +148,28 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -148,14 +148,28 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
148 return service.stationCacheUpdate(map); 148 return service.stationCacheUpdate(map);
149 } 149 }
150 /** 150 /**
  151 + * @Description :TODO(更新内部编码)
  152 + * @param stationCount,sectionCount 更新数
  153 + */
  154 + @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET)
  155 + public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
  156 + for(int i = 0; i < stationCount; i++) {
  157 + GetUIDAndCode.getStationId();
  158 + }
  159 + for(int i = 0; i < sectionCount; i++) {
  160 + GetUIDAndCode.getSectionId();
  161 + }
  162 + return 1;
  163 + }
  164 + /**
151 * @Description :TODO(查询站点编码) 165 * @Description :TODO(查询站点编码)
152 - * 166 + *
153 * @return int <stationCode站点编码> 167 * @return int <stationCode站点编码>
154 */ 168 */
155 @RequestMapping(value="getStationCode" , method = RequestMethod.GET) 169 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
156 public long getStationCode() { 170 public long getStationCode() {
157 return GetUIDAndCode.getStationId(); 171 return GetUIDAndCode.getStationId();
158 - 172 +
159 } 173 }
160 /** 174 /**
161 * @Description :TODO(查询站点编码) 175 * @Description :TODO(查询站点编码)
src/main/java/com/bsth/controller/StationRouteController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import com.bsth.entity.Station;
3 import com.bsth.entity.StationRoute; 4 import com.bsth.entity.StationRoute;
4 import com.bsth.entity.StationRouteCache; 5 import com.bsth.entity.StationRouteCache;
5 import com.bsth.repository.StationRouteCacheRepository; 6 import com.bsth.repository.StationRouteCacheRepository;
@@ -110,12 +111,20 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -110,12 +111,20 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
110 } 111 }
111 112
112 /** 113 /**
113 - * @Description :TODO(查询缓存站点的上一个缓存站点) 114 + * @Description :TODO(查询线路某方向下的站点序号与类型)
114 */ 115 */
115 @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) 116 @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET)
116 public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { 117 public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) {
117 return service.findCacheUpStationRouteCode(map); 118 return service.findCacheUpStationRouteCode(map);
118 } 119 }
  120 +
  121 + /**
  122 + * @Description :TODO(查询站点的下一个缓存站点)
  123 + */
  124 + @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET)
  125 + public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) {
  126 + return service.findDownStationRoute(map);
  127 + }
119 128
120 /** 129 /**
121 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) 130 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
1 -package com.bsth.controller.geo_data;  
2 -  
3 -import com.bsth.entity.geo_data.GeoStation;  
4 -import com.bsth.service.geo_data.GeoDataService;  
5 -import org.springframework.beans.factory.annotation.Autowired;  
6 -import org.springframework.web.bind.annotation.RequestMapping;  
7 -import org.springframework.web.bind.annotation.RequestMethod;  
8 -import org.springframework.web.bind.annotation.RequestParam;  
9 -import org.springframework.web.bind.annotation.RestController;  
10 -  
11 -import java.util.Map;  
12 -  
13 -/**  
14 - * Created by panzhao on 2017/12/7.  
15 - */  
16 -@RestController  
17 -@RequestMapping("/_geo_data")  
18 -public class GeoDataController {  
19 -  
20 - @Autowired  
21 - GeoDataService geoDataService;  
22 -  
23 - @RequestMapping("findGeoStations")  
24 - public Map<String, Object> findGeoStations(@RequestParam String lineCode){  
25 - return geoDataService.findGeoStations(lineCode);  
26 - }  
27 -  
28 -  
29 - @RequestMapping("findGeoRoad")  
30 - public Map<String, Object> findGeoRoad(@RequestParam String lineCode){  
31 - return geoDataService.findGeoRoad(lineCode);  
32 - }  
33 -  
34 - @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST)  
35 - public Map<String, Object> updateBufferInfo(GeoStation station){  
36 - return geoDataService.updateBufferInfo(station);  
37 - }  
38 -  
39 - @RequestMapping(value = "updateStationName",method = RequestMethod.POST)  
40 - public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){  
41 - return geoDataService.updateStationName(map);  
42 - } 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 + }
43 } 96 }
44 \ No newline at end of file 97 \ No newline at end of file
src/main/java/com/bsth/controller/gps/GpsController.java
@@ -3,6 +3,8 @@ package com.bsth.controller.gps; @@ -3,6 +3,8 @@ package com.bsth.controller.gps;
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
4 import com.bsth.data.gpsdata_v2.GpsRealData; 4 import com.bsth.data.gpsdata_v2.GpsRealData;
5 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 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;
6 import com.bsth.service.gps.GpsService; 8 import com.bsth.service.gps.GpsService;
7 import com.bsth.service.gps.entity.GpsSpeed; 9 import com.bsth.service.gps.entity.GpsSpeed;
8 import com.google.common.base.Splitter; 10 import com.google.common.base.Splitter;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*; @@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
12 import javax.servlet.http.HttpServletResponse; 14 import javax.servlet.http.HttpServletResponse;
13 import java.text.ParseException; 15 import java.text.ParseException;
14 import java.util.ArrayList; 16 import java.util.ArrayList;
  17 +import java.util.HashMap;
15 import java.util.List; 18 import java.util.List;
16 import java.util.Map; 19 import java.util.Map;
17 20
@@ -25,6 +28,9 @@ public class GpsController { @@ -25,6 +28,9 @@ public class GpsController {
25 @Autowired 28 @Autowired
26 GpsService gpsService; 29 GpsService gpsService;
27 30
  31 + @Autowired
  32 + OverspeedProcess overspeedProcess;
  33 +
28 @RequestMapping(value = "/real/all") 34 @RequestMapping(value = "/real/all")
29 public Map<String, Object> search(@RequestParam Map<String, Object> map, 35 public Map<String, Object> search(@RequestParam Map<String, Object> map,
30 @RequestParam(defaultValue = "0") int page, 36 @RequestParam(defaultValue = "0") int page,
@@ -42,8 +48,17 @@ public class GpsController { @@ -42,8 +48,17 @@ public class GpsController {
42 } 48 }
43 49
44 @RequestMapping(value = "/real/line") 50 @RequestMapping(value = "/real/line")
45 - public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) {  
46 - return gpsRealData.get(Splitter.on(",").splitToList(lineCodes)); 51 + public Map<String, Object> findByLineCodes(@RequestParam String lineCodes) {
  52 + Map<String, Object> rs = new HashMap();
  53 + List<String> lineArray = Splitter.on(",").splitToList(lineCodes);
  54 + //实时gps
  55 + List<GpsEntity> gpsList = gpsRealData.get(lineArray);
  56 +
  57 + //超速信息
  58 + List<GpsOverspeed> overspeedList = overspeedProcess.findByLines(lineArray);
  59 + rs.put("gpsList", gpsList);
  60 + rs.put("overspeedList", overspeedList);
  61 + return rs;
47 } 62 }
48 63
49 @RequestMapping(value = "/allDevices") 64 @RequestMapping(value = "/allDevices")
@@ -197,5 +212,15 @@ public class GpsController { @@ -197,5 +212,15 @@ public class GpsController {
197 map.put("pageData","10"); 212 map.put("pageData","10");
198 return gpsService.Pagequery(map); 213 return gpsService.Pagequery(map);
199 } 214 }
  215 +
  216 + /**
  217 + * 获取线路下所有车辆,包括实时设备 和 计划排班
  218 + * @param lineCode
  219 + * @return
  220 + */
  221 + @RequestMapping(value = "/allCarsByLine",method = RequestMethod.GET)
  222 + public Map<String, Object> allCarsByLine(String lineCode){
  223 + return gpsService.allCarsByLine(lineCode);
  224 + }
200 225
201 } 226 }
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -229,6 +229,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -229,6 +229,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
229 return list; 229 return list;
230 } 230 }
231 231
  232 + @RequestMapping(value = "/checkDate",method = RequestMethod.GET)
  233 + public String checkDate(@RequestParam Map<String, Object> map){
  234 + String list=ylbService.checkDate(map);
  235 + return list;
  236 + }
  237 +
232 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) 238 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
233 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ 239 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
234 Map<String, Object> list=ylbService.sumYlb(map); 240 Map<String, Object> list=ylbService.sumYlb(map);
src/main/java/com/bsth/controller/oil/YlxxbController.java
@@ -65,4 +65,16 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{ @@ -65,4 +65,16 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{
65 return list; 65 return list;
66 } 66 }
67 67
  68 + @RequestMapping(value="/saveYlxxb",method = RequestMethod.POST)
  69 + public Map<String, Object> savejzl(@RequestParam Map<String, Object> map){
  70 + Map<String, Object> maps=new HashMap<>();
  71 + try {
  72 + maps = service.saveYlxxb(map);
  73 + } catch (Exception e) {
  74 + // TODO Auto-generated catch block
  75 + e.printStackTrace();
  76 + }
  77 + return maps;
  78 + }
  79 +
68 } 80 }
src/main/java/com/bsth/controller/realcontrol/ChildTaskPlanController.java
@@ -27,4 +27,9 @@ public class ChildTaskPlanController extends BaseController&lt;ChildTaskPlan, Long&gt; @@ -27,4 +27,9 @@ public class ChildTaskPlanController extends BaseController&lt;ChildTaskPlan, Long&gt;
27 public Map<String, Object> delHistory(@PathVariable("id") Long id){ 27 public Map<String, Object> delHistory(@PathVariable("id") Long id){
28 return childTaskPlanService.delHistory(id); 28 return childTaskPlanService.delHistory(id);
29 } 29 }
  30 +
  31 + @RequestMapping(value = "update", method = RequestMethod.POST)
  32 + public Map<String, Object> update(ChildTaskPlan childTask){
  33 + return childTaskPlanService.update(childTask);
  34 + }
30 } 35 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -483,6 +483,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -483,6 +483,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
483 public Map<String, Object> MapById(@RequestParam("id") Long id){ 483 public Map<String, Object> MapById(@RequestParam("id") Long id){
484 return scheduleRealInfoService.MapById(id); 484 return scheduleRealInfoService.MapById(id);
485 } 485 }
  486 +
  487 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  488 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  489 + return scheduleRealInfoService.MapByIdQp(id);
  490 + }
486 491
487 /** 492 /**
488 * @Title: scheduleDaily 493 * @Title: scheduleDaily
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
@@ -63,7 +63,9 @@ public class ServiceDataInterface { @@ -63,7 +63,9 @@ public class ServiceDataInterface {
63 map = new HashMap<>(); 63 map = new HashMap<>();
64 map.put("clZbh", sch.getClZbh()); 64 map.put("clZbh", sch.getClZbh());
65 map.put("jGh", sch.getjGh()); 65 map.put("jGh", sch.getjGh());
  66 + map.put("jName", sch.getjGh());
66 map.put("sGh", sch.getsGh()); 67 map.put("sGh", sch.getsGh());
  68 + map.put("sName", sch.getsGh());
67 map.put("lpName", sch.getLpName()); 69 map.put("lpName", sch.getLpName());
68 map.put("xlBm", sch.getXlBm()); 70 map.put("xlBm", sch.getXlBm());
69 map.put("xlName", sch.getXlName()); 71 map.put("xlName", sch.getXlName());
src/main/java/com/bsth/controller/realcontrol/summary/TempSchSituationController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.summary;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.data.summary.entity.TempSchSituation;
  5 +import com.bsth.data.summary.service.TempSchSituationService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import javax.servlet.http.HttpServletRequest;
  12 +import javax.servlet.http.HttpServletResponse;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * Created by panzhao on 2017/11/1.
  17 + */
  18 +@RestController
  19 +@RequestMapping("/summary/temp_sch")
  20 +public class TempSchSituationController extends BaseController<TempSchSituation, Long> {
  21 +
  22 + @Autowired
  23 + TempSchSituationService tempSchSituationService;
  24 +
  25 + @RequestMapping("excel")
  26 + public void excel(@RequestParam Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
  27 + tempSchSituationService.excel(map, request, response);
  28 + }
  29 +}
src/main/java/com/bsth/controller/report/ReportController.java
@@ -209,6 +209,12 @@ public class ReportController { @@ -209,6 +209,12 @@ public class ReportController {
209 return service.historyMessageCount(line, date, code); 209 return service.historyMessageCount(line, date, code);
210 } 210 }
211 211
  212 + @RequestMapping(value = "/historyMessageList", method = RequestMethod.GET)
  213 + public List<Object[]> historyMessageList(@RequestParam String line, @RequestParam String date,
  214 + @RequestParam String code,@RequestParam String type) {
  215 + return service.historyMessageList(line, date, code, type);
  216 + }
  217 +
212 @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET) 218 @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET)
213 public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) { 219 public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) {
214 return service.tbodyTime1(line, ttinfo); 220 return service.tbodyTime1(line, ttinfo);
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java
@@ -2,16 +2,14 @@ package com.bsth.controller.schedule.core; @@ -2,16 +2,14 @@ package com.bsth.controller.schedule.core;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 -import com.bsth.entity.LineVersions;  
6 import com.bsth.entity.schedule.TTInfo; 5 import com.bsth.entity.schedule.TTInfo;
7 -import com.bsth.service.LineVersionsService;  
8 import com.bsth.service.schedule.TTInfoService; 6 import com.bsth.service.schedule.TTInfoService;
9 import com.bsth.service.schedule.exception.ScheduleException; 7 import com.bsth.service.schedule.exception.ScheduleException;
10 -import org.joda.time.DateTime;  
11 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*; 9 import org.springframework.web.bind.annotation.*;
13 10
14 -import java.util.*; 11 +import java.util.HashMap;
  12 +import java.util.Map;
15 13
16 /** 14 /**
17 * Created by xu on 16/12/20. 15 * Created by xu on 16/12/20.
@@ -21,47 +19,33 @@ import java.util.*; @@ -21,47 +19,33 @@ import java.util.*;
21 public class TTInfoController extends BController<TTInfo, Long> { 19 public class TTInfoController extends BController<TTInfo, Long> {
22 @Autowired 20 @Autowired
23 private TTInfoService ttInfoService; 21 private TTInfoService ttInfoService;
24 - @Autowired  
25 - private LineVersionsService lineVersionsService;  
26 22
27 @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET) 23 @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET)
28 public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) { 24 public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) {
29 Map<String, Object> rtn = new HashMap<>(); 25 Map<String, Object> rtn = new HashMap<>();
30 try { 26 try {
31 - List<LineVersions> lineVersionses = lineVersionsService.findByLineCode(lineid);  
32 - Collections.sort(lineVersionses, new Comparator<LineVersions>() {  
33 - @Override  
34 - public int compare(LineVersions o1, LineVersions o2) {  
35 - if (o1.getVersions() > o2.getVersions()) {  
36 - return -1;  
37 - } else if (o1.getVersions() < o2.getVersions()) {  
38 - return 1;  
39 - } else {  
40 - return 0;  
41 - }  
42 - }  
43 - });  
44 -  
45 - // 取最近2条记录  
46 - List<Map<String, Object>> mapList = new ArrayList<>();  
47 - for (LineVersions lv: lineVersionses) {  
48 - String vname = lv.getName();  
49 - String rq = lv.getStartDate() == null ? "未知启用日期" : new DateTime(lv.getStartDate()).toString("YYYY年MM月dd日");  
50 - String sdesc = lv.getStatus() == 0 ? "历史" : (lv.getStatus() == 1 ? "当前" : "待更新");  
51 -  
52 - Map<String, Object> value = new HashMap<>();  
53 - value.put("desc", vname + "-" + rq + "-" + sdesc);  
54 - value.put("version", lv.getVersions());  
55 -  
56 - mapList.add(value);  
57 -  
58 - if (mapList.size() == 2) {  
59 - break;  
60 - }  
61 - } 27 + rtn.put("status", ResponseCode.SUCCESS);
  28 + rtn.put("data", ttInfoService.getLineStationRouteVersions(lineid));
  29 +
  30 + } catch (Exception exp) {
  31 + rtn.put("status", ResponseCode.ERROR);
  32 + rtn.put("msg", exp.getMessage());
  33 + }
  34 +
  35 + return rtn;
62 36
  37 + }
  38 +
  39 + @RequestMapping(value = "/versiondesc/{lineid}/{version}")
  40 + public Map<String, Object> getLineVersionDesc(
  41 + @PathVariable(value = "lineid") Integer lineid,
  42 + @PathVariable(value = "version") Integer version) {
  43 + Map<String, Object> rtn = new HashMap<>();
  44 + try {
  45 + Map<String, String> desc = new HashMap<>();
  46 + desc.put("desc", ttInfoService.getLineVersionDesc(lineid, version));
63 rtn.put("status", ResponseCode.SUCCESS); 47 rtn.put("status", ResponseCode.SUCCESS);
64 - rtn.put("data", mapList); 48 + rtn.put("data", desc);
65 49
66 } catch (Exception exp) { 50 } catch (Exception exp) {
67 rtn.put("status", ResponseCode.ERROR); 51 rtn.put("status", ResponseCode.ERROR);
@@ -69,7 +53,23 @@ public class TTInfoController extends BController&lt;TTInfo, Long&gt; { @@ -69,7 +53,23 @@ public class TTInfoController extends BController&lt;TTInfo, Long&gt; {
69 } 53 }
70 54
71 return rtn; 55 return rtn;
  56 + }
  57 +
  58 + @RequestMapping(value = "/versiondesc2/{lineid}/{status}")
  59 + public Map<String, Object> getLineVersionDesc2(
  60 + @PathVariable(value = "lineid") Integer lineid,
  61 + @PathVariable(value = "status") Integer status) {
  62 + Map<String, Object> rtn = new HashMap<>();
  63 + try {
  64 + rtn.put("status", ResponseCode.SUCCESS);
  65 + rtn.put("data", ttInfoService.getLineVersions(lineid, status));
72 66
  67 + } catch (Exception exp) {
  68 + rtn.put("status", ResponseCode.ERROR);
  69 + rtn.put("msg", exp.getMessage());
  70 + }
  71 +
  72 + return rtn;
73 } 73 }
74 74
75 @RequestMapping(value = "/validate_name", method = RequestMethod.GET) 75 @RequestMapping(value = "/validate_name", method = RequestMethod.GET)
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
@@ -5,9 +5,13 @@ import com.bsth.controller.schedule.BController; @@ -5,9 +5,13 @@ import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.TTInfoDetail; 5 import com.bsth.entity.schedule.TTInfoDetail;
6 import com.bsth.service.schedule.TTInfoDetailService; 6 import com.bsth.service.schedule.TTInfoDetailService;
7 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; 7 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
  8 +import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
  9 +import com.bsth.service.schedule.utils.DataToolsFile;
8 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.*; 11 import org.springframework.web.bind.annotation.*;
10 12
  13 +import javax.servlet.http.HttpServletResponse;
  14 +import java.io.*;
11 import java.util.HashMap; 15 import java.util.HashMap;
12 import java.util.List; 16 import java.util.List;
13 import java.util.Map; 17 import java.util.Map;
@@ -32,30 +36,18 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -32,30 +36,18 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
32 * @param sheetname sheet名字 36 * @param sheetname sheet名字
33 * @param lineid 线路id 37 * @param lineid 线路id
34 * @param linename 线路名称 38 * @param linename 线路名称
  39 + * @param lineversion 线路版本
35 * @return 40 * @return
36 */ 41 */
37 @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST) 42 @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
38 public Map<String, Object> validate_sheet( 43 public Map<String, Object> validate_sheet(
39 - String filename, String sheetname, Integer lineid, String linename,  
40 - Integer zdlytype, Integer zdlyversion) { 44 + String filename, String sheetname, Integer lineid, String linename, Integer lineversion) {
41 Map<String, Object> rtn = new HashMap<>(); 45 Map<String, Object> rtn = new HashMap<>();
42 try { 46 try {
43 - if (zdlytype == null) {  
44 - throw new Exception("请选择路由版本类型");  
45 - } else {  
46 - if (zdlytype == 1) {  
47 - ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, null);  
48 - } else if (zdlytype == 2) {  
49 - if (zdlyversion == null || zdlyversion == -1) {  
50 - throw new Exception("请选择具体版本");  
51 - } else {  
52 - ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, zdlyversion);  
53 - }  
54 - } else {  
55 - throw new Exception("未知路由版本类型");  
56 - } 47 + if (lineversion == null) {
  48 + throw new Exception("线路版本未知");
57 } 49 }
58 - 50 + ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, lineversion);
59 rtn.put("status", ResponseCode.SUCCESS); 51 rtn.put("status", ResponseCode.SUCCESS);
60 } catch (Exception exp) { 52 } catch (Exception exp) {
61 rtn.put("status", ResponseCode.ERROR); 53 rtn.put("status", ResponseCode.ERROR);
@@ -108,10 +100,10 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -108,10 +100,10 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
108 } 100 }
109 101
110 @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) 102 @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET)
111 - public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir) { 103 + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) {
112 Map<String, Object> rtn = new HashMap<>(); 104 Map<String, Object> rtn = new HashMap<>();
113 try { 105 try {
114 - List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir); 106 + List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir, lineversion);
115 rtn.put("status", ResponseCode.SUCCESS); 107 rtn.put("status", ResponseCode.SUCCESS);
116 rtn.put("data", list); 108 rtn.put("data", list);
117 } catch (Exception exp) { 109 } catch (Exception exp) {
@@ -132,4 +124,32 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -132,4 +124,32 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
132 public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){ 124 public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){
133 return ttInfoDetailService.skbDetailMxSave(entities); 125 return ttInfoDetailService.skbDetailMxSave(entities);
134 } 126 }
  127 +
  128 +
  129 + @RequestMapping(value = "/exportDTDFile", method = RequestMethod.POST)
  130 + public void exportFile(
  131 + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos,
  132 + HttpServletResponse response) throws Exception {
  133 + DataToolsFile dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos);
  134 + // 流输出导出文件
  135 + response.setHeader("content-type", "application/octet-stream");
  136 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  137 + response.setContentType("application/octet-stream");
  138 +
  139 + OutputStream os = response.getOutputStream();
  140 + BufferedOutputStream bos = new BufferedOutputStream(os);
  141 +
  142 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  143 + BufferedInputStream bis = new BufferedInputStream(is);
  144 +
  145 + int length = 0;
  146 + byte[] temp = new byte[1 * 1024 * 10];
  147 + while ((length = bis.read(temp)) != -1) {
  148 + bos.write(temp, 0, length);
  149 + }
  150 + bos.flush();
  151 + bis.close();
  152 + bos.close();
  153 + is.close();
  154 + }
135 } 155 }
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
1 package com.bsth.data.car_out_info; 1 package com.bsth.data.car_out_info;
2 2
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
  4 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  5 +import com.bsth.data.gpsdata_v2.entity.StationRoute;
4 import com.bsth.data.schedule.DayOfSchedule; 6 import com.bsth.data.schedule.DayOfSchedule;
5 import com.bsth.data.schedule.ScheduleComparator; 7 import com.bsth.data.schedule.ScheduleComparator;
6 import com.bsth.entity.realcontrol.ScheduleRealInfo; 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
@@ -43,7 +45,7 @@ public class CarOutInfoHandler { @@ -43,7 +45,7 @@ public class CarOutInfoHandler {
43 bcTypeMap.put("ldks", "两点间空驶"); 45 bcTypeMap.put("ldks", "两点间空驶");
44 } 46 }
45 47
46 - private static ScheduleComparator.DFSJ schDFSJComparator = new ScheduleComparator.DFSJ(); 48 + private static ScheduleComparator.DFSJ2 schDFSJComparator = new ScheduleComparator.DFSJ2();
47 49
48 @Autowired 50 @Autowired
49 JdbcTemplate jdbcTemplate; 51 JdbcTemplate jdbcTemplate;
@@ -166,6 +168,11 @@ public class CarOutInfoHandler { @@ -166,6 +168,11 @@ public class CarOutInfoHandler {
166 * @param list 168 * @param list
167 * @return 169 * @return
168 */ 170 */
  171 + private static String[] fls = new String[]{"in","out","ldks","venting","major"};
  172 + private static List<String> clearTypes;
  173 + static {
  174 + clearTypes = Arrays.asList(fls);
  175 + }
169 private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) { 176 private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) {
170 ScheduleRealInfo[] array = new ScheduleRealInfo[3]; 177 ScheduleRealInfo[] array = new ScheduleRealInfo[3];
171 Collections.sort(list, schDFSJComparator); 178 Collections.sort(list, schDFSJComparator);
@@ -181,11 +188,16 @@ public class CarOutInfoHandler { @@ -181,11 +188,16 @@ public class CarOutInfoHandler {
181 continue; 188 continue;
182 189
183 //进场、出场、2点间空驶 190 //进场、出场、2点间空驶
184 - if (sch.getBcType().equals("in")  
185 - || sch.getBcType().equals("out")  
186 - || sch.getBcType().equals("ldks")) 191 + if (clearTypes.contains(sch.getBcType()))
187 continue; 192 continue;
188 193
  194 + //区间
  195 + if (sch.getBcType().equals("region")){
  196 + //是否起点发出
  197 + if(!isStartOut(sch))
  198 + continue;
  199 + }
  200 +
189 //有实发实达时间的 201 //有实发实达时间的
190 if (StringUtils.isNotEmpty(sch.getFcsjActual()) 202 if (StringUtils.isNotEmpty(sch.getFcsjActual())
191 || StringUtils.isNotEmpty(sch.getZdsjActual())) 203 || StringUtils.isNotEmpty(sch.getZdsjActual()))
@@ -199,4 +211,30 @@ public class CarOutInfoHandler { @@ -199,4 +211,30 @@ public class CarOutInfoHandler {
199 } 211 }
200 return array; 212 return array;
201 } 213 }
  214 +
  215 + private static StationRouteComp sComp = new StationRouteComp();
  216 + private boolean isStartOut(ScheduleRealInfo sch) {
  217 + try{
  218 + List<StationRoute> list = GeoCacheData.getStationRoute(sch.getXlBm(), Integer.parseInt(sch.getXlDir()));
  219 +
  220 + if(null == list && list.size() == 0)
  221 + return false;
  222 + //排序
  223 + Collections.sort(list, sComp);
  224 +
  225 + if(sch.getQdzName().equals(list.get(0).getName()))
  226 + return true;
  227 + }catch (Exception e){
  228 + logger.error("", e);
  229 + }
  230 + return false;
  231 + }
  232 +
  233 + private static class StationRouteComp implements Comparator<StationRoute> {
  234 +
  235 + @Override
  236 + public int compare(StationRoute s1, StationRoute s2) {
  237 + return s1.getRouteSort() - s2.getRouteSort();
  238 + }
  239 + }
202 } 240 }
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
@@ -7,6 +7,8 @@ import com.bsth.entity.directive.Directive; @@ -7,6 +7,8 @@ import com.bsth.entity.directive.Directive;
7 import com.bsth.entity.realcontrol.ScheduleRealInfo; 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
8 import com.bsth.repository.directive.D60Repository; 8 import com.bsth.repository.directive.D60Repository;
9 import com.bsth.repository.directive.D64Repository; 9 import com.bsth.repository.directive.D64Repository;
  10 +import org.joda.time.format.DateTimeFormat;
  11 +import org.joda.time.format.DateTimeFormatter;
10 import org.slf4j.Logger; 12 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +34,8 @@ public class DirectivesPstThread extends Thread { @@ -32,6 +34,8 @@ public class DirectivesPstThread extends Thread {
32 @Autowired 34 @Autowired
33 DayOfSchedule dayOfSchedule; 35 DayOfSchedule dayOfSchedule;
34 36
  37 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  38 +
35 @Override 39 @Override
36 public void run() { 40 public void run() {
37 41
@@ -52,6 +56,8 @@ public class DirectivesPstThread extends Thread { @@ -52,6 +56,8 @@ public class DirectivesPstThread extends Thread {
52 continue; 56 continue;
53 } 57 }
54 } 58 }
  59 + //日期
  60 + d60.setRq(fmtyyyyMMdd.print(d60.getTimestamp()));
55 d60Repository.save(d60); 61 d60Repository.save(d60);
56 } 62 }
57 63
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
1 package com.bsth.data.gpsdata_v2; 1 package com.bsth.data.gpsdata_v2;
2 2
  3 +import com.alibaba.fastjson.JSON;
3 import com.bsth.data.gpsdata_v2.cache.GpsCacheData; 4 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
4 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
5 import com.bsth.data.gpsdata_v2.handlers.*; 6 import com.bsth.data.gpsdata_v2.handlers.*;
@@ -11,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -11,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
12 13
13 import java.util.*; 14 import java.util.*;
14 -import java.util.concurrent.*; 15 +import java.util.concurrent.CountDownLatch;
  16 +import java.util.concurrent.ExecutorService;
  17 +import java.util.concurrent.Executors;
15 18
16 /** 19 /**
17 * 实时信号数据处理 20 * 实时信号数据处理
@@ -38,7 +41,7 @@ public class DataHandleProcess { @@ -38,7 +41,7 @@ public class DataHandleProcess {
38 41
39 static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); 42 static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
40 43
41 - final static int POOL_SIZE = 25; 44 + final static int POOL_SIZE = 20;
42 45
43 static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); 46 static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1);
44 public static CountDownLatch count; 47 public static CountDownLatch count;
@@ -73,38 +76,16 @@ public class DataHandleProcess { @@ -73,38 +76,16 @@ public class DataHandleProcess {
73 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); 76 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
74 count = new CountDownLatch(ks.size()); 77 count = new CountDownLatch(ks.size());
75 78
76 - List<Future> fRs = new ArrayList<>(ks.size()); 79 + logger.info(JSON.toJSONString(ks));
77 for (Integer index : ks) { 80 for (Integer index : ks) {
78 - fRs.add(threadPool.submit(new SignalHandleThread(dataListMap.get(index), count))); 81 + //logger.info("execute index: " + index);
  82 + threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));
79 } 83 }
80 84
81 - //按线路分组gps  
82 - /*ArrayListMultimap multimap = ArrayListMultimap.create();  
83 - for (GpsEntity gps : list) {  
84 - multimap.put(gps.getLineId(), gps);  
85 - }  
86 -  
87 - Set<String> ks = multimap.keySet();  
88 -  
89 - logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());  
90 - count = new CountDownLatch(ks.size());  
91 -  
92 - for (String lineCode : ks) {  
93 - threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count));  
94 - }*/  
95 85
96 //等待子线程结束 86 //等待子线程结束
97 count.await(); 87 count.await();
98 88
99 - for (Future f : fRs) {  
100 - try {  
101 - f.get();  
102 - } catch (InterruptedException e) {  
103 - } catch (ExecutionException e) {  
104 - logger.error(e.getCause().getMessage());  
105 - }  
106 - }  
107 -  
108 //加入实时gps对照 89 //加入实时gps对照
109 for (GpsEntity gps : list) 90 for (GpsEntity gps : list)
110 gpsRealData.put(gps); 91 gpsRealData.put(gps);
@@ -129,36 +110,45 @@ public class DataHandleProcess { @@ -129,36 +110,45 @@ public class DataHandleProcess {
129 110
130 @Override 111 @Override
131 public void run() { 112 public void run() {
132 - //try {  
133 - Collections.sort(list, comp);  
134 - for (GpsEntity gps : list) {  
135 - try {  
136 - if(StringUtils.isEmpty(gps.getNbbm()))  
137 - continue;  
138 - if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)  
139 - continue;  
140 -  
141 - gpsStateProcess.process(gps);//状态处理  
142 - stationInsideProcess.process(gps);//场站内外判定  
143 - reverseRouteProcess.process(gps);//反向路由处理  
144 - abnormalStateProcess.process(gps);//超速越界  
145 -  
146 - inStationProcess.process(gps);//进站  
147 - outStationProcess.process(gps);//出站  
148 -  
149 - GpsCacheData.putGps(gps);//历史gps缓存  
150 - } catch (Exception e) {  
151 - logger.error("", e); 113 + try {
  114 + Collections.sort(list, comp);
  115 + //logger.info("sort end --" + Thread.currentThread().getName() + " -list size: " + list.size());
  116 +
  117 + GpsEntity gps;
  118 + for(int i = 0,len = list.size(); i< len ;i ++){
  119 + gps = list.get(i);
  120 +
  121 + //logger.info("run |--" + Thread.currentThread().getName() + " -i: " + i);
  122 + try {
  123 + if (StringUtils.isEmpty(gps.getNbbm()))
  124 + continue;
  125 + if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)
  126 + continue;
  127 +
  128 + gpsStateProcess.process(gps);//状态处理
  129 + stationInsideProcess.process(gps);//场站内外判定
  130 + reverseRouteProcess.process(gps);//反向路由处理
  131 + abnormalStateProcess.process(gps);//超速越界
  132 +
  133 + inStationProcess.process(gps);//进站
  134 + outStationProcess.process(gps);//出站
  135 +
  136 +
  137 + //logger.info("put start --" + Thread.currentThread().getName() + " -i: " + i);
  138 + GpsCacheData.putGps(gps);//历史gps缓存
  139 + //logger.info("put end --" + Thread.currentThread().getName() + " -i: " + i);
  140 + } catch (Throwable e) {
  141 + logger.error("", e);
  142 + }
152 } 143 }
153 - }  
154 144
155 - logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount());  
156 - count.countDown();  
157 - /*} finally { 145 + //logger.info("for end --" + Thread.currentThread().getName() + " -list size: " + list.size());
  146 +
  147 + } finally {
158 if (count != null) 148 if (count != null)
159 count.countDown(); 149 count.countDown();
160 - logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount());  
161 - }*/ 150 + //logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount());
  151 + }
162 } 152 }
163 } 153 }
164 154
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
@@ -123,7 +123,13 @@ public class GpsRealData { @@ -123,7 +123,13 @@ public class GpsRealData {
123 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws 123 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws
124 */ 124 */
125 public List<GpsEntity> getByLine(String lineCode) { 125 public List<GpsEntity> getByLine(String lineCode) {
126 - NavigableSet<String> set = lineCode2Devices.get(lineCode); 126 + NavigableSet<String> set = lineCode2Devices.get(lineCode);//实际车载
  127 + Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
  128 +
  129 + Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  130 + for(String nbbm : nbbmSet){
  131 + set.add(nbbm2deviceMap.get(nbbm));
  132 + }
127 133
128 List<GpsEntity> rs = new ArrayList<>(); 134 List<GpsEntity> rs = new ArrayList<>();
129 GpsEntity gps; 135 GpsEntity gps;
@@ -135,14 +141,28 @@ public class GpsRealData { @@ -135,14 +141,28 @@ public class GpsRealData {
135 continue; 141 continue;
136 142
137 sch = dayOfSchedule.execPlanMap().get(gps.getNbbm()); 143 sch = dayOfSchedule.execPlanMap().get(gps.getNbbm());
138 - if (null != sch) 144 + if (null != sch){
139 gps.setSchId(sch.getId()); 145 gps.setSchId(sch.getId());
  146 + if(!sch.getXlBm().equals(lineCode)){
  147 + //车辆在其他线路营运
  148 + gps.setRemark("执行 " + sch.getXlName() + " " + sch.getDfsj() + " 班次");
  149 + gps.setPlanCode(sch.getXlBm());
  150 + }
  151 + else
  152 + gps.setRemark(null);
  153 + }else
  154 + gps.setRemark(null);
  155 +
140 rs.add(gps); 156 rs.add(gps);
141 } 157 }
142 158
143 return rs; 159 return rs;
144 } 160 }
145 161
  162 + public static Set<String> findDevices(String lineCode){
  163 + return lineCode2Devices.get(lineCode);
  164 + }
  165 +
146 public List<GpsEntity> get(List<String> pArray) { 166 public List<GpsEntity> get(List<String> pArray) {
147 List<GpsEntity> list = new ArrayList<>(); 167 List<GpsEntity> list = new ArrayList<>();
148 168
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
@@ -139,7 +139,7 @@ public class GeoCacheData { @@ -139,7 +139,7 @@ public class GeoCacheData {
139 139
140 private void loadTccMapData(){ 140 private void loadTccMapData(){
141 //加载停车场数据 141 //加载停车场数据
142 - String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null"; 142 + String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0";
143 List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql); 143 List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql);
144 Map<String, Polygon> tccTempMap = new HashMap<>(); 144 Map<String, Polygon> tccTempMap = new HashMap<>();
145 145
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
@@ -9,6 +9,8 @@ import org.slf4j.Logger; @@ -9,6 +9,8 @@ import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
10 10
11 import java.util.*; 11 import java.util.*;
  12 +import java.util.concurrent.ConcurrentHashMap;
  13 +import java.util.concurrent.ConcurrentMap;
12 14
13 /** 15 /**
14 * gps 数据缓存 16 * gps 数据缓存
@@ -17,10 +19,10 @@ import java.util.*; @@ -17,10 +19,10 @@ import java.util.*;
17 public class GpsCacheData { 19 public class GpsCacheData {
18 20
19 /** 21 /**
20 - * 每辆车缓存最后300条gps 22 + * 每辆车缓存最后200条gps
21 */ 23 */
22 - private static final int CACHE_SIZE = 300;  
23 - private static Map<String, CircleQueue<GpsEntity>> gpsCacheMap = new HashMap<>(); 24 + private static final int CACHE_SIZE = 200;
  25 + private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>();
24 26
25 /** 27 /**
26 * 车辆执行班次的详细 进出站数据 28 * 车辆执行班次的详细 进出站数据
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
@@ -100,6 +100,9 @@ public class GpsEntity implements Cloneable{ @@ -100,6 +100,9 @@ public class GpsEntity implements Cloneable{
100 */ 100 */
101 private int source = -1; 101 private int source = -1;
102 102
  103 + private String remark;
  104 + private String planCode;
  105 +
103 public Object clone() { 106 public Object clone() {
104 try { 107 try {
105 return super.clone(); 108 return super.clone();
@@ -360,4 +363,20 @@ public class GpsEntity implements Cloneable{ @@ -360,4 +363,20 @@ public class GpsEntity implements Cloneable{
360 public void setPremiseCode(String premiseCode) { 363 public void setPremiseCode(String premiseCode) {
361 this.premiseCode = premiseCode; 364 this.premiseCode = premiseCode;
362 } 365 }
  366 +
  367 + public String getRemark() {
  368 + return remark;
  369 + }
  370 +
  371 + public void setRemark(String remark) {
  372 + this.remark = remark;
  373 + }
  374 +
  375 + public String getPlanCode() {
  376 + return planCode;
  377 + }
  378 +
  379 + public void setPlanCode(String planCode) {
  380 + this.planCode = planCode;
  381 + }
363 } 382 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/AbnormalStateProcess.java
@@ -3,8 +3,10 @@ package com.bsth.data.gpsdata_v2.handlers; @@ -3,8 +3,10 @@ package com.bsth.data.gpsdata_v2.handlers;
3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData; 3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4 import com.bsth.data.gpsdata_v2.entity.CtLineString; 4 import com.bsth.data.gpsdata_v2.entity.CtLineString;
5 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  6 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
6 import com.bsth.data.gpsdata_v2.utils.GeoUtils; 7 import com.bsth.data.gpsdata_v2.utils.GeoUtils;
7 import com.bsth.util.Geo.Point; 8 import com.bsth.util.Geo.Point;
  9 +import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
9 11
10 import java.util.List; 12 import java.util.List;
@@ -17,19 +19,18 @@ import java.util.List; @@ -17,19 +19,18 @@ import java.util.List;
17 public class AbnormalStateProcess { 19 public class AbnormalStateProcess {
18 20
19 /** 21 /**
20 - * 默认限速  
21 - */  
22 - private static final double DEFAULT_SPEED_LIMIT = 60;  
23 - /**  
24 * 越界阈值 22 * 越界阈值
25 */ 23 */
26 private static final double OUT_BOUNDS_THRESHOLD = 100; 24 private static final double OUT_BOUNDS_THRESHOLD = 100;
27 25
  26 + @Autowired
  27 + OverspeedProcess overspeedProcess;
  28 +
28 public void process(GpsEntity gps) { 29 public void process(GpsEntity gps) {
29 if (isOffline(gps)) 30 if (isOffline(gps))
30 return; 31 return;
31 32
32 - if (overspeed(gps)) 33 + if (overspeedProcess.process(gps))
33 return; 34 return;
34 35
35 if (outOfBounds((gps))) 36 if (outOfBounds((gps)))
@@ -41,14 +42,14 @@ public class AbnormalStateProcess { @@ -41,14 +42,14 @@ public class AbnormalStateProcess {
41 } 42 }
42 43
43 44
44 - /** 45 +/* *//**
45 * 是否超速 46 * 是否超速
46 * 47 *
47 * @param gps 48 * @param gps
48 * @return 49 * @return
49 - */ 50 +
50 private boolean overspeed(GpsEntity gps) { 51 private boolean overspeed(GpsEntity gps) {
51 - double maxSpeed = DEFAULT_SPEED_LIMIT; 52 + *//*double maxSpeed = DEFAULT_SPEED_LIMIT;
52 if (GeoCacheData.speedLimit(gps.getLineId()) != null) 53 if (GeoCacheData.speedLimit(gps.getLineId()) != null)
53 maxSpeed = GeoCacheData.speedLimit(gps.getLineId()); 54 maxSpeed = GeoCacheData.speedLimit(gps.getLineId());
54 55
@@ -56,8 +57,9 @@ public class AbnormalStateProcess { @@ -56,8 +57,9 @@ public class AbnormalStateProcess {
56 gps.setAbnormalStatus("overspeed"); 57 gps.setAbnormalStatus("overspeed");
57 return true; 58 return true;
58 } 59 }
59 - return false;  
60 - } 60 + return false;*//*
  61 + return overspeedProcess.process(gps);
  62 + }*/
61 63
62 64
63 /** 65 /**
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -159,7 +159,7 @@ public class InStationProcess { @@ -159,7 +159,7 @@ public class InStationProcess {
159 logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual()); 159 logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual());
160 160
161 //清除车辆误点调整监听 161 //清除车辆误点调整监听
162 - LateAdjustHandle.remove(nbbm); 162 + LateAdjustHandle.remove(sch);
163 163
164 //将gps转换成下一个班次走向的站内信号(应对只有一个站内信号 即 发出时) 164 //将gps转换成下一个班次走向的站内信号(应对只有一个站内信号 即 发出时)
165 transformUpDown(gps, next); 165 transformUpDown(gps, next);
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
@@ -113,7 +113,7 @@ public class OutStationProcess { @@ -113,7 +113,7 @@ public class OutStationProcess {
113 dayOfSchedule.save(sch); 113 dayOfSchedule.save(sch);
114 114
115 //清理应发未发标记 115 //清理应发未发标记
116 - LateAdjustHandle.remove(sch.getClZbh()); 116 + LateAdjustHandle.remove(sch);
117 117
118 //发车的时候,同步一下状态 118 //发车的时候,同步一下状态
119 if (!gps.isService() && !dayOfSchedule.emptyService(sch)) 119 if (!gps.isService() && !dayOfSchedule.emptyService(sch))
src/main/java/com/bsth/data/gpsdata_v2/handlers/overspeed/GpsOverspeed.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.handlers.overspeed;
  2 +
  3 +/**
  4 + * gps 超速信息
  5 + * Created by panzhao on 2018/1/9.
  6 + */
  7 +public class GpsOverspeed {
  8 +
  9 + private String device;
  10 +
  11 + private String nbbm;
  12 +
  13 + private String lineCode;
  14 +
  15 + /**
  16 + * 开始超速时间 HH:mm
  17 + */
  18 + private String sts;
  19 +
  20 + private long st;
  21 +
  22 + /**
  23 + * 结束超速时间 HH:mm
  24 + */
  25 + private String ets;
  26 +
  27 + /**
  28 + * 最新速度值
  29 + */
  30 + private float speed;
  31 +
  32 + /**
  33 + * 0:结束超速, 1:离线
  34 + */
  35 + private int eType;
  36 +
  37 + public String getDevice() {
  38 + return device;
  39 + }
  40 +
  41 + public void setDevice(String device) {
  42 + this.device = device;
  43 + }
  44 +
  45 + public String getNbbm() {
  46 + return nbbm;
  47 + }
  48 +
  49 + public void setNbbm(String nbbm) {
  50 + this.nbbm = nbbm;
  51 + }
  52 +
  53 + public String getLineCode() {
  54 + return lineCode;
  55 + }
  56 +
  57 + public void setLineCode(String lineCode) {
  58 + this.lineCode = lineCode;
  59 + }
  60 +
  61 + public String getSts() {
  62 + return sts;
  63 + }
  64 +
  65 + public void setSts(String sts) {
  66 + this.sts = sts;
  67 + }
  68 +
  69 + public long getSt() {
  70 + return st;
  71 + }
  72 +
  73 + public void setSt(long st) {
  74 + this.st = st;
  75 + }
  76 +
  77 + public String getEts() {
  78 + return ets;
  79 + }
  80 +
  81 + public void setEts(String ets) {
  82 + this.ets = ets;
  83 + }
  84 +
  85 + public float getSpeed() {
  86 + return speed;
  87 + }
  88 +
  89 + public void setSpeed(float speed) {
  90 + this.speed = speed;
  91 + }
  92 +
  93 + public int geteType() {
  94 + return eType;
  95 + }
  96 +
  97 + public void seteType(int eType) {
  98 + this.eType = eType;
  99 + }
  100 +}
src/main/java/com/bsth/data/gpsdata_v2/handlers/overspeed/OverspeedProcess.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.handlers.overspeed;
  2 +
  3 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  4 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  5 +import com.google.common.collect.ArrayListMultimap;
  6 +import org.joda.time.format.DateTimeFormat;
  7 +import org.joda.time.format.DateTimeFormatter;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.*;
  13 +
  14 +/**
  15 + * 超速处理
  16 + * Created by panzhao on 2018/1/9.
  17 + */
  18 +@Component
  19 +public class OverspeedProcess {
  20 +
  21 +
  22 + private static final double DEFAULT_SPEED_LIMIT = 60;
  23 +
  24 + private static final double INVALID_SPEED_LIMIT = 110;
  25 +
  26 + private static final int CONT_SPEED_SIZE = 6;
  27 +
  28 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  29 +
  30 + private static GpsOverspeedComp comp = new GpsOverspeedComp();
  31 + /**
  32 + * 按线路分组的超速信息
  33 + */
  34 + private static ArrayListMultimap<String, GpsOverspeed> multimap;
  35 +
  36 + /**
  37 + * 设备号 --> 当前超速
  38 + */
  39 + private static Map<String, GpsOverspeed> realOverspeedMap;
  40 +
  41 + /**
  42 + * 设备号 --> 连续超速次数
  43 + */
  44 + private static Map<String, Integer> contSpeedMap;
  45 +
  46 + Logger logger = LoggerFactory.getLogger(this.getClass());
  47 +
  48 + static{
  49 + multimap = ArrayListMultimap.create();
  50 + contSpeedMap = new HashMap();
  51 + realOverspeedMap = new HashMap();
  52 + }
  53 +
  54 + public static void clear(){
  55 + multimap = null;
  56 + multimap = ArrayListMultimap.create();
  57 +
  58 + contSpeedMap = null;
  59 + contSpeedMap = new HashMap();
  60 +
  61 + realOverspeedMap = null;
  62 + realOverspeedMap = new HashMap();
  63 + }
  64 +
  65 + public boolean process(GpsEntity gps){
  66 + if(gps.getSpeed() >= INVALID_SPEED_LIMIT){
  67 + return false;//无效的速度
  68 + }
  69 +
  70 + Double maxSpeed = GeoCacheData.speedLimit(gps.getLineId());
  71 + if(null == maxSpeed)
  72 + maxSpeed = DEFAULT_SPEED_LIMIT;
  73 +
  74 + if(gps.getSpeed() > maxSpeed){
  75 + overspeed(gps, maxSpeed);
  76 + }
  77 + else if(realOverspeedMap.containsKey(gps.getDeviceId())){
  78 + String device = gps.getDeviceId();
  79 + //结束超速
  80 + GpsOverspeed sp = realOverspeedMap.get(device);
  81 + sp.setEts(fmtHHmm.print(gps.getTimestamp()));
  82 +
  83 + realOverspeedMap.remove(device);
  84 + contSpeedMap.put(device, 0);
  85 + }
  86 + return false;
  87 + }
  88 +
  89 + private void overspeed(GpsEntity gps, Double maxSpeed) {
  90 + String device = gps.getDeviceId();
  91 + Integer cont = contSpeedMap.get(device);
  92 +
  93 + if(null == cont)
  94 + cont = 1;
  95 +
  96 + cont++;
  97 +
  98 + if(gps.getSpeed() - maxSpeed > (maxSpeed * 0.1))
  99 + cont++;
  100 +
  101 + if(cont >= CONT_SPEED_SIZE){
  102 + if(realOverspeedMap.containsKey(device)){
  103 + //正在超速,更新速度
  104 + realOverspeedMap.get(device).setSpeed(gps.getSpeed());
  105 + }
  106 + else{
  107 + logger.info("开始超速..." + gps.getNbbm());
  108 + GpsOverspeed sp = new GpsOverspeed();
  109 + sp.setLineCode(gps.getLineId());
  110 + sp.setDevice(device);
  111 + sp.setSpeed(gps.getSpeed());
  112 + sp.setNbbm(gps.getNbbm());
  113 + sp.setSts(fmtHHmm.print(gps.getTimestamp()));
  114 + sp.setSt(gps.getTimestamp());
  115 +
  116 + realOverspeedMap.put(device, sp);
  117 + multimap.put(sp.getLineCode(), sp);
  118 + }
  119 + //标记gps超速
  120 + gps.setAbnormalStatus("overspeed");
  121 + }
  122 +
  123 + contSpeedMap.put(device, cont);
  124 + }
  125 +
  126 + /**
  127 + * 设备掉线
  128 + * @param device
  129 + */
  130 + public void offline(String device){
  131 + if(realOverspeedMap.containsKey(device)){
  132 + //结束超速
  133 + GpsOverspeed sp = realOverspeedMap.get(device);
  134 + sp.setEts(fmtHHmm.print(System.currentTimeMillis()));
  135 + sp.seteType(1);
  136 +
  137 + realOverspeedMap.remove(device);
  138 + contSpeedMap.put(device, 0);
  139 + }
  140 + }
  141 +
  142 +
  143 + public List<GpsOverspeed> findByLines(List<String> lineArray){
  144 + List<GpsOverspeed> rs = new ArrayList<>();
  145 +
  146 + for(String code : lineArray){
  147 + rs.addAll(multimap.get(code));
  148 + }
  149 +
  150 + //按发送时间排序
  151 + Collections.sort(rs, comp);
  152 + if(rs.size() > 50)
  153 + rs = rs.subList(0, 50);
  154 +
  155 + return rs;
  156 + }
  157 +
  158 +
  159 + public static class GpsOverspeedComp implements Comparator<GpsOverspeed>{
  160 +
  161 + @Override
  162 + public int compare(GpsOverspeed o1, GpsOverspeed o2) {
  163 + return (int) (o2.getSt() - o1.getSt());
  164 + }
  165 + }
  166 +}
src/main/java/com/bsth/data/gpsdata_v2/load/GatewayHttpLoader.java
@@ -51,8 +51,8 @@ public class GatewayHttpLoader implements ApplicationContextAware{ @@ -51,8 +51,8 @@ public class GatewayHttpLoader implements ApplicationContextAware{
51 httpClient = HttpClients.createDefault(); 51 httpClient = HttpClients.createDefault();
52 get = new HttpGet(url); 52 get = new HttpGet(url);
53 requestConfig = RequestConfig.custom() 53 requestConfig = RequestConfig.custom()
54 - .setConnectTimeout(1500).setConnectionRequestTimeout(1000)  
55 - .setSocketTimeout(1500).build(); 54 + .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
  55 + .setSocketTimeout(2500).build();
56 get.setConfig(requestConfig); 56 get.setConfig(requestConfig);
57 } 57 }
58 58
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
@@ -44,8 +44,8 @@ public class SocketClientLoader { @@ -44,8 +44,8 @@ public class SocketClientLoader {
44 httpClient = HttpClients.createDefault(); 44 httpClient = HttpClients.createDefault();
45 get = new HttpGet(url); 45 get = new HttpGet(url);
46 requestConfig = RequestConfig.custom() 46 requestConfig = RequestConfig.custom()
47 - .setConnectTimeout(1500).setConnectionRequestTimeout(1000)  
48 - .setSocketTimeout(1500).build(); 47 + .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
  48 + .setSocketTimeout(2500).build();
49 get.setConfig(requestConfig); 49 get.setConfig(requestConfig);
50 } 50 }
51 51
src/main/java/com/bsth/data/gpsdata_v2/thread/OfflineMonitorThread.java
@@ -2,6 +2,7 @@ package com.bsth.data.gpsdata_v2.thread; @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata_v2.thread;
2 2
3 import com.bsth.data.gpsdata_v2.GpsRealData; 3 import com.bsth.data.gpsdata_v2.GpsRealData;
4 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 4 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  5 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
5 import com.bsth.websocket.handler.SendUtils; 6 import com.bsth.websocket.handler.SendUtils;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
@@ -28,6 +29,9 @@ public class OfflineMonitorThread extends Thread{ @@ -28,6 +29,9 @@ public class OfflineMonitorThread extends Thread{
28 @Autowired 29 @Autowired
29 SendUtils sendUtils; 30 SendUtils sendUtils;
30 31
  32 + @Autowired
  33 + OverspeedProcess overspeedProcess;
  34 +
31 //无任务时 离线阈值 35 //无任务时 离线阈值
32 //private final static int OFFLINE_TIME = 1000 * 60 * 10; 36 //private final static int OFFLINE_TIME = 1000 * 60 * 10;
33 37
@@ -47,6 +51,8 @@ public class OfflineMonitorThread extends Thread{ @@ -47,6 +51,8 @@ public class OfflineMonitorThread extends Thread{
47 if (t - gps.getTimestamp() > LOSE_TIME){ 51 if (t - gps.getTimestamp() > LOSE_TIME){
48 gps.offline(); 52 gps.offline();
49 53
  54 + //结束超速
  55 + overspeedProcess.offline(gps.getDeviceId());
50 //通知页面有设备掉线 56 //通知页面有设备掉线
51 sendUtils.deviceOffline(gps); 57 sendUtils.deviceOffline(gps);
52 } 58 }
src/main/java/com/bsth/data/line_version/EnableRouteVersionHandler.java 0 → 100644
  1 +package com.bsth.data.line_version;
  2 +
  3 +import com.bsth.data.line_version.dto.EvSectionRoute;
  4 +import com.bsth.data.line_version.dto.EvStationRoute;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  9 +import org.springframework.jdbc.core.JdbcTemplate;
  10 +import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
  11 +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
  12 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  13 +import org.springframework.stereotype.Component;
  14 +import org.springframework.transaction.TransactionDefinition;
  15 +import org.springframework.transaction.TransactionStatus;
  16 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  17 +
  18 +import java.util.ArrayList;
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * 启用线路路由版本
  23 + * Created by panzhao on 2017/12/28.
  24 + */
  25 +@Component
  26 +public class EnableRouteVersionHandler {
  27 +
  28 + @Autowired
  29 + JdbcTemplate jdbcTemplate;
  30 +
  31 + @Autowired
  32 + NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  33 +
  34 + Logger logger = LoggerFactory.getLogger(this.getClass());
  35 +
  36 + public void enable(String lineCode, int version){
  37 + //编程式事务
  38 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  39 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  40 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  41 + TransactionStatus status = tran.getTransaction(def);
  42 +
  43 +
  44 + try{
  45 + enableStation(lineCode, version);
  46 + enableRoad(lineCode, version);
  47 +
  48 + //将当前版本变为历史版本
  49 + String sql = "update bsth_c_line_versions set status=0, end_date=SYSDATE(),update_date=SYSDATE() where line_code=" + lineCode + " and status=1";
  50 + jdbcTemplate.update(sql);
  51 + //将待更新版本变为启用版本
  52 + sql = "update bsth_c_line_versions set status=1,update_date=SYSDATE() where line_code=" + lineCode + " and versions="+version;
  53 + jdbcTemplate.update(sql);
  54 +
  55 + tran.commit(status);
  56 + }catch (Exception e){
  57 + tran.rollback(status);
  58 + logger.error("", e);
  59 + }
  60 + }
  61 +
  62 + public void sync(String lineCode, int version){
  63 + //编程式事务
  64 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  65 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  66 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  67 + TransactionStatus status = tran.getTransaction(def);
  68 +
  69 +
  70 + try{
  71 + enableStation(lineCode, version);
  72 + enableRoad(lineCode, version);
  73 +
  74 + tran.commit(status);
  75 + }catch (Exception e){
  76 + tran.rollback(status);
  77 + logger.error("", e);
  78 + }
  79 + }
  80 +
  81 + /**
  82 + * 启用新版本站点
  83 + * @param lineCode
  84 + * @param version
  85 + */
  86 + public void enableStation(String lineCode, int version){
  87 + //删除当前站点路由表数据
  88 + String sql = "delete from bsth_c_stationroute where line_code=" + lineCode;
  89 + jdbcTemplate.update(sql);
  90 +
  91 + //将新版本数据插入当前表
  92 + sql = "select * from bsth_c_ls_stationroute where line_code=" + lineCode + " and versions=" + version;
  93 + List<EvStationRoute> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(EvStationRoute.class));
  94 +
  95 + List<BeanPropertySqlParameterSource> sourceList = new ArrayList<>();
  96 + for(EvStationRoute s : list){
  97 + sourceList.add(new BeanPropertySqlParameterSource(s));
  98 + }
  99 +
  100 + sql = "insert into bsth_c_stationroute(id,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,create_date,update_date) " +
  101 + " values(:id,:line,:station,:stationName,:stationRouteCode,:lineCode,:stationCode,:stationMark,:outStationNmber,:directions,:distances,:toTime,:firstTime,:endTime,:descriptions,:destroy,:versions,SYSDATE(),SYSDATE())";
  102 + BeanPropertySqlParameterSource[] beanSources = sourceList.toArray(new BeanPropertySqlParameterSource[sourceList.size()]);
  103 + namedParameterJdbcTemplate.batchUpdate(sql, beanSources);
  104 + }
  105 +
  106 + /**
  107 + * 启用新版本路段
  108 + * @param lineCode
  109 + * @param version
  110 + */
  111 + public void enableRoad(String lineCode, int version){
  112 + //删除当前路段路由表数据
  113 + String sql = "delete from bsth_c_sectionroute where line_code=" + lineCode;
  114 + jdbcTemplate.update(sql);
  115 +
  116 + //将新版本数据插入当前表
  117 + sql = "select * from bsth_c_ls_sectionroute where line_code=" + lineCode + " and versions=" + version;
  118 + List<EvSectionRoute> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(EvSectionRoute.class));
  119 +
  120 + List<BeanPropertySqlParameterSource> sourceList = new ArrayList<>();
  121 + for(EvSectionRoute s : list){
  122 + sourceList.add(new BeanPropertySqlParameterSource(s));
  123 + }
  124 +
  125 + sql = "insert into bsth_c_sectionroute(id,line_code,section_code,sectionroute_code,directions,line,section,descriptions,create_by,create_date,update_by,update_date,versions,destroy,is_roade_speed) " +
  126 + " values(:id,:lineCode,:sectionCode,:sectionrouteCode,:directions,:line,:section,:descriptions,:createBy,SYSDATE(),:updateBy,SYSDATE(),:versions,:destroy,:isRoadeSpeed)";
  127 + BeanPropertySqlParameterSource[] beanSources = sourceList.toArray(new BeanPropertySqlParameterSource[sourceList.size()]);
  128 + namedParameterJdbcTemplate.batchUpdate(sql, beanSources);
  129 + }
  130 +}
src/main/java/com/bsth/data/line_version/dto/EvSectionRoute.java 0 → 100644
  1 +package com.bsth.data.line_version.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/12/28.
  7 + */
  8 +public class EvSectionRoute {
  9 +
  10 +
  11 + private Integer id;
  12 +
  13 + // 路段路由序号
  14 + private Integer sectionrouteCode;
  15 +
  16 + // 线路编号
  17 + private String lineCode;
  18 +
  19 + // 路段编号
  20 + private String sectionCode;
  21 +
  22 + // 路段路由方向
  23 + private Integer directions;
  24 +
  25 + // 版本号
  26 + private Integer versions;
  27 +
  28 + // 是否撤销
  29 + private Integer destroy;
  30 +
  31 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
  32 + private Integer isRoadeSpeed;
  33 +
  34 + // 描述
  35 + private String descriptions;
  36 +
  37 + // 创建人
  38 + private Integer createBy;
  39 +
  40 + // 修改人
  41 + private Integer updateBy;
  42 +
  43 + // 创建日期
  44 + private Date createDate;
  45 +
  46 + // 修改日期
  47 + private Date updateDate;
  48 +
  49 + // 路段信息
  50 + private Integer section;
  51 +
  52 + // 线路信息
  53 + private Integer line;
  54 +
  55 + public Integer getId() {
  56 + return id;
  57 + }
  58 +
  59 + public void setId(Integer id) {
  60 + this.id = id;
  61 + }
  62 +
  63 + public Integer getSectionrouteCode() {
  64 + return sectionrouteCode;
  65 + }
  66 +
  67 + public void setSectionrouteCode(Integer sectionrouteCode) {
  68 + this.sectionrouteCode = sectionrouteCode;
  69 + }
  70 +
  71 + public String getLineCode() {
  72 + return lineCode;
  73 + }
  74 +
  75 + public void setLineCode(String lineCode) {
  76 + this.lineCode = lineCode;
  77 + }
  78 +
  79 + public String getSectionCode() {
  80 + return sectionCode;
  81 + }
  82 +
  83 + public void setSectionCode(String sectionCode) {
  84 + this.sectionCode = sectionCode;
  85 + }
  86 +
  87 + public Integer getDirections() {
  88 + return directions;
  89 + }
  90 +
  91 + public void setDirections(Integer directions) {
  92 + this.directions = directions;
  93 + }
  94 +
  95 + public Integer getVersions() {
  96 + return versions;
  97 + }
  98 +
  99 + public void setVersions(Integer versions) {
  100 + this.versions = versions;
  101 + }
  102 +
  103 + public Integer getDestroy() {
  104 + return destroy;
  105 + }
  106 +
  107 + public void setDestroy(Integer destroy) {
  108 + this.destroy = destroy;
  109 + }
  110 +
  111 + public Integer getIsRoadeSpeed() {
  112 + return isRoadeSpeed;
  113 + }
  114 +
  115 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  116 + this.isRoadeSpeed = isRoadeSpeed;
  117 + }
  118 +
  119 + public String getDescriptions() {
  120 + return descriptions;
  121 + }
  122 +
  123 + public void setDescriptions(String descriptions) {
  124 + this.descriptions = descriptions;
  125 + }
  126 +
  127 + public Integer getCreateBy() {
  128 + return createBy;
  129 + }
  130 +
  131 + public void setCreateBy(Integer createBy) {
  132 + this.createBy = createBy;
  133 + }
  134 +
  135 + public Integer getUpdateBy() {
  136 + return updateBy;
  137 + }
  138 +
  139 + public void setUpdateBy(Integer updateBy) {
  140 + this.updateBy = updateBy;
  141 + }
  142 +
  143 + public Date getCreateDate() {
  144 + return createDate;
  145 + }
  146 +
  147 + public void setCreateDate(Date createDate) {
  148 + this.createDate = createDate;
  149 + }
  150 +
  151 + public Date getUpdateDate() {
  152 + return updateDate;
  153 + }
  154 +
  155 + public void setUpdateDate(Date updateDate) {
  156 + this.updateDate = updateDate;
  157 + }
  158 +
  159 + public Integer getSection() {
  160 + return section;
  161 + }
  162 +
  163 + public void setSection(Integer section) {
  164 + this.section = section;
  165 + }
  166 +
  167 + public Integer getLine() {
  168 + return line;
  169 + }
  170 +
  171 + public void setLine(Integer line) {
  172 + this.line = line;
  173 + }
  174 +}
src/main/java/com/bsth/data/line_version/dto/EvStationRoute.java 0 → 100644
  1 +package com.bsth.data.line_version.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/12/28.
  7 + */
  8 +public class EvStationRoute {
  9 + private Integer id;
  10 +
  11 + // 站点路由序号
  12 + private Integer stationRouteCode;
  13 +
  14 + // 站点编码
  15 + private String stationCode;
  16 +
  17 + // 站点名称
  18 + private String stationName;
  19 +
  20 + // 线路编码
  21 + private String lineCode;
  22 +
  23 + /**
  24 + * 站点类型
  25 + *
  26 + * ------ B:起点站
  27 + *
  28 + * ------ Z:中途站
  29 + *
  30 + * ------ E:终点站
  31 + *
  32 + * ------ T:停车场
  33 + *
  34 + */
  35 + private String stationMark;
  36 +
  37 + // 站点路由出站序号
  38 + private Integer outStationNmber;
  39 +
  40 + // 站点路由到站距离
  41 + private Double distances;
  42 +
  43 + // 站点路由到站时间
  44 + private Double toTime;
  45 +
  46 + // 首班时间
  47 + private String firstTime;
  48 +
  49 + // 末班时间
  50 + private String endTime;
  51 +
  52 + // 站点路由方向
  53 + private Integer directions;
  54 +
  55 + // 版本号
  56 + private Integer versions;
  57 +
  58 + // 是否撤销
  59 + private Integer destroy;
  60 +
  61 + // 描述
  62 + private String descriptions;
  63 +
  64 + // 创建人
  65 + private Integer createBy;
  66 +
  67 + // 修改人
  68 + private Integer updateBy;
  69 +
  70 + // 创建日期
  71 + private Date createDate;
  72 +
  73 + // 修改日期
  74 + private Date updateDate;
  75 +
  76 + // 站点信息
  77 + private Integer station;
  78 +
  79 + // 线路信息
  80 + private Integer line;
  81 +
  82 + public Integer getId() {
  83 + return id;
  84 + }
  85 +
  86 + public void setId(Integer id) {
  87 + this.id = id;
  88 + }
  89 +
  90 + public Integer getStationRouteCode() {
  91 + return stationRouteCode;
  92 + }
  93 +
  94 + public void setStationRouteCode(Integer stationRouteCode) {
  95 + this.stationRouteCode = stationRouteCode;
  96 + }
  97 +
  98 + public String getStationCode() {
  99 + return stationCode;
  100 + }
  101 +
  102 + public void setStationCode(String stationCode) {
  103 + this.stationCode = stationCode;
  104 + }
  105 +
  106 + public String getStationName() {
  107 + return stationName;
  108 + }
  109 +
  110 + public void setStationName(String stationName) {
  111 + this.stationName = stationName;
  112 + }
  113 +
  114 + public String getLineCode() {
  115 + return lineCode;
  116 + }
  117 +
  118 + public void setLineCode(String lineCode) {
  119 + this.lineCode = lineCode;
  120 + }
  121 +
  122 + public String getStationMark() {
  123 + return stationMark;
  124 + }
  125 +
  126 + public void setStationMark(String stationMark) {
  127 + this.stationMark = stationMark;
  128 + }
  129 +
  130 + public Integer getOutStationNmber() {
  131 + return outStationNmber;
  132 + }
  133 +
  134 + public void setOutStationNmber(Integer outStationNmber) {
  135 + this.outStationNmber = outStationNmber;
  136 + }
  137 +
  138 + public Double getDistances() {
  139 + return distances;
  140 + }
  141 +
  142 + public void setDistances(Double distances) {
  143 + this.distances = distances;
  144 + }
  145 +
  146 + public Double getToTime() {
  147 + return toTime;
  148 + }
  149 +
  150 + public void setToTime(Double toTime) {
  151 + this.toTime = toTime;
  152 + }
  153 +
  154 + public String getFirstTime() {
  155 + return firstTime;
  156 + }
  157 +
  158 + public void setFirstTime(String firstTime) {
  159 + this.firstTime = firstTime;
  160 + }
  161 +
  162 + public String getEndTime() {
  163 + return endTime;
  164 + }
  165 +
  166 + public void setEndTime(String endTime) {
  167 + this.endTime = endTime;
  168 + }
  169 +
  170 + public Integer getDirections() {
  171 + return directions;
  172 + }
  173 +
  174 + public void setDirections(Integer directions) {
  175 + this.directions = directions;
  176 + }
  177 +
  178 + public Integer getVersions() {
  179 + return versions;
  180 + }
  181 +
  182 + public void setVersions(Integer versions) {
  183 + this.versions = versions;
  184 + }
  185 +
  186 + public Integer getDestroy() {
  187 + return destroy;
  188 + }
  189 +
  190 + public void setDestroy(Integer destroy) {
  191 + this.destroy = destroy;
  192 + }
  193 +
  194 + public String getDescriptions() {
  195 + return descriptions;
  196 + }
  197 +
  198 + public void setDescriptions(String descriptions) {
  199 + this.descriptions = descriptions;
  200 + }
  201 +
  202 + public Integer getCreateBy() {
  203 + return createBy;
  204 + }
  205 +
  206 + public void setCreateBy(Integer createBy) {
  207 + this.createBy = createBy;
  208 + }
  209 +
  210 + public Integer getUpdateBy() {
  211 + return updateBy;
  212 + }
  213 +
  214 + public void setUpdateBy(Integer updateBy) {
  215 + this.updateBy = updateBy;
  216 + }
  217 +
  218 + public Date getCreateDate() {
  219 + return createDate;
  220 + }
  221 +
  222 + public void setCreateDate(Date createDate) {
  223 + this.createDate = createDate;
  224 + }
  225 +
  226 + public Date getUpdateDate() {
  227 + return updateDate;
  228 + }
  229 +
  230 + public void setUpdateDate(Date updateDate) {
  231 + this.updateDate = updateDate;
  232 + }
  233 +
  234 + public Integer getStation() {
  235 + return station;
  236 + }
  237 +
  238 + public void setStation(Integer station) {
  239 + this.station = station;
  240 + }
  241 +
  242 + public Integer getLine() {
  243 + return line;
  244 + }
  245 +
  246 + public void setLine(Integer line) {
  247 + this.line = line;
  248 + }
  249 +}
src/main/java/com/bsth/data/line_version/thread/FixedEnableVerionsThread.java 0 → 100644
  1 +package com.bsth.data.line_version.thread;
  2 +
  3 +import com.bsth.data.line_version.EnableRouteVersionHandler;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.jdbc.core.JdbcTemplate;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by panzhao on 2017/12/28.
  15 + */
  16 +@Component
  17 +public class FixedEnableVerionsThread extends Thread {
  18 +
  19 + @Autowired
  20 + JdbcTemplate jdbcTemplate;
  21 +
  22 + Logger logger = LoggerFactory.getLogger(this.getClass());
  23 +
  24 + @Autowired
  25 + EnableRouteVersionHandler enableRouteVersionHandler;
  26 +
  27 + @Override
  28 + public void run() {
  29 + try {
  30 +
  31 + String sql = "select * from bsth_c_line_versions where status=2 and start_date<=SYSDATE()";
  32 +
  33 + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
  34 + if (list.size() > 0) {
  35 + String lineCode;
  36 + int version;
  37 +
  38 + for (Map<String, Object> map : list) {
  39 + lineCode = map.get("line_code").toString();
  40 + version = Integer.parseInt(map.get("versions").toString());
  41 +
  42 + enableRouteVersionHandler.enable(lineCode, version);
  43 + }
  44 + }
  45 +
  46 +
  47 + //自动同步当前启用版本
  48 + long t = System.currentTimeMillis();
  49 + List<String> syncs = jdbcTemplate.queryForList("SELECT CONCAT(line_code,'_',versions) FROM bsth_c_line_versions WHERE STATUS = 1 AND CONCAT(line_code, '_', versions) IN (SELECT CONCAT(line_code, '_', version) FROM logger_route_synchro where t < " + t + ")", String.class);
  50 +
  51 + String[] ks;
  52 + for (String keys : syncs) {
  53 + ks = keys.split("_");
  54 +
  55 + enableRouteVersionHandler.sync(ks[0], Integer.parseInt(ks[1]));
  56 +
  57 + logger.info("同步线路 " + ks[0] + " 版本:" + ks[1]);
  58 + }
  59 +
  60 + jdbcTemplate.update("delete from logger_route_synchro where t < " + t);
  61 + } catch (Exception e) {
  62 + logger.error("", e);
  63 + }
  64 + }
  65 +}
src/main/java/com/bsth/data/pilot80/PilotReport.java
@@ -20,9 +20,7 @@ import org.slf4j.LoggerFactory; @@ -20,9 +20,7 @@ import org.slf4j.LoggerFactory;
20 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.stereotype.Component; 21 import org.springframework.stereotype.Component;
22 22
23 -import java.util.ArrayList;  
24 -import java.util.Collection;  
25 -import java.util.List; 23 +import java.util.*;
26 import java.util.concurrent.ConcurrentHashMap; 24 import java.util.concurrent.ConcurrentHashMap;
27 25
28 /** 26 /**
@@ -55,10 +53,16 @@ public class PilotReport { @@ -55,10 +53,16 @@ public class PilotReport {
55 53
56 private static ConcurrentHashMap<Integer, D80> d80Maps; 54 private static ConcurrentHashMap<Integer, D80> d80Maps;
57 55
  56 + /**
  57 + * 设备 ——> 最后一条请求出场记录
  58 + */
  59 + public static ConcurrentHashMap<String, D80> qqccMap;
  60 +
58 Logger logger = LoggerFactory.getLogger(PilotReport.class); 61 Logger logger = LoggerFactory.getLogger(PilotReport.class);
59 62
60 static { 63 static {
61 d80Maps = new ConcurrentHashMap<>(); 64 d80Maps = new ConcurrentHashMap<>();
  65 + qqccMap = new ConcurrentHashMap<>();
62 } 66 }
63 67
64 public void report(D80 d80) { 68 public void report(D80 d80) {
@@ -81,6 +85,7 @@ public class PilotReport { @@ -81,6 +85,7 @@ public class PilotReport {
81 switch (d80.getData().getRequestCode()) { 85 switch (d80.getData().getRequestCode()) {
82 //出场请求 86 //出场请求
83 case 0xA3: 87 case 0xA3:
  88 + qqccMap.put(d80.getDeviceId(), d80);
84 ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out"); 89 ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out");
85 //如果有对应出场班次 90 //如果有对应出场班次
86 if (outSch != null && StringUtils.isEmpty(outSch.getFcsjActual())) { 91 if (outSch != null && StringUtils.isEmpty(outSch.getFcsjActual())) {
@@ -241,6 +246,7 @@ public class PilotReport { @@ -241,6 +246,7 @@ public class PilotReport {
241 List<D80> rems = findByLine(lineCode); 246 List<D80> rems = findByLine(lineCode);
242 for (D80 d80 : rems) { 247 for (D80 d80 : rems) {
243 d80Maps.remove(d80.getId()); 248 d80Maps.remove(d80.getId());
  249 + qqccMap.remove(d80.getDeviceId());
244 } 250 }
245 251
246 rems.clear(); 252 rems.clear();
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
@@ -21,7 +21,7 @@ import java.util.List; @@ -21,7 +21,7 @@ import java.util.List;
21 @Component 21 @Component
22 public class SafeDrivDataLoadThread extends Thread{ 22 public class SafeDrivDataLoadThread extends Thread{
23 23
24 - private final static String url = "http://118.178.187.115/bsth-safedriving/Crlcxb/realtimeInterface.do"; 24 + private final static String url = "http://180.166.5.82:9005/bsth-safedriving/Crlcxb/realtimeInterface.do";
25 25
26 Logger logger = LoggerFactory.getLogger(this.getClass()); 26 Logger logger = LoggerFactory.getLogger(this.getClass());
27 27
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -15,6 +15,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; @@ -15,6 +15,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
15 import com.bsth.service.schedule.SchedulePlanInfoService; 15 import com.bsth.service.schedule.SchedulePlanInfoService;
16 import com.bsth.websocket.handler.SendUtils; 16 import com.bsth.websocket.handler.SendUtils;
17 import com.google.common.collect.ArrayListMultimap; 17 import com.google.common.collect.ArrayListMultimap;
  18 +import com.google.common.collect.HashMultimap;
18 import org.apache.commons.lang3.StringUtils; 19 import org.apache.commons.lang3.StringUtils;
19 import org.joda.time.format.DateTimeFormat; 20 import org.joda.time.format.DateTimeFormat;
20 import org.joda.time.format.DateTimeFormatter; 21 import org.joda.time.format.DateTimeFormatter;
@@ -55,6 +56,9 @@ public class DayOfSchedule { @@ -55,6 +56,9 @@ public class DayOfSchedule {
55 // 按车辆分组的班次数据 56 // 按车辆分组的班次数据
56 private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; 57 private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
57 58
  59 + //按线路分组计划用车
  60 + private static HashMultimap<String, String> lineNbbmsMap;
  61 +
58 //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list 62 //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list
59 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; 63 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
60 64
@@ -199,6 +203,8 @@ public class DayOfSchedule { @@ -199,6 +203,8 @@ public class DayOfSchedule {
199 reCalcExecPlan(nbbm); 203 reCalcExecPlan(nbbm);
200 } 204 }
201 205
  206 + //分组计划用车
  207 + reCalcLineNbbms();
202 // 页面 翻班通知 208 // 页面 翻班通知
203 //sendUtils.shiftSchedule(lineCode); 209 //sendUtils.shiftSchedule(lineCode);
204 } catch (Exception e) { 210 } catch (Exception e) {
@@ -543,15 +549,15 @@ public class DayOfSchedule { @@ -543,15 +549,15 @@ public class DayOfSchedule {
543 * @Description: TODO(线路下运营的车辆) 549 * @Description: TODO(线路下运营的车辆)
544 */ 550 */
545 public Set<String> findCarByLineCode(String lineCode) { 551 public Set<String> findCarByLineCode(String lineCode) {
546 - Set<String> rs = new HashSet<>(); 552 + /*Set<String> rs = new HashSet<>();
547 553
548 Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values(); 554 Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
549 for (ScheduleRealInfo sch : schs) { 555 for (ScheduleRealInfo sch : schs) {
550 if (sch.getXlBm().equals(lineCode)) 556 if (sch.getXlBm().equals(lineCode))
551 rs.add(sch.getClZbh()); 557 rs.add(sch.getClZbh());
552 } 558 }
553 -  
554 - return rs; 559 +*/
  560 + return lineNbbmsMap.get(lineCode);
555 } 561 }
556 562
557 public List<ScheduleRealInfo> findByNbbm(String nbbm) { 563 public List<ScheduleRealInfo> findByNbbm(String nbbm) {
@@ -908,6 +914,8 @@ public class DayOfSchedule { @@ -908,6 +914,8 @@ public class DayOfSchedule {
908 //重新计算车辆当前执行班次 914 //重新计算车辆当前执行班次
909 reCalcExecPlan(newClZbh); 915 reCalcExecPlan(newClZbh);
910 reCalcExecPlan(sch.getClZbh()); 916 reCalcExecPlan(sch.getClZbh());
  917 + //重新分组计划用车
  918 + reCalcLineNbbms();
911 return ups; 919 return ups;
912 } 920 }
913 921
@@ -970,7 +978,6 @@ public class DayOfSchedule { @@ -970,7 +978,6 @@ public class DayOfSchedule {
970 978
971 //删除班次数据 979 //删除班次数据
972 removeRealSch(lineCode, rq); 980 removeRealSch(lineCode, rq);
973 - //删除相关班次修正记录  
974 981
975 } 982 }
976 rs.put("status", ResponseCode.SUCCESS); 983 rs.put("status", ResponseCode.SUCCESS);
@@ -1083,6 +1090,20 @@ public class DayOfSchedule { @@ -1083,6 +1090,20 @@ public class DayOfSchedule {
1083 return id2SchedulMap.size(); 1090 return id2SchedulMap.size();
1084 } 1091 }
1085 1092
  1093 + /**
  1094 + * 重新计算线路计划用车
  1095 + */
  1096 + public void reCalcLineNbbms(){
  1097 + HashMultimap<String, String> multimap = HashMultimap.create();
  1098 +
  1099 + Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
  1100 + for (ScheduleRealInfo sch : schs) {
  1101 + multimap.put(sch.getXlBm(), sch.getClZbh());
  1102 + }
  1103 +
  1104 + lineNbbmsMap = multimap;
  1105 + }
  1106 +
1086 public String sizeString(){ 1107 public String sizeString(){
1087 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size(); 1108 return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
1088 } 1109 }
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 import com.bsth.entity.realcontrol.ScheduleRealInfo; 3 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
4 6
5 import java.util.Comparator; 7 import java.util.Comparator;
6 import java.util.HashMap; 8 import java.util.HashMap;
@@ -23,6 +25,7 @@ public class ScheduleComparator { @@ -23,6 +25,7 @@ public class ScheduleComparator {
23 } 25 }
24 }*/ 26 }*/
25 27
  28 +
26 static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); 29 static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
27 30
28 static{ 31 static{
@@ -50,10 +53,44 @@ public class ScheduleComparator { @@ -50,10 +53,44 @@ public class ScheduleComparator {
50 53
51 public static class DFSJ implements Comparator<ScheduleRealInfo>{ 54 public static class DFSJ implements Comparator<ScheduleRealInfo>{
52 55
  56 + static Logger logger = LoggerFactory.getLogger(DFSJ.class);
  57 +
53 @Override 58 @Override
54 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 59 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
55 - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());  
56 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); 60 + try{
  61 +
  62 + if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){
  63 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  64 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  65 + }
  66 + else{
  67 + /**
  68 + * 按时刻表发车顺序号
  69 + */
  70 + Integer fc1 = s1.getFcno();
  71 + Integer fc2 = s2.getFcno();
  72 + if(null != fc1 && null != fc2){
  73 + return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue();
  74 + }
  75 + else{
  76 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  77 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  78 + }
  79 + }
  80 + }catch (Exception e){
  81 + logger.error("排序异常", e);
  82 + return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1;
  83 + }
57 } 84 }
58 } 85 }
  86 +
  87 + public static class DFSJ2 implements Comparator<ScheduleRealInfo>{
  88 +
  89 +
  90 + @Override
  91 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  92 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  93 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  94 + }
  95 + }
59 } 96 }
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -117,7 +117,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -117,7 +117,7 @@ public class LateAdjustHandle implements ApplicationContextAware{
117 } 117 }
118 } 118 }
119 119
120 - public static void remove(String nbbm){ 120 +/* public static void remove(String nbbm){
121 if(lateSchMap.containsKey(nbbm)){ 121 if(lateSchMap.containsKey(nbbm)){
122 ScheduleRealInfo sch = lateSchMap.get(nbbm); 122 ScheduleRealInfo sch = lateSchMap.get(nbbm);
123 sch.setLate2(false); 123 sch.setLate2(false);
@@ -127,7 +127,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -127,7 +127,7 @@ public class LateAdjustHandle implements ApplicationContextAware{
127 lateSchMap.remove(nbbm); 127 lateSchMap.remove(nbbm);
128 logger.info("移除误点调整 nbbm -" + nbbm); 128 logger.info("移除误点调整 nbbm -" + nbbm);
129 } 129 }
130 - } 130 + }*/
131 131
132 /** 132 /**
133 * 车辆到站 133 * 车辆到站
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
@@ -35,7 +35,7 @@ public class ScheduleLateThread extends Thread{ @@ -35,7 +35,7 @@ public class ScheduleLateThread extends Thread{
35 35
36 Logger logger = LoggerFactory.getLogger(this.getClass()); 36 Logger logger = LoggerFactory.getLogger(this.getClass());
37 37
38 - private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ(); 38 + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ2();
39 39
40 @Override 40 @Override
41 public void run() { 41 public void run() {
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 package com.bsth.data.schedule.thread; 1 package com.bsth.data.schedule.thread;
2 2
  3 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
3 import com.bsth.service.oil.DlbService; 4 import com.bsth.service.oil.DlbService;
4 import com.bsth.data.safe_driv.SafeDrivCenter; 5 import com.bsth.data.safe_driv.SafeDrivCenter;
5 import com.bsth.service.oil.YlbService; 6 import com.bsth.service.oil.YlbService;
@@ -38,6 +39,8 @@ public class CalcOilThread extends Thread{ @@ -38,6 +39,8 @@ public class CalcOilThread extends Thread{
38 logger.info("计算班次准点率结束!"); 39 logger.info("计算班次准点率结束!");
39 //清除安全驾驶数据 先临时蹭这个线程 40 //清除安全驾驶数据 先临时蹭这个线程
40 SafeDrivCenter.clear(); 41 SafeDrivCenter.clear();
  42 + //清除超速缓存数据
  43 + OverspeedProcess.clear();
41 } catch(Exception e){ 44 } catch(Exception e){
42 logger.error("计算路单里程加注量失败",e); 45 logger.error("计算路单里程加注量失败",e);
43 } 46 }
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
@@ -152,7 +152,7 @@ public class SchedulePstThread extends Thread { @@ -152,7 +152,7 @@ public class SchedulePstThread extends Thread {
152 ps.setBoolean(40, sch.isOnline()); 152 ps.setBoolean(40, sch.isOnline());
153 ps.setString(41, sch.getAdjustExps()); 153 ps.setString(41, sch.getAdjustExps());
154 ps.setBoolean(42, sch.isReissue()); 154 ps.setBoolean(42, sch.isReissue());
155 - ps.setDouble(43, sch.getJhlcOrig()); 155 + ps.setDouble(43, sch.getJhlcOrig()==null?0:sch.getJhlcOrig());
156 ps.setInt(44, sch.getSiginCompate()); 156 ps.setInt(44, sch.getSiginCompate());
157 ps.setInt(45, sch.getDriftStatus()); 157 ps.setInt(45, sch.getDriftStatus());
158 ps.setBoolean(46, sch.isCcService()); 158 ps.setBoolean(46, sch.isCcService());
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
@@ -74,14 +74,6 @@ public class ScheduleRefreshThread extends Thread{ @@ -74,14 +74,6 @@ public class ScheduleRefreshThread extends Thread{
74 //重载排班数据 74 //重载排班数据
75 dayOfSchedule.reloadSch(lineCode, currSchDate, false); 75 dayOfSchedule.reloadSch(lineCode, currSchDate, false);
76 logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); 76 logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
77 -  
78 -  
79 - //校验一下数据库和缓存的数据  
80 - /*int dbCount = dayOfSchedule.dbCount(lineCode, currSchDate);  
81 - logger.info(lineCode + " 数据库数量:" + dbCount);  
82 - if(dbCount != dayOfSchedule.findByLineCode(lineCode).size()){  
83 - logger.error("异常异常异常,,数据库和缓存数量不一致," + lineCode);  
84 - }*/  
85 } 77 }
86 }catch (Exception e){ 78 }catch (Exception e){
87 logger.error("班次更新失败!! -" + lineCode, e); 79 logger.error("班次更新失败!! -" + lineCode, e);
src/main/java/com/bsth/data/summary/entity/TempSchSituation.java 0 → 100644
  1 +package com.bsth.data.summary.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 临加情况
  9 + * Created by panzhao on 2017/10/31.
  10 + */
  11 +@Entity
  12 +@Table(name = "z_calc_temp_detail")
  13 +public class TempSchSituation {
  14 +
  15 + @Id
  16 + private Long id;
  17 +
  18 + private String rq;
  19 +
  20 + private String gsBm;
  21 +
  22 + private String fgsBm;
  23 +
  24 + private String lineCode;
  25 +
  26 + private String lineName;
  27 +
  28 + private String nbbm;
  29 +
  30 + private String jGh;
  31 +
  32 + private String sGh;
  33 +
  34 + private int size;
  35 +
  36 + private Double mileage;
  37 +
  38 + private Long t;
  39 +
  40 + private String remark;
  41 +
  42 + private String idsStr;
  43 +
  44 + public Long getId() {
  45 + return id;
  46 + }
  47 +
  48 + public void setId(Long id) {
  49 + this.id = id;
  50 + }
  51 +
  52 + public String getRq() {
  53 + return rq;
  54 + }
  55 +
  56 + public void setRq(String rq) {
  57 + this.rq = rq;
  58 + }
  59 +
  60 + public String getLineCode() {
  61 + return lineCode;
  62 + }
  63 +
  64 + public void setLineCode(String lineCode) {
  65 + this.lineCode = lineCode;
  66 + }
  67 +
  68 + public String getLineName() {
  69 + return lineName;
  70 + }
  71 +
  72 + public void setLineName(String lineName) {
  73 + this.lineName = lineName;
  74 + }
  75 +
  76 + public String getNbbm() {
  77 + return nbbm;
  78 + }
  79 +
  80 + public void setNbbm(String nbbm) {
  81 + this.nbbm = nbbm;
  82 + }
  83 +
  84 + public String getjGh() {
  85 + return jGh;
  86 + }
  87 +
  88 + public void setjGh(String jGh) {
  89 + this.jGh = jGh;
  90 + }
  91 +
  92 + public String getsGh() {
  93 + return sGh;
  94 + }
  95 +
  96 + public void setsGh(String sGh) {
  97 + this.sGh = sGh;
  98 + }
  99 +
  100 + public int getSize() {
  101 + return size;
  102 + }
  103 +
  104 + public void setSize(int size) {
  105 + this.size = size;
  106 + }
  107 +
  108 + public Double getMileage() {
  109 + return mileage;
  110 + }
  111 +
  112 + public void setMileage(Double mileage) {
  113 + this.mileage = mileage;
  114 + }
  115 +
  116 + public Long getT() {
  117 + return t;
  118 + }
  119 +
  120 + public void setT(Long t) {
  121 + this.t = t;
  122 + }
  123 +
  124 + public String getRemark() {
  125 + return remark;
  126 + }
  127 +
  128 + public void setRemark(String remark) {
  129 + this.remark = remark;
  130 + }
  131 +
  132 + public String getIdsStr() {
  133 + return idsStr;
  134 + }
  135 +
  136 + public void setIdsStr(String idsStr) {
  137 + this.idsStr = idsStr;
  138 + }
  139 +
  140 + public String getGsBm() {
  141 + return gsBm;
  142 + }
  143 +
  144 + public void setGsBm(String gsBm) {
  145 + this.gsBm = gsBm;
  146 + }
  147 +
  148 + public String getFgsBm() {
  149 + return fgsBm;
  150 + }
  151 +
  152 + public void setFgsBm(String fgsBm) {
  153 + this.fgsBm = fgsBm;
  154 + }
  155 +}
0 \ No newline at end of file 156 \ No newline at end of file
src/main/java/com/bsth/data/summary/repository/TempSchSituationRepository.java 0 → 100644
  1 +package com.bsth.data.summary.repository;
  2 +
  3 +import com.bsth.data.summary.entity.TempSchSituation;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/11/1.
  9 + */
  10 +@Repository
  11 +public interface TempSchSituationRepository extends BaseRepository<TempSchSituation, Long> {
  12 +}
src/main/java/com/bsth/data/summary/service/TempSchSituationService.java 0 → 100644
  1 +package com.bsth.data.summary.service;
  2 +
  3 +import com.bsth.data.summary.entity.TempSchSituation;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import javax.servlet.http.HttpServletRequest;
  7 +import javax.servlet.http.HttpServletResponse;
  8 +import java.util.Map;
  9 +
  10 +/**
  11 + * Created by panzhao on 2017/11/1.
  12 + */
  13 +public interface TempSchSituationService extends BaseService<TempSchSituation, Long> {
  14 + void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response);
  15 +}
0 \ No newline at end of file 16 \ No newline at end of file
src/main/java/com/bsth/data/summary/service/impl/DestroySituationServiceImpl.java
@@ -118,7 +118,7 @@ public class DestroySituationServiceImpl extends BaseServiceImpl&lt;DestroySituatio @@ -118,7 +118,7 @@ public class DestroySituationServiceImpl extends BaseServiceImpl&lt;DestroySituatio
118 row.createCell(9).setCellValue(dys.getRemark()); 118 row.createCell(9).setCellValue(dys.getRemark());
119 } 119 }
120 120
121 - String name = list.get(0).getLineName(); 121 + String name = "";//list.get(0).getLineName();
122 wb.setSheetName(0, name + "烂班明细"); 122 wb.setSheetName(0, name + "烂班明细");
123 //response 输出 123 //response 输出
124 String filename = name + map.get("rq_ge") + "至" + map.get("rq_le") + "烂班明细情况.xls"; 124 String filename = name + map.get("rq_ge") + "至" + map.get("rq_le") + "烂班明细情况.xls";
src/main/java/com/bsth/data/summary/service/impl/TempSchSituationServiceImpl.java 0 → 100644
  1 +package com.bsth.data.summary.service.impl;
  2 +
  3 +import com.bsth.data.summary.entity.TempSchSituation;
  4 +import com.bsth.data.summary.service.TempSchSituationService;
  5 +import com.bsth.data.utils.CustomStringUtils;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  8 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
  9 +import org.apache.poi.ss.usermodel.Row;
  10 +import org.apache.poi.ss.usermodel.Sheet;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import javax.servlet.http.HttpServletRequest;
  16 +import javax.servlet.http.HttpServletResponse;
  17 +import java.io.FileInputStream;
  18 +import java.io.OutputStream;
  19 +import java.net.URLEncoder;
  20 +import java.text.SimpleDateFormat;
  21 +import java.util.*;
  22 +
  23 +/**
  24 + * Created by panzhao on 2017/11/1.
  25 + */
  26 +@Service
  27 +public class TempSchSituationServiceImpl extends BaseServiceImpl<TempSchSituation, Long> implements TempSchSituationService {
  28 +
  29 + Logger logger = LoggerFactory.getLogger(this.getClass());
  30 +
  31 + @Override
  32 + public Iterable<TempSchSituation> list(Map<String, Object> map) {
  33 + List<TempSchSituation> list = (List<TempSchSituation>) super.list(map);
  34 +
  35 + //排序
  36 + Collections.sort(list, new Comparator<TempSchSituation>() {
  37 + @Override
  38 + public int compare(TempSchSituation o1, TempSchSituation o2) {
  39 + int i = o1.getRq().compareTo(o2.getRq());
  40 + if (i != 0)
  41 + return i;
  42 +
  43 + i = o1.getLineName().compareTo(o2.getLineName());
  44 + if (i != 0)
  45 + return i;
  46 +
  47 + i = (int) (o1.getT() - o2.getT());
  48 + return i;
  49 + }
  50 + });
  51 + return list;
  52 + }
  53 +
  54 + @Override
  55 + public void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
  56 + try {
  57 + map.put("rq_le", CustomStringUtils.maxEndTime(map.get("rq_ge").toString()
  58 + , map.get("rq_le").toString(), 62));
  59 +
  60 + List<TempSchSituation> list = (List<TempSchSituation>) super.list(map);
  61 +
  62 + if (list.size() == 0) {
  63 + response.setHeader("Content-type", "text/html;charset=UTF-8");
  64 + response.getWriter().print("<span style='color:red;font-size:24px;'>根据查询条件没有搜索到数据,别导了!</span>");
  65 + return;
  66 + }
  67 +
  68 + //排序
  69 + Collections.sort(list, new Comparator<TempSchSituation>() {
  70 + @Override
  71 + public int compare(TempSchSituation o1, TempSchSituation o2) {
  72 + int i = o1.getRq().compareTo(o2.getRq());
  73 + if (i != 0)
  74 + return i;
  75 +
  76 + i = o1.getLineName().compareTo(o2.getLineName());
  77 + if (i != 0)
  78 + return i;
  79 +
  80 + i = (int) (o1.getT() - o2.getT());
  81 + return i;
  82 + }
  83 + });
  84 +
  85 + //输出excel
  86 + String basePath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
  87 + String filePath = basePath + "/static/pages/summary/excel/临加明细情况.xls";
  88 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filePath));
  89 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  90 +
  91 + //写入数据
  92 + Sheet sheet = wb.getSheetAt(0);
  93 + Row row;
  94 + TempSchSituation tss;
  95 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  96 + for (int i = 0; i < list.size(); i++) {
  97 + tss = list.get(i);
  98 + row = sheet.createRow(i + 1);
  99 + row.createCell(0).setCellValue(tss.getRq());
  100 + row.createCell(1).setCellValue(tss.getLineName());
  101 + row.createCell(2).setCellValue(tss.getNbbm());
  102 + row.createCell(3).setCellValue(tss.getjGh());
  103 + row.createCell(4).setCellValue(tss.getsGh());
  104 + row.createCell(5).setCellValue(tss.getSize());
  105 + row.createCell(6).setCellValue(tss.getMileage());
  106 + row.createCell(7).setCellValue(sdf.format(new Date(tss.getT())));
  107 + row.createCell(8).setCellValue(tss.getRemark());
  108 + }
  109 +
  110 + String name = "";//list.get(0).getLineName();
  111 + wb.setSheetName(0, name + "临加明细");
  112 + //response 输出
  113 + String filename = name + map.get("rq_ge") + "至" + map.get("rq_le") + "临加明细情况.xls";
  114 + response.setContentType("application/x-msdownload");
  115 + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
  116 +
  117 + OutputStream os = response.getOutputStream();
  118 + wb.write(os);
  119 + os.flush();
  120 + os.close();
  121 + } catch (Exception e) {
  122 + logger.error("", e);
  123 + }
  124 + }
  125 +}
0 \ No newline at end of file 126 \ No newline at end of file
src/main/java/com/bsth/email/MailAuthenticator.java 0 → 100644
  1 +package com.bsth.email;
  2 +
  3 +import javax.mail.Authenticator;
  4 +import javax.mail.PasswordAuthentication;
  5 +
  6 +/**
  7 + * 服务器邮箱登录验证
  8 + */
  9 +public class MailAuthenticator extends Authenticator{
  10 + /**
  11 + * 用户名(登录邮箱)
  12 + */
  13 + private String username;
  14 + /**
  15 + * 密码
  16 + */
  17 + private String password;
  18 +
  19 + /**
  20 + * 初始化邮箱和密码
  21 + *
  22 + * @param username
  23 + * 邮箱
  24 + * @param password
  25 + * 密码
  26 + */
  27 + public MailAuthenticator(String username, String password) {
  28 + this.username = username;
  29 + this.password = password;
  30 + }
  31 +
  32 + String getPassword() {
  33 + return password;
  34 + }
  35 +
  36 + @Override
  37 + protected PasswordAuthentication getPasswordAuthentication() {
  38 + return new PasswordAuthentication(username, password);
  39 + }
  40 +
  41 + String getUsername() {
  42 + return username;
  43 + }
  44 +
  45 + public void setPassword(String password) {
  46 + this.password = password;
  47 + }
  48 +
  49 + public void setUsername(String username) {
  50 + this.username = username;
  51 + }
  52 +}
src/main/java/com/bsth/email/SendEmailController.java 0 → 100644
  1 +package com.bsth.email;
  2 +
  3 +import com.bsth.email.entity.EmailBean;
  4 +import com.bsth.util.Tools;
  5 +import org.springframework.stereotype.Component;
  6 +
  7 +import java.util.List;
  8 +
  9 +@Component
  10 +public class SendEmailController {
  11 +
  12 + /*
  13 + * recipients
  14 + * 收件人集合
  15 + * mail
  16 + * 邮件
  17 + */
  18 + public int sendMail(List<String> recipients,EmailBean mail){
  19 + Tools t = new Tools("mailbox.properties");
  20 + SimpleMailSender sms = new SimpleMailSender(t.getValue("username"),t.getValue("password"));
  21 + try {
  22 + for (String recipient : recipients) {
  23 + sms.send(recipient, mail.getSubject(),mail.getContent());
  24 + }
  25 + } catch (Exception e) {
  26 + e.printStackTrace();
  27 + return -1;
  28 + }
  29 + return 1;
  30 + }
  31 +
  32 + /*
  33 + * recipient
  34 + * 收件人
  35 + * mail
  36 + * 邮件
  37 + */
  38 + public int sendMail(String recipient,EmailBean mail){
  39 + Tools t = new Tools("mailbox.properties");
  40 + SimpleMailSender sms = new SimpleMailSender(t.getValue("username"),t.getValue("password"));
  41 + try {
  42 + sms.send(recipient, mail.getSubject(),mail.getContent());
  43 + } catch (Exception e) {
  44 + e.printStackTrace();
  45 + return -1;
  46 + }
  47 + return 1;
  48 + }
  49 +}
src/main/java/com/bsth/email/SimpleMailSender.java 0 → 100644
  1 +package com.bsth.email;
  2 +
  3 +import com.bsth.email.entity.EmailBean;
  4 +
  5 +import java.util.List;
  6 +import java.util.Properties;
  7 +
  8 +import javax.activation.CommandMap;
  9 +import javax.activation.MailcapCommandMap;
  10 +import javax.mail.MessagingException;
  11 +import javax.mail.Session;
  12 +import javax.mail.Transport;
  13 +import javax.mail.internet.AddressException;
  14 +import javax.mail.internet.InternetAddress;
  15 +import javax.mail.internet.MimeMessage;
  16 +import javax.mail.internet.MimeMessage.RecipientType;
  17 +
  18 +
  19 +public class SimpleMailSender {
  20 + /**
  21 + * 发送邮件的props文件
  22 + */
  23 + private final transient Properties props = System.getProperties();
  24 + /**
  25 + * 邮件服务器登录验证
  26 + */
  27 + private transient MailAuthenticator authenticator;
  28 +
  29 + /**
  30 + * 邮箱session
  31 + */
  32 + private transient Session session;
  33 +
  34 + /**
  35 + * 初始化邮件发送器
  36 + *
  37 + * @param smtpHostName
  38 + * SMTP邮件服务器地址
  39 + * @param username
  40 + * 发送邮件的用户名(地址)
  41 + * @param password
  42 + * 发送邮件的密码
  43 + */
  44 + public SimpleMailSender(final String smtpHostName, final String username,
  45 + final String password) {
  46 + init(username, password, smtpHostName);
  47 + }
  48 +
  49 + /**
  50 + * 初始化邮件发送器
  51 + *
  52 + * @param username
  53 + * 发送邮件的用户名(地址),并以此解析SMTP服务器地址
  54 + * @param password
  55 + * 发送邮件的密码
  56 + */
  57 + public SimpleMailSender(final String username, final String password) {
  58 + //通过邮箱地址解析出smtp服务器,对大多数邮箱都管用
  59 + final String smtpHostName = "smtp." + username.split("@")[1];
  60 + init(username, password, smtpHostName);
  61 +
  62 + }
  63 +
  64 + /**
  65 + * 初始化
  66 + *
  67 + * @param username
  68 + * 发送邮件的用户名(地址)
  69 + * @param password
  70 + * 密码
  71 + * @param smtpHostName
  72 + * SMTP主机地址
  73 + */
  74 + private void init(String username, String password, String smtpHostName) {
  75 + // 初始化props
  76 + props.put("mail.smtp.auth", "true");
  77 + props.put("mail.smtp.host", smtpHostName);
  78 + // 验证
  79 + authenticator = new MailAuthenticator(username, password);
  80 + // 创建session
  81 + session = Session.getInstance(props, authenticator);
  82 + }
  83 +
  84 + /**
  85 + * 发送邮件
  86 + *
  87 + * @param recipient
  88 + * 收件人邮箱地址
  89 + * @param subject
  90 + * 邮件主题
  91 + * @param content
  92 + * 邮件内容
  93 + * @throws AddressException
  94 + * @throws MessagingException
  95 + */
  96 + public void send(String recipient, String subject, Object content)
  97 + throws AddressException, MessagingException {
  98 + // 创建mime类型邮件
  99 + final MimeMessage message = new MimeMessage(session);
  100 + // 设置发信人
  101 + message.setFrom(new InternetAddress(authenticator.getUsername()));
  102 + // 设置收件人
  103 + message.setRecipient(RecipientType.TO, new InternetAddress(recipient));
  104 + // 设置主题
  105 + message.setSubject(subject);
  106 + // 设置邮件内容
  107 + message.setContent(content.toString(), "text/html;charset=utf-8");
  108 +
  109 + MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
  110 + mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
  111 + mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
  112 + mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
  113 + mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
  114 + mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
  115 + CommandMap.setDefaultCommandMap(mc);
  116 + // 发送
  117 + Transport.send(message);
  118 + }
  119 +
  120 + /**
  121 + * 群发邮件
  122 + *
  123 + * @param recipients
  124 + * 收件人们
  125 + * @param subject
  126 + * 主题
  127 + * @param content
  128 + * 内容
  129 + * @throws AddressException
  130 + * @throws MessagingException
  131 + */
  132 + public void send(List<String> recipients, String subject, Object content)
  133 + throws AddressException, MessagingException {
  134 + // 创建mime类型邮件
  135 + final MimeMessage message = new MimeMessage(session);
  136 + // 设置发信人
  137 + message.setFrom(new InternetAddress(authenticator.getUsername()));
  138 + // 设置收件人们
  139 + final int num = recipients.size();
  140 + InternetAddress[] addresses = new InternetAddress[num];
  141 + for (int i = 0; i < num; i++) {
  142 + addresses[i] = new InternetAddress(recipients.get(i));
  143 + }
  144 + message.setRecipients(RecipientType.TO, addresses);
  145 + // 设置主题
  146 + message.setSubject(subject);
  147 + // 设置邮件内容
  148 + message.setContent(content.toString(), "text/html;charset=utf-8");
  149 + // 发送
  150 + Transport.send(message);
  151 + }
  152 +
  153 + /**
  154 + * 发送邮件
  155 + *
  156 + * @param recipient
  157 + * 收件人邮箱地址
  158 + * @param mail
  159 + * 邮件对象
  160 + * @throws AddressException
  161 + * @throws MessagingException
  162 + */
  163 + public void send(String recipient, EmailBean mail)
  164 + throws AddressException, MessagingException {
  165 + send(recipient, mail.getSubject(), mail.getContent());
  166 + }
  167 +
  168 + /**
  169 + * 群发邮件
  170 + *
  171 + * @param recipients
  172 + * 收件人们
  173 + * @param mail
  174 + * 邮件对象
  175 + * @throws AddressException
  176 + * @throws MessagingException
  177 + */
  178 + public void send(List<String> recipients, EmailBean mail)
  179 + throws AddressException, MessagingException {
  180 + send(recipients, mail.getSubject(), mail.getContent());
  181 + }
  182 +}
src/main/java/com/bsth/email/entity/EmailBean.java 0 → 100644
  1 +package com.bsth.email.entity;
  2 +
  3 +/**
  4 + * Created by zlz on 2017-12-29.
  5 + */
  6 +public class EmailBean {
  7 + private String subject;// 邮件标题
  8 + private String content;//邮件内容
  9 + public String getSubject() {
  10 + return subject;
  11 + }
  12 + public void setSubject(String subject) {
  13 + this.subject = subject;
  14 + }
  15 + public String getContent() {
  16 + return content;
  17 + }
  18 + public void setContent(String content) {
  19 + this.content = content;
  20 + }
  21 +}
src/main/java/com/bsth/entity/Line.java
@@ -160,6 +160,11 @@ public class Line implements Serializable { @@ -160,6 +160,11 @@ public class Line implements Serializable {
160 160
161 /** 是否在使用 <1:是;0:否> bit length(50) */ 161 /** 是否在使用 <1:是;0:否> bit length(50) */
162 private Integer inUse; 162 private Integer inUse;
  163 +
  164 + /**
  165 + * 逻辑删除标记 为 1:标识已删除
  166 + */
  167 + private Integer remove;
163 168
164 public Integer getSpacGrade() { 169 public Integer getSpacGrade() {
165 return spacGrade; 170 return spacGrade;
@@ -492,6 +497,13 @@ public class Line implements Serializable { @@ -492,6 +497,13 @@ public class Line implements Serializable {
492 public void setSfyy(Integer sfyy) { 497 public void setSfyy(Integer sfyy) {
493 this.sfyy = sfyy; 498 this.sfyy = sfyy;
494 } 499 }
495 -  
496 - 500 +
  501 +
  502 + public Integer getRemove() {
  503 + return remove;
  504 + }
  505 +
  506 + public void setRemove(Integer remove) {
  507 + this.remove = remove;
  508 + }
497 } 509 }
src/main/java/com/bsth/entity/LonLatName.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +public class LonLatName {
  4 + public String first_name;
  5 + public String second_name;
  6 + public String way_name;
  7 + public String location;
  8 +
  9 + public String getFirst_name() {
  10 + return first_name;
  11 + }
  12 +
  13 + public void setFirst_name(String first_name) {
  14 + this.first_name = first_name;
  15 + }
  16 +
  17 + public String getSecond_name() {
  18 + return second_name;
  19 + }
  20 +
  21 + public void setSecond_name(String second_name) {
  22 + this.second_name = second_name;
  23 + }
  24 +
  25 + public String getWay_name() {
  26 + return way_name;
  27 + }
  28 +
  29 + public void setWay_name(String way_name) {
  30 + this.way_name = way_name;
  31 + }
  32 + public String getLocation() {
  33 + return location;
  34 + }
  35 +
  36 + public void setLocation(String location) {
  37 + this.location = location;
  38 + }
  39 +}
src/main/java/com/bsth/entity/directive/Directive.java
@@ -28,6 +28,8 @@ public class Directive { @@ -28,6 +28,8 @@ public class Directive {
28 * 时间戳 28 * 时间戳
29 */ 29 */
30 protected Long timestamp; 30 protected Long timestamp;
  31 +
  32 + private String rq;
31 33
32 /** 34 /**
33 * 时间 HH:mm 35 * 时间 HH:mm
@@ -113,4 +115,12 @@ public class Directive { @@ -113,4 +115,12 @@ public class Directive {
113 public void setSender(String sender) { 115 public void setSender(String sender) {
114 this.sender = sender; 116 this.sender = sender;
115 } 117 }
  118 +
  119 + public String getRq() {
  120 + return rq;
  121 + }
  122 +
  123 + public void setRq(String rq) {
  124 + this.rq = rq;
  125 + }
116 } 126 }
src/main/java/com/bsth/entity/geo_data/GeoLineVersionInfo.java 0 → 100644
  1 +package com.bsth.entity.geo_data;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * 线路版本信息
  7 + * Created by panzhao on 2017/12/18.
  8 + */
  9 +public class GeoLineVersionInfo {
  10 + /** ID 主键(唯一标识符) int length(11) */
  11 + private Integer id;
  12 +
  13 + /** 线路版本名字 varchar length(50)
  14 + * 给排版人员选版本使用
  15 + * */
  16 + private String name;
  17 +
  18 + /** 线路ID int length(11) */
  19 + private Integer line;
  20 +
  21 + /** 线路编码 varchar length(50) */
  22 + private String lineCode;
  23 +
  24 + /** 版本号 int length(11) */
  25 + private int versions;
  26 +
  27 + /** 启用日期 timestamp */
  28 + private Date startDate;
  29 +
  30 + /** 终止日期 timestamp */
  31 + private Date endDate;
  32 +
  33 + /** 创建日期 timestamp */
  34 + private Date createDate;
  35 +
  36 + /** 修改日期 timestamp */
  37 + private Date updateDate;
  38 +
  39 + /** 备注 varchar length(50) */
  40 + private String remark;
  41 +
  42 + /** 版本状态 int length(11)
  43 + * 0(历史版本),1(当前版本),2(待更新版本)
  44 + */
  45 + private int status;
  46 +
  47 + /**
  48 + * 是否发布 int length(1)
  49 + * 0(没有),1(发布)
  50 + */
  51 + private int isupdate;
  52 +
  53 + private String lineName;
  54 +
  55 + public Integer getId() {
  56 + return id;
  57 + }
  58 +
  59 + public void setId(Integer id) {
  60 + this.id = id;
  61 + }
  62 +
  63 + public String getName() {
  64 + return name;
  65 + }
  66 +
  67 + public void setName(String name) {
  68 + this.name = name;
  69 + }
  70 +
  71 + public String getLineCode() {
  72 + return lineCode;
  73 + }
  74 +
  75 + public void setLineCode(String lineCode) {
  76 + this.lineCode = lineCode;
  77 + }
  78 +
  79 + public int getVersions() {
  80 + return versions;
  81 + }
  82 +
  83 + public void setVersions(int versions) {
  84 + this.versions = versions;
  85 + }
  86 +
  87 + public Date getStartDate() {
  88 + return startDate;
  89 + }
  90 +
  91 + public void setStartDate(Date startDate) {
  92 + this.startDate = startDate;
  93 + }
  94 +
  95 + public Date getEndDate() {
  96 + return endDate;
  97 + }
  98 +
  99 + public void setEndDate(Date endDate) {
  100 + this.endDate = endDate;
  101 + }
  102 +
  103 + public Date getCreateDate() {
  104 + return createDate;
  105 + }
  106 +
  107 + public void setCreateDate(Date createDate) {
  108 + this.createDate = createDate;
  109 + }
  110 +
  111 + public Date getUpdateDate() {
  112 + return updateDate;
  113 + }
  114 +
  115 + public void setUpdateDate(Date updateDate) {
  116 + this.updateDate = updateDate;
  117 + }
  118 +
  119 + public String getRemark() {
  120 + return remark;
  121 + }
  122 +
  123 + public void setRemark(String remark) {
  124 + this.remark = remark;
  125 + }
  126 +
  127 + public int getStatus() {
  128 + return status;
  129 + }
  130 +
  131 + public void setStatus(int status) {
  132 + this.status = status;
  133 + }
  134 +
  135 + public int getIsupdate() {
  136 + return isupdate;
  137 + }
  138 +
  139 + public void setIsupdate(int isupdate) {
  140 + this.isupdate = isupdate;
  141 + }
  142 +
  143 + public String getLineName() {
  144 + return lineName;
  145 + }
  146 +
  147 + public void setLineName(String lineName) {
  148 + this.lineName = lineName;
  149 + }
  150 +
  151 + public Integer getLine() {
  152 + return line;
  153 + }
  154 +
  155 + public void setLine(Integer line) {
  156 + this.line = line;
  157 + }
  158 +}
src/main/java/com/bsth/entity/geo_data/GeoStation.java
1 -package com.bsth.entity.geo_data;  
2 -  
3 -import com.fasterxml.jackson.annotation.JsonIgnore;  
4 -  
5 -import java.util.List;  
6 -  
7 -/**  
8 - * Created by panzhao on 2017/12/7.  
9 - */  
10 -public class GeoStation {  
11 -  
12 - private int id;  
13 -  
14 - private String stationName;  
15 -  
16 - private String stationRouteCode;  
17 -  
18 - private String lineCode;  
19 -  
20 - private Integer directions;  
21 -  
22 - private String stationCode;  
23 -  
24 - private String stationMark;  
25 -  
26 - private Integer version;  
27 -  
28 - private Float gLonx;  
29 -  
30 - private Float gLaty;  
31 -  
32 - @JsonIgnore  
33 - private String gPolygonGrid;  
34 -  
35 - private List<String> bdCoords;  
36 -  
37 - private Integer radius;  
38 -  
39 - private String shapesType;  
40 -  
41 - public int getId() {  
42 - return id;  
43 - }  
44 -  
45 - public void setId(int id) {  
46 - this.id = id;  
47 - }  
48 -  
49 - public String getStationName() {  
50 - return stationName;  
51 - }  
52 -  
53 - public void setStationName(String stationName) {  
54 - this.stationName = stationName;  
55 - }  
56 -  
57 - public String getStationRouteCode() {  
58 - return stationRouteCode;  
59 - }  
60 -  
61 - public void setStationRouteCode(String stationRouteCode) {  
62 - this.stationRouteCode = stationRouteCode;  
63 - }  
64 -  
65 - public String getLineCode() {  
66 - return lineCode;  
67 - }  
68 -  
69 - public void setLineCode(String lineCode) {  
70 - this.lineCode = lineCode;  
71 - }  
72 -  
73 - public Integer getDirections() {  
74 - return directions;  
75 - }  
76 -  
77 - public void setDirections(Integer directions) {  
78 - this.directions = directions;  
79 - }  
80 -  
81 - public String getStationCode() {  
82 - return stationCode;  
83 - }  
84 -  
85 - public void setStationCode(String stationCode) {  
86 - this.stationCode = stationCode;  
87 - }  
88 -  
89 - public String getStationMark() {  
90 - return stationMark;  
91 - }  
92 -  
93 - public void setStationMark(String stationMark) {  
94 - this.stationMark = stationMark;  
95 - }  
96 -  
97 - public Integer getVersion() {  
98 - return version;  
99 - }  
100 -  
101 - public void setVersion(Integer version) {  
102 - this.version = version;  
103 - }  
104 -  
105 - public Float getgLonx() {  
106 - return gLonx;  
107 - }  
108 -  
109 - public void setgLonx(Float gLonx) {  
110 - this.gLonx = gLonx;  
111 - }  
112 -  
113 - public Float getgLaty() {  
114 - return gLaty;  
115 - }  
116 -  
117 - public void setgLaty(Float gLaty) {  
118 - this.gLaty = gLaty;  
119 - }  
120 -  
121 - public String getgPolygonGrid() {  
122 - return gPolygonGrid;  
123 - }  
124 -  
125 - public void setgPolygonGrid(String gPolygonGrid) {  
126 - this.gPolygonGrid = gPolygonGrid;  
127 - }  
128 -  
129 - public Integer getRadius() {  
130 - return radius;  
131 - }  
132 -  
133 - public void setRadius(Integer radius) {  
134 - this.radius = radius;  
135 - }  
136 -  
137 - public String getShapesType() {  
138 - return shapesType;  
139 - }  
140 -  
141 - public void setShapesType(String shapesType) {  
142 - this.shapesType = shapesType;  
143 - }  
144 -  
145 - public List<String> getBdCoords() {  
146 - return bdCoords;  
147 - }  
148 -  
149 - public void setBdCoords(List<String> bdCoords) {  
150 - this.bdCoords = bdCoords;  
151 - } 1 +package com.bsth.entity.geo_data;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/12/7.
  9 + */
  10 +public class GeoStation {
  11 +
  12 + private int id;
  13 +
  14 + private String stationName;
  15 +
  16 + private String stationRouteCode;
  17 +
  18 + private String lineCode;
  19 +
  20 + private Integer directions;
  21 +
  22 + private String stationCode;
  23 +
  24 + private String stationMark;
  25 +
  26 + private Integer versions;
  27 +
  28 + private Float gLonx;
  29 +
  30 + private Float gLaty;
  31 +
  32 + @JsonIgnore
  33 + private String gPolygonGrid;
  34 +
  35 + private List<String> bdCoords;
  36 +
  37 + private Integer radius;
  38 +
  39 + private String shapesType;
  40 +
  41 + public int getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(int id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public String getStationName() {
  50 + return stationName;
  51 + }
  52 +
  53 + public void setStationName(String stationName) {
  54 + this.stationName = stationName;
  55 + }
  56 +
  57 + public String getStationRouteCode() {
  58 + return stationRouteCode;
  59 + }
  60 +
  61 + public void setStationRouteCode(String stationRouteCode) {
  62 + this.stationRouteCode = stationRouteCode;
  63 + }
  64 +
  65 + public String getLineCode() {
  66 + return lineCode;
  67 + }
  68 +
  69 + public void setLineCode(String lineCode) {
  70 + this.lineCode = lineCode;
  71 + }
  72 +
  73 + public Integer getDirections() {
  74 + return directions;
  75 + }
  76 +
  77 + public void setDirections(Integer directions) {
  78 + this.directions = directions;
  79 + }
  80 +
  81 + public String getStationCode() {
  82 + return stationCode;
  83 + }
  84 +
  85 + public void setStationCode(String stationCode) {
  86 + this.stationCode = stationCode;
  87 + }
  88 +
  89 + public String getStationMark() {
  90 + return stationMark;
  91 + }
  92 +
  93 + public void setStationMark(String stationMark) {
  94 + this.stationMark = stationMark;
  95 + }
  96 +
  97 + public Float getgLonx() {
  98 + return gLonx;
  99 + }
  100 +
  101 + public void setgLonx(Float gLonx) {
  102 + this.gLonx = gLonx;
  103 + }
  104 +
  105 + public Float getgLaty() {
  106 + return gLaty;
  107 + }
  108 +
  109 + public void setgLaty(Float gLaty) {
  110 + this.gLaty = gLaty;
  111 + }
  112 +
  113 + public String getgPolygonGrid() {
  114 + return gPolygonGrid;
  115 + }
  116 +
  117 + public void setgPolygonGrid(String gPolygonGrid) {
  118 + this.gPolygonGrid = gPolygonGrid;
  119 + }
  120 +
  121 + public Integer getRadius() {
  122 + return radius;
  123 + }
  124 +
  125 + public void setRadius(Integer radius) {
  126 + this.radius = radius;
  127 + }
  128 +
  129 + public String getShapesType() {
  130 + return shapesType;
  131 + }
  132 +
  133 + public void setShapesType(String shapesType) {
  134 + this.shapesType = shapesType;
  135 + }
  136 +
  137 + public List<String> getBdCoords() {
  138 + return bdCoords;
  139 + }
  140 +
  141 + public void setBdCoords(List<String> bdCoords) {
  142 + this.bdCoords = bdCoords;
  143 + }
  144 +
  145 + public Integer getVersions() {
  146 + return versions;
  147 + }
  148 +
  149 + public void setVersions(Integer versions) {
  150 + this.versions = versions;
  151 + }
152 } 152 }
153 \ No newline at end of file 153 \ No newline at end of file
src/main/java/com/bsth/entity/oil/Dlb.java
@@ -58,6 +58,8 @@ public class Dlb { @@ -58,6 +58,8 @@ public class Dlb {
58 private int nylx; 58 private int nylx;
59 //进场顺序(根据最先出场和最后进场来关联车辆的存电量) 59 //进场顺序(根据最先出场和最后进场来关联车辆的存电量)
60 private int jcsx; 60 private int jcsx;
  61 +
  62 + private String jname;
61 @Transient 63 @Transient
62 private String name; 64 private String name;
63 @Transient 65 @Transient
@@ -73,7 +75,8 @@ public class Dlb { @@ -73,7 +75,8 @@ public class Dlb {
73 private String fgsname; 75 private String fgsname;
74 76
75 77
76 - private String lp=""; 78 +
  79 + private String lp;
77 80
78 public Integer getId() { 81 public Integer getId() {
79 return id; 82 return id;
@@ -391,6 +394,14 @@ public class Dlb { @@ -391,6 +394,14 @@ public class Dlb {
391 public void setLp(String lp) { 394 public void setLp(String lp) {
392 this.lp = lp; 395 this.lp = lp;
393 } 396 }
  397 +
  398 + public String getJname() {
  399 + return jname;
  400 + }
  401 +
  402 + public void setJname(String jname) {
  403 + this.jname = jname;
  404 + }
394 405
395 406
396 407
src/main/java/com/bsth/entity/oil/Ylb.java
@@ -26,6 +26,7 @@ public class Ylb { @@ -26,6 +26,7 @@ public class Ylb {
26 private String fgsdm; 26 private String fgsdm;
27 private String nbbm; 27 private String nbbm;
28 private String jsy; 28 private String jsy;
  29 + private String jname;
29 private Double czlc=0.0; 30 private Double czlc=0.0;
30 private Double jzlc=0.0; 31 private Double jzlc=0.0;
31 private Double czyl=0.0; 32 private Double czyl=0.0;
@@ -56,7 +57,7 @@ public class Ylb { @@ -56,7 +57,7 @@ public class Ylb {
56 //进场顺序(根据最先出场和最后进场来关联车辆的存油量) 57 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
57 private int jcsx; 58 private int jcsx;
58 59
59 - private String lp=""; 60 + private String lp;
60 @Transient 61 @Transient
61 private String bglyh; 62 private String bglyh;
62 63
@@ -339,6 +340,14 @@ public class Ylb { @@ -339,6 +340,14 @@ public class Ylb {
339 public void setLp(String lp) { 340 public void setLp(String lp) {
340 this.lp = lp; 341 this.lp = lp;
341 } 342 }
  343 +
  344 + public String getJname() {
  345 + return jname;
  346 + }
  347 +
  348 + public void setJname(String jname) {
  349 + this.jname = jname;
  350 + }
342 351
343 352
344 } 353 }
src/main/java/com/bsth/entity/schedule/TTInfo.java
@@ -67,6 +67,10 @@ public class TTInfo extends BEntity { @@ -67,6 +67,10 @@ public class TTInfo extends BEntity {
67 /** 最近备份日期 */ 67 /** 最近备份日期 */
68 private Date lastBackUpDate; 68 private Date lastBackUpDate;
69 69
  70 + /** 线路版本(bsth_c_line_versions表对应字段) */
  71 + @Column(nullable = false)
  72 + private int lineVersion;
  73 +
70 public TTInfo() {} 74 public TTInfo() {}
71 public TTInfo(Object id, Object xlid, Object name, Object nds, Object sds) { 75 public TTInfo(Object id, Object xlid, Object name, Object nds, Object sds) {
72 if (id != null) { 76 if (id != null) {
@@ -109,7 +113,9 @@ public class TTInfo extends BEntity { @@ -109,7 +113,9 @@ public class TTInfo extends BEntity {
109 .setUpdateUser(getUpdateBy() == null ? 0 : getUpdateBy().getId()) 113 .setUpdateUser(getUpdateBy() == null ? 0 : getUpdateBy().getId())
110 .setUpdateUserName(getUpdateBy() == null ? "" : getUpdateBy().getUserName()) 114 .setUpdateUserName(getUpdateBy() == null ? "" : getUpdateBy().getUserName())
111 .setCreateDate(getCreateDate() == null ? 0l : getCreateDate().getTime()) 115 .setCreateDate(getCreateDate() == null ? 0l : getCreateDate().getTime())
112 - .setUpdateDate(getUpdateDate() == null ? 0l : getUpdateDate().getTime()); 116 + .setUpdateDate(getUpdateDate() == null ? 0l : getUpdateDate().getTime())
  117 + .setLineVersion(lineVersion)
  118 + ;
113 119
114 } 120 }
115 121
@@ -216,4 +222,12 @@ public class TTInfo extends BEntity { @@ -216,4 +222,12 @@ public class TTInfo extends BEntity {
216 public void setLastBackUpDate(Date lastBackUpDate) { 222 public void setLastBackUpDate(Date lastBackUpDate) {
217 this.lastBackUpDate = lastBackUpDate; 223 this.lastBackUpDate = lastBackUpDate;
218 } 224 }
  225 +
  226 + public int getLineVersion() {
  227 + return lineVersion;
  228 + }
  229 +
  230 + public void setLineVersion(int lineVersion) {
  231 + this.lineVersion = lineVersion;
  232 + }
219 } 233 }
src/main/java/com/bsth/entity/schedule/TTInfoBackup.java
@@ -36,6 +36,10 @@ public class TTInfoBackup { @@ -36,6 +36,10 @@ public class TTInfoBackup {
36 @Lob 36 @Lob
37 private byte[] backUpInfo; 37 private byte[] backUpInfo;
38 38
  39 + /** 线路版本(bsth_c_line_versions表对应字段) */
  40 + @Column(nullable = false)
  41 + private int lineVersion;
  42 +
39 public Long getId() { 43 public Long getId() {
40 return id; 44 return id;
41 } 45 }
@@ -91,4 +95,12 @@ public class TTInfoBackup { @@ -91,4 +95,12 @@ public class TTInfoBackup {
91 public void setBackUpInfo(byte[] backUpInfo) { 95 public void setBackUpInfo(byte[] backUpInfo) {
92 this.backUpInfo = backUpInfo; 96 this.backUpInfo = backUpInfo;
93 } 97 }
  98 +
  99 + public int getLineVersion() {
  100 + return lineVersion;
  101 + }
  102 +
  103 + public void setLineVersion(int lineVersion) {
  104 + this.lineVersion = lineVersion;
  105 + }
94 } 106 }
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
@@ -100,6 +100,10 @@ public class TTInfoDetail extends BEntity { @@ -100,6 +100,10 @@ public class TTInfoDetail extends BEntity {
100 /** 备注 */ 100 /** 备注 */
101 private String remark; 101 private String remark;
102 102
  103 + /** 线路版本(bsth_c_line_versions表对应字段) */
  104 + @Column(nullable = false)
  105 + private int lineVersion;
  106 +
103 /** 107 /**
104 * 输出proto生成的builder 108 * 输出proto生成的builder
105 * @return 109 * @return
@@ -126,6 +130,7 @@ public class TTInfoDetail extends BEntity { @@ -126,6 +130,7 @@ public class TTInfoDetail extends BEntity {
126 .setIsFB(isFB == null ? false : isFB) 130 .setIsFB(isFB == null ? false : isFB)
127 .setIsTS(isTS == null ? false : isTS) 131 .setIsTS(isTS == null ? false : isTS)
128 .setRemark(remark == null ? "" : remark) 132 .setRemark(remark == null ? "" : remark)
  133 + .setLineVersion(lineVersion)
129 ; 134 ;
130 } 135 }
131 136
@@ -320,4 +325,12 @@ public class TTInfoDetail extends BEntity { @@ -320,4 +325,12 @@ public class TTInfoDetail extends BEntity {
320 public void setIsTS(Boolean isTS) { 325 public void setIsTS(Boolean isTS) {
321 this.isTS = isTS; 326 this.isTS = isTS;
322 } 327 }
  328 +
  329 + public int getLineVersion() {
  330 + return lineVersion;
  331 + }
  332 +
  333 + public void setLineVersion(int lineVersion) {
  334 + this.lineVersion = lineVersion;
  335 + }
323 } 336 }
src/main/java/com/bsth/filter/BaseFilter.java
@@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter { @@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter {
17 * 白名单 17 * 白名单
18 */ 18 */
19 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, 19 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20 - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL }; 20 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT };
21 21
22 @Override 22 @Override
23 public void destroy() { 23 public void destroy() {
src/main/java/com/bsth/repository/CarDeviceRepository.java
1 package com.bsth.repository; 1 package com.bsth.repository;
2 2
3 import com.bsth.entity.CarDevice; 3 import com.bsth.entity.CarDevice;
  4 +
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +import org.springframework.data.jpa.repository.Query;
4 import org.springframework.stereotype.Repository; 9 import org.springframework.stereotype.Repository;
5 10
6 /** 11 /**
@@ -8,4 +13,6 @@ import org.springframework.stereotype.Repository; @@ -8,4 +13,6 @@ import org.springframework.stereotype.Repository;
8 */ 13 */
9 @Repository 14 @Repository
10 public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { 15 public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> {
  16 + @Query(value="select s from CarDevice s where s.oldDeviceNo=?1 and s.qyrq>=?2 ")
  17 + List<CarDevice> findCarDevice(String device,Date date );
11 } 18 }
src/main/java/com/bsth/repository/CarsRepository.java
@@ -15,4 +15,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{ @@ -15,4 +15,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{
15 15
16 @Query(value="select s from Cars s") 16 @Query(value="select s from Cars s")
17 List<Cars> findCars(); 17 List<Cars> findCars();
  18 +
  19 + @Query(value="select s from Cars s where s.insideCode=?1")
  20 + List<Cars> findCarsByCode(String insideCode);
18 } 21 }
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
172 void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); 172 void isRoadSpeedUpd(Integer isR,Integer line,Integer directions);
173 173
174 @Modifying 174 @Modifying
175 - @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) 175 + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
176 public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); 176 public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod);
177 - 177 +
  178 + @Modifying
  179 + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
  180 + public void sectionUpdSectionRouteCode(String lineCode,Integer dir,int routeCod);
  181 +
178 @Modifying 182 @Modifying
179 @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) 183 @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true)
180 public void sectionRouteIsDestroyUpdBatch(Integer id); 184 public void sectionRouteIsDestroyUpdBatch(Integer id);
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
102 "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + 102 "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " +
103 "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) 103 "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true)
104 List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); 104 List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
105 -  
106 - 105 +
  106 + /**
  107 + * @Description :TODO(查询下个站点)
  108 + *
  109 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  110 + *
  111 + * @return List<Map<String, Object>>
  112 + */
  113 + @Query(value = "SELECT a.stationRouteLine," +
  114 + " a.stationRouteStation," +
  115 + " a.stationRouteCode," +
  116 + " a.stationRouteLIneCode," +
  117 + " a.stationRouteStationMark," +
  118 + " a.stationOutStationNmber," +
  119 + " a.stationRoutedirections," +
  120 + " a.stationRouteDistances," +
  121 + " a.stationRouteToTime," +
  122 + " a.staitonRouteFirstTime," +
  123 + " a.stationRouteEndTime," +
  124 + " a.stationRouteDescriptions," +
  125 + " a.stationRouteDestroy," +
  126 + " a.stationRouteVersions," +
  127 + " a.stationRouteCreateBy," +
  128 + " a.stationRouteCreateDate," +
  129 + " a.stationRouteUpdateBy," +
  130 + " a.stationRouteUpdateDate," +
  131 + " b.id AS stationId," +
  132 + " b.station_cod AS stationCode," +
  133 + " a.stationRouteName," +
  134 + " b.road_coding AS stationRoadCoding," +
  135 + " b.db_type AS stationDbType," +
  136 + " b.b_jwpoints AS stationJwpoints," +
  137 + " b.g_lonx AS stationGlonx," +
  138 + " b.g_laty AS stationGlaty," +
  139 + " b.x AS stationX," +
  140 + " b.y AS stationY," +
  141 + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  142 + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
  143 + " b.destroy AS stationDestroy," +
  144 + " b.radius AS stationRadius," +
  145 + " b.shapes_type AS stationShapesType," +
  146 + " b.versions AS stationVersions," +
  147 + " b.descriptions AS sttationDescriptions," +
  148 + " b.create_by AS stationCreateBy," +
  149 + " b.create_date AS stationCreateDate," +
  150 + " b.update_by AS stationUpdateBy," +
  151 + " b.update_date AS stationUpdateDate," +
  152 + " a.stationRouteId,b.station_name as zdmc "+
  153 + " FROM ( SELECT s.id AS stationRouteId," +
  154 + " s.line AS stationRouteLine," +
  155 + " s.station as stationRouteStation," +
  156 + " s.station_name AS stationRouteName," +
  157 + " s.station_route_code as stationRouteCode," +
  158 + " s.line_code AS stationRouteLIneCode," +
  159 + " s.station_mark AS stationRouteStationMark," +
  160 + " s.out_station_nmber AS stationOutStationNmber," +
  161 + " s.directions AS stationRoutedirections," +
  162 + " s.distances AS stationRouteDistances," +
  163 + " s.to_time AS stationRouteToTime," +
  164 + " s.first_time AS staitonRouteFirstTime," +
  165 + " s.end_time AS stationRouteEndTime," +
  166 + " s.descriptions AS stationRouteDescriptions," +
  167 + " s.destroy AS stationRouteDestroy," +
  168 + " s.versions AS stationRouteVersions," +
  169 + " s.create_by AS stationRouteCreateBy," +
  170 + " s.create_date AS stationRouteCreateDate," +
  171 + " s.update_by AS stationRouteUpdateBy," +
  172 + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.station_route_code =(" +
  173 + "select MIN(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " +
  174 + "r.line=?1 and r.directions =?2 and station_route_code > ?3 and r.destroy = 0 ) and s.line=?1 and s.directions = ?2 AND s.destroy = 0) a " +
  175 + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
  176 + List<Object[]> findDownStationRoute(Integer id,Integer direction,Integer stationRouteCode);
  177 +
107 /** 178 /**
108 * @Description :TODO(站点中心点坐标查询) 179 * @Description :TODO(站点中心点坐标查询)
109 * 180 *
src/main/java/com/bsth/repository/oil/DlbRepository.java
@@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{ @@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
95 95
96 @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) 96 @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
97 List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm); 97 List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm);
  98 +
  99 + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true)
  100 + List<Dlb> queryDlbByRqXlbm(String rq, String xlbm);
  101 +
98 } 102 }
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -49,13 +49,13 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -49,13 +49,13 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
49 @Query(value="select * from bsth_c_ylb where to_days(?1) -to_days(rq) <30 " 49 @Query(value="select * from bsth_c_ylb where to_days(?1) -to_days(rq) <30 "
50 + " and rq< ?1 and ssgsdm like %?2%" 50 + " and rq< ?1 and ssgsdm like %?2%"
51 + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " 51 + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% "
52 - + " order by nbbm , rq desc,jcsx desc",nativeQuery=true) 52 + + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true)
53 List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); 53 List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
54 54
55 @Query(value="select * from bsth_c_ylb where rq>=?1 " 55 @Query(value="select * from bsth_c_ylb where rq>=?1 "
56 + " and rq<= ?2 and ssgsdm =?3" 56 + " and rq<= ?2 and ssgsdm =?3"
57 + " and fgsdm =?4 and xlbm like %?5% " 57 + " and fgsdm =?4 and xlbm like %?5% "
58 - + " order by nbbm , rq desc,jcsx desc",nativeQuery=true) 58 + + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true)
59 List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm); 59 List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm);
60 60
61 /** 61 /**
@@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
81 81
82 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) 82 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
83 List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm); 83 List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm);
  84 +
  85 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true)
  86 + List<Ylb> queryYlbByRqXlbm(String rq,String xlbm);
84 87
85 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) 88 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true)
86 List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); 89 List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px);
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -58,6 +58,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -58,6 +58,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
58 + " lp_name,xl_name,cl_zbh",nativeQuery=true) 58 + " lp_name,xl_name,cl_zbh",nativeQuery=true)
59 List<Object[]> historyMessageCount(String line,String date,String code); 59 List<Object[]> historyMessageCount(String line,String date,String code);
60 60
  61 + @Query(value="SELECT r.xl_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content "
  62 + + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "
  63 + + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "
  64 + + " r.schedule_date_str = ?2 and r.cl_zbh =?3 ",nativeQuery=true)
  65 + List<Object[]> historyMessageList(String line,String date,String code);
  66 +
61 @Query(value = "select max(id) from ScheduleRealInfo") 67 @Query(value = "select max(id) from ScheduleRealInfo")
62 Long getMaxId(); 68 Long getMaxId();
63 69
@@ -187,10 +193,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -187,10 +193,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
187 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); 193 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);
188 194
189 195
190 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") 196 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate,s.jName as jName ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName,jName ORDER BY clZbh,realExecDate,fcsj")
191 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); 197 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm);
192 198
193 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") 199 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate,s.jName as jName ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName,jName ORDER BY clZbh,realExecDate,fcsj")
194 List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm); 200 List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm);
195 201
196 @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") 202 @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
src/main/java/com/bsth/repository/schedule/TTInfoRepository.java
@@ -11,7 +11,9 @@ import org.springframework.data.jpa.repository.EntityGraph; @@ -11,7 +11,9 @@ import org.springframework.data.jpa.repository.EntityGraph;
11 import org.springframework.data.jpa.repository.Query; 11 import org.springframework.data.jpa.repository.Query;
12 import org.springframework.stereotype.Repository; 12 import org.springframework.stereotype.Repository;
13 13
  14 +import javax.persistence.Tuple;
14 import java.util.List; 15 import java.util.List;
  16 +import java.util.Map;
15 17
16 /** 18 /**
17 * Created by xu on 16/5/12. 19 * Created by xu on 16/5/12.
@@ -31,4 +33,19 @@ public interface TTInfoRepository extends BaseRepository&lt;TTInfo, Long&gt; { @@ -31,4 +33,19 @@ public interface TTInfoRepository extends BaseRepository&lt;TTInfo, Long&gt; {
31 33
32 @Query("select t from TTInfo t where t.xl = ?1 and t.isCancel = false") 34 @Query("select t from TTInfo t where t.xl = ?1 and t.isCancel = false")
33 List<TTInfo> findInCanceledByXl(Line xl); 35 List<TTInfo> findInCanceledByXl(Line xl);
  36 +
  37 + @Query(value = "select new map(lv.name as name, lv.startDate as sd, " +
  38 + "lv.status as status, lv.versions as version) " +
  39 + "from LineVersions lv where lv.line.id = ?1 ")
  40 + List<Map<String, Object>> findLineVersionDescs(Integer lineId);
  41 +
  42 + @Query(value = "select new map(lv.name as name, lv.startDate as sd, " +
  43 + "lv.status as status, lv.versions as version) " +
  44 + "from LineVersions lv where lv.line.id = ?1 and lv.versions = ?2 ")
  45 + List<Map<String, Object>> findLineVersionDescs2(Integer lineId, Integer version);
  46 +
  47 + @Query(value = "select new map(lv.name as name, lv.versions as version) " +
  48 + "from LineVersions lv where lv.line.id = ?1 and lv.status = ?2 ")
  49 + List<Map<String, Object>> findLineVersionDescs3(Integer lineId, Integer status);
  50 +
34 } 51 }
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
36 public void configure(WebSecurity web) throws Exception { 36 public void configure(WebSecurity web) throws Exception {
37 // 白名单 37 // 白名单
38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, 38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
39 - Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL); 39 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT);
40 } 40 }
41 41
42 @Override 42 @Override
src/main/java/com/bsth/security/filter/LoginInterceptor.java
@@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter { @@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter {
33 * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 33 * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证
34 */ 34 */
35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, 35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
36 - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL }; 36 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT };
37 37
38 38
39 @Override 39 @Override
src/main/java/com/bsth/service/BusIntervalService.java
@@ -19,4 +19,6 @@ public interface BusIntervalService { @@ -19,4 +19,6 @@ public interface BusIntervalService {
19 List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); 19 List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map);
20 20
21 List<Map<String, Object>> correctStatis(Map<String, Object> map); 21 List<Map<String, Object>> correctStatis(Map<String, Object> map);
  22 +
  23 + Map<String, Object> exportWaybillMore(Map<String, Object> map);
22 } 24 }
src/main/java/com/bsth/service/LineService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
3 -import java.util.Map;  
4 -  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RequestMethod;  
7 -  
8 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
9 4
  5 +import java.util.Map;
  6 +
10 /** 7 /**
11 * 8 *
12 * @Interface: LineService(线路service业务层实现接口) 9 * @Interface: LineService(线路service业务层实现接口)
@@ -38,4 +35,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; { @@ -38,4 +35,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; {
38 String lineCodeVerification(String lineCode); 35 String lineCodeVerification(String lineCode);
39 36
40 Map<String, Object> update(Line l); 37 Map<String, Object> update(Line l);
  38 +
  39 + Map<String,Object> remove(Integer id);
41 } 40 }
src/main/java/com/bsth/service/SectionService.java
@@ -37,4 +37,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; { @@ -37,4 +37,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; {
37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map); 37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map);
38 38
39 Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map); 39 Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map);
  40 +
  41 + Map<String,Object> doubleName(Map<String, Object> map);
40 } 42 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
72 * @return List<Map<String, Object>> 72 * @return List<Map<String, Object>>
73 */ 73 */
74 List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); 74 List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map);
75 - 75 +
76 List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map); 76 List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map);
77 - 77 +
  78 + /**
  79 + * @Description :TODO(查询下一个站点)
  80 + *
  81 + * @param map <站点路由id; direction:方向;stationRouteCode:站点编码>
  82 + *
  83 + * @return List<Map<String, Object>>
  84 + */
  85 + List<Map<String, Object>> findDownStationRoute(Map<String, Object> map);
  86 +
78 /** 87 /**
79 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) 88 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
80 * 89 *
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -658,7 +658,7 @@ public class FormsServiceImpl implements FormsService { @@ -658,7 +658,7 @@ public class FormsServiceImpl implements FormsService {
658 List<Singledata> list_=new ArrayList<Singledata>(); 658 List<Singledata> list_=new ArrayList<Singledata>();
659 if(tjtype.equals("jsy")){ 659 if(tjtype.equals("jsy")){
660 //油统计 660 //油统计
661 - String sql="select r.j_gh, r.xl_bm,r.cl_zbh" 661 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name"
662 + " from bsth_c_s_sp_info_real r where " 662 + " from bsth_c_s_sp_info_real r where "
663 + " r.schedule_date_str = '"+startDate+"'"; 663 + " r.schedule_date_str = '"+startDate+"'";
664 if(xlbm.equals("")){ 664 if(xlbm.equals("")){
@@ -667,13 +667,14 @@ public class FormsServiceImpl implements FormsService { @@ -667,13 +667,14 @@ public class FormsServiceImpl implements FormsService {
667 }else{ 667 }else{
668 sql += " and r.xl_bm = '"+xlbm+"'"; 668 sql += " and r.xl_bm = '"+xlbm+"'";
669 } 669 }
670 - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh"; 670 + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh";
671 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 671 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
672 @Override 672 @Override
673 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 673 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
674 Singledata sin = new Singledata(); 674 Singledata sin = new Singledata();
675 sin.setxL(arg0.getString("xl_bm")); 675 sin.setxL(arg0.getString("xl_bm"));
676 sin.setJsy(arg0.getString("j_gh")); 676 sin.setJsy(arg0.getString("j_gh"));
  677 + sin.setjName(arg0.getString("j_name"));
677 sin.setClzbh(arg0.getString("cl_zbh")); 678 sin.setClzbh(arg0.getString("cl_zbh"));
678 return sin; 679 return sin;
679 } 680 }
@@ -794,7 +795,7 @@ public class FormsServiceImpl implements FormsService { @@ -794,7 +795,7 @@ public class FormsServiceImpl implements FormsService {
794 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 795 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
795 sin.setXlmc(BasicData.lineCode2NameMap.get(line)); 796 sin.setXlmc(BasicData.lineCode2NameMap.get(line));
796 sin.setrQ(startDate); 797 sin.setrQ(startDate);
797 - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 798 +// sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
798 sin.setSgh(""); 799 sin.setSgh("");
799 sin.setsName(""); 800 sin.setsName("");
800 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 801 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
@@ -868,7 +869,7 @@ public class FormsServiceImpl implements FormsService { @@ -868,7 +869,7 @@ public class FormsServiceImpl implements FormsService {
868 869
869 sin.setEmptMileage(String.valueOf(zksgl)); 870 sin.setEmptMileage(String.valueOf(zksgl));
870 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 871 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
871 - sin.setxL(BasicData.lineCode2NameMap.get(line)); 872 + sin.setXlmc(BasicData.lineCode2NameMap.get(line));
872 sin.setClzbh(clzbh); 873 sin.setClzbh(clzbh);
873 sin.setJsy(""); 874 sin.setJsy("");
874 sin.setjName(""); 875 sin.setjName("");
@@ -876,8 +877,9 @@ public class FormsServiceImpl implements FormsService { @@ -876,8 +877,9 @@ public class FormsServiceImpl implements FormsService {
876 sin.setHyl(""); 877 sin.setHyl("");
877 sin.setJzl(""); 878 sin.setJzl("");
878 sin.setUnyyyl(""); 879 sin.setUnyyyl("");
  880 + list_.add(sin);
879 } 881 }
880 - Collections.sort(list,new SingledataByXlbm()); 882 + Collections.sort(list_,new SingledataByXlbm());
881 } 883 }
882 return list_; 884 return list_;
883 } 885 }
@@ -1380,7 +1382,11 @@ public class FormsServiceImpl implements FormsService { @@ -1380,7 +1382,11 @@ public class FormsServiceImpl implements FormsService {
1380 sin.setClzbh(clzbh); 1382 sin.setClzbh(clzbh);
1381 sin.setJsy(jsy); 1383 sin.setJsy(jsy);
1382 sin.setrQ(startDate); 1384 sin.setrQ(startDate);
1383 - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 1385 + if(newList.size()>0){
  1386 + sin.setjName(newList.get(0).getjName());
  1387 + }else{
  1388 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1389 + }
1384 sin.setSgh(""); 1390 sin.setSgh("");
1385 sin.setsName(""); 1391 sin.setsName("");
1386 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1392 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
@@ -1458,7 +1464,11 @@ public class FormsServiceImpl implements FormsService { @@ -1458,7 +1464,11 @@ public class FormsServiceImpl implements FormsService {
1458 sin.setClzbh(clzbh); 1464 sin.setClzbh(clzbh);
1459 sin.setJsy(jsy); 1465 sin.setJsy(jsy);
1460 sin.setrQ(startDate); 1466 sin.setrQ(startDate);
1461 - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 1467 + if(newList.size()>0){
  1468 + sin.setjName(newList.get(0).getjName());
  1469 + }else{
  1470 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1471 + }
1462 sin.setSgh(""); 1472 sin.setSgh("");
1463 sin.setsName(""); 1473 sin.setsName("");
1464 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1474 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
@@ -1539,7 +1549,7 @@ public class FormsServiceImpl implements FormsService { @@ -1539,7 +1549,7 @@ public class FormsServiceImpl implements FormsService {
1539 1549
1540 sin.setEmptMileage(String.valueOf(zksgl)); 1550 sin.setEmptMileage(String.valueOf(zksgl));
1541 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 1551 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1542 - sin.setxL(BasicData.lineCode2NameMap.get(line)); 1552 + sin.setXlmc(BasicData.lineCode2NameMap.get(line));
1543 sin.setClzbh(clzbh); 1553 sin.setClzbh(clzbh);
1544 sin.setJsy(""); 1554 sin.setJsy("");
1545 sin.setjName(""); 1555 sin.setjName("");
@@ -1550,9 +1560,7 @@ public class FormsServiceImpl implements FormsService { @@ -1550,9 +1560,7 @@ public class FormsServiceImpl implements FormsService {
1550 } 1560 }
1551 Collections.sort(list,new SingledataByXlbm()); 1561 Collections.sort(list,new SingledataByXlbm());
1552 } 1562 }
1553 -  
1554 return list; 1563 return list;
1555 -  
1556 } 1564 }
1557 1565
1558 // 运营服务阶段报表 1566 // 运营服务阶段报表
src/main/java/com/bsth/service/geo_data/GeoDataService.java
1 -package com.bsth.service.geo_data;  
2 -  
3 -import com.bsth.entity.geo_data.GeoStation;  
4 -  
5 -import java.util.Map;  
6 -  
7 -/**  
8 - * Created by panzhao on 2017/12/7.  
9 - */  
10 -public interface GeoDataService {  
11 -  
12 -  
13 - Map<String, Object> findGeoStations(String lineCode);  
14 -  
15 -  
16 - Map<String, Object> findGeoRoad(String lineCode);  
17 -  
18 - Map<String, Object> updateBufferInfo(GeoStation station);  
19 -  
20 - Map<String, Object> updateStationName(Map<String, Object> map);  
21 -} 1 +package com.bsth.service.geo_data;
  2 +
  3 +import com.bsth.entity.geo_data.GeoRoad;
  4 +import com.bsth.entity.geo_data.GeoStation;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/12/7.
  10 + */
  11 +public interface GeoDataService {
  12 +
  13 +
  14 + Map<String, Object> findGeoStations(String lineCode, Integer version);
  15 +
  16 +
  17 + Map<String, Object> findGeoRoad(String lineCode,Integer version);
  18 +
  19 + Map<String, Object> updateBufferInfo(GeoStation station);
  20 +
  21 + Map<String, Object> updateStationName(Map<String, Object> map);
  22 +
  23 + Map<String,Object> addNewStationRoute(String lineCode, int upDown,int versions, String stationName, Float lat, Float lng, int prevRouteId);
  24 +
  25 + Map<String,Object> destroyStation(GeoStation station);
  26 +
  27 + Map<String,Object> updateRoadInfo(GeoRoad road);
  28 +
  29 + Map<String,Object> destroyRoad(GeoRoad road);
  30 +
  31 + Map<String,Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId);
  32 +
  33 + Map<String,Object> findVersionInfo(String lineCode);
  34 +
  35 + Map<String,Object> addNewLineVersion(Map<String, Object> map);
  36 +
  37 + Map<String,Object> deleteLineVersion(String lineCode, int version);
  38 +
  39 + Map<String,Object> findFutureVersion(String lineCode);
  40 +
  41 + Map<String,Object> addEnableInfo(String lineCode, int version, String enableTime);
  42 +}