Commit b8ae17acc01e8716645e6873cb1a35150fdae521

Authored by 娄高锋
2 parents 86055dd9 2bdbde5b

Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang

Showing 51 changed files with 2930 additions and 925 deletions

Too many changes to show.

To preserve performance only 51 of 295 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 - * [车辆历史GPS数据](#车辆历史GPS)  
21 -  
22 -----------  
23 -  
24 -## 字典表  
25 -----------  
26 -字典操作全部由前端负责,主要有2种。  
27 -  
28 -1、转换字典代码。  
29 - 当pjax的`pjax:success`事件被触发(片段加载完成)  
30 - 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换  
31 -``` html  
32 ---dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码  
33 -<span class="nt-dictionary" data-group="ScheduleType">out</span>  
34 ---to  
35 -<span>出场</span>  
36 -  
37 -<!- dom标签为input时,如下 data-code为要转换的代码 -->  
38 -<input class="nt-dictionary" data-group="ScheduleType" data-code="out">  
39 ---to  
40 -<input value="出场">  
41 -  
42 -<!- dom标签为select时 如下 data-code为要选中的项 -->  
43 -<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>  
44 ---to  
45 -<select>  
46 - <option value="normal">正常班次</option>  
47 - <option value="out" selected>出场</option>  
48 - <option value="in">进场</option>  
49 - <option value="oil">加油</option>  
50 - <option value="temp">临加</option>  
51 - <option value="region">区间</option>  
52 - <option value="venting">放空</option>  
53 - <option value="major">放大站</option>  
54 -</select>  
55 -```  
56 -*原标签的class 除nt-dictionary 外,其余均会被保留*  
57 -  
58 -2、dictionary.js提供如下方法自行使用  
59 -| 方法名 | 参数|返回|  
60 -| ---- | ---- | ---- | ---- |  
61 -| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |  
62 -| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|  
63 -| transformCode (转换字典代码)| (group, code) | 上行 |  
64 -  
65 -## 动态jpa查询实现  
66 -----------  
67 -*参考调度系统枚举com.bsth.entity.search.SearchOperator*  
68 -  
69 -  
70 -## gps  
71 -----------  
72 -### 实时gps接口  
73 -  
74 -所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)  
75 -根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)  
76 -  
77 -<span style="color: red">Response</span>:  
78 -```json  
79 -{  
80 - "data":[  
81 - {  
82 - "companyCode":5,  
83 - "lineId":10329,  
84 - "deviceId":"05B01901",  
85 - "carparkNo":"00000000",  
86 - "stopNo":"7C890002",  
87 - "lon":121.549866,  
88 - "lat":31.238798,  
89 - "timestamp":1397104499000,  
90 - "speed":42.0,  
91 - "direction":245.9,  
92 - "state":0,  
93 - "upDown":0  
94 - }]  
95 -}  
96 -```  
97 -  
98 -| -- | --|--|  
99 -| ---- | ---- | ---- |  
100 -| companyCode | int | 公司代码 |  
101 -| lineId | int | 线路编码 |  
102 -| deviceId | String | 设备编号 |  
103 -| carparkNo | String | 停车场编码 |  
104 -| stopNo | String | 站点编码 |  
105 -| lon | float | 经度 |  
106 -| lat | float | 纬度 |  
107 -| timestamp | long | 时间戳 |  
108 -| speed | float | 速度|  
109 -| direction | float | 方向(角度) |  
110 -| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |  
111 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|  
112 -  
113 -  
114 -### 进站数据  
115 -----------  
116 -表名:  
117 -  
118 -| .. | .. | .. |  
119 -| ---- | ---- | ---- |  
120 -| id | int | 主键 |  
121 -| deviceId | String | 设备号 |  
122 -| lineId | int | 线路编码 |  
123 -| stopNo | long | 站点编码 |  
124 -| timestamp | long | 时间戳 |  
125 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
126 -| createDate | Date | 创建时间 |  
127 -  
128 -  
129 -### 异常警报  
130 -----------  
131 -  
132 -### 大间隔  
133 -----------  
134 -表名:  
135 -  
136 -| .. | .. | .. |  
137 -| ---- | ---- | ---- |  
138 -| id | int | 主键 |  
139 -| line | int | 线路编码 |  
140 -| station | String | 站点编码 |  
141 -| cVehicle | String | 当前车辆编码 |  
142 -| lastVehicle | String | 上一个车辆编码 |  
143 -| interval | long | 间隔时间(秒) |  
144 -| timestamp | long | 时间戳 |  
145 -| createDate | Date | 创建时间 |  
146 -  
147 -### 超速  
148 -----------  
149 -表名:  
150 -  
151 -| .. | .. | .. |  
152 -| ---- | ---- | ---- |  
153 -| id | int | 主键 |  
154 -| vehicle | String | 车辆编码 |  
155 -| line | int | 线路编码 |  
156 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
157 -| lon | float | 经度 |  
158 -| lat | float | 纬度|  
159 -| speed | float | 速度 |  
160 -| timestamp | long | 时间戳 |  
161 -| createDate | Date | 时间 |  
162 -  
163 -### 越界  
164 -----------  
165 -表名:  
166 -  
167 -| .. | .. | .. |  
168 -| ---- | ---- | ---- |  
169 -| id | int | 主键 |  
170 -| vehicle | String | 车辆编码 |  
171 -| line | int | 线路编码 |  
172 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
173 -| lon | float | 经度 |  
174 -| lat | float | 纬度|  
175 -| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|  
176 -| timestamp | long | 时间戳 |  
177 -| createDate | Date | 时间 |  
178 -  
179 -  
180 -### 越站  
181 -----------  
182 -表名:  
183 -  
184 -| .. | .. | .. |  
185 -| ---- | ---- | ---- |  
186 -| id | int | 主键 |  
187 -| line | int | 线路编码 |  
188 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
189 -| station | String | 站点编码 |  
190 -| vehicle | String | 车辆编码 |  
191 -| inData | Date | 进站时间 |  
192 -| outDate | Date | 出站时间 |  
193 -  
194 -  
195 -### 聚集  
196 -----------  
197 -表名:  
198 -  
199 -| .. | .. | .. |  
200 -| ---- | ---- | ---- |  
201 -| id | int | 主键 |  
202 -| line | int | 线路编码 |  
203 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
204 -| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |  
205 -| vehicles | String | 车辆编码(多个用 , 号分隔) |  
206 -| timestamp | long | 时间戳 |  
207 -| createDate | Date | 时间 |  
208 -  
209 -  
210 -### 掉线  
211 -----------  
212 -表名:  
213 -  
214 -| .. | .. | .. |  
215 -| ---- | ---- | ---- |  
216 -| id | int | 主键 |  
217 -| line | int | 线路编码 |  
218 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
219 -| vehicle | String | 车辆编码 |  
220 -| lon | float | 经度 |  
221 -| lat | float | 纬度|  
222 -| timestamp | long | 时间戳 |  
223 -| createDate | Date | 时间 |  
224 -  
225 -  
226 -### 调度消息下发接口  
227 -----------  
228 -[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)  
229 -  
230 -<span style="color: red">Request</span>:  
231 -```json  
232 -{  
233 - "deviceId":12345,  
234 - "timestamp":44324,  
235 - "operCode":0x60,  
236 - "data":{  
237 - "companyCode":22,  
238 - "deviceId":"029L2222",  
239 - "timestamp":134326,  
240 - "instructType":00,  
241 - "dispatchInstruct":0x00,  
242 - "msgId":12345,  
243 - "alarmTime":201606012000,  
244 - "serviceState":00000000,  
245 - "txtContent":"你好"  
246 - }  
247 -}  
248 -```  
249 -| .. | .. | .. |  
250 -| ---- | ---- | ---- |  
251 -| deviceId | string | 设备编号 |  
252 -| timestamp | long | 时间戳(ms) |  
253 -| operCode | short | 一级协议 |  
254 -| data.companyCode | short | 公司代码 |  
255 -| data.deviceId | string | 设备编号 |  
256 -| data.timestamp | long | 时间戳 |  
257 -| data.instructType | short | 保留 默认0 |  
258 -| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|  
259 -| data.msgId | long | 同上 |  
260 -| data.alarmTime | long | 闹钟 MMddhhmm|  
261 -| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|  
262 -| data.txtContent | string | 下发的消息文本 |  
263 -```json  
264 -{  
265 - "deviceId":12345,  
266 - "timestamp":44324,  
267 - "operCode":0x64,  
268 - "data":{  
269 - "cityCode":22,  
270 - "deviceId":"029L2222",  
271 - "lineId":"134326"  
272 - }  
273 -}  
274 -```  
275 -| .. | .. | .. |  
276 -| ---- | ---- | ---- |  
277 -| deviceId | string | 设备编号 |  
278 -| timestamp | long | 时间戳(ms) |  
279 -| operCode | short | 一级协议 |  
280 -| data.cityCode | short | 城市区号 |  
281 -| data.deviceId | string | 设备编号 |  
282 -| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |  
283 -  
284 -```json  
285 -{  
286 - "deviceId":12345,  
287 - "timestamp":44324,  
288 - "operCode":0xC0,  
289 - "data":{  
290 - "operCode":0x86,  
291 - "requestAck":0x06  
292 - }  
293 -}  
294 -```  
295 -| .. | .. | .. |  
296 -| ---- | ---- | ---- |  
297 -| deviceId | string | 设备编号 |  
298 -| timestamp | long | 时间戳(ms) |  
299 -| operCode | short | 一级协议 |  
300 -| data.operCode | short | 二级协议 |  
301 -| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|  
302 -  
303 -```json  
304 -{  
305 - "deviceId":12345,  
306 - "timestamp":44324,  
307 - "operCode":0xC0,  
308 - "data":{  
309 - "operCode":0xa3,  
310 - "deviceId":12345,  
311 - "ipAddress":222.66.0.204,  
312 - "port":8899,  
313 - "reportMode":0,  
314 - "interval":0,  
315 - "distance":0,  
316 - "speedingThreshold":0,  
317 - "alarmThreshold":0,  
318 - "posIpAddress":0,  
319 - "posPort":0,  
320 - "delay":0,  
321 - "speedThreshold1":0,  
322 - "speedThreshold2":0,  
323 - "contrast":0,  
324 - "brightness":0,  
325 - "saturation":0  
326 - }  
327 -}  
328 -```  
329 -| .. | .. | .. |  
330 -| ---- | ---- | ---- |  
331 -| deviceId | string | 设备编号 |  
332 -| timestamp | long | 时间戳(ms) |  
333 -| operCode | short | 一级协议 |  
334 -| data.operCode | short | 二级协议 |  
335 -| data.deviceId | string | 设备编号|  
336 -| data.ipAddress | string | 网关IP地址|  
337 -| data.port | string | 网关端口|  
338 -| data.reportMode | short | 定时定距上报模式|  
339 -| data.interval | int | 定时上报时间间隔|  
340 -| data.distance | string | 定距上报距离间隔|  
341 -| data.speedingThreshold | short | 非线路状态超速阀门|  
342 -| data.alarmThreshold | short | 预警阀门|  
343 -| data.posIpAddress | string | pos机IP地址|  
344 -| data.posPort | string | pos机端口|  
345 -| data.delay | int | 延迟机关时间|  
346 -| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45|  
347 -| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35|  
348 -| data.deviceId | short | 对比度|  
349 -| data.deviceId | short | 亮度|  
350 -| data.deviceId | short | 饱和度|  
351 -  
352 -```json  
353 -{  
354 - "deviceId":12345,  
355 - "timestamp":44324,  
356 - "operCode":0xC0,  
357 - "data":{  
358 - "operCode":0xa4  
359 - }  
360 -}  
361 -```  
362 -| .. | .. | .. |  
363 -| ---- | ---- | ---- |  
364 -| deviceId | string | 设备编号 |  
365 -| timestamp | long | 时间戳(ms) |  
366 -| operCode | short | 一级协议 |  
367 -| data.operCode | short | 二级协议 |  
368 -  
369 -```json  
370 -{  
371 - "deviceId":12345,  
372 - "timestamp":44324,  
373 - "operCode":0xC0,  
374 - "data":{  
375 - "operCode":0xa5  
376 - "programVersion":2  
377 - }  
378 -}  
379 -```  
380 -| .. | .. | .. |  
381 -| ---- | ---- | ---- |  
382 -| deviceId | string | 设备编号 |  
383 -| timestamp | long | 时间戳(ms) |  
384 -| operCode | short | 一级协议 |  
385 -| data.operCode | short | 二级协议 |  
386 -| data.programVersion | short | 程序版本 |  
387 -  
388 -<span style="color: red">Response</span>:  
389 -```json  
390 -{  
391 - "errCode":0  
392 -}  
393 -```  
394 -  
395 -### 调度消息上传接口  
396 -----------  
397 -上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)  
398 -<span style="color: red">Request</span>:  
399 -```json  
400 -{  
401 - "deviceId":12345,  
402 - "timestamp":44324,  
403 - "status":0,  
404 - "operCode":0x80,  
405 - "data":{  
406 - "operCode":0x26,  
407 - "requestCode":22  
408 - }  
409 -}  
410 -```  
411 -| .. | .. | .. |  
412 -| ---- | ---- | ---- |  
413 -| deviceId | string | 设备编号 |  
414 -| timestamp | long | 时间戳(ms) |  
415 -| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |  
416 -| operCode | short | 一级协议 消息确认将无数据 |  
417 -| data.operCode | short | 二级协议 |  
418 -| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |  
419 -<span style="color: red">Response</span>:  
420 -```json  
421 -{  
422 - "errCode":0  
423 -}  
424 -```  
425 -  
426 -### 车辆历史GPS  
427 -----------  
428 -表名:BSTH_C_GPS_INFO  
429 -  
430 -| .. | .. | .. |  
431 -| ---- | ---- | ---- |  
432 -| cityCode | int | 城市代码 |  
433 -| industryCode | int | 行业代码 |  
434 -| companyCode | int | 企业代码 |  
435 -| lineId | int | 线路编号 |  
436 -| deviceId | string | 设备编号 |  
437 -| driverNo | int | 驾驶员工号 |  
438 -| carparkSerialNo | int | 停车场序列号 |  
439 -| carparkNo | string | 停车场编号 |  
440 -| stopSerialNo | int | 站点序列号 |  
441 -| stopNo | string | 停车场编号 |  
442 -| lon | float | 经度 |  
443 -| lat | float | 维度 |  
444 -| ts | long | 时间戳 |  
445 -| speedSensor | float | 发动机速度 |  
446 -| speedGps | float | gps速度 |  
447 -| direction | float | 角度0-359 |  
448 -| inTemp | int | 车内温度 |  
449 -| serviceState | long | 设备状态字 |  
450 -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |  
451 - 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 + * [车辆历史GPS数据](#车辆历史GPS)
  21 +
  22 +----------
  23 +
  24 +## 字典表
  25 +----------
  26 +字典操作全部由前端负责,主要有2种。
  27 +
  28 +1、转换字典代码。
  29 + 当pjax的`pjax:success`事件被触发(片段加载完成)
  30 + 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换
  31 +``` html
  32 +--dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码
  33 +<span class="nt-dictionary" data-group="ScheduleType">out</span>
  34 +--to
  35 +<span>出场</span>
  36 +
  37 +<!- dom标签为input时,如下 data-code为要转换的代码 -->
  38 +<input class="nt-dictionary" data-group="ScheduleType" data-code="out">
  39 +--to
  40 +<input value="出场">
  41 +
  42 +<!- dom标签为select时 如下 data-code为要选中的项 -->
  43 +<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>
  44 +--to
  45 +<select>
  46 + <option value="normal">正常班次</option>
  47 + <option value="out" selected>出场</option>
  48 + <option value="in">进场</option>
  49 + <option value="oil">加油</option>
  50 + <option value="temp">临加</option>
  51 + <option value="region">区间</option>
  52 + <option value="venting">放空</option>
  53 + <option value="major">放大站</option>
  54 +</select>
  55 +```
  56 +*原标签的class 除nt-dictionary 外,其余均会被保留*
  57 +
  58 +2、dictionary.js提供如下方法自行使用
  59 +| 方法名 | 参数|返回|
  60 +| ---- | ---- | ---- | ---- |
  61 +| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |
  62 +| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|
  63 +| transformCode (转换字典代码)| (group, code) | 上行 |
  64 +
  65 +## 动态jpa查询实现
  66 +----------
  67 +*参考调度系统枚举com.bsth.entity.search.SearchOperator*
  68 +
  69 +
  70 +## gps
  71 +----------
  72 +### 实时gps接口
  73 +
  74 +所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)
  75 +根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)
  76 +
  77 +<span style="color: red">Response</span>:
  78 +```json
  79 +{
  80 + "data":[
  81 + {
  82 + "companyCode":5,
  83 + "lineId":10329,
  84 + "deviceId":"05B01901",
  85 + "carparkNo":"00000000",
  86 + "stopNo":"7C890002",
  87 + "lon":121.549866,
  88 + "lat":31.238798,
  89 + "timestamp":1397104499000,
  90 + "speed":42.0,
  91 + "direction":245.9,
  92 + "state":0,
  93 + "upDown":0
  94 + }]
  95 +}
  96 +```
  97 +
  98 +| -- | --|--|
  99 +| ---- | ---- | ---- |
  100 +| companyCode | int | 公司代码 |
  101 +| lineId | int | 线路编码 |
  102 +| deviceId | String | 设备编号 |
  103 +| carparkNo | String | 停车场编码 |
  104 +| stopNo | String | 站点编码 |
  105 +| lon | float | 经度 |
  106 +| lat | float | 纬度 |
  107 +| timestamp | long | 时间戳 |
  108 +| speed | float | 速度|
  109 +| direction | float | 方向(角度) |
  110 +| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |
  111 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|
  112 +
  113 +
  114 +### 进站数据
  115 +----------
  116 +表名:
  117 +
  118 +| .. | .. | .. |
  119 +| ---- | ---- | ---- |
  120 +| id | int | 主键 |
  121 +| deviceId | String | 设备号 |
  122 +| lineId | int | 线路编码 |
  123 +| stopNo | long | 站点编码 |
  124 +| timestamp | long | 时间戳 |
  125 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  126 +| createDate | Date | 创建时间 |
  127 +
  128 +
  129 +### 异常警报
  130 +----------
  131 +
  132 +### 大间隔
  133 +----------
  134 +表名:
  135 +
  136 +| .. | .. | .. |
  137 +| ---- | ---- | ---- |
  138 +| id | int | 主键 |
  139 +| line | int | 线路编码 |
  140 +| station | String | 站点编码 |
  141 +| cVehicle | String | 当前车辆编码 |
  142 +| lastVehicle | String | 上一个车辆编码 |
  143 +| interval | long | 间隔时间(秒) |
  144 +| timestamp | long | 时间戳 |
  145 +| createDate | Date | 创建时间 |
  146 +
  147 +### 超速
  148 +----------
  149 +表名:
  150 +
  151 +| .. | .. | .. |
  152 +| ---- | ---- | ---- |
  153 +| id | int | 主键 |
  154 +| vehicle | String | 车辆编码 |
  155 +| line | int | 线路编码 |
  156 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  157 +| lon | float | 经度 |
  158 +| lat | float | 纬度|
  159 +| speed | float | 速度 |
  160 +| timestamp | long | 时间戳 |
  161 +| createDate | Date | 时间 |
  162 +
  163 +### 越界
  164 +----------
  165 +表名:
  166 +
  167 +| .. | .. | .. |
  168 +| ---- | ---- | ---- |
  169 +| id | int | 主键 |
  170 +| vehicle | String | 车辆编码 |
  171 +| line | int | 线路编码 |
  172 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  173 +| lon | float | 经度 |
  174 +| lat | float | 纬度|
  175 +| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|
  176 +| timestamp | long | 时间戳 |
  177 +| createDate | Date | 时间 |
  178 +
  179 +
  180 +### 越站
  181 +----------
  182 +表名:
  183 +
  184 +| .. | .. | .. |
  185 +| ---- | ---- | ---- |
  186 +| id | int | 主键 |
  187 +| line | int | 线路编码 |
  188 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  189 +| station | String | 站点编码 |
  190 +| vehicle | String | 车辆编码 |
  191 +| inData | Date | 进站时间 |
  192 +| outDate | Date | 出站时间 |
  193 +
  194 +
  195 +### 聚集
  196 +----------
  197 +表名:
  198 +
  199 +| .. | .. | .. |
  200 +| ---- | ---- | ---- |
  201 +| id | int | 主键 |
  202 +| line | int | 线路编码 |
  203 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  204 +| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |
  205 +| vehicles | String | 车辆编码(多个用 , 号分隔) |
  206 +| timestamp | long | 时间戳 |
  207 +| createDate | Date | 时间 |
  208 +
  209 +
  210 +### 掉线
  211 +----------
  212 +表名:
  213 +
  214 +| .. | .. | .. |
  215 +| ---- | ---- | ---- |
  216 +| id | int | 主键 |
  217 +| line | int | 线路编码 |
  218 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  219 +| vehicle | String | 车辆编码 |
  220 +| lon | float | 经度 |
  221 +| lat | float | 纬度|
  222 +| timestamp | long | 时间戳 |
  223 +| createDate | Date | 时间 |
  224 +
  225 +
  226 +### 调度消息下发接口
  227 +----------
  228 +[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)
  229 +
  230 +<span style="color: red">Request</span>:
  231 +```json
  232 +{
  233 + "deviceId":12345,
  234 + "timestamp":44324,
  235 + "operCode":0x60,
  236 + "data":{
  237 + "companyCode":22,
  238 + "deviceId":"029L2222",
  239 + "timestamp":134326,
  240 + "instructType":00,
  241 + "dispatchInstruct":0x00,
  242 + "msgId":12345,
  243 + "alarmTime":201606012000,
  244 + "serviceState":00000000,
  245 + "txtContent":"你好"
  246 + }
  247 +}
  248 +```
  249 +| .. | .. | .. |
  250 +| ---- | ---- | ---- |
  251 +| deviceId | string | 设备编号 |
  252 +| timestamp | long | 时间戳(ms) |
  253 +| operCode | short | 一级协议 |
  254 +| data.companyCode | short | 公司代码 |
  255 +| data.deviceId | string | 设备编号 |
  256 +| data.timestamp | long | 时间戳 |
  257 +| data.instructType | short | 保留 默认0 |
  258 +| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|
  259 +| data.msgId | long | 同上 |
  260 +| data.alarmTime | long | 闹钟 MMddhhmm|
  261 +| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|
  262 +| data.txtContent | string | 下发的消息文本 |
  263 +```json
  264 +{
  265 + "deviceId":12345,
  266 + "timestamp":44324,
  267 + "operCode":0x64,
  268 + "data":{
  269 + "cityCode":22,
  270 + "deviceId":"029L2222",
  271 + "lineId":"134326"
  272 + }
  273 +}
  274 +```
  275 +| .. | .. | .. |
  276 +| ---- | ---- | ---- |
  277 +| deviceId | string | 设备编号 |
  278 +| timestamp | long | 时间戳(ms) |
  279 +| operCode | short | 一级协议 |
  280 +| data.cityCode | short | 城市区号 |
  281 +| data.deviceId | string | 设备编号 |
  282 +| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |
  283 +
  284 +```json
  285 +{
  286 + "deviceId":12345,
  287 + "timestamp":44324,
  288 + "operCode":0xC0,
  289 + "data":{
  290 + "operCode":0x86,
  291 + "requestAck":0x06
  292 + }
  293 +}
  294 +```
  295 +| .. | .. | .. |
  296 +| ---- | ---- | ---- |
  297 +| deviceId | string | 设备编号 |
  298 +| timestamp | long | 时间戳(ms) |
  299 +| operCode | short | 一级协议 |
  300 +| data.operCode | short | 二级协议 |
  301 +| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|
  302 +
  303 +```json
  304 +{
  305 + "deviceId":12345,
  306 + "timestamp":44324,
  307 + "operCode":0xC0,
  308 + "data":{
  309 + "operCode":0xa3,
  310 + "deviceId":12345,
  311 + "ipAddress":222.66.0.204,
  312 + "port":8899,
  313 + "reportMode":0,
  314 + "interval":0,
  315 + "distance":0,
  316 + "speedingThreshold":0,
  317 + "alarmThreshold":0,
  318 + "posIpAddress":0,
  319 + "posPort":0,
  320 + "delay":0,
  321 + "speedThreshold1":0,
  322 + "speedThreshold2":0,
  323 + "contrast":0,
  324 + "brightness":0,
  325 + "saturation":0
  326 + }
  327 +}
  328 +```
  329 +| .. | .. | .. |
  330 +| ---- | ---- | ---- |
  331 +| deviceId | string | 设备编号 |
  332 +| timestamp | long | 时间戳(ms) |
  333 +| operCode | short | 一级协议 |
  334 +| data.operCode | short | 二级协议 |
  335 +| data.deviceId | string | 设备编号|
  336 +| data.ipAddress | string | 网关IP地址|
  337 +| data.port | string | 网关端口|
  338 +| data.reportMode | short | 定时定距上报模式|
  339 +| data.interval | int | 定时上报时间间隔|
  340 +| data.distance | string | 定距上报距离间隔|
  341 +| data.speedingThreshold | short | 非线路状态超速阀门|
  342 +| data.alarmThreshold | short | 预警阀门|
  343 +| data.posIpAddress | string | pos机IP地址|
  344 +| data.posPort | string | pos机端口|
  345 +| data.delay | int | 延迟机关时间|
  346 +| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45|
  347 +| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35|
  348 +| data.deviceId | short | 对比度|
  349 +| data.deviceId | short | 亮度|
  350 +| data.deviceId | short | 饱和度|
  351 +
  352 +```json
  353 +{
  354 + "deviceId":12345,
  355 + "timestamp":44324,
  356 + "operCode":0xC0,
  357 + "data":{
  358 + "operCode":0xa4
  359 + }
  360 +}
  361 +```
  362 +| .. | .. | .. |
  363 +| ---- | ---- | ---- |
  364 +| deviceId | string | 设备编号 |
  365 +| timestamp | long | 时间戳(ms) |
  366 +| operCode | short | 一级协议 |
  367 +| data.operCode | short | 二级协议 |
  368 +
  369 +```json
  370 +{
  371 + "deviceId":12345,
  372 + "timestamp":44324,
  373 + "operCode":0xC0,
  374 + "data":{
  375 + "operCode":0xa5
  376 + "programVersion":2
  377 + }
  378 +}
  379 +```
  380 +| .. | .. | .. |
  381 +| ---- | ---- | ---- |
  382 +| deviceId | string | 设备编号 |
  383 +| timestamp | long | 时间戳(ms) |
  384 +| operCode | short | 一级协议 |
  385 +| data.operCode | short | 二级协议 |
  386 +| data.programVersion | short | 程序版本 |
  387 +
  388 +<span style="color: red">Response</span>:
  389 +```json
  390 +{
  391 + "errCode":0
  392 +}
  393 +```
  394 +
  395 +### 调度消息上传接口
  396 +----------
  397 +上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)
  398 +<span style="color: red">Request</span>:
  399 +```json
  400 +{
  401 + "deviceId":12345,
  402 + "timestamp":44324,
  403 + "status":0,
  404 + "operCode":0x80,
  405 + "data":{
  406 + "operCode":0x26,
  407 + "requestCode":22
  408 + }
  409 +}
  410 +```
  411 +| .. | .. | .. |
  412 +| ---- | ---- | ---- |
  413 +| deviceId | string | 设备编号 |
  414 +| timestamp | long | 时间戳(ms) |
  415 +| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |
  416 +| operCode | short | 一级协议 消息确认将无数据 |
  417 +| data.operCode | short | 二级协议 |
  418 +| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |
  419 +<span style="color: red">Response</span>:
  420 +```json
  421 +{
  422 + "errCode":0
  423 +}
  424 +```
  425 +
  426 +### 车辆历史GPS
  427 +----------
  428 +表名:BSTH_C_GPS_INFO
  429 +
  430 +| .. | .. | .. |
  431 +| ---- | ---- | ---- |
  432 +| cityCode | int | 城市代码 |
  433 +| industryCode | int | 行业代码 |
  434 +| companyCode | int | 企业代码 |
  435 +| lineId | int | 线路编号 |
  436 +| deviceId | string | 设备编号 |
  437 +| driverNo | int | 驾驶员工号 |
  438 +| carparkSerialNo | int | 停车场序列号 |
  439 +| carparkNo | string | 停车场编号 |
  440 +| stopSerialNo | int | 站点序列号 |
  441 +| stopNo | string | 停车场编号 |
  442 +| lon | float | 经度 |
  443 +| lat | float | 维度 |
  444 +| ts | long | 时间戳 |
  445 +| speedSensor | float | 发动机速度 |
  446 +| speedGps | float | gps速度 |
  447 +| direction | float | 角度0-359 |
  448 +| inTemp | int | 车内温度 |
  449 +| serviceState | long | 设备状态字 |
  450 +<<<<<<< HEAD
  451 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
  452 +=======
  453 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
  454 +
  455 +>>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50
@@ -219,6 +219,12 @@ @@ -219,6 +219,12 @@
219 <artifactId>jaxrpc-api</artifactId> 219 <artifactId>jaxrpc-api</artifactId>
220 <version>1.1</version> 220 <version>1.1</version>
221 </dependency> 221 </dependency>
  222 +
  223 + <dependency>
  224 + <groupId>org.springframework.boot</groupId>
  225 + <artifactId>spring-boot-devtools</artifactId>
  226 + <optional>true</optional>
  227 + </dependency>
222 </dependencies> 228 </dependencies>
223 229
224 <dependencyManagement> 230 <dependencyManagement>
@@ -248,7 +254,6 @@ @@ -248,7 +254,6 @@
248 <artifactId>maven-war-plugin</artifactId> 254 <artifactId>maven-war-plugin</artifactId>
249 <version>2.2</version><!--$NO-MVN-MAN-VER$ --> 255 <version>2.2</version><!--$NO-MVN-MAN-VER$ -->
250 <configuration> 256 <configuration>
251 - <version>3.1</version>  
252 <failOnMissingWebXml>false</failOnMissingWebXml> 257 <failOnMissingWebXml>false</failOnMissingWebXml>
253 </configuration> 258 </configuration>
254 </plugin> 259 </plugin>
@@ -257,6 +262,12 @@ @@ -257,6 +262,12 @@
257 <artifactId>spring-boot-maven-plugin</artifactId> 262 <artifactId>spring-boot-maven-plugin</artifactId>
258 </plugin> 263 </plugin>
259 </plugins> 264 </plugins>
  265 + <resources>
  266 + <resource>
  267 + <directory>src/main/resources</directory>
  268 + <filtering>false</filtering>
  269 + </resource>
  270 + </resources>
260 </build> 271 </build>
261 <repositories> 272 <repositories>
262 <repository> 273 <repository>
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(268435456));  
7 - System.out.println("上下行:" + getUpOrDown(268435456)); 6 + System.out.println("运营状态:" + getService(603979776));
  7 + System.out.println("上下行:" + getUpOrDown(603979776));
8 } 8 }
9 9
10 /** 10 /**
src/main/java/com/bsth/WebAppConfiguration.java
@@ -25,8 +25,8 @@ import com.bsth.websocket.handler.RealControlSocketHandler; @@ -25,8 +25,8 @@ import com.bsth.websocket.handler.RealControlSocketHandler;
25 @ComponentScan 25 @ComponentScan
26 public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{ 26 public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{
27 27
28 - @Autowired  
29 - HttpOpLogInterceptor httpOpLogInterceptor; 28 +// @Autowired
  29 +// HttpOpLogInterceptor httpOpLogInterceptor;
30 30
31 /** 31 /**
32 * @Title: httpPutFormContentFilter 32 * @Title: httpPutFormContentFilter
@@ -63,11 +63,11 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS @@ -63,11 +63,11 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
63 * 63 *
64 * @Title: addInterceptors 64 * @Title: addInterceptors
65 * @Description: TODO(HTTP结构化访问日志记录 ) 65 * @Description: TODO(HTTP结构化访问日志记录 )
66 - */ 66 +
67 @Override 67 @Override
68 public void addInterceptors(InterceptorRegistry registry) { 68 public void addInterceptors(InterceptorRegistry registry) {
69 registry.addInterceptor(httpOpLogInterceptor); 69 registry.addInterceptor(httpOpLogInterceptor);
70 - } 70 + }*/
71 71
72 @Override 72 @Override
73 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { 73 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
src/main/java/com/bsth/controller/BaseController.java
@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile; @@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
17 17
18 import javax.servlet.http.HttpServletResponse; 18 import javax.servlet.http.HttpServletResponse;
19 import java.io.*; 19 import java.io.*;
  20 +import java.util.ArrayList;
20 import java.util.HashMap; 21 import java.util.HashMap;
21 import java.util.List; 22 import java.util.List;
22 import java.util.Map; 23 import java.util.Map;
@@ -54,18 +55,31 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -54,18 +55,31 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
54 @RequestParam(defaultValue = "id") String order, 55 @RequestParam(defaultValue = "id") String order,
55 @RequestParam(defaultValue = "DESC") String direction){ 56 @RequestParam(defaultValue = "DESC") String direction){
56 57
57 - Direction d;  
58 -  
59 - if(null != direction && direction.equals("ASC"))  
60 - d = Direction.ASC;  
61 - else  
62 - d = Direction.DESC;  
63 -  
64 // 允许多个字段排序,order可以写单个字段,也可以写多个字段 58 // 允许多个字段排序,order可以写单个字段,也可以写多个字段
65 // 多个字段格式:{col1},{col2},{col3},....,{coln} 59 // 多个字段格式:{col1},{col2},{col3},....,{coln}
66 - // 每个字段的排序方向都是一致,这个以后再看要不要改  
67 - List<String> list = Splitter.on(",").trimResults().splitToList(order);  
68 - return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); 60 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  61 + // 多字段排序:DESC,ASC...
  62 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  63 +
  64 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  65 + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) {
  66 + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.ASC, order_columns)));
  67 + } else {
  68 + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.DESC, order_columns)));
  69 + }
  70 + } else if (order_columns.size() == order_dirs.size()) {
  71 + List<Sort.Order> orderList = new ArrayList<>();
  72 + for (int i = 0; i < order_columns.size(); i++) {
  73 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  74 + orderList.add(new Sort.Order(Direction.ASC, order_columns.get(i)));
  75 + } else {
  76 + orderList.add(new Sort.Order(Direction.DESC, order_columns.get(i)));
  77 + }
  78 + }
  79 + return baseService.list(map, new PageRequest(page, size, new Sort(orderList)));
  80 + } else {
  81 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  82 + }
69 } 83 }
70 84
71 /** 85 /**
src/main/java/com/bsth/controller/BaseController2.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.service.BaseService;
  6 +import com.bsth.service.schedule.utils.DataImportExportService;
  7 +import com.google.common.base.Splitter;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Page;
  10 +import org.springframework.data.domain.PageRequest;
  11 +import org.springframework.data.domain.Sort;
  12 +import org.springframework.web.bind.annotation.*;
  13 +import org.springframework.web.multipart.MultipartFile;
  14 +
  15 +import javax.servlet.http.HttpServletResponse;
  16 +import java.io.*;
  17 +import java.util.ArrayList;
  18 +import java.util.HashMap;
  19 +import java.util.List;
  20 +import java.util.Map;
  21 +
  22 +/**
  23 + * Created by xu on 16/11/3.
  24 + */
  25 +public class BaseController2<T, ID extends Serializable> {
  26 +
  27 + @Autowired
  28 + protected BaseService<T, ID> baseService;
  29 + @Autowired
  30 + DataImportExportService dataImportExportService;
  31 +
  32 + /**
  33 + *
  34 + * @Title: list
  35 + * @Description: TODO(多条件分页查询)
  36 + * @param @param map 查询条件
  37 + * @param @param page 页码
  38 + * @param @param size 每页显示数量
  39 + * @throws
  40 + */
  41 + @RequestMapping(method = RequestMethod.GET)
  42 + public Page<T> list(@RequestParam Map<String, Object> map,
  43 + @RequestParam(defaultValue = "0") int page,
  44 + @RequestParam(defaultValue = "10") int size,
  45 + @RequestParam(defaultValue = "id") String order,
  46 + @RequestParam(defaultValue = "DESC") String direction){
  47 +
  48 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  49 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  50 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  51 + // 多字段排序:DESC,ASC...
  52 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  53 +
  54 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  55 + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) {
  56 + return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns)));
  57 + } else {
  58 + return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns)));
  59 + }
  60 + } else if (order_columns.size() == order_dirs.size()) {
  61 + List<Sort.Order> orderList = new ArrayList<>();
  62 + for (int i = 0; i < order_columns.size(); i++) {
  63 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  64 + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i)));
  65 + } else {
  66 + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i)));
  67 + }
  68 + }
  69 + return baseService.list(map, new PageRequest(page, size, new Sort(orderList)));
  70 + } else {
  71 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  72 + }
  73 + }
  74 +
  75 + /**
  76 + *
  77 + * @Title: list
  78 + * @Description: TODO(多条件查询)
  79 + * @param @param map
  80 + * @throws
  81 + */
  82 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  83 + public Iterable<T> list(@RequestParam Map<String, Object> map){
  84 + return baseService.list(map);
  85 + }
  86 +
  87 + /**
  88 + * 这里保存直接返回保存后的对象,不自己定义Map返回了,和前端angularjs配合。
  89 + * form也可以提交,但是页面参数可能不全,
  90 + * json的化比较灵活,但是貌似有多余属性也会报错,或者碰到lazy属性值,也有问题
  91 + * 不论form,还是json提交都能解决问题,就看哪个方便哪个来
  92 + *
  93 + * @param t 参数需要使用@RequestBody转换json成对象
  94 + * @return
  95 + */
  96 + @RequestMapping(method = RequestMethod.POST)
  97 + public T save(@RequestBody T t) {
  98 + baseService.save(t);
  99 + return t;
  100 + }
  101 +
  102 + @RequestMapping(value="/{id}", method = RequestMethod.POST)
  103 + public T update(@RequestBody T t) {
  104 + baseService.save(t);
  105 + return t;
  106 + }
  107 +
  108 + /**
  109 + *
  110 + * @Title: findById
  111 + * @Description: TODO(根据主键获取单个对象)
  112 + * @param @param id
  113 + * @throws
  114 + */
  115 + @RequestMapping(value="/{id}",method = RequestMethod.GET)
  116 + public T findById(@PathVariable("id") ID id){
  117 + return baseService.findById(id);
  118 + }
  119 +
  120 + /**
  121 + *
  122 + * @Title: delete
  123 + * @Description: TODO(根据主键删除对象)
  124 + * @param @param id
  125 + * @throws
  126 + */
  127 + @RequestMapping(value="/{id}",method = RequestMethod.DELETE)
  128 + public Map<String, Object> delete(@PathVariable("id") ID id){
  129 + return baseService.delete(id);
  130 + }
  131 +
  132 + /**
  133 + * 上传数据文件,并使用ktr转换文件导入数据。
  134 + * @param file
  135 + * @return
  136 + * @throws Exception
  137 + */
  138 + @RequestMapping(value = "/dataImport", method = RequestMethod.POST)
  139 + public Map<String, Object> uploadDataAndImport(MultipartFile file) throws Exception {
  140 + Map<String, Object> resultMap = new HashMap<>();
  141 +
  142 + try {
  143 + // 获取ktr转换文件绝对路径
  144 + File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI());
  145 + System.out.println(ktrfile.getAbsolutePath());
  146 + // 导入数据
  147 + dataImportExportService.fileDataImport(file, ktrfile);
  148 +
  149 + resultMap.put("status", ResponseCode.SUCCESS);
  150 + resultMap.put("msg", "导入成功");
  151 + } catch (Exception exp) {
  152 + exp.printStackTrace();
  153 + resultMap.put("status", ResponseCode.ERROR);
  154 + resultMap.put("msg", exp.getLocalizedMessage());
  155 + }
  156 +
  157 + return resultMap;
  158 + }
  159 +
  160 + /**
  161 + * 使用ktr导出数据。
  162 + * @param response
  163 + * @throws Exception
  164 + */
  165 + @RequestMapping(value = "/dataExport", method = RequestMethod.GET)
  166 + public void dataExport(HttpServletResponse response) throws Exception {
  167 + // 1、使用ktr转换获取输出文件
  168 + File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI());
  169 + File outputfile = dataImportExportService.fileDataOutput(
  170 + getDataExportFilename(),
  171 + ktrfile);
  172 +
  173 + System.out.println(outputfile.getName());
  174 + String filePath = outputfile.getAbsolutePath();
  175 + String fp[] = filePath.split(File.separator);
  176 + String fileName = fp[fp.length - 1];
  177 +
  178 + // TODO:使用ktr获取导出数据
  179 +
  180 + response.setHeader("conent-type", "application/octet-stream");
  181 + response.setContentType("application/octet-stream");
  182 + response.setHeader("Content-Disposition", "attachment; filename=" + "东东");
  183 +
  184 + OutputStream os = response.getOutputStream();
  185 + BufferedOutputStream bos = new BufferedOutputStream(os);
  186 +
  187 + InputStream is = null;
  188 +
  189 + is = new FileInputStream(filePath);
  190 + BufferedInputStream bis = new BufferedInputStream(is);
  191 +
  192 + int length = 0;
  193 + byte[] temp = new byte[1 * 1024 * 10];
  194 +
  195 + while ((length = bis.read(temp)) != -1) {
  196 + bos.write(temp, 0, length);
  197 + }
  198 + bos.flush();
  199 + bis.close();
  200 + bos.close();
  201 + is.close();
  202 + }
  203 +
  204 + /**
  205 + * @return 数据导出的ktr转换文件类路径。
  206 + */
  207 + protected String getDataExportKtrClasspath() {
  208 + // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定ktr文件类路径
  209 + throw new RuntimeException("必须override,并指定ktr classpath");
  210 + }
  211 +
  212 + /**
  213 + * @return 导出文件名。
  214 + */
  215 + protected String getDataExportFilename() {
  216 + // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定导出的文件路径名
  217 + throw new RuntimeException("必须override,并指定导出文件名");
  218 + }
  219 +
  220 + /**
  221 + * @return 数据导入的ktr转换文件类路径。
  222 + */
  223 + protected String getDataImportKtrClasspath() {
  224 + // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径
  225 + throw new RuntimeException("必须override,并指定ktr classpath");
  226 + }
  227 +
  228 +}
src/main/java/com/bsth/controller/CarDeviceController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import com.bsth.common.ResponseCode;
3 import com.bsth.entity.CarDevice; 4 import com.bsth.entity.CarDevice;
  5 +import com.bsth.service.CarDeviceService;
  6 +import org.joda.time.DateTime;
  7 +import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.web.bind.annotation.RequestBody; 8 import org.springframework.web.bind.annotation.RequestBody;
5 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RequestMethod; 10 import org.springframework.web.bind.annotation.RequestMethod;
7 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
8 12
  13 +import java.util.HashMap;
  14 +import java.util.Iterator;
9 import java.util.Map; 15 import java.util.Map;
10 16
11 /** 17 /**
12 * Created by xu on 16/6/15. 18 * Created by xu on 16/6/15.
13 */ 19 */
14 @RestController 20 @RestController
15 -@RequestMapping("carDevice") 21 +@RequestMapping("cde")
16 public class CarDeviceController extends BaseController<CarDevice, Long> { 22 public class CarDeviceController extends BaseController<CarDevice, Long> {
17 - 23 + @Autowired
  24 + private CarDeviceService carDeviceService;
18 /** 25 /**
19 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody 26 * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
20 * @Title: save 27 * @Title: save
@@ -28,4 +35,22 @@ public class CarDeviceController extends BaseController&lt;CarDevice, Long&gt; { @@ -28,4 +35,22 @@ public class CarDeviceController extends BaseController&lt;CarDevice, Long&gt; {
28 public Map<String, Object> save(@RequestBody CarDevice t){ 35 public Map<String, Object> save(@RequestBody CarDevice t){
29 return baseService.save(t); 36 return baseService.save(t);
30 } 37 }
  38 +
  39 + @RequestMapping(value = "/validate/qyrq", method = RequestMethod.GET)
  40 + public Map<String, Object> validateQyrq(String qyrq, Integer xl, Integer cl) {
  41 + // 验证启用日期,必须是最大的日期,就是最晚的日期
  42 + Map<String, Object> obj = new HashMap<>();
  43 + obj.put("xl_eq", xl);
  44 + obj.put("cl_eq", cl);
  45 + obj.put("qyrq_ge", new DateTime(qyrq).toDate());
  46 + Iterator<CarDevice> iterator = carDeviceService.list(obj).iterator();
  47 + if (iterator.hasNext()) {
  48 + obj.clear();
  49 + obj.put("status", ResponseCode.ERROR);
  50 + } else {
  51 + obj.clear();
  52 + obj.put("status", ResponseCode.SUCCESS);
  53 + }
  54 + return obj;
  55 + }
31 } 56 }
src/main/java/com/bsth/controller/DeviceGpsController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.io.BufferedOutputStream;
  4 +import java.io.BufferedReader;
  5 +import java.io.File;
  6 +import java.io.FileInputStream;
  7 +import java.io.IOException;
  8 +import java.io.InputStreamReader;
  9 +import java.io.OutputStream;
  10 +import java.text.SimpleDateFormat;
  11 +import java.util.ArrayList;
  12 +import java.util.Date;
  13 +import java.util.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +import javax.servlet.http.HttpServletRequest;
  18 +import javax.servlet.http.HttpServletResponse;
  19 +
  20 +import org.apache.commons.lang.StringEscapeUtils;
  21 +import org.apache.poi.hssf.usermodel.HSSFCell;
  22 +import org.apache.poi.hssf.usermodel.HSSFRichTextString;
  23 +import org.apache.poi.hssf.usermodel.HSSFRow;
  24 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  25 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  26 +import org.springframework.beans.BeanUtils;
  27 +import org.springframework.beans.factory.annotation.Autowired;
  28 +import org.springframework.util.StringUtils;
  29 +import org.springframework.web.bind.annotation.PathVariable;
  30 +import org.springframework.web.bind.annotation.RequestMapping;
  31 +import org.springframework.web.bind.annotation.RequestMethod;
  32 +import org.springframework.web.bind.annotation.RequestParam;
  33 +import org.springframework.web.bind.annotation.RestController;
  34 +import org.springframework.web.multipart.MultipartFile;
  35 +
  36 +import com.bsth.data.gpsdata.GpsEntity;
  37 +import com.bsth.data.gpsdata.GpsRealData;
  38 +import com.fasterxml.jackson.core.JsonParseException;
  39 +import com.fasterxml.jackson.databind.JsonMappingException;
  40 +import com.fasterxml.jackson.databind.ObjectMapper;
  41 +import com.fasterxml.jackson.databind.util.BeanUtil;
  42 +
  43 +@RestController
  44 +@RequestMapping("devicegps")
  45 +public class DeviceGpsController {
  46 +
  47 + @Autowired
  48 + GpsRealData gpsRealData;
  49 +
  50 + @RequestMapping(value = "/real/line/{lineCode}")
  51 + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
  52 + return gpsRealData.getByLine(lineCode);
  53 + }
  54 +
  55 + @RequestMapping(value = "/real/all")
  56 + public List<GpsEntity> findByLineCodes() {
  57 + return new ArrayList<>(gpsRealData.all());
  58 + }
  59 +
  60 + @RequestMapping(value = "/open", method = RequestMethod.POST)
  61 + public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) {
  62 + Map<String, Object> res = new HashMap<>();
  63 + File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + "");
  64 + File rd = rf.getParentFile();
  65 + if (!rd.exists()) {
  66 + rd.mkdirs();
  67 + }
  68 +
  69 + BufferedReader reader = null;
  70 + try {
  71 + file.transferTo(rf);
  72 + reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK"));
  73 + String line = null;
  74 + List<Map<String, Object>> data = new ArrayList<>();
  75 + while ((line = reader.readLine()) != null) {
  76 + if (!StringUtils.isEmpty(line)) {
  77 + String temp[] = line.split(",");
  78 + if (temp.length != 4) {
  79 + res.put("errCode", 1);
  80 + res.put("msg", "txt文档格式错误,请检查");
  81 + return res;
  82 + }
  83 + Map<String, Object> info = new HashMap<>();
  84 + info.put("lineName", temp[0]);
  85 + info.put("lineCode", temp[1]);
  86 + info.put("inCode", temp[2]);
  87 + info.put("deviceId", temp[3]);
  88 + info.put("detail", gpsRealData.get(temp[3]));
  89 +
  90 + data.add(info);
  91 + }
  92 + }
  93 + // 删除临时文件
  94 + rf.delete();
  95 + res.put("errCode", 0);
  96 + res.put("data", data);
  97 + } catch (IllegalStateException e) {
  98 + // TODO Auto-generated catch block
  99 + e.printStackTrace();
  100 + } catch (IOException e) {
  101 + // TODO Auto-generated catch block
  102 + e.printStackTrace();
  103 + } finally {
  104 + try {
  105 + if (reader != null) reader.close();
  106 + } catch (IOException e) {
  107 + // TODO Auto-generated catch block
  108 + e.printStackTrace();
  109 + }
  110 + }
  111 +
  112 + return res;
  113 + }
  114 +
  115 + @SuppressWarnings("unchecked")
  116 + @RequestMapping(value = "/opened", method = RequestMethod.POST)
  117 + public Map<String, Object> opened(@RequestParam(value = "json")String json) {
  118 + json = StringEscapeUtils.unescapeHtml(json);
  119 + Map<String, Object> res = new HashMap<>();
  120 + List<Map<String, Object>> data = null;
  121 + try {
  122 + data = new ObjectMapper().readValue(json, List.class);
  123 + for (Map<String, Object> info : data) {
  124 + info.put("detail", gpsRealData.findByDeviceId((String)info.get("deviceId")));
  125 + }
  126 +
  127 + res.put("errCode", 0);
  128 + res.put("data", data);
  129 + } catch (JsonParseException e) {
  130 + // TODO Auto-generated catch block
  131 + e.printStackTrace();
  132 + } catch (JsonMappingException e) {
  133 + // TODO Auto-generated catch block
  134 + e.printStackTrace();
  135 + } catch (IOException e) {
  136 + // TODO Auto-generated catch block
  137 + e.printStackTrace();
  138 + }
  139 +
  140 + return res;
  141 + }
  142 +
  143 + @SuppressWarnings("unchecked")
  144 + @RequestMapping(value = "/export", method = RequestMethod.POST)
  145 + public void export(@RequestParam(value = "json")String json, HttpServletResponse response) {
  146 + json = StringEscapeUtils.unescapeHtml(json);
  147 + List<Map<String, Object>> data = null;
  148 + OutputStream out = null;
  149 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  150 + try {
  151 + data = new ObjectMapper().readValue(json, List.class);
  152 + for (Map<String, Object> info : data) {
  153 + Map<String, Object> detail = (Map<String, Object>)info.get("detail");
  154 + if (detail != null) {
  155 + info.put("lineId", detail.get("lineId"));
  156 + info.put("valid", (int)detail.get("valid") == 0 ? "有效" : "无效");
  157 + info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp"))));
  158 + info.put("version", detail.get("version"));
  159 + } else {
  160 + info.put("lineId", "");
  161 + info.put("valid", "");
  162 + info.put("timestamp", "");
  163 + info.put("version", "");
  164 + }
  165 + }
  166 +
  167 + List<Header> head = new ArrayList<>();
  168 + head.add(new Header("线路编码", "lineCode"));
  169 + head.add(new Header("线路名称", "lineName"));
  170 + head.add(new Header("内部编码", "inCode"));
  171 + head.add(new Header("识别码", "deviceId"));
  172 + head.add(new Header("线路ID", "lineId"));
  173 + head.add(new Header("GPS", "valid"));
  174 + head.add(new Header("report", "timestamp"));
  175 + head.add(new Header("版本", "version"));
  176 +
  177 + // 清空response
  178 + response.reset();
  179 + // 设置response的Header
  180 + response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls");
  181 + response.setContentType("application/vnd.ms-excel;charset=UTF-8");
  182 + out = new BufferedOutputStream(response.getOutputStream());
  183 + excel(head, data, out);
  184 + out.flush();
  185 + } catch (JsonParseException e) {
  186 + // TODO Auto-generated catch block
  187 + e.printStackTrace();
  188 + } catch (JsonMappingException e) {
  189 + // TODO Auto-generated catch block
  190 + e.printStackTrace();
  191 + } catch (IOException e) {
  192 + // TODO Auto-generated catch block
  193 + e.printStackTrace();
  194 + } finally {
  195 + try {
  196 + if (out != null) out.close();
  197 + } catch (IOException e) {
  198 + e.printStackTrace();
  199 + }
  200 + }
  201 + }
  202 +
  203 + private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException {
  204 + // 声明一个工作薄
  205 + HSSFWorkbook wb = new HSSFWorkbook();
  206 + // 生成一个表格
  207 + HSSFSheet sheet = wb.createSheet("1");
  208 + // 产生表格标题行
  209 + HSSFRow row = sheet.createRow(0);
  210 + for (int i = 0;i < head.size();i++) {
  211 + HSSFCell cell = row.createCell(i);
  212 + HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe());
  213 + cell.setCellValue(text);
  214 + }
  215 +
  216 + int rownum = 1;
  217 + for (Map<String, Object> map : data) {
  218 + HSSFRow r = sheet.createRow(rownum);
  219 + for (int i = 0;i < head.size();i++) {
  220 + HSSFCell cell = r.createCell(i);
  221 + HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField())));
  222 + cell.setCellValue(text);
  223 + }
  224 + rownum++;
  225 + }
  226 +
  227 + wb.write(out);
  228 + wb.close();
  229 + }
  230 +
  231 + final class Header {
  232 + private String describe;
  233 + private String field;
  234 +
  235 + Header(){
  236 +
  237 + }
  238 +
  239 + Header(String describe, String field) {
  240 + this.describe = describe;
  241 + this.field = field;
  242 + }
  243 +
  244 + public String getDescribe() {
  245 + return describe;
  246 + }
  247 +
  248 + public void setDescribe(String describe) {
  249 + this.describe = describe;
  250 + }
  251 +
  252 + public String getField() {
  253 + return field;
  254 + }
  255 +
  256 + public void setField(String field) {
  257 + this.field = field;
  258 + }
  259 + }
  260 +}
src/main/java/com/bsth/controller/directive/DirectiveController.java
@@ -71,6 +71,30 @@ public class DirectiveController { @@ -71,6 +71,30 @@ public class DirectiveController {
71 SysUser user = SecurityUtils.getCurrentUser(); 71 SysUser user = SecurityUtils.getCurrentUser();
72 return directiveService.lineChange(nbbm, lineId, user.getUserName()); 72 return directiveService.lineChange(nbbm, lineId, user.getUserName());
73 } 73 }
  74 +
  75 + /**
  76 + *
  77 + * @Title: lineChangeByDevice
  78 + * @Description: TODO(切换线路)
  79 + * @param @param deviceId 设备编码
  80 + * @param @param lineId 新线路编码
  81 + * @throws
  82 + */
  83 + @RequestMapping(value = "/lineChangeByDevice", method = RequestMethod.POST)
  84 + public int lineChangeByDevice(@RequestParam String deviceId, @RequestParam String lineId){
  85 + SysUser user = SecurityUtils.getCurrentUser();
  86 + return directiveService.lineChangeByDeviceId(deviceId, lineId, user.getUserName());
  87 + }
  88 +
  89 + /**
  90 + * 刷新线路文件
  91 + * @param deviceId 设备号
  92 + * @return
  93 + */
  94 + @RequestMapping(value = "/refreshLineFile", method = RequestMethod.POST)
  95 + public int refreshLineFile(@RequestParam String deviceId){
  96 + return directiveService.refreshLineFile(deviceId);
  97 + }
74 98
75 /** 99 /**
76 * 100 *
src/main/java/com/bsth/controller/gps/GpsController.java
@@ -4,10 +4,7 @@ import java.util.List; @@ -4,10 +4,7 @@ import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 -import org.springframework.web.bind.annotation.PathVariable;  
8 -import org.springframework.web.bind.annotation.RequestMapping;  
9 -import org.springframework.web.bind.annotation.RequestParam;  
10 -import org.springframework.web.bind.annotation.RestController; 7 +import org.springframework.web.bind.annotation.*;
11 8
12 import com.bsth.data.BasicData; 9 import com.bsth.data.BasicData;
13 import com.bsth.data.gpsdata.GpsEntity; 10 import com.bsth.data.gpsdata.GpsEntity;
@@ -46,6 +43,16 @@ public class GpsController { @@ -46,6 +43,16 @@ public class GpsController {
46 return gpsRealData.get(Splitter.on(",").splitToList(lineCodes)); 43 return gpsRealData.get(Splitter.on(",").splitToList(lineCodes));
47 } 44 }
48 45
  46 + @RequestMapping(value = "/allDevices")
  47 + public Iterable<String> allDevices(){
  48 + return gpsRealData.allDevices();
  49 + }
  50 +
  51 + @RequestMapping(value = "/removeRealGps", method = RequestMethod.POST)
  52 + public Map<String, Object> removeRealGps(@RequestParam String device){
  53 + return gpsService.removeRealGps(device);
  54 + }
  55 +
49 /** 56 /**
50 * 57 *
51 * @Title: history @Description: TODO(这个方法给测试页面用) @throws 58 * @Title: history @Description: TODO(这个方法给测试页面用) @throws
src/main/java/com/bsth/controller/oil/CwjyController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +
  4 +import java.util.Date;
  5 +import java.util.Map;
  6 +
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import com.bsth.controller.BaseController;
  15 +import com.bsth.entity.oil.Cwjy;
  16 +import com.bsth.entity.oil.Ylxxb;
  17 +import com.bsth.entity.sys.SysUser;
  18 +import com.bsth.security.util.SecurityUtils;
  19 +import com.bsth.service.oil.CwjyService;
  20 +import com.bsth.util.PageObject;
  21 +
  22 +@RestController
  23 +@RequestMapping("cwjy")
  24 +public class CwjyController extends BaseController<Cwjy, Integer>{
  25 + @Autowired
  26 + private CwjyService service;
  27 + @RequestMapping(method = RequestMethod.POST)
  28 + public Map<String, Object> save(Cwjy t){
  29 + SysUser sysUser = SecurityUtils.getCurrentUser();
  30 + t.setCreateDate(new Date());
  31 + t.setXgr(sysUser.getUserName());
  32 + return service.save(t);
  33 + }
  34 +
  35 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  36 + public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){
  37 + PageObject<Ylxxb> pagequery=null;
  38 + map.put("curPage", map.get("page").toString());
  39 + map.put("pageData","10");
  40 + pagequery=service.Pagequery(map);
  41 + return pagequery;
  42 + }
  43 +
  44 + @RequestMapping(value="/bynbbm",method = RequestMethod.GET)
  45 + public Ylxxb bynbbm(@RequestParam Map<String, Object> map){
  46 +
  47 + return service.bynbbm(map);
  48 + }
  49 +
  50 + /**
  51 + *
  52 + * @Title: save
  53 + * @Description: TODO(持久化对象)
  54 + * @param @param t
  55 + * @param @return 设定文件
  56 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  57 + * @throws
  58 + */
  59 + @RequestMapping(value="/savejzl",method = RequestMethod.POST)
  60 + public Map<String, Object> savejzl(Ylxxb t){
  61 + Map<String, Object> map=service.savejzl(t);
  62 + return map;
  63 + }
  64 +
  65 +
  66 +}
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -2,7 +2,9 @@ package com.bsth.controller.oil; @@ -2,7 +2,9 @@ package com.bsth.controller.oil;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
4 import java.text.SimpleDateFormat; 4 import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
5 import java.util.Date; 6 import java.util.Date;
  7 +import java.util.Iterator;
6 import java.util.List; 8 import java.util.List;
7 import java.util.Map; 9 import java.util.Map;
8 10
@@ -44,14 +46,47 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -44,14 +46,47 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
44 * @return 46 * @return
45 */ 47 */
46 @RequestMapping(value = "/obtain",method = RequestMethod.GET) 48 @RequestMapping(value = "/obtain",method = RequestMethod.GET)
47 - public List<Map<String, Object>> obtain(@RequestParam Map<String, Object> map){ 49 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map){
48 String rq=map.get("rq").toString(); 50 String rq=map.get("rq").toString();
49 - List<Map<String, Object>> list=yblService.obtain(rq); 51 + Map<String, Object> list=yblService.obtain(rq);
50 System.out.println(); 52 System.out.println();
51 return list; 53 return list;
52 } 54 }
53 55
54 /** 56 /**
  57 + * 拆分油量
  58 + * @param map
  59 + * @return
  60 + */
  61 + @RequestMapping(value = "/sort",method = RequestMethod.GET)
  62 + public Map<String, Object> sort(@RequestParam Map<String, Object> map){
  63 + Map<String, Object> list=yblService.sort(map);
  64 + return list;
  65 + }
  66 +
  67 + /**
  68 + * 进场油量等于出场油量
  69 + * @param map
  70 + * @return
  71 + */
  72 + @RequestMapping(value = "/outAndIn",method = RequestMethod.GET)
  73 + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){
  74 + Map<String, Object> list=yblService.outAndIn(map);
  75 + return list;
  76 + }
  77 +
  78 + /**
  79 + * 核对油量(有加油没里程)
  80 + * @param map
  81 + * @return
  82 + */
  83 + @RequestMapping(value = "/checkYl",method = RequestMethod.GET)
  84 + public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){
  85 + Map<String, Object> list=yblService.checkYl(map);
  86 + return list;
  87 + }
  88 +
  89 + /**
55 * 90 *
56 * @Title: list 91 * @Title: list
57 * @Description: TODO(多条件分页查询) 92 * @Description: TODO(多条件分页查询)
@@ -90,4 +125,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -90,4 +125,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
90 return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); 125 return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
91 } 126 }
92 127
  128 +
  129 + @RequestMapping(value="/oilListMonth")
  130 + public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date){
  131 + return yblService.oilListMonth(line, date);
  132 + }
  133 +
93 } 134 }
src/main/java/com/bsth/controller/oil/YlxxbController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
4 import org.springframework.web.bind.annotation.RestController; 9 import org.springframework.web.bind.annotation.RestController;
5 10
6 import com.bsth.controller.BaseController; 11 import com.bsth.controller.BaseController;
7 import com.bsth.entity.oil.Ylxxb; 12 import com.bsth.entity.oil.Ylxxb;
  13 +import com.bsth.service.oil.YlxxbService;
  14 +import com.bsth.util.PageObject;
8 15
9 @RestController 16 @RestController
10 @RequestMapping("ylxxb") 17 @RequestMapping("ylxxb")
11 public class YlxxbController extends BaseController<Ylxxb, Integer>{ 18 public class YlxxbController extends BaseController<Ylxxb, Integer>{
12 - 19 + @Autowired
  20 + private YlxxbService service;
  21 + @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
  22 + public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){
  23 + PageObject<Ylxxb> pagequery=null;
  24 + map.put("curPage", map.get("page").toString());
  25 + map.put("pageData","10");
  26 + pagequery=service.Pagequery(map);
  27 + return pagequery;
  28 + }
  29 +
  30 +
  31 + /**
  32 + * 核对油量(有加油没里程)
  33 + * @param map
  34 + * @return
  35 + */
  36 + @RequestMapping(value = "/check",method = RequestMethod.GET)
  37 + public Map<String, Object> check(@RequestParam Map<String, Object> map){
  38 + Map<String, Object> list=service.checkJsy(map);
  39 + return list;
  40 + }
13 } 41 }
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
@@ -21,6 +21,11 @@ public class BasicDataController { @@ -21,6 +21,11 @@ public class BasicDataController {
21 return BasicData.deviceId2NbbmMap.values(); 21 return BasicData.deviceId2NbbmMap.values();
22 } 22 }
23 23
  24 + @RequestMapping("/nbbm2deviceId")
  25 + public Map<String, String> nbbm2deviceId(Map<String, Object> map){
  26 + return BasicData.deviceId2NbbmMap.inverse();
  27 + }
  28 +
24 @RequestMapping("/lineCode2Name") 29 @RequestMapping("/lineCode2Name")
25 public Map<String, String> findLineCodeMap(){ 30 public Map<String, String> findLineCodeMap(){
26 return BasicData.lineCode2NameMap; 31 return BasicData.lineCode2NameMap;
@@ -47,6 +52,15 @@ public class BasicDataController { @@ -47,6 +52,15 @@ public class BasicDataController {
47 return rs; 52 return rs;
48 } 53 }
49 54
  55 + @RequestMapping("/all_personnel")
  56 + public Map<String, String> all_personnel(){
  57 + //Map<String, Object> rs = new HashMap<>();
  58 + //PersonnelFieldFilter filter=new PersonnelFieldFilter();
  59 +
  60 + //rs.put("list", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter)));
  61 + return BasicData.allPerson;
  62 + }
  63 +
50 64
51 public class PersonnelFieldFilter implements PropertyFilter{ 65 public class PersonnelFieldFilter implements PropertyFilter{
52 66
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
@@ -21,13 +21,13 @@ public class LineConfigController extends BaseController&lt;LineConfig, Integer&gt;{ @@ -21,13 +21,13 @@ public class LineConfigController extends BaseController&lt;LineConfig, Integer&gt;{
21 LineConfigService lineConfigService; 21 LineConfigService lineConfigService;
22 22
23 @RequestMapping("/check") 23 @RequestMapping("/check")
24 - public Map<String, Object> check(@RequestParam Integer[] codeArray){ 24 + public Map<String, Object> check(@RequestParam String[] codeArray){
25 return lineConfigService.check(codeArray); 25 return lineConfigService.check(codeArray);
26 } 26 }
27 27
28 @RequestMapping("/init/{lineCode}") 28 @RequestMapping("/init/{lineCode}")
29 - public Integer init(@PathVariable("lineCode") Integer lineCode) throws Exception{  
30 - return lineConfigService.inti(lineCode); 29 + public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{
  30 + return lineConfigService.init(lineCode);
31 } 31 }
32 32
33 @RequestMapping(value = "/editTime", method = RequestMethod.POST) 33 @RequestMapping(value = "/editTime", method = RequestMethod.POST)
src/main/java/com/bsth/controller/realcontrol/RealChartsController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.service.realcontrol.RealChartsService;
  4 +import com.bsth.service.realcontrol.dto.CarOutRate;
  5 +import com.bsth.service.realcontrol.dto.DeviceOnlineRate;
  6 +import com.bsth.service.realcontrol.dto.StratEndPunctualityRate;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 线路调度统计图
  16 + * Created by panzhao on 2016/11/9.
  17 + */
  18 +@RestController
  19 +@RequestMapping("realCharts")
  20 +public class RealChartsController {
  21 +
  22 + @Autowired
  23 + RealChartsService realChartsService;
  24 +
  25 + @RequestMapping("deviceOnlineRate")
  26 + public List<DeviceOnlineRate> deviceOnlineRate(@RequestParam String idx, @RequestParam String month){
  27 + return realChartsService.deviceOnlineRate(month, idx);
  28 + }
  29 +
  30 + @RequestMapping("carOutRate")
  31 + public List<CarOutRate> carOutRate(@RequestParam String idx, @RequestParam String month){
  32 + return realChartsService.carOutRate(month, idx);
  33 + }
  34 +
  35 + @RequestMapping("stratEndPunctualityRate")
  36 + public List<StratEndPunctualityRate> stratEndPunctualityRate(@RequestParam String idx, @RequestParam String month){
  37 + return realChartsService.stratEndPunctualityRate(month, idx);
  38 + }
  39 +
  40 + @RequestMapping("sePunctualityRateLine")
  41 + public List<StratEndPunctualityRate> sePunctualityRateLine(@RequestParam String idx, @RequestParam String month){
  42 + return realChartsService.sePunctualityRateLine(month, idx);
  43 + }
  44 +}
src/main/java/com/bsth/controller/report/ReportController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.entity.excep.ArrivalInfo;
  13 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  14 +import com.bsth.service.report.ReportService;
  15 +
  16 +@RestController
  17 +@RequestMapping("report")
  18 +public class ReportController {
  19 +
  20 + @Autowired
  21 + ReportService service;
  22 +
  23 + @RequestMapping(value="/queryListBczx" ,method = RequestMethod.POST)
  24 + public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){
  25 + return service.queryListBczx(line,date,clzbh);
  26 + }
  27 +
  28 + @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.POST)
  29 + public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line,
  30 + @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){
  31 + return service.queryListZdxx(line,date,clzbh,fcsj,ddsj);
  32 + }
  33 + @RequestMapping(value="/queryListClzd" ,method = RequestMethod.POST)
  34 + public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
  35 + @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
  36 + return service.queryListClzd(line,zd,zdlx,fcsj,ddsj);
  37 + }
  38 +
  39 + @RequestMapping(value = "/sreachZd", method = RequestMethod.GET)
  40 + public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) {
  41 + return service.sreachZd(line,zdlx, zd);
  42 + }
  43 +
  44 +
  45 +
  46 + @RequestMapping(value = "/historyMessageCount", method = RequestMethod.GET)
  47 + public List<Object[]> historyMessageCount(@RequestParam String line, @RequestParam String date,
  48 + @RequestParam String code) {
  49 + return service.historyMessageCount(line, date, code);
  50 + }
  51 +
  52 +}
src/main/java/com/bsth/controller/schedule/GuideboardInfoController.java
@@ -8,8 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -8,8 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 import org.springframework.web.bind.annotation.PathVariable; 9 import org.springframework.web.bind.annotation.PathVariable;
10 import org.springframework.web.bind.annotation.RequestMapping; 10 import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
11 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
12 13
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
13 /** 17 /**
14 * Created by xu on 16/5/11. 18 * Created by xu on 16/5/11.
15 */ 19 */
@@ -31,4 +35,10 @@ public class GuideboardInfoController extends BaseController&lt;GuideboardInfo, Lon @@ -31,4 +35,10 @@ public class GuideboardInfoController extends BaseController&lt;GuideboardInfo, Lon
31 public GuideboardInfo findById(@PathVariable("id") Long aLong) { 35 public GuideboardInfo findById(@PathVariable("id") Long aLong) {
32 return guideboardInfoRepository.findOneExtend(aLong); 36 return guideboardInfoRepository.findOneExtend(aLong);
33 } 37 }
  38 +
  39 +
  40 + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)
  41 + public List<Map<String, Object>> findLpName(Long ttid) {
  42 + return guideboardInfoRepository.findLpName(ttid);
  43 + }
34 } 44 }
src/main/java/com/bsth/controller/schedule/RerunController.java 0 → 100644
  1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.schedule.rule.RerunRule;
  5 +import com.bsth.repository.schedule.RerunRuleRepository;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.*;
  8 +
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * Created by xu on 16/10/20.
  13 + */
  14 +@RestController
  15 +@RequestMapping("rms")
  16 +public class RerunController extends BaseController<RerunRule, Long> {
  17 +
  18 + @Autowired
  19 + private RerunRuleRepository rerunRuleRepository;
  20 +
  21 + @Override
  22 + public RerunRule findById(@PathVariable("id") Long aLong) {
  23 + return rerunRuleRepository.findOneExtend(aLong);
  24 + }
  25 +
  26 + /**
  27 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  28 + * @Title: save
  29 + * @Description: TODO(持久化对象)
  30 + * @param @param t
  31 + * @param @return 设定文件
  32 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  33 + * @throws
  34 + */
  35 + @RequestMapping(method = RequestMethod.POST)
  36 + public Map<String, Object> save(@RequestBody RerunRule t){
  37 + return baseService.save(t);
  38 + }
  39 +
  40 +
  41 +}
src/main/java/com/bsth/controller/schedule/TTInfoController.java
1 package com.bsth.controller.schedule; 1 package com.bsth.controller.schedule;
2 2
3 -import com.bsth.controller.BaseController; 3 +import com.bsth.controller.BaseController2;
4 import com.bsth.entity.schedule.TTInfo; 4 import com.bsth.entity.schedule.TTInfo;
5 import com.bsth.repository.schedule.TTInfoDetailRepository; 5 import com.bsth.repository.schedule.TTInfoDetailRepository;
6 import com.bsth.repository.schedule.TTInfoRepository; 6 import com.bsth.repository.schedule.TTInfoRepository;
@@ -18,7 +18,7 @@ import java.util.Map; @@ -18,7 +18,7 @@ import java.util.Map;
18 @RestController 18 @RestController
19 @RequestMapping("tic") 19 @RequestMapping("tic")
20 @EnableConfigurationProperties(DataToolsProperties.class) 20 @EnableConfigurationProperties(DataToolsProperties.class)
21 -public class TTInfoController extends BaseController<TTInfo, Long> { 21 +public class TTInfoController extends BaseController2<TTInfo, Long> {
22 @Autowired 22 @Autowired
23 private DataToolsProperties dataToolsProperties; 23 private DataToolsProperties dataToolsProperties;
24 @Autowired 24 @Autowired
@@ -31,20 +31,6 @@ public class TTInfoController extends BaseController&lt;TTInfo, Long&gt; { @@ -31,20 +31,6 @@ public class TTInfoController extends BaseController&lt;TTInfo, Long&gt; {
31 return dataToolsProperties.getTtinfoDatainputktr(); 31 return dataToolsProperties.getTtinfoDatainputktr();
32 } 32 }
33 33
34 - /**  
35 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
36 - * @Title: save  
37 - * @Description: TODO(持久化对象)  
38 - * @param @param t  
39 - * @param @return 设定文件  
40 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
41 - * @throws  
42 - */  
43 - @RequestMapping(method = RequestMethod.POST)  
44 - public Map<String, Object> save(@RequestBody TTInfo t){  
45 - return baseService.save(t);  
46 - }  
47 -  
48 @Override 34 @Override
49 public TTInfo findById(@PathVariable("id") Long aLong) { 35 public TTInfo findById(@PathVariable("id") Long aLong) {
50 return ttInfoRepository.findOneExtend(aLong); 36 return ttInfoRepository.findOneExtend(aLong);
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
@@ -4,19 +4,32 @@ import com.bsth.common.ResponseCode; @@ -4,19 +4,32 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.controller.BaseController; 4 import com.bsth.controller.BaseController;
5 import com.bsth.entity.CarPark; 5 import com.bsth.entity.CarPark;
6 import com.bsth.entity.LineInformation; 6 import com.bsth.entity.LineInformation;
  7 +import com.bsth.entity.StationRoute;
  8 +import com.bsth.entity.schedule.GuideboardInfo;
7 import com.bsth.entity.schedule.TTInfoDetail; 9 import com.bsth.entity.schedule.TTInfoDetail;
8 import com.bsth.repository.schedule.TTInfoDetailRepository; 10 import com.bsth.repository.schedule.TTInfoDetailRepository;
9 import com.bsth.service.CarParkService; 11 import com.bsth.service.CarParkService;
10 import com.bsth.service.LineInformationService; 12 import com.bsth.service.LineInformationService;
11 -import com.bsth.service.schedule.TTInfoDetailServiceImpl; 13 +import com.bsth.service.StationRouteService;
  14 +import com.bsth.service.schedule.GuideboardInfoService;
  15 +import com.bsth.service.schedule.TTInfoDetailService;
  16 +import com.bsth.service.schedule.utils.DataImportExportService;
  17 +import jxl.Cell;
  18 +import jxl.Sheet;
  19 +import jxl.Workbook;
  20 +import jxl.write.Label;
  21 +import jxl.write.WritableSheet;
  22 +import jxl.write.WritableWorkbook;
12 import org.apache.commons.lang3.StringUtils; 23 import org.apache.commons.lang3.StringUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.util.CollectionUtils;
14 import org.springframework.web.bind.annotation.*; 26 import org.springframework.web.bind.annotation.*;
15 import org.springframework.web.multipart.MultipartFile; 27 import org.springframework.web.multipart.MultipartFile;
16 28
17 -import java.util.HashMap;  
18 -import java.util.Iterator;  
19 -import java.util.Map; 29 +import java.io.File;
  30 +import java.util.*;
  31 +import java.util.regex.Matcher;
  32 +import java.util.regex.Pattern;
20 33
21 /** 34 /**
22 * Created by xu on 16/7/2. 35 * Created by xu on 16/7/2.
@@ -25,14 +38,340 @@ import java.util.Map; @@ -25,14 +38,340 @@ import java.util.Map;
25 @RequestMapping("tidc") 38 @RequestMapping("tidc")
26 public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { 39 public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> {
27 @Autowired 40 @Autowired
28 - private TTInfoDetailServiceImpl ttInfoDetailService; 41 + private TTInfoDetailService ttInfoDetailService;
29 @Autowired 42 @Autowired
30 private CarParkService carParkService; 43 private CarParkService carParkService;
31 @Autowired 44 @Autowired
32 private LineInformationService lineInformationService; 45 private LineInformationService lineInformationService;
33 @Autowired 46 @Autowired
34 private TTInfoDetailRepository ttInfoDetailRepository; 47 private TTInfoDetailRepository ttInfoDetailRepository;
  48 + @Autowired
  49 + private DataImportExportService dataImportExportService;
  50 + @Autowired
  51 + private StationRouteService stationRouteService;
  52 + @Autowired
  53 + private GuideboardInfoService guideboardInfoService;
  54 +
  55 +
  56 + public static class ExcelFileOutput {
  57 + private String fileName;
  58 + private List<Map<String, Object>> sheetnames = new ArrayList<>();
  59 +
  60 + public String getFileName() {
  61 + return fileName;
  62 + }
  63 +
  64 + public void setFileName(String fileName) {
  65 + this.fileName = fileName;
  66 + }
  67 +
  68 + public List<Map<String, Object>> getSheetnames() {
  69 + return sheetnames;
  70 + }
  71 +
  72 + public void setSheetnames(List<Map<String, Object>> sheetnames) {
  73 + this.sheetnames = sheetnames;
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 1、上传Excel文件,返回文件全路径名,工作区名称列表。
  79 + * @param file
  80 + * @return
  81 + * @throws Exception
  82 + */
  83 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  84 + public ExcelFileOutput fileUpload(MultipartFile file) throws Exception {
  85 + // 返回对象
  86 + ExcelFileOutput rs = new ExcelFileOutput();
  87 +
  88 + // 上传文件
  89 + File file1 = dataImportExportService.uploadFile(file);
  90 + // 获取文件的sheet
  91 + Workbook book = Workbook.getWorkbook(file1);
  92 + for (Sheet sheet : book.getSheets()) {
  93 + String sheetname = sheet.getName();
  94 + Map<String, Object> s = new HashMap<>();
  95 + s.put("name", sheetname);
  96 + rs.getSheetnames().add(s);
  97 + }
  98 +
  99 + rs.setFileName(file1.getAbsolutePath());
  100 + return rs;
  101 + }
  102 +
  103 + /**
  104 + * 2、验证sheet(以后放到规则引擎里去做)。
  105 + * @param filename excel文件全路径名
  106 + * @param sheetname sheet名字
  107 + * @param lineid 线路id
  108 + * @param linename 线路名称
  109 + * @return
  110 + */
  111 + @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
  112 + public Map<String, Object> validateSheet(String filename, String sheetname, Integer lineid, String linename) throws Exception {
  113 + Map<String, Object> rtn = new HashMap<>();
  114 + Workbook book = Workbook.getWorkbook(new File(filename));
  115 + Sheet sheet = book.getSheet(sheetname);
  116 + if (sheet.getRows() == 0 || sheet.getColumns() == 0) { // 工作区是否为空
  117 + rtn.put("status", ResponseCode.ERROR);
  118 + rtn.put("msg", String.format("%s 工作区没有数据!", sheetname));
  119 + } else {
  120 + if (sheet.getRows() <= 1 || sheet.getColumns() <= 1) {
  121 + rtn.put("status", ResponseCode.ERROR);
  122 + rtn.put("msg", String.format("工作区至少包含2行2列的数据"));
  123 + return rtn;
  124 + } else {
  125 + Cell[] cells = sheet.getRow(0); // 获取第一行数据列
  126 + for (int i = 0; i < cells.length; i++) {
  127 + String cell_con = cells[i].getContents();
  128 + if (StringUtils.isEmpty(cell_con)) {
  129 + rtn.put("status", ResponseCode.ERROR);
  130 + rtn.put("msg", String.format("第1行,第%d列数据不能为空", i + 1));
  131 + return rtn;
  132 + } else {
  133 + if (i == 0) { // 第一列必须是路牌2个字
  134 + if (!"路牌".equals(cell_con.trim())) {
  135 + rtn.put("status", ResponseCode.ERROR);
  136 + rtn.put("msg", "第1行,第1列数据必须是路牌2个字");
  137 + return rtn;
  138 + }
  139 + } else { // 排除出场,进场,其余内容到站点路由里查询,以各个方向的起点站为查询依据
  140 + if ((!"出场".equals(cell_con.trim())) &&
  141 + (!"进场".equals(cell_con.trim()))) {
  142 + Map<String, Object> p1 = new HashMap<>();
  143 + p1.put("line.id_eq", lineid);
  144 + p1.put("stationName_eq", cell_con.trim());
  145 + p1.put("stationMark_eq", "B");
  146 +
  147 + List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
  148 + if (CollectionUtils.isEmpty(stationRouteList)) {
  149 + rtn.put("status", ResponseCode.ERROR);
  150 + rtn.put("msg", String.format("第1行,第%d列数据在%s站点路由中不是起点站", i + 1, linename));
  151 + return rtn;
  152 + } else if (stationRouteList.size() > 1) {
  153 + rtn.put("status", ResponseCode.ERROR);
  154 + rtn.put("msg", String.format("第1行,第%d列数据在%s站点路由中上下行都是起点站", i + 1, linename));
  155 + return rtn;
  156 + }
  157 + }
  158 +
  159 + }
  160 + }
  161 + }
  162 +
  163 + // 验证路牌内容
  164 + Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
  165 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  166 + Cell bcell = sheet.getRow(i)[0]; // 获取第1列
  167 + String bcell_con = bcell.getContents();
  168 + if (StringUtils.isEmpty(bcell_con)) {
  169 + rtn.put("status", ResponseCode.ERROR);
  170 + rtn.put("msg", String.format("第%d行,第1列路牌无数据", i + 1));
  171 + return rtn;
  172 + } else if (gbindexmap.get(bcell_con.trim()) != null) {
  173 + rtn.put("status", ResponseCode.ERROR);
  174 + rtn.put("msg", String.format("第%d行,第1列的路牌数据与第%d行,第1列数据重复",
  175 + i + 1,
  176 + gbindexmap.get(bcell_con.trim())));
  177 + return rtn;
  178 + } else {
  179 + Map<String, Object> p2 = new HashMap<>();
  180 + p2.put("xl.id_eq", lineid);
  181 + p2.put("lpName_eq", bcell_con.trim());
  182 + List<GuideboardInfo> guideboardInfoList = (List<GuideboardInfo>) guideboardInfoService.list(p2);
  183 + if (CollectionUtils.isEmpty(guideboardInfoList)) {
  184 + rtn.put("status", ResponseCode.ERROR);
  185 + rtn.put("msg", String.format("第%d行,第1列的路牌在%s中不存在", i + 1, linename));
  186 + return rtn;
  187 + } else if (guideboardInfoList.size() > 1) {
  188 + rtn.put("status", ResponseCode.ERROR);
  189 + rtn.put("msg", String.format("第%d行,第1列的路牌在%s中重复", i + 1, linename));
  190 + return rtn;
  191 + } else {
  192 + gbindexmap.put(bcell_con.trim(), i + 1);
  193 + }
  194 + }
  195 + }
35 196
  197 + // 班次时间验证,正则表达式,格式hh:mm或者hhmm
  198 + String el = "^(([0-1]\\d)|(2[0-4])):[0-5]\\d$"; // hh:mm格式
  199 + String el2 = "^(([0-1]\\d)|(2[0-4]))[0-5]\\d$"; // hhmm格式
  200 + Pattern p = Pattern.compile(el);
  201 + Pattern p2 = Pattern.compile(el2);
  202 +
  203 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  204 + Cell[] bcells = sheet.getRow(i);
  205 + for (int j = 1; j < bcells.length; j++) { // 从第2列开始
  206 + String bcell_con = bcells[j].getContents();
  207 + if (StringUtils.isNotEmpty(bcell_con)) {
  208 + Matcher m = p.matcher(bcell_con.trim());
  209 + Matcher m2 = p2.matcher(bcell_con.trim());
  210 + if ((!m.matches()) && (!m2.matches())) {
  211 + rtn.put("status", ResponseCode.ERROR);
  212 + rtn.put("msg", String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hhmm", i + 1, j + 1));
  213 + return rtn;
  214 + }
  215 + }
  216 + }
  217 + }
  218 + }
  219 +
  220 + }
  221 +
  222 + rtn.put("status", ResponseCode.SUCCESS);
  223 + return rtn;
  224 + }
  225 +
  226 + /**
  227 + * 3、验证关联的线路标准信息(以后放到规则引擎里去做)。
  228 + * @param lineinfoid
  229 + * @return
  230 + */
  231 + @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET)
  232 + public Map<String, Object> validateAssoLineInfo(Integer lineinfoid) {
  233 + Map<String, Object> rtn = new HashMap<>();
  234 + LineInformation lineInformation = lineInformationService.findById(lineinfoid);
  235 + if (lineInformation.getUpInMileage() == null) {
  236 + rtn.put("status", ResponseCode.ERROR);
  237 + rtn.put("msg", "上行进场里程为空");
  238 + return rtn;
  239 + } else if (lineInformation.getUpInTimer() == null) {
  240 + rtn.put("status", ResponseCode.ERROR);
  241 + rtn.put("msg", "上行进场时间为空");
  242 + return rtn;
  243 + } else if (lineInformation.getUpOutMileage() == null) {
  244 + rtn.put("status", ResponseCode.ERROR);
  245 + rtn.put("msg", "上行出场里程为空");
  246 + return rtn;
  247 + } else if (lineInformation.getUpOutTimer() == null) {
  248 + rtn.put("status", ResponseCode.ERROR);
  249 + rtn.put("msg", "上行出场时间为空");
  250 + return rtn;
  251 + } else if (lineInformation.getUpMileage() == null) {
  252 + rtn.put("status", ResponseCode.ERROR);
  253 + rtn.put("msg", "上行班次里程为空");
  254 + return rtn;
  255 + } else if (lineInformation.getUpTravelTime() == null) {
  256 + rtn.put("status", ResponseCode.ERROR);
  257 + rtn.put("msg", "上行班次时间为空");
  258 + return rtn;
  259 + } else if (lineInformation.getDownInMileage() == null) {
  260 + rtn.put("status", ResponseCode.ERROR);
  261 + rtn.put("msg", "下行进场里程为空");
  262 + return rtn;
  263 + } else if (lineInformation.getDownInTimer() == null) {
  264 + rtn.put("status", ResponseCode.ERROR);
  265 + rtn.put("msg", "下行进场时间为空");
  266 + return rtn;
  267 + } else if (lineInformation.getDownOutMileage() == null) {
  268 + rtn.put("status", ResponseCode.ERROR);
  269 + rtn.put("msg", "下行出场里程为空");
  270 + return rtn;
  271 + } else if (lineInformation.getDownOutTimer() == null) {
  272 + rtn.put("status", ResponseCode.ERROR);
  273 + rtn.put("msg", "下行出场时间为空");
  274 + return rtn;
  275 + } else if (lineInformation.getDownMileage() == null) {
  276 + rtn.put("status", ResponseCode.ERROR);
  277 + rtn.put("msg", "下行班次里程为空");
  278 + return rtn;
  279 + } else if (lineInformation.getDownTravelTime() == null) {
  280 + rtn.put("status", ResponseCode.ERROR);
  281 + rtn.put("msg", "下行班次时间为空");
  282 + return rtn;
  283 + } else if (StringUtils.isEmpty(lineInformation.getCarPark())) {
  284 + rtn.put("status", ResponseCode.ERROR);
  285 + rtn.put("msg", "停车场必须选择");
  286 + return rtn;
  287 + }
  288 +
  289 + // 单独验证停车场信息
  290 + String tcccode = lineInformation.getCarPark();
  291 + Map<String, Object> p1 = new HashMap<>();
  292 + p1.put("parkCode_eq", tcccode);
  293 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  294 + if (CollectionUtils.isEmpty(carParkList)) {
  295 + rtn.put("status", ResponseCode.ERROR);
  296 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中未找到", tcccode));
  297 + return rtn;
  298 + } else if (carParkList.size() > 1) {
  299 + rtn.put("status", ResponseCode.ERROR);
  300 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中有重复数据", tcccode));
  301 + return rtn;
  302 + } else {
  303 + CarPark carPark = carParkList.get(0);
  304 + if (StringUtils.isEmpty(carPark.getParkName())) {
  305 + rtn.put("status", ResponseCode.ERROR);
  306 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中没有停车场名字", tcccode));
  307 + return rtn;
  308 + }
  309 + }
  310 +
  311 + rtn.put("status", ResponseCode.SUCCESS);
  312 + return rtn;
  313 + }
  314 +
  315 + /**
  316 + * 4、导入时刻表明细数据。
  317 + * @param form
  318 + * @return
  319 + */
  320 + @RequestMapping(value = "/importfile", method = RequestMethod.POST)
  321 + public Map<String, Object> importTTinfo(@RequestParam Map<String, Object> form) throws Exception {
  322 + Map<String, Object> rtn = new HashMap<>();
  323 +
  324 + // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次
  325 + // 2、由于格式问题,需要把内容都转换成字符串
  326 + String filename = (String) form.get("filename");
  327 + List<String> colList = new ArrayList<>();
  328 + Workbook workbook = Workbook.getWorkbook(new File(filename));
  329 + Sheet sheet = workbook.getSheet((String) form.get("sheetname"));
  330 + Cell[] cells = sheet.getRow(0);
  331 + for (int i = 0; i < cells.length; i++) {
  332 + if (i == 0) {
  333 + colList.add(cells[i].getContents().trim());
  334 + } else {
  335 + colList.add(cells[i].getContents() + i);
  336 + }
  337 + }
  338 +
  339 + WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File(filename + "_temp.xls"), workbook);
  340 + WritableSheet sheet1 = writableWorkbook.getSheet((String) form.get("sheetname"));
  341 + for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据
  342 + sheet1.addCell(new Label(i, 0, colList.get(i)));
  343 + }
  344 + for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始
  345 + Cell[] cells1 = sheet.getRow(i);
  346 + for (int j = 0; j < cells1.length; j++) {
  347 + sheet1.addCell(new Label(j, i, cells1[j].getContents()));
  348 + }
  349 + }
  350 + writableWorkbook.write();
  351 + writableWorkbook.close();
  352 +
  353 + // 2、删除原有数据
  354 + ttInfoDetailService.deleteByTtinfo(Long.valueOf(form.get("ttid").toString()));
  355 +
  356 + // 3、导入时刻表
  357 + // 获取停车场名字
  358 + LineInformation lineInformation = lineInformationService.findById(Integer.valueOf(form.get("lineinfo").toString()));
  359 + Map<String, Object> p1 = new HashMap<>();
  360 + p1.put("parkCode_eq", lineInformation.getCarPark());
  361 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  362 + String tccname = carParkList.get(0).getParkName();
  363 +
  364 + ttInfoDetailService.fileDataImport(
  365 + new File(filename + "_temp.xls"),
  366 + (String) form.get("xlname"),
  367 + (String) form.get("ttname"),
  368 + tccname
  369 + );
  370 +
  371 + return rtn;
  372 + }
  373 +
  374 + //------------- 旧版本 --------------//
36 @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST) 375 @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST)
37 public Map<String, Object> uploadDataAndImport( 376 public Map<String, Object> uploadDataAndImport(
38 MultipartFile file, String xlmc, String ttinfoname) throws Exception { 377 MultipartFile file, String xlmc, String ttinfoname) throws Exception {
@@ -111,4 +450,9 @@ public class TTInfoDetailController extends BaseController&lt;TTInfoDetail, Long&gt; { @@ -111,4 +450,9 @@ public class TTInfoDetailController extends BaseController&lt;TTInfoDetail, Long&gt; {
111 public TTInfoDetail findById(@PathVariable("id") Long aLong) { 450 public TTInfoDetail findById(@PathVariable("id") Long aLong) {
112 return ttInfoDetailRepository.findOneExtend(aLong); 451 return ttInfoDetailRepository.findOneExtend(aLong);
113 } 452 }
  453 +
  454 + @RequestMapping(value = "/bcdetail", method = RequestMethod.GET)
  455 + public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
  456 + return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId);
  457 + }
114 } 458 }
src/main/java/com/bsth/controller/sys/util/RSAUtils.java
@@ -10,10 +10,14 @@ import java.security.interfaces.RSAPublicKey; @@ -10,10 +10,14 @@ import java.security.interfaces.RSAPublicKey;
10 import javax.crypto.Cipher; 10 import javax.crypto.Cipher;
11 11
12 import org.apache.commons.net.util.Base64; 12 import org.apache.commons.net.util.Base64;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
13 15
14 public class RSAUtils { 16 public class RSAUtils {
15 private static final KeyPair keyPair = initKey(); 17 private static final KeyPair keyPair = initKey();
16 - 18 +
  19 + static Logger logger = LoggerFactory.getLogger(RSAUtils.class);
  20 +
17 private static KeyPair initKey(){ 21 private static KeyPair initKey(){
18 try { 22 try {
19 Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); 23 Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
@@ -41,6 +45,7 @@ public class RSAUtils { @@ -41,6 +45,7 @@ public class RSAUtils {
41 * @return 45 * @return
42 */ 46 */
43 public static String decryptBase64(String string) { 47 public static String decryptBase64(String string) {
  48 + logger.info("decryptBase64 -[" + string + "]");
44 return new String(decrypt(Base64.decodeBase64(string))); 49 return new String(decrypt(Base64.decodeBase64(string)));
45 } 50 }
46 51
src/main/java/com/bsth/data/BasicData.java
@@ -140,7 +140,7 @@ public class BasicData implements CommandLineRunner{ @@ -140,7 +140,7 @@ public class BasicData implements CommandLineRunner{
140 //车辆和线路映射信息 140 //车辆和线路映射信息
141 loadNbbm2LineInfo(); 141 loadNbbm2LineInfo();
142 //站点路由信息 142 //站点路由信息
143 - loadStationRouteInfo(); 143 + loadStationRouteInfo();
144 //人员信息 144 //人员信息
145 loadPersonnelInfo(); 145 loadPersonnelInfo();
146 logger.info("加载基础数据成功!," ); 146 logger.info("加载基础数据成功!," );
src/main/java/com/bsth/data/LineConfigData.java
@@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner { @@ -77,7 +77,7 @@ public class LineConfigData implements CommandLineRunner {
77 * @Title: init 77 * @Title: init
78 * @Description: TODO(初始化配置信息) 78 * @Description: TODO(初始化配置信息)
79 */ 79 */
80 - public void init(Integer lineCode) throws Exception{ 80 + public void init(String lineCode) throws Exception{
81 LineConfig conf = new LineConfig(); 81 LineConfig conf = new LineConfig();
82 //线路 82 //线路
83 Line line = lineService.findByLineCode(lineCode); 83 Line line = lineService.findByLineCode(lineCode);
src/main/java/com/bsth/data/arrival/AnalyseData.java
@@ -78,6 +78,9 @@ public class AnalyseData { @@ -78,6 +78,9 @@ public class AnalyseData {
78 && curr.getTs() - prve.getTs() < SHIFT_TIME){ 78 && curr.getTs() - prve.getTs() < SHIFT_TIME){
79 prve.setEnable(false); 79 prve.setEnable(false);
80 } 80 }
  81 +// else if(curr.getInOut()){
  82 +// //curr.getTs() - prve.getTs() < 30000
  83 +// }
81 } 84 }
82 else{ 85 else{
83 //上下行的同名站,新走向的第一个出站信号开始有效 86 //上下行的同名站,新走向的第一个出站信号开始有效
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
@@ -50,8 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -50,8 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{
50 50
51 @Override 51 @Override
52 public void run(String... arg0) throws Exception { 52 public void run(String... arg0) throws Exception {
53 - logger.info("ArrivalData_GPS,30,10");  
54 - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS); 53 + logger.info("ArrivalData_GPS,100,10 @11-11");
  54 + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 100, 10, TimeUnit.SECONDS);
55 } 55 }
56 56
57 @Component 57 @Component
@@ -144,4 +144,4 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -144,4 +144,4 @@ public class ArrivalData_GPS implements CommandLineRunner{
144 carIndexMap.put(nbbm, size); 144 carIndexMap.put(nbbm, size);
145 return rs; 145 return rs;
146 } 146 }
147 -} 147 +}
148 \ No newline at end of file 148 \ No newline at end of file
src/main/java/com/bsth/data/arrival/DataLoader.java
@@ -58,7 +58,7 @@ public class DataLoader { @@ -58,7 +58,7 @@ public class DataLoader {
58 PreparedStatement ps = null; 58 PreparedStatement ps = null;
59 ResultSet rs = null; 59 ResultSet rs = null;
60 60
61 - String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; 61 + String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date";
62 try{ 62 try{
63 long t = System.currentTimeMillis(); 63 long t = System.currentTimeMillis();
64 64
src/main/java/com/bsth/data/directive/DayOfDirectives.java
@@ -91,9 +91,11 @@ public class DayOfDirectives { @@ -91,9 +91,11 @@ public class DayOfDirectives {
91 break; 91 break;
92 case 1: 92 case 1:
93 d60.setReply46((short) 0);// 发送成功 93 d60.setReply46((short) 0);// 发送成功
  94 + d60.setReply46Time(System.currentTimeMillis());
94 break; 95 break;
95 case 2: 96 case 2:
96 d60.setReply47((short) 0);// 驾驶员阅读 97 d60.setReply47((short) 0);// 驾驶员阅读
  98 + d60.setReply47Time(System.currentTimeMillis());
97 break; 99 break;
98 } 100 }
99 // 入库 101 // 入库
src/main/java/com/bsth/data/directive/DirectiveCreator.java
@@ -122,30 +122,33 @@ public class DirectiveCreator { @@ -122,30 +122,33 @@ public class DirectiveCreator {
122 122
123 /** 123 /**
124 * 124 *
125 - * @Title: createDirective64 125 + * @Title: createD64
126 * @Description: TODO(创建线路切换指令 64) 126 * @Description: TODO(创建线路切换指令 64)
127 * @param @param nbbm 车辆内部编码 127 * @param @param nbbm 车辆内部编码
128 * @param @param lineId 线路编码 128 * @param @param lineId 线路编码
129 * @param @param t 时间戳 129 * @param @param t 时间戳
130 * @throws 130 * @throws
131 - */ 131 +
132 public D64 createD64(String nbbm, String lineCode, long t){ 132 public D64 createD64(String nbbm, String lineCode, long t){
133 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); 133 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  134 + return create64(deviceId, lineCode, t);
  135 + }*/
134 136
  137 + public D64 create64(String deviceId, String lineCode, long t){
135 D64 change = new D64(); 138 D64 change = new D64();
136 D64Data data = new D64Data(); 139 D64Data data = new D64Data();
137 data.setCityCode(cityCode); 140 data.setCityCode(cityCode);
138 data.setDeviceId(deviceId); 141 data.setDeviceId(deviceId);
139 - 142 +
140 //线路编码补满6位数 143 //线路编码补满6位数
141 String lineCodeStr = padLeft(lineCode, 6, '0'); 144 String lineCodeStr = padLeft(lineCode, 6, '0');
142 data.setLineId(lineCodeStr); 145 data.setLineId(lineCodeStr);
143 - 146 +
144 change.setDeviceId(deviceId); 147 change.setDeviceId(deviceId);
145 change.setOperCode((short) 0X64); 148 change.setOperCode((short) 0X64);
146 change.setTimestamp(t); 149 change.setTimestamp(t);
147 change.setData(data); 150 change.setData(data);
148 - 151 +
149 return change; 152 return change;
150 } 153 }
151 154
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 9 import org.springframework.stereotype.Component;
10 10
  11 +import com.bsth.data.match.Arrival2Schedule;
  12 +import com.bsth.data.match.ExpectArrivalEnd;
11 import com.bsth.data.schedule.DayOfSchedule; 13 import com.bsth.data.schedule.DayOfSchedule;
12 import com.bsth.entity.realcontrol.ScheduleRealInfo; 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 import com.bsth.service.directive.DirectiveService; 15 import com.bsth.service.directive.DirectiveService;
@@ -43,9 +45,7 @@ public class FirstScheduleCheckThread extends Thread{ @@ -43,9 +45,7 @@ public class FirstScheduleCheckThread extends Thread{
43 List<ScheduleRealInfo> schList; 45 List<ScheduleRealInfo> schList;
44 ScheduleRealInfo first; 46 ScheduleRealInfo first;
45 for(String car : cars){ 47 for(String car : cars){
46 - if(car.equals("SXC-CD1004")){  
47 - System.out.println("debugger...");  
48 - } 48 +
49 schList = dayOfSchedule.findByNbbm(car); 49 schList = dayOfSchedule.findByNbbm(car);
50 50
51 if(null == schList || schList.size() == 0) 51 if(null == schList || schList.size() == 0)
@@ -65,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{ @@ -65,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{
65 && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){ 65 && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){
66 66
67 directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统"); 67 directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统");
  68 + //期望完成出场班次时间
  69 + long endTime;
  70 +
  71 + if(first.getZdsj() != null)
  72 + endTime=first.getZdsjT() - 60000;
  73 + else
  74 + endTime=schList.get(1).getDfsjT() - 60000;
  75 +
  76 + ExpectArrivalEnd ead = new ExpectArrivalEnd()
  77 + ,ead2 = new ExpectArrivalEnd();
  78 + ead.setNbbm(car);
  79 + ead.setEndStation(first.getQdzCode());
  80 + ead.setEndTime(endTime);
  81 +
  82 + ead2.setNbbm(car);
  83 + ead2.setEndStation(first.getZdzCode());
  84 + ead2.setEndTime(endTime);
  85 +
  86 + Arrival2Schedule.addExpect(car, ead);
  87 + Arrival2Schedule.addExpect(car, ead2);
68 } 88 }
69 } 89 }
70 } 90 }
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
@@ -52,7 +52,7 @@ public class GatewayHttpUtils { @@ -52,7 +52,7 @@ public class GatewayHttpUtils {
52 post.setEntity(new StringEntity(jsonStr, "utf-8")); 52 post.setEntity(new StringEntity(jsonStr, "utf-8"));
53 53
54 CloseableHttpResponse response = httpClient.execute(post); 54 CloseableHttpResponse response = httpClient.execute(post);
55 - 55 +
56 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); 56 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
57 if(null != json && json.getInteger("errCode") == 0) 57 if(null != json && json.getInteger("errCode") == 0)
58 code = 0; 58 code = 0;
src/main/java/com/bsth/data/forecast/SampleTimeDataLoader.java
1 package com.bsth.data.forecast; 1 package com.bsth.data.forecast;
2 2
3 -import java.text.SimpleDateFormat;  
4 import java.util.ArrayList; 3 import java.util.ArrayList;
5 import java.util.Collections; 4 import java.util.Collections;
6 import java.util.Comparator; 5 import java.util.Comparator;
@@ -9,6 +8,8 @@ import java.util.Iterator; @@ -9,6 +8,8 @@ import java.util.Iterator;
9 import java.util.List; 8 import java.util.List;
10 import java.util.Set; 9 import java.util.Set;
11 10
  11 +import org.joda.time.format.DateTimeFormat;
  12 +import org.joda.time.format.DateTimeFormatter;
12 import org.slf4j.Logger; 13 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,14 +40,14 @@ public class SampleTimeDataLoader extends Thread { @@ -39,14 +40,14 @@ public class SampleTimeDataLoader extends Thread {
39 // 当天日期 40 // 当天日期
40 String rq; 41 String rq;
41 42
42 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); 43 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm")
  44 + ,fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
43 45
44 Logger logger = LoggerFactory.getLogger(this.getClass()); 46 Logger logger = LoggerFactory.getLogger(this.getClass());
45 47
46 @Override 48 @Override
47 public void run() { 49 public void run() {
48 - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");  
49 - rq = sdfyyyyMMdd.format(new Date()); 50 + rq = fmtyyyyMMdd.print(new Date().getTime());
50 51
51 Iterator<Sample> iterator = sampleRepository.findAll().iterator(); 52 Iterator<Sample> iterator = sampleRepository.findAll().iterator();
52 ArrayListMultimap<String, Sample> sampleMap = ArrayListMultimap.create(); 53 ArrayListMultimap<String, Sample> sampleMap = ArrayListMultimap.create();
@@ -103,8 +104,9 @@ public class SampleTimeDataLoader extends Thread { @@ -103,8 +104,9 @@ public class SampleTimeDataLoader extends Thread {
103 TimeRange tg; 104 TimeRange tg;
104 for (Sample s : list) { 105 for (Sample s : list) {
105 tg = new TimeRange(); 106 tg = new TimeRange();
106 - tg.startTime = sdfyyyyMMddHHmm.parse(rq + s.getsDate()).getTime();  
107 - tg.endTime = sdfyyyyMMddHHmm.parse(rq + s.geteDate()).getTime(); 107 +
  108 + tg.startTime = fmtyyyyMMddHHmm.parseMillis(rq + s.getsDate());
  109 + tg.endTime = fmtyyyyMMddHHmm.parseMillis(rq + s.geteDate());
108 tg.runTime = s.getRunTime(); 110 tg.runTime = s.getRunTime();
109 simple.ranges.add(tg); 111 simple.ranges.add(tg);
110 } 112 }
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -66,6 +66,10 @@ public class GpsEntity { @@ -66,6 +66,10 @@ public class GpsEntity {
66 66
67 /** 是否异常数据 */ 67 /** 是否异常数据 */
68 private boolean abnormal; 68 private boolean abnormal;
  69 +
  70 + private int valid;
  71 +
  72 + private int version;
69 73
70 public Integer getCompanyCode() { 74 public Integer getCompanyCode() {
71 return companyCode; 75 return companyCode;
@@ -218,4 +222,20 @@ public class GpsEntity { @@ -218,4 +222,20 @@ public class GpsEntity {
218 public void setAbnormal(boolean abnormal) { 222 public void setAbnormal(boolean abnormal) {
219 this.abnormal = abnormal; 223 this.abnormal = abnormal;
220 } 224 }
  225 +
  226 + public int getValid() {
  227 + return valid;
  228 + }
  229 +
  230 + public void setValid(int valid) {
  231 + this.valid = valid;
  232 + }
  233 +
  234 + public int getVersion() {
  235 + return version;
  236 + }
  237 +
  238 + public void setVersion(int version) {
  239 + this.version = version;
  240 + }
221 } 241 }
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -2,12 +2,7 @@ package com.bsth.data.gpsdata; @@ -2,12 +2,7 @@ package com.bsth.data.gpsdata;
2 2
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;  
6 -import java.util.Collection;  
7 -import java.util.HashMap;  
8 -import java.util.List;  
9 -import java.util.Map;  
10 -import java.util.NavigableSet; 5 +import java.util.*;
11 import java.util.concurrent.TimeUnit; 6 import java.util.concurrent.TimeUnit;
12 7
13 import org.apache.commons.lang3.StringUtils; 8 import org.apache.commons.lang3.StringUtils;
@@ -34,7 +29,7 @@ import com.google.common.collect.TreeMultimap; @@ -34,7 +29,7 @@ import com.google.common.collect.TreeMultimap;
34 29
35 /** 30 /**
36 * 31 *
37 - * @ClassName: GpsRealEntityBuffer 32 + * @ClassName: GpsRealData
38 * @Description: TODO(实时GPS数据集合) 33 * @Description: TODO(实时GPS数据集合)
39 * @author PanZhao 34 * @author PanZhao
40 * @date 2016年8月12日 下午2:04:41 35 * @date 2016年8月12日 下午2:04:41
@@ -72,7 +67,8 @@ public class GpsRealData implements CommandLineRunner{ @@ -72,7 +67,8 @@ public class GpsRealData implements CommandLineRunner{
72 67
73 @Override 68 @Override
74 public void run(String... arg0) throws Exception { 69 public void run(String... arg0) throws Exception {
75 - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); 70 + logger.info("gpsDataLoader,20,6");
  71 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS);
76 } 72 }
77 73
78 public GpsEntity add(GpsEntity gps) { 74 public GpsEntity add(GpsEntity gps) {
@@ -136,6 +132,10 @@ public class GpsRealData implements CommandLineRunner{ @@ -136,6 +132,10 @@ public class GpsRealData implements CommandLineRunner{
136 list.addAll(getByLine(code)); 132 list.addAll(getByLine(code));
137 return list; 133 return list;
138 } 134 }
  135 +
  136 + public Set<String> allDevices(){
  137 + return gpsMap.keySet();
  138 + }
139 139
140 public GpsEntity findByDeviceId(String deviceId) { 140 public GpsEntity findByDeviceId(String deviceId) {
141 return gpsMap.get(deviceId); 141 return gpsMap.get(deviceId);
@@ -144,7 +144,10 @@ public class GpsRealData implements CommandLineRunner{ @@ -144,7 +144,10 @@ public class GpsRealData implements CommandLineRunner{
144 public Collection<GpsEntity> all(){ 144 public Collection<GpsEntity> all(){
145 return gpsMap.values(); 145 return gpsMap.values();
146 } 146 }
147 - 147 +
  148 + public void remove(String device){
  149 + gpsMap.remove(device);
  150 + }
148 @Component 151 @Component
149 public static class GpsDataLoader extends Thread{ 152 public static class GpsDataLoader extends Thread{
150 153
@@ -188,6 +191,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -188,6 +191,7 @@ public class GpsRealData implements CommandLineRunner{
188 191
189 String nbbm; 192 String nbbm;
190 //附加车辆内部编码 193 //附加车辆内部编码
  194 + Integer updown;
191 for(GpsEntity gps : list){ 195 for(GpsEntity gps : list){
192 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); 196 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
193 if(StringUtils.isBlank(nbbm)) 197 if(StringUtils.isBlank(nbbm))
@@ -196,6 +200,12 @@ public class GpsRealData implements CommandLineRunner{ @@ -196,6 +200,12 @@ public class GpsRealData implements CommandLineRunner{
196 gps.setNbbm(nbbm); 200 gps.setNbbm(nbbm);
197 201
198 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); 202 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
  203 + if(gps.getUpDown() == -1){
  204 + //如果走向未知,尝试根据站点纠正走向
  205 + updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
  206 + if(updown != null)
  207 + gps.setUpDown(updown);
  208 + }
199 gpsRealData.add(gps); 209 gpsRealData.add(gps);
200 } 210 }
201 } else 211 } else
src/main/java/com/bsth/data/match/Arrival2Schedule.java
1 package com.bsth.data.match; 1 package com.bsth.data.match;
2 2
3 -import java.text.SimpleDateFormat;  
4 import java.util.ArrayList; 3 import java.util.ArrayList;
5 import java.util.Collections; 4 import java.util.Collections;
6 import java.util.List; 5 import java.util.List;
7 import java.util.Set; 6 import java.util.Set;
8 7
  8 +import org.joda.time.format.DateTimeFormat;
  9 +import org.joda.time.format.DateTimeFormatter;
9 import org.slf4j.Logger; 10 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.BeansException; 12 import org.springframework.beans.BeansException;
@@ -13,14 +14,17 @@ import org.springframework.context.ApplicationContext; @@ -13,14 +14,17 @@ import org.springframework.context.ApplicationContext;
13 import org.springframework.context.ApplicationContextAware; 14 import org.springframework.context.ApplicationContextAware;
14 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
15 16
  17 +import com.bsth.data.LineConfigData;
16 import com.bsth.data.arrival.ArrivalComparator; 18 import com.bsth.data.arrival.ArrivalComparator;
17 import com.bsth.data.arrival.ArrivalData_GPS; 19 import com.bsth.data.arrival.ArrivalData_GPS;
18 import com.bsth.data.arrival.ArrivalEntity; 20 import com.bsth.data.arrival.ArrivalEntity;
19 import com.bsth.data.schedule.DayOfSchedule; 21 import com.bsth.data.schedule.DayOfSchedule;
20 import com.bsth.data.schedule.ScheduleComparator; 22 import com.bsth.data.schedule.ScheduleComparator;
  23 +import com.bsth.entity.realcontrol.LineConfig;
21 import com.bsth.entity.realcontrol.ScheduleRealInfo; 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
22 import com.bsth.service.directive.DirectiveService; 25 import com.bsth.service.directive.DirectiveService;
23 import com.bsth.websocket.handler.SendUtils; 26 import com.bsth.websocket.handler.SendUtils;
  27 +import com.google.common.collect.ArrayListMultimap;
24 28
25 /** 29 /**
26 * 30 *
@@ -36,12 +40,15 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -36,12 +40,15 @@ public class Arrival2Schedule implements ApplicationContextAware {
36 private static DayOfSchedule dayOfSchedule; 40 private static DayOfSchedule dayOfSchedule;
37 private static SendUtils sendUtils; 41 private static SendUtils sendUtils;
38 private static DirectiveService directiveService; 42 private static DirectiveService directiveService;
  43 + private static LineConfigData lineConfigData;
39 private final static int ONE_MINUTE = 1000 * 60; 44 private final static int ONE_MINUTE = 1000 * 60;
40 //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次 45 //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次
41 private final static int FOUR_HOURS = 1000 * 60 * 60 * 4; 46 private final static int FOUR_HOURS = 1000 * 60 * 60 * 4;
42 47
43 private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); 48 private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class);
44 49
  50 + private static ArrayListMultimap<String, ExpectArrivalEnd> expectMap = ArrayListMultimap.create();
  51 +
45 /** 52 /**
46 * 53 *
47 * @Title: start 54 * @Title: start
@@ -57,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -57,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
57 64
58 public static class SchMatchThread extends Thread{ 65 public static class SchMatchThread extends Thread{
59 String nbbm; 66 String nbbm;
  67 + LineConfig conf;
  68 +
60 public SchMatchThread(String nbbm){ 69 public SchMatchThread(String nbbm){
61 this.nbbm = nbbm; 70 this.nbbm = nbbm;
62 } 71 }
@@ -65,8 +74,9 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -65,8 +74,9 @@ public class Arrival2Schedule implements ApplicationContextAware {
65 private ScheduleComparator.FCSJ schComparator = new ScheduleComparator.FCSJ(); 74 private ScheduleComparator.FCSJ schComparator = new ScheduleComparator.FCSJ();
66 private ArrivalComparator arrComparator = new ArrivalComparator(); 75 private ArrivalComparator arrComparator = new ArrivalComparator();
67 private MatchResultComparator mrComparator = new MatchResultComparator(); 76 private MatchResultComparator mrComparator = new MatchResultComparator();
68 - private SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
69 - 77 +
  78 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  79 +
70 @Override 80 @Override
71 public void run() { 81 public void run() {
72 //班次列表 82 //班次列表
@@ -77,6 +87,7 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -77,6 +87,7 @@ public class Arrival2Schedule implements ApplicationContextAware {
77 if(schList.size() == 0 || arrList.size() == 0) 87 if(schList.size() == 0 || arrList.size() == 0)
78 return; 88 return;
79 89
  90 + conf = lineConfigData.get(schList.get(0).getXlBm());
80 //排序 91 //排序
81 Collections.sort(schList, schComparator); 92 Collections.sort(schList, schComparator);
82 Collections.sort(arrList, arrComparator); 93 Collections.sort(arrList, arrComparator);
@@ -108,8 +119,8 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -108,8 +119,8 @@ public class Arrival2Schedule implements ApplicationContextAware {
108 if(sch.isDestroy()) 119 if(sch.isDestroy())
109 continue; 120 continue;
110 121
111 - //没有里程的不匹配  
112 - if(sch.getBcsj() == null && sch.getJhlc() == null) 122 + //线路配置出站既出场,并且没有里程的不匹配
  123 + if(conf.getOutConfig()==2 && sch.getBcsj() == null && sch.getJhlc() == null)
113 continue; 124 continue;
114 125
115 list.add(sch); 126 list.add(sch);
@@ -189,7 +200,15 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -189,7 +200,15 @@ public class Arrival2Schedule implements ApplicationContextAware {
189 mr = new MatchResult(); 200 mr = new MatchResult();
190 mr.sch = sch; 201 mr.sch = sch;
191 mr.ts = inArr.getTs(); 202 mr.ts = inArr.getTs();
192 - mr.diff = inArr.getTs() - sch.getZdsjT(); 203 + //班次没有里程和运送时间的
  204 + if(sch.getZdsj() == null){
  205 + if(i < schList.size()-1)
  206 + mr.diff = inArr.getTs() - schList.get(i + 1).getDfsjT();
  207 + else
  208 + mr.diff = inArr.getTs() - sch.getDfsjT();
  209 + }
  210 + else
  211 + mr.diff = inArr.getTs() - sch.getZdsjT();
193 mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs()); 212 mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs());
194 if(Math.abs(mr.diff) < FOUR_HOURS && mr.success) 213 if(Math.abs(mr.diff) < FOUR_HOURS && mr.success)
195 mrs.add(mr); 214 mrs.add(mr);
@@ -209,14 +228,44 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -209,14 +228,44 @@ public class Arrival2Schedule implements ApplicationContextAware {
209 * @Description: TODO(车辆发出) 228 * @Description: TODO(车辆发出)
210 */ 229 */
211 public void carOut(MatchResult mr){ 230 public void carOut(MatchResult mr){
  231 + ScheduleRealInfo sch = mr.sch;
  232 +
  233 + if(!isExpectOut(mr))
  234 + return;
212 //设置发车时间 235 //设置发车时间
213 - mr.sch.setFcsjActualAll(mr.ts); 236 + sch.setFcsjActualAll(mr.ts);
214 //通知客户端 237 //通知客户端
215 - sendUtils.sendFcsj(mr.sch); 238 + sendUtils.sendFcsj(sch);
216 //持久化 239 //持久化
217 - dayOfSchedule.save(mr.sch); 240 + dayOfSchedule.save(sch);
218 //车辆当前执行班次 241 //车辆当前执行班次
219 - dayOfSchedule.addExecPlan(mr.sch); 242 + dayOfSchedule.addExecPlan(sch);
  243 +
  244 + //期望车辆到达的终点
  245 + if(sch.getZdsj() != null)
  246 + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts));
  247 + }
  248 +
  249 + /**
  250 + *
  251 + * @Title: isExpectOut
  252 + * @Description: TODO(是否是一个期望的出站匹配结果)
  253 + */
  254 + private boolean isExpectOut(MatchResult mr){
  255 + ScheduleRealInfo sch = mr.sch;
  256 + String nbbm = sch.getClZbh();
  257 + if(expectMap.containsKey(nbbm)){
  258 + List<ExpectArrivalEnd> eads = expectMap.get(nbbm);
  259 + for(ExpectArrivalEnd ead : eads){
  260 + if(sch.getQdzCode().equals(ead.getEndStation())
  261 + || mr.ts > ead.getEndTime()){
  262 + expectMap.removeAll(nbbm);
  263 + return true;
  264 + }
  265 + }
  266 + return false;
  267 + }
  268 + return true;
220 } 269 }
221 270
222 /** 271 /**
@@ -225,12 +274,23 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -225,12 +274,23 @@ public class Arrival2Schedule implements ApplicationContextAware {
225 * @Description: TODO(车辆进入终点站) 274 * @Description: TODO(车辆进入终点站)
226 */ 275 */
227 public void carInStop(MatchResult mr){ 276 public void carInStop(MatchResult mr){
228 - mr.sch.setZdsjActualAll(mr.ts); 277 + ScheduleRealInfo sch = mr.sch;
  278 + String nbbm=sch.getClZbh();
  279 + if(!isExpectIn(mr))
  280 + return;
229 281
230 - int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh());  
231 - ScheduleRealInfo next = dayOfSchedule.next(mr.sch); 282 + //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。
  283 + if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){
  284 + int prve_nen = dayOfSchedule.prveNotExecNum(sch);
  285 + if(prve_nen > 0)
  286 + return;
  287 + }
  288 +
  289 + sch.setZdsjActualAll(mr.ts);
  290 + int doneSum = dayOfSchedule.doneSum(nbbm);
  291 + ScheduleRealInfo next = dayOfSchedule.next(sch);
232 if(null != next){ 292 if(null != next){
233 - next.setQdzArrDateSJ(mr.sch.getZdsjActual()); 293 + next.setQdzArrDateSJ(sch.getZdsjActual());
234 //下发调度指令 294 //下发调度指令
235 directiveService.send60Dispatch(next, doneSum, "到站@系统"); 295 directiveService.send60Dispatch(next, doneSum, "到站@系统");
236 296
@@ -239,18 +299,40 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -239,18 +299,40 @@ public class Arrival2Schedule implements ApplicationContextAware {
239 next.setFcsjActualAll(mr.ts); 299 next.setFcsjActualAll(mr.ts);
240 300
241 //套跑 -下发线路切换指令 301 //套跑 -下发线路切换指令
242 - if(!next.getXlBm().equals(mr.sch.getXlBm()))  
243 - directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); 302 + if(!next.getXlBm().equals(sch.getXlBm()))
  303 + directiveService.lineChange(nbbm, next.getXlBm(), "套跑@系统");
244 } 304 }
245 else//下发文本指令(已结束运营) 305 else//下发文本指令(已结束运营)
246 - directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统"); 306 + directiveService.send60Phrase(nbbm, "到达终点 " + sch.getZdzName() + ",已完成当日所有排班。", "系统");
247 //通知客户端 307 //通知客户端
248 - sendUtils.sendZdsj(mr.sch, next, doneSum); 308 + sendUtils.sendZdsj(sch, next, doneSum);
249 //持久化 309 //持久化
250 - dayOfSchedule.save(mr.sch);  
251 - logger.info(mr.sch.getClZbh() + "移除正在执行班次," + mr.sch.getFcsj()); 310 + dayOfSchedule.save(sch);
  311 + logger.info(sch.getClZbh() + "移除正在执行班次," + sch.getFcsj());
252 //移除车辆正在执行班次索引 312 //移除车辆正在执行班次索引
253 - dayOfSchedule.removeExecPlan(mr.sch.getClZbh()); 313 + dayOfSchedule.removeExecPlan(nbbm);
  314 + }
  315 +
  316 + /**
  317 + *
  318 + * @Title: isExpectOut
  319 + * @Description: TODO(是否是一个期望的进站匹配结果)
  320 + */
  321 + private boolean isExpectIn(MatchResult mr){
  322 + ScheduleRealInfo sch = mr.sch;
  323 + String nbbm = sch.getClZbh();
  324 + if(expectMap.containsKey(nbbm)){
  325 + List<ExpectArrivalEnd> eads = expectMap.get(nbbm);
  326 + for(ExpectArrivalEnd ead : eads){
  327 + if(sch.getZdzCode().equals(ead.getEndStation())
  328 + || mr.ts > ead.getEndTime()){
  329 + expectMap.removeAll(nbbm);
  330 + return true;
  331 + }
  332 + }
  333 + return false;
  334 + }
  335 + return true;
254 } 336 }
255 337
256 /** 338 /**
@@ -308,8 +390,9 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -308,8 +390,9 @@ public class Arrival2Schedule implements ApplicationContextAware {
308 //上行发车,和到达时间比较一下。起点一般不会立即发出 390 //上行发车,和到达时间比较一下。起点一般不会立即发出
309 if(mr.sch.getXlDir().equals("0") 391 if(mr.sch.getXlDir().equals("0")
310 && null != mr.sch.getQdzArrDateSJ()){ 392 && null != mr.sch.getQdzArrDateSJ()){
311 -  
312 - long dt = sdfyyyyMMddHHmm.parse(mr.sch.getRealExecDate() + mr.sch.getQdzArrDateSJ()).getTime(); 393 +
  394 +
  395 + long dt = fmtyyyyMMddHHmm.parseMillis(mr.sch.getRealExecDate() + mr.sch.getQdzArrDateSJ());
313 396
314 //停站时间少于 计划的3分之1,标记为漂移信号 397 //停站时间少于 计划的3分之1,标记为漂移信号
315 if((mr.ts - dt < (mr.sch.getDfsjT() - dt) / 3)){ 398 if((mr.ts - dt < (mr.sch.getDfsjT() - dt) / 3)){
@@ -333,5 +416,20 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -333,5 +416,20 @@ public class Arrival2Schedule implements ApplicationContextAware {
333 sendUtils = arg0.getBean(SendUtils.class); 416 sendUtils = arg0.getBean(SendUtils.class);
334 dayOfSchedule = arg0.getBean(DayOfSchedule.class); 417 dayOfSchedule = arg0.getBean(DayOfSchedule.class);
335 directiveService = arg0.getBean(DirectiveService.class); 418 directiveService = arg0.getBean(DirectiveService.class);
  419 + lineConfigData = arg0.getBean(LineConfigData.class);
  420 + }
  421 +
  422 + /**
  423 + *
  424 + * @Title: removeExpect
  425 + * @Description: TODO(清除预期站点)
  426 + * @param @param nbbm
  427 + */
  428 + public void removeExpect(String nbbm){
  429 + expectMap.removeAll(nbbm);
  430 + }
  431 +
  432 + public static void addExpect(String nbbm, ExpectArrivalEnd eae){
  433 + expectMap.put(nbbm, eae);
336 } 434 }
337 } 435 }
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java 0 → 100644
  1 +package com.bsth.data.match;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +
  5 +/**
  6 + *
  7 + * @ClassName: ExpectArrivalEnd
  8 + * @Description: TODO(期望车辆在某个时间段到达某个终点或 发出某个起点........)
  9 + * @author PanZhao
  10 + * @date 2016年11月2日 下午8:04:43
  11 + *
  12 + */
  13 +public class ExpectArrivalEnd {
  14 +
  15 + private String nbbm;
  16 +
  17 + private String endStation;
  18 +
  19 + private Long endTime;
  20 +
  21 + public static ExpectArrivalEnd getEndInstance(ScheduleRealInfo sch, long t){
  22 + ExpectArrivalEnd ead = new ExpectArrivalEnd();
  23 + ead.setNbbm(sch.getClZbh());
  24 + ead.setEndStation(sch.getZdzCode());
  25 + if(sch.getBcType().equals("out"))
  26 + ead.setEndTime(sch.getZdsjT());
  27 + else{
  28 + ead.setEndTime(sch.getZdsjT() - (sch.getDfsjT() - t));
  29 + }
  30 + return ead;
  31 + }
  32 +
  33 +
  34 + public String getNbbm() {
  35 + return nbbm;
  36 + }
  37 +
  38 + public void setNbbm(String nbbm) {
  39 + this.nbbm = nbbm;
  40 + }
  41 +
  42 + public String getEndStation() {
  43 + return endStation;
  44 + }
  45 +
  46 + public void setEndStation(String endStation) {
  47 + this.endStation = endStation;
  48 + }
  49 +
  50 + public Long getEndTime() {
  51 + return endTime;
  52 + }
  53 +
  54 + public void setEndTime(Long endTime) {
  55 + this.endTime = endTime;
  56 + }
  57 +}
src/main/java/com/bsth/data/pilot80/PilotReport.java
@@ -85,13 +85,13 @@ public class PilotReport { @@ -85,13 +85,13 @@ public class PilotReport {
85 85
86 //下发调度指令 86 //下发调度指令
87 directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); 87 directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统");
88 - d80.setRemarks("计划出场时间:" + outSch.getDfsj()); 88 +/* d80.setRemarks("计划出场时间:" + outSch.getDfsj());
89 //当前GPS位置 89 //当前GPS位置
90 GpsEntity gps = gpsRealData.get(d80.getDeviceId()); 90 GpsEntity gps = gpsRealData.get(d80.getDeviceId());
91 if(null != gps) 91 if(null != gps)
92 - d80.addRemarks("<br> 位置:" + coordHtmlStr(gps)); 92 + d80.addRemarks("<br> 位置:" + coordHtmlStr(gps));*/
93 93
94 - sendUtils.refreshSch(outSch); 94 + //sendUtils.refreshSch(outSch);
95 }else 95 }else
96 d80.setRemarks("没有出场计划"); 96 d80.setRemarks("没有出场计划");
97 97
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -5,7 +5,6 @@ import java.text.SimpleDateFormat; @@ -5,7 +5,6 @@ import java.text.SimpleDateFormat;
5 import java.util.ArrayList; 5 import java.util.ArrayList;
6 import java.util.Collection; 6 import java.util.Collection;
7 import java.util.Collections; 7 import java.util.Collections;
8 -import java.util.Date;  
9 import java.util.HashMap; 8 import java.util.HashMap;
10 import java.util.HashSet; 9 import java.util.HashSet;
11 import java.util.Iterator; 10 import java.util.Iterator;
@@ -15,6 +14,11 @@ import java.util.Map; @@ -15,6 +14,11 @@ import java.util.Map;
15 import java.util.Set; 14 import java.util.Set;
16 import java.util.concurrent.TimeUnit; 15 import java.util.concurrent.TimeUnit;
17 16
  17 +import com.bsth.data.schedule.thread.SubmitToTrafficManage;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.joda.time.DateTime;
  20 +import org.joda.time.format.DateTimeFormat;
  21 +import org.joda.time.format.DateTimeFormatter;
18 import org.slf4j.Logger; 22 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 23 import org.slf4j.LoggerFactory;
20 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
@@ -115,16 +119,30 @@ public class DayOfSchedule implements CommandLineRunner { @@ -115,16 +119,30 @@ public class DayOfSchedule implements CommandLineRunner {
115 @Autowired 119 @Autowired
116 ScheduleLateThread scheduleLateThread; 120 ScheduleLateThread scheduleLateThread;
117 121
  122 + @Autowired
  123 + SubmitToTrafficManage submitToTrafficManage;
  124 +
  125 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")
  126 + ,fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  127 +
118 @Override 128 @Override
119 public void run(String... arg0) throws Exception { 129 public void run(String... arg0) throws Exception {
120 //翻班线程 130 //翻班线程
121 - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 120, TimeUnit.SECONDS); 131 + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
122 //入库 132 //入库
123 - Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); 133 + //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
124 //首班出场指令补发器 134 //首班出场指令补发器
125 - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 60, TimeUnit.SECONDS); 135 + //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
126 //班次误点扫描 136 //班次误点扫描
127 - Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); 137 + //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
  138 +
  139 + //每天凌晨2点20提交数据到运管处
  140 + long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis();
  141 + if(diff < 0)
  142 + diff+=(1000*60*60*24);
  143 +
  144 + logger.info(diff/1000/60 + "分钟之后提交到运管处");
  145 + //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
128 } 146 }
129 147
130 public Map<String, String> getCurrSchDate() { 148 public Map<String, String> getCurrSchDate() {
@@ -140,8 +158,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -140,8 +158,7 @@ public class DayOfSchedule implements CommandLineRunner {
140 LineConfig conf = lineConfigData.get(lineCode); 158 LineConfig conf = lineConfigData.get(lineCode);
141 long ct = System.currentTimeMillis(); 159 long ct = System.currentTimeMillis();
142 160
143 - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");  
144 - String schDate = sdfyyyyMMdd.format(new Date(ct)); 161 + String schDate = fmtyyyyMMdd.print(ct);
145 // 小于当天起始运营时间,则取前一天的排班 162 // 小于当天起始运营时间,则取前一天的排班
146 if (ct < conf.getCurrStartTime()) 163 if (ct < conf.getCurrStartTime())
147 schDate = DateUtils.subtractDay(schDate, 1); 164 schDate = DateUtils.subtractDay(schDate, 1);
@@ -295,10 +312,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -295,10 +312,8 @@ public class DayOfSchedule implements CommandLineRunner {
295 312
296 try { 313 try {
297 Map<String, Object> data = new HashMap<>(); 314 Map<String, Object> data = new HashMap<>();
298 - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")  
299 - ,sdfHHmm = new SimpleDateFormat("HH:mm");  
300 -  
301 - data.put("scheduleDate_eq", sdfyyyyMMdd.parse(schDate)); 315 +
  316 + data.put("scheduleDate_eq", fmtyyyyMMdd.parseDateTime(schDate).toDate());
302 data.put("xlBm_eq", lineCode); 317 data.put("xlBm_eq", lineCode);
303 318
304 // 查询计划排班 319 // 查询计划排班
@@ -307,20 +322,34 @@ public class DayOfSchedule implements CommandLineRunner { @@ -307,20 +322,34 @@ public class DayOfSchedule implements CommandLineRunner {
307 // 转换为实际排班 322 // 转换为实际排班
308 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); 323 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class);
309 324
  325 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  326 + String fcsj;
310 for (ScheduleRealInfo sch : realList) { 327 for (ScheduleRealInfo sch : realList) {
311 - sch.setScheduleDateStr(sdfyyyyMMdd.format(sch.getScheduleDate())); 328 + sch.setScheduleDateStr(fmtyyyyMMdd.print(sch.getScheduleDate().getTime()));
312 sch.setRealExecDate(sch.getScheduleDateStr()); 329 sch.setRealExecDate(sch.getScheduleDateStr());
  330 +
  331 + if(StringUtils.isEmpty(sch.getFcsj()))
  332 + sch.setFcsj("00:00");
  333 +
  334 + fcsj=sch.getFcsj().trim();
  335 + //处理一下发车时间格式没有:号的问题
  336 + if(fcsj.indexOf(":") == -1 && fcsj.length() >= 4){
  337 + sch.setFcsj(fcsj.substring(0, 2) + ":" + fcsj.substring(2, 4));
  338 + }
  339 +
  340 + try {
  341 + sdf.parse(sch.getFcsj());
  342 + } catch (ParseException e) {
  343 + //发车时间仍然校验不过的,直接写成00:00
  344 + sch.setFcsj("00:00");
  345 + }
  346 +
313 // 计划终点时间 347 // 计划终点时间
314 if (sch.getBcsj() != null) { 348 if (sch.getBcsj() != null) {
315 - try{  
316 - sch.setZdsjT(sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000));  
317 - sch.setZdsj(sdfHHmm.format(sch.getZdsjT()));  
318 - sch.setLate(false);  
319 - }catch(ParseException pe){  
320 - logger.error("loadPlanSch... 计算终点时间失败...");  
321 - } 349 + sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000)));
  350 + sch.setLate(false);
322 } 351 }
323 - //计划里程为0,直接清空 352 + //计划里程为0,设置NULL
324 if(sch.getJhlc() != null && sch.getJhlc() == 0) 353 if(sch.getJhlc() != null && sch.getJhlc() == 0)
325 sch.setJhlc(null); 354 sch.setJhlc(null);
326 } 355 }
@@ -453,6 +482,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -453,6 +482,7 @@ public class DayOfSchedule implements CommandLineRunner {
453 } 482 }
454 483
455 public void put(ScheduleRealInfo sch) { 484 public void put(ScheduleRealInfo sch) {
  485 +
456 schAttrCalculator 486 schAttrCalculator
457 .calcRealDate(sch) 487 .calcRealDate(sch)
458 .calcAllTimeByFcsj(sch); 488 .calcAllTimeByFcsj(sch);
@@ -476,9 +506,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -476,9 +506,9 @@ public class DayOfSchedule implements CommandLineRunner {
476 //return sch; 506 //return sch;
477 } 507 }
478 508
479 - public void calcQdzTimePlan(String nbbm){  
480 - schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));  
481 - } 509 +// public void calcQdzTimePlan(String nbbm){
  510 +// schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));
  511 +// }
482 512
483 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm){ 513 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm){
484 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm)); 514 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm));
@@ -489,7 +519,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -489,7 +519,7 @@ public class DayOfSchedule implements CommandLineRunner {
489 * @Title: nextAll 519 * @Title: nextAll
490 * @Description: TODO(之后的所有班次) 520 * @Description: TODO(之后的所有班次)
491 */ 521 */
492 - public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { 522 +/* public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) {
493 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); 523 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
494 // 排序 524 // 排序
495 Collections.sort(list, schFCSJComparator); 525 Collections.sort(list, schFCSJComparator);
@@ -503,7 +533,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -503,7 +533,7 @@ public class DayOfSchedule implements CommandLineRunner {
503 533
504 } 534 }
505 return rs; 535 return rs;
506 - } 536 + }*/
507 537
508 /** 538 /**
509 * 539 *
@@ -520,6 +550,24 @@ public class DayOfSchedule implements CommandLineRunner { @@ -520,6 +550,24 @@ public class DayOfSchedule implements CommandLineRunner {
520 } 550 }
521 return rs; 551 return rs;
522 } 552 }
  553 +
  554 + /**
  555 + *
  556 + * @Title: prveNotExecNum
  557 + * @Description: TODO(班次之前未执行班次数量)
  558 + */
  559 + public int prveNotExecNum(ScheduleRealInfo sch){
  560 + int n = 0;
  561 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  562 + for(ScheduleRealInfo s : list){
  563 + if(s.getFcsjActual() == null && !s.isDestroy())
  564 + n ++;
  565 +
  566 + if(s.getId().equals(sch.getId()))
  567 + break;
  568 + }
  569 + return n;
  570 + }
523 571
524 /** 572 /**
525 * 573 *
@@ -684,4 +732,4 @@ public class DayOfSchedule implements CommandLineRunner { @@ -684,4 +732,4 @@ public class DayOfSchedule implements CommandLineRunner {
684 break; 732 break;
685 } 733 }
686 }*/ 734 }*/
687 -} 735 +}
688 \ No newline at end of file 736 \ No newline at end of file
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
4 -import java.text.SimpleDateFormat;  
5 import java.util.ArrayList; 4 import java.util.ArrayList;
6 import java.util.Collections; 5 import java.util.Collections;
7 -import java.util.Date;  
8 import java.util.List; 6 import java.util.List;
9 7
  8 +import org.joda.time.format.DateTimeFormat;
  9 +import org.joda.time.format.DateTimeFormatter;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +34,10 @@ public class SchAttrCalculator { @@ -34,6 +34,10 @@ public class SchAttrCalculator {
34 34
35 Logger logger = LoggerFactory.getLogger(this.getClass()); 35 Logger logger = LoggerFactory.getLogger(this.getClass());
36 36
  37 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")
  38 + ,fmtHHmm = DateTimeFormat.forPattern("HH:mm")
  39 + ,fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  40 +
37 /** 41 /**
38 * @Title: calcRealDate 42 * @Title: calcRealDate
39 * @Description: TODO(计算班次的真实执行日期) 43 * @Description: TODO(计算班次的真实执行日期)
@@ -45,22 +49,12 @@ public class SchAttrCalculator { @@ -45,22 +49,12 @@ public class SchAttrCalculator {
45 if (null == sch.getFcsjT()) 49 if (null == sch.getFcsjT())
46 calcFcsjTime(sch); 50 calcFcsjTime(sch);
47 51
48 - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");  
49 - /*  
50 - * 早于线路开始运营时间的,加一天  
51 - * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25  
52 -  
53 -  
54 - ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");  
55 - long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime();  
56 - if (st > sch.getFcsjT())  
57 - sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);*/  
58 52
59 if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ 53 if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){
60 sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); 54 sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);
61 } 55 }
62 56
63 - sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); 57 + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT()));
64 } catch (Exception e) { 58 } catch (Exception e) {
65 logger.error("", e); 59 logger.error("", e);
66 } 60 }
@@ -77,12 +71,10 @@ public class SchAttrCalculator { @@ -77,12 +71,10 @@ public class SchAttrCalculator {
77 // 生成时间戳 71 // 生成时间戳
78 calcTimestamp(sch); 72 calcTimestamp(sch);
79 73
80 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
81 // 计划终点时间 74 // 计划终点时间
82 if (sch.getBcsj() != null) { 75 if (sch.getBcsj() != null) {
83 - Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));  
84 - sch.setZdsjT(zdDate.getTime());  
85 - sch.setZdsj(sdfHHmm.format(zdDate)); 76 + sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));
  77 + sch.setZdsj(fmtHHmm.print(sch.getZdsjT()));
86 } 78 }
87 } catch (ParseException e) { 79 } catch (ParseException e) {
88 logger.error("", e); 80 logger.error("", e);
@@ -178,8 +170,7 @@ public class SchAttrCalculator { @@ -178,8 +170,7 @@ public class SchAttrCalculator {
178 } 170 }
179 171
180 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { 172 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {
181 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
182 - sch.setFcsjT(sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); 173 + sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj()));
183 return this; 174 return this;
184 } 175 }
185 176
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
@@ -18,7 +18,7 @@ import com.bsth.entity.realcontrol.LineConfig; @@ -18,7 +18,7 @@ import com.bsth.entity.realcontrol.LineConfig;
18 18
19 /** 19 /**
20 * 20 *
21 - * @ClassName: refreshScheduleThread 21 + * @ClassName: ScheduleRefreshThread
22 * @Description: TODO(班次刷新线程,用于在营运开始时间切换到当日排班) 22 * @Description: TODO(班次刷新线程,用于在营运开始时间切换到当日排班)
23 * @author PanZhao 23 * @author PanZhao
24 * @date 2016年8月17日 下午1:23:34 24 * @date 2016年8月17日 下午1:23:34
@@ -72,6 +72,7 @@ public class ScheduleRefreshThread extends Thread{ @@ -72,6 +72,7 @@ public class ScheduleRefreshThread extends Thread{
72 logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); 72 logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
73 } 73 }
74 } 74 }
  75 +
75 } catch (Exception e) { 76 } catch (Exception e) {
76 logger.error("", e); 77 logger.error("", e);
77 } 78 }
src/main/java/com/bsth/data/schedule/thread/SubmitToTrafficManage.java 0 → 100644
  1 +package com.bsth.data.schedule.thread;
  2 +
  3 +import com.bsth.service.TrafficManageService;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 运营数据提交到运管处
  11 + * Created by panzhao on 2016/11/9.
  12 + */
  13 +@Component
  14 +public class SubmitToTrafficManage extends Thread{
  15 +
  16 + Logger logger = LoggerFactory.getLogger(this.getClass());
  17 +
  18 + @Autowired
  19 + TrafficManageService trafficManageService;
  20 +
  21 + @Override
  22 + public void run() {
  23 + logger.info("开始提交数据到运管处...");
  24 + try {
  25 + //路单
  26 + trafficManageService.setLD();
  27 + } catch (Exception e) {
  28 + logger.error("提交路单到运管处失败", e);
  29 + }
  30 + try {
  31 + //车辆里程、油耗
  32 + trafficManageService.setLCYH();
  33 + } catch (Exception e) {
  34 + logger.error("提交车辆里程、油耗到运管处失败", e);
  35 + }
  36 + try {
  37 + //线路调度日报
  38 + trafficManageService.setDDRB();
  39 + } catch (Exception e) {
  40 + logger.error("提交线路调度日报到运管处失败", e);
  41 + }
  42 + try {
  43 + //线路计划班次表
  44 + trafficManageService.setJHBC();
  45 + } catch (Exception e) {
  46 + logger.error("提交线路计划班次表到运管处失败", e);
  47 + }
  48 + logger.info("提交数据到运管处结束!");
  49 + }
  50 +}
src/main/java/com/bsth/entity/CarDevice.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import com.bsth.entity.sys.SysUser;
  4 +
3 import javax.persistence.*; 5 import javax.persistence.*;
4 import java.util.Date; 6 import java.util.Date;
5 7
@@ -15,17 +17,32 @@ public class CarDevice { @@ -15,17 +17,32 @@ public class CarDevice {
15 @GeneratedValue 17 @GeneratedValue
16 private Long id; 18 private Long id;
17 19
18 - /** 公司名称 */  
19 - @Column(nullable = false) 20 + /** 公司名称(留着,暂时不用) */
  21 + @Column
20 private String gsName; 22 private String gsName;
  23 +
  24 + /** 车辆id,关联bsth_c_cars */
  25 + @Column(nullable = false)
  26 + private Integer cl;
21 /** 内部编号(自编号) */ 27 /** 内部编号(自编号) */
  28 + @Column(nullable = false)
22 private String clZbh; 29 private String clZbh;
  30 +
  31 + /** 关联 bsth_c_line 主键,不做mapping */
  32 + @Column(nullable = false)
  33 + private Integer xl;
23 /** 线路名称 */ 34 /** 线路名称 */
  35 + @Column(nullable = false)
24 private String xlName; 36 private String xlName;
  37 + /** 线路编码 */
  38 + @Column(nullable = false)
  39 + private String xlBm;
25 40
26 /** 旧终端号 */ 41 /** 旧终端号 */
  42 + @Column(nullable = false)
27 private String oldDeviceNo; 43 private String oldDeviceNo;
28 /** 新终端号 */ 44 /** 新终端号 */
  45 + @Column(nullable = false)
29 private String newDeviceNo; 46 private String newDeviceNo;
30 /** 旧SIM卡号 */ 47 /** 旧SIM卡号 */
31 private String oldSimNo; 48 private String oldSimNo;
@@ -37,11 +54,24 @@ public class CarDevice { @@ -37,11 +54,24 @@ public class CarDevice {
37 /** 保修描述 */ 54 /** 保修描述 */
38 private String guaranteeDesc; 55 private String guaranteeDesc;
39 56
40 - // 创建日期 57 + /** 启用日期 */
  58 + @Column(nullable = false)
  59 + private Date qyrq;
  60 +
  61 + /** 是否删除(标记) */
  62 + @Column(nullable = false)
  63 + private Boolean isCancel = false;
  64 +
  65 + /** 创建人 */
  66 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  67 + private SysUser createBy;
  68 + /** 修改人 */
  69 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  70 + private SysUser updateBy;
  71 + /** 创建日期 */
41 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") 72 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
42 private Date createDate; 73 private Date createDate;
43 -  
44 - // 修改日期 74 + /** 修改日期 */
45 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 75 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
46 private Date updateDate; 76 private Date updateDate;
47 77
@@ -61,6 +91,14 @@ public class CarDevice { @@ -61,6 +91,14 @@ public class CarDevice {
61 this.gsName = gsName; 91 this.gsName = gsName;
62 } 92 }
63 93
  94 + public Integer getCl() {
  95 + return cl;
  96 + }
  97 +
  98 + public void setCl(Integer cl) {
  99 + this.cl = cl;
  100 + }
  101 +
64 public String getClZbh() { 102 public String getClZbh() {
65 return clZbh; 103 return clZbh;
66 } 104 }
@@ -69,6 +107,14 @@ public class CarDevice { @@ -69,6 +107,14 @@ public class CarDevice {
69 this.clZbh = clZbh; 107 this.clZbh = clZbh;
70 } 108 }
71 109
  110 + public Integer getXl() {
  111 + return xl;
  112 + }
  113 +
  114 + public void setXl(Integer xl) {
  115 + this.xl = xl;
  116 + }
  117 +
72 public String getXlName() { 118 public String getXlName() {
73 return xlName; 119 return xlName;
74 } 120 }
@@ -77,6 +123,14 @@ public class CarDevice { @@ -77,6 +123,14 @@ public class CarDevice {
77 this.xlName = xlName; 123 this.xlName = xlName;
78 } 124 }
79 125
  126 + public String getXlBm() {
  127 + return xlBm;
  128 + }
  129 +
  130 + public void setXlBm(String xlBm) {
  131 + this.xlBm = xlBm;
  132 + }
  133 +
80 public String getOldDeviceNo() { 134 public String getOldDeviceNo() {
81 return oldDeviceNo; 135 return oldDeviceNo;
82 } 136 }
@@ -125,6 +179,22 @@ public class CarDevice { @@ -125,6 +179,22 @@ public class CarDevice {
125 this.guaranteeDesc = guaranteeDesc; 179 this.guaranteeDesc = guaranteeDesc;
126 } 180 }
127 181
  182 + public SysUser getCreateBy() {
  183 + return createBy;
  184 + }
  185 +
  186 + public void setCreateBy(SysUser createBy) {
  187 + this.createBy = createBy;
  188 + }
  189 +
  190 + public SysUser getUpdateBy() {
  191 + return updateBy;
  192 + }
  193 +
  194 + public void setUpdateBy(SysUser updateBy) {
  195 + this.updateBy = updateBy;
  196 + }
  197 +
128 public Date getCreateDate() { 198 public Date getCreateDate() {
129 return createDate; 199 return createDate;
130 } 200 }
@@ -140,4 +210,20 @@ public class CarDevice { @@ -140,4 +210,20 @@ public class CarDevice {
140 public void setUpdateDate(Date updateDate) { 210 public void setUpdateDate(Date updateDate) {
141 this.updateDate = updateDate; 211 this.updateDate = updateDate;
142 } 212 }
  213 +
  214 + public Date getQyrq() {
  215 + return qyrq;
  216 + }
  217 +
  218 + public void setQyrq(Date qyrq) {
  219 + this.qyrq = qyrq;
  220 + }
  221 +
  222 + public Boolean getIsCancel() {
  223 + return isCancel;
  224 + }
  225 +
  226 + public void setIsCancel(Boolean isCancel) {
  227 + this.isCancel = isCancel;
  228 + }
143 } 229 }
src/main/java/com/bsth/entity/Line.java
@@ -116,6 +116,12 @@ public class Line implements Serializable { @@ -116,6 +116,12 @@ public class Line implements Serializable {
116 /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ 116 /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
117 private Integer ordCarNumber; 117 private Integer ordCarNumber;
118 118
  119 + /** 权证车辆数量 报表需要的字段值 */
  120 + private Integer warrantCar;
  121 +
  122 + /** 权证配车启用日期 报表需要的字段值 */
  123 + private Integer warrantDate;
  124 +
119 /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ 125 /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */
120 private String carParkCode; 126 private String carParkCode;
121 127
@@ -139,6 +145,22 @@ public class Line implements Serializable { @@ -139,6 +145,22 @@ public class Line implements Serializable {
139 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 145 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
140 private Date updateDate; 146 private Date updateDate;
141 147
  148 + public Integer getWarrantCar() {
  149 + return warrantCar;
  150 + }
  151 +
  152 + public void setWarrantCar(Integer warrantCar) {
  153 + this.warrantCar = warrantCar;
  154 + }
  155 +
  156 + public Integer getWarrantDate() {
  157 + return warrantDate;
  158 + }
  159 +
  160 + public void setWarrantDate(Integer warrantDate) {
  161 + this.warrantDate = warrantDate;
  162 + }
  163 +
142 public Integer getLinePlayType() { 164 public Integer getLinePlayType() {
143 return linePlayType; 165 return linePlayType;
144 } 166 }
src/main/java/com/bsth/entity/directive/D60.java
@@ -17,251 +17,276 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @@ -17,251 +17,276 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
17 17
18 18
19 /** 19 /**
20 - *  
21 - * @ClassName: D60  
22 - * @Description: TODO(调度指令)  
23 * @author PanZhao 20 * @author PanZhao
24 - * @date 2016年6月7日 上午10:21:59  
25 - * 21 + * @ClassName: D60
  22 + * @Description: TODO(调度指令)
  23 + * @date 2016年6月7日 上午10:21:59
26 */ 24 */
27 @Entity 25 @Entity
28 @Table(name = "bsth_v_directive_60") 26 @Table(name = "bsth_v_directive_60")
29 @NamedEntityGraphs({ 27 @NamedEntityGraphs({
30 - @NamedEntityGraph(name = "directive60_sch", attributeNodes = {  
31 - @NamedAttributeNode("sch")  
32 - }) 28 + @NamedEntityGraph(name = "directive60_sch", attributeNodes = {
  29 + @NamedAttributeNode("sch")
  30 + })
33 }) 31 })
34 -public class D60 extends Directive{ 32 +public class D60 extends Directive {
35 33
36 - @Id 34 + @Id
37 @GeneratedValue 35 @GeneratedValue
38 - private Integer id;  
39 -  
40 - /**  
41 - * 数据  
42 - */  
43 - private D60Data data;  
44 -  
45 - /**  
46 - * 唯一标识  
47 - */  
48 - @Transient  
49 - private Integer msgId;  
50 -  
51 - /**  
52 - * 46上行  
53 - */  
54 - private Short reply46 = -1;  
55 -  
56 - /**  
57 - * 47上行  
58 - */  
59 - private Short reply47 = -1;  
60 -  
61 - /**  
62 - * 是否是调度指令  
63 - * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分  
64 - */  
65 - private boolean isDispatch;  
66 -  
67 - /**  
68 - * 相关联的班次  
69 - */  
70 - @JsonIgnore  
71 - @ManyToOne(fetch = FetchType.LAZY)  
72 - private ScheduleRealInfo sch;  
73 -  
74 - @Embeddable  
75 - public static class D60Data {  
76 - // 公司代码  
77 - private short companyCode;  
78 -  
79 - // 设备号  
80 - @Transient  
81 - private String deviceId;  
82 -  
83 - // 时间戳  
84 - @Transient  
85 - private Long timestamp;  
86 -  
87 - // 保留 默认0  
88 - private short instructType = 0;  
89 -  
90 - /*  
91 - * 调度指令 调度指令。  
92 - * 0X00表示信息短语  
93 - * 0X01表示取消上次指令+调度指令(闹钟有效)  
94 - * 0x02表示为调度指令(闹钟有效)  
95 - * 0x03表示运营状态指令(闹钟无效)  
96 - * 0x04表示其他指令  
97 - */  
98 - private Short dispatchInstruct;  
99 -  
100 - // 唯一标识  
101 - private int msgId;  
102 -  
103 - // 闹钟  
104 - private Long alarmTime;  
105 -  
106 - // 多个运营状态字节  
107 - private Long serviceState;  
108 -  
109 - // 消息文本  
110 - private String txtContent;  
111 -  
112 - public short getCompanyCode() {  
113 - return companyCode;  
114 - }  
115 -  
116 - public void setCompanyCode(short companyCode) {  
117 - this.companyCode = companyCode;  
118 - }  
119 -  
120 - public String getDeviceId() {  
121 - return deviceId;  
122 - }  
123 -  
124 - public void setDeviceId(String deviceId) {  
125 - this.deviceId = deviceId;  
126 - }  
127 -  
128 - public Long getTimestamp() {  
129 - return timestamp;  
130 - }  
131 -  
132 - public void setTimestamp(Long timestamp) {  
133 - this.timestamp = timestamp;  
134 - }  
135 -  
136 - public short getInstructType() {  
137 - return instructType;  
138 - }  
139 -  
140 - public void setInstructType(short instructType) {  
141 - this.instructType = instructType;  
142 - }  
143 -  
144 - public Short getDispatchInstruct() {  
145 - return dispatchInstruct;  
146 - }  
147 -  
148 - public void setDispatchInstruct(Short dispatchInstruct) {  
149 - this.dispatchInstruct = dispatchInstruct;  
150 - }  
151 -  
152 - public int getMsgId() {  
153 - return msgId;  
154 - }  
155 -  
156 - public void setMsgId(int msgId) {  
157 - this.msgId = msgId;  
158 - }  
159 -  
160 - public Long getAlarmTime() {  
161 - return alarmTime;  
162 - }  
163 -  
164 - public void setAlarmTime(Long alarmTime) {  
165 - this.alarmTime = alarmTime;  
166 - }  
167 -  
168 - public Long getServiceState() {  
169 - return serviceState;  
170 - }  
171 -  
172 - public void setServiceState(Long serviceState) {  
173 - this.serviceState = serviceState;  
174 - }  
175 -  
176 - public String getTxtContent() {  
177 - return txtContent;  
178 - }  
179 -  
180 - public void setTxtContent(String txtContent) {  
181 - this.txtContent = txtContent;  
182 - }  
183 - }  
184 -  
185 - public Integer getId() {  
186 - return id;  
187 - }  
188 -  
189 - public void setId(Integer id) {  
190 - this.id = id;  
191 - }  
192 -  
193 - public short getOperCode() {  
194 - return operCode;  
195 - }  
196 -  
197 - public void setOperCode(short operCode) {  
198 - this.operCode = operCode;  
199 - }  
200 -  
201 - public D60Data getData() {  
202 - return data;  
203 - }  
204 -  
205 - public void setData(D60Data data) {  
206 - this.data = data;  
207 - }  
208 -  
209 - public Integer getMsgId() {  
210 - if(this.msgId != null)  
211 - return this.msgId;  
212 - else  
213 - return this.getData().getMsgId();  
214 - }  
215 -  
216 - public void setMsgId(Integer msgId) {  
217 - this.msgId = msgId;  
218 - }  
219 -  
220 - @Override  
221 - public void setTimestamp(Long timestamp) {  
222 - if(this.data != null)  
223 - this.data.setTimestamp(timestamp);  
224 -  
225 - this.timestamp = timestamp;  
226 - }  
227 -  
228 - @Override  
229 - public void setDeviceId(String deviceId) {  
230 - if(this.data != null)  
231 - this.data.setDeviceId(deviceId);  
232 -  
233 - this.deviceId = deviceId;  
234 - }  
235 -  
236 - public Short getReply46() {  
237 - return reply46;  
238 - }  
239 -  
240 - public void setReply46(Short reply46) {  
241 - this.reply46 = reply46;  
242 - }  
243 -  
244 - public Short getReply47() {  
245 - return reply47;  
246 - }  
247 -  
248 - public void setReply47(Short reply47) {  
249 - this.reply47 = reply47;  
250 - }  
251 -  
252 - public boolean isDispatch() {  
253 - return isDispatch;  
254 - }  
255 -  
256 - public void setDispatch(boolean isDispatch) {  
257 - this.isDispatch = isDispatch;  
258 - }  
259 -  
260 - public ScheduleRealInfo getSch() {  
261 - return sch;  
262 - }  
263 -  
264 - public void setSch(ScheduleRealInfo sch) {  
265 - this.sch = sch;  
266 - } 36 + private Integer id;
  37 +
  38 + /**
  39 + * 数据
  40 + */
  41 + private D60Data data;
  42 +
  43 + /**
  44 + * 唯一标识
  45 + */
  46 + @Transient
  47 + private Integer msgId;
  48 +
  49 + /**
  50 + * 46上行
  51 + */
  52 + private Short reply46 = -1;
  53 + /**
  54 + * 46收到时间
  55 + */
  56 + private Long reply46Time;
  57 +
  58 + /**
  59 + * 47上行
  60 + */
  61 + private Short reply47 = -1;
  62 +
  63 + /**
  64 + * 47收到时间
  65 + */
  66 + private Long reply47Time;
  67 +
  68 + /**
  69 + * 是否是调度指令
  70 + * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分
  71 + */
  72 + private boolean isDispatch;
  73 +
  74 + /**
  75 + * 相关联的班次
  76 + */
  77 + @JsonIgnore
  78 + @ManyToOne(fetch = FetchType.LAZY)
  79 + private ScheduleRealInfo sch;
  80 +
  81 + public Long getReply46Time() {
  82 + return reply46Time;
  83 + }
  84 +
  85 + public void setReply46Time(Long reply46Time) {
  86 + this.reply46Time = reply46Time;
  87 + }
  88 +
  89 + public Long getReply47Time() {
  90 + return reply47Time;
  91 + }
  92 +
  93 + public void setReply47Time(Long reply47Time) {
  94 + this.reply47Time = reply47Time;
  95 + }
  96 +
  97 + @Embeddable
  98 + public static class D60Data {
  99 + // 公司代码
  100 + private short companyCode;
  101 +
  102 + // 设备号
  103 + @Transient
  104 + private String deviceId;
  105 +
  106 + // 时间戳
  107 + @Transient
  108 + private Long timestamp;
  109 +
  110 + // 保留 默认0
  111 + private short instructType = 0;
  112 +
  113 + /*
  114 + * 调度指令 调度指令。
  115 + * 0X00表示信息短语
  116 + * 0X01表示取消上次指令+调度指令(闹钟有效)
  117 + * 0x02表示为调度指令(闹钟有效)
  118 + * 0x03表示运营状态指令(闹钟无效)
  119 + * 0x04表示其他指令
  120 + */
  121 + private Short dispatchInstruct;
  122 +
  123 + // 唯一标识
  124 + private int msgId;
  125 +
  126 + // 闹钟
  127 + private Long alarmTime;
  128 +
  129 + // 多个运营状态字节
  130 + private Long serviceState;
  131 +
  132 + // 消息文本
  133 + private String txtContent;
  134 +
  135 + public short getCompanyCode() {
  136 + return companyCode;
  137 + }
  138 +
  139 + public void setCompanyCode(short companyCode) {
  140 + this.companyCode = companyCode;
  141 + }
  142 +
  143 + public String getDeviceId() {
  144 + return deviceId;
  145 + }
  146 +
  147 + public void setDeviceId(String deviceId) {
  148 + this.deviceId = deviceId;
  149 + }
  150 +
  151 + public Long getTimestamp() {
  152 + return timestamp;
  153 + }
  154 +
  155 + public void setTimestamp(Long timestamp) {
  156 + this.timestamp = timestamp;
  157 + }
  158 +
  159 + public short getInstructType() {
  160 + return instructType;
  161 + }
  162 +
  163 + public void setInstructType(short instructType) {
  164 + this.instructType = instructType;
  165 + }
  166 +
  167 + public Short getDispatchInstruct() {
  168 + return dispatchInstruct;
  169 + }
  170 +
  171 + public void setDispatchInstruct(Short dispatchInstruct) {
  172 + this.dispatchInstruct = dispatchInstruct;
  173 + }
  174 +
  175 + public int getMsgId() {
  176 + return msgId;
  177 + }
  178 +
  179 + public void setMsgId(int msgId) {
  180 + this.msgId = msgId;
  181 + }
  182 +
  183 + public Long getAlarmTime() {
  184 + return alarmTime;
  185 + }
  186 +
  187 + public void setAlarmTime(Long alarmTime) {
  188 + this.alarmTime = alarmTime;
  189 + }
  190 +
  191 + public Long getServiceState() {
  192 + return serviceState;
  193 + }
  194 +
  195 + public void setServiceState(Long serviceState) {
  196 + this.serviceState = serviceState;
  197 + }
  198 +
  199 + public String getTxtContent() {
  200 + return txtContent;
  201 + }
  202 +
  203 + public void setTxtContent(String txtContent) {
  204 + this.txtContent = txtContent;
  205 + }
  206 + }
  207 +
  208 + public Integer getId() {
  209 + return id;
  210 + }
  211 +
  212 + public void setId(Integer id) {
  213 + this.id = id;
  214 + }
  215 +
  216 + public short getOperCode() {
  217 + return operCode;
  218 + }
  219 +
  220 + public void setOperCode(short operCode) {
  221 + this.operCode = operCode;
  222 + }
  223 +
  224 + public D60Data getData() {
  225 + return data;
  226 + }
  227 +
  228 + public void setData(D60Data data) {
  229 + this.data = data;
  230 + }
  231 +
  232 + public Integer getMsgId() {
  233 + if (this.msgId != null)
  234 + return this.msgId;
  235 + else
  236 + return this.getData().getMsgId();
  237 + }
  238 +
  239 + public void setMsgId(Integer msgId) {
  240 + this.msgId = msgId;
  241 + }
  242 +
  243 + @Override
  244 + public void setTimestamp(Long timestamp) {
  245 + if (this.data != null)
  246 + this.data.setTimestamp(timestamp);
  247 +
  248 + this.timestamp = timestamp;
  249 + }
  250 +
  251 + @Override
  252 + public void setDeviceId(String deviceId) {
  253 + if (this.data != null)
  254 + this.data.setDeviceId(deviceId);
  255 +
  256 + this.deviceId = deviceId;
  257 + }
  258 +
  259 + public Short getReply46() {
  260 + return reply46;
  261 + }
  262 +
  263 + public void setReply46(Short reply46) {
  264 + this.reply46 = reply46;
  265 + }
  266 +
  267 + public Short getReply47() {
  268 + return reply47;
  269 + }
  270 +
  271 + public void setReply47(Short reply47) {
  272 + this.reply47 = reply47;
  273 + }
  274 +
  275 + public boolean isDispatch() {
  276 + return isDispatch;
  277 + }
  278 +
  279 + public void setDispatch(boolean isDispatch) {
  280 + this.isDispatch = isDispatch;
  281 + }
  282 +
  283 + public ScheduleRealInfo getSch() {
  284 + return sch;
  285 + }
  286 +
  287 + public void setSch(ScheduleRealInfo sch) {
  288 + this.sch = sch;
  289 + }
  290 +
  291 +
267 } 292 }
src/main/java/com/bsth/entity/directive/DC0_A3.java
1 package com.bsth.entity.directive; 1 package com.bsth.entity.directive;
2 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; 3 +import javax.persistence.*;
9 4
10 /** 5 /**
11 * 6 *
@@ -41,6 +36,7 @@ public class DC0_A3 extends Directive{ @@ -41,6 +36,7 @@ public class DC0_A3 extends Directive{
41 /** 定时定距上报模式 */ 36 /** 定时定距上报模式 */
42 private short reportMode; 37 private short reportMode;
43 /** 定时上报时间间隔 */ 38 /** 定时上报时间间隔 */
  39 + @Column(name = "_interval")
44 private int interval; 40 private int interval;
45 /** 定距上报距离间隔 */ 41 /** 定距上报距离间隔 */
46 private String distance; 42 private String distance;
src/main/java/com/bsth/entity/directive/DC0_A4.java
1 package com.bsth.entity.directive; 1 package com.bsth.entity.directive;
2 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; 3 +import javax.persistence.*;
9 4
10 /** 5 /**
11 * 6 *
@@ -41,6 +36,7 @@ public class DC0_A4 extends Directive{ @@ -41,6 +36,7 @@ public class DC0_A4 extends Directive{
41 /** 定时定距上报模式 */ 36 /** 定时定距上报模式 */
42 private short reportMode; 37 private short reportMode;
43 /** 定时上报时间间隔 */ 38 /** 定时上报时间间隔 */
  39 + @Column(name = "_interval")
44 private int interval; 40 private int interval;
45 /** 定距上报距离间隔 */ 41 /** 定距上报距离间隔 */
46 private String distance; 42 private String distance;
src/main/java/com/bsth/entity/excep/ArrivalInfo.java 0 → 100644
  1 +package com.bsth.entity.excep;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.Date;
  5 +
  6 +import com.bsth.data.BasicData;
  7 +
  8 +/**
  9 + *
  10 + * @ClassName: ArrivalEntity
  11 + * @Description: TODO(进出站实体)
  12 + * @author PanZhao
  13 + * @date 2016年8月19日 上午9:32:20
  14 + *
  15 + */
  16 +public class ArrivalInfo {
  17 +
  18 + /** 设备号*/
  19 + private String deviceId;
  20 +
  21 + private String nbbm;
  22 +
  23 + /** 站点名称 */
  24 + private String stopName;
  25 +
  26 + /** 时间戳*/
  27 + private Long ts;
  28 +
  29 + /** 线路编码*/
  30 + private String lineCode;
  31 +
  32 + /** 上下行*/
  33 + private Integer upDown;
  34 +
  35 + /**站点编码*/
  36 + private String stopNo;
  37 +
  38 + /** 0: 进 1:出*/
  39 + private Integer inOut;
  40 +
  41 + private Long createDate;
  42 +
  43 + /** 是否有效 */
  44 + private boolean enable;
  45 +
  46 + /**分区字段,当年的第几周*/
  47 + private Integer weeksYear;
  48 +
  49 + private boolean tcc;
  50 +
  51 + //是否被纠正
  52 + private boolean correct;
  53 +
  54 + private String correctText;
  55 +
  56 +
  57 + private String czsj;
  58 +
  59 + private String jzsj;
  60 + /** -1 则信号有效,但程序标记为不使用 */
  61 + private int flag = 0;
  62 +
  63 + public ArrivalInfo(){}
  64 +
  65 + public ArrivalInfo(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate,
  66 + int weeksYear, String stopName) {
  67 +
  68 + this.deviceId = deviceId;
  69 + this.ts = ts;
  70 + this.lineCode = lineCode;
  71 + this.upDown = upDown;
  72 + this.stopNo = stopNo;
  73 + this.stopName = stopName;
  74 + this.inOut = inOut;
  75 + this.createDate = createDate;
  76 + }
  77 +
  78 +/* @Override
  79 + public boolean equals(Object obj) {
  80 + ArrivalEntity a2 = (ArrivalEntity)obj;
  81 +
  82 + return this.toString().equals(a2.toString())
  83 + && Math.abs(this.ts - a2.ts) < EQ_RANGE;
  84 + }
  85 +
  86 + @Override
  87 + public int hashCode() {
  88 + return this.toString().hashCode();
  89 + }*/
  90 +
  91 +
  92 + @Override
  93 + public String toString() {
  94 + try {
  95 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  96 + return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+sdfHHmm.format(new Date(this.ts))
  97 + +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]";
  98 + } catch (Exception e) {
  99 + return "";
  100 + }
  101 + }
  102 +
  103 + public String getLineCode() {
  104 + return lineCode;
  105 + }
  106 +
  107 + public void setLineCode(String lineCode) {
  108 + this.lineCode = lineCode;
  109 + }
  110 +
  111 + public Integer getUpDown() {
  112 + return upDown;
  113 + }
  114 +
  115 + public void setUpDown(Integer upDown) {
  116 + this.upDown = upDown;
  117 + }
  118 +
  119 + public String getStopNo() {
  120 + return stopNo;
  121 + }
  122 +
  123 + public void setStopNo(String stopNo) {
  124 + this.stopNo = stopNo;
  125 + }
  126 +
  127 + public Integer getInOut() {
  128 + return inOut;
  129 + }
  130 +
  131 + public void setInOut(Integer inOut) {
  132 + this.inOut = inOut;
  133 + }
  134 +
  135 + public Long getCreateDate() {
  136 + return createDate;
  137 + }
  138 +
  139 + public void setCreateDate(Long createDate) {
  140 + this.createDate = createDate;
  141 + }
  142 +
  143 + public Integer getWeeksYear() {
  144 + return weeksYear;
  145 + }
  146 +
  147 + public void setWeeksYear(Integer weeksYear) {
  148 + this.weeksYear = weeksYear;
  149 + }
  150 +
  151 + public String getDeviceId() {
  152 + return deviceId;
  153 + }
  154 +
  155 + public void setDeviceId(String deviceId) {
  156 + this.deviceId = deviceId;
  157 + }
  158 +
  159 + public Long getTs() {
  160 + return ts;
  161 + }
  162 +
  163 + public void setTs(Long ts) {
  164 + this.ts = ts;
  165 + }
  166 +
  167 + public String getStopName() {
  168 + return stopName;
  169 + }
  170 +
  171 + public void setStopName(String stopName) {
  172 + this.stopName = stopName;
  173 + }
  174 +
  175 + public String getId(){
  176 + return this.deviceId + "_" + this.ts;
  177 + }
  178 +
  179 + public String getNbbm() {
  180 + return nbbm;
  181 + }
  182 +
  183 + public void setNbbm(String nbbm) {
  184 + this.nbbm = nbbm;
  185 + }
  186 +
  187 + public boolean isEnable() {
  188 + return enable;
  189 + }
  190 +
  191 + public void setEnable(boolean enable) {
  192 + this.enable = enable;
  193 + }
  194 +
  195 + public boolean isTcc() {
  196 + return tcc;
  197 + }
  198 +
  199 + public void setTcc(boolean tcc) {
  200 + this.tcc = tcc;
  201 + }
  202 +
  203 + public boolean isOutTcc() {
  204 + return isTcc() && inOut == 1;
  205 + }
  206 +
  207 + public boolean isCorrect() {
  208 + return correct;
  209 + }
  210 +
  211 + public void setCorrect(boolean correct) {
  212 + this.correct = correct;
  213 + }
  214 +
  215 + public String getCorrectText() {
  216 + return correctText;
  217 + }
  218 +
  219 + public void setCorrectText(String correctText) {
  220 + this.correctText = correctText;
  221 + }
  222 +
  223 + public Integer getFlag() {
  224 + return flag;
  225 + }
  226 +
  227 + public void setFlag(Integer flag) {
  228 + this.flag = flag;
  229 + }
  230 +
  231 + public String getCzsj() {
  232 + return czsj;
  233 + }
  234 +
  235 + public void setCzsj(String czsj) {
  236 + this.czsj = czsj;
  237 + }
  238 +
  239 + public String getJzsj() {
  240 + return jzsj;
  241 + }
  242 +
  243 + public void setJzsj(String jzsj) {
  244 + this.jzsj = jzsj;
  245 + }
  246 +
  247 +
  248 +
  249 +}
src/main/java/com/bsth/entity/oil/Cwjy.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_cwjy")
  12 +public class Cwjy {
  13 + @Id
  14 + @GeneratedValue
  15 + private Integer id;
  16 +
  17 + private String gsdm;
  18 +
  19 + private String fgsdm;
  20 +
  21 + private String nbbm;
  22 +
  23 + private String xgr;
  24 +
  25 + private Date createDate;
  26 +
  27 + public Integer getId() {
  28 + return id;
  29 + }
  30 +
  31 + public void setId(Integer id) {
  32 + this.id = id;
  33 + }
  34 +
  35 + public String getGsdm() {
  36 + return gsdm;
  37 + }
  38 +
  39 + public void setGsdm(String gsdm) {
  40 + this.gsdm = gsdm;
  41 + }
  42 +
  43 + public String getFgsdm() {
  44 + return fgsdm;
  45 + }
  46 +
  47 + public void setFgsdm(String fgsdm) {
  48 + this.fgsdm = fgsdm;
  49 + }
  50 +
  51 + public String getNbbm() {
  52 + return nbbm;
  53 + }
  54 +
  55 + public void setNbbm(String nbbm) {
  56 + this.nbbm = nbbm;
  57 + }
  58 +
  59 + public String getXgr() {
  60 + return xgr;
  61 + }
  62 +
  63 + public void setXgr(String xgr) {
  64 + this.xgr = xgr;
  65 + }
  66 +
  67 + public Date getCreateDate() {
  68 + return createDate;
  69 + }
  70 +
  71 + public void setCreateDate(Date createDate) {
  72 + this.createDate = createDate;
  73 + }
  74 +
  75 +
  76 +}
src/main/java/com/bsth/entity/oil/Ylb.java
1 package com.bsth.entity.oil; 1 package com.bsth.entity.oil;
2 2
  3 +import java.text.DecimalFormat;
3 import java.util.Date; 4 import java.util.Date;
4 5
5 import javax.persistence.Entity; 6 import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 7 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 8 import javax.persistence.Id;
8 import javax.persistence.Table; 9 import javax.persistence.Table;
  10 +import javax.persistence.Transient;
9 11
10 import org.springframework.format.annotation.DateTimeFormat; 12 import org.springframework.format.annotation.DateTimeFormat;
11 13
  14 +import com.bsth.data.BasicData;
  15 +
12 @Entity 16 @Entity
13 @Table(name = "bsth_c_ylb") 17 @Table(name = "bsth_c_ylb")
14 public class Ylb { 18 public class Ylb {
@@ -22,23 +26,23 @@ public class Ylb { @@ -22,23 +26,23 @@ public class Ylb {
22 private String fgsdm; 26 private String fgsdm;
23 private String nbbm; 27 private String nbbm;
24 private String jsy; 28 private String jsy;
25 - private Double czlc;  
26 - private Double jzlc;  
27 - private Double czyl;  
28 - private Double jzyl; 29 + private Double czlc=0.0;
  30 + private Double jzlc=0.0;
  31 + private Double czyl=0.0;
  32 + private Double jzyl=0.0;
29 private Double jzl; 33 private Double jzl;
30 private int sfkt; 34 private int sfkt;
31 private String jhsj; 35 private String jhsj;
32 - private Double yh;  
33 - private Double sh; 36 + private Double yh=0.0;
  37 + private Double sh=0.0;
34 private String shyy; 38 private String shyy;
35 - private Double zlc; 39 + private Double zlc=0.0;
36 private int yhlx; 40 private int yhlx;
37 private String rylx; 41 private String rylx;
38 - private Double ns;  
39 - private Double fyylc;  
40 - private Double jhzlc;  
41 - private Double jhfyylc; 42 + private Double ns=0.0;
  43 + private Double fyylc=0.0;
  44 + private Double jhzlc=0.0;
  45 + private Double jhfyylc=0.0;
42 private int jhzbc; 46 private int jhzbc;
43 private int jhbc; 47 private int jhbc;
44 private int sjzbc; 48 private int sjzbc;
@@ -49,6 +53,16 @@ public class Ylb { @@ -49,6 +53,16 @@ public class Ylb {
49 private int nylx; 53 private int nylx;
50 //进场顺序(根据最先出场和最后进场来关联车辆的存油量) 54 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
51 private int jcsx; 55 private int jcsx;
  56 +
  57 + @Transient
  58 + private String bglyh;
  59 +
  60 + @Transient
  61 + private String xlname;
  62 +
  63 + @Transient
  64 + private String gsname;
  65 +
52 66
53 public Integer getId() { 67 public Integer getId() {
54 return id; 68 return id;
@@ -254,5 +268,38 @@ public class Ylb { @@ -254,5 +268,38 @@ public class Ylb {
254 public void setJcsx(int jcsx){ 268 public void setJcsx(int jcsx){
255 this.jcsx=jcsx; 269 this.jcsx=jcsx;
256 } 270 }
  271 +
  272 + public String getBglyh() {
  273 + if(this.getZlc()==0){
  274 + return "0.00";
  275 + }else{
  276 + DecimalFormat df = new DecimalFormat("0.00");
  277 + return df.format(this.getYh()/this.getZlc()*100);
  278 + }
  279 + }
  280 +
  281 + public void setBglyh(String bglyh) {
  282 + this.bglyh = bglyh;
  283 + }
  284 +
  285 + public String getXlname() {
  286 + return BasicData.lineCode2NameMap.get(this.xlbm);
  287 + }
  288 +
  289 + public void setXlname(String xlname) {
  290 + this.xlname = xlname;
  291 + }
  292 +
  293 + public String getGsname() {
  294 + return BasicData.nbbm2CompanyCodeMap.get(this.nbbm);
  295 + }
  296 +
  297 + public void setGsname(String gsname) {
  298 + this.gsname = gsname;
  299 + }
  300 +
  301 +
  302 +
  303 +
257 304
258 } 305 }
src/main/java/com/bsth/entity/oil/Ylxxb.java
@@ -6,6 +6,9 @@ import javax.persistence.Entity; @@ -6,6 +6,9 @@ import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 6 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 7 import javax.persistence.Id;
8 import javax.persistence.Table; 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import org.springframework.format.annotation.DateTimeFormat;
9 12
10 @Entity 13 @Entity
11 @Table(name = "bsth_c_ylxxb") 14 @Table(name = "bsth_c_ylxxb")
@@ -13,6 +16,7 @@ public class Ylxxb { @@ -13,6 +16,7 @@ public class Ylxxb {
13 @Id 16 @Id
14 @GeneratedValue 17 @GeneratedValue
15 private Integer id; 18 private Integer id;
  19 + @DateTimeFormat(pattern="yyyy-MM-dd")
16 private Date yyrq; 20 private Date yyrq;
17 private Date jlrq; 21 private Date jlrq;
18 private String nbbm; 22 private String nbbm;
@@ -29,6 +33,12 @@ public class Ylxxb { @@ -29,6 +33,12 @@ public class Ylxxb {
29 private String xgr; 33 private String xgr;
30 private String fromgsdm; 34 private String fromgsdm;
31 private int nylx; 35 private int nylx;
  36 + @Transient
  37 + private String ldgh;
  38 + //0为接口数据,1为手工输入
  39 + private int jylx=0;
  40 +
  41 +
32 public Integer getId() { 42 public Integer getId() {
33 return id; 43 return id;
34 } 44 }
@@ -131,6 +141,18 @@ public class Ylxxb { @@ -131,6 +141,18 @@ public class Ylxxb {
131 public void setNylx(int nylx) { 141 public void setNylx(int nylx) {
132 this.nylx = nylx; 142 this.nylx = nylx;
133 } 143 }
  144 + public String getLdgh() {
  145 + return ldgh;
  146 + }
  147 + public void setLdgh(String ldgh) {
  148 + this.ldgh = ldgh;
  149 + }
  150 + public int getJylx() {
  151 + return jylx;
  152 + }
  153 + public void setJylx(int jylx) {
  154 + this.jylx = jylx;
  155 + }
134 156
135 157
136 158
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -6,9 +6,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @@ -6,9 +6,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
6 import javax.persistence.*; 6 import javax.persistence.*;
7 7
8 import org.apache.commons.lang3.StringUtils; 8 import org.apache.commons.lang3.StringUtils;
  9 +import org.joda.time.format.DateTimeFormat;
  10 +import org.joda.time.format.DateTimeFormatter;
9 11
10 -import java.text.ParseException;  
11 -import java.text.SimpleDateFormat;  
12 import java.util.Date; 12 import java.util.Date;
13 import java.util.HashSet; 13 import java.util.HashSet;
14 import java.util.Set; 14 import java.util.Set;
@@ -507,31 +507,28 @@ public class ScheduleRealInfo { @@ -507,31 +507,28 @@ public class ScheduleRealInfo {
507 public void setDfsjT(Long dfsjT) { 507 public void setDfsjT(Long dfsjT) {
508 this.dfsjT = dfsjT; 508 this.dfsjT = dfsjT;
509 } 509 }
510 - 510 +
  511 +
  512 + @Transient
  513 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  514 + @Transient
  515 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  516 +
511 public void setDfsjAll(Long dfsjT) { 517 public void setDfsjAll(Long dfsjT) {
512 this.dfsjT = dfsjT; 518 this.dfsjT = dfsjT;
513 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
514 - this.dfsj = sdfHHmm.format(new Date(this.dfsjT)); 519 + this.dfsj = fmtHHmm.print(this.dfsjT);
515 } 520 }
516 521
517 public void setDfsjAll(String dfsj) { 522 public void setDfsjAll(String dfsj) {
518 -  
519 - try {  
520 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
521 - this.dfsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime();  
522 - this.dfsj = dfsj;  
523 - } catch (ParseException e) {  
524 - e.printStackTrace();  
525 - } 523 + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);
  524 + this.dfsj = dfsj;
526 } 525 }
527 526
528 public void calcEndTime(){ 527 public void calcEndTime(){
529 //计划终点时间 528 //计划终点时间
530 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
531 if(this.getBcsj() != null){ 529 if(this.getBcsj() != null){
532 - Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000));  
533 - this.setZdsjT(zdDate.getTime());  
534 - this.setZdsj(sdfHHmm.format(zdDate)); 530 + this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000));
  531 + this.setZdsj(fmtHHmm.print(this.zdsjT));
535 } 532 }
536 } 533 }
537 534
@@ -583,13 +580,8 @@ public class ScheduleRealInfo { @@ -583,13 +580,8 @@ public class ScheduleRealInfo {
583 * @throws 580 * @throws
584 */ 581 */
585 public void setFcsjAll(String fcsj){ 582 public void setFcsjAll(String fcsj){
586 - try {  
587 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
588 - this.fcsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime();  
589 - this.fcsj = fcsj;  
590 - } catch (ParseException e) {  
591 - e.printStackTrace();  
592 - } 583 + this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj);
  584 + this.fcsj = fcsj;
593 } 585 }
594 586
595 /** 587 /**
@@ -600,8 +592,7 @@ public class ScheduleRealInfo { @@ -600,8 +592,7 @@ public class ScheduleRealInfo {
600 */ 592 */
601 public void setFcsjAll(Long fcsjT){ 593 public void setFcsjAll(Long fcsjT){
602 this.fcsjT = fcsjT; 594 this.fcsjT = fcsjT;
603 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
604 - this.fcsj = sdfHHmm.format(new Date(fcsjT)); 595 + this.fcsj = fmtHHmm.print(fcsjT);
605 } 596 }
606 597
607 /** 598 /**
@@ -611,15 +602,9 @@ public class ScheduleRealInfo { @@ -611,15 +602,9 @@ public class ScheduleRealInfo {
611 * @throws 602 * @throws
612 */ 603 */
613 public void setFcsjActualAll(String fcsjActual){ 604 public void setFcsjActualAll(String fcsjActual){
614 - try {  
615 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
616 - this.fcsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime();  
617 - this.fcsjActual = fcsjActual;  
618 -  
619 - calcStatus();  
620 - } catch (ParseException e) {  
621 - e.printStackTrace();  
622 - } 605 + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);
  606 + this.fcsjActual = fcsjActual;
  607 + calcStatus();
623 } 608 }
624 609
625 /** 610 /**
@@ -630,9 +615,8 @@ public class ScheduleRealInfo { @@ -630,9 +615,8 @@ public class ScheduleRealInfo {
630 */ 615 */
631 public void setFcsjActualAll(Long t){ 616 public void setFcsjActualAll(Long t){
632 this.fcsjActualTime = t; 617 this.fcsjActualTime = t;
633 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
634 - this.fcsjActual = sdfHHmm.format(new Date(t));  
635 - 618 + this.fcsjActual = fmtHHmm.print(t);
  619 +
636 //更新班次状态 620 //更新班次状态
637 calcStatus(); 621 calcStatus();
638 } 622 }
@@ -645,12 +629,10 @@ public class ScheduleRealInfo { @@ -645,12 +629,10 @@ public class ScheduleRealInfo {
645 */ 629 */
646 public void setZdsjActualAll(Long t){ 630 public void setZdsjActualAll(Long t){
647 this.zdsjActualTime = t; 631 this.zdsjActualTime = t;
648 - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");  
649 - this.zdsjActual = sdfHHmm.format(new Date(t)); 632 + this.zdsjActual = fmtHHmm.print(t);
650 633
651 //更新班次状态 634 //更新班次状态
652 calcStatus(); 635 calcStatus();
653 - //this.synchroZdsj();  
654 } 636 }
655 637
656 /** 638 /**
@@ -660,15 +642,10 @@ public class ScheduleRealInfo { @@ -660,15 +642,10 @@ public class ScheduleRealInfo {
660 * @throws 642 * @throws
661 */ 643 */
662 public void setZdsjActualAll(String zdsjActual){ 644 public void setZdsjActualAll(String zdsjActual){
663 - try {  
664 - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");  
665 - this.zdsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime();  
666 - this.zdsjActual = zdsjActual;  
667 -  
668 - calcStatus();  
669 - } catch (ParseException e) {  
670 - e.printStackTrace();  
671 - } 645 + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);
  646 + this.zdsjActual = zdsjActual;
  647 +
  648 + calcStatus();
672 } 649 }
673 650
674 public Long getSpId() { 651 public Long getSpId() {
@@ -713,17 +690,17 @@ public class ScheduleRealInfo { @@ -713,17 +690,17 @@ public class ScheduleRealInfo {
713 return this.status == -1; 690 return this.status == -1;
714 } 691 }
715 692
716 - public boolean isNotDestroy(){ 693 +/* public boolean isNotDestroy(){
717 return this.status != -1; 694 return this.status != -1;
718 - } 695 + }*/
719 696
720 public Set<ChildTaskPlan> getcTasks() { 697 public Set<ChildTaskPlan> getcTasks() {
721 return cTasks; 698 return cTasks;
722 } 699 }
723 700
724 - public void setcTasks(Set<ChildTaskPlan> cTasks) { 701 +/* public void setcTasks(Set<ChildTaskPlan> cTasks) {
725 this.cTasks = cTasks; 702 this.cTasks = cTasks;
726 - } 703 + }*/
727 704
728 public String getScheduleDateStr() { 705 public String getScheduleDateStr() {
729 return scheduleDateStr; 706 return scheduleDateStr;