Commit dd60c6ddbeaf66f6184b6017bb307fb2a0e8f724

Authored by zq
2 parents 8f31be15 2f7e3672

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Showing 64 changed files with 3713 additions and 589 deletions

Too many changes to show.

To preserve performance only 64 of 233 files are displayed.

README.md
1 -公交调度系统BS版 0.1  
2 -======  
3 -----------  
4 -## 目录  
5 ----------  
6 - * [字典表](#字典表)  
7 - * [动态jpa查询实现](#动态jpa查询实现)  
8 - * [车载 gps 相关数据](#gps)  
9 - * [实时gps数据接口 http](#实时gps接口)  
10 - * [进出站数据表结构](#进站数据)  
11 - * [异常警报表结构](#异常警报)  
12 - * [大间隔](#大间隔)  
13 - * [超速](#超速)  
14 - * [越界](#越界)  
15 - * [越站](#越站)  
16 - * [聚集](#聚集)  
17 - * [掉线](#掉线)  
18 - * [调度消息下发接口HTTP](#调度消息下发接口)  
19 - * [调度消息上传接口HTTP](#调度消息上传接口)  
20 -  
21 -----------  
22 -  
23 -## 字典表  
24 -----------  
25 -字典操作全部由前端负责,主要有2种。  
26 -  
27 -1、转换字典代码。  
28 - 当pjax的`pjax:success`事件被触发(片段加载完成)  
29 - 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换  
30 -``` html  
31 ---dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码  
32 -<span class="nt-dictionary" data-group="ScheduleType">out</span>  
33 ---to  
34 -<span>出场</span>  
35 -  
36 -<!- dom标签为input时,如下 data-code为要转换的代码 -->  
37 -<input class="nt-dictionary" data-group="ScheduleType" data-code="out">  
38 ---to  
39 -<input value="出场">  
40 -  
41 -<!- dom标签为select时 如下 data-code为要选中的项 -->  
42 -<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>  
43 ---to  
44 -<select>  
45 - <option value="normal">正常班次</option>  
46 - <option value="out" selected>出场</option>  
47 - <option value="in">进场</option>  
48 - <option value="oil">加油</option>  
49 - <option value="temp">临加</option>  
50 - <option value="region">区间</option>  
51 - <option value="venting">放空</option>  
52 - <option value="major">放大站</option>  
53 -</select>  
54 -```  
55 -*原标签的class 除nt-dictionary 外,其余均会被保留*  
56 -  
57 -2、dictionary.js提供如下方法自行使用  
58 -| 方法名 | 参数|返回|  
59 -| ---- | ---- | ---- | ---- |  
60 -| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |  
61 -| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|  
62 -| transformCode (转换字典代码)| (group, code) | 上行 |  
63 -  
64 -## 动态jpa查询实现  
65 -----------  
66 -*参考调度系统枚举com.bsth.entity.search.SearchOperator*  
67 -  
68 -  
69 -## gps  
70 -----------  
71 -### 实时gps接口  
72 -  
73 -所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)  
74 -根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)  
75 -  
76 -<span style="color: red">Response</span>:  
77 -```json  
78 -{  
79 - "data":[  
80 - {  
81 - "companyCode":5,  
82 - "lineId":10329,  
83 - "deviceId":"05B01901",  
84 - "carparkNo":"00000000",  
85 - "stopNo":"7C890002",  
86 - "lon":121.549866,  
87 - "lat":31.238798,  
88 - "timestamp":1397104499000,  
89 - "speed":42.0,  
90 - "direction":245.9,  
91 - "state":0,  
92 - "upDown":0  
93 - }]  
94 -}  
95 -```  
96 -  
97 -| -- | --|--|  
98 -| ---- | ---- | ---- |  
99 -| companyCode | int | 公司代码 |  
100 -| lineId | int | 线路编码 |  
101 -| deviceId | String | 设备编号 |  
102 -| carparkNo | String | 停车场编码 |  
103 -| stopNo | String | 站点编码 |  
104 -| lon | float | 经度 |  
105 -| lat | float | 纬度 |  
106 -| timestamp | long | 时间戳 |  
107 -| speed | float | 速度|  
108 -| direction | float | 方向(角度) |  
109 -| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |  
110 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|  
111 -  
112 -  
113 -### 进站数据  
114 -----------  
115 -表名:  
116 -  
117 -| .. | .. | .. |  
118 -| ---- | ---- | ---- |  
119 -| id | int | 主键 |  
120 -| deviceId | String | 设备号 |  
121 -| lineId | int | 线路编码 |  
122 -| stopNo | long | 站点编码 |  
123 -| timestamp | long | 时间戳 |  
124 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
125 -| createDate | Date | 创建时间 |  
126 -  
127 -  
128 -### 异常警报  
129 -----------  
130 -  
131 -### 大间隔  
132 -----------  
133 -表名:  
134 -  
135 -| .. | .. | .. |  
136 -| ---- | ---- | ---- |  
137 -| id | int | 主键 |  
138 -| line | int | 线路编码 |  
139 -| station | String | 站点编码 |  
140 -| cVehicle | String | 当前车辆编码 |  
141 -| lastVehicle | String | 上一个车辆编码 |  
142 -| interval | long | 间隔时间(秒) |  
143 -| timestamp | long | 时间戳 |  
144 -| createDate | Date | 创建时间 |  
145 -  
146 -### 超速  
147 -----------  
148 -表名:  
149 -  
150 -| .. | .. | .. |  
151 -| ---- | ---- | ---- |  
152 -| id | int | 主键 |  
153 -| vehicle | String | 车辆编码 |  
154 -| line | int | 线路编码 |  
155 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
156 -| lon | float | 经度 |  
157 -| lat | float | 纬度|  
158 -| speed | float | 速度 |  
159 -| timestamp | long | 时间戳 |  
160 -| createDate | Date | 时间 |  
161 -  
162 -### 越界  
163 -----------  
164 -表名:  
165 -  
166 -| .. | .. | .. |  
167 -| ---- | ---- | ---- |  
168 -| id | int | 主键 |  
169 -| vehicle | String | 车辆编码 |  
170 -| line | int | 线路编码 |  
171 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
172 -| lon | float | 经度 |  
173 -| lat | float | 纬度|  
174 -| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|  
175 -| timestamp | long | 时间戳 |  
176 -| createDate | Date | 时间 |  
177 -  
178 -  
179 -### 越站  
180 -----------  
181 -表名:  
182 -  
183 -| .. | .. | .. |  
184 -| ---- | ---- | ---- |  
185 -| id | int | 主键 |  
186 -| line | int | 线路编码 |  
187 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
188 -| station | String | 站点编码 |  
189 -| vehicle | String | 车辆编码 |  
190 -| inData | Date | 进站时间 |  
191 -| outDate | Date | 出站时间 |  
192 -  
193 -  
194 -### 聚集  
195 -----------  
196 -表名:  
197 -  
198 -| .. | .. | .. |  
199 -| ---- | ---- | ---- |  
200 -| id | int | 主键 |  
201 -| line | int | 线路编码 |  
202 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
203 -| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |  
204 -| vehicles | String | 车辆编码(多个用 , 号分隔) |  
205 -| timestamp | long | 时间戳 |  
206 -| createDate | Date | 时间 |  
207 -  
208 -  
209 -### 掉线  
210 -----------  
211 -表名:  
212 -  
213 -| .. | .. | .. |  
214 -| ---- | ---- | ---- |  
215 -| id | int | 主键 |  
216 -| line | int | 线路编码 |  
217 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
218 -| vehicle | String | 车辆编码 |  
219 -| lon | float | 经度 |  
220 -| lat | float | 纬度|  
221 -| timestamp | long | 时间戳 |  
222 -| createDate | Date | 时间 |  
223 -  
224 -  
225 -### 调度消息下发接口  
226 -----------  
227 -[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)  
228 -  
229 -<span style="color: red">Request</span>:  
230 -```json  
231 -{  
232 - "deviceId":12345,  
233 - "timestamp":44324,  
234 - "operCode":0x60,  
235 - "data":{  
236 - "companyCode":22,  
237 - "deviceId":"029L2222",  
238 - "timestamp":134326,  
239 - "instructType":00,  
240 - "dispatchInstruct":0x00,  
241 - "msgId":12345,  
242 - "alarmTime":201606012000,  
243 - "serviceState":00000000,  
244 - "txtContent":"你好"  
245 - }  
246 -}  
247 -```  
248 -| .. | .. | .. |  
249 -| ---- | ---- | ---- |  
250 -| deviceId | string | 设备编号 |  
251 -| timestamp | long | 时间戳(ms) |  
252 -| operCode | short | 一级协议 |  
253 -| data.companyCode | short | 公司代码 |  
254 -| data.deviceId | string | 设备编号 |  
255 -| data.timestamp | long | 时间戳 |  
256 -| data.instructType | short | 保留 默认0 |  
257 -| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|  
258 -| data.msgId | long | 同上 |  
259 -| data.alarmTime | long | 闹钟 MMddhhmm|  
260 -| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|  
261 -| data.txtContent | string | 下发的消息文本 |  
262 -```json  
263 -{  
264 - "deviceId":12345,  
265 - "timestamp":44324,  
266 - "operCode":0x64,  
267 - "data":{  
268 - "cityCode":22,  
269 - "deviceId":"029L2222",  
270 - "lineId":"134326"  
271 - }  
272 -}  
273 -```  
274 -| .. | .. | .. |  
275 -| ---- | ---- | ---- |  
276 -| deviceId | string | 设备编号 |  
277 -| timestamp | long | 时间戳(ms) |  
278 -| operCode | short | 一级协议 |  
279 -| data.cityCode | short | 城市区号 |  
280 -| data.deviceId | string | 设备编号 |  
281 -| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |  
282 -  
283 -```json  
284 -{  
285 - "deviceId":12345,  
286 - "timestamp":44324,  
287 - "operCode":0xC0,  
288 - "data":{  
289 - "operCode":0x86,  
290 - "requestAck":0x06  
291 - }  
292 -}  
293 -```  
294 -| .. | .. | .. |  
295 -| ---- | ---- | ---- |  
296 -| deviceId | string | 设备编号 |  
297 -| timestamp | long | 时间戳(ms) |  
298 -| operCode | short | 一级协议 |  
299 -| data.operCode | short | 二级协议 |  
300 -| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|  
301 -  
302 -<span style="color: red">Response</span>:  
303 -```json  
304 -{  
305 - "errCode":0  
306 -}  
307 -```  
308 -  
309 -  
310 -### 调度消息上传接口  
311 -----------  
312 -上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)  
313 -<span style="color: red">Request</span>:  
314 -```json  
315 -{  
316 - "deviceId":12345,  
317 - "timestamp":44324,  
318 - "status":0,  
319 - "operCode":0x80,  
320 - "data":{  
321 - "operCode":0x26,  
322 - "requestCode":22  
323 - }  
324 -}  
325 -```  
326 -| .. | .. | .. |  
327 -| ---- | ---- | ---- |  
328 -| deviceId | string | 设备编号 |  
329 -| timestamp | long | 时间戳(ms) |  
330 -| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |  
331 -| operCode | short | 一级协议 消息确认将无数据 |  
332 -| data.operCode | short | 二级协议 |  
333 -| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |  
334 -<span style="color: red">Response</span>:  
335 -```json  
336 -{  
337 - "errCode":0  
338 -}  
339 -``` 1 +公交调度系统BS版 0.1
  2 +======
  3 +----------
  4 +## 目录
  5 +---------
  6 + * [字典表](#字典表)
  7 + * [动态jpa查询实现](#动态jpa查询实现)
  8 + * [车载 gps 相关数据](#gps)
  9 + * [实时gps数据接口 http](#实时gps接口)
  10 + * [进出站数据表结构](#进站数据)
  11 + * [异常警报表结构](#异常警报)
  12 + * [大间隔](#大间隔)
  13 + * [超速](#超速)
  14 + * [越界](#越界)
  15 + * [越站](#越站)
  16 + * [聚集](#聚集)
  17 + * [掉线](#掉线)
  18 + * [调度消息下发接口HTTP](#调度消息下发接口)
  19 + * [调度消息上传接口HTTP](#调度消息上传接口)
  20 +
  21 +----------
  22 +
  23 +## 字典表
  24 +----------
  25 +字典操作全部由前端负责,主要有2种。
  26 +
  27 +1、转换字典代码。
  28 + 当pjax的`pjax:success`事件被触发(片段加载完成)
  29 + 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换
  30 +``` html
  31 +--dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码
  32 +<span class="nt-dictionary" data-group="ScheduleType">out</span>
  33 +--to
  34 +<span>出场</span>
  35 +
  36 +<!- dom标签为input时,如下 data-code为要转换的代码 -->
  37 +<input class="nt-dictionary" data-group="ScheduleType" data-code="out">
  38 +--to
  39 +<input value="出场">
  40 +
  41 +<!- dom标签为select时 如下 data-code为要选中的项 -->
  42 +<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>
  43 +--to
  44 +<select>
  45 + <option value="normal">正常班次</option>
  46 + <option value="out" selected>出场</option>
  47 + <option value="in">进场</option>
  48 + <option value="oil">加油</option>
  49 + <option value="temp">临加</option>
  50 + <option value="region">区间</option>
  51 + <option value="venting">放空</option>
  52 + <option value="major">放大站</option>
  53 +</select>
  54 +```
  55 +*原标签的class 除nt-dictionary 外,其余均会被保留*
  56 +
  57 +2、dictionary.js提供如下方法自行使用
  58 +| 方法名 | 参数|返回|
  59 +| ---- | ---- | ---- | ---- |
  60 +| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |
  61 +| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|
  62 +| transformCode (转换字典代码)| (group, code) | 上行 |
  63 +
  64 +## 动态jpa查询实现
  65 +----------
  66 +*参考调度系统枚举com.bsth.entity.search.SearchOperator*
  67 +
  68 +
  69 +## gps
  70 +----------
  71 +### 实时gps接口
  72 +
  73 +所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)
  74 +根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)
  75 +
  76 +<span style="color: red">Response</span>:
  77 +```json
  78 +{
  79 + "data":[
  80 + {
  81 + "companyCode":5,
  82 + "lineId":10329,
  83 + "deviceId":"05B01901",
  84 + "carparkNo":"00000000",
  85 + "stopNo":"7C890002",
  86 + "lon":121.549866,
  87 + "lat":31.238798,
  88 + "timestamp":1397104499000,
  89 + "speed":42.0,
  90 + "direction":245.9,
  91 + "state":0,
  92 + "upDown":0
  93 + }]
  94 +}
  95 +```
  96 +
  97 +| -- | --|--|
  98 +| ---- | ---- | ---- |
  99 +| companyCode | int | 公司代码 |
  100 +| lineId | int | 线路编码 |
  101 +| deviceId | String | 设备编号 |
  102 +| carparkNo | String | 停车场编码 |
  103 +| stopNo | String | 站点编码 |
  104 +| lon | float | 经度 |
  105 +| lat | float | 纬度 |
  106 +| timestamp | long | 时间戳 |
  107 +| speed | float | 速度|
  108 +| direction | float | 方向(角度) |
  109 +| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |
  110 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|
  111 +
  112 +
  113 +### 进站数据
  114 +----------
  115 +表名:
  116 +
  117 +| .. | .. | .. |
  118 +| ---- | ---- | ---- |
  119 +| id | int | 主键 |
  120 +| deviceId | String | 设备号 |
  121 +| lineId | int | 线路编码 |
  122 +| stopNo | long | 站点编码 |
  123 +| timestamp | long | 时间戳 |
  124 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  125 +| createDate | Date | 创建时间 |
  126 +
  127 +
  128 +### 异常警报
  129 +----------
  130 +
  131 +### 大间隔
  132 +----------
  133 +表名:
  134 +
  135 +| .. | .. | .. |
  136 +| ---- | ---- | ---- |
  137 +| id | int | 主键 |
  138 +| line | int | 线路编码 |
  139 +| station | String | 站点编码 |
  140 +| cVehicle | String | 当前车辆编码 |
  141 +| lastVehicle | String | 上一个车辆编码 |
  142 +| interval | long | 间隔时间(秒) |
  143 +| timestamp | long | 时间戳 |
  144 +| createDate | Date | 创建时间 |
  145 +
  146 +### 超速
  147 +----------
  148 +表名:
  149 +
  150 +| .. | .. | .. |
  151 +| ---- | ---- | ---- |
  152 +| id | int | 主键 |
  153 +| vehicle | String | 车辆编码 |
  154 +| line | int | 线路编码 |
  155 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  156 +| lon | float | 经度 |
  157 +| lat | float | 纬度|
  158 +| speed | float | 速度 |
  159 +| timestamp | long | 时间戳 |
  160 +| createDate | Date | 时间 |
  161 +
  162 +### 越界
  163 +----------
  164 +表名:
  165 +
  166 +| .. | .. | .. |
  167 +| ---- | ---- | ---- |
  168 +| id | int | 主键 |
  169 +| vehicle | String | 车辆编码 |
  170 +| line | int | 线路编码 |
  171 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  172 +| lon | float | 经度 |
  173 +| lat | float | 纬度|
  174 +| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|
  175 +| timestamp | long | 时间戳 |
  176 +| createDate | Date | 时间 |
  177 +
  178 +
  179 +### 越站
  180 +----------
  181 +表名:
  182 +
  183 +| .. | .. | .. |
  184 +| ---- | ---- | ---- |
  185 +| id | int | 主键 |
  186 +| line | int | 线路编码 |
  187 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  188 +| station | String | 站点编码 |
  189 +| vehicle | String | 车辆编码 |
  190 +| inData | Date | 进站时间 |
  191 +| outDate | Date | 出站时间 |
  192 +
  193 +
  194 +### 聚集
  195 +----------
  196 +表名:
  197 +
  198 +| .. | .. | .. |
  199 +| ---- | ---- | ---- |
  200 +| id | int | 主键 |
  201 +| line | int | 线路编码 |
  202 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  203 +| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |
  204 +| vehicles | String | 车辆编码(多个用 , 号分隔) |
  205 +| timestamp | long | 时间戳 |
  206 +| createDate | Date | 时间 |
  207 +
  208 +
  209 +### 掉线
  210 +----------
  211 +表名:
  212 +
  213 +| .. | .. | .. |
  214 +| ---- | ---- | ---- |
  215 +| id | int | 主键 |
  216 +| line | int | 线路编码 |
  217 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  218 +| vehicle | String | 车辆编码 |
  219 +| lon | float | 经度 |
  220 +| lat | float | 纬度|
  221 +| timestamp | long | 时间戳 |
  222 +| createDate | Date | 时间 |
  223 +
  224 +
  225 +### 调度消息下发接口
  226 +----------
  227 +[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)
  228 +
  229 +<span style="color: red">Request</span>:
  230 +```json
  231 +{
  232 + "deviceId":12345,
  233 + "timestamp":44324,
  234 + "operCode":0x60,
  235 + "data":{
  236 + "companyCode":22,
  237 + "deviceId":"029L2222",
  238 + "timestamp":134326,
  239 + "instructType":00,
  240 + "dispatchInstruct":0x00,
  241 + "msgId":12345,
  242 + "alarmTime":201606012000,
  243 + "serviceState":00000000,
  244 + "txtContent":"你好"
  245 + }
  246 +}
  247 +```
  248 +| .. | .. | .. |
  249 +| ---- | ---- | ---- |
  250 +| deviceId | string | 设备编号 |
  251 +| timestamp | long | 时间戳(ms) |
  252 +| operCode | short | 一级协议 |
  253 +| data.companyCode | short | 公司代码 |
  254 +| data.deviceId | string | 设备编号 |
  255 +| data.timestamp | long | 时间戳 |
  256 +| data.instructType | short | 保留 默认0 |
  257 +| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|
  258 +| data.msgId | long | 同上 |
  259 +| data.alarmTime | long | 闹钟 MMddhhmm|
  260 +| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|
  261 +| data.txtContent | string | 下发的消息文本 |
  262 +```json
  263 +{
  264 + "deviceId":12345,
  265 + "timestamp":44324,
  266 + "operCode":0x64,
  267 + "data":{
  268 + "cityCode":22,
  269 + "deviceId":"029L2222",
  270 + "lineId":"134326"
  271 + }
  272 +}
  273 +```
  274 +| .. | .. | .. |
  275 +| ---- | ---- | ---- |
  276 +| deviceId | string | 设备编号 |
  277 +| timestamp | long | 时间戳(ms) |
  278 +| operCode | short | 一级协议 |
  279 +| data.cityCode | short | 城市区号 |
  280 +| data.deviceId | string | 设备编号 |
  281 +| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |
  282 +
  283 +```json
  284 +{
  285 + "deviceId":12345,
  286 + "timestamp":44324,
  287 + "operCode":0xC0,
  288 + "data":{
  289 + "operCode":0x86,
  290 + "requestAck":0x06
  291 + }
  292 +}
  293 +```
  294 +| .. | .. | .. |
  295 +| ---- | ---- | ---- |
  296 +| deviceId | string | 设备编号 |
  297 +| timestamp | long | 时间戳(ms) |
  298 +| operCode | short | 一级协议 |
  299 +| data.operCode | short | 二级协议 |
  300 +| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|
  301 +
  302 +<span style="color: red">Response</span>:
  303 +```json
  304 +{
  305 + "errCode":0
  306 +}
  307 +```
  308 +
  309 +
  310 +### 调度消息上传接口
  311 +----------
  312 +上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)
  313 +<span style="color: red">Request</span>:
  314 +```json
  315 +{
  316 + "deviceId":12345,
  317 + "timestamp":44324,
  318 + "status":0,
  319 + "operCode":0x80,
  320 + "data":{
  321 + "operCode":0x26,
  322 + "requestCode":22
  323 + }
  324 +}
  325 +```
  326 +| .. | .. | .. |
  327 +| ---- | ---- | ---- |
  328 +| deviceId | string | 设备编号 |
  329 +| timestamp | long | 时间戳(ms) |
  330 +| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |
  331 +| operCode | short | 一级协议 消息确认将无数据 |
  332 +| data.operCode | short | 二级协议 |
  333 +| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |
  334 +<span style="color: red">Response</span>:
  335 +```json
  336 +{
  337 + "errCode":0
  338 +}
  339 +```
@@ -142,6 +142,18 @@ @@ -142,6 +142,18 @@
142 <artifactId>c3p0</artifactId> 142 <artifactId>c3p0</artifactId>
143 <version>0.9.1.2</version> 143 <version>0.9.1.2</version>
144 </dependency> 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 <!-- pentaho kettle 依赖 --> 158 <!-- pentaho kettle 依赖 -->
147 <dependency> 159 <dependency>
src/main/java/com/bsth/Application.java
@@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary; @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary;
16 @SpringBootApplication 16 @SpringBootApplication
17 public class Application extends SpringBootServletInitializer { 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 @Override 21 @Override
22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
src/main/java/com/bsth/ServiceStateTest.java
@@ -3,8 +3,8 @@ package com.bsth; @@ -3,8 +3,8 @@ package com.bsth;
3 public class ServiceStateTest { 3 public class ServiceStateTest {
4 4
5 public static void main(String[] args) { 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,37 +23,6 @@ public class StartCommand implements CommandLineRunner{
23 @Autowired 23 @Autowired
24 SecurityMetadataSourceService invocationSecurityMetadataSourceService; 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 @Override 26 @Override
58 public void run(String... arg0){ 27 public void run(String... arg0){
59 28
@@ -61,91 +30,6 @@ public class StartCommand implements CommandLineRunner{ @@ -61,91 +30,6 @@ public class StartCommand implements CommandLineRunner{
61 //启动时加载所有资源 30 //启动时加载所有资源
62 invocationSecurityMetadataSourceService.loadResourceDefine(); 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 } catch (Exception e) { 33 } catch (Exception e) {
150 e.printStackTrace(); 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,18 +2,21 @@ package com.bsth;
2 2
3 import javax.servlet.Filter; 3 import javax.servlet.Filter;
4 4
  5 +import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.boot.context.embedded.FilterRegistrationBean; 6 import org.springframework.boot.context.embedded.FilterRegistrationBean;
6 import org.springframework.context.annotation.Bean; 7 import org.springframework.context.annotation.Bean;
7 import org.springframework.context.annotation.ComponentScan; 8 import org.springframework.context.annotation.ComponentScan;
8 import org.springframework.context.annotation.Configuration; 9 import org.springframework.context.annotation.Configuration;
9 import org.springframework.web.filter.CharacterEncodingFilter; 10 import org.springframework.web.filter.CharacterEncodingFilter;
10 import org.springframework.web.filter.HttpPutFormContentFilter; 11 import org.springframework.web.filter.HttpPutFormContentFilter;
  12 +import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
11 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 13 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
12 import org.springframework.web.socket.config.annotation.EnableWebSocket; 14 import org.springframework.web.socket.config.annotation.EnableWebSocket;
13 import org.springframework.web.socket.config.annotation.WebSocketConfigurer; 15 import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
14 import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; 16 import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
15 17
16 import com.bsth.filter.ResourceFilter; 18 import com.bsth.filter.ResourceFilter;
  19 +import com.bsth.oplog.http.HttpOpLogInterceptor;
17 import com.bsth.websocket.WebSocketHandshakeInterceptor; 20 import com.bsth.websocket.WebSocketHandshakeInterceptor;
18 import com.bsth.websocket.handler.RealControlSocketHandler; 21 import com.bsth.websocket.handler.RealControlSocketHandler;
19 22
@@ -22,12 +25,12 @@ import com.bsth.websocket.handler.RealControlSocketHandler; @@ -22,12 +25,12 @@ import com.bsth.websocket.handler.RealControlSocketHandler;
22 @ComponentScan 25 @ComponentScan
23 public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{ 26 public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{
24 27
  28 + @Autowired
  29 + HttpOpLogInterceptor httpOpLogInterceptor;
  30 +
25 /** 31 /**
26 - *  
27 * @Title: httpPutFormContentFilter 32 * @Title: httpPutFormContentFilter
28 * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换) 33 * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换)
29 - * @return Filter 返回类型  
30 - * @throws  
31 */ 34 */
32 @Bean 35 @Bean
33 public Filter httpPutFormContentFilter() { 36 public Filter httpPutFormContentFilter() {
@@ -35,11 +38,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS @@ -35,11 +38,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
35 } 38 }
36 39
37 /** 40 /**
38 - *  
39 * @Title: characterEncodingFilter 41 * @Title: characterEncodingFilter
40 * @Description: TODO(编码过滤器) 42 * @Description: TODO(编码过滤器)
41 - * @return Filter 返回类型  
42 - * @throws  
43 */ 43 */
44 @Bean 44 @Bean
45 public Filter characterEncodingFilter(){ 45 public Filter characterEncodingFilter(){
@@ -50,8 +50,6 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS @@ -50,8 +50,6 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
50 * 50 *
51 * @Title: resourceFilterRegistration 51 * @Title: resourceFilterRegistration
52 * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 ) 52 * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 )
53 - * @return FilterRegistrationBean 返回类型  
54 - * @throws  
55 */ 53 */
56 @Bean 54 @Bean
57 public FilterRegistrationBean resourceFilterRegistration(){ 55 public FilterRegistrationBean resourceFilterRegistration(){
@@ -59,8 +57,18 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS @@ -59,8 +57,18 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
59 registration.setFilter(new ResourceFilter()); 57 registration.setFilter(new ResourceFilter());
60 registration.addUrlPatterns("/pages/*"); 58 registration.addUrlPatterns("/pages/*");
61 return registration; 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 @Override 72 @Override
65 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { 73 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
66 //线调webSocket 74 //线调webSocket
src/main/java/com/bsth/controller/BaseController.java
@@ -65,7 +65,7 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -65,7 +65,7 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
65 // 多个字段格式:{col1},{col2},{col3},....,{coln} 65 // 多个字段格式:{col1},{col2},{col3},....,{coln}
66 // 每个字段的排序方向都是一致,这个以后再看要不要改 66 // 每个字段的排序方向都是一致,这个以后再看要不要改
67 List<String> list = Splitter.on(",").trimResults().splitToList(order); 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 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 import com.bsth.entity.Personnel; 3 import com.bsth.entity.Personnel;
  4 +import com.bsth.service.PersonnelService;
4 import com.bsth.service.schedule.utils.DataToolsProperties; 5 import com.bsth.service.schedule.utils.DataToolsProperties;
5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 import org.springframework.boot.context.properties.EnableConfigurationProperties;
7 import org.springframework.web.bind.annotation.*; 8 import org.springframework.web.bind.annotation.*;
8 9
  10 +import java.util.List;
9 import java.util.Map; 11 import java.util.Map;
10 12
11 /** 13 /**
@@ -19,6 +21,8 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; { @@ -19,6 +21,8 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; {
19 @Autowired 21 @Autowired
20 private DataToolsProperties dataToolsProperties; 22 private DataToolsProperties dataToolsProperties;
21 23
  24 + @Autowired
  25 + private PersonnelService service;
22 /** 26 /**
23 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody 27 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
24 * @Title: save 28 * @Title: save
@@ -58,4 +62,9 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; { @@ -58,4 +62,9 @@ public class PersonnelController extends BaseController&lt;Personnel, Integer&gt; {
58 protected String getDataExportFilename() { 62 protected String getDataExportFilename() {
59 return "人员基础信息"; 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/StationRouteController.java
@@ -120,6 +120,15 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -120,6 +120,15 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
120 return stationRouteRepository.findStations(xlid, xldir); 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,13 +3,17 @@ package com.bsth.controller.directive;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
  6 +import org.apache.commons.lang3.StringEscapeUtils;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod; 9 import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestParam; 10 import org.springframework.web.bind.annotation.RequestParam;
10 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
11 12
  13 +import com.alibaba.fastjson.JSON;
  14 +import com.alibaba.fastjson.JSONObject;
12 import com.bsth.entity.directive.D80; 15 import com.bsth.entity.directive.D80;
  16 +import com.bsth.entity.directive.DC0_A3;
13 import com.bsth.entity.sys.SysUser; 17 import com.bsth.entity.sys.SysUser;
14 import com.bsth.security.util.SecurityUtils; 18 import com.bsth.security.util.SecurityUtils;
15 import com.bsth.service.directive.DirectiveService; 19 import com.bsth.service.directive.DirectiveService;
@@ -130,4 +134,28 @@ public class DirectiveController { @@ -130,4 +134,28 @@ public class DirectiveController {
130 134
131 return directiveService.findDirective(nbbm, dType, page, size); 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,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
13 import com.bsth.data.directive.DayOfDirectives; 13 import com.bsth.data.directive.DayOfDirectives;
14 import com.bsth.data.pilot80.PilotReport; 14 import com.bsth.data.pilot80.PilotReport;
15 import com.bsth.entity.directive.D80; 15 import com.bsth.entity.directive.D80;
  16 +import com.bsth.entity.directive.DC0_A4;
16 import com.bsth.entity.directive.DirectiveReponse; 17 import com.bsth.entity.directive.DirectiveReponse;
17 18
18 /** 19 /**
@@ -53,10 +54,25 @@ public class UpstreamEntrance { @@ -53,10 +54,25 @@ public class UpstreamEntrance {
53 // 80协议上报 54 // 80协议上报
54 else if (jsonParam.getInteger("operCode") == 0X80) { 55 else if (jsonParam.getInteger("operCode") == 0X80) {
55 try { 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 pilotReport.report(d80); 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 } catch (Exception e) { 76 } catch (Exception e) {
61 logger.error("", e); 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,6 +24,17 @@ public class GpsController {
24 24
25 @Autowired 25 @Autowired
26 GpsService gpsService; 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 @RequestMapping(value = "/real/line/{lineCode}") 39 @RequestMapping(value = "/real/line/{lineCode}")
29 public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { 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.Map;
  4 +
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +import com.bsth.data.BasicData;
  9 +
  10 +@RestController
  11 +@RequestMapping("/basic")
  12 +public class BasicDataController {
  13 +
  14 +
  15 + @RequestMapping("/cars")
  16 + public Iterable<String> findAllNbbm(Map<String, Object> map){
  17 + return BasicData.deviceId2NbbmMap.values();
  18 + }
  19 +
  20 + @RequestMapping("/lineCode2Name")
  21 + public Map<String, String> findLineCodeMap(){
  22 + return BasicData.lineCode2NameMap;
  23 + }
  24 +}
src/main/java/com/bsth/data/BasicData.java
@@ -20,6 +20,7 @@ import com.bsth.entity.Line; @@ -20,6 +20,7 @@ import com.bsth.entity.Line;
20 import com.bsth.entity.Station; 20 import com.bsth.entity.Station;
21 import com.bsth.entity.StationRoute; 21 import com.bsth.entity.StationRoute;
22 import com.bsth.entity.schedule.CarConfigInfo; 22 import com.bsth.entity.schedule.CarConfigInfo;
  23 +import com.bsth.oplog.normal.OpLogger;
23 import com.bsth.repository.CarParkRepository; 24 import com.bsth.repository.CarParkRepository;
24 import com.bsth.repository.CarsRepository; 25 import com.bsth.repository.CarsRepository;
25 import com.bsth.repository.LineRepository; 26 import com.bsth.repository.LineRepository;
@@ -100,6 +101,8 @@ public class BasicData implements CommandLineRunner{ @@ -100,6 +101,8 @@ public class BasicData implements CommandLineRunner{
100 @Autowired 101 @Autowired
101 StationRouteRepository stationRouteRepository; 102 StationRouteRepository stationRouteRepository;
102 103
  104 + @Autowired
  105 + OpLogger opLog;
103 106
104 @Override 107 @Override
105 public void run() { 108 public void run() {
@@ -119,6 +122,8 @@ public class BasicData implements CommandLineRunner{ @@ -119,6 +122,8 @@ public class BasicData implements CommandLineRunner{
119 122
120 loadStationRouteInfo(); 123 loadStationRouteInfo();
121 logger.info("加载基础数据成功!," ); 124 logger.info("加载基础数据成功!," );
  125 +
  126 + opLog.info("load_basic");
122 }catch(Exception e){ 127 }catch(Exception e){
123 logger.error("加载基础数据时出现异常," , e); 128 logger.error("加载基础数据时出现异常," , e);
124 } 129 }
src/main/java/com/bsth/data/LineConfigData.java
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
15 import com.bsth.entity.Line; 15 import com.bsth.entity.Line;
16 import com.bsth.entity.realcontrol.D80ReplyTemp; 16 import com.bsth.entity.realcontrol.D80ReplyTemp;
17 import com.bsth.entity.realcontrol.LineConfig; 17 import com.bsth.entity.realcontrol.LineConfig;
  18 +import com.bsth.oplog.normal.OpLogger;
18 import com.bsth.service.LineService; 19 import com.bsth.service.LineService;
19 import com.bsth.service.realcontrol.LineConfigService; 20 import com.bsth.service.realcontrol.LineConfigService;
20 21
@@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner { @@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner {
39 40
40 @Autowired 41 @Autowired
41 LineService lineService; 42 LineService lineService;
  43 +
  44 + @Autowired
  45 + OpLogger opLog;
42 46
43 @Override 47 @Override
44 public void run(String... arg0) throws Exception { 48 public void run(String... arg0) throws Exception {
@@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner { @@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner {
47 Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); 51 Iterator<LineConfig> itr = lineConfigService.findAll().iterator();
48 while (itr.hasNext()) 52 while (itr.hasNext())
49 setBuffer(itr.next()); 53 setBuffer(itr.next());
  54 +
  55 + opLog.info("Line_config_data");
50 } 56 }
51 57
52 public LineConfig get(String lineCode){ 58 public LineConfig get(String lineCode){
src/main/java/com/bsth/data/directive/DayOfDirectives.java
@@ -38,6 +38,9 @@ public class DayOfDirectives { @@ -38,6 +38,9 @@ public class DayOfDirectives {
38 38
39 // 线路切换指令 64 39 // 线路切换指令 64
40 public static Map<String, D64> d64Map; 40 public static Map<String, D64> d64Map;
  41 +
  42 + //等待C0_A4回复的用户
  43 + //public static Map<K, V>
41 44
42 @Autowired 45 @Autowired
43 DirectiveService directiveService; 46 DirectiveService directiveService;
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -63,6 +63,9 @@ public class GpsEntity { @@ -63,6 +63,9 @@ public class GpsEntity {
63 63
64 /** 当前执行班次ID */ 64 /** 当前执行班次ID */
65 private Long schId; 65 private Long schId;
  66 +
  67 + /** 是否异常数据 */
  68 + private boolean abnormal;
66 69
67 public Integer getCompanyCode() { 70 public Integer getCompanyCode() {
68 return companyCode; 71 return companyCode;
@@ -207,4 +210,12 @@ public class GpsEntity { @@ -207,4 +210,12 @@ public class GpsEntity {
207 public void setSchId(Long schId) { 210 public void setSchId(Long schId) {
208 this.schId = schId; 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,6 +3,7 @@ package com.bsth.data.gpsdata;
3 import java.io.BufferedReader; 3 import java.io.BufferedReader;
4 import java.io.InputStreamReader; 4 import java.io.InputStreamReader;
5 import java.util.ArrayList; 5 import java.util.ArrayList;
  6 +import java.util.Collection;
6 import java.util.HashMap; 7 import java.util.HashMap;
7 import java.util.List; 8 import java.util.List;
8 import java.util.Map; 9 import java.util.Map;
@@ -71,7 +72,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -71,7 +72,7 @@ public class GpsRealData implements CommandLineRunner{
71 72
72 @Override 73 @Override
73 public void run(String... arg0) throws Exception { 74 public void run(String... arg0) throws Exception {
74 - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS); 75 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 18, TimeUnit.SECONDS);
75 } 76 }
76 77
77 public GpsEntity add(GpsEntity gps) { 78 public GpsEntity add(GpsEntity gps) {
@@ -115,6 +116,10 @@ public class GpsRealData implements CommandLineRunner{ @@ -115,6 +116,10 @@ public class GpsRealData implements CommandLineRunner{
115 ScheduleRealInfo sch; 116 ScheduleRealInfo sch;
116 for(String device : set){ 117 for(String device : set){
117 gps = gpsMap.get(device); 118 gps = gpsMap.get(device);
  119 + //过滤异常GPS数据
  120 + if(gps.isAbnormal())
  121 + continue;
  122 +
118 sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); 123 sch = dayOfSchedule.execPlamMap().get(gps.getNbbm());
119 if(null != sch) 124 if(null != sch)
120 gps.setSchId(sch.getId()); 125 gps.setSchId(sch.getId());
@@ -136,6 +141,10 @@ public class GpsRealData implements CommandLineRunner{ @@ -136,6 +141,10 @@ public class GpsRealData implements CommandLineRunner{
136 return gpsMap.get(deviceId); 141 return gpsMap.get(deviceId);
137 } 142 }
138 143
  144 + public Collection<GpsEntity> all(){
  145 + return gpsMap.values();
  146 + }
  147 +
139 @Component 148 @Component
140 public static class GpsDataLoader extends Thread{ 149 public static class GpsDataLoader extends Thread{
141 150
@@ -182,15 +191,19 @@ public class GpsRealData implements CommandLineRunner{ @@ -182,15 +191,19 @@ public class GpsRealData implements CommandLineRunner{
182 for(GpsEntity gps : list){ 191 for(GpsEntity gps : list){
183 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); 192 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
184 if(StringUtils.isBlank(nbbm)) 193 if(StringUtils.isBlank(nbbm))
185 - continue; 194 + gps.setAbnormal(true);//标记为异常数据
  195 + else
  196 + gps.setNbbm(nbbm);
186 197
187 - gps.setNbbm(nbbm);  
188 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); 198 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
189 gpsRealData.add(gps); 199 gpsRealData.add(gps);
190 } 200 }
191 } else 201 } else
192 logger.error("result is null"); 202 logger.error("result is null");
193 - } finally { 203 + } catch(Exception e){
  204 + logger.error("", e);
  205 + }
  206 + finally {
194 if (null != httpClient) 207 if (null != httpClient)
195 httpClient.close(); 208 httpClient.close();
196 if(null != response) 209 if(null != response)
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java
@@ -47,7 +47,9 @@ public class ScheduleLateThread extends Thread{ @@ -47,7 +47,9 @@ public class ScheduleLateThread extends Thread{
47 if(sch.getDfsjT() > t) 47 if(sch.getDfsjT() > t)
48 break; 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 sch.setLate(true); 54 sch.setLate(true);
53 //通知客户端 55 //通知客户端
src/main/java/com/bsth/entity/directive/D64.java
@@ -40,6 +40,8 @@ public class D64 extends Directive{ @@ -40,6 +40,8 @@ public class D64 extends Directive{
40 private String deviceId; 40 private String deviceId;
41 41
42 private String lineId; 42 private String lineId;
  43 +
  44 + private String txtContent;
43 45
44 public Short getCityCode() { 46 public Short getCityCode() {
45 return cityCode; 47 return cityCode;
@@ -64,6 +66,14 @@ public class D64 extends Directive{ @@ -64,6 +66,14 @@ public class D64 extends Directive{
64 public void setLineId(String lineId) { 66 public void setLineId(String lineId) {
65 this.lineId = lineId; 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 public Integer getId() { 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/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 +
  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/PersonnelRepository.java
1 package com.bsth.repository; 1 package com.bsth.repository;
2 2
3 import com.bsth.entity.Personnel; 3 import com.bsth.entity.Personnel;
  4 +
  5 +import java.util.List;
  6 +
  7 +import org.springframework.data.jpa.repository.Query;
4 import org.springframework.stereotype.Repository; 8 import org.springframework.stereotype.Repository;
5 9
6 /** 10 /**
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -250,4 +250,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -250,4 +250,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
250 250
251 @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") 251 @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode")
252 List<StationRoute> findByLine(String lineCode, int updown); 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
@@ -74,4 +74,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -74,4 +74,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
74 74
75 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 75 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
76 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 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);
77 } 80 }
src/main/java/com/bsth/security/SecurityMetadataSourceService.java
@@ -66,8 +66,6 @@ public class SecurityMetadataSourceService implements @@ -66,8 +66,6 @@ public class SecurityMetadataSourceService implements
66 String method = invocation.getRequest().getMethod(); 66 String method = invocation.getRequest().getMethod();
67 String url = method.toLowerCase() + "#" + invocation.getRequestUrl(); 67 String url = method.toLowerCase() + "#" + invocation.getRequestUrl();
68 68
69 - System.out.println(url);  
70 -  
71 int symIndex = url.indexOf("?"); 69 int symIndex = url.indexOf("?");
72 if(symIndex != -1){ 70 if(symIndex != -1){
73 url = url.substring(0, symIndex); 71 url = url.substring(0, symIndex);
src/main/java/com/bsth/service/PersonnelService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
3 import com.bsth.entity.Personnel; 6 import com.bsth.entity.Personnel;
4 7
5 /** 8 /**
6 * Created by xu on 16/6/15. 9 * Created by xu on 16/6/15.
7 */ 10 */
8 public interface PersonnelService extends BaseService<Personnel, Integer> { 11 public interface PersonnelService extends BaseService<Personnel, Integer> {
  12 + List<Map<String, String>> sreachPersonnel(String jobCode);
9 } 13 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -78,4 +78,6 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -78,4 +78,6 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
78 * @return List<Map<String, Object>> 78 * @return List<Map<String, Object>>
79 */ 79 */
80 List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map); 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/directive/DirectiveService.java
@@ -7,6 +7,7 @@ import java.util.Map; @@ -7,6 +7,7 @@ import java.util.Map;
7 import com.bsth.entity.directive.D60; 7 import com.bsth.entity.directive.D60;
8 import com.bsth.entity.directive.D64; 8 import com.bsth.entity.directive.D64;
9 import com.bsth.entity.directive.D80; 9 import com.bsth.entity.directive.D80;
  10 +import com.bsth.entity.directive.DC0_A3;
10 import com.bsth.entity.realcontrol.ScheduleRealInfo; 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 import com.bsth.service.BaseService; 12 import com.bsth.service.BaseService;
12 13
@@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{ @@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{
82 Map<String, Object> findAll80(Map<String, Object> map, int page, int size); 83 Map<String, Object> findAll80(Map<String, Object> map, int page, int size);
83 84
84 D64 save64(D64 d64); 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,6 +30,7 @@ import com.bsth.data.schedule.DayOfSchedule;
30 import com.bsth.entity.directive.D60; 30 import com.bsth.entity.directive.D60;
31 import com.bsth.entity.directive.D64; 31 import com.bsth.entity.directive.D64;
32 import com.bsth.entity.directive.D80; 32 import com.bsth.entity.directive.D80;
  33 +import com.bsth.entity.directive.DC0_A3;
33 import com.bsth.entity.directive.Directive; 34 import com.bsth.entity.directive.Directive;
34 import com.bsth.entity.realcontrol.ScheduleRealInfo; 35 import com.bsth.entity.realcontrol.ScheduleRealInfo;
35 import com.bsth.entity.sys.SysUser; 36 import com.bsth.entity.sys.SysUser;
@@ -235,13 +236,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -235,13 +236,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
235 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64)); 236 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64));
236 // 入库 237 // 入库
237 d64.setHttpCode(code); 238 d64.setHttpCode(code);
  239 + d64.getData().setTxtContent("切换线路[" + lineCode + "]");
238 dayOfDirectives.put64(d64); 240 dayOfDirectives.put64(d64);
239 241
240 // 通知设备刷新线路文件,忽略结果 242 // 通知设备刷新线路文件,忽略结果
241 if (code == 0) 243 if (code == 0)
242 GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode)); 244 GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
243 else 245 else
244 - d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code); 246 + d64.setErrorText(" 网关通讯失败, code: " + code);
245 247
246 d64Repository.save(d64); 248 d64Repository.save(d64);
247 return code; 249 return code;
@@ -408,7 +410,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -408,7 +410,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
408 } 410 }
409 411
410 rsMap.put("list", rs); 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 rsMap.put("page", page); 414 rsMap.put("page", page);
413 return rsMap; 415 return rsMap;
414 } 416 }
@@ -469,4 +471,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -469,4 +471,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
469 public D64 save64(D64 d64) { 471 public D64 save64(D64 d64) {
470 return d64Repository.save(d64); 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 +}
src/main/java/com/bsth/service/excep/impl/AbnormalServiceImpl.java 0 → 100644
  1 +package com.bsth.service.excep.impl;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.util.ArrayList;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import com.bsth.entity.excep.Abnormal;
  14 +import com.bsth.service.excep.AbnormalService;
  15 +import com.bsth.util.PageHelper;
  16 +import com.bsth.util.PageObject;
  17 +import com.bsth.util.db.DBUtils_MS;
  18 +
  19 +@Service
  20 +public class AbnormalServiceImpl implements AbnormalService {
  21 +
  22 +
  23 + static List<Abnormal> findAll(Map<String, Object> map) {
  24 + // TODO Auto-generated method stub
  25 +
  26 + //查询条件
  27 +
  28 + Connection conn = null;
  29 + PreparedStatement ps = null;
  30 + ResultSet rs = null;
  31 + int page=Integer.parseInt(map.get("page").toString());
  32 + List<Abnormal> list=new ArrayList<Abnormal>();
  33 + /*
  34 + String sql="SELECT * FROM (SELECT A.*,ROWNUM R FROM ( "
  35 + + "select * from bsth_c_offline) A "
  36 + + "WHERE ROWNUM <= ? ) B WHERE R >?";*/
  37 + String sql="select * from bsth_c_device_abnormal where 1=1 ";
  38 + Object nbbm=map.get("nbbm");
  39 +
  40 + if(nbbm!=null){
  41 + if(nbbm.toString()!="")
  42 + sql +=" and vehicle like '%"+nbbm+"%'";
  43 + }
  44 +
  45 + sql +=" order by id limit ?,?";
  46 +
  47 + try {
  48 + conn = DBUtils_MS.getConnection();
  49 + ps = conn.prepareStatement(sql);
  50 + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
  51 + ps.setInt(2, 10); // O-最小条数 -- M-显示条数
  52 + rs = ps.executeQuery();
  53 + list = resultSet2Set(rs);
  54 + } catch (SQLException e) {
  55 + // TODO Auto-generated catch block
  56 + e.printStackTrace();
  57 + }finally {
  58 + DBUtils_MS.close(rs, ps, conn);
  59 + }
  60 +
  61 + return list;
  62 + }
  63 +
  64 + /**
  65 + * 数据转换
  66 + */
  67 +// @Override
  68 + static List<Abnormal> resultSet2Set(ResultSet rs) throws SQLException{
  69 + // TODO Auto-generated method stub
  70 + List<Abnormal> list=new ArrayList<Abnormal>();
  71 + Abnormal abnormal;
  72 + while(rs.next()){
  73 + abnormal=new Abnormal();
  74 + abnormal.setId(Integer.valueOf(rs.getObject("id").toString()));
  75 + abnormal.setDrift(Integer.valueOf(rs.getObject("drift").toString()));
  76 + abnormal.setOffline(Integer.valueOf(rs.getObject("offline").toString()));
  77 + abnormal.setProtocol(Integer.valueOf(rs.getObject("protocol").toString()));
  78 + abnormal.setVehicle(rs.getObject("vehicle").toString());
  79 + list.add(abnormal);
  80 + }
  81 + return list;
  82 + }
  83 +
  84 + @Override
  85 + public PageObject<Abnormal> Pagequery(Map<String, Object> map) {
  86 + // TODO Auto-generated method stub
  87 + String sql="select count(*) record from bsth_c_device_abnormal where 1=1 ";
  88 + Object nbbm=map.get("nbbm");
  89 + if(nbbm!=null){
  90 + if(nbbm.toString()!="")
  91 + sql +=" and vehicle like '%"+nbbm+"%'";
  92 + }
  93 + Connection conn = null;
  94 + PreparedStatement ps = null;
  95 + ResultSet rs = null;
  96 + int totalData = 0;
  97 + try {
  98 + conn = DBUtils_MS.getConnection();
  99 + ps = conn.prepareStatement(sql);
  100 + rs = ps.executeQuery();
  101 + if(rs.next()){
  102 + totalData=rs.getInt("record");
  103 + }
  104 + } catch (SQLException e) {
  105 + // TODO Auto-generated catch block
  106 + e.printStackTrace();
  107 + }finally {
  108 + DBUtils_MS.close(rs, ps, conn);
  109 + }
  110 + PageHelper pageHelper = new PageHelper(totalData, map);
  111 +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap());
  112 + List<Abnormal> list=findAll(pageHelper.getMap());
  113 + PageObject<Abnormal> pageObject = pageHelper.getPageObject();
  114 + pageObject.setDataList(list);
  115 + return pageObject;
  116 + }
  117 +
  118 +}
src/main/java/com/bsth/service/excep/impl/OfflineServiceImpl.java 0 → 100644
  1 +package com.bsth.service.excep.impl;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.text.ParseException;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.ArrayList;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import com.bsth.data.BasicData;
  18 +import com.bsth.entity.excep.Offline;
  19 +import com.bsth.service.excep.OfflineService;
  20 +import com.bsth.util.EchartConver;
  21 +import com.bsth.util.PageHelper;
  22 +import com.bsth.util.PageObject;
  23 +import com.bsth.util.db.DBUtils_MS;
  24 +import com.github.abel533.echarts.Option;
  25 +import com.google.gson.Gson;
  26 +
  27 +@Service
  28 +public class OfflineServiceImpl implements OfflineService {
  29 +
  30 + // @Override
  31 + static List<Offline> findAll(Map<String, Object> map) {
  32 + // TODO Auto-generated method stub
  33 +
  34 + //查询条件
  35 +
  36 + Connection conn = null;
  37 + PreparedStatement ps = null;
  38 + ResultSet rs = null;
  39 + int page=Integer.parseInt(map.get("page").toString());
  40 + List<Offline> list=new ArrayList<Offline>();
  41 + /*
  42 + String sql="SELECT * FROM (SELECT A.*,ROWNUM R FROM ( "
  43 + + "select * from bsth_c_offline) A "
  44 + + "WHERE ROWNUM <= ? ) B WHERE R >?";*/
  45 + String sql="select * from bsth_c_offline where 1=1 ";
  46 + Object line=map.get("line");
  47 + Object nbbm=map.get("nbbm");
  48 + Object updown=map.get("updown");
  49 +
  50 +
  51 + if(line!=null){
  52 + if(line.toString()!="")
  53 + sql +=" and line="+line;
  54 + }
  55 +
  56 + if(nbbm!=null){
  57 + if(nbbm.toString()!="")
  58 + sql +=" and vehicle like '%"+nbbm+"%'";
  59 + }
  60 +
  61 + if(updown!=null){
  62 + if(updown.toString() !="")
  63 + sql +="and up_down ="+updown;
  64 + }
  65 +
  66 + sql +=" order by id limit ?,?";
  67 +
  68 + try {
  69 + conn = DBUtils_MS.getConnection();
  70 + ps = conn.prepareStatement(sql);
  71 + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
  72 + ps.setInt(2, 10); // O-最小条数 -- M-显示条数
  73 + rs = ps.executeQuery();
  74 + list = resultSet2Set(rs);
  75 + } catch (SQLException e) {
  76 + // TODO Auto-generated catch block
  77 + e.printStackTrace();
  78 + }finally {
  79 + DBUtils_MS.close(rs, ps, conn);
  80 + }
  81 +
  82 + return list;
  83 + }
  84 +
  85 + /**
  86 + * 数据转换
  87 + */
  88 +// @Override
  89 + static List<Offline> resultSet2Set(ResultSet rs) throws SQLException{
  90 + // TODO Auto-generated method stub
  91 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  92 + List<Offline> list=new ArrayList<Offline>();
  93 + Offline offline;
  94 + while(rs.next()){
  95 + offline=new Offline();
  96 + offline.setId(Integer.valueOf(rs.getObject("id").toString()));
  97 + offline.setLat(Float.valueOf(rs.getObject("lat").toString()));
  98 + offline.setLine(Integer.valueOf(rs.getObject("line").toString()));
  99 + //run 时注解
  100 + offline.setLineName(BasicData.lineCode2NameMap.get(offline.getLine().toString()));
  101 + offline.setLon(Float.valueOf(rs.getObject("lon").toString()));
  102 + offline.setTimestamp(Long.valueOf(rs.getObject("timestamp").toString()));
  103 + offline.setTimestampDate(sdf.format(new Date(offline.getTimestamp())));
  104 + offline.setUpDown(Integer.valueOf(rs.getObject("up_down").toString()));
  105 + offline.setVehicle(rs.getObject("vehicle").toString());
  106 + list.add(offline);
  107 + }
  108 + return list;
  109 + }
  110 +
  111 +
  112 + @SuppressWarnings("unchecked")
  113 + public PageObject <Offline> Pagequery(Map<String, Object> map) {
  114 + // TODO Auto-generated method stub
  115 + String sql="select count(*) record from bsth_c_offline where 1=1 ";
  116 +
  117 + Object line=map.get("line");
  118 + Object nbbm=map.get("nbbm");
  119 + Object updown=map.get("updown");
  120 +
  121 + if(line!=null){
  122 + if(line.toString()!="")
  123 + sql +=" and line="+line;
  124 + }
  125 +
  126 + if(nbbm!=null){
  127 + if(nbbm.toString()!="")
  128 + sql +=" and vehicle like '%"+nbbm+"%'";
  129 + }
  130 +
  131 + if(updown!=null){
  132 + if(updown.toString() !="")
  133 + sql +="and up_down ="+updown;
  134 + }
  135 +
  136 + Connection conn = null;
  137 + PreparedStatement ps = null;
  138 + ResultSet rs = null;
  139 + int totalData = 0;
  140 +
  141 + try {
  142 + conn = DBUtils_MS.getConnection();
  143 + ps = conn.prepareStatement(sql);
  144 + rs = ps.executeQuery();
  145 + if(rs.next()){
  146 + totalData=rs.getInt("record");
  147 + }
  148 + } catch (SQLException e) {
  149 + // TODO Auto-generated catch block
  150 + e.printStackTrace();
  151 + }finally {
  152 + DBUtils_MS.close(rs, ps, conn);
  153 + }
  154 + PageHelper pageHelper = new PageHelper(totalData, map);
  155 +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap());
  156 + List<Offline> list=findAll(pageHelper.getMap());
  157 + PageObject<Offline> pageObject = pageHelper.getPageObject();
  158 + pageObject.setDataList(list);
  159 + return pageObject;
  160 + }
  161 + public static void main(String[] args) {
  162 + // TODO Auto-generated method stub
  163 + Map<String, Object> map=new HashMap<String,Object>();
  164 + map.put("pageData","20");
  165 + map.put("curPage", "1");
  166 + String sql="select count(*) record from bsth_c_offline";
  167 + Connection conn = null;
  168 + PreparedStatement ps = null;
  169 + ResultSet rs = null;
  170 + int totalData = 0;
  171 +
  172 + try {
  173 + conn = DBUtils_MS.getConnection();
  174 + ps = conn.prepareStatement(sql);
  175 + rs = ps.executeQuery();
  176 + if(rs.next()){
  177 + totalData=rs.getInt("record");
  178 + }
  179 + } catch (SQLException e) {
  180 + // TODO Auto-generated catch block
  181 + e.printStackTrace();
  182 + }finally {
  183 + DBUtils_MS.close(rs, ps, conn);
  184 + }
  185 + PageHelper pageHelper = new PageHelper(totalData, map);
  186 +// List<T> list = this.baseDao.queryByObject(pageHelper.getMap());
  187 + List<Offline> list=findAll(pageHelper.getMap());
  188 + PageObject<Offline> pageObject = pageHelper.getPageObject();
  189 + pageObject.setDataList(list);
  190 + System.out.println("");
  191 + }
  192 +
  193 + @Override
  194 + public Map<String, Object> getReport(Map<String, Object> map) {
  195 + // TODO Auto-generated method stub
  196 + String chartStr = "";
  197 + Map<String, Object> mapValue = new HashMap<String, Object>();
  198 + try {
  199 + String xAxisName = map.get("xAxisName").toString();
  200 + String legendName = map.get("legendName").toString();
  201 + String xAxisItem = "";
  202 + String xAxisOrderBy = "";
  203 + String legendItem = "";
  204 + String legendOrderBy = "";
  205 + if(xAxisName!=null){
  206 + String [] xaxis = xAxisName.split(":");
  207 + if(xaxis.length>1 && xaxis[1].toLowerCase().contains("date")){
  208 + //本来还要判断下日期格式是否标准
  209 + xAxisItem = "to_char("+xaxis[0]+",'"+xaxis[2]+"') ";
  210 + xAxisOrderBy = (xaxis.length>3?xaxis[3]:"");
  211 + }else{
  212 + xAxisItem = xaxis[0];
  213 + }
  214 + }
  215 + if(legendName!=null){
  216 + String [] legend = legendName.split(":");
  217 + if(legend.length>1 && legend[1].toLowerCase().contains("date")){
  218 + //本来还要判断下日期格式是否标准
  219 + legendItem = "to_char("+legend[0]+",'"+legend[2]+"') ";
  220 + legendOrderBy = (legend[3].length()>3?legend[3]:"");
  221 + }else{
  222 + legendItem = legend[0];
  223 + }
  224 + }
  225 + map.put("xAxisItem", xAxisItem);
  226 + map.put("xAxisOrderBy", xAxisOrderBy);
  227 + map.put("legendItem", legendItem);
  228 + map.put("legendOrderBy", legendOrderBy);
  229 + List dataList = new ArrayList();
  230 + dataList =getReportList(map);
  231 + EchartConver echart = new EchartConver(map);
  232 + Option option = echart.getOption(dataList);
  233 + Gson gson = new Gson();
  234 + chartStr = gson.toJsonTree(option).toString();
  235 + mapValue.put("dataList", dataList);
  236 + mapValue.put("option", chartStr);
  237 + } catch (Exception e) {
  238 + e.printStackTrace();
  239 + }
  240 + return mapValue;
  241 + }
  242 +
  243 + static List getReportList(Map<String, Object> map) {
  244 + List dataList = new ArrayList();
  245 + String times="";
  246 + Object dataTime=map.get("dataTime");
  247 + Object line=map.get("line");
  248 + String addSql="";
  249 + if(line !=null){
  250 + if(line.toString()!=""){
  251 + addSql =" and line =" +line;
  252 + }
  253 + }
  254 + if(dataTime!=null){
  255 + times=dataTime.toString();
  256 + }
  257 + if(times.equals("")){
  258 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  259 + times=sdf.format(new Date());
  260 + }
  261 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  262 + String times1=times+" 00:00:01";
  263 + String times2=times+" 23:59:59";
  264 +
  265 + Connection conn = null;
  266 + PreparedStatement ps = null;
  267 + ResultSet rs = null;
  268 + try {
  269 + Long t1=simpleDateFormat.parse(times1).getTime();
  270 + Long t2=simpleDateFormat.parse(times2).getTime();
  271 + String sql="SELECT up_down xAxis , line legend,count(*) series"+
  272 + " FROM bsth_c_offline "+
  273 + "where timestamp>? and timestamp<? "+addSql+" group by xAxis ,legend";
  274 + conn = DBUtils_MS.getConnection();
  275 + ps = conn.prepareStatement(sql);
  276 + ps.setLong(1, t1);
  277 + ps.setLong(2, t2);
  278 + rs = ps.executeQuery();
  279 + while(rs.next()){
  280 + Map<String, Object> newMap=new HashMap<String,Object>();
  281 + if(rs.getObject("xAxis").toString().equals("0"))
  282 + newMap.put("xAxis", "上行");
  283 + else if(rs.getObject("xAxis").toString().equals("1"))
  284 + newMap.put("xAxis", "下行");
  285 + else
  286 + newMap.put("xAxis", "无效");
  287 +
  288 + if(BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!=null && BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!="" )
  289 + newMap.put("legend", BasicData.lineCode2NameMap.get(rs.getObject("legend").toString()));
  290 + else
  291 + newMap.put("legend", "编码"+rs.getObject("legend").toString());
  292 +
  293 +
  294 +
  295 + newMap.put("series", Integer.parseInt(rs.getObject("series").toString()));
  296 + dataList.add(newMap);
  297 + }
  298 +
  299 + } catch (SQLException e) {
  300 + // TODO Auto-generated catch block
  301 + e.printStackTrace();
  302 + }catch (ParseException e1) {
  303 + // TODO Auto-generated catch block
  304 + e1.printStackTrace();
  305 + }finally {
  306 + DBUtils_MS.close(rs, ps, conn);
  307 + }
  308 +
  309 + return dataList;
  310 + }
  311 +
  312 +}
src/main/java/com/bsth/service/excep/impl/OutboundServiceImpl.java 0 → 100644
  1 +package com.bsth.service.excep.impl;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.text.ParseException;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.ArrayList;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import com.bsth.data.BasicData;
  18 +import com.bsth.entity.excep.Outbound;
  19 +import com.bsth.service.excep.OutboundService;
  20 +import com.bsth.util.EchartConver;
  21 +import com.bsth.util.PageHelper;
  22 +import com.bsth.util.PageObject;
  23 +import com.bsth.util.db.DBUtils_MS;
  24 +import com.github.abel533.echarts.Option;
  25 +import com.google.gson.Gson;
  26 +@Service
  27 +public class OutboundServiceImpl implements OutboundService{
  28 +
  29 + static List<Outbound> findAll(Map<String, Object> map) {
  30 + Connection conn = null;
  31 + PreparedStatement ps = null;
  32 + ResultSet rs = null;
  33 + int page=Integer.parseInt(map.get("page").toString());
  34 + List<Outbound> list=new ArrayList<Outbound>();
  35 + String sql="select * from bsth_c_outbound where 1=1 ";
  36 + Object line=map.get("line");
  37 + Object nbbm=map.get("nbbm");
  38 + Object updown=map.get("updown");
  39 +
  40 +
  41 + if(line!=null){
  42 + if(line.toString()!="")
  43 + sql +=" and line="+line;
  44 + }
  45 +
  46 + if(nbbm!=null){
  47 + if(nbbm.toString()!="")
  48 + sql +=" and vehicle like '%"+nbbm+"%'";
  49 + }
  50 +
  51 + if(updown!=null){
  52 + if(updown.toString() !="")
  53 + sql +="and up_down ="+updown;
  54 + }
  55 +
  56 + sql +=" order by id limit ?,?";
  57 +
  58 +
  59 + try {
  60 + conn = DBUtils_MS.getConnection();
  61 + ps = conn.prepareStatement(sql);
  62 + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
  63 + ps.setInt(2, 10); // O-最小条数 -- M-显示条数
  64 + rs = ps.executeQuery();
  65 + list = resultSet2Set(rs);
  66 + } catch (SQLException e) {
  67 + // TODO Auto-generated catch block
  68 + e.printStackTrace();
  69 + }finally {
  70 + DBUtils_MS.close(rs, ps, conn);
  71 + }
  72 +
  73 + return list;
  74 + }
  75 +
  76 + static List<Outbound> resultSet2Set(ResultSet rs) throws SQLException{
  77 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  78 + List<Outbound> list=new ArrayList<Outbound>();
  79 + Outbound outbound;
  80 + while(rs.next()){
  81 + outbound=new Outbound();
  82 + outbound.setId(Integer.valueOf(rs.getObject("id").toString()));
  83 + outbound.setLat(Float.valueOf(rs.getObject("lat").toString()));
  84 + outbound.setLine(Integer.valueOf(rs.getObject("line").toString()));
  85 + //run 时注解
  86 + outbound.setLineName(BasicData.lineCode2NameMap.get(outbound.getLine().toString()));
  87 + outbound.setLon(Float.valueOf(rs.getObject("lon").toString()));
  88 + outbound.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString())));
  89 + outbound.setTimestampDate(sdf.format(new Date(outbound.getTimestamp())));
  90 + outbound.setUpDown(Integer.valueOf(rs.getObject("up_down").toString()));
  91 + outbound.setVehicle(rs.getObject("vehicle").toString());
  92 + outbound.setLocation(rs.getObject("location")==null?"":rs.getObject("location").toString());
  93 + list.add(outbound);
  94 + }
  95 + return list;
  96 + }
  97 +
  98 + @Override
  99 + public PageObject<Outbound> Pagequery(Map<String, Object> map) {
  100 + // TODO Auto-generated method stub PageObject<Outbound> Pagequery
  101 + String sql="select count(*) record from bsth_c_outbound where 1=1 ";
  102 + Object line=map.get("line");
  103 + Object nbbm=map.get("nbbm");
  104 + Object updown=map.get("updown");
  105 +
  106 + if(line!=null){
  107 + if(line.toString()!="")
  108 + sql +=" and line="+line;
  109 + }
  110 +
  111 + if(nbbm!=null){
  112 + if(nbbm.toString()!="")
  113 + sql +=" and vehicle like '%"+nbbm+"%'";
  114 + }
  115 +
  116 + if(updown!=null){
  117 + if(updown.toString() !="")
  118 + sql +="and up_down ="+updown;
  119 + }
  120 + Connection conn = null;
  121 + PreparedStatement ps = null;
  122 + ResultSet rs = null;
  123 + int totalData = 0;
  124 +
  125 + try {
  126 + conn = DBUtils_MS.getConnection();
  127 + ps = conn.prepareStatement(sql);
  128 + rs = ps.executeQuery();
  129 + if(rs.next()){
  130 + totalData=rs.getInt("record");
  131 + }
  132 + } catch (SQLException e) {
  133 + // TODO Auto-generated catch block
  134 + e.printStackTrace();
  135 + }finally {
  136 + DBUtils_MS.close(rs, ps, conn);
  137 + }
  138 +
  139 + PageHelper pageHelper = new PageHelper(totalData, map);
  140 + List<Outbound> list=findAll(pageHelper.getMap());
  141 +
  142 + PageObject<Outbound> pageObject = pageHelper.getPageObject();
  143 + pageObject.setDataList(list);
  144 + return pageObject;
  145 + }
  146 +
  147 +
  148 + @Override
  149 + public Map<String, Object> getReport(Map<String, Object> map) {
  150 + // TODO Auto-generated method stub
  151 + String chartStr = "";
  152 + Map<String, Object> mapValue = new HashMap<String, Object>();
  153 + try {
  154 + String xAxisName = map.get("xAxisName").toString();
  155 + String legendName = map.get("legendName").toString();
  156 + String xAxisItem = "";
  157 + String xAxisOrderBy = "";
  158 + String legendItem = "";
  159 + String legendOrderBy = "";
  160 + if(xAxisName!=null){
  161 + String [] xaxis = xAxisName.split(":");
  162 + if(xaxis.length>1 && xaxis[1].toLowerCase().contains("date")){
  163 + //本来还要判断下日期格式是否标准
  164 + xAxisItem = "to_char("+xaxis[0]+",'"+xaxis[2]+"') ";
  165 + xAxisOrderBy = (xaxis.length>3?xaxis[3]:"");
  166 + }else{
  167 + xAxisItem = xaxis[0];
  168 + }
  169 + }
  170 + if(legendName!=null){
  171 + String [] legend = legendName.split(":");
  172 + if(legend.length>1 && legend[1].toLowerCase().contains("date")){
  173 + //本来还要判断下日期格式是否标准
  174 + legendItem = "to_char("+legend[0]+",'"+legend[2]+"') ";
  175 + legendOrderBy = (legend[3].length()>3?legend[3]:"");
  176 + }else{
  177 + legendItem = legend[0];
  178 + }
  179 + }
  180 + map.put("xAxisItem", xAxisItem);
  181 + map.put("xAxisOrderBy", xAxisOrderBy);
  182 + map.put("legendItem", legendItem);
  183 + map.put("legendOrderBy", legendOrderBy);
  184 + List dataList = new ArrayList();
  185 + dataList =getReportList(map);
  186 + EchartConver echart = new EchartConver(map);
  187 + Option option = echart.getOption(dataList);
  188 + Gson gson = new Gson();
  189 + chartStr = gson.toJsonTree(option).toString();
  190 + mapValue.put("dataList", dataList);
  191 + mapValue.put("option", chartStr);
  192 + } catch (Exception e) {
  193 + e.printStackTrace();
  194 + }
  195 + return mapValue;
  196 + }
  197 +
  198 + static List getReportList(Map<String, Object> map) {
  199 + List dataList = new ArrayList();
  200 + String times="";
  201 + Object dataTime=map.get("dataTime");
  202 + Object line=map.get("line");
  203 + String addSql="";
  204 + if(line !=null){
  205 + if(line.toString()!=""){
  206 + addSql =" and line =" +line;
  207 + }
  208 + }
  209 + if(dataTime!=null){
  210 + times=dataTime.toString();
  211 + }
  212 + if(times.equals("")){
  213 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  214 + times=sdf.format(new Date());
  215 + }
  216 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  217 + String times1=times+" 00:00:01";
  218 + String times2=times+" 23:59:59";
  219 +
  220 + Connection conn = null;
  221 + PreparedStatement ps = null;
  222 + ResultSet rs = null;
  223 + try {
  224 + Long t1=simpleDateFormat.parse(times1).getTime();
  225 + Long t2=simpleDateFormat.parse(times2).getTime();
  226 + String sql="SELECT up_down xAxis , line legend,count(*) series"+
  227 + " FROM bsth_c_outbound "+
  228 + "where timestamp>? and timestamp<? "+addSql+" group by xAxis ,legend";
  229 + conn = DBUtils_MS.getConnection();
  230 + ps = conn.prepareStatement(sql);
  231 + ps.setLong(1, t1);
  232 + ps.setLong(2, t2);
  233 + rs = ps.executeQuery();
  234 + while(rs.next()){
  235 + Map<String, Object> newMap=new HashMap<String,Object>();
  236 + if(rs.getObject("xAxis").toString().equals("0"))
  237 + newMap.put("xAxis", "上行");
  238 + else if(rs.getObject("xAxis").toString().equals("1"))
  239 + newMap.put("xAxis", "下行");
  240 + else
  241 + newMap.put("xAxis", "无效");
  242 +
  243 + if(BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!=null && BasicData.lineCode2NameMap.get(rs.getObject("legend").toString())!="" )
  244 + newMap.put("legend", BasicData.lineCode2NameMap.get(rs.getObject("legend").toString()));
  245 + else
  246 + newMap.put("legend", "编码"+rs.getObject("legend").toString());
  247 +
  248 +
  249 +
  250 + newMap.put("series", Integer.parseInt(rs.getObject("series").toString()));
  251 + dataList.add(newMap);
  252 + }
  253 +
  254 + } catch (SQLException e) {
  255 + // TODO Auto-generated catch block
  256 + e.printStackTrace();
  257 + }catch (ParseException e1) {
  258 + // TODO Auto-generated catch block
  259 + e1.printStackTrace();
  260 + }finally {
  261 + DBUtils_MS.close(rs, ps, conn);
  262 + }
  263 +
  264 + return dataList;
  265 + }
  266 +}