Commit 76a4b27366c19f78e49cf7ce3de18e1c01235a61

Authored by 徐烜
2 parents 6656b6a3 af8ec3be

PSM-12

Showing 86 changed files with 3649 additions and 334 deletions

Too many changes to show.

To preserve performance only 86 of 350 files are displayed.

README.md
... ... @@ -447,4 +447,9 @@
447 447 | direction | float | 角度0-359 |
448 448 | inTemp | int | 车内温度 |
449 449 | serviceState | long | 设备状态字 |
450   -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
451 450 \ No newline at end of file
  451 +<<<<<<< HEAD
  452 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
  453 +=======
  454 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
  455 +
  456 +>>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50
... ...
... ... @@ -142,6 +142,18 @@
142 142 <artifactId>c3p0</artifactId>
143 143 <version>0.9.1.2</version>
144 144 </dependency>
  145 +
  146 + <!-- 图表 -->
  147 + <dependency>
  148 + <groupId>com.google.code.gson</groupId>
  149 + <artifactId>gson</artifactId>
  150 + <version>2.2.4</version>
  151 + </dependency>
  152 + <dependency>
  153 + <groupId>com.github.abel533</groupId>
  154 + <artifactId>ECharts</artifactId>
  155 + <version>2.1.8</version>
  156 + </dependency>
145 157  
146 158 <!-- pentaho kettle 依赖 -->
147 159 <dependency>
... ... @@ -196,7 +208,17 @@
196 208 <groupId>org.bouncycastle</groupId>
197 209 <artifactId>bcprov-jdk15on</artifactId>
198 210 <version>1.52</version>
199   - </dependency>
  211 + </dependency>
  212 + <dependency>
  213 + <groupId>axis</groupId>
  214 + <artifactId>axis</artifactId>
  215 + <version>1.4</version>
  216 + </dependency>
  217 + <dependency>
  218 + <groupId>javax.xml</groupId>
  219 + <artifactId>jaxrpc-api</artifactId>
  220 + <version>1.1</version>
  221 + </dependency>
200 222 </dependencies>
201 223  
202 224 <dependencyManagement>
... ...
src/main/java/com/bsth/Application.java
... ... @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary;
16 16 @SpringBootApplication
17 17 public class Application extends SpringBootServletInitializer {
18 18  
19   - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(11);
  19 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(12);
20 20  
21 21 @Override
22 22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
... ...
src/main/java/com/bsth/ServiceStateTest.java
... ... @@ -3,8 +3,8 @@ package com.bsth;
3 3 public class ServiceStateTest {
4 4  
5 5 public static void main(String[] args) {
6   - System.out.println("运营状态:" + getService(603979776));
7   - System.out.println("上下行:" + getUpOrDown(603979776));
  6 + System.out.println("运营状态:" + getService(268435456));
  7 + System.out.println("上下行:" + getUpOrDown(268435456));
8 8 }
9 9  
10 10 /**
... ...
src/main/java/com/bsth/StartCommand.java
... ... @@ -23,37 +23,6 @@ public class StartCommand implements CommandLineRunner{
23 23 @Autowired
24 24 SecurityMetadataSourceService invocationSecurityMetadataSourceService;
25 25  
26   - //public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(8);
27   -
28   - /*@Autowired
29   - GpsRealDataRefreshThread gpsRefreshThread;
30   - @Autowired
31   - GetSchedulePlanThread getSchedulePlanThread;
32   - @Autowired
33   - CommonRefreshThread commonRefreshThread;
34   - @Autowired
35   - DirectivePersistenceThread directivePersistenceThread;
36   - @Autowired
37   - SchedulePersistenceThread SchedulePersistenceThread;
38   - @Autowired
39   - ArrivalThread gpsArrivalStationThread;
40   - @Autowired
41   - FirstScheduleIssuedThread firstScheduleIssuedThread;
42   -
43   - @Autowired
44   - DirectiveService directiveService;
45   - @Autowired
46   - DirectiveBuffer directiveBuffer;
47   - @Autowired
48   - CarConfigInfoRepository carConfigInfoRepository;
49   -
50   - @Autowired
51   - GpsOfflineMonitorThread gpsOfflineMonitorThread;*/
52   -
53   - /*final static Long HOUR_TIME = 1000 * 60 * 60L;
54   -
55   - final static int HOUR_SECOND = 60 * 60;*/
56   -
57 26 @Override
58 27 public void run(String... arg0){
59 28  
... ... @@ -61,91 +30,6 @@ public class StartCommand implements CommandLineRunner{
61 30 //启动时加载所有资源
62 31 invocationSecurityMetadataSourceService.loadResourceDefine();
63 32  
64   - /**
65   - * 车辆,设备,公司等常用的映射数据,每两小时刷新一次
66   - *//*
67   - commonRefreshThread.start();
68   - scheduler.scheduleWithFixedDelay(commonRefreshThread, HOUR_SECOND * 2 , HOUR_SECOND * 2, TimeUnit.SECONDS);
69   - //等映射数据加载完......睡一会吧
70   - Thread.sleep(4000);
71   -
72   - *//**
73   - * GPS实时数据更新 线程
74   - * 每8秒和网关HTTP接口同步一次
75   - *//*
76   - scheduler.scheduleWithFixedDelay(gpsRefreshThread, 0, 8, TimeUnit.SECONDS);
77   -
78   - *//**
79   - * GPS 监控设备掉线行为
80   - * 每分钟检测一次
81   - *//*
82   - scheduler.scheduleWithFixedDelay(gpsOfflineMonitorThread, 60, 60, TimeUnit.SECONDS);
83   -
84   -
85   - *//**
86   - * 每天 凌晨 2 点 抓取当天实际排班
87   - *//*
88   - //启动时先run一次
89   - getSchedulePlanThread.start();
90   - scheduler.scheduleAtFixedRate(getSchedulePlanThread
91   - , ((DateUtils.getTimesnight2() + HOUR_TIME * 2) - System.currentTimeMillis()) / 1000
92   - , 60 * 60 * 24, TimeUnit.SECONDS);
93   -
94   - *//**
95   - * 调度指令两分钟入库一次
96   - * 指令会缓存在内存,直到收到所有响应再入库
97   - *//*
98   - //从数据库恢复初始数据
99   - directiveBuffer.recovery();
100   - scheduler.scheduleWithFixedDelay(directivePersistenceThread, 20, 60 * 2, TimeUnit.SECONDS);
101   -
102   - *//**
103   - * 每分钟将有变更的班次入库(不包括子任务)
104   - * 单纯为了提高 线调操作 的响应速度
105   - *//*
106   - scheduler.scheduleWithFixedDelay(SchedulePersistenceThread, 60 * 1, 60 * 1, TimeUnit.SECONDS);
107   -
108   - *//**
109   - * 每15秒从数据库抓取到离站信息和班次匹配
110   - * (网关生成的到离站数据也是延迟批量入库,所以缩短该线程执行周期并不会提高 “实际到离站” 的实时性)
111   - *//*
112   - scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 35, 15, TimeUnit.SECONDS);
113   -
114   - *//**
115   - * 首个调度指令下发(2分钟运行一次)
116   - * 每辆车的第一个调度指令由该线程下发
117   - * 后续班次由 “实际终点到达” 事件触发指令下发
118   - *//*
119   - scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS);
120   - */
121   -
122   -/* new Timer().schedule(new TimerTask() {
123   -
124   - @Override
125   - public void run() {
126   - List<CarConfigInfo> ccis = carConfigInfoRepository.findAll();
127   - Cars car;
128   - Line line;
129   - String lineCode;
130   - System.out.println("ccis size: " + ccis.size());
131   - for(CarConfigInfo cci : ccis){
132   - car = cci.getCl();
133   - line = cci.getXl();
134   - lineCode = line.getLineCode();
135   -
136   - String data = directiveService.createDeviceRefreshData(CommonMapped.vehicDeviceBiMap.inverse().get(car.getInsideCode())
137   - , Integer.parseInt(lineCode));
138   - System.out.println(data);
139   - int code = HttpUtils.postJson(data);
140   - System.out.println("车辆:" + car.getInsideCode() + "刷新线路:" + line.getLineCode());
141   - code = directiveService.lineChange(car.getInsideCode(), Integer.parseInt(lineCode));
142   - //directiveService.send60Phrase(car.getInsideCode(), "");
143   - System.out.println("返回值:" + code);
144   - }
145   -
146   - }
147   - }, 1000 * 10);*/
148   -
149 33 } catch (Exception e) {
150 34 e.printStackTrace();
151 35 }
... ...
src/main/java/com/bsth/Test.java deleted 100644 → 0
1   -//package com.bsth;
2   -//
3   -//import java.io.ByteArrayOutputStream;
4   -//import java.io.IOException;
5   -//import java.io.InputStream;
6   -//import java.io.OutputStream;
7   -//import java.net.HttpURLConnection;
8   -//import java.net.URL;
9   -//import java.util.HashMap;
10   -//import java.util.Map;
11   -//
12   -//import org.apache.commons.io.IOUtils;
13   -//
14   -//import com.fasterxml.jackson.databind.ObjectMapper;
15   -//
16   -//public class Test {
17   -//
18   -// public static void main(String[] args) {
19   -// Map<String, Object> map = new HashMap<>();
20   -// map.put("timestamp", 1469764939000L);
21   -// map.put("operCode", 128);
22   -// map.put("deviceId", "66ML0007");
23   -//
24   -// Map<String , Object> dataMap = new HashMap<>();
25   -// dataMap.put("requestCode", 161);
26   -// dataMap.put("lineId", 1025);
27   -// dataMap.put("operCode2", 38);
28   -//
29   -// map.put("data", dataMap);
30   -// request(map, "http://192.168.168.171:9088/control/upstream");
31   -//
32   -// }
33   -//
34   -// private static Map<String, Object> request(Map<String, Object> map, String url) {
35   -// InputStream in = null;
36   -// OutputStream out = null;
37   -// HttpURLConnection con = null;
38   -// try {
39   -// con = (HttpURLConnection)new URL(url).openConnection();
40   -// con.setRequestMethod("POST");
41   -// con.setRequestProperty("keep-alive", "true");
42   -// con.setRequestProperty("accept", "*/*");
43   -// con.setDoInput(true);
44   -// con.setDoOutput(true);
45   -// con.setReadTimeout(2500);
46   -// con.setConnectTimeout(2500);
47   -// out = con.getOutputStream();
48   -// out.write("json=".getBytes());
49   -// out.write(new ObjectMapper().writeValueAsBytes(map));
50   -// out.flush();
51   -// System.out.println("con.getResponseCode(): " + con.getResponseCode());
52   -// if (con.getResponseCode() == 200) {
53   -// in = con.getInputStream();
54   -// ByteArrayOutputStream bout = new ByteArrayOutputStream();
55   -// IOUtils.copy(in, bout); bout.close();
56   -// System.out.println("Message:" + new String(bout.toByteArray()));
57   -// return new ObjectMapper().readValue(bout.toByteArray(), Map.class);
58   -// }
59   -// } catch (IOException e) {
60   -// e.printStackTrace();
61   -// } finally {
62   -// con.disconnect();
63   -// try {
64   -// if (in != null) in.close();
65   -// if (out != null) out.close();
66   -// } catch (IOException e) {
67   -// e.printStackTrace();
68   -// }
69   -// }
70   -// return null;
71   -// }
72   -//}
src/main/java/com/bsth/Test2.java deleted 100644 → 0
1   -package com.bsth;
2   -
3   -public class Test2 {
4   -
5   - public static void main(String[] args) {
6   -
7   - for(int i = 0; i < 20; i ++){
8   - new MyThread(i + "").start();
9   - }
10   - }
11   -
12   - public static class MyThread extends Thread {
13   -
14   - private String name ;
15   -
16   - public MyThread(String name) {
17   - this.name = name;
18   - }
19   -
20   - @Override
21   - public void run() {
22   - method(name);
23   - }
24   - }
25   -
26   - public static void method(String name){
27   - System.out.println("线程" + name + "开始...");
28   - int a = 0;
29   - for(int i = 0; i < 1000; i ++){
30   - a ++;
31   - }
32   - a--;
33   - System.out.println("线程" + name + "结束... a = " + a);
34   - }
35   -}
src/main/java/com/bsth/WebAppConfiguration.java
... ... @@ -2,18 +2,21 @@ package com.bsth;
2 2  
3 3 import javax.servlet.Filter;
4 4  
  5 +import org.springframework.beans.factory.annotation.Autowired;
5 6 import org.springframework.boot.context.embedded.FilterRegistrationBean;
6 7 import org.springframework.context.annotation.Bean;
7 8 import org.springframework.context.annotation.ComponentScan;
8 9 import org.springframework.context.annotation.Configuration;
9 10 import org.springframework.web.filter.CharacterEncodingFilter;
10 11 import org.springframework.web.filter.HttpPutFormContentFilter;
  12 +import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
11 13 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
12 14 import org.springframework.web.socket.config.annotation.EnableWebSocket;
13 15 import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
14 16 import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
15 17  
16 18 import com.bsth.filter.ResourceFilter;
  19 +import com.bsth.oplog.http.HttpOpLogInterceptor;
17 20 import com.bsth.websocket.WebSocketHandshakeInterceptor;
18 21 import com.bsth.websocket.handler.RealControlSocketHandler;
19 22  
... ... @@ -22,12 +25,12 @@ import com.bsth.websocket.handler.RealControlSocketHandler;
22 25 @ComponentScan
23 26 public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{
24 27  
  28 + @Autowired
  29 + HttpOpLogInterceptor httpOpLogInterceptor;
  30 +
25 31 /**
26   - *
27 32 * @Title: httpPutFormContentFilter
28 33 * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换)
29   - * @return Filter 返回类型
30   - * @throws
31 34 */
32 35 @Bean
33 36 public Filter httpPutFormContentFilter() {
... ... @@ -35,11 +38,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
35 38 }
36 39  
37 40 /**
38   - *
39 41 * @Title: characterEncodingFilter
40 42 * @Description: TODO(编码过滤器)
41   - * @return Filter 返回类型
42   - * @throws
43 43 */
44 44 @Bean
45 45 public Filter characterEncodingFilter(){
... ... @@ -50,8 +50,6 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
50 50 *
51 51 * @Title: resourceFilterRegistration
52 52 * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 )
53   - * @return FilterRegistrationBean 返回类型
54   - * @throws
55 53 */
56 54 @Bean
57 55 public FilterRegistrationBean resourceFilterRegistration(){
... ... @@ -59,8 +57,18 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
59 57 registration.setFilter(new ResourceFilter());
60 58 registration.addUrlPatterns("/pages/*");
61 59 return registration;
62   - }
63   -
  60 + }
  61 +
  62 + /**
  63 + *
  64 + * @Title: addInterceptors
  65 + * @Description: TODO(HTTP结构化访问日志记录 )
  66 + */
  67 + @Override
  68 + public void addInterceptors(InterceptorRegistry registry) {
  69 + registry.addInterceptor(httpOpLogInterceptor);
  70 + }
  71 +
64 72 @Override
65 73 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
66 74 //线调webSocket
... ...
src/main/java/com/bsth/common/Constants.java
... ... @@ -24,7 +24,7 @@ public class Constants {
24 24 /**
25 25 * 线调部分子页面不做拦截,便于浏览器缓存
26 26 */
27   - public static final String XD_CHILD_PAGES = "/pages/control/line/child_pages/**";
  27 + public static final String XD_CHILD_PAGES = "/real_control_v2/**";
28 28 public static final String XD_TEMPS = "/pages/control/line/temps/**";
29 29  
30 30 //车载网关上行接口
... ...
src/main/java/com/bsth/controller/BaseController.java
... ... @@ -65,7 +65,7 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
65 65 // 多个字段格式:{col1},{col2},{col3},....,{coln}
66 66 // 每个字段的排序方向都是一致,这个以后再看要不要改
67 67 List<String> list = Splitter.on(",").trimResults().splitToList(order);
68   - return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
  68 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
69 69 }
70 70  
71 71 /**
... ...
src/main/java/com/bsth/controller/PersonnelController.java
1 1 package com.bsth.controller;
2 2  
3 3 import com.bsth.entity.Personnel;
  4 +import com.bsth.service.PersonnelService;
4 5 import com.bsth.service.schedule.utils.DataToolsProperties;
5 6 import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.boot.context.properties.EnableConfigurationProperties;
7 8 import org.springframework.web.bind.annotation.*;
8 9  
  10 +import java.util.List;
9 11 import java.util.Map;
10 12  
11 13 /**
... ... @@ -19,6 +21,8 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; {
19 21 @Autowired
20 22 private DataToolsProperties dataToolsProperties;
21 23  
  24 + @Autowired
  25 + private PersonnelService service;
22 26 /**
23 27 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
24 28 * @Title: save
... ... @@ -58,4 +62,9 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; {
58 62 protected String getDataExportFilename() {
59 63 return "人员基础信息";
60 64 }
  65 +
  66 + @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET)
  67 + public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) {
  68 + return service.sreachPersonnel(jobCode);
  69 + }
61 70 }
... ...
src/main/java/com/bsth/controller/SectionSpeedController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.SectionSpeed;
  7 +import com.bsth.service.SectionSpeedService;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +
  13 +@RestController
  14 +@RequestMapping("sectionspeed")
  15 +public class SectionSpeedController extends BaseController<SectionSpeed, Integer> {
  16 +
  17 + @Autowired
  18 + private SectionSpeedService sectionSpeedService;
  19 +
  20 + /**@description TODO(新增路段限速) */
  21 + @RequestMapping(value="add" , method = RequestMethod.POST)
  22 + public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
  23 + return sectionSpeedService.add(map);
  24 + }
  25 +
  26 + /**@description TODO(修改路段) */
  27 + @RequestMapping(value="roadUpd" , method = RequestMethod.POST)
  28 + public Map<String, Object> roadUpd(@RequestParam Map<String, Object> map) {
  29 + return sectionSpeedService.roadUpd(map);
  30 + }
  31 +
  32 + /** @description TODO(根据线路ID与编码及方向查询路段限速信息) */
  33 + @RequestMapping(value="getSectionSpeedInfoList",method=RequestMethod.GET)
  34 + public List<Map<String, Object>> getSectionSpeedInfoList(@RequestParam Map<String, Object> map){
  35 + return sectionSpeedService.getSectionSpeedInfo(map);
  36 + }
  37 +
  38 + /**
  39 + * @Description :TODO(查询路段信息)
  40 + *
  41 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  42 + *
  43 + * @return Map<String, Object>
  44 + */
  45 + @RequestMapping(value = "/analyticSection" , method = RequestMethod.GET)
  46 + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
  47 + return sectionSpeedService.analyticSection(map);
  48 + }
  49 +
  50 +}
... ...
src/main/java/com/bsth/controller/StationRouteController.java
... ... @@ -120,6 +120,15 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
120 120 return stationRouteRepository.findStations(xlid, xldir);
121 121 }
122 122  
123   -
  123 + /**
  124 + *
  125 + * @Title: findByMultiLine
  126 + * @Description: TODO(多线路路由查询)
  127 + */
  128 + @RequestMapping(value = "/multiLine", method = RequestMethod.GET)
  129 + public Map<String, Object> findByMultiLine(@RequestParam String lineIds){
  130 +
  131 + return service.findByMultiLine(lineIds);
  132 + }
124 133  
125 134 }
... ...
src/main/java/com/bsth/controller/directive/DirectiveController.java
... ... @@ -3,13 +3,17 @@ package com.bsth.controller.directive;
3 3 import java.util.List;
4 4 import java.util.Map;
5 5  
  6 +import org.apache.commons.lang3.StringEscapeUtils;
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.web.bind.annotation.RequestMapping;
8 9 import org.springframework.web.bind.annotation.RequestMethod;
9 10 import org.springframework.web.bind.annotation.RequestParam;
10 11 import org.springframework.web.bind.annotation.RestController;
11 12  
  13 +import com.alibaba.fastjson.JSON;
  14 +import com.alibaba.fastjson.JSONObject;
12 15 import com.bsth.entity.directive.D80;
  16 +import com.bsth.entity.directive.DC0_A3;
13 17 import com.bsth.entity.sys.SysUser;
14 18 import com.bsth.security.util.SecurityUtils;
15 19 import com.bsth.service.directive.DirectiveService;
... ... @@ -130,4 +134,28 @@ public class DirectiveController {
130 134  
131 135 return directiveService.findDirective(nbbm, dType, page, size);
132 136 }
  137 +
  138 + @RequestMapping(value = "/c0a4", method = RequestMethod.POST)
  139 + public int c0a4(@RequestParam String nbbm){
  140 + return directiveService.sendC0A4(nbbm);
  141 + }
  142 +
  143 +// @RequestMapping(value = "/c0a3", method = RequestMethod.POST)
  144 +// public int c0a3(@RequestParam DC0_A4 c0a4){
  145 +// return directiveService.sendC0A3(c0a4);
  146 +// }
  147 +
  148 + @RequestMapping(value = "/c0a3", method = RequestMethod.POST)
  149 + public int c0a3(String json){
  150 + json = StringEscapeUtils.unescapeHtml4(json);
  151 + DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class);
  152 + return directiveService.sendC0A3(c0a3);
  153 + }
  154 +
  155 + @RequestMapping(value = "/c0a5", method = RequestMethod.POST)
  156 + public int c0a5(String json){
  157 + json = StringEscapeUtils.unescapeHtml4(json);
  158 + //DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class);
  159 + return directiveService.sendC0A5(json);
  160 + }
133 161 }
... ...
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
... ... @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
13 13 import com.bsth.data.directive.DayOfDirectives;
14 14 import com.bsth.data.pilot80.PilotReport;
15 15 import com.bsth.entity.directive.D80;
  16 +import com.bsth.entity.directive.DC0_A4;
16 17 import com.bsth.entity.directive.DirectiveReponse;
17 18  
18 19 /**
... ... @@ -53,10 +54,25 @@ public class UpstreamEntrance {
53 54 // 80协议上报
54 55 else if (jsonParam.getInteger("operCode") == 0X80) {
55 56 try {
56   - D80 d80 = JSON.toJavaObject(jsonParam, D80.class);
57   - // 驾驶员上报
58   - if (d80.getData().getOperCode2() == 0x26)
  57 + JSONObject data = jsonParam.getJSONObject("data");
  58 + switch (data.getShort("operCode2")) {
  59 + case 0x26:
  60 + // 驾驶员上报
  61 + D80 d80 = JSON.toJavaObject(jsonParam, D80.class);
59 62 pilotReport.report(d80);
  63 + break;
  64 +
  65 + case 0xA4:
  66 + data.put("port", data.getString("port").trim());
  67 + data.put("posPort", data.getString("posPort").trim());
  68 + data.put("posIpAddress", data.getString("posIpAddress").trim());
  69 + data.put("ipAddress", data.getString("ipAddress").trim());
  70 +
  71 + DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class);
  72 + System.out.println(c0a4);
  73 + break;
  74 + }
  75 +
60 76 } catch (Exception e) {
61 77 logger.error("", e);
62 78 }
... ...
src/main/java/com/bsth/controller/excep/AbnormalController.java 0 → 100644
  1 +package com.bsth.controller.excep;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.ResponseBody;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.bsth.controller.BaseController;
  14 +import com.bsth.entity.excep.Abnormal;
  15 +import com.bsth.entity.sys.SysUser;
  16 +import com.bsth.service.excep.AbnormalService;
  17 +import com.bsth.util.PageObject;
  18 +
  19 +@RestController
  20 +@RequestMapping("abnormal")
  21 +public class AbnormalController extends BaseController<SysUser, Integer>{
  22 + @Autowired
  23 + private AbnormalService abnormalService;
  24 +
  25 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  26 + public PageObject<Abnormal> pagequery(@RequestParam Map<String, Object> map){
  27 + PageObject<Abnormal> pageObject = null;
  28 + map.put("curPage", map.get("page").toString());
  29 + map.put("pageData","10");
  30 + pageObject=abnormalService.Pagequery(map);
  31 + return pageObject;
  32 +
  33 + }
  34 +
  35 +
  36 + @RequestMapping(value = "/getReport", method = RequestMethod.POST)
  37 + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) {
  38 + Map<String, Object> modelMap = new HashMap<String, Object>();
  39 + try {
  40 + map.put("isShow", 1);
  41 +// modelMap = offlineService.getReport(map);
  42 + } catch (Exception e) {
  43 + e.printStackTrace();
  44 + }
  45 + return modelMap;
  46 + }
  47 +
  48 +
  49 +}
... ...
src/main/java/com/bsth/controller/excep/OfflineController.java 0 → 100644
  1 +package com.bsth.controller.excep;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.ResponseBody;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.bsth.controller.BaseController;
  14 +import com.bsth.entity.excep.Offline;
  15 +import com.bsth.entity.sys.SysUser;
  16 +import com.bsth.service.excep.OfflineService;
  17 +import com.bsth.util.PageObject;
  18 +
  19 +@RestController
  20 +@RequestMapping("offline")
  21 +public class OfflineController extends BaseController<SysUser, Integer>{
  22 + @Autowired
  23 + private OfflineService offlineService;
  24 +
  25 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  26 + public PageObject<Offline> pagequery(@RequestParam Map<String, Object> map){
  27 + PageObject<Offline> pageObject = null;
  28 + map.put("curPage", map.get("page").toString());
  29 + map.put("pageData","10");
  30 + pageObject=offlineService.Pagequery(map);
  31 + return pageObject;
  32 +
  33 + }
  34 +
  35 +
  36 + @RequestMapping(value = "/getReport", method = RequestMethod.POST)
  37 + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) {
  38 + Map<String, Object> modelMap = new HashMap<String, Object>();
  39 + try {
  40 + map.put("isShow", 1);
  41 + modelMap = offlineService.getReport(map);
  42 + } catch (Exception e) {
  43 + e.printStackTrace();
  44 + }
  45 + return modelMap;
  46 + }
  47 +
  48 +
  49 +}
... ...
src/main/java/com/bsth/controller/excep/OutboundController.java 0 → 100644
  1 +package com.bsth.controller.excep;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.controller.BaseController;
  13 +import com.bsth.entity.excep.Outbound;
  14 +import com.bsth.entity.sys.SysUser;
  15 +import com.bsth.service.excep.OutboundService;
  16 +import com.bsth.util.PageObject;
  17 +
  18 +@RestController
  19 +@RequestMapping("bound")
  20 +public class OutboundController extends BaseController<SysUser, Integer>{
  21 + @Autowired
  22 + private OutboundService outboundService;
  23 +
  24 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  25 + public PageObject<Outbound> pagequery(@RequestParam Map<String, Object> map){
  26 + PageObject<Outbound> pageObject = null;
  27 + map.put("curPage", map.get("page").toString());
  28 + map.put("pageData","10");
  29 + pageObject=outboundService.Pagequery(map);
  30 + return pageObject;
  31 +
  32 + }
  33 +
  34 +
  35 + @RequestMapping(value = "/getReport", method = RequestMethod.POST)
  36 + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) {
  37 + Map<String, Object> modelMap = new HashMap<String, Object>();
  38 + try {
  39 + map.put("isShow", 1);
  40 + modelMap = outboundService.getReport(map);
  41 + } catch (Exception e) {
  42 + e.printStackTrace();
  43 + }
  44 + return modelMap;
  45 + }
  46 +
  47 +
  48 +}
... ...
src/main/java/com/bsth/controller/excep/SpeedingController.java 0 → 100644
  1 +package com.bsth.controller.excep;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.ResponseBody;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.bsth.controller.BaseController;
  14 +import com.bsth.entity.excep.Offline;
  15 +import com.bsth.entity.excep.Speeding;
  16 +import com.bsth.entity.sys.SysUser;
  17 +import com.bsth.service.excep.OfflineService;
  18 +import com.bsth.service.excep.SpeedingService;
  19 +import com.bsth.util.PageObject;
  20 +
  21 +@RestController
  22 +@RequestMapping("speeding")
  23 +public class SpeedingController extends BaseController<SysUser, Integer>{
  24 + @Autowired
  25 + private SpeedingService speedingService;
  26 +
  27 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  28 + public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){
  29 + PageObject<Speeding> pageObject = null;
  30 + map.put("curPage", map.get("page").toString());
  31 + map.put("pageData","10");
  32 + pageObject=speedingService.Pagequery(map);
  33 + return pageObject;
  34 +
  35 + }
  36 +
  37 +
  38 + @RequestMapping(value = "/getReport", method = RequestMethod.POST)
  39 + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) {
  40 + Map<String, Object> modelMap = new HashMap<String, Object>();
  41 + try {
  42 + map.put("isShow", 1);
  43 + modelMap = speedingService.getReport(map);
  44 + } catch (Exception e) {
  45 + e.printStackTrace();
  46 + }
  47 + return modelMap;
  48 + }
  49 +
  50 +
  51 +}
... ...
src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -24,6 +24,17 @@ public class GpsController {
24 24  
25 25 @Autowired
26 26 GpsService gpsService;
  27 +
  28 + @RequestMapping(value = "/real/all")
  29 + public Map<String, Object> search(@RequestParam Map<String, Object> map,
  30 + @RequestParam(defaultValue = "0") int page,
  31 + @RequestParam(defaultValue = "15") int size,
  32 + @RequestParam(defaultValue = "timestamp") String order,
  33 + @RequestParam(defaultValue = "DESC") String direction){
  34 +
  35 +
  36 + return gpsService.search(map, page, size, order, direction);
  37 + }
27 38  
28 39 @RequestMapping(value = "/real/line/{lineCode}")
29 40 public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
... ...
src/main/java/com/bsth/controller/oil/CylController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +import java.util.Map;
  7 +
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.bsth.controller.BaseController;
  14 +import com.bsth.entity.oil.Cyl;
  15 +import com.bsth.service.oil.CylService;
  16 +
  17 +@RestController
  18 +@RequestMapping("cyl")
  19 +public class CylController extends BaseController<Cyl, Integer>{
  20 + @Autowired
  21 + CylService service;
  22 + @RequestMapping(value = "/save",method = RequestMethod.POST)
  23 + public Map<String, Object> saveYlb(Cyl t){
  24 +// SysUser user = SecurityUtils.getCurrentUser();
  25 + t.setGsdm("77");
  26 + t.setUpdatetime(new Date());
  27 + /*SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  28 + try {
  29 + t.setUpdatetime(sdf.parse("2016-10-13"));
  30 + } catch (ParseException e) {
  31 + // TODO Auto-generated catch block
  32 + e.printStackTrace();
  33 + }*/
  34 + return service.save(t);
  35 + }
  36 +}
... ...
src/main/java/com/bsth/controller/oil/YlbController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.data.domain.Page;
  11 +import org.springframework.data.domain.PageRequest;
  12 +import org.springframework.data.domain.Sort;
  13 +import org.springframework.data.domain.Sort.Direction;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RequestMethod;
  16 +import org.springframework.web.bind.annotation.RequestParam;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +
  19 +import com.bsth.controller.BaseController;
  20 +import com.bsth.entity.oil.Ylb;
  21 +import com.bsth.entity.sys.SysUser;
  22 +import com.bsth.security.util.SecurityUtils;
  23 +import com.bsth.service.oil.YlbService;
  24 +import com.google.common.base.Splitter;
  25 +
  26 +@RestController
  27 +@RequestMapping("ylb")
  28 +public class YlbController extends BaseController<Ylb, Integer>{
  29 + @Autowired
  30 + YlbService yblService;
  31 +
  32 + @RequestMapping(value = "/saveYlb",method = RequestMethod.POST)
  33 + public Map<String, Object> saveYlb(Ylb t){
  34 +// SysUser user = SecurityUtils.getCurrentUser();
  35 + t.setCreatetime(new Date());
  36 +// Ylb t=new Ylb();
  37 + return yblService.save(t);
  38 + }
  39 +
  40 +
  41 + /**
  42 + * 把加油(YLXXB)的数据加入
  43 + * @param map
  44 + * @return
  45 + */
  46 + @RequestMapping(value = "/obtain",method = RequestMethod.GET)
  47 + public List<Map<String, Object>> obtain(@RequestParam Map<String, Object> map){
  48 + String rq=map.get("rq").toString();
  49 + List<Map<String, Object>> list=yblService.obtain(rq);
  50 + System.out.println();
  51 + return list;
  52 + }
  53 +
  54 + /**
  55 + *
  56 + * @Title: list
  57 + * @Description: TODO(多条件分页查询)
  58 + * @param @param map 查询条件
  59 + * @param @param page 页码
  60 + * @param @param size 每页显示数量
  61 + * @throws
  62 + */
  63 + @RequestMapping(method = RequestMethod.GET)
  64 + public Page<Ylb> list(@RequestParam Map<String, Object> map,
  65 + @RequestParam(defaultValue = "0") int page,
  66 + @RequestParam(defaultValue = "10") int size,
  67 + @RequestParam(defaultValue = "id") String order,
  68 + @RequestParam(defaultValue = "DESC") String direction){
  69 +
  70 + Direction d;
  71 + try {
  72 + String rq=map.get("rq").toString();
  73 + if(!(rq=="")){
  74 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  75 + map.put("rq_eq", sdf.parse(rq));
  76 + }
  77 + } catch (ParseException e) {
  78 + // TODO Auto-generated catch block
  79 + e.printStackTrace();
  80 + }
  81 + if(null != direction && direction.equals("ASC"))
  82 + d = Direction.ASC;
  83 + else
  84 + d = Direction.DESC;
  85 +
  86 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  87 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  88 + // 每个字段的排序方向都是一致,这个以后再看要不要改
  89 + List<String> list = Splitter.on(",").trimResults().splitToList(order);
  90 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
  91 + }
  92 +
  93 +}
... ...
src/main/java/com/bsth/controller/oil/YlxxbController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.entity.oil.Ylxxb;
  8 +
  9 +@RestController
  10 +@RequestMapping("ylxxb")
  11 +public class YlxxbController extends BaseController<Ylxxb, Integer>{
  12 +
  13 +}
... ...
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RestController;
  9 +
  10 +import com.alibaba.fastjson.JSON;
  11 +import com.alibaba.fastjson.serializer.PropertyFilter;
  12 +import com.bsth.data.BasicData;
  13 +
  14 +@RestController
  15 +@RequestMapping("/basic")
  16 +public class BasicDataController {
  17 +
  18 +
  19 + @RequestMapping("/cars")
  20 + public Iterable<String> findAllNbbm(Map<String, Object> map){
  21 + return BasicData.deviceId2NbbmMap.values();
  22 + }
  23 +
  24 + @RequestMapping("/lineCode2Name")
  25 + public Map<String, String> findLineCodeMap(){
  26 + return BasicData.lineCode2NameMap;
  27 + }
  28 +
  29 + @RequestMapping("/parks")
  30 + public Map<String, String> findParks(){
  31 + Map<String, String> rs = new HashMap<>();
  32 + List<String> codes = BasicData.parkCodeList;
  33 + for(String code : codes){
  34 + rs.put(code, BasicData.stationCode2NameMap.get(code));
  35 + }
  36 + return rs;
  37 + }
  38 +
  39 + @RequestMapping("/personnel")
  40 + public Map<String, Object> findPersonnelInfo(){
  41 + Map<String, Object> rs = new HashMap<>();
  42 + PersonnelFieldFilter filter=new PersonnelFieldFilter();
  43 + //驾驶员
  44 + rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter)));
  45 + //售票员
  46 + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));
  47 + return rs;
  48 + }
  49 +
  50 +
  51 + public class PersonnelFieldFilter implements PropertyFilter{
  52 +
  53 + String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"};
  54 + @Override
  55 + public boolean apply(Object object, String name, Object value) {
  56 + for(String f : whiteList){
  57 + if(name.equals(f))
  58 + return true;
  59 + }
  60 + return false;
  61 + }
  62 +
  63 + }
  64 +}
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -7,6 +7,7 @@ import java.util.List;
7 7 import java.util.Map;
8 8  
9 9 import org.apache.commons.lang3.StringEscapeUtils;
  10 +import org.drools.core.runtime.help.impl.XStreamJSon.JSonAbortWorkItemConverter;
10 11 import org.springframework.beans.factory.annotation.Autowired;
11 12 import org.springframework.web.bind.annotation.PathVariable;
12 13 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -14,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
14 15 import org.springframework.web.bind.annotation.RequestParam;
15 16 import org.springframework.web.bind.annotation.RestController;
16 17  
  18 +import com.alibaba.fastjson.JSON;
  19 +import com.alibaba.fastjson.JSONArray;
17 20 import com.bsth.controller.BaseController;
  21 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  22 +import com.bsth.controller.realcontrol.dto.DfsjChange;
18 23 import com.bsth.data.BasicData;
19 24 import com.bsth.data.schedule.DayOfSchedule;
20 25 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -42,10 +47,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
42 47  
43 48 /**
44 49 *
  50 + * 改由通过 websocket 注册监听!!!
  51 + *
45 52 * @Title: registerLine @Description: TODO(注册线路,后续才能收到数据推送) @param @param
46 53 * lineCodes @throws
47 54 * 用GET 防止监控模式下被拦截
48   - */
  55 +
49 56 @RequestMapping(value = "/registerLine", method = RequestMethod.GET)
50 57 public int registerLine(@RequestParam String lineCodes) {
51 58 List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes);
... ... @@ -58,7 +65,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
58 65 BasicData.lineCode2SocketUserMap.put(line, userName);
59 66  
60 67 return 0;
61   - }
  68 + }*/
62 69  
63 70 /**
64 71 *
... ... @@ -67,20 +74,19 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
67 74 */
68 75 @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
69 76 public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
70   - @RequestParam String dfsj, String clZbh, String jsy, String spy) {
71   - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, clZbh, jsy, spy);
  77 + @RequestParam String dfsj/*, String clZbh, String jsy, String spy*/) {
  78 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj/*, clZbh, jsy, spy*/);
72 79 }
73 80  
74 81 /**
75 82 *
76   - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID
77   - * ,分隔 @param @param spaceAdjust 自动调整后续间隔(1 是 -1 否) @param @param remarks
78   - * 备注 @param @param reason 理由 @param @param spaceNum 间隔(分钟) @throws
  83 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
79 84 */
80 85 @RequestMapping(value = "/destroy", method = RequestMethod.POST)
81   - public Map<String, Object> destroy(@RequestParam String idsStr, @RequestParam(defaultValue = "-1") int spaceAdjust,
82   - @RequestParam String remarks, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum) {
83   - return scheduleRealInfoService.destroy(idsStr, spaceAdjust, remarks, reason, spaceNum);
  86 + public Map<String, Object> destroy(@RequestParam String idsStr
  87 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  88 + @RequestParam String remarks/*, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum*/) {
  89 + return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks/*, reason, spaceNum*/);
84 90 }
85 91  
86 92 /**
... ... @@ -380,4 +386,18 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
380 386 public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
381 387 return scheduleRealInfoService.realScheduleList(line,date);
382 388 }
  389 +
  390 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  391 + public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  392 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  393 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  394 + return scheduleRealInfoService.multi_tzrc(cpcs);
  395 + }
  396 +
  397 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  398 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  399 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  400 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  401 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  402 + }
383 403 }
... ...
src/main/java/com/bsth/controller/realcontrol/dto/ChangePersonCar.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: ChangePersonCar
  6 + * @Description: TODO(换人换车)
  7 + * @author PanZhao
  8 + * @date 2016年10月30日 下午10:06:54
  9 + *
  10 + */
  11 +public class ChangePersonCar {
  12 +
  13 + /** 班次ID */
  14 + private Long schId;
  15 +
  16 + /** 要更换的车辆自编号 */
  17 + private String clZbh;
  18 +
  19 + /** 驾驶员 工号/姓名 */
  20 + private String jsy;
  21 +
  22 + /** 售票员 工号/姓名 */
  23 + private String spy;
  24 +
  25 + public Long getSchId() {
  26 + return schId;
  27 + }
  28 +
  29 + public void setSchId(Long schId) {
  30 + this.schId = schId;
  31 + }
  32 +
  33 + public String getJsy() {
  34 + return jsy;
  35 + }
  36 +
  37 + public void setJsy(String jsy) {
  38 + this.jsy = jsy;
  39 + }
  40 +
  41 + public String getSpy() {
  42 + return spy;
  43 + }
  44 +
  45 + public void setSpy(String spy) {
  46 + this.spy = spy;
  47 + }
  48 +
  49 + public String getClZbh() {
  50 + return clZbh;
  51 + }
  52 +
  53 + public void setClZbh(String clZbh) {
  54 + this.clZbh = clZbh;
  55 + }
  56 +
  57 +}
... ...
src/main/java/com/bsth/controller/realcontrol/dto/DfsjChange.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: DfsjChange
  6 + * @Description: TODO(待发调整)
  7 + * @author PanZhao
  8 + * @date 2016年10月31日 上午1:00:11
  9 + *
  10 + */
  11 +public class DfsjChange {
  12 +
  13 + private Long schId;
  14 +
  15 + private String old_dfsj;
  16 +
  17 + private String new_dfsj;
  18 +
  19 + public Long getSchId() {
  20 + return schId;
  21 + }
  22 +
  23 + public void setSchId(Long schId) {
  24 + this.schId = schId;
  25 + }
  26 +
  27 + public String getOld_dfsj() {
  28 + return old_dfsj;
  29 + }
  30 +
  31 + public void setOld_dfsj(String old_dfsj) {
  32 + this.old_dfsj = old_dfsj;
  33 + }
  34 +
  35 + public String getNew_dfsj() {
  36 + return new_dfsj;
  37 + }
  38 +
  39 + public void setNew_dfsj(String new_dfsj) {
  40 + this.new_dfsj = new_dfsj;
  41 + }
  42 +
  43 +}
... ...
src/main/java/com/bsth/controller/schedule/TrafficManageController.java 0 → 100644
  1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.service.TrafficManageService;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.PathVariable;
  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 +/**
  13 + *
  14 + * @author BSTH
  15 + *
  16 + */
  17 +@RestController
  18 +@RequestMapping("trmg")
  19 +public class TrafficManageController {
  20 +
  21 + @Autowired
  22 + private TrafficManageService trManageService;
  23 +
  24 +
  25 + @RequestMapping(value = "/setXL", method = RequestMethod.GET)
  26 + public String setXL() throws Exception {
  27 + try {
  28 + return trManageService.setXL();
  29 + } catch (Exception exp) {
  30 + throw new Exception(exp.getCause());
  31 + }
  32 + }
  33 +
  34 + @RequestMapping(value = "/setCL", method = RequestMethod.GET)
  35 + public String setCL() throws Exception {
  36 + try {
  37 + return trManageService.setCL();
  38 + } catch (Exception exp) {
  39 + throw new Exception(exp.getCause());
  40 + }
  41 + }
  42 +
  43 + @RequestMapping(value = "/setSJ", method = RequestMethod.GET)
  44 + public String setSJ() throws Exception {
  45 + try {
  46 + return trManageService.setSJ();
  47 + } catch (Exception exp) {
  48 + throw new Exception(exp.getCause());
  49 + }
  50 + }
  51 +
  52 + @RequestMapping(value = "/setCS", method = RequestMethod.GET)
  53 + public String setCS() throws Exception {
  54 + try {
  55 + return trManageService.setCS();
  56 + } catch (Exception exp) {
  57 + throw new Exception(exp.getCause());
  58 + }
  59 + }
  60 +
  61 + @RequestMapping(value = "/setSKB", method = RequestMethod.GET)
  62 + public String setSKB(@RequestParam("ids") String ids) throws Exception {
  63 + try {
  64 + return trManageService.setSKB(ids);
  65 + } catch (Exception exp) {
  66 + throw new Exception(exp.getCause());
  67 + }
  68 + }
  69 +
  70 + @RequestMapping(value = "/setXLPC", method = RequestMethod.GET)
  71 + public String setXLPC() throws Exception {
  72 + try {
  73 + return trManageService.setXLPC();
  74 + } catch (Exception exp) {
  75 + throw new Exception(exp.getCause());
  76 + }
  77 + }
  78 +
  79 + @RequestMapping(value = "/setJHBC", method = RequestMethod.GET)
  80 + public String setJHBC() throws Exception {
  81 + try {
  82 + return trManageService.setDDRB();
  83 + } catch (Exception exp) {
  84 + throw new Exception(exp.getCause());
  85 + }
  86 + }
  87 +}
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -17,12 +17,14 @@ import com.bsth.Application;
17 17 import com.bsth.entity.CarPark;
18 18 import com.bsth.entity.Cars;
19 19 import com.bsth.entity.Line;
  20 +import com.bsth.entity.Personnel;
20 21 import com.bsth.entity.Station;
21 22 import com.bsth.entity.StationRoute;
22 23 import com.bsth.entity.schedule.CarConfigInfo;
23 24 import com.bsth.repository.CarParkRepository;
24 25 import com.bsth.repository.CarsRepository;
25 26 import com.bsth.repository.LineRepository;
  27 +import com.bsth.repository.PersonnelRepository;
26 28 import com.bsth.repository.StationRepository;
27 29 import com.bsth.repository.StationRouteRepository;
28 30 import com.bsth.repository.schedule.CarConfigInfoRepository;
... ... @@ -68,6 +70,20 @@ public class BasicData implements CommandLineRunner{
68 70 //停车场
69 71 public static List<String> parkCodeList;
70 72  
  73 + //线路ID和shangHaiLinecode 对照
  74 + public static Map<Integer, String> lineId2ShangHaiCodeMap;
  75 +
  76 + //线路Code和shangHaiLinecode 对照
  77 + public static Map<String, String> lineCode2ShangHaiCodeMap;
  78 +
  79 + //驾驶员工号 和 personnel 对象映射
  80 + public static Map<String, Personnel> jsyMap;
  81 + //售票员工号 和 personnel 对象映射
  82 + public static Map<String, Personnel> spyMap;
  83 + //全量员工 工号和姓名对照
  84 + public static Map<String, String> allPerson;
  85 +
  86 +
71 87 static Logger logger = LoggerFactory.getLogger(BasicData.class);
72 88  
73 89 @Autowired
... ... @@ -100,6 +116,9 @@ public class BasicData implements CommandLineRunner{
100 116 @Autowired
101 117 StationRouteRepository stationRouteRepository;
102 118  
  119 + @Autowired
  120 + PersonnelRepository personnelRepository;
  121 +
103 122  
104 123 @Override
105 124 public void run() {
... ... @@ -112,12 +131,18 @@ public class BasicData implements CommandLineRunner{
112 131 */
113 132 public int loadAllData(){
114 133 try{
  134 + //设备信息
115 135 loadDeviceInfo();
  136 + //站点信息
116 137 loadStationInfo();
  138 + //线路信息
117 139 loadLineInfo();
  140 + //车辆和线路映射信息
118 141 loadNbbm2LineInfo();
119   -
  142 + //站点路由信息
120 143 loadStationRouteInfo();
  144 + //人员信息
  145 + loadPersonnelInfo();
121 146 logger.info("加载基础数据成功!," );
122 147 }catch(Exception e){
123 148 logger.error("加载基础数据时出现异常," , e);
... ... @@ -213,15 +238,53 @@ public class BasicData implements CommandLineRunner{
213 238 Line line;
214 239 BiMap<Integer, String> biMap = HashBiMap.create();
215 240 Map<String, String> code2name = new HashMap<>();
  241 + Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
  242 + Map<String, String> code2SHcode = new HashMap<String, String>();
216 243  
217 244 while(iterator.hasNext()){
218 245 line = iterator.next();
219 246 biMap.put(line.getId(), line.getLineCode());
220 247 code2name.put(line.getLineCode(), line.getName());
  248 + id2SHcode.put(line.getId(),line.getShanghaiLinecode());
  249 + code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());
221 250 }
222 251  
223 252 lineId2CodeMap = biMap;
224 253 lineCode2NameMap = code2name;
  254 + lineId2ShangHaiCodeMap = id2SHcode;
  255 + lineCode2ShangHaiCodeMap = code2SHcode;
  256 + }
  257 +
  258 + /**
  259 + *
  260 + * @Title: loadPersonnelInfo
  261 + * @Description: TODO(加载人员信息)
  262 + */
  263 + public void loadPersonnelInfo() {
  264 + Iterator<Personnel> iterator = personnelRepository.findAll().iterator();
  265 +
  266 + Map<String, Personnel> jsyTempMap=new HashMap<>()
  267 + , spyTempMap=new HashMap<>();
  268 + Map<String, String> allPersonMap=new HashMap<>();
  269 +
  270 + Personnel p;
  271 +
  272 + while(iterator.hasNext()){
  273 + p = iterator.next();
  274 +
  275 + if(p.getPosts() != null){
  276 + if(p.getPosts().equals("1"))
  277 + jsyTempMap.put(p.getJobCode(), p);
  278 + else if(p.getPosts().equals("2"))
  279 + spyTempMap.put(p.getJobCode(), p);
  280 + }
  281 +
  282 + allPersonMap.put(p.getJobCode(), p.getPersonnelName());
  283 + }
  284 +
  285 + jsyMap=jsyTempMap;
  286 + spyMap=spyTempMap;
  287 + allPerson=allPersonMap;
225 288 }
226 289 }
227 290 }
... ...
src/main/java/com/bsth/data/LineConfigData.java
... ... @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
15 15 import com.bsth.entity.Line;
16 16 import com.bsth.entity.realcontrol.D80ReplyTemp;
17 17 import com.bsth.entity.realcontrol.LineConfig;
  18 +import com.bsth.oplog.normal.OpLogger;
18 19 import com.bsth.service.LineService;
19 20 import com.bsth.service.realcontrol.LineConfigService;
20 21  
... ... @@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner {
39 40  
40 41 @Autowired
41 42 LineService lineService;
  43 +
  44 + @Autowired
  45 + OpLogger opLog;
42 46  
43 47 @Override
44 48 public void run(String... arg0) throws Exception {
... ... @@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner {
47 51 Iterator<LineConfig> itr = lineConfigService.findAll().iterator();
48 52 while (itr.hasNext())
49 53 setBuffer(itr.next());
  54 +
  55 + opLog.info("Line_config_data");
50 56 }
51 57  
52 58 public LineConfig get(String lineCode){
... ...
src/main/java/com/bsth/data/arrival/AnalyseArrivalData.java renamed to src/main/java/com/bsth/data/arrival/AnalyseData.java
... ... @@ -20,9 +20,9 @@ import com.bsth.data.BasicData;
20 20 *
21 21 */
22 22 @Component
23   -public class AnalyseArrivalData {
  23 +public class AnalyseData {
24 24  
25   - Logger logger = LoggerFactory.getLogger(AnalyseArrivalData.class);
  25 + Logger logger = LoggerFactory.getLogger(AnalyseData.class);
26 26  
27 27 public void analyse(Set<String> cars){
28 28 try{
... ...
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
... ... @@ -64,7 +64,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
64 64 DayOfSchedule dayOfSchedule;
65 65  
66 66 @Autowired
67   - AnalyseArrivalData analyseData;
  67 + AnalyseData analyseData;
68 68  
69 69 @Override
70 70 public void run() {
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
... ... @@ -38,6 +38,9 @@ public class DayOfDirectives {
38 38  
39 39 // 线路切换指令 64
40 40 public static Map<String, D64> d64Map;
  41 +
  42 + //等待C0_A4回复的用户
  43 + //public static Map<K, V>
41 44  
42 45 @Autowired
43 46 DirectiveService directiveService;
... ...
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
... ... @@ -43,6 +43,9 @@ public class FirstScheduleCheckThread extends Thread{
43 43 List<ScheduleRealInfo> schList;
44 44 ScheduleRealInfo first;
45 45 for(String car : cars){
  46 + if(car.equals("SXC-CD1004")){
  47 + System.out.println("debugger...");
  48 + }
46 49 schList = dayOfSchedule.findByNbbm(car);
47 50  
48 51 if(null == schList || schList.size() == 0)
... ... @@ -54,7 +57,7 @@ public class FirstScheduleCheckThread extends Thread{
54 57 && first.getBcType().equals("out")){
55 58  
56 59 //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令
57   - if(first.getJhlc() == null)
  60 + if(first.getJhlc() == null && first.getXlDir().equals(schList.get(1).getXlDir()))
58 61 first = schList.get(1);
59 62  
60 63 //为首班补发指令
... ...
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
... ... @@ -63,6 +63,9 @@ public class GpsEntity {
63 63  
64 64 /** 当前执行班次ID */
65 65 private Long schId;
  66 +
  67 + /** 是否异常数据 */
  68 + private boolean abnormal;
66 69  
67 70 public Integer getCompanyCode() {
68 71 return companyCode;
... ... @@ -207,4 +210,12 @@ public class GpsEntity {
207 210 public void setSchId(Long schId) {
208 211 this.schId = schId;
209 212 }
  213 +
  214 + public boolean isAbnormal() {
  215 + return abnormal;
  216 + }
  217 +
  218 + public void setAbnormal(boolean abnormal) {
  219 + this.abnormal = abnormal;
  220 + }
210 221 }
... ...
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata;
3 3 import java.io.BufferedReader;
4 4 import java.io.InputStreamReader;
5 5 import java.util.ArrayList;
  6 +import java.util.Collection;
6 7 import java.util.HashMap;
7 8 import java.util.List;
8 9 import java.util.Map;
... ... @@ -116,6 +117,10 @@ public class GpsRealData implements CommandLineRunner{
116 117 ScheduleRealInfo sch;
117 118 for(String device : set){
118 119 gps = gpsMap.get(device);
  120 + //过滤异常GPS数据
  121 + if(gps.isAbnormal())
  122 + continue;
  123 +
119 124 sch = dayOfSchedule.execPlamMap().get(gps.getNbbm());
120 125 if(null != sch)
121 126 gps.setSchId(sch.getId());
... ... @@ -137,6 +142,10 @@ public class GpsRealData implements CommandLineRunner{
137 142 return gpsMap.get(deviceId);
138 143 }
139 144  
  145 + public Collection<GpsEntity> all(){
  146 + return gpsMap.values();
  147 + }
  148 +
140 149 @Component
141 150 public static class GpsDataLoader extends Thread{
142 151  
... ... @@ -183,15 +192,19 @@ public class GpsRealData implements CommandLineRunner{
183 192 for(GpsEntity gps : list){
184 193 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
185 194 if(StringUtils.isBlank(nbbm))
186   - continue;
  195 + gps.setAbnormal(true);//标记为异常数据
  196 + else
  197 + gps.setNbbm(nbbm);
187 198  
188   - gps.setNbbm(nbbm);
189 199 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
190 200 gpsRealData.add(gps);
191 201 }
192 202 } else
193 203 logger.error("result is null");
194   - } finally {
  204 + } catch(Exception e){
  205 + logger.error("", e);
  206 + }
  207 + finally {
195 208 if (null != httpClient)
196 209 httpClient.close();
197 210 if(null != response)
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -24,10 +24,8 @@ import org.springframework.stereotype.Component;
24 24 import com.alibaba.fastjson.JSON;
25 25 import com.alibaba.fastjson.JSONArray;
26 26 import com.bsth.Application;
27   -import com.bsth.data.BasicData;
28 27 import com.bsth.data.LineConfigData;
29 28 import com.bsth.data.directive.FirstScheduleCheckThread;
30   -import com.bsth.data.gpsdata.GpsEntity;
31 29 import com.bsth.data.gpsdata.GpsRealData;
32 30 import com.bsth.data.schedule.thread.ScheduleLateThread;
33 31 import com.bsth.data.schedule.thread.SchedulePstThread;
... ... @@ -124,7 +122,7 @@ public class DayOfSchedule implements CommandLineRunner {
124 122 //入库
125 123 Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
126 124 //首班出场指令补发器
127   - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS);
  125 + Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 60, TimeUnit.SECONDS);
128 126 //班次误点扫描
129 127 Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
130 128 }
... ... @@ -262,6 +260,7 @@ public class DayOfSchedule implements CommandLineRunner {
262 260 for(ScheduleRealInfo sch : remList){
263 261 if(null != sch){
264 262 nbbmScheduleMap.remove(sch.getClZbh(), sch);
  263 + id2SchedulMap.remove(sch.getId());
265 264 count ++;
266 265 }
267 266 }
... ... @@ -467,9 +466,23 @@ public class DayOfSchedule implements CommandLineRunner {
467 466 id2SchedulMap.put(sch.getId(), sch);
468 467 }
469 468  
  469 + public void delete(ScheduleRealInfo sch) {
  470 + //ScheduleRealInfo sch = id2SchedulMap.get(id);
  471 + if(!sch.isSflj())
  472 + return;
  473 +
  474 + nbbmScheduleMap.remove(sch.getClZbh(), sch);
  475 + id2SchedulMap.remove(sch.getId());
  476 + //return sch;
  477 + }
  478 +
470 479 public void calcQdzTimePlan(String nbbm){
471 480 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));
472 481 }
  482 +
  483 + public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm){
  484 + return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm));
  485 + }
473 486  
474 487 /**
475 488 *
... ... @@ -596,15 +609,6 @@ public class DayOfSchedule implements CommandLineRunner {
596 609 }
597 610 return outList;
598 611 }
599   -
600   - public ScheduleRealInfo delete(Long id) {
601   - ScheduleRealInfo sch = id2SchedulMap.get(id);
602   - if(!sch.isSflj())
603   - return null;
604   -
605   - nbbmScheduleMap.remove(sch.getClZbh(), sch);
606   - return sch;
607   - }
608 612  
609 613 public Set<String> allCar(){
610 614 return nbbmScheduleMap.keySet();
... ... @@ -625,6 +629,33 @@ public class DayOfSchedule implements CommandLineRunner {
625 629 public Map<String, ScheduleRealInfo> execPlamMap(){
626 630 return carExecutePlanMap;
627 631 }
  632 +
  633 + /**
  634 + * @Title: changeCar
  635 + * @Description: TODO(班次换车) 返回有更新的班次
  636 + * @param @param sch
  637 + * @param @param newClZbh 新的车辆自编号
  638 + */
  639 + public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch , String newClZbh){
  640 + List<ScheduleRealInfo> ups = new ArrayList<>();
  641 + String oldClzbh = sch.getClZbh();
  642 + if(oldClzbh.equals(newClZbh))
  643 + return ups;
  644 +
  645 +
  646 + //变更相关映射信息
  647 + nbbmScheduleMap.remove(sch.getClZbh(), sch);
  648 +
  649 + sch.setClZbh(newClZbh);
  650 + nbbmScheduleMap.put(newClZbh, sch);
  651 + nbbm2SEStationMap.put(newClZbh, sch.getQdzCode());
  652 + nbbm2SEStationMap.put(newClZbh, sch.getZdzCode());
  653 +
  654 + //重新计算班次应到时间
  655 + ups.addAll(updateQdzTimePlan(oldClzbh));
  656 + ups.addAll(updateQdzTimePlan(newClZbh));
  657 + return ups;
  658 + }
628 659  
629 660 /**
630 661 *
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.schedule;
2 2  
3 3 import java.text.ParseException;
4 4 import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
5 6 import java.util.Collections;
6 7 import java.util.Date;
7 8 import java.util.List;
... ... @@ -44,15 +45,20 @@ public class SchAttrCalculator {
44 45 if (null == sch.getFcsjT())
45 46 calcFcsjTime(sch);
46 47  
  48 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
47 49 /*
48 50 * 早于线路开始运营时间的,加一天
49 51 * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25
50   - */
51   - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm")
  52 +
  53 +
52 54 ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
53 55 long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime();
54 56 if (st > sch.getFcsjT())
  57 + sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);*/
  58 +
  59 + if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){
55 60 sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);
  61 + }
56 62  
57 63 sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT())));
58 64 } catch (Exception e) {
... ... @@ -108,6 +114,43 @@ public class SchAttrCalculator {
108 114  
109 115 /**
110 116 *
  117 + * @Title: updateQdzTimePlan
  118 + * @Description: TODO(更新班次的起点应到时间,list 必须是同一辆车的班次) 并返回被更新的班次
  119 + */
  120 + public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){
  121 + Collections.sort(list, new ScheduleComparator.FCSJ());
  122 +
  123 + List<ScheduleRealInfo> updateList = new ArrayList<>();
  124 + int len = list.size();
  125 + if(len == 0)
  126 + return updateList;
  127 +
  128 + ScheduleRealInfo prve = list.get(0), curr;
  129 + for(int i = 1; i < len; i ++){
  130 + curr = list.get(i);
  131 +
  132 + if(prve.getZdzName().equals(curr.getQdzName())){
  133 +
  134 + if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){
  135 + prve = curr;
  136 + continue;
  137 + }
  138 +
  139 + curr.setQdzArrDateJH(prve.getZdsj());
  140 + updateList.add(curr);
  141 + }
  142 + else{
  143 + curr.setQdzArrDateJH(null);
  144 + updateList.add(curr);
  145 + }
  146 + prve = curr;
  147 + }
  148 +
  149 + return updateList;
  150 + }
  151 +
  152 + /**
  153 + *
111 154 * @Title: connectOutSchedule
112 155 * @Description: TODO(关联出场班次)
113 156 */
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java
... ... @@ -47,7 +47,9 @@ public class ScheduleLateThread extends Thread{
47 47 if(sch.getDfsjT() > t)
48 48 break;
49 49  
50   - if(sch.getStatus() == 0 && sch.getFcsjActual() == null){
  50 + if(sch.isLate() == false
  51 + && sch.getStatus() == 0
  52 + && sch.getFcsjActual() == null){
51 53 //应发未发
52 54 sch.setLate(true);
53 55 //通知客户端
... ...
src/main/java/com/bsth/entity/Cars.java
... ... @@ -57,7 +57,7 @@ public class Cars implements Serializable {
57 57 /** 设备终端号 */
58 58 @Column(nullable = false)
59 59 private String equipmentCode;
60   -
  60 +
61 61 // 以下信息来自总公司的业务系统,可能需要调用相关接口
62 62 /** 车型类别 */
63 63 private String carClass ;
... ... @@ -115,6 +115,8 @@ public class Cars implements Serializable {
115 115 private String vehicleStats;
116 116 /** 营运状态 */
117 117 private String operatorsState;
  118 + /** 营运证编码 */
  119 + private String serviceNo;
118 120 /** 是否电车(TODO:在原系统里没有,这里暂时留着) */
119 121 private Boolean sfdc;
120 122 /** 备注/描述 */
... ... @@ -148,8 +150,16 @@ public class Cars implements Serializable {
148 150 /** 修改日期 */
149 151 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
150 152 private Date updateDate;
  153 +
  154 + public String getServiceNo() {
  155 + return serviceNo;
  156 + }
  157 +
  158 + public void setServiceNo(String serviceNo) {
  159 + this.serviceNo = serviceNo;
  160 + }
151 161  
152   - public Integer getId() {
  162 + public Integer getId() {
153 163 return id;
154 164 }
155 165  
... ...
src/main/java/com/bsth/entity/Line.java
... ... @@ -25,115 +25,127 @@ import java.util.Date;
25 25 @Table(name = "bsth_c_line")
26 26 public class Line implements Serializable {
27 27  
28   - // 线路ID
29 28 @Id
30   - /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
  29 + /** 线路ID 主键(唯一标识符) int length(11) */
31 30 private Integer id;
32 31  
33   - // 线路名称
  32 + /** 线路名称 varchar length(50) 不能为空 */
34 33 private String name;
35 34  
36   - // 线路代码
  35 + /** 线路编码 varchar length(50) 不能为空 */
37 36 private String lineCode;
38 37  
39   - // 英文名
  38 + /** 英文名 varchar length(50) */
40 39 private String es;
41 40  
42   - // 简称
  41 + /** 简称 varchar length(50) */
43 42 private String shortName;
44 43  
45   - /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */
46   - private Integer carSumNumber;
47   -
48   - /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */
49   - private Integer hvacCarNumber;
50   -
51   - /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */
52   - private Integer ordCarNumber;
53   -
54   - /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */
55   - private String carParkCode;
56   -
57   - // 起始站名称
  44 + /** 起始站名称 varchar length(50) 不能为空
  45 + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */
58 46 private String startStationName;
59 47  
60   - // 起始站首班车时间 00:00
  48 + /** 终点站名称 varchar length(50) 不能为空
  49 + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */
  50 + private String endStationName;
  51 +
  52 + /** 起始站首班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */
61 53 private String startStationFirstTime;
62 54  
63   - // 起始站末班车时间 00:00
  55 + /** 起始站末班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */
64 56 private String startStationEndTime;
65 57  
66   - // 终点站名称
67   - private String endStationName;
68   -
69   - // 终点站首班时间 00:00
  58 + /** 终点站首班时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空*/
70 59 private String endStationFirstTime;
71 60  
72   - // 终点站末班时间 00:00
  61 + /** 终点站末班时间 00:00 上海公交APP中某个接口所需要的字段值 */
73 62 private String endStationEndTime;
74 63  
75   - // 所属公司
  64 + /** 所属公司 varchar length(50) */
76 65 private String company;
77 66  
78   - // 分公司
  67 + /** 分公司 varchar length(50)*/
79 68 private String brancheCompany;
80 69  
81   - // 性质(线路类型)
  70 + /** 性质(线路类型) varchar length(50) */
82 71 private String nature;
83 72  
84   - // 线路等级
  73 + /** 线路等级 varchar length(50) */
85 74 private String level;
86 75  
87   - // 线路长度
  76 + /** 线路长度 */
88 77 private double length;
89 78  
90   - // 线路负责人
  79 + /** 线路负责人 varchar length(50) */
91 80 private String chargeName;
92 81  
93   - // 负责人电话
  82 + /** 负责人电话 varchar length(50) */
94 83 private String telephone;
95 84  
96   - // 是否撤销
  85 + /** 是否撤销 <1:是;0:否> bit length(50) */
97 86 private Integer destroy;
98 87  
99   - // 是否夜宵线
  88 + /** 是否夜宵线 <1:是;0:否> bit length(50)*/
100 89 private Integer supperLine;
101 90  
102   - // 起始调度电话
  91 + /** 起始调度电话 varchar length(50) */
103 92 private String startPhone;
104 93  
105   - // 终点调度电话
  94 + /** 终点调度电话 varchar length(50) */
106 95 private String endPhone;
107 96  
108   - // 开辟日期
  97 + /** 开辟日期 date*/
109 98 @DateTimeFormat(pattern ="yyyy-MM-dd")
110 99 private Date openDate;
111 100  
112   - // 线路沿革
  101 + /** 线路沿革 varchar length(50) */
113 102 private String history;
114 103  
115   - // 上海市线路编码
  104 + /** 上海市线路编码 varchar length(50) */
116 105 private String shanghaiLinecode;
117 106  
118   - // 设备线路编码
  107 + /** 设备线路编码 varchar length(50) */
119 108 private String eqLinecode;
120 109  
121   - // 描述
  110 + /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11)*/
  111 + private Integer carSumNumber;
  112 +
  113 + /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
  114 + private Integer hvacCarNumber;
  115 +
  116 + /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
  117 + private Integer ordCarNumber;
  118 +
  119 + /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
  120 + private String carParkCode;
  121 +
  122 + /** 线路规划类型 <0:双向;1:环线> int length(11) 运管处接口需要的字段 不能为空 */
  123 + private Integer linePlayType;
  124 +
  125 + /** 描述 varchar length(255) */
122 126 private String descriptions;
123 127  
124   - // 创建人
  128 + /** 创建人 int length(11) */
125 129 private Integer createBy;
126 130  
127   - // 修改人
  131 + /** 修改人 int length(11) */
128 132 private Integer updateBy;
129 133  
130   - // 创建日期
  134 + /** 创建日期 timestamp */
131 135 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
132 136 private Date createDate;
133 137  
134   - // 修改日期
  138 + /** 修改日期 timestamp */
135 139 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
136 140 private Date updateDate;
  141 +
  142 + public Integer getLinePlayType() {
  143 + return linePlayType;
  144 + }
  145 +
  146 + public void setLinePlayType(Integer linePlayType) {
  147 + this.linePlayType = linePlayType;
  148 + }
137 149  
138 150 public Integer getId() {
139 151 return id;
... ...
src/main/java/com/bsth/entity/Personnel.java
... ... @@ -53,7 +53,17 @@ public class Personnel {
53 53 private String personnelType;
54 54 /** 所属岗位/工种(字典类型gzType) */
55 55 private String posts;
  56 +
  57 + /** 身份证 */
  58 + private String card;
56 59  
  60 + public String getCard() {
  61 + return card;
  62 + }
  63 +
  64 + public void setCard(String card) {
  65 + this.card = card;
  66 + }
57 67  
58 68 /** 人员编码(TODO:在原系统里没有,这里暂时留着) */
59 69 private String personnelCode;
... ...
src/main/java/com/bsth/entity/Road.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +@Entity
  8 +@Table(name = "bsth_c_road")
  9 +public class Road {
  10 +
  11 + @Id
  12 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
  13 + private Integer id;
  14 +
  15 + // 路段编码
  16 + private String roadCode;
  17 +
  18 + // 路段名称
  19 + private String roadName;
  20 +
  21 + // 路段矢量(空间坐标点集合)--百度原始坐标坐标点
  22 + private String broadVector;
  23 +
  24 + // 路段矢量(空间坐标点集合)--GPS坐标点
  25 + private String groadVector;
  26 +
  27 + // 限速
  28 + private Double speed;
  29 +
  30 + public Integer getId() {
  31 + return id;
  32 + }
  33 +
  34 + public void setId(Integer id) {
  35 + this.id = id;
  36 + }
  37 +
  38 + public String getRoadCode() {
  39 + return roadCode;
  40 + }
  41 +
  42 + public void setRoadCode(String roadCode) {
  43 + this.roadCode = roadCode;
  44 + }
  45 +
  46 + public String getRoadName() {
  47 + return roadName;
  48 + }
  49 +
  50 + public void setRoadName(String roadName) {
  51 + this.roadName = roadName;
  52 + }
  53 +
  54 + public String getBroadVector() {
  55 + return broadVector;
  56 + }
  57 +
  58 + public void setBroadVector(String broadVector) {
  59 + this.broadVector = broadVector;
  60 + }
  61 +
  62 + public String getGroadVector() {
  63 + return groadVector;
  64 + }
  65 +
  66 + public void setGroadVector(String groadVector) {
  67 + this.groadVector = groadVector;
  68 + }
  69 +
  70 + public Double getSpeed() {
  71 + return speed;
  72 + }
  73 +
  74 + public void setSpeed(Double speed) {
  75 + this.speed = speed;
  76 + }
  77 +}
... ...
src/main/java/com/bsth/entity/SectionRoute.java
... ... @@ -52,6 +52,9 @@ public class SectionRoute {
52 52 // 是否撤销
53 53 private Integer destroy;
54 54  
  55 + /** 是否有路段限速数据 <0:无;1:有>*/
  56 + private Integer isRoadeSpeed;
  57 +
55 58 // 描述
56 59 private String descriptions;
57 60  
... ... @@ -76,6 +79,14 @@ public class SectionRoute {
76 79 // 线路信息
77 80 @ManyToOne
78 81 private Line line;
  82 +
  83 + public Integer getIsRoadeSpeed() {
  84 + return isRoadeSpeed;
  85 + }
  86 +
  87 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  88 + this.isRoadeSpeed = isRoadeSpeed;
  89 + }
79 90  
80 91 public Integer getId() {
81 92 return id;
... ...
src/main/java/com/bsth/entity/SectionSpeed.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.GeneratedValue;
  5 +import javax.persistence.GenerationType;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.ManyToOne;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * @description TODO(路段限速)
  12 + *
  13 + * @author bsth@lq
  14 + *
  15 + * @date 2016年9月14日 14:15:42
  16 + */
  17 +
  18 +
  19 +@Entity
  20 +@Table(name = "bsth_c_sectionspeed")
  21 +public class SectionSpeed {
  22 +
  23 + @Id
  24 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  25 + private Integer id;
  26 +
  27 + // 线路信息
  28 + @ManyToOne
  29 + private Line line;
  30 +
  31 + @ManyToOne
  32 + private Road road;
  33 +
  34 + /** 线路编码 */
  35 + private String lineCode;
  36 +
  37 + private String roadCode;
  38 +
  39 + /** 方向*/
  40 + private Integer directions;
  41 +
  42 + /** 序号*/
  43 + private Integer code;
  44 +
  45 + /** 路段名称 */
  46 + private String sName;
  47 +
  48 + public String getRoadCode() {
  49 + return roadCode;
  50 + }
  51 +
  52 + public void setRoadCode(String roadCode) {
  53 + this.roadCode = roadCode;
  54 + }
  55 +
  56 + public Road getRoad() {
  57 + return road;
  58 + }
  59 +
  60 + public void setRoad(Road road) {
  61 + this.road = road;
  62 + }
  63 +
  64 + public Integer getDirections() {
  65 + return directions;
  66 + }
  67 +
  68 + public void setDirections(Integer directions) {
  69 + this.directions = directions;
  70 + }
  71 +
  72 + public Integer getCode() {
  73 + return code;
  74 + }
  75 +
  76 + public void setCode(Integer code) {
  77 + this.code = code;
  78 + }
  79 +
  80 + public Integer getId() {
  81 + return id;
  82 + }
  83 +
  84 + public void setId(Integer id) {
  85 + this.id = id;
  86 + }
  87 +
  88 + public Line getLine() {
  89 + return line;
  90 + }
  91 +
  92 + public void setLine(Line line) {
  93 + this.line = line;
  94 + }
  95 +
  96 + public String getLineCode() {
  97 + return lineCode;
  98 + }
  99 +
  100 + public void setLineCode(String lineCode) {
  101 + this.lineCode = lineCode;
  102 + }
  103 +
  104 + public String getsName() {
  105 + return sName;
  106 + }
  107 +
  108 + public void setsName(String sName) {
  109 + this.sName = sName;
  110 + }
  111 +
  112 +}
... ...
src/main/java/com/bsth/entity/Station.java
... ... @@ -41,6 +41,9 @@ public class Station {
41 41 // 所在道路编码
42 42 private String roadCoding;
43 43  
  44 + // 站点的具体地址
  45 + private String addr;
  46 +
44 47 /**
45 48 * 经纬坐标类型
46 49 *
... ... @@ -111,6 +114,14 @@ public class Station {
111 114 // 修改日期
112 115 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
113 116 private Date updateDate;
  117 +
  118 + public String getAddr() {
  119 + return addr;
  120 + }
  121 +
  122 + public void setAddr(String addr) {
  123 + this.addr = addr;
  124 + }
114 125  
115 126 public Integer getId() {
116 127 return id;
... ...
src/main/java/com/bsth/entity/directive/D64.java
... ... @@ -40,6 +40,8 @@ public class D64 extends Directive{
40 40 private String deviceId;
41 41  
42 42 private String lineId;
  43 +
  44 + private String txtContent;
43 45  
44 46 public Short getCityCode() {
45 47 return cityCode;
... ... @@ -64,6 +66,14 @@ public class D64 extends Directive{
64 66 public void setLineId(String lineId) {
65 67 this.lineId = lineId;
66 68 }
  69 +
  70 + public String getTxtContent() {
  71 + return txtContent;
  72 + }
  73 +
  74 + public void setTxtContent(String txtContent) {
  75 + this.txtContent = txtContent;
  76 + }
67 77 }
68 78  
69 79 public Integer getId() {
... ...
src/main/java/com/bsth/entity/directive/DC0_A3.java 0 → 100644
  1 +package com.bsth.entity.directive;
  2 +
  3 +import javax.persistence.Embeddable;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.Table;
  8 +import javax.persistence.Transient;
  9 +
  10 +/**
  11 + *
  12 + * @ClassName: DC0_A4
  13 + * @Description: TODO(设备参数)
  14 + * @author PanZhao
  15 + * @date 2016年10月18日 下午5:22:36
  16 + *
  17 + */
  18 +@Entity
  19 +@Table(name = "bsth_v_C0_A3")
  20 +public class DC0_A3 extends Directive{
  21 +
  22 + @Id
  23 + @GeneratedValue
  24 + private Integer id;
  25 +
  26 + private DC0_A3Data data;
  27 +
  28 + @Embeddable
  29 + public static class DC0_A3Data {
  30 + /**
  31 + * 二级协议
  32 + */
  33 + private Short operCode2 = 0xA3;
  34 + /** 设备编号 */
  35 + @Transient
  36 + private String deviceId;
  37 + /** 网关IP地址 */
  38 + private String ipAddress;
  39 + /** 网关端口 */
  40 + private int port;
  41 + /** 定时定距上报模式 */
  42 + private short reportMode;
  43 + /** 定时上报时间间隔 */
  44 + private int interval;
  45 + /** 定距上报距离间隔 */
  46 + private String distance;
  47 + /** 非线路状态超速阀门 */
  48 + private short speedingThreshold;
  49 + /** 预警阀门 */
  50 + private short alarmThreshold;
  51 + /** pos机IP地址 */
  52 + private String posIpAddress;
  53 + /** pos机端口 */
  54 + private String posPort;
  55 + /** 延迟机关时间 */
  56 + private int delay;
  57 + /** 中门视频切换到码表界面速度阀门 默认45 */
  58 + private short speedThreshold1;
  59 + /** 码表界面切换到中门视频速度阀门 默认35 */
  60 + private short speedThreshold2;
  61 + /** 对比度 */
  62 + private short contrast;
  63 + /** 亮度 */
  64 + private short brightness;
  65 + /** 饱和度 */
  66 + private short saturation;
  67 + public Short getOperCode2() {
  68 + return operCode2;
  69 + }
  70 + public void setOperCode2(Short operCode2) {
  71 + this.operCode2 = operCode2;
  72 + }
  73 + public String getDeviceId() {
  74 + return deviceId;
  75 + }
  76 + public void setDeviceId(String deviceId) {
  77 + this.deviceId = deviceId;
  78 + }
  79 + public String getIpAddress() {
  80 + return ipAddress;
  81 + }
  82 + public void setIpAddress(String ipAddress) {
  83 + this.ipAddress = ipAddress;
  84 + }
  85 + public int getPort() {
  86 + return port;
  87 + }
  88 + public void setPort(int port) {
  89 + this.port = port;
  90 + }
  91 + public short getReportMode() {
  92 + return reportMode;
  93 + }
  94 + public void setReportMode(short reportMode) {
  95 + this.reportMode = reportMode;
  96 + }
  97 + public int getInterval() {
  98 + return interval;
  99 + }
  100 + public void setInterval(int interval) {
  101 + this.interval = interval;
  102 + }
  103 + public String getDistance() {
  104 + return distance;
  105 + }
  106 + public void setDistance(String distance) {
  107 + this.distance = distance;
  108 + }
  109 + public short getSpeedingThreshold() {
  110 + return speedingThreshold;
  111 + }
  112 + public void setSpeedingThreshold(short speedingThreshold) {
  113 + this.speedingThreshold = speedingThreshold;
  114 + }
  115 + public short getAlarmThreshold() {
  116 + return alarmThreshold;
  117 + }
  118 + public void setAlarmThreshold(short alarmThreshold) {
  119 + this.alarmThreshold = alarmThreshold;
  120 + }
  121 + public String getPosIpAddress() {
  122 + return posIpAddress;
  123 + }
  124 + public void setPosIpAddress(String posIpAddress) {
  125 + this.posIpAddress = posIpAddress;
  126 + }
  127 + public String getPosPort() {
  128 + return posPort;
  129 + }
  130 + public void setPosPort(String posPort) {
  131 + this.posPort = posPort;
  132 + }
  133 + public int getDelay() {
  134 + return delay;
  135 + }
  136 + public void setDelay(int delay) {
  137 + this.delay = delay;
  138 + }
  139 + public short getSpeedThreshold1() {
  140 + return speedThreshold1;
  141 + }
  142 + public void setSpeedThreshold1(short speedThreshold1) {
  143 + this.speedThreshold1 = speedThreshold1;
  144 + }
  145 + public short getSpeedThreshold2() {
  146 + return speedThreshold2;
  147 + }
  148 + public void setSpeedThreshold2(short speedThreshold2) {
  149 + this.speedThreshold2 = speedThreshold2;
  150 + }
  151 + public short getContrast() {
  152 + return contrast;
  153 + }
  154 + public void setContrast(short contrast) {
  155 + this.contrast = contrast;
  156 + }
  157 + public short getBrightness() {
  158 + return brightness;
  159 + }
  160 + public void setBrightness(short brightness) {
  161 + this.brightness = brightness;
  162 + }
  163 + public short getSaturation() {
  164 + return saturation;
  165 + }
  166 + public void setSaturation(short saturation) {
  167 + this.saturation = saturation;
  168 + }
  169 + }
  170 +
  171 + public Integer getId() {
  172 + return id;
  173 + }
  174 +
  175 + public void setId(Integer id) {
  176 + this.id = id;
  177 + }
  178 +
  179 + public DC0_A3Data getData() {
  180 + return data;
  181 + }
  182 +
  183 + public void setData(DC0_A3Data data) {
  184 + this.data = data;
  185 + }
  186 +
  187 +}
... ...
src/main/java/com/bsth/entity/directive/DC0_A4.java 0 → 100644
  1 +package com.bsth.entity.directive;
  2 +
  3 +import javax.persistence.Embeddable;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.Table;
  8 +import javax.persistence.Transient;
  9 +
  10 +/**
  11 + *
  12 + * @ClassName: DC0_A4
  13 + * @Description: TODO(设备参数)
  14 + * @author PanZhao
  15 + * @date 2016年10月18日 下午5:22:36
  16 + *
  17 + */
  18 +@Entity
  19 +@Table(name = "bsth_v_C0_A4")
  20 +public class DC0_A4 extends Directive{
  21 +
  22 + @Id
  23 + @GeneratedValue
  24 + private Integer id;
  25 +
  26 + private DC0A4Data data;
  27 +
  28 + @Embeddable
  29 + public static class DC0A4Data {
  30 + /**
  31 + * 二级协议
  32 + */
  33 + private Short operCode2;
  34 + /** 设备编号 */
  35 + @Transient
  36 + private String deviceId;
  37 + /** 网关IP地址 */
  38 + private String ipAddress;
  39 + /** 网关端口 */
  40 + private int port;
  41 + /** 定时定距上报模式 */
  42 + private short reportMode;
  43 + /** 定时上报时间间隔 */
  44 + private int interval;
  45 + /** 定距上报距离间隔 */
  46 + private String distance;
  47 + /** 非线路状态超速阀门 */
  48 + private short speedingThreshold;
  49 + /** 预警阀门 */
  50 + private short alarmThreshold;
  51 + /** pos机IP地址 */
  52 + private String posIpAddress;
  53 + /** pos机端口 */
  54 + private String posPort;
  55 + /** 延迟机关时间 */
  56 + private int delay;
  57 + /** 中门视频切换到码表界面速度阀门 默认45 */
  58 + private short speedThreshold1;
  59 + /** 码表界面切换到中门视频速度阀门 默认35 */
  60 + private short speedThreshold2;
  61 + /** 对比度 */
  62 + private short contrast;
  63 + /** 亮度 */
  64 + private short brightness;
  65 + /** 饱和度 */
  66 + private short saturation;
  67 + public Short getOperCode2() {
  68 + return operCode2;
  69 + }
  70 + public void setOperCode2(Short operCode2) {
  71 + this.operCode2 = operCode2;
  72 + }
  73 + public String getDeviceId() {
  74 + return deviceId;
  75 + }
  76 + public void setDeviceId(String deviceId) {
  77 + this.deviceId = deviceId;
  78 + }
  79 + public String getIpAddress() {
  80 + return ipAddress;
  81 + }
  82 + public void setIpAddress(String ipAddress) {
  83 + this.ipAddress = ipAddress;
  84 + }
  85 + public int getPort() {
  86 + return port;
  87 + }
  88 + public void setPort(int port) {
  89 + this.port = port;
  90 + }
  91 + public short getReportMode() {
  92 + return reportMode;
  93 + }
  94 + public void setReportMode(short reportMode) {
  95 + this.reportMode = reportMode;
  96 + }
  97 + public int getInterval() {
  98 + return interval;
  99 + }
  100 + public void setInterval(int interval) {
  101 + this.interval = interval;
  102 + }
  103 + public String getDistance() {
  104 + return distance;
  105 + }
  106 + public void setDistance(String distance) {
  107 + this.distance = distance;
  108 + }
  109 + public short getSpeedingThreshold() {
  110 + return speedingThreshold;
  111 + }
  112 + public void setSpeedingThreshold(short speedingThreshold) {
  113 + this.speedingThreshold = speedingThreshold;
  114 + }
  115 + public short getAlarmThreshold() {
  116 + return alarmThreshold;
  117 + }
  118 + public void setAlarmThreshold(short alarmThreshold) {
  119 + this.alarmThreshold = alarmThreshold;
  120 + }
  121 + public String getPosIpAddress() {
  122 + return posIpAddress;
  123 + }
  124 + public void setPosIpAddress(String posIpAddress) {
  125 + this.posIpAddress = posIpAddress;
  126 + }
  127 + public String getPosPort() {
  128 + return posPort;
  129 + }
  130 + public void setPosPort(String posPort) {
  131 + this.posPort = posPort;
  132 + }
  133 + public int getDelay() {
  134 + return delay;
  135 + }
  136 + public void setDelay(int delay) {
  137 + this.delay = delay;
  138 + }
  139 + public short getSpeedThreshold1() {
  140 + return speedThreshold1;
  141 + }
  142 + public void setSpeedThreshold1(short speedThreshold1) {
  143 + this.speedThreshold1 = speedThreshold1;
  144 + }
  145 + public short getSpeedThreshold2() {
  146 + return speedThreshold2;
  147 + }
  148 + public void setSpeedThreshold2(short speedThreshold2) {
  149 + this.speedThreshold2 = speedThreshold2;
  150 + }
  151 + public short getContrast() {
  152 + return contrast;
  153 + }
  154 + public void setContrast(short contrast) {
  155 + this.contrast = contrast;
  156 + }
  157 + public short getBrightness() {
  158 + return brightness;
  159 + }
  160 + public void setBrightness(short brightness) {
  161 + this.brightness = brightness;
  162 + }
  163 + public short getSaturation() {
  164 + return saturation;
  165 + }
  166 + public void setSaturation(short saturation) {
  167 + this.saturation = saturation;
  168 + }
  169 + }
  170 +
  171 + public Integer getId() {
  172 + return id;
  173 + }
  174 +
  175 + public void setId(Integer id) {
  176 + this.id = id;
  177 + }
  178 +
  179 + public DC0A4Data getData() {
  180 + return data;
  181 + }
  182 +
  183 + public void setData(DC0A4Data data) {
  184 + this.data = data;
  185 + }
  186 +}
... ...
src/main/java/com/bsth/entity/excep/Abnormal.java 0 → 100644
  1 +package com.bsth.entity.excep;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.GeneratedValue;
  5 +import javax.persistence.Id;
  6 +import javax.persistence.Table;
  7 +
  8 +/**
  9 + *
  10 + * 设备异常
  11 + *
  12 + */
  13 +@Entity
  14 +@Table(name="bsth_c_device_abnormal")
  15 +public class Abnormal {
  16 + @Id
  17 + @GeneratedValue
  18 + private Integer id;
  19 +
  20 + /**
  21 + * 车辆编码
  22 + */
  23 + private String vehicle;
  24 +
  25 + /**
  26 + * 离线
  27 + */
  28 + private Integer offline;
  29 +
  30 + /**
  31 + * 流动
  32 + */
  33 + private Integer drift;
  34 +
  35 + /**
  36 + * 协议错误
  37 + */
  38 + private Integer protocol;
  39 +
  40 + public Integer getId() {
  41 + return id;
  42 + }
  43 +
  44 + public void setId(Integer id) {
  45 + this.id = id;
  46 + }
  47 +
  48 + public String getVehicle() {
  49 + return vehicle;
  50 + }
  51 +
  52 + public void setVehicle(String vehicle) {
  53 + this.vehicle = vehicle;
  54 + }
  55 +
  56 + public Integer getOffline() {
  57 + return offline;
  58 + }
  59 +
  60 + public void setOffline(Integer offline) {
  61 + this.offline = offline;
  62 + }
  63 +
  64 + public Integer getDrift() {
  65 + return drift;
  66 + }
  67 +
  68 + public void setDrift(Integer drift) {
  69 + this.drift = drift;
  70 + }
  71 +
  72 + public Integer getProtocol() {
  73 + return protocol;
  74 + }
  75 +
  76 + public void setProtocol(Integer protocol) {
  77 + this.protocol = protocol;
  78 + }
  79 +
  80 +
  81 +
  82 +}
... ...
src/main/java/com/bsth/entity/excep/Offline.java 0 → 100644
  1 +package com.bsth.entity.excep;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * 掉线
  12 + *
  13 + *
  14 + */
  15 +@Entity
  16 +@Table(name = "bsth_c_offline")
  17 +public class Offline {
  18 + @Id
  19 + @GeneratedValue
  20 + private Integer id;
  21 +
  22 + /**
  23 + * 车辆编码
  24 + */
  25 + private String vehicle;
  26 +
  27 + /**
  28 + * 线路编码
  29 + */
  30 + private Integer line;
  31 +
  32 + /**
  33 + * 线路名称
  34 + */
  35 + private String lineName;
  36 +
  37 +
  38 + /**
  39 + * 上下行(0 上行 , 1 下行 , -1 无效)
  40 + */
  41 + private Integer upDown;
  42 +
  43 + /**
  44 + * 经度
  45 + */
  46 + private Float lon;
  47 +
  48 + /**
  49 + * 纬度
  50 + */
  51 + private Float lat;
  52 +
  53 + /**
  54 + * 时间戳
  55 + */
  56 + private Long timestamp;
  57 +
  58 + /**
  59 + * 时间戳转换的时间
  60 + */
  61 + private String timestampDate;
  62 +
  63 + /**
  64 + * 创建时间
  65 + */
  66 + private Date createDate;
  67 +
  68 +
  69 + public Integer getId() {
  70 + return id;
  71 + }
  72 +
  73 + public void setId(Integer id) {
  74 + this.id = id;
  75 + }
  76 +
  77 + public String getVehicle() {
  78 + return vehicle;
  79 + }
  80 +
  81 + public void setVehicle(String vehicle) {
  82 + this.vehicle = vehicle;
  83 + }
  84 +
  85 + public Integer getLine() {
  86 + return line;
  87 + }
  88 +
  89 + public void setLine(Integer line) {
  90 + this.line = line;
  91 + }
  92 +
  93 + public Integer getUpDown() {
  94 + return upDown;
  95 + }
  96 +
  97 + public void setUpDown(Integer upDown) {
  98 + this.upDown = upDown;
  99 + }
  100 +
  101 + public Float getLon() {
  102 + return lon;
  103 + }
  104 +
  105 + public void setLon(Float lon) {
  106 + this.lon = lon;
  107 + }
  108 +
  109 + public Float getLat() {
  110 + return lat;
  111 + }
  112 +
  113 + public void setLat(Float lat) {
  114 + this.lat = lat;
  115 + }
  116 +
  117 + public Long getTimestamp() {
  118 + return timestamp;
  119 + }
  120 +
  121 + public void setTimestamp(Long timestamp) {
  122 + this.timestamp = timestamp;
  123 + }
  124 +
  125 + public Date getCreateDate() {
  126 + return createDate;
  127 + }
  128 +
  129 + public void setCreateDate(Date createDate) {
  130 + this.createDate = createDate;
  131 + }
  132 +
  133 + public String getLineName() {
  134 + return lineName;
  135 + }
  136 +
  137 + public void setLineName(String lineName) {
  138 + this.lineName = lineName;
  139 + }
  140 +
  141 + public String getTimestampDate() {
  142 + return timestampDate;
  143 + }
  144 +
  145 + public void setTimestampDate(String timestampDate) {
  146 + this.timestampDate = timestampDate;
  147 + }
  148 +
  149 +
  150 +}
... ...
src/main/java/com/bsth/entity/excep/Outbound.java 0 → 100644
  1 +package com.bsth.entity.excep;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * 越界
  12 + *
  13 + *
  14 + */
  15 +@Entity
  16 +@Table(name = "bsth_c_outbound")
  17 +public class Outbound {
  18 + @Id
  19 + @GeneratedValue
  20 + private Integer id;
  21 +
  22 + /**
  23 + * 车辆编码
  24 + */
  25 + private String vehicle;
  26 +
  27 + /**
  28 + * 线路编码
  29 + */
  30 + private Integer line;
  31 + /**
  32 + * 线路名称
  33 + */
  34 + private String lineName;
  35 +
  36 +
  37 +
  38 +
  39 + /**
  40 + * 上下行(0 上行 , 1 下行 , -1 无效)
  41 + */
  42 + private Integer upDown;
  43 +
  44 + /**
  45 + * 经度
  46 + */
  47 + private Float lon;
  48 +
  49 + /**
  50 + * 纬度
  51 + */
  52 + private Float lat;
  53 +
  54 + /**
  55 + * 越界位置
  56 + */
  57 + private String location;
  58 +
  59 +
  60 + /**
  61 + * 时间戳
  62 + */
  63 + private Long timestamp;
  64 +
  65 + /**
  66 + * 时间戳转换的时间
  67 + */
  68 + private String timestampDate;
  69 +
  70 +
  71 + /**
  72 + * 时间
  73 + */
  74 + private Date createDate;
  75 +
  76 +
  77 + public Integer getId() {
  78 + return id;
  79 + }
  80 +
  81 + public void setId(Integer id) {
  82 + this.id = id;
  83 + }
  84 +
  85 + public String getVehicle() {
  86 + return vehicle;
  87 + }
  88 +
  89 + public void setVehicle(String vehicle) {
  90 + this.vehicle = vehicle;
  91 + }
  92 +
  93 + public Integer getLine() {
  94 + return line;
  95 + }
  96 +
  97 + public void setLine(Integer line) {
  98 + this.line = line;
  99 + }
  100 +
  101 + public String getLineName() {
  102 + return lineName;
  103 + }
  104 +
  105 + public void setLineName(String lineName) {
  106 + this.lineName = lineName;
  107 + }
  108 +
  109 + public Integer getUpDown() {
  110 + return upDown;
  111 + }
  112 +
  113 + public void setUpDown(Integer upDown) {
  114 + this.upDown = upDown;
  115 + }
  116 +
  117 + public Float getLon() {
  118 + return lon;
  119 + }
  120 +
  121 + public void setLon(Float lon) {
  122 + this.lon = lon;
  123 + }
  124 +
  125 + public Float getLat() {
  126 + return lat;
  127 + }
  128 +
  129 + public void setLat(Float lat) {
  130 + this.lat = lat;
  131 + }
  132 +
  133 + public String getLocation() {
  134 + return location;
  135 + }
  136 +
  137 + public void setLocation(String location) {
  138 + this.location = location;
  139 + }
  140 +
  141 + public Long getTimestamp() {
  142 + return timestamp;
  143 + }
  144 +
  145 + public void setTimestamp(Long timestamp) {
  146 + this.timestamp = timestamp;
  147 + }
  148 +
  149 + public Date getCreateDate() {
  150 + return createDate;
  151 + }
  152 +
  153 + public void setCreateDate(Date createDate) {
  154 + this.createDate = createDate;
  155 + }
  156 +
  157 + public String getTimestampDate() {
  158 + return timestampDate;
  159 + }
  160 +
  161 + public void setTimestampDate(String timestampDate) {
  162 + this.timestampDate = timestampDate;
  163 + }
  164 +
  165 +
  166 +}
... ...
src/main/java/com/bsth/entity/excep/Speeding.java 0 → 100644
  1 +package com.bsth.entity.excep;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * 超速
  12 + *
  13 + *
  14 + */
  15 +@Entity
  16 +@Table(name = "bsth_c_speeding")
  17 +public class Speeding {
  18 + @Id
  19 + @GeneratedValue
  20 + private Integer id;
  21 +
  22 + /**
  23 + * 车辆编码
  24 + */
  25 + private String vehicle;
  26 +
  27 + /**
  28 + * 线路编码
  29 + */
  30 + private Integer line;
  31 +
  32 + /**
  33 + * 线路名称
  34 + */
  35 + private String lineName;
  36 +
  37 +
  38 + /**
  39 + * 上下行(0 上行 , 1 下行 , -1 无效)
  40 + */
  41 + private Integer upDown;
  42 +
  43 + /**
  44 + * 经度
  45 + */
  46 + private Float lon;
  47 +
  48 + /**
  49 + * 纬度
  50 + */
  51 + private Float lat;
  52 +
  53 + /**
  54 + * 速度
  55 + */
  56 + private Float speed;
  57 +
  58 + /**
  59 + * 时间戳
  60 + */
  61 + private Long timestamp;
  62 +
  63 + /**
  64 + * 时间戳转换的时间
  65 + */
  66 + private String timestampDate;
  67 +
  68 +
  69 + /**
  70 + * 创建时间
  71 + */
  72 + private Date createDate;
  73 +
  74 +
  75 + public Integer getId() {
  76 + return id;
  77 + }
  78 +
  79 + public void setId(Integer id) {
  80 + this.id = id;
  81 + }
  82 +
  83 + public String getVehicle() {
  84 + return vehicle;
  85 + }
  86 +
  87 + public void setVehicle(String vehicle) {
  88 + this.vehicle = vehicle;
  89 + }
  90 +
  91 + public Integer getLine() {
  92 + return line;
  93 + }
  94 +
  95 + public void setLine(Integer line) {
  96 + this.line = line;
  97 + }
  98 +
  99 +
  100 + public String getLineName() {
  101 + return lineName;
  102 + }
  103 +
  104 + public void setLineName(String lineName) {
  105 + this.lineName = lineName;
  106 + }
  107 +
  108 + public Integer getUpDown() {
  109 + return upDown;
  110 + }
  111 +
  112 + public void setUpDown(Integer upDown) {
  113 + this.upDown = upDown;
  114 + }
  115 +
  116 + public Float getLon() {
  117 + return lon;
  118 + }
  119 +
  120 + public void setLon(Float lon) {
  121 + this.lon = lon;
  122 + }
  123 +
  124 + public Float getLat() {
  125 + return lat;
  126 + }
  127 +
  128 + public void setLat(Float lat) {
  129 + this.lat = lat;
  130 + }
  131 +
  132 + public Float getSpeed() {
  133 + return speed;
  134 + }
  135 +
  136 + public void setSpeed(Float speed) {
  137 + this.speed = speed;
  138 + }
  139 +
  140 + public Long getTimestamp() {
  141 + return timestamp;
  142 + }
  143 +
  144 + public void setTimestamp(Long timestamp) {
  145 + this.timestamp = timestamp;
  146 + }
  147 +
  148 + public Date getCreateDate() {
  149 + return createDate;
  150 + }
  151 +
  152 + public void setCreateDate(Date createDate) {
  153 + this.createDate = createDate;
  154 + }
  155 +
  156 + public String getTimestampDate() {
  157 + return timestampDate;
  158 + }
  159 +
  160 + public void setTimestampDate(String timestampDate) {
  161 + this.timestampDate = timestampDate;
  162 + }
  163 +
  164 +
  165 +
  166 +}
... ...
src/main/java/com/bsth/entity/oil/Cyl.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "bsth_c_cyl")
  12 +public class Cyl {
  13 + @Id
  14 + @GeneratedValue
  15 + private Integer id;
  16 +
  17 + private String nbbm;
  18 +
  19 + //存油量
  20 + private Double cyl;
  21 +
  22 + private Date updatetime;
  23 +
  24 + //车厢容量
  25 + private Double cxrl;
  26 + //公司代码
  27 + private String gsdm;
  28 + public Integer getId() {
  29 + return id;
  30 + }
  31 +
  32 + public void setId(Integer id) {
  33 + this.id = id;
  34 + }
  35 +
  36 + public String getNbbm() {
  37 + return nbbm;
  38 + }
  39 +
  40 + public void setNbbm(String nbbm) {
  41 + this.nbbm = nbbm;
  42 + }
  43 +
  44 + public Double getCyl() {
  45 + return cyl;
  46 + }
  47 +
  48 + public void setCyl(Double cyl) {
  49 + this.cyl = cyl;
  50 + }
  51 +
  52 + public Date getUpdatetime() {
  53 + return updatetime;
  54 + }
  55 +
  56 + public void setUpdatetime(Date updatetime) {
  57 + this.updatetime = updatetime;
  58 + }
  59 +
  60 + public Double getCxrl(){
  61 + return cxrl;
  62 + }
  63 +
  64 + public void setCxrl(Double cxrl){
  65 + this.cxrl=cxrl;
  66 + }
  67 +
  68 + public String getGsdm(){
  69 + return gsdm;
  70 + }
  71 +
  72 + public void setGsdm(String gsdm){
  73 + this.gsdm=gsdm;
  74 + }
  75 +}
... ...
src/main/java/com/bsth/entity/oil/Ylb.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +import org.springframework.format.annotation.DateTimeFormat;
  11 +
  12 +@Entity
  13 +@Table(name = "bsth_c_ylb")
  14 +public class Ylb {
  15 + @Id
  16 + @GeneratedValue
  17 + private Integer id;
  18 + @DateTimeFormat(pattern="yyyy-MM-dd")
  19 + private Date rq;
  20 + private String xlbm;
  21 + private String ssgsdm;
  22 + private String fgsdm;
  23 + private String nbbm;
  24 + private String jsy;
  25 + private Double czlc;
  26 + private Double jzlc;
  27 + private Double czyl;
  28 + private Double jzyl;
  29 + private Double jzl;
  30 + private int sfkt;
  31 + private String jhsj;
  32 + private Double yh;
  33 + private Double sh;
  34 + private String shyy;
  35 + private Double zlc;
  36 + private int yhlx;
  37 + private String rylx;
  38 + private Double ns;
  39 + private Double fyylc;
  40 + private Double jhzlc;
  41 + private Double jhfyylc;
  42 + private int jhzbc;
  43 + private int jhbc;
  44 + private int sjzbc;
  45 + private int sjbc;
  46 + private String edituser;
  47 + private Date edittime;
  48 + private Date createtime;
  49 + private int nylx;
  50 + //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
  51 + private int jcsx;
  52 +
  53 + public Integer getId() {
  54 + return id;
  55 + }
  56 +
  57 + public void setId(Integer id) {
  58 + this.id = id;
  59 + }
  60 + public Date getRq() {
  61 + return rq;
  62 + }
  63 +
  64 + public void setRq(Date rq) {
  65 + this.rq = rq;
  66 + }
  67 +
  68 + public String getXlbm() {
  69 + return xlbm;
  70 + }
  71 +
  72 + public void setXlbm(String xlbm) {
  73 + this.xlbm = xlbm;
  74 + }
  75 + public String getSsgsdm() {
  76 + return ssgsdm;
  77 + }
  78 + public void setSsgsdm(String ssgsdm) {
  79 + this.ssgsdm = ssgsdm;
  80 + }
  81 + public String getFgsdm() {
  82 + return fgsdm;
  83 + }
  84 + public void setFgsdm(String fgsdm) {
  85 + this.fgsdm = fgsdm;
  86 + }
  87 + public String getNbbm() {
  88 + return nbbm;
  89 + }
  90 + public void setNbbm(String nbbm) {
  91 + this.nbbm = nbbm;
  92 + }
  93 + public String getJsy() {
  94 + return jsy;
  95 + }
  96 + public void setJsy(String jsy) {
  97 + this.jsy = jsy;
  98 + }
  99 + public Double getCzlc() {
  100 + return czlc;
  101 + }
  102 + public void setCzlc(Double czlc) {
  103 + this.czlc = czlc;
  104 + }
  105 + public Double getJzlc() {
  106 + return jzlc;
  107 + }
  108 + public void setJzlc(Double jzlc) {
  109 + this.jzlc = jzlc;
  110 + }
  111 + public Double getCzyl() {
  112 + return czyl;
  113 + }
  114 + public void setCzyl(Double czyl) {
  115 + this.czyl = czyl;
  116 + }
  117 + public Double getJzyl() {
  118 + return jzyl;
  119 + }
  120 + public void setJzyl(Double jzyl) {
  121 + this.jzyl = jzyl;
  122 + }
  123 + public Double getJzl() {
  124 + return jzl;
  125 + }
  126 + public void setJzl(Double jzl) {
  127 + this.jzl = jzl;
  128 + }
  129 + public int getSfkt() {
  130 + return sfkt;
  131 + }
  132 + public void setSfkt(int sfkt) {
  133 + this.sfkt = sfkt;
  134 + }
  135 + public String getJhsj() {
  136 + return jhsj;
  137 + }
  138 + public void setJhsj(String jhsj) {
  139 + this.jhsj = jhsj;
  140 + }
  141 + public Double getYh() {
  142 + return yh;
  143 + }
  144 + public void setYh(Double yh) {
  145 + this.yh = yh;
  146 + }
  147 + public Double getSh() {
  148 + return sh;
  149 + }
  150 + public void setSh(Double sh) {
  151 + this.sh = sh;
  152 + }
  153 + public String getShyy() {
  154 + return shyy;
  155 + }
  156 + public void setShyy(String shyy) {
  157 + this.shyy = shyy;
  158 + }
  159 + public Double getZlc() {
  160 + return zlc;
  161 + }
  162 + public void setZlc(Double zlc) {
  163 + this.zlc = zlc;
  164 + }
  165 + public int getYhlx() {
  166 + return yhlx;
  167 + }
  168 + public void setYhlx(int yhlx) {
  169 + this.yhlx = yhlx;
  170 + }
  171 + public String getRylx() {
  172 + return rylx;
  173 + }
  174 + public void setRylx(String rylx) {
  175 + this.rylx = rylx;
  176 + }
  177 + public Double getNs() {
  178 + return ns;
  179 + }
  180 + public void setNs(Double ns) {
  181 + this.ns = ns;
  182 + }
  183 + public Double getFyylc() {
  184 + return fyylc;
  185 + }
  186 + public void setFyylc(Double fyylc) {
  187 + this.fyylc = fyylc;
  188 + }
  189 + public Double getJhzlc() {
  190 + return jhzlc;
  191 + }
  192 + public void setJhzlc(Double jhzlc) {
  193 + this.jhzlc = jhzlc;
  194 + }
  195 + public Double getJhfyylc() {
  196 + return jhfyylc;
  197 + }
  198 + public void setJhfyylc(Double jhfyylc) {
  199 + this.jhfyylc = jhfyylc;
  200 + }
  201 + public int getJhzbc() {
  202 + return jhzbc;
  203 + }
  204 + public void setJhzbc(int jhzbc) {
  205 + this.jhzbc = jhzbc;
  206 + }
  207 + public int getJhbc() {
  208 + return jhbc;
  209 + }
  210 + public void setJhbc(int jhbc) {
  211 + this.jhbc = jhbc;
  212 + }
  213 + public int getSjzbc() {
  214 + return sjzbc;
  215 + }
  216 + public void setSjzbc(int sjzbc) {
  217 + this.sjzbc = sjzbc;
  218 + }
  219 + public int getSjbc() {
  220 + return sjbc;
  221 + }
  222 + public void setSjbc(int sjbc) {
  223 + this.sjbc = sjbc;
  224 + }
  225 + public String getEdituser() {
  226 + return edituser;
  227 + }
  228 + public void setEdituser(String edituser) {
  229 + this.edituser = edituser;
  230 + }
  231 + public Date getEdittime() {
  232 + return edittime;
  233 + }
  234 + public void setEdittime(Date edittime) {
  235 + this.edittime = edittime;
  236 + }
  237 + public Date getCreatetime() {
  238 + return createtime;
  239 + }
  240 + public void setCreatetime(Date createtime) {
  241 + this.createtime = createtime;
  242 + }
  243 + public int getNylx() {
  244 + return nylx;
  245 + }
  246 + public void setNylx(int nylx) {
  247 + this.nylx = nylx;
  248 + }
  249 +
  250 + public int getJcsx(){
  251 + return jcsx;
  252 + }
  253 +
  254 + public void setJcsx(int jcsx){
  255 + this.jcsx=jcsx;
  256 + }
  257 +
  258 +}
... ...
src/main/java/com/bsth/entity/oil/Ylxxb.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "bsth_c_ylxxb")
  12 +public class Ylxxb {
  13 + @Id
  14 + @GeneratedValue
  15 + private Integer id;
  16 + private Date yyrq;
  17 + private Date jlrq;
  18 + private String nbbm;
  19 + private String jsy;
  20 + private Double jzl;
  21 + private String stationid;
  22 + private Date createtime;
  23 + private String gsdm;
  24 + private String yp;
  25 + private String jyggh;
  26 + private Double yj;
  27 + private String bz;
  28 + private Date xgrq;
  29 + private String xgr;
  30 + private String fromgsdm;
  31 + private int nylx;
  32 + public Integer getId() {
  33 + return id;
  34 + }
  35 + public void setId(Integer id) {
  36 + this.id = id;
  37 + }
  38 + public Date getYyrq() {
  39 + return yyrq;
  40 + }
  41 + public void setYyrq(Date yyrq) {
  42 + this.yyrq = yyrq;
  43 + }
  44 + public Date getJlrq() {
  45 + return jlrq;
  46 + }
  47 + public void setJlrq(Date jlrq) {
  48 + this.jlrq = jlrq;
  49 + }
  50 + public String getNbbm() {
  51 + return nbbm;
  52 + }
  53 + public void setNbbm(String nbbm) {
  54 + this.nbbm = nbbm;
  55 + }
  56 + public String getJsy() {
  57 + return jsy;
  58 + }
  59 + public void setJsy(String jsy) {
  60 + this.jsy = jsy;
  61 + }
  62 + public Double getJzl() {
  63 + return jzl;
  64 + }
  65 + public void setJzl(Double jzl) {
  66 + this.jzl = jzl;
  67 + }
  68 + public String getStationid() {
  69 + return stationid;
  70 + }
  71 + public void setStationid(String stationid) {
  72 + this.stationid = stationid;
  73 + }
  74 + public Date getCreatetime() {
  75 + return createtime;
  76 + }
  77 + public void setCreatetime(Date createtime) {
  78 + this.createtime = createtime;
  79 + }
  80 + public String getGsdm() {
  81 + return gsdm;
  82 + }
  83 + public void setGsdm(String gsdm) {
  84 + this.gsdm = gsdm;
  85 + }
  86 + public String getYp() {
  87 + return yp;
  88 + }
  89 + public void setYp(String yp) {
  90 + this.yp = yp;
  91 + }
  92 + public String getJyggh() {
  93 + return jyggh;
  94 + }
  95 + public void setJyggh(String jyggh) {
  96 + this.jyggh = jyggh;
  97 + }
  98 + public Double getYj() {
  99 + return yj;
  100 + }
  101 + public void setYj(Double yj) {
  102 + this.yj = yj;
  103 + }
  104 + public String getBz() {
  105 + return bz;
  106 + }
  107 + public void setBz(String bz) {
  108 + this.bz = bz;
  109 + }
  110 + public Date getXgrq() {
  111 + return xgrq;
  112 + }
  113 + public void setXgrq(Date xgrq) {
  114 + this.xgrq = xgrq;
  115 + }
  116 + public String getXgr() {
  117 + return xgr;
  118 + }
  119 + public void setXgr(String xgr) {
  120 + this.xgr = xgr;
  121 + }
  122 + public String getFromgsdm() {
  123 + return fromgsdm;
  124 + }
  125 + public void setFromgsdm(String fromgsdm) {
  126 + this.fromgsdm = fromgsdm;
  127 + }
  128 + public int getNylx() {
  129 + return nylx;
  130 + }
  131 + public void setNylx(int nylx) {
  132 + this.nylx = nylx;
  133 + }
  134 +
  135 +
  136 +
  137 +}
... ...
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
... ... @@ -49,9 +49,9 @@ public class LineConfig {
49 49 /** 开始运营时间 HH:mm */
50 50 private String startOpt;
51 51  
52   - /** 当天开始营运时间戳 */
  52 + /** 当天开始营运时间戳
53 53 @Transient
54   - private long currStartTime;
  54 + private long currStartTime;*/
55 55  
56 56 /** 托管状态 */
57 57 private boolean trust;
... ...
src/main/java/com/bsth/oplog/Level.java 0 → 100644
  1 +package com.bsth.oplog;
  2 +
  3 +public enum Level {
  4 +
  5 + ERROR,WARN,INFO,ACCESS;
  6 +}
... ...
src/main/java/com/bsth/oplog/Log.java 0 → 100644
  1 +package com.bsth.oplog;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Log {
  6 +
  7 + private String userName;
  8 +
  9 + private Long timestamp;
  10 +
  11 + private String type;
  12 +
  13 + private String level;
  14 +
  15 + private String path;
  16 +
  17 + private String serverIp;
  18 +
  19 + private String clientIp;
  20 +
  21 + private String httpData;
  22 +
  23 + private Date month;
  24 +
  25 + private String callerClass;
  26 +
  27 + private String callerMethod;
  28 +
  29 + private Integer lineNumber;
  30 +
  31 + public String getPath() {
  32 + return path;
  33 + }
  34 +
  35 + public void setPath(String path) {
  36 + this.path = path;
  37 + }
  38 +
  39 + public String getServerIp() {
  40 + return serverIp;
  41 + }
  42 +
  43 + public void setServerIp(String serverIp) {
  44 + this.serverIp = serverIp;
  45 + }
  46 +
  47 + public String getHttpData() {
  48 + return httpData;
  49 + }
  50 +
  51 + public void setHttpData(String httpData) {
  52 + this.httpData = httpData;
  53 + }
  54 +
  55 + public Date getMonth() {
  56 + return month;
  57 + }
  58 +
  59 + public void setMonth(Date month) {
  60 + this.month = month;
  61 + }
  62 +
  63 + public String getType() {
  64 + return type;
  65 + }
  66 +
  67 + public void setType(String type) {
  68 + this.type = type;
  69 + }
  70 +
  71 + public String getLevel() {
  72 + return level;
  73 + }
  74 +
  75 + public void setLevel(String level) {
  76 + this.level = level;
  77 + }
  78 +
  79 + public String getCallerClass() {
  80 + return callerClass;
  81 + }
  82 +
  83 + public void setCallerClass(String callerClass) {
  84 + this.callerClass = callerClass;
  85 + }
  86 +
  87 + public String getCallerMethod() {
  88 + return callerMethod;
  89 + }
  90 +
  91 + public void setCallerMethod(String callerMethod) {
  92 + this.callerMethod = callerMethod;
  93 + }
  94 +
  95 + public String getClientIp() {
  96 + return clientIp;
  97 + }
  98 +
  99 + public void setClientIp(String clientIp) {
  100 + this.clientIp = clientIp;
  101 + }
  102 +
  103 + public String getUserName() {
  104 + return userName;
  105 + }
  106 +
  107 + public void setUserName(String userName) {
  108 + this.userName = userName;
  109 + }
  110 +
  111 + public Long getTimestamp() {
  112 + return timestamp;
  113 + }
  114 +
  115 + public void setTimestamp(Long timestamp) {
  116 + this.timestamp = timestamp;
  117 + }
  118 +
  119 + public Integer getLineNumber() {
  120 + return lineNumber;
  121 + }
  122 +
  123 + public void setLineNumber(Integer lineNumber) {
  124 + this.lineNumber = lineNumber;
  125 + }
  126 +}
... ...
src/main/java/com/bsth/oplog/db/DBHelper.java 0 → 100644
  1 +package com.bsth.oplog.db;
  2 +
  3 +import java.util.LinkedList;
  4 +import java.util.concurrent.TimeUnit;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.boot.CommandLineRunner;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import com.bsth.Application;
  11 +import com.bsth.oplog.Log;
  12 +import com.bsth.oplog.db.mysql.DBPersistence;
  13 +
  14 +@Component
  15 +public class DBHelper implements CommandLineRunner{
  16 +
  17 + private final static int maxBufSize = 1000;
  18 + private final static int fixedMinute = 10;
  19 +
  20 + private static LinkedList<Log> buffer = new LinkedList<>();
  21 +
  22 + @Autowired
  23 + private FixedTimePersistenceThread fixedTimeThread;
  24 +
  25 + public void save(Log log){
  26 + buffer.add(log);
  27 +
  28 + if(buffer.size() >= maxBufSize)
  29 + fixedTimeThread.start();
  30 + }
  31 +
  32 + @Component
  33 + public static class FixedTimePersistenceThread extends Thread{
  34 +
  35 + @Autowired
  36 + DBPersistence persistence;
  37 +
  38 + @Override
  39 + public void run() {
  40 + persistence.batchSave(buffer);
  41 + }
  42 + }
  43 +
  44 + @Override
  45 + public void run(String... arg0) throws Exception {
  46 + Application.mainServices.scheduleWithFixedDelay(fixedTimeThread, fixedMinute, fixedMinute, TimeUnit.MINUTES);
  47 + }
  48 +}
... ...
src/main/java/com/bsth/oplog/db/mysql/DBPersistence.java 0 → 100644
  1 +package com.bsth.oplog.db.mysql;
  2 +
  3 +import java.sql.Date;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.SQLException;
  6 +import java.util.ArrayList;
  7 +import java.util.LinkedList;
  8 +import java.util.List;
  9 +
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  14 +import org.springframework.jdbc.core.JdbcTemplate;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import com.bsth.oplog.Log;
  18 +
  19 +/**
  20 + *
  21 + * @ClassName: DBPersistence
  22 + * @Description: TODO(mysql 批量入库)
  23 + * @author PanZhao
  24 + * @date 2016年10月20日 上午9:44:00
  25 + *
  26 + */
  27 +@Component
  28 +public class DBPersistence {
  29 +
  30 + @Autowired
  31 + JdbcTemplate jdbcTemplate;
  32 +
  33 + Logger logger = LoggerFactory.getLogger(DBPersistence.class);
  34 +
  35 + public void batchSave(LinkedList<Log> list){
  36 + String sql = "insert into bsth_c_sys_op_log"
  37 + + "(timestamp, path, type,level, caller_class, caller_method, user_name, client_ip, server_ip, month, http_data, line_number)"
  38 + + " values(?,?,?,?,?,?,?,?,?,?,?,?)";
  39 +
  40 +
  41 + List<Log> saveList = new ArrayList<>(list.size());
  42 + Log log;
  43 + while(true){
  44 + log = list.poll();
  45 + if(log != null)
  46 + saveList.add(log);
  47 + else
  48 + break;
  49 + }
  50 +
  51 + Date month = new Date(System.currentTimeMillis());
  52 +
  53 + try {
  54 + jdbcTemplate.batchUpdate(sql, new LogBatchPreparedStatementSetter(saveList, month));
  55 + } catch (Exception e) {
  56 + logger.error("操作日志入库失败", e);
  57 + }
  58 + }
  59 +
  60 + private class LogBatchPreparedStatementSetter implements BatchPreparedStatementSetter{
  61 +
  62 + List<Log> temList;
  63 + Date month;
  64 +
  65 + public LogBatchPreparedStatementSetter(final List<Log> list, Date month){
  66 + this.temList = list;
  67 + this.month = month;
  68 + }
  69 +
  70 + @Override
  71 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  72 + Log log = temList.get(i);
  73 + ps.setLong(1, log.getTimestamp());
  74 + ps.setString(2, log.getPath());
  75 + ps.setString(3, log.getType());
  76 + ps.setString(4, log.getLevel());
  77 + ps.setString(5, log.getCallerClass());
  78 + ps.setString(6, log.getCallerMethod());
  79 + ps.setString(7, log.getUserName());
  80 + ps.setString(8, log.getClientIp());
  81 + ps.setString(9, log.getServerIp());
  82 + ps.setDate(10, month);
  83 + ps.setString(11, log.getHttpData());
  84 + ps.setObject(12, log.getLineNumber());
  85 + }
  86 +
  87 + @Override
  88 + public int getBatchSize() {
  89 + return temList.size();
  90 + }
  91 + }
  92 +}
... ...
src/main/java/com/bsth/oplog/db/mysql/db.sql 0 → 100644
  1 +CREATE TABLE `bsth_c_sys_op_log` (
  2 +`timestamp` bigint(20) NOT NULL ,
  3 +`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  4 +`caller_class` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  5 +`caller_method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  6 +`client_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  7 +`http_data` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
  8 +`level` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  9 +`month` date NOT NULL ,
  10 +`path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  11 +`server_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
  12 +`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  13 +`line_number` int(11) NULL DEFAULT NULL
  14 +)
  15 +ENGINE=InnoDB
  16 +DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
  17 +ROW_FORMAT=DYNAMIC
  18 +
  19 +PARTITION BY RANGE(TO_DAYS (month))
  20 +(
  21 +PARTITION p201610 VALUES LESS THAN (TO_DAYS('2016-11-01')),
  22 +PARTITION p201611 VALUES LESS THAN (TO_DAYS('2016-12-01')),
  23 +PARTITION p201612 VALUES LESS THAN (TO_DAYS('2017-01-01')),
  24 +
  25 +PARTITION p201701 VALUES LESS THAN (TO_DAYS('2017-02-01')),
  26 +PARTITION p201702 VALUES LESS THAN (TO_DAYS('2017-03-01')),
  27 +PARTITION p201703 VALUES LESS THAN (TO_DAYS('2017-04-01')),
  28 +PARTITION p201704 VALUES LESS THAN (TO_DAYS('2017-05-01')),
  29 +PARTITION p201705 VALUES LESS THAN (TO_DAYS('2017-06-01')),
  30 +PARTITION p201706 VALUES LESS THAN (TO_DAYS('2017-07-01')),
  31 +PARTITION p201707 VALUES LESS THAN (TO_DAYS('2017-08-01')),
  32 +PARTITION p201708 VALUES LESS THAN (TO_DAYS('2017-09-01')),
  33 +PARTITION p201709 VALUES LESS THAN (TO_DAYS('2017-10-01')),
  34 +PARTITION p201710 VALUES LESS THAN (TO_DAYS('2017-11-01')),
  35 +PARTITION p201711 VALUES LESS THAN (TO_DAYS('2017-12-01')),
  36 +PARTITION p201712 VALUES LESS THAN (TO_DAYS('2018-01-01')),
  37 +
  38 +
  39 +PARTITION p201801 VALUES LESS THAN (TO_DAYS('2018-02-01')),
  40 +PARTITION p201802 VALUES LESS THAN (TO_DAYS('2018-03-01')),
  41 +PARTITION p201803 VALUES LESS THAN (TO_DAYS('2018-04-01')),
  42 +PARTITION p201804 VALUES LESS THAN (TO_DAYS('2018-05-01')),
  43 +PARTITION p201805 VALUES LESS THAN (TO_DAYS('2018-06-01')),
  44 +PARTITION p201806 VALUES LESS THAN (TO_DAYS('2018-07-01')),
  45 +PARTITION p201807 VALUES LESS THAN (TO_DAYS('2018-08-01')),
  46 +PARTITION p201808 VALUES LESS THAN (TO_DAYS('2018-09-01')),
  47 +PARTITION p201809 VALUES LESS THAN (TO_DAYS('2018-10-01')),
  48 +PARTITION p201810 VALUES LESS THAN (TO_DAYS('2018-11-01')),
  49 +PARTITION p201811 VALUES LESS THAN (TO_DAYS('2018-12-01')),
  50 +PARTITION p201812 VALUES LESS THAN (TO_DAYS('2019-01-01')),
  51 +
  52 +PARTITION p201901 VALUES LESS THAN (TO_DAYS('2019-02-01')),
  53 +PARTITION p201902 VALUES LESS THAN (TO_DAYS('2019-03-01')),
  54 +PARTITION p201903 VALUES LESS THAN (TO_DAYS('2019-04-01')),
  55 +PARTITION p201904 VALUES LESS THAN (TO_DAYS('2019-05-01')),
  56 +PARTITION p201905 VALUES LESS THAN (TO_DAYS('2019-06-01')),
  57 +PARTITION p201906 VALUES LESS THAN (TO_DAYS('2019-07-01')),
  58 +PARTITION p201907 VALUES LESS THAN (TO_DAYS('2019-08-01')),
  59 +PARTITION p201908 VALUES LESS THAN (TO_DAYS('2019-09-01')),
  60 +PARTITION p201909 VALUES LESS THAN (TO_DAYS('2019-10-01')),
  61 +PARTITION p201910 VALUES LESS THAN (TO_DAYS('2019-11-01')),
  62 +PARTITION p201911 VALUES LESS THAN (TO_DAYS('2019-12-01')),
  63 +PARTITION p201912 VALUES LESS THAN (TO_DAYS('2020-01-01'))
  64 +
  65 +
  66 +);
  67 +
... ...
src/main/java/com/bsth/oplog/http/HttpOpLogInterceptor.java 0 → 100644
  1 +package com.bsth.oplog.http;
  2 +
  3 +import javax.servlet.http.HttpServletRequest;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +import org.springframework.util.AntPathMatcher;
  9 +import org.springframework.util.PathMatcher;
  10 +import org.springframework.web.method.HandlerMethod;
  11 +import org.springframework.web.servlet.HandlerInterceptor;
  12 +import org.springframework.web.servlet.ModelAndView;
  13 +
  14 +/**
  15 + *
  16 + * @ClassName: HttpOpLogger
  17 + * @Description: TODO(HTTP 接口日志拦截器)
  18 + * @author PanZhao
  19 + * @date 2016年10月20日 上午12:03:11
  20 + *
  21 + */
  22 +@Component
  23 +public class HttpOpLogInterceptor implements HandlerInterceptor {
  24 +
  25 + private final PathMatcher pathMatcher = new AntPathMatcher();
  26 +
  27 + // GET 白名单
  28 + private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser","/dictionary/**", "/module/findByCurrentUser", "/gps/**", "/error/**" };
  29 +
  30 + // POST 白名单
  31 + private String[] httpPostWhiteList = {
  32 + "/control/upstream"
  33 + };
  34 +
  35 + @Autowired
  36 + HttpRecorder httpRecorder;
  37 +
  38 + @Override
  39 + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception arg3)
  40 + throws Exception {
  41 +
  42 + }
  43 +
  44 + @Override
  45 + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object arg2, ModelAndView arg3)
  46 + throws Exception {
  47 +
  48 + String method = request.getMethod(), path = request.getRequestURI();
  49 + // white list
  50 + String[] whiteList = method == "GET" ? httpGetWhiteList : httpPostWhiteList;
  51 +
  52 + if (!isWhiteURL(whiteList, path))
  53 + httpRecorder.record(request, (HandlerMethod)arg2);
  54 + }
  55 +
  56 + @Override
  57 + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object arg2) throws Exception {
  58 +
  59 + return true;
  60 + }
  61 +
  62 + private boolean isWhiteURL(String[] whiteList, String currentURL) {
  63 + for (String whiteURL : whiteList) {
  64 + if (pathMatcher.match(whiteURL, currentURL)) {
  65 + return true;
  66 + }
  67 + }
  68 + return false;
  69 + }
  70 +}
... ...
src/main/java/com/bsth/oplog/http/HttpRecorder.java 0 → 100644
  1 +package com.bsth.oplog.http;
  2 +
  3 +import java.lang.reflect.Method;
  4 +import java.net.InetAddress;
  5 +import java.net.UnknownHostException;
  6 +
  7 +import javax.servlet.http.HttpServletRequest;
  8 +
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Component;
  13 +import org.springframework.web.method.HandlerMethod;
  14 +
  15 +import com.alibaba.fastjson.JSON;
  16 +import com.bsth.entity.sys.SysUser;
  17 +import com.bsth.oplog.Level;
  18 +import com.bsth.oplog.Log;
  19 +import com.bsth.oplog.db.DBHelper;
  20 +import com.bsth.security.util.SecurityUtils;
  21 +import com.bsth.util.IpUtils;
  22 +
  23 +/**
  24 + *
  25 + * @ClassName: HttpRecorder
  26 + * @Description: TODO(HTTP 日志记录器)
  27 + * @author PanZhao
  28 + * @date 2016年10月20日 下午12:56:56
  29 + *
  30 + */
  31 +@Component
  32 +public class HttpRecorder {
  33 +
  34 + Logger logger = LoggerFactory.getLogger(HttpRecorder.class);
  35 +
  36 + private final static int httpDataMaxLen = 500;
  37 +
  38 + @Autowired
  39 + DBHelper persistenceBuff;
  40 +
  41 + public void record(HttpServletRequest request, HandlerMethod method){
  42 + Log log = new Log();
  43 +
  44 + log.setType(request.getMethod().toUpperCase());
  45 + log.setLevel(Level.INFO.toString());
  46 + try {
  47 + log.setServerIp(InetAddress.getLocalHost().getHostAddress());
  48 + } catch (UnknownHostException e) {
  49 + e.printStackTrace();
  50 + }
  51 +
  52 + log.setPath(request.getRequestURI());
  53 + //Caller
  54 + Method refMethod = method.getMethod();
  55 + log.setCallerClass(refMethod.getDeclaringClass().getName());
  56 + log.setCallerMethod(refMethod.getName());
  57 +
  58 + //Primary Key
  59 + log.setTimestamp(System.currentTimeMillis());
  60 +
  61 + SysUser user = SecurityUtils.getCurrentUser();
  62 + if(user != null)
  63 + log.setUserName(user.getUserName());
  64 + //request
  65 + log.setClientIp(IpUtils.getIpAddr(request));
  66 + log.setHttpData(httpData(request));
  67 +
  68 + //save
  69 + persistenceBuff.save(log);
  70 + }
  71 +
  72 + private String httpData(HttpServletRequest request){
  73 + String rs = JSON.toJSONString(request.getParameterMap());
  74 +
  75 + if(rs.length() > httpDataMaxLen)
  76 + rs = rs.substring(0, httpDataMaxLen);
  77 +
  78 + return rs.replaceAll("\"", "‘");
  79 + }
  80 +}
... ...
src/main/java/com/bsth/oplog/normal/OpLogger.java 0 → 100644
  1 +package com.bsth.oplog.normal;
  2 +
  3 +import java.net.InetAddress;
  4 +import java.net.UnknownHostException;
  5 +
  6 +import javax.servlet.http.HttpServletRequest;
  7 +
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import com.bsth.entity.sys.SysUser;
  12 +import com.bsth.oplog.Log;
  13 +import com.bsth.oplog.db.DBHelper;
  14 +import com.bsth.security.util.SecurityUtils;
  15 +import com.bsth.util.IpUtils;
  16 +
  17 +/**
  18 + *
  19 + * @ClassName: OpLogger
  20 + * @Description: TODO(常规的操作日志记录器)
  21 + * @author PanZhao
  22 + * @date 2016年10月21日 上午12:52:30
  23 + *
  24 + */
  25 +@Component
  26 +public class OpLogger {
  27 +
  28 + @Autowired
  29 + DBHelper dbHelper;
  30 +
  31 + public void info(String path){
  32 + save(getInitLog(path));
  33 + }
  34 +
  35 + public void info(String path, HttpServletRequest request){
  36 + Log log = getInitLog(path);
  37 +
  38 + if(request != null){
  39 + SysUser user = SecurityUtils.getCurrentUser();
  40 + if(user != null)
  41 + log.setUserName(user.getUserName());
  42 +
  43 + log.setClientIp(IpUtils.getIpAddr(request));
  44 + }
  45 +
  46 + save(log);
  47 + }
  48 +
  49 + public void info(String path, HttpServletRequest request, String description){
  50 +
  51 + }
  52 +
  53 + public static Log getInitLog(String path){
  54 + Log log = new Log();
  55 + log.setTimestamp(System.currentTimeMillis());
  56 + log.setPath(path);
  57 + log.setType("NORMAL");
  58 +
  59 + //get caller
  60 + StackTraceElement[] stack = (new Throwable()).getStackTrace();
  61 + //注意调用链的顺序,此时2为实际调用者
  62 + StackTraceElement caller = stack[2];
  63 +
  64 + log.setCallerClass(caller.getClassName());
  65 + log.setCallerMethod(caller.getMethodName());
  66 + log.setLineNumber(caller.getLineNumber());
  67 +
  68 + try {
  69 + log.setServerIp(InetAddress.getLocalHost().getHostAddress());
  70 + } catch (UnknownHostException e) {
  71 + e.printStackTrace();
  72 + }
  73 +
  74 + return log;
  75 + }
  76 +
  77 + public void save(Log log){
  78 + dbHelper.save(log);
  79 + }
  80 +}
... ...
src/main/java/com/bsth/repository/CarsRepository.java
1 1 package com.bsth.repository;
2 2  
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Query;
3 6 import org.springframework.stereotype.Repository;
4 7  
5 8 import com.bsth.entity.Cars;
... ... @@ -7,4 +10,6 @@ import com.bsth.entity.Cars;
7 10 @Repository
8 11 public interface CarsRepository extends BaseRepository<Cars, Integer>{
9 12  
  13 + @Query(value="select s from Cars s where s.id in(select e.cl.id from CarConfigInfo e where e.xl.id = ?1) ")
  14 + List<Cars> findCarsByLineId(Integer lineId);
10 15 }
... ...
src/main/java/com/bsth/repository/PersonnelRepository.java
1 1 package com.bsth.repository;
2 2  
  3 +import java.util.List;
  4 +
3 5 import com.bsth.entity.Personnel;
  6 +import org.springframework.data.jpa.repository.Query;
4 7 import org.springframework.stereotype.Repository;
5 8  
6 9 /**
... ... @@ -8,4 +11,10 @@ import org.springframework.stereotype.Repository;
8 11 */
9 12 @Repository
10 13 public interface PersonnelRepository extends BaseRepository<Personnel, Integer> {
  14 +
  15 + @Query(value="select s from Personnel s where s.id in(select e.jsy.id from EmployeeConfigInfo e where e.xl.id = ?1) ")
  16 + List<Personnel> findJsysByLineId(Integer lineId);
  17 +
  18 + @Query(value="select s from Personnel s where s.id in(select e.spy.id from EmployeeConfigInfo e where e.xl.id = ?1) ")
  19 + List<Personnel> findSpysByLineId(Integer lineId);
11 20 }
... ...
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -157,4 +157,9 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
157 157 " FROM bsth_c_sectionroute c " +
158 158 " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true)
159 159 List<Object[]> sectionRouteVector(Integer lineId,Integer directions);
  160 +
  161 + @Transactional
  162 + @Modifying
  163 + @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true)
  164 + void isRoadSpeedUpd(Integer isR,Integer line,Integer directions);
160 165 }
... ...
src/main/java/com/bsth/repository/SectionSpeedRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.SectionSpeed;
  11 +
  12 +/**
  13 + * @description TODO(路段限速持久层)
  14 + *
  15 + * @author Administrator
  16 + *
  17 + * @date 2016年9月21日 13:31:25
  18 + */
  19 +@Repository
  20 +public interface SectionSpeedRepository extends BaseRepository<SectionSpeed, Integer>{
  21 +
  22 +
  23 + @Transactional
  24 + @Modifying
  25 + @Query(value="INSERT INTO bsth_c_sectionspeed (" +
  26 + "line , line_code , directions , `code` , s_name,road,road_code ) " +
  27 + " VALUES (" +
  28 + "?1 , ?2 , ?3 , ?4 , ?5,?6,?7)", nativeQuery=true)
  29 + /** @description TODO(路段限速保存) @param (<line:线路ID;versions:版本号;destroy:是否撤销;directions:方向;sValue:限速;code:路段序号> )*/
  30 + /** @param (<lineCode:线路编码;sName:路段名称;sType:路段类型;bLineStr:路段矢量百度坐标;gLineStr:路段矢量WGS坐标;descriptions:说明>)*/
  31 + void add(Integer line,String lineCode,Integer directions,Integer code,String sName,Integer road,String road_code);
  32 +
  33 + @Transactional
  34 + @Modifying
  35 + @Query(value="INSERT INTO bsth_c_road("+
  36 + "broad_vector,groad_vector,road_code,road_name,speed,id)"+
  37 + " VALUES(" +
  38 + "ST_GeomFromText(?1),ST_GeomFromText(?2),?3,?4,?5,?6)", nativeQuery=true)
  39 + void insertRoad(String broad_vector,String groad_vector,String road_code,String road_name,Double speed,Integer id);
  40 +
  41 + @Query(value="SELECT b.`name` as linename, a.speedid, a.bLineStr ,a.line_code,a.s_name,a.speed ,a.line,a.codenumb,a.road,a.directions FROM ("+
  42 + " SELECT p.id AS speedid,p.line,p.line_code,p.road,p.directions,p.`code` AS codenumb,p.s_name,ST_AsText(r.broad_vector) AS bLineStr,r.speed FROM ("+
  43 + " SELECT s.id,s.line,s.line_code,s.road,s.directions,s.`code`,s.s_name FROM bsth_c_sectionspeed s where s.line =?1 and s.line_code=?2 and s.directions=?3) p LEFT JOIN bsth_c_road r ON p.road = r.id) a "+
  44 + " LEFT JOIN bsth_c_line b ON a.line = b.id ORDER BY codenumb asc",nativeQuery = true)
  45 + List<Object[]> getSectionSpeedInfo(int lineId, String lineCode, int directions);
  46 +
  47 + /** 获取路网数据 */
  48 + @Query(value="SELECT ST_AsText(g.bdjw) as SHAPE , id as id ,ldbh,mc FROM jjwgps_t_gjldb g where g.bdjw is not null ",nativeQuery = true)
  49 + List<Object[]> getroadNet();
  50 +
  51 + /** */
  52 + @Query(value="SELECT ST_Contains(ST_Buffer(ST_GeomFromText(?1),0.0005),ST_GeomFromText(?2)) AS result",nativeQuery = true)
  53 + int ST_Contains(String g1,String g2);
  54 +
  55 +
  56 + @Query(value="SELECT id FROM bsth_c_road r where r.road_code = ?1",nativeQuery = true)
  57 + Integer validateRoade(String raodCode);
  58 +
  59 + @Transactional
  60 + @Modifying
  61 + @Query(value="UPDATE bsth_c_sectionspeed set `code` =?1 where id=?2",nativeQuery = true)
  62 + void roadUpdCode(Integer code,Integer sSpeedId);
  63 +
  64 + @Transactional
  65 + @Modifying
  66 + @Query(value="UPDATE bsth_c_road set road_name = ?1 ,speed =?2 where id= ?3",nativeQuery = true)
  67 + void sSpeedUpd(String roadName,Double speed ,Integer id);
  68 +
  69 +}
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -250,4 +250,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
250 250  
251 251 @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode")
252 252 List<StationRoute> findByLine(String lineCode, int updown);
  253 +
  254 + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  255 + @Query("select s from StationRoute s where s.destroy=0 and s.lineCode=?1")
  256 + List<StationRoute> findByLineCode(String lineCode);
253 257 }
... ...
src/main/java/com/bsth/repository/oil/CylRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +
  4 +import org.springframework.stereotype.Repository;
  5 +import com.bsth.entity.oil.Cyl;
  6 +import com.bsth.repository.BaseRepository;
  7 +
  8 +@Repository
  9 +public interface CylRepository extends BaseRepository<Cyl, Integer>{
  10 +
  11 +}
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.oil.Ylb;
  11 +import com.bsth.repository.BaseRepository;
  12 +
  13 +@Repository
  14 +public interface YlbRepository extends BaseRepository<Ylb, Integer>{
  15 + /**
  16 + * 前一天YLB信息
  17 + * @param rq
  18 + * @return
  19 + */
  20 + @Transactional
  21 + @Modifying
  22 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)-to_days(rq)=1",nativeQuery=true)
  23 + List<Ylb> obtainYlbefore(String rq);
  24 +
  25 + /**
  26 + * 当天YLB信息
  27 + * @param rq
  28 + * @return
  29 + */
  30 + @Transactional
  31 + @Modifying
  32 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true)
  33 + List<Ylb> obtainYl(String rq);
  34 +}
... ...
src/main/java/com/bsth/repository/oil/YlxxbRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.oil.Ylxxb;
  11 +import com.bsth.repository.BaseRepository;
  12 +
  13 +@Repository
  14 +public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{
  15 + /**
  16 + * 当天YLXXB信息
  17 + * @param rq
  18 + * @return
  19 + */
  20 + @Transactional
  21 + @Modifying
  22 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true)
  23 + List<Ylxxb> obtainYlxx(String rq);
  24 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -20,7 +20,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
20 20 List<ScheduleRealInfo> findByLines(List<String> lines);
21 21  
22 22  
23   - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType = 'out' order by (lpName+1)")
  23 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName order by (lpName+1)")
24 24 List<ScheduleRealInfo> queryUserInfo(String line,String date);
25 25  
26 26 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
... ... @@ -29,7 +29,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
29 29 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,sum(addMileage) as ksgl,count(jName) as bcs) from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh")
30 30 List<Map<String, Object>> dailyInfo(String line,String date);
31 31  
32   - @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm = ?1 AND r.schedule_date = ?2 and r.cl_zbh = ?3",nativeQuery=true)
  32 + @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm = ?1 AND r.schedule_date = ?2 and r.cl_zbh = ?3 order by d.timestamp",nativeQuery=true)
33 33 List<Object[]> historyMessage(String line,String date,String code);
34 34  
35 35 @Query(value = "select max(id) from ScheduleRealInfo")
... ... @@ -54,7 +54,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
54 54 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDate >= str_to_date(?2,'%Y-%m-%d') and s.scheduleDate <= str_to_date(?3,'%Y-%m-%d') and s.lpName = ?4 order by s.fcsj")
55 55 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName);
56 56  
57   - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate <= str_to_date(?4,'%Y-%m-%d') order by bcs")
  57 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') order by bcs")
58 58 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
59 59  
60 60 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
... ... @@ -74,4 +74,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
74 74  
75 75 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
76 76 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
  77 +
  78 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual")
  79 + List<Map<String,Object>> yesterdayDataList(String line,String date);
  80 +
  81 + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
  82 + List<ScheduleRealInfo> setLD(String date);
  83 +
  84 + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh")
  85 + List<ScheduleRealInfo> setLDGroup(String date);
  86 +
  87 + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh")
  88 + List<ScheduleRealInfo> setLCYHGroup(String date);
  89 +
  90 + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm")
  91 + List<ScheduleRealInfo> setDDRBGroup(String date);
77 92 }
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
1 1 package com.bsth.repository.schedule;
2 2  
  3 +import com.bsth.entity.Cars;
3 4 import com.bsth.entity.schedule.SchedulePlanInfo;
4 5 import com.bsth.repository.BaseRepository;
5 6  
... ... @@ -116,5 +117,8 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
116 117 @Param("p5") Date scheduleDate,
117 118 @Param("p6") String lpName,
118 119 @Param("p7") Integer spyId_src);
  120 +
  121 + @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 order by s.xlBm,clZbh,lp,xlDir")
  122 + List<SchedulePlanInfo> findLineScheduleBc(String scheduleDate);
119 123  
120 124 }
... ...
src/main/java/com/bsth/security/SecurityMetadataSourceService.java
... ... @@ -66,8 +66,6 @@ public class SecurityMetadataSourceService implements
66 66 String method = invocation.getRequest().getMethod();
67 67 String url = method.toLowerCase() + "#" + invocation.getRequestUrl();
68 68  
69   - System.out.println(url);
70   -
71 69 int symIndex = url.indexOf("?");
72 70 if(symIndex != -1){
73 71 url = url.substring(0, symIndex);
... ...
src/main/java/com/bsth/service/PersonnelService.java
1 1 package com.bsth.service;
2 2  
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
3 6 import com.bsth.entity.Personnel;
4 7  
5 8 /**
6 9 * Created by xu on 16/6/15.
7 10 */
8 11 public interface PersonnelService extends BaseService<Personnel, Integer> {
  12 + List<Map<String, String>> sreachPersonnel(String jobCode);
9 13 }
... ...
src/main/java/com/bsth/service/SectionSpeedService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.SectionSpeed;
  7 +
  8 +/**
  9 + * Created by xu on 16/5/31.
  10 + */
  11 +public interface SectionSpeedService extends BaseService<SectionSpeed, Integer> {
  12 +
  13 + /** @description TODO(新增路段限速) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/
  14 + Map<String, Object> add(Map<String, Object> map);
  15 +
  16 + /** @description TODO(修改路段) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/
  17 + Map<String, Object> roadUpd(Map<String, Object> map);
  18 +
  19 + List<Map<String, Object>> getSectionSpeedInfo(Map<String, Object> map);
  20 +
  21 + /** 解析路段 */
  22 + List<Map<String, Object>> analyticSection(Map<String,Object> map);
  23 +
  24 +}
... ...
src/main/java/com/bsth/service/StationRouteService.java
... ... @@ -78,4 +78,6 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
78 78 * @return List<Map<String, Object>>
79 79 */
80 80 List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map);
  81 +
  82 + Map<String, Object> findByMultiLine(String lineIds);
81 83 }
... ...
src/main/java/com/bsth/service/TrafficManageService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.Line;
  4 +
  5 +/**
  6 + *
  7 + * @Interface: LineService(线路service业务层实现接口)
  8 + *
  9 + * @extends : BaseService
  10 + *
  11 + * @Description: TODO(线路service业务层实现接口)
  12 + *
  13 + * @Author bsth@lq
  14 + *
  15 + * @Date 2016年4月28日 上午9:21:17
  16 + *
  17 + * @Version 公交调度系统BS版 0.1
  18 + *
  19 + */
  20 +public interface TrafficManageService {
  21 +
  22 + /**
  23 + * 上传线路信息
  24 + *
  25 + * @return 调用接口返回信息
  26 + */
  27 + String setXL();
  28 +
  29 + /**
  30 + * 上传车辆信息
  31 + *
  32 + * @return 调用接口返回信息
  33 + */
  34 + String setCL();
  35 +
  36 + /**
  37 + * 上传司机信息
  38 + * @return 调用接口返回信息
  39 + */
  40 + String setSJ();
  41 +
  42 + /**
  43 + * 上传超速数据
  44 + *
  45 + * @return 调用接口返回信息
  46 + */
  47 + String setCS();
  48 +
  49 + /**
  50 + * 上传线路班次时刻表数据
  51 + *
  52 + * @return 调用接口返回信息
  53 + */
  54 + String setSKB(String ids);
  55 +
  56 + /**
  57 + * 线路人员车辆配置信息
  58 + * @return 调用接口返回信息
  59 + */
  60 + String setXLPC();
  61 +
  62 + /**
  63 + * 线路计划班次表
  64 + * @return 调用接口返回信息
  65 + */
  66 + String setJHBC();
  67 +
  68 + String setLD();
  69 +
  70 + String setLCYH();
  71 +
  72 + String setDDRB();
  73 +}
... ...
src/main/java/com/bsth/service/directive/DirectiveService.java
... ... @@ -7,6 +7,7 @@ import java.util.Map;
7 7 import com.bsth.entity.directive.D60;
8 8 import com.bsth.entity.directive.D64;
9 9 import com.bsth.entity.directive.D80;
  10 +import com.bsth.entity.directive.DC0_A3;
10 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 12 import com.bsth.service.BaseService;
12 13  
... ... @@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{
82 83 Map<String, Object> findAll80(Map<String, Object> map, int page, int size);
83 84  
84 85 D64 save64(D64 d64);
  86 +
  87 + int sendC0A4(String nbbm);
  88 +
  89 + int sendC0A3(DC0_A3 c0a4);
  90 +
  91 + int sendC0A5(String json);
85 92 }
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -30,6 +30,7 @@ import com.bsth.data.schedule.DayOfSchedule;
30 30 import com.bsth.entity.directive.D60;
31 31 import com.bsth.entity.directive.D64;
32 32 import com.bsth.entity.directive.D80;
  33 +import com.bsth.entity.directive.DC0_A3;
33 34 import com.bsth.entity.directive.Directive;
34 35 import com.bsth.entity.realcontrol.ScheduleRealInfo;
35 36 import com.bsth.entity.sys.SysUser;
... ... @@ -235,13 +236,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
235 236 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64));
236 237 // 入库
237 238 d64.setHttpCode(code);
  239 + d64.getData().setTxtContent("切换线路[" + lineCode + "]");
238 240 dayOfDirectives.put64(d64);
239 241  
240 242 // 通知设备刷新线路文件,忽略结果
241 243 if (code == 0)
242 244 GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
243 245 else
244   - d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code);
  246 + d64.setErrorText(" 网关通讯失败, code: " + code);
245 247  
246 248 d64Repository.save(d64);
247 249 return code;
... ... @@ -408,7 +410,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
408 410 }
409 411  
410 412 rsMap.put("list", rs);
411   - rsMap.put("totalPages", count % size == 0 ? count / size : count / size + 1);
  413 + rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size);
412 414 rsMap.put("page", page);
413 415 return rsMap;
414 416 }
... ... @@ -469,4 +471,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
469 471 public D64 save64(D64 d64) {
470 472 return d64Repository.save(d64);
471 473 }
  474 +
  475 + @Override
  476 + public int sendC0A4(String nbbm) {
  477 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  478 +
  479 + Map<String, Object> c0a4 = new HashMap<>();
  480 + c0a4.put("deviceId", deviceId);
  481 + c0a4.put("timestamp", System.currentTimeMillis());
  482 + c0a4.put("operCode", (short)0xC0);
  483 +
  484 + Map<String, Object> data = new HashMap<>();
  485 + data.put("deviceId", deviceId);
  486 + data.put("operCode2", (short)0xA4);
  487 + c0a4.put("data", data);
  488 +
  489 + return GatewayHttpUtils.postJson(JSON.toJSONString(c0a4));
  490 + }
  491 +
  492 + @Override
  493 + public int sendC0A3(DC0_A3 c0a3) {
  494 + GatewayHttpUtils.postJson(JSON.toJSONString(c0a3));
  495 + return 0;
  496 + }
  497 +
  498 + @Override
  499 + public int sendC0A5(String json) {
  500 + return GatewayHttpUtils.postJson(json);
  501 + }
472 502 }
... ...
src/main/java/com/bsth/service/excep/AbnormalService.java 0 → 100644
  1 +package com.bsth.service.excep;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import com.bsth.entity.excep.Abnormal;
  6 +import com.bsth.util.PageObject;
  7 +
  8 +public interface AbnormalService {
  9 + PageObject <Abnormal> Pagequery(Map<String, Object> map) ;
  10 +}
... ...
src/main/java/com/bsth/service/excep/OfflineService.java 0 → 100644
  1 +package com.bsth.service.excep;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +import com.bsth.entity.excep.Offline;
  9 +import com.bsth.util.PageObject;
  10 +
  11 +public interface OfflineService {
  12 +// List<Offline> findAll(Map<String, Object> map);
  13 + PageObject <Offline> Pagequery(Map<String, Object> map) ;
  14 +// List<Offline> resultSet2Set(ResultSet rs) throws SQLException;
  15 + Map<String, Object> getReport( Map<String, Object> map);
  16 +}
... ...
src/main/java/com/bsth/service/excep/OutboundService.java 0 → 100644
  1 +package com.bsth.service.excep;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import com.bsth.entity.excep.Outbound;
  6 +import com.bsth.util.PageObject;
  7 +
  8 +public interface OutboundService {
  9 + PageObject <Outbound> Pagequery(Map<String, Object> map) ;
  10 + Map<String, Object> getReport( Map<String, Object> map);
  11 +}
... ...
src/main/java/com/bsth/service/excep/SpeedingService.java 0 → 100644
  1 +package com.bsth.service.excep;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import com.bsth.entity.excep.Speeding;
  6 +import com.bsth.util.PageObject;
  7 +
  8 +public interface SpeedingService {
  9 + PageObject <Speeding> Pagequery(Map<String, Object> map) ;
  10 + Map<String, Object> getReport( Map<String, Object> map);
  11 +}
... ...