Commit d8bbd0bf73ac838387b2138455181f493c3df07f
0 parents
初始化
Showing
41 changed files
with
4484 additions
and
0 deletions
Too many changes to show.
To preserve performance only 41 of 4910 files are displayed.
.gitignore
0 → 100644
README.md
0 → 100644
| 1 | +++ a/README.md | ||
| 1 | +公交调度系统BS版 0.2 | ||
| 2 | +* 各大块功能服务工程化改造,主项目分布式调用模块服务改造 | ||
| 3 | + | ||
| 4 | +====== | ||
| 5 | +---------- | ||
| 6 | +## 目录 | ||
| 7 | +--------- | ||
| 8 | + * [字典表](#字典表) | ||
| 9 | + * [动态jpa查询实现](#动态jpa查询实现) | ||
| 10 | + * [车载 gps 相关数据](#gps) | ||
| 11 | + * [实时gps数据接口 http](#实时gps接口) | ||
| 12 | + * [进出站数据表结构](#进站数据) | ||
| 13 | + * [异常警报表结构](#异常警报) | ||
| 14 | + * [大间隔](#大间隔) | ||
| 15 | + * [超速](#超速) | ||
| 16 | + * [越界](#越界) | ||
| 17 | + * [越站](#越站) | ||
| 18 | + * [聚集](#聚集) | ||
| 19 | + * [掉线](#掉线) | ||
| 20 | + * [调度消息下发接口HTTP](#调度消息下发接口) | ||
| 21 | + * [调度消息上传接口HTTP](#调度消息上传接口) | ||
| 22 | + * [车辆历史GPS数据](#车辆历史GPS) | ||
| 23 | + | ||
| 24 | +---------- | ||
| 25 | + | ||
| 26 | +## 字典表 | ||
| 27 | +---------- | ||
| 28 | +字典操作全部由前端负责,主要有2种。 | ||
| 29 | + | ||
| 30 | +1、转换字典代码。 | ||
| 31 | + 当pjax的`pjax:success`事件被触发(片段加载完成) | ||
| 32 | + 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换 | ||
| 33 | +``` html | ||
| 34 | +--dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码 | ||
| 35 | +<span class="nt-dictionary" data-group="ScheduleType">out</span> | ||
| 36 | +--to | ||
| 37 | +<span>出场</span> | ||
| 38 | + | ||
| 39 | +<!- dom标签为input时,如下 data-code为要转换的代码 --> | ||
| 40 | +<input class="nt-dictionary" data-group="ScheduleType" data-code="out"> | ||
| 41 | +--to | ||
| 42 | +<input value="出场"> | ||
| 43 | + | ||
| 44 | +<!- dom标签为select时 如下 data-code为要选中的项 --> | ||
| 45 | +<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select> | ||
| 46 | +--to | ||
| 47 | +<select> | ||
| 48 | + <option value="normal">正常班次</option> | ||
| 49 | + <option value="out" selected>出场</option> | ||
| 50 | + <option value="in">进场</option> | ||
| 51 | + <option value="oil">加油</option> | ||
| 52 | + <option value="temp">临加</option> | ||
| 53 | + <option value="region">区间</option> | ||
| 54 | + <option value="venting">放空</option> | ||
| 55 | + <option value="major">放大站</option> | ||
| 56 | +</select> | ||
| 57 | +``` | ||
| 58 | +*原标签的class 除nt-dictionary 外,其余均会被保留* | ||
| 59 | + | ||
| 60 | +2、dictionary.js提供如下方法自行使用 | ||
| 61 | +| 方法名 | 参数|返回| | ||
| 62 | +| ---- | ---- | ---- | ---- | | ||
| 63 | +| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} | | ||
| 64 | +| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}| | ||
| 65 | +| transformCode (转换字典代码)| (group, code) | 上行 | | ||
| 66 | + | ||
| 67 | +## 动态jpa查询实现 | ||
| 68 | +---------- | ||
| 69 | +*参考调度系统枚举com.bsth.entity.search.SearchOperator* | ||
| 70 | + | ||
| 71 | + | ||
| 72 | +## gps | ||
| 73 | +---------- | ||
| 74 | +### 实时gps接口 | ||
| 75 | + | ||
| 76 | +所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/) | ||
| 77 | +根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901) | ||
| 78 | + | ||
| 79 | +<span style="color: red">Response</span>: | ||
| 80 | +```json | ||
| 81 | +{ | ||
| 82 | + "data":[ | ||
| 83 | + { | ||
| 84 | + "companyCode":5, | ||
| 85 | + "lineId":10329, | ||
| 86 | + "deviceId":"05B01901", | ||
| 87 | + "carparkNo":"00000000", | ||
| 88 | + "stopNo":"7C890002", | ||
| 89 | + "lon":121.549866, | ||
| 90 | + "lat":31.238798, | ||
| 91 | + "timestamp":1397104499000, | ||
| 92 | + "speed":42.0, | ||
| 93 | + "direction":245.9, | ||
| 94 | + "state":0, | ||
| 95 | + "upDown":0 | ||
| 96 | + }] | ||
| 97 | +} | ||
| 98 | +``` | ||
| 99 | + | ||
| 100 | +| -- | --|--| | ||
| 101 | +| ---- | ---- | ---- | | ||
| 102 | +| companyCode | int | 公司代码 | | ||
| 103 | +| lineId | int | 线路编码 | | ||
| 104 | +| deviceId | String | 设备编号 | | ||
| 105 | +| carparkNo | String | 停车场编码 | | ||
| 106 | +| stopNo | String | 站点编码 | | ||
| 107 | +| lon | float | 经度 | | ||
| 108 | +| lat | float | 纬度 | | ||
| 109 | +| timestamp | long | 时间戳 | | ||
| 110 | +| speed | float | 速度| | ||
| 111 | +| direction | float | 方向(角度) | | ||
| 112 | +| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) | | ||
| 113 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)| | ||
| 114 | + | ||
| 115 | + | ||
| 116 | +### 进站数据 | ||
| 117 | +---------- | ||
| 118 | +表名: | ||
| 119 | + | ||
| 120 | +| .. | .. | .. | | ||
| 121 | +| ---- | ---- | ---- | | ||
| 122 | +| id | int | 主键 | | ||
| 123 | +| deviceId | String | 设备号 | | ||
| 124 | +| lineId | int | 线路编码 | | ||
| 125 | +| stopNo | long | 站点编码 | | ||
| 126 | +| timestamp | long | 时间戳 | | ||
| 127 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 128 | +| createDate | Date | 创建时间 | | ||
| 129 | + | ||
| 130 | + | ||
| 131 | +### 异常警报 | ||
| 132 | +---------- | ||
| 133 | + | ||
| 134 | +### 大间隔 | ||
| 135 | +---------- | ||
| 136 | +表名: | ||
| 137 | + | ||
| 138 | +| .. | .. | .. | | ||
| 139 | +| ---- | ---- | ---- | | ||
| 140 | +| id | int | 主键 | | ||
| 141 | +| line | int | 线路编码 | | ||
| 142 | +| station | String | 站点编码 | | ||
| 143 | +| cVehicle | String | 当前车辆编码 | | ||
| 144 | +| lastVehicle | String | 上一个车辆编码 | | ||
| 145 | +| interval | long | 间隔时间(秒) | | ||
| 146 | +| timestamp | long | 时间戳 | | ||
| 147 | +| createDate | Date | 创建时间 | | ||
| 148 | + | ||
| 149 | +### 超速 | ||
| 150 | +---------- | ||
| 151 | +表名: | ||
| 152 | + | ||
| 153 | +| .. | .. | .. | | ||
| 154 | +| ---- | ---- | ---- | | ||
| 155 | +| id | int | 主键 | | ||
| 156 | +| vehicle | String | 车辆编码 | | ||
| 157 | +| line | int | 线路编码 | | ||
| 158 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 159 | +| lon | float | 经度 | | ||
| 160 | +| lat | float | 纬度| | ||
| 161 | +| speed | float | 速度 | | ||
| 162 | +| timestamp | long | 时间戳 | | ||
| 163 | +| createDate | Date | 时间 | | ||
| 164 | + | ||
| 165 | +### 越界 | ||
| 166 | +---------- | ||
| 167 | +表名: | ||
| 168 | + | ||
| 169 | +| .. | .. | .. | | ||
| 170 | +| ---- | ---- | ---- | | ||
| 171 | +| id | int | 主键 | | ||
| 172 | +| vehicle | String | 车辆编码 | | ||
| 173 | +| line | int | 线路编码 | | ||
| 174 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 175 | +| lon | float | 经度 | | ||
| 176 | +| lat | float | 纬度| | ||
| 177 | +| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值| | ||
| 178 | +| timestamp | long | 时间戳 | | ||
| 179 | +| createDate | Date | 时间 | | ||
| 180 | + | ||
| 181 | + | ||
| 182 | +### 越站 | ||
| 183 | +---------- | ||
| 184 | +表名: | ||
| 185 | + | ||
| 186 | +| .. | .. | .. | | ||
| 187 | +| ---- | ---- | ---- | | ||
| 188 | +| id | int | 主键 | | ||
| 189 | +| line | int | 线路编码 | | ||
| 190 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 191 | +| station | String | 站点编码 | | ||
| 192 | +| vehicle | String | 车辆编码 | | ||
| 193 | +| inData | Date | 进站时间 | | ||
| 194 | +| outDate | Date | 出站时间 | | ||
| 195 | + | ||
| 196 | + | ||
| 197 | +### 聚集 | ||
| 198 | +---------- | ||
| 199 | +表名: | ||
| 200 | + | ||
| 201 | +| .. | .. | .. | | ||
| 202 | +| ---- | ---- | ---- | | ||
| 203 | +| id | int | 主键 | | ||
| 204 | +| line | int | 线路编码 | | ||
| 205 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 206 | +| stations | String | 站点(多个用 , 号分隔。应该是连续站点) | | ||
| 207 | +| vehicles | String | 车辆编码(多个用 , 号分隔) | | ||
| 208 | +| timestamp | long | 时间戳 | | ||
| 209 | +| createDate | Date | 时间 | | ||
| 210 | + | ||
| 211 | + | ||
| 212 | +### 掉线 | ||
| 213 | +---------- | ||
| 214 | +表名: | ||
| 215 | + | ||
| 216 | +| .. | .. | .. | | ||
| 217 | +| ---- | ---- | ---- | | ||
| 218 | +| id | int | 主键 | | ||
| 219 | +| line | int | 线路编码 | | ||
| 220 | +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) | | ||
| 221 | +| vehicle | String | 车辆编码 | | ||
| 222 | +| lon | float | 经度 | | ||
| 223 | +| lat | float | 纬度| | ||
| 224 | +| timestamp | long | 时间戳 | | ||
| 225 | +| createDate | Date | 时间 | | ||
| 226 | + | ||
| 227 | + | ||
| 228 | +### 调度消息下发接口 | ||
| 229 | +---------- | ||
| 230 | +[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/) | ||
| 231 | + | ||
| 232 | +<span style="color: red">Request</span>: | ||
| 233 | +```json | ||
| 234 | +{ | ||
| 235 | + "deviceId":12345, | ||
| 236 | + "timestamp":44324, | ||
| 237 | + "operCode":0x60, | ||
| 238 | + "data":{ | ||
| 239 | + "companyCode":22, | ||
| 240 | + "deviceId":"029L2222", | ||
| 241 | + "timestamp":134326, | ||
| 242 | + "instructType":00, | ||
| 243 | + "dispatchInstruct":0x00, | ||
| 244 | + "msgId":12345, | ||
| 245 | + "alarmTime":201606012000, | ||
| 246 | + "serviceState":00000000, | ||
| 247 | + "txtContent":"你好" | ||
| 248 | + } | ||
| 249 | +} | ||
| 250 | +``` | ||
| 251 | +| .. | .. | .. | | ||
| 252 | +| ---- | ---- | ---- | | ||
| 253 | +| deviceId | string | 设备编号 | | ||
| 254 | +| timestamp | long | 时间戳(ms) | | ||
| 255 | +| operCode | short | 一级协议 | | ||
| 256 | +| data.companyCode | short | 公司代码 | | ||
| 257 | +| data.deviceId | string | 设备编号 | | ||
| 258 | +| data.timestamp | long | 时间戳 | | ||
| 259 | +| data.instructType | short | 保留 默认0 | | ||
| 260 | +| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。| | ||
| 261 | +| data.msgId | long | 同上 | | ||
| 262 | +| data.alarmTime | long | 闹钟 MMddhhmm| | ||
| 263 | +| data.serviceState | long | 多状态字节 先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。| | ||
| 264 | +| data.txtContent | string | 下发的消息文本 | | ||
| 265 | +```json | ||
| 266 | +{ | ||
| 267 | + "deviceId":12345, | ||
| 268 | + "timestamp":44324, | ||
| 269 | + "operCode":0x64, | ||
| 270 | + "data":{ | ||
| 271 | + "cityCode":22, | ||
| 272 | + "deviceId":"029L2222", | ||
| 273 | + "lineId":"134326" | ||
| 274 | + } | ||
| 275 | +} | ||
| 276 | +``` | ||
| 277 | +| .. | .. | .. | | ||
| 278 | +| ---- | ---- | ---- | | ||
| 279 | +| deviceId | string | 设备编号 | | ||
| 280 | +| timestamp | long | 时间戳(ms) | | ||
| 281 | +| operCode | short | 一级协议 | | ||
| 282 | +| data.cityCode | short | 城市区号 | | ||
| 283 | +| data.deviceId | string | 设备编号 | | ||
| 284 | +| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 | | ||
| 285 | + | ||
| 286 | +```json | ||
| 287 | +{ | ||
| 288 | + "deviceId":12345, | ||
| 289 | + "timestamp":44324, | ||
| 290 | + "operCode":0xC0, | ||
| 291 | + "data":{ | ||
| 292 | + "operCode":0x86, | ||
| 293 | + "requestAck":0x06 | ||
| 294 | + } | ||
| 295 | +} | ||
| 296 | +``` | ||
| 297 | +| .. | .. | .. | | ||
| 298 | +| ---- | ---- | ---- | | ||
| 299 | +| deviceId | string | 设备编号 | | ||
| 300 | +| timestamp | long | 时间戳(ms) | | ||
| 301 | +| operCode | short | 一级协议 | | ||
| 302 | +| data.operCode | short | 二级协议 | | ||
| 303 | +| data.requestAck | short | 请求应答字 0x06同意 0x15不同意| | ||
| 304 | + | ||
| 305 | +```json | ||
| 306 | +{ | ||
| 307 | + "deviceId":12345, | ||
| 308 | + "timestamp":44324, | ||
| 309 | + "operCode":0xC0, | ||
| 310 | + "data":{ | ||
| 311 | + "operCode":0xa3, | ||
| 312 | + "deviceId":12345, | ||
| 313 | + "ipAddress":222.66.0.204, | ||
| 314 | + "port":8899, | ||
| 315 | + "reportMode":0, | ||
| 316 | + "interval":0, | ||
| 317 | + "distance":0, | ||
| 318 | + "speedingThreshold":0, | ||
| 319 | + "alarmThreshold":0, | ||
| 320 | + "posIpAddress":0, | ||
| 321 | + "posPort":0, | ||
| 322 | + "delay":0, | ||
| 323 | + "speedThreshold1":0, | ||
| 324 | + "speedThreshold2":0, | ||
| 325 | + "contrast":0, | ||
| 326 | + "brightness":0, | ||
| 327 | + "saturation":0 | ||
| 328 | + } | ||
| 329 | +} | ||
| 330 | +``` | ||
| 331 | +| .. | .. | .. | | ||
| 332 | +| ---- | ---- | ---- | | ||
| 333 | +| deviceId | string | 设备编号 | | ||
| 334 | +| timestamp | long | 时间戳(ms) | | ||
| 335 | +| operCode | short | 一级协议 | | ||
| 336 | +| data.operCode | short | 二级协议 | | ||
| 337 | +| data.deviceId | string | 设备编号| | ||
| 338 | +| data.ipAddress | string | 网关IP地址| | ||
| 339 | +| data.port | string | 网关端口| | ||
| 340 | +| data.reportMode | short | 定时定距上报模式| | ||
| 341 | +| data.interval | int | 定时上报时间间隔| | ||
| 342 | +| data.distance | string | 定距上报距离间隔| | ||
| 343 | +| data.speedingThreshold | short | 非线路状态超速阀门| | ||
| 344 | +| data.alarmThreshold | short | 预警阀门| | ||
| 345 | +| data.posIpAddress | string | pos机IP地址| | ||
| 346 | +| data.posPort | string | pos机端口| | ||
| 347 | +| data.delay | int | 延迟机关时间| | ||
| 348 | +| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45| | ||
| 349 | +| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35| | ||
| 350 | +| data.deviceId | short | 对比度| | ||
| 351 | +| data.deviceId | short | 亮度| | ||
| 352 | +| data.deviceId | short | 饱和度| | ||
| 353 | + | ||
| 354 | +```json | ||
| 355 | +{ | ||
| 356 | + "deviceId":12345, | ||
| 357 | + "timestamp":44324, | ||
| 358 | + "operCode":0xC0, | ||
| 359 | + "data":{ | ||
| 360 | + "operCode":0xa4 | ||
| 361 | + } | ||
| 362 | +} | ||
| 363 | +``` | ||
| 364 | +| .. | .. | .. | | ||
| 365 | +| ---- | ---- | ---- | | ||
| 366 | +| deviceId | string | 设备编号 | | ||
| 367 | +| timestamp | long | 时间戳(ms) | | ||
| 368 | +| operCode | short | 一级协议 | | ||
| 369 | +| data.operCode | short | 二级协议 | | ||
| 370 | + | ||
| 371 | +```json | ||
| 372 | +{ | ||
| 373 | + "deviceId":12345, | ||
| 374 | + "timestamp":44324, | ||
| 375 | + "operCode":0xC0, | ||
| 376 | + "data":{ | ||
| 377 | + "operCode":0xa5 | ||
| 378 | + "programVersion":2 | ||
| 379 | + } | ||
| 380 | +} | ||
| 381 | +``` | ||
| 382 | +| .. | .. | .. | | ||
| 383 | +| ---- | ---- | ---- | | ||
| 384 | +| deviceId | string | 设备编号 | | ||
| 385 | +| timestamp | long | 时间戳(ms) | | ||
| 386 | +| operCode | short | 一级协议 | | ||
| 387 | +| data.operCode | short | 二级协议 | | ||
| 388 | +| data.programVersion | short | 程序版本 | | ||
| 389 | + | ||
| 390 | +<span style="color: red">Response</span>: | ||
| 391 | +```json | ||
| 392 | +{ | ||
| 393 | + "errCode":0 | ||
| 394 | +} | ||
| 395 | +``` | ||
| 396 | + | ||
| 397 | +### 调度消息上传接口 | ||
| 398 | +---------- | ||
| 399 | +上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream) | ||
| 400 | +<span style="color: red">Request</span>: | ||
| 401 | +```json | ||
| 402 | +{ | ||
| 403 | + "deviceId":12345, | ||
| 404 | + "timestamp":44324, | ||
| 405 | + "status":0, | ||
| 406 | + "operCode":0x80, | ||
| 407 | + "data":{ | ||
| 408 | + "operCode":0x26, | ||
| 409 | + "requestCode":22 | ||
| 410 | + } | ||
| 411 | +} | ||
| 412 | +``` | ||
| 413 | +| .. | .. | .. | | ||
| 414 | +| ---- | ---- | ---- | | ||
| 415 | +| deviceId | string | 设备编号 | | ||
| 416 | +| timestamp | long | 时间戳(ms) | | ||
| 417 | +| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 | | ||
| 418 | +| operCode | short | 一级协议 消息确认将无数据 | | ||
| 419 | +| data.operCode | short | 二级协议 | | ||
| 420 | +| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 | | ||
| 421 | +<span style="color: red">Response</span>: | ||
| 422 | +```json | ||
| 423 | +{ | ||
| 424 | + "errCode":0 | ||
| 425 | +} | ||
| 426 | +``` | ||
| 427 | + | ||
| 428 | +### 车辆历史GPS | ||
| 429 | +---------- | ||
| 430 | +表名:BSTH_C_GPS_INFO | ||
| 431 | + | ||
| 432 | +| .. | .. | .. | | ||
| 433 | +| ---- | ---- | ---- | | ||
| 434 | +| cityCode | int | 城市代码 | | ||
| 435 | +| industryCode | int | 行业代码 | | ||
| 436 | +| companyCode | int | 企业代码 | | ||
| 437 | +| lineId | int | 线路编号 | | ||
| 438 | +| deviceId | string | 设备编号 | | ||
| 439 | +| driverNo | int | 驾驶员工号 | | ||
| 440 | +| carparkSerialNo | int | 停车场序列号 | | ||
| 441 | +| carparkNo | string | 停车场编号 | | ||
| 442 | +| stopSerialNo | int | 站点序列号 | | ||
| 443 | +| stopNo | string | 停车场编号 | | ||
| 444 | +| lon | float | 经度 | | ||
| 445 | +| lat | float | 维度 | | ||
| 446 | +| ts | long | 时间戳 | | ||
| 447 | +| speedSensor | float | 发动机速度 | | ||
| 448 | +| speedGps | float | gps速度 | | ||
| 449 | +| direction | float | 角度0-359 | | ||
| 450 | +| inTemp | int | 车内温度 | | ||
| 451 | +| serviceState | long | 设备状态字 | | ||
| 452 | +<<<<<<< HEAD | ||
| 453 | +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | | ||
| 454 | +======= | ||
| 455 | +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | | ||
| 456 | + | ||
| 457 | +>>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50 |
pom.xml
0 → 100644
| 1 | +++ a/pom.xml | ||
| 1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 3 | + | ||
| 4 | + <modelVersion>4.0.0</modelVersion> | ||
| 5 | + <groupId>com.bsth</groupId> | ||
| 6 | + <artifactId>bsth_control_v2</artifactId> | ||
| 7 | + <version>0.0.1-SNAPSHOT</version> | ||
| 8 | + <packaging>war</packaging> | ||
| 9 | + <description>分布式服务优化版本</description> | ||
| 10 | + | ||
| 11 | + <parent> | ||
| 12 | + <groupId>org.springframework.boot</groupId> | ||
| 13 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 14 | + <version>1.3.3.RELEASE</version> | ||
| 15 | + </parent> | ||
| 16 | + | ||
| 17 | + <dependencies> | ||
| 18 | + <dependency> | ||
| 19 | + <groupId>org.springframework.boot</groupId> | ||
| 20 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 21 | + </dependency> | ||
| 22 | + | ||
| 23 | + <dependency> | ||
| 24 | + <groupId>org.springframework.boot</groupId> | ||
| 25 | + <artifactId>spring-boot-starter-tomcat</artifactId> | ||
| 26 | + <scope>provided</scope> | ||
| 27 | + </dependency> | ||
| 28 | + <dependency> | ||
| 29 | + <groupId>javax.servlet</groupId> | ||
| 30 | + <artifactId>javax.servlet-api</artifactId> | ||
| 31 | + <version>3.1.0</version> | ||
| 32 | + <scope>provided</scope> | ||
| 33 | + </dependency> | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>org.springframework.boot</groupId> | ||
| 36 | + <artifactId>spring-boot-starter-security</artifactId> | ||
| 37 | + </dependency> | ||
| 38 | + <!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> | ||
| 39 | + </dependency> --> | ||
| 40 | + <dependency> | ||
| 41 | + <groupId>org.springframework.boot</groupId> | ||
| 42 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 43 | + </dependency> | ||
| 44 | + <dependency> | ||
| 45 | + <groupId>org.springframework.boot</groupId> | ||
| 46 | + <artifactId>spring-boot-starter-aop</artifactId> | ||
| 47 | + </dependency> | ||
| 48 | + | ||
| 49 | + <dependency> | ||
| 50 | + <groupId>org.springframework</groupId> | ||
| 51 | + <artifactId>spring-context-support</artifactId> | ||
| 52 | + </dependency> | ||
| 53 | + <dependency> | ||
| 54 | + <groupId>org.springframework.boot</groupId> | ||
| 55 | + <artifactId>spring-boot-starter-redis</artifactId> | ||
| 56 | + </dependency> | ||
| 57 | + <dependency> | ||
| 58 | + <groupId>org.springframework.boot</groupId> | ||
| 59 | + <artifactId>spring-boot-starter-websocket</artifactId> | ||
| 60 | + </dependency> | ||
| 61 | + <dependency> | ||
| 62 | + <groupId>mysql</groupId> | ||
| 63 | + <artifactId>mysql-connector-java</artifactId> | ||
| 64 | + </dependency> | ||
| 65 | + | ||
| 66 | + <dependency> | ||
| 67 | + <groupId>joda-time</groupId> | ||
| 68 | + <artifactId>joda-time</artifactId> | ||
| 69 | + </dependency> | ||
| 70 | + <dependency> | ||
| 71 | + <groupId>com.alibaba</groupId> | ||
| 72 | + <artifactId>fastjson</artifactId> | ||
| 73 | + <version>1.2.4</version> | ||
| 74 | + </dependency> | ||
| 75 | + | ||
| 76 | + <dependency> | ||
| 77 | + <groupId>org.apache.httpcomponents</groupId> | ||
| 78 | + <artifactId>httpclient</artifactId> | ||
| 79 | + </dependency> | ||
| 80 | + | ||
| 81 | + <dependency> | ||
| 82 | + <groupId>commons-dbcp</groupId> | ||
| 83 | + <artifactId>commons-dbcp</artifactId> | ||
| 84 | + </dependency> | ||
| 85 | + <dependency> | ||
| 86 | + <groupId>commons-lang</groupId> | ||
| 87 | + <artifactId>commons-lang</artifactId> | ||
| 88 | + <version>2.6</version> | ||
| 89 | + </dependency> | ||
| 90 | + <dependency> | ||
| 91 | + <groupId>org.apache.commons</groupId> | ||
| 92 | + <artifactId>commons-lang3</artifactId> | ||
| 93 | + <version>3.4</version> | ||
| 94 | + </dependency> | ||
| 95 | + <dependency> | ||
| 96 | + <groupId>commons-fileupload</groupId> | ||
| 97 | + <artifactId>commons-fileupload</artifactId> | ||
| 98 | + <version>1.2.2</version> | ||
| 99 | + </dependency> | ||
| 100 | + <dependency> | ||
| 101 | + <groupId>commons-io</groupId> | ||
| 102 | + <artifactId>commons-io</artifactId> | ||
| 103 | + <version>2.4</version> | ||
| 104 | + </dependency> | ||
| 105 | + <dependency> | ||
| 106 | + <groupId>org.codehaus.janino</groupId> | ||
| 107 | + <artifactId>janino</artifactId> | ||
| 108 | + </dependency> | ||
| 109 | + | ||
| 110 | + <dependency> | ||
| 111 | + <groupId>org.apache.poi</groupId> | ||
| 112 | + <artifactId>poi-ooxml</artifactId> | ||
| 113 | + <version>3.13</version> | ||
| 114 | + </dependency> | ||
| 115 | + | ||
| 116 | + <dependency> | ||
| 117 | + <groupId>com.google.guava</groupId> | ||
| 118 | + <artifactId>guava</artifactId> | ||
| 119 | + <version>19.0</version> | ||
| 120 | + </dependency> | ||
| 121 | + <!-- ftp文件上传包 --> | ||
| 122 | + <dependency> | ||
| 123 | + <groupId>commons-net</groupId> | ||
| 124 | + <artifactId>commons-net</artifactId> | ||
| 125 | + <version>3.5</version> | ||
| 126 | + </dependency> | ||
| 127 | + <dependency> | ||
| 128 | + <groupId>org.apache.commons</groupId> | ||
| 129 | + <artifactId>commons-compress</artifactId> | ||
| 130 | + <version>1.3</version> | ||
| 131 | + </dependency> | ||
| 132 | + <!-- drools 6依赖 --> | ||
| 133 | + <dependency> | ||
| 134 | + <groupId>org.kie</groupId> | ||
| 135 | + <artifactId>kie-api</artifactId> | ||
| 136 | + </dependency> | ||
| 137 | + <dependency> | ||
| 138 | + <groupId>org.drools</groupId> | ||
| 139 | + <artifactId>drools-compiler</artifactId> | ||
| 140 | + </dependency> | ||
| 141 | + | ||
| 142 | + <!-- springboot测试 --> | ||
| 143 | + <dependency> | ||
| 144 | + <groupId>org.springframework.boot</groupId> | ||
| 145 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 146 | + <scope>test</scope> | ||
| 147 | + </dependency> | ||
| 148 | + | ||
| 149 | + <dependency> | ||
| 150 | + <groupId>c3p0</groupId> | ||
| 151 | + <artifactId>c3p0</artifactId> | ||
| 152 | + <version>0.9.1.2</version> | ||
| 153 | + </dependency> | ||
| 154 | + | ||
| 155 | + <!-- 图表 --> | ||
| 156 | + <dependency> | ||
| 157 | + <groupId>com.google.code.gson</groupId> | ||
| 158 | + <artifactId>gson</artifactId> | ||
| 159 | + <version>2.2.4</version> | ||
| 160 | + </dependency> | ||
| 161 | + <dependency> | ||
| 162 | + <groupId>com.github.abel533</groupId> | ||
| 163 | + <artifactId>ECharts</artifactId> | ||
| 164 | + <version>2.1.8</version> | ||
| 165 | + </dependency> | ||
| 166 | + | ||
| 167 | + <dependency> | ||
| 168 | + <groupId>org.apache.tika</groupId> | ||
| 169 | + <artifactId>tika-core</artifactId> | ||
| 170 | + <version>1.7</version> | ||
| 171 | + </dependency> | ||
| 172 | + | ||
| 173 | + <!-- pentaho kettle 依赖 --> | ||
| 174 | + <dependency> | ||
| 175 | + <groupId>com.pentaho.kettle</groupId> | ||
| 176 | + <artifactId>kettle-core</artifactId> | ||
| 177 | + <version>6.0.1.0-386</version> | ||
| 178 | + </dependency> | ||
| 179 | + <dependency> | ||
| 180 | + <groupId>com.pentaho.kettle</groupId> | ||
| 181 | + <artifactId>kettle-engine</artifactId> | ||
| 182 | + <version>6.0.1.0-386</version> | ||
| 183 | + </dependency> | ||
| 184 | + <dependency> | ||
| 185 | + <groupId>com.pentaho.kettle</groupId> | ||
| 186 | + <artifactId>metastore</artifactId> | ||
| 187 | + <version>6.0.1.0-386</version> | ||
| 188 | + </dependency> | ||
| 189 | + <dependency> | ||
| 190 | + <groupId>com.pentaho.kettle</groupId> | ||
| 191 | + <artifactId>vfs2</artifactId> | ||
| 192 | + <version>2.1-20150824</version> | ||
| 193 | + </dependency> | ||
| 194 | + <dependency> | ||
| 195 | + <groupId>net.sourceforge.jexcelapi</groupId> | ||
| 196 | + <artifactId>jxl</artifactId> | ||
| 197 | + <version>2.6.12</version> | ||
| 198 | + </dependency> | ||
| 199 | + <dependency> | ||
| 200 | + <groupId>rhino</groupId> | ||
| 201 | + <artifactId>js</artifactId> | ||
| 202 | + <version>1.7R2</version> | ||
| 203 | + </dependency> | ||
| 204 | + <dependency> | ||
| 205 | + <groupId>javax.mail</groupId> | ||
| 206 | + <artifactId>mail</artifactId> | ||
| 207 | + <version>1.4.7</version> | ||
| 208 | + </dependency> | ||
| 209 | + | ||
| 210 | + <dependency> | ||
| 211 | + <groupId>com.github.axet</groupId> | ||
| 212 | + <artifactId>kaptcha</artifactId> | ||
| 213 | + <version>0.0.9</version> | ||
| 214 | + </dependency> | ||
| 215 | + | ||
| 216 | + <dependency> | ||
| 217 | + <groupId>commons-codec</groupId> | ||
| 218 | + <artifactId>commons-codec</artifactId> | ||
| 219 | + <version>1.4</version> | ||
| 220 | + <scope>compile</scope> | ||
| 221 | + </dependency> | ||
| 222 | + <dependency> | ||
| 223 | + <groupId>org.bouncycastle</groupId> | ||
| 224 | + <artifactId>bcprov-jdk15on</artifactId> | ||
| 225 | + <version>1.52</version> | ||
| 226 | + </dependency> | ||
| 227 | + <dependency> | ||
| 228 | + <groupId>axis</groupId> | ||
| 229 | + <artifactId>axis</artifactId> | ||
| 230 | + <version>1.4</version> | ||
| 231 | + </dependency> | ||
| 232 | + <dependency> | ||
| 233 | + <groupId>javax.xml</groupId> | ||
| 234 | + <artifactId>jaxrpc-api</artifactId> | ||
| 235 | + <version>1.1</version> | ||
| 236 | + </dependency> | ||
| 237 | + | ||
| 238 | + <dependency> | ||
| 239 | + <groupId>org.apache.axis2</groupId> | ||
| 240 | + <artifactId>axis2-adb</artifactId> | ||
| 241 | + <version>1.7.4</version> | ||
| 242 | + </dependency> | ||
| 243 | + <dependency> | ||
| 244 | + <groupId>org.apache.axis2</groupId> | ||
| 245 | + <artifactId>axis2-transport-local</artifactId> | ||
| 246 | + <version>1.7.4</version> | ||
| 247 | + </dependency> | ||
| 248 | + <dependency> | ||
| 249 | + <groupId>org.apache.axis2</groupId> | ||
| 250 | + <artifactId>axis2-transport-http</artifactId> | ||
| 251 | + <version>1.7.4</version> | ||
| 252 | + </dependency> | ||
| 253 | + | ||
| 254 | + <dependency> | ||
| 255 | + <groupId>org.dbunit</groupId> | ||
| 256 | + <artifactId>dbunit</artifactId> | ||
| 257 | + <version>2.4.9</version> | ||
| 258 | + <scope>test</scope> | ||
| 259 | + | ||
| 260 | + <exclusions> | ||
| 261 | + <exclusion> | ||
| 262 | + <groupId>org.slf4j</groupId> | ||
| 263 | + <artifactId>slf4j-api</artifactId> | ||
| 264 | + </exclusion> | ||
| 265 | + </exclusions> | ||
| 266 | + </dependency> | ||
| 267 | + | ||
| 268 | + <dependency> | ||
| 269 | + <groupId>com.h2database</groupId> | ||
| 270 | + <artifactId>h2</artifactId> | ||
| 271 | + <version>1.2.132</version> | ||
| 272 | + <scope>test</scope> | ||
| 273 | + </dependency> | ||
| 274 | + | ||
| 275 | + | ||
| 276 | + <dependency> | ||
| 277 | + <groupId>ojdbc</groupId> | ||
| 278 | + <artifactId>ojdbc</artifactId> | ||
| 279 | + <version>14</version> | ||
| 280 | + </dependency> | ||
| 281 | + | ||
| 282 | + <dependency> | ||
| 283 | + <groupId>org.apache.mina</groupId> | ||
| 284 | + <artifactId>mina-core</artifactId> | ||
| 285 | + <version>2.0.13</version> | ||
| 286 | + </dependency> | ||
| 287 | + | ||
| 288 | + <dependency> | ||
| 289 | + <groupId>com.google.protobuf</groupId> | ||
| 290 | + <artifactId>protobuf-java</artifactId> | ||
| 291 | + <version>3.3.0</version> | ||
| 292 | + </dependency> | ||
| 293 | + | ||
| 294 | + <dependency> | ||
| 295 | + <groupId>com.github.stuxuhai</groupId> | ||
| 296 | + <artifactId>jpinyin</artifactId> | ||
| 297 | + <version>1.1.8</version> | ||
| 298 | + </dependency> | ||
| 299 | + </dependencies> | ||
| 300 | + | ||
| 301 | + <dependencyManagement> | ||
| 302 | + <dependencies> | ||
| 303 | + <!-- drools 6依赖 --> | ||
| 304 | + <dependency> | ||
| 305 | + <groupId>org.drools</groupId> | ||
| 306 | + <artifactId>drools-bom</artifactId> | ||
| 307 | + <type>pom</type> | ||
| 308 | + <version>6.3.0.Final</version> | ||
| 309 | + <scope>import</scope> | ||
| 310 | + </dependency> | ||
| 311 | + </dependencies> | ||
| 312 | + </dependencyManagement> | ||
| 313 | + | ||
| 314 | + <build> | ||
| 315 | + <plugins> | ||
| 316 | + <plugin> | ||
| 317 | + <artifactId>maven-compiler-plugin</artifactId> | ||
| 318 | + <version>2.3.2</version><!--$NO-MVN-MAN-VER$ --> | ||
| 319 | + <configuration> | ||
| 320 | + <source>1.7</source> | ||
| 321 | + <target>1.7</target> | ||
| 322 | + </configuration> | ||
| 323 | + </plugin> | ||
| 324 | + <plugin> | ||
| 325 | + <artifactId>maven-war-plugin</artifactId> | ||
| 326 | + <version>2.2</version><!--$NO-MVN-MAN-VER$ --> | ||
| 327 | + <configuration> | ||
| 328 | + <failOnMissingWebXml>false</failOnMissingWebXml> | ||
| 329 | + </configuration> | ||
| 330 | + </plugin> | ||
| 331 | + <plugin> | ||
| 332 | + <groupId>org.springframework.boot</groupId> | ||
| 333 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 334 | + </plugin> | ||
| 335 | + </plugins> | ||
| 336 | + <resources> | ||
| 337 | + <resource> | ||
| 338 | + <directory>src/main/resources</directory> | ||
| 339 | + <filtering>false</filtering> | ||
| 340 | + </resource> | ||
| 341 | + </resources> | ||
| 342 | + </build> | ||
| 343 | + <repositories> | ||
| 344 | + <repository> | ||
| 345 | + <id>spring-snapshots</id> | ||
| 346 | + <url>http://repo.spring.io/snapshot</url> | ||
| 347 | + <snapshots> | ||
| 348 | + <enabled>true</enabled> | ||
| 349 | + </snapshots> | ||
| 350 | + </repository> | ||
| 351 | + <repository> | ||
| 352 | + <id>spring-milestones</id> | ||
| 353 | + <url>http://repo.spring.io/milestone</url> | ||
| 354 | + </repository> | ||
| 355 | + </repositories> | ||
| 356 | + <pluginRepositories> | ||
| 357 | + <pluginRepository> | ||
| 358 | + <id>spring-snapshots</id> | ||
| 359 | + <url>http://repo.spring.io/snapshot</url> | ||
| 360 | + </pluginRepository> | ||
| 361 | + <pluginRepository> | ||
| 362 | + <id>spring-milestones</id> | ||
| 363 | + <url>http://repo.spring.io/milestone</url> | ||
| 364 | + </pluginRepository> | ||
| 365 | + </pluginRepositories> | ||
| 366 | + | ||
| 367 | + <properties> | ||
| 368 | + <start-class>com.bsth.Application</start-class> | ||
| 369 | + </properties> | ||
| 370 | +</project> |
src/main/java/com/bsth/Application.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/Application.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 4 | +import com.fasterxml.jackson.databind.SerializationFeature; | ||
| 5 | +import org.springframework.boot.SpringApplication; | ||
| 6 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 7 | +import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 8 | +import org.springframework.boot.context.web.SpringBootServletInitializer; | ||
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 10 | +import org.springframework.context.annotation.Primary; | ||
| 11 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
| 12 | + | ||
| 13 | +import java.util.concurrent.Executors; | ||
| 14 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 15 | + | ||
| 16 | +@EnableTransactionManagement | ||
| 17 | +@SpringBootApplication | ||
| 18 | +public class Application extends SpringBootServletInitializer { | ||
| 19 | + | ||
| 20 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(18); | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||
| 24 | + return application.sources(Application.class); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @Bean | ||
| 28 | + @Primary | ||
| 29 | + public ObjectMapper objectMapper() { | ||
| 30 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 31 | + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); | ||
| 32 | + | ||
| 33 | + return objectMapper; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static void main(String[] args) throws Exception { | ||
| 37 | + SpringApplication.run(Application.class, args); | ||
| 38 | + } | ||
| 39 | +} | ||
| 0 | \ No newline at end of file | 40 | \ No newline at end of file |
src/main/java/com/bsth/StartCommand.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/StartCommand.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.security.SecurityMetadataSourceService; | ||
| 5 | + | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.CommandLineRunner; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 随应用启动运行 | ||
| 15 | + * @author PanZhao | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Component | ||
| 19 | +public class StartCommand implements CommandLineRunner{ | ||
| 20 | + | ||
| 21 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + SecurityMetadataSourceService invocationSecurityMetadataSourceService; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void run(String... arg0){ | ||
| 28 | + | ||
| 29 | + try { | ||
| 30 | + //启动时加载所有资源 | ||
| 31 | + invocationSecurityMetadataSourceService.loadResourceDefine(); | ||
| 32 | + | ||
| 33 | + } catch (Exception e) { | ||
| 34 | + e.printStackTrace(); | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} |
src/main/java/com/bsth/WebAppConfiguration.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/WebAppConfiguration.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import com.bsth.filter.ResourceFilter; | ||
| 4 | +import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 5 | +import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.boot.context.embedded.FilterRegistrationBean; | ||
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 10 | +import org.springframework.context.annotation.ComponentScan; | ||
| 11 | +import org.springframework.context.annotation.Configuration; | ||
| 12 | +import org.springframework.web.filter.CharacterEncodingFilter; | ||
| 13 | +import org.springframework.web.filter.HttpPutFormContentFilter; | ||
| 14 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||
| 15 | +import org.springframework.web.socket.config.annotation.EnableWebSocket; | ||
| 16 | +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | ||
| 17 | +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | ||
| 18 | +import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; | ||
| 19 | + | ||
| 20 | +import javax.servlet.Filter; | ||
| 21 | + | ||
| 22 | +@Configuration | ||
| 23 | +@EnableWebSocket | ||
| 24 | +@ComponentScan | ||
| 25 | +public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{ | ||
| 26 | + | ||
| 27 | +// @Autowired | ||
| 28 | +// HttpOpLogInterceptor httpOpLogInterceptor; | ||
| 29 | + | ||
| 30 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * @Title: httpPutFormContentFilter | ||
| 34 | + * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换) | ||
| 35 | + */ | ||
| 36 | + @Bean | ||
| 37 | + public Filter httpPutFormContentFilter() { | ||
| 38 | + return new HttpPutFormContentFilter(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @Title: characterEncodingFilter | ||
| 43 | + * @Description: TODO(编码过滤器) | ||
| 44 | + */ | ||
| 45 | + @Bean | ||
| 46 | + public Filter characterEncodingFilter(){ | ||
| 47 | + return new CharacterEncodingFilter("UTF-8"); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * | ||
| 52 | + * @Title: resourceFilterRegistration | ||
| 53 | + * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 ) | ||
| 54 | + */ | ||
| 55 | + @Bean | ||
| 56 | + public FilterRegistrationBean resourceFilterRegistration(){ | ||
| 57 | + FilterRegistrationBean registration = new FilterRegistrationBean(); | ||
| 58 | + registration.setFilter(new ResourceFilter()); | ||
| 59 | + registration.addUrlPatterns("/pages/*"); | ||
| 60 | + return registration; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * | ||
| 65 | + * @Title: addInterceptors | ||
| 66 | + * @Description: TODO(HTTP结构化访问日志记录 ) | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public void addInterceptors(InterceptorRegistry registry) { | ||
| 70 | + registry.addInterceptor(httpOpLogInterceptor); | ||
| 71 | + }*/ | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | ||
| 75 | + //线调webSocket | ||
| 76 | + registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | ||
| 77 | + .withSockJS(); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 增加websocket的输出缓冲区 | ||
| 82 | + * @return | ||
| 83 | + */ | ||
| 84 | + @Bean | ||
| 85 | + public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() { | ||
| 86 | + ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean(); | ||
| 87 | + container.setMaxTextMessageBufferSize(52768); | ||
| 88 | + container.setMaxBinaryMessageBufferSize(52768); | ||
| 89 | + logger.info("Websocket factory returned"); | ||
| 90 | + return container; | ||
| 91 | + } | ||
| 92 | +} |
src/main/java/com/bsth/XDApplication.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/XDApplication.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.LineVersionsData; | ||
| 5 | +import com.bsth.data.ThreadMonotor; | ||
| 6 | +import com.bsth.data.car_out_info.UpdateDBThread; | ||
| 7 | +import com.bsth.data.directive.DirectivesPstThread; | ||
| 8 | +import com.bsth.data.forecast.SampleTimeDataLoader; | ||
| 9 | +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 10 | +import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; | ||
| 11 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 12 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 13 | +import com.bsth.data.safe_driv.SafeDrivDataLoadThread; | ||
| 14 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 15 | +import com.bsth.data.schedule.auto_exec.AutoExecScanThread; | ||
| 16 | +import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread; | ||
| 17 | +import com.bsth.data.schedule.edit_logs.SeiPstThread; | ||
| 18 | +import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | ||
| 19 | +import com.bsth.data.schedule.signal.SchSiginUpdateDBThread; | ||
| 20 | +import com.bsth.data.schedule.thread.CalcOilThread; | ||
| 21 | +import com.bsth.data.schedule.thread.SchedulePstThread; | ||
| 22 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | ||
| 23 | +import com.bsth.data.schedule.thread.SubmitToTrafficManage; | ||
| 24 | +import com.bsth.util.DateUtils; | ||
| 25 | +import com.bsth.util.Tools; | ||
| 26 | +import org.slf4j.Logger; | ||
| 27 | +import org.slf4j.LoggerFactory; | ||
| 28 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 29 | +import org.springframework.boot.CommandLineRunner; | ||
| 30 | +import org.springframework.stereotype.Component; | ||
| 31 | + | ||
| 32 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 33 | +import java.util.concurrent.TimeUnit; | ||
| 34 | + | ||
| 35 | +/** | ||
| 36 | + * 线调大部分服务都在这里启动 | ||
| 37 | + * Created by panzhao on 2017/5/14. | ||
| 38 | + */ | ||
| 39 | +@Component | ||
| 40 | +public class XDApplication implements CommandLineRunner { | ||
| 41 | + | ||
| 42 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + BasicData.BasicDataLoader basicDataLoader; | ||
| 46 | + @Autowired | ||
| 47 | + UpdateDBThread fcxxUpdateThread; | ||
| 48 | + @Autowired | ||
| 49 | + ScheduleRefreshThread scheduleRefreshThread; | ||
| 50 | + @Autowired | ||
| 51 | + SchedulePstThread schedulePstThread; | ||
| 52 | + @Autowired | ||
| 53 | + ScheduleLateThread scheduleLateThread; | ||
| 54 | + @Autowired | ||
| 55 | + SubmitToTrafficManage submitToTrafficManage; | ||
| 56 | + @Autowired | ||
| 57 | + CalcOilThread calcOilThread; | ||
| 58 | + @Autowired | ||
| 59 | + DirectivesPstThread directivesPstThread; | ||
| 60 | + @Autowired | ||
| 61 | + ThreadMonotor threadMonotor; | ||
| 62 | + @Autowired | ||
| 63 | + SeiPstThread seiPstThread; | ||
| 64 | + @Autowired | ||
| 65 | + SampleTimeDataLoader sampleTimeDataLoader; | ||
| 66 | + @Autowired | ||
| 67 | + SchSiginUpdateDBThread schSiginUpdateDBThread; | ||
| 68 | + @Autowired | ||
| 69 | + AutoExecScanThread autoExecScanThread; | ||
| 70 | + | ||
| 71 | + @Autowired | ||
| 72 | + GpsDataLoaderThread gpsDataLoader; | ||
| 73 | + | ||
| 74 | + @Autowired | ||
| 75 | + OfflineMonitorThread offlineMonitorThread; | ||
| 76 | + | ||
| 77 | + @Autowired | ||
| 78 | + LineVersionsData lineVersionsData; | ||
| 79 | + | ||
| 80 | + /*@Autowired | ||
| 81 | + FixedEnableVerionsThread fixedEnableVerionsThread;*/ | ||
| 82 | + | ||
| 83 | + @Autowired | ||
| 84 | + SafeDrivDataLoadThread safeDrivDataLoadThread; | ||
| 85 | + | ||
| 86 | + @Autowired | ||
| 87 | + FixedCheckStationCodeThread fixedCheckStationCodeThread; | ||
| 88 | + | ||
| 89 | + private static long timeDiff; | ||
| 90 | + private static long timeDiffTraffic; | ||
| 91 | + | ||
| 92 | + static { | ||
| 93 | + // 早上2:20 | ||
| 94 | + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | ||
| 95 | + if (timeDiff < 0) | ||
| 96 | + timeDiff += (1000 * 60 * 60 * 24); | ||
| 97 | + // 早上07:00 | ||
| 98 | + timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis(); | ||
| 99 | + if (timeDiffTraffic < 0) | ||
| 100 | + timeDiffTraffic += (1000 * 60 * 60 * 24); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @Override | ||
| 104 | + public void run(String... strings) throws Exception { | ||
| 105 | + try { | ||
| 106 | + Tools tools = new Tools("application.properties"); | ||
| 107 | + String environment = tools.getValue("spring.profiles.active"); | ||
| 108 | + //预先加载基础的对照数据 | ||
| 109 | + basicDataLoader.loadAllData(); | ||
| 110 | + switch (environment){ | ||
| 111 | + case "dev": | ||
| 112 | + devInit(); | ||
| 113 | + break; | ||
| 114 | + case "prod": | ||
| 115 | + prodInit(); | ||
| 116 | + break; | ||
| 117 | + } | ||
| 118 | + }catch (Exception e){ | ||
| 119 | + log.error("线调后台启动出现异常!!", e); | ||
| 120 | + System.exit(1); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + @Autowired | ||
| 125 | + DayOfSchedule dayOfSchedule; | ||
| 126 | + public void devInit(){ | ||
| 127 | + log.info("devInit..."); | ||
| 128 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 129 | + //抓取GPS数据 | ||
| 130 | + gpsDataLoader.setFlag(-1); | ||
| 131 | + //dayOfSchedule.dataRecovery(); | ||
| 132 | + //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS); | ||
| 133 | + //实际排班更新线程 | ||
| 134 | + //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | ||
| 135 | + //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点 | ||
| 136 | + //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 137 | + //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 138 | + | ||
| 139 | + //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 140 | + //实际排班延迟入库线程 | ||
| 141 | + //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); | ||
| 142 | + //班次修正日志延迟入库 | ||
| 143 | + //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS); | ||
| 144 | + //调度指令延迟入库 | ||
| 145 | + //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | ||
| 146 | + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 147 | + //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | ||
| 148 | + | ||
| 149 | + //安全驾驶 | ||
| 150 | + //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS); | ||
| 151 | + | ||
| 152 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void prodInit(){ | ||
| 156 | + log.info("prodInit..."); | ||
| 157 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 158 | + //安全驾驶 | ||
| 159 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 160 | + | ||
| 161 | + /** 线调业务 */ | ||
| 162 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 163 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 164 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 165 | + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 166 | + | ||
| 167 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 168 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 169 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 170 | + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 171 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 172 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 173 | + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 174 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 175 | + DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 176 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 177 | + | ||
| 178 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 179 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 180 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 181 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 182 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 183 | + | ||
| 184 | + //运管处静态数据提交 | ||
| 185 | + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 186 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 187 | + //计算油、公里加注 | ||
| 188 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 189 | + | ||
| 190 | + //线路版本更新 | ||
| 191 | + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 192 | + | ||
| 193 | + //线路版本更新 | ||
| 194 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 195 | + } | ||
| 196 | +} |
src/main/java/com/bsth/common/Constants.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/common/Constants.java | ||
| 1 | +package com.bsth.common; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @ClassName: Constants | ||
| 6 | + * @Description: TODO(常量类) | ||
| 7 | + * @author PanZhao | ||
| 8 | + * @date 2016年3月18日 下午11:06:53 | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public class Constants { | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 不需要拦截的资源 | ||
| 15 | + */ | ||
| 16 | + public static final String LOGIN = "/user/login/**"; | ||
| 17 | + public static final String LOGIN_PAGE = "/login.html"; | ||
| 18 | + public static final String ASSETS_URL = "/assets/**"; | ||
| 19 | + public static final String FAVICON_URL = "/favicon.ico"; | ||
| 20 | + public static final String METRONIC_URL = "/metronic_v4.5.4/**"; | ||
| 21 | + public static final String LOGIN_FAILURE = "/user/loginFailure"; | ||
| 22 | + public static final String CAPTCHA = "/captcha.jpg"; | ||
| 23 | + | ||
| 24 | + //对外的营运数据接口 | ||
| 25 | + public static final String SERVICE_INTERFACE = "/companyService/**"; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 线调部分子页面不做拦截,便于浏览器缓存 | ||
| 29 | + */ | ||
| 30 | + public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | ||
| 31 | + public static final String XD_REAL_GPS = "/gps/real/line"; | ||
| 32 | + //public static final String XD_TEMPS = "/pages/control/line/temps/**"; | ||
| 33 | + | ||
| 34 | + //车载网关上行接口 | ||
| 35 | + public static final String UPSTREAM_URL = "/control/upstream"; | ||
| 36 | + //rfid 上传入口 | ||
| 37 | + public static final String UP_RFID_URL = "/rfid/**"; | ||
| 38 | + | ||
| 39 | + public static final String SESSION_USERNAME = "sessionUserName"; | ||
| 40 | + public static final String COMPANY_AUTHORITYS = "cmyAuths"; | ||
| 41 | + public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 解除调度指令和班次的外键约束 | ||
| 45 | + */ | ||
| 46 | + public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 批量解除调度指令和班次的外键约束 | ||
| 50 | + */ | ||
| 51 | + public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | ||
| 52 | +} |
src/main/java/com/bsth/common/ResponseCode.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/common/ResponseCode.java | ||
| 1 | +package com.bsth.common; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @ClassName: ResponseCode | ||
| 6 | + * @Description: TODO(响应状态码) | ||
| 7 | + * @author PanZhao | ||
| 8 | + * @date 2016年3月18日 下午11:12:08 | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public enum ResponseCode { | ||
| 12 | + | ||
| 13 | + SUCCESS("操作成功", 200), | ||
| 14 | + NO_PERMISSION("无资源访问权限", 403), | ||
| 15 | + NO_AUTHENTICATION("客户端未授权", 407), | ||
| 16 | + ERROR("服务器异常", 500); | ||
| 17 | + | ||
| 18 | + private String text; | ||
| 19 | + private int code; | ||
| 20 | + | ||
| 21 | + ResponseCode(String text, int code) { | ||
| 22 | + this.text = text; | ||
| 23 | + this.code = code; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public String toString() { | ||
| 28 | + return this.code + ""; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public String getText() { | ||
| 32 | + return this.text; | ||
| 33 | + } | ||
| 34 | +} |
src/main/java/com/bsth/controller/BaseController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/BaseController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.service.BaseService; | ||
| 4 | +import com.google.common.base.Splitter; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.data.domain.Page; | ||
| 7 | +import org.springframework.data.domain.PageRequest; | ||
| 8 | +import org.springframework.data.domain.Sort; | ||
| 9 | +import org.springframework.data.domain.Sort.Direction; | ||
| 10 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | + | ||
| 15 | +import java.io.Serializable; | ||
| 16 | +import java.util.ArrayList; | ||
| 17 | +import java.util.List; | ||
| 18 | +import java.util.Map; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @param <T> | ||
| 22 | + * @param <ID> 主键类型 | ||
| 23 | + * @author PanZhao | ||
| 24 | + * @ClassName: BaseController | ||
| 25 | + * @Description: TODO(基础的Controller实现) | ||
| 26 | + * @date 2016年3月17日 下午12:44:06 | ||
| 27 | + */ | ||
| 28 | +public class BaseController<T, ID extends Serializable> { | ||
| 29 | + | ||
| 30 | + @Autowired | ||
| 31 | + protected BaseService<T, ID> baseService; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @param @param map 查询条件 | ||
| 35 | + * @param @param page 页码 | ||
| 36 | + * @param @param size 每页显示数量 | ||
| 37 | + * @throws | ||
| 38 | + * @Title: list | ||
| 39 | + * @Description: TODO(多条件分页查询) | ||
| 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(Direction.ASC, order_columns))); | ||
| 57 | + } else { | ||
| 58 | + return baseService.list(map, new PageRequest(page, size, new 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(Direction.ASC, order_columns.get(i))); | ||
| 65 | + } else { | ||
| 66 | + orderList.add(new Sort.Order(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 | + * @param @param map | ||
| 77 | + * @throws | ||
| 78 | + * @Title: list | ||
| 79 | + * @Description: TODO(多条件查询) | ||
| 80 | + */ | ||
| 81 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 82 | + public Iterable<T> list(@RequestParam Map<String, Object> map) { | ||
| 83 | + return baseService.list(map); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * @param @param t | ||
| 88 | + * @param @return 设定文件 | ||
| 89 | + * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 90 | + * @throws | ||
| 91 | + * @Title: save | ||
| 92 | + * @Description: TODO(持久化对象) | ||
| 93 | + */ | ||
| 94 | + @RequestMapping(method = RequestMethod.POST) | ||
| 95 | + public Map<String, Object> save(T t) { | ||
| 96 | + return baseService.save(t); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * @param @param id | ||
| 101 | + * @throws | ||
| 102 | + * @Title: findById | ||
| 103 | + * @Description: TODO(根据主键获取单个对象) | ||
| 104 | + */ | ||
| 105 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 106 | + public T findById(@PathVariable("id") ID id) { | ||
| 107 | + return baseService.findById(id); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @param @param id | ||
| 112 | + * @throws | ||
| 113 | + * @Title: delete | ||
| 114 | + * @Description: TODO(根据主键删除对象) | ||
| 115 | + */ | ||
| 116 | + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 117 | + public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 118 | + return baseService.delete(id); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | +} |
src/main/java/com/bsth/controller/BusIntervalController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/BusIntervalController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.service.BusIntervalService; | ||
| 13 | + | ||
| 14 | +@RestController | ||
| 15 | +@RequestMapping("busInterval") | ||
| 16 | +public class BusIntervalController { | ||
| 17 | + | ||
| 18 | + @Autowired | ||
| 19 | + private BusIntervalService busIntervalService; | ||
| 20 | + | ||
| 21 | + @RequestMapping(value = "/getDir", method = RequestMethod.GET) | ||
| 22 | + public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){ | ||
| 23 | + return busIntervalService.getDir(map); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "/getLp", method = RequestMethod.GET) | ||
| 27 | + public List<Map<String,Object>> getLp(@RequestParam Map<String, Object> map){ | ||
| 28 | + return busIntervalService.getLp(map); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @RequestMapping(value = "/interval", method = RequestMethod.GET) | ||
| 32 | + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){ | ||
| 33 | + return busIntervalService.interval(map); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET) | ||
| 37 | + public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){ | ||
| 38 | + return busIntervalService.timeAndSpeed(map); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET) | ||
| 42 | + public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){ | ||
| 43 | + return busIntervalService.lineTimeAnaliy(map); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET) | ||
| 47 | + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){ | ||
| 48 | + return busIntervalService.lbStatuAnaly(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/correctStatis", method = RequestMethod.GET) | ||
| 52 | + public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | ||
| 53 | + return busIntervalService.correctStatis(map); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | ||
| 57 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | ||
| 58 | + return busIntervalService.exportWaybillMore(map); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @RequestMapping(value = "/onTime", method = RequestMethod.GET) | ||
| 62 | + public List<Map<String,Object>> onTime(@RequestParam Map<String, Object> map){ | ||
| 63 | + return busIntervalService.onTime(map); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | +} |
src/main/java/com/bsth/controller/BusinessController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/BusinessController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +import com.bsth.entity.Business; | ||
| 9 | +import com.bsth.service.BusinessService; | ||
| 10 | +import com.bsth.util.GetUIDAndCode; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * | ||
| 14 | + * @ClassName: LineController(公司控制器) | ||
| 15 | + * | ||
| 16 | + * @Extends : BaseController | ||
| 17 | + * | ||
| 18 | + * @Description: TODO(公司控制层) | ||
| 19 | + * | ||
| 20 | + * @Author bsth@lq | ||
| 21 | + * | ||
| 22 | + * @Date 2016-4-28 9:21:17 | ||
| 23 | + * | ||
| 24 | + * @Version 公交调度系统BS版 0.1 | ||
| 25 | + * | ||
| 26 | + */ | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("business") | ||
| 29 | +public class BusinessController extends BaseController<Business, Integer> { | ||
| 30 | + @Autowired | ||
| 31 | + private BusinessService businessService; | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | ||
| 34 | + public long getLineCode() { | ||
| 35 | + return businessService.getCompCode(); | ||
| 36 | + } | ||
| 37 | +} |
src/main/java/com/bsth/controller/CarDeviceController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/CarDeviceController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 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; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.Iterator; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Created by xu on 16/6/15. | ||
| 19 | + */ | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("cde") | ||
| 22 | +public class CarDeviceController extends BaseController<CarDevice, Long> { | ||
| 23 | + @Autowired | ||
| 24 | + private CarDeviceService carDeviceService; | ||
| 25 | + /** | ||
| 26 | + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | ||
| 27 | + * @Title: save | ||
| 28 | + * @Description: TODO(持久化对象) | ||
| 29 | + * @param @param t | ||
| 30 | + * @param @return 设定文件 | ||
| 31 | + * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 32 | + * @throws | ||
| 33 | + */ | ||
| 34 | + @RequestMapping(method = RequestMethod.POST) | ||
| 35 | + public Map<String, Object> save(@RequestBody CarDevice t){ | ||
| 36 | + return baseService.save(t); | ||
| 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 | + } | ||
| 56 | +} |
src/main/java/com/bsth/controller/CarParkController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/CarParkController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.CarPark; | ||
| 8 | +import com.bsth.service.CarParkService; | ||
| 9 | +import com.bsth.util.GetUIDAndCode; | ||
| 10 | + | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("carpark") | ||
| 17 | +public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 18 | + @Autowired | ||
| 19 | + CarParkService service; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * @Description :TODO(查询停车场编码) | ||
| 23 | + * | ||
| 24 | + * @return int <carParkCode 停车场编码> | ||
| 25 | + */ | ||
| 26 | + @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) | ||
| 27 | + public Map<String, Object> getStationCode() { | ||
| 28 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 29 | + resultMap.put("carParkCode", "FFFFFF" + GetUIDAndCode.getCarParkId()); | ||
| 30 | + return resultMap; | ||
| 31 | + } | ||
| 32 | + /** | ||
| 33 | + * 新增停车场信息 | ||
| 34 | + * | ||
| 35 | + * | ||
| 36 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 37 | + * | ||
| 38 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 39 | + * | ||
| 40 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 41 | + * | ||
| 42 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 43 | + * | ||
| 44 | + * @return map <SUCCESS:成功;ERROR:失败> | ||
| 45 | + * | ||
| 46 | + */ | ||
| 47 | + @RequestMapping(value="carParkSave" , method = RequestMethod.POST) | ||
| 48 | + public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { | ||
| 49 | + map.put("createBy", ""); | ||
| 50 | + map.put("updateBy", ""); | ||
| 51 | + return service.carParkSave(map); | ||
| 52 | + } | ||
| 53 | + @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) | ||
| 54 | + public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { | ||
| 55 | + return service.findCarParkInfoFormId(map); | ||
| 56 | + } | ||
| 57 | + /** | ||
| 58 | + * 修改停车场信息 | ||
| 59 | + * | ||
| 60 | + * | ||
| 61 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 62 | + * | ||
| 63 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 64 | + * | ||
| 65 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 66 | + * | ||
| 67 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 68 | + * | ||
| 69 | + * @return map <SUCCESS:成功;ERROR:失败> | ||
| 70 | + * | ||
| 71 | + */ | ||
| 72 | + @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) | ||
| 73 | + public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { | ||
| 74 | + map.put("updateBy", ""); | ||
| 75 | + return service.carParkUpdate(map); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @RequestMapping(value="isHaveParkCode",method=RequestMethod.GET) | ||
| 79 | + public boolean isHaveParkCode(@RequestParam Map<String,Object> map) { | ||
| 80 | + return service.selectTccInfoByCode(map); | ||
| 81 | + } | ||
| 82 | +} |
src/main/java/com/bsth/controller/CarsController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/CarsController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RestController; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Created by xu on 16/5/31. | ||
| 9 | + */ | ||
| 10 | +@RestController | ||
| 11 | +@RequestMapping("cars") | ||
| 12 | +public class CarsController extends BaseController<Cars, Integer> { | ||
| 13 | + | ||
| 14 | +} |
src/main/java/com/bsth/controller/DeviceGpsController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/DeviceGpsController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 4 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 5 | +import com.fasterxml.jackson.core.JsonParseException; | ||
| 6 | +import com.fasterxml.jackson.databind.JsonMappingException; | ||
| 7 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | +import org.apache.commons.lang.StringEscapeUtils; | ||
| 9 | +import org.apache.poi.hssf.usermodel.*; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.util.StringUtils; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | +import org.springframework.web.multipart.MultipartFile; | ||
| 14 | + | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import javax.servlet.http.HttpServletResponse; | ||
| 17 | +import java.io.*; | ||
| 18 | +import java.text.SimpleDateFormat; | ||
| 19 | +import java.util.*; | ||
| 20 | + | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("devicegps") | ||
| 23 | +public class DeviceGpsController { | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + GpsRealData gpsRealData; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/real/line/{lineCode}") | ||
| 29 | + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | ||
| 30 | + return gpsRealData.getByLine(lineCode); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "/real/all") | ||
| 34 | + public List<GpsEntity> findByLineCodes() { | ||
| 35 | + return new ArrayList<>(gpsRealData.all()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @RequestMapping(value = "/open", method = RequestMethod.POST) | ||
| 39 | + public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | ||
| 40 | + Map<String, Object> res = new HashMap<>(); | ||
| 41 | + File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | ||
| 42 | + File rd = rf.getParentFile(); | ||
| 43 | + if (!rd.exists()) { | ||
| 44 | + rd.mkdirs(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + BufferedReader reader = null; | ||
| 48 | + try { | ||
| 49 | + file.transferTo(rf); | ||
| 50 | + reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | ||
| 51 | + String line = null; | ||
| 52 | + List<Map<String, Object>> data = new ArrayList<>(); | ||
| 53 | + while ((line = reader.readLine()) != null) { | ||
| 54 | + if (!StringUtils.isEmpty(line)) { | ||
| 55 | + String temp[] = line.split(","); | ||
| 56 | + if (temp.length != 4) { | ||
| 57 | + res.put("errCode", 1); | ||
| 58 | + res.put("msg", "txt文档格式错误,请检查"); | ||
| 59 | + return res; | ||
| 60 | + } | ||
| 61 | + Map<String, Object> info = new HashMap<>(); | ||
| 62 | + info.put("lineName", temp[0]); | ||
| 63 | + info.put("lineCode", temp[1]); | ||
| 64 | + info.put("inCode", temp[2]); | ||
| 65 | + info.put("deviceId", temp[3]); | ||
| 66 | + info.put("detail", gpsRealData.get(temp[3])); | ||
| 67 | + | ||
| 68 | + data.add(info); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + // 删除临时文件 | ||
| 72 | + rf.delete(); | ||
| 73 | + res.put("errCode", 0); | ||
| 74 | + res.put("data", data); | ||
| 75 | + } catch (IllegalStateException e) { | ||
| 76 | + // TODO Auto-generated catch block | ||
| 77 | + e.printStackTrace(); | ||
| 78 | + } catch (IOException e) { | ||
| 79 | + // TODO Auto-generated catch block | ||
| 80 | + e.printStackTrace(); | ||
| 81 | + } finally { | ||
| 82 | + try { | ||
| 83 | + if (reader != null) reader.close(); | ||
| 84 | + } catch (IOException e) { | ||
| 85 | + // TODO Auto-generated catch block | ||
| 86 | + e.printStackTrace(); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return res; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @SuppressWarnings("unchecked") | ||
| 94 | + @RequestMapping(value = "/opened", method = RequestMethod.POST) | ||
| 95 | + public Map<String, Object> opened(@RequestParam(value = "json")String json) { | ||
| 96 | + json = StringEscapeUtils.unescapeHtml(json); | ||
| 97 | + Map<String, Object> res = new HashMap<>(); | ||
| 98 | + List<Map<String, Object>> data = null; | ||
| 99 | + try { | ||
| 100 | + data = new ObjectMapper().readValue(json, List.class); | ||
| 101 | + for (Map<String, Object> info : data) { | ||
| 102 | + info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + res.put("errCode", 0); | ||
| 106 | + res.put("data", data); | ||
| 107 | + } catch (JsonParseException e) { | ||
| 108 | + // TODO Auto-generated catch block | ||
| 109 | + e.printStackTrace(); | ||
| 110 | + } catch (JsonMappingException e) { | ||
| 111 | + // TODO Auto-generated catch block | ||
| 112 | + e.printStackTrace(); | ||
| 113 | + } catch (IOException e) { | ||
| 114 | + // TODO Auto-generated catch block | ||
| 115 | + e.printStackTrace(); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + return res; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @SuppressWarnings("unchecked") | ||
| 122 | + @RequestMapping(value = "/export", method = RequestMethod.POST) | ||
| 123 | + public void export(@RequestParam(value = "json")String json, HttpServletResponse response) { | ||
| 124 | + json = StringEscapeUtils.unescapeHtml(json); | ||
| 125 | + List<Map<String, Object>> data = null; | ||
| 126 | + OutputStream out = null; | ||
| 127 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 128 | + try { | ||
| 129 | + data = new ObjectMapper().readValue(json, List.class); | ||
| 130 | + for (Map<String, Object> info : data) { | ||
| 131 | + Map<String, Object> detail = (Map<String, Object>)info.get("detail"); | ||
| 132 | + if (detail != null) { | ||
| 133 | + info.put("lineId", detail.get("lineId")); | ||
| 134 | + info.put("valid", (int)detail.get("valid") == 0 ? "有效" : "无效"); | ||
| 135 | + info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp")))); | ||
| 136 | + info.put("version", detail.get("version")); | ||
| 137 | + } else { | ||
| 138 | + info.put("lineId", ""); | ||
| 139 | + info.put("valid", ""); | ||
| 140 | + info.put("timestamp", ""); | ||
| 141 | + info.put("version", ""); | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + List<Header> head = new ArrayList<>(); | ||
| 146 | + head.add(new Header("线路编码", "lineCode")); | ||
| 147 | + head.add(new Header("线路名称", "lineName")); | ||
| 148 | + head.add(new Header("内部编码", "inCode")); | ||
| 149 | + head.add(new Header("识别码", "deviceId")); | ||
| 150 | + head.add(new Header("线路ID", "lineId")); | ||
| 151 | + head.add(new Header("GPS", "valid")); | ||
| 152 | + head.add(new Header("report", "timestamp")); | ||
| 153 | + head.add(new Header("版本", "version")); | ||
| 154 | + | ||
| 155 | + // 清空response | ||
| 156 | + response.reset(); | ||
| 157 | + // 设置response的Header | ||
| 158 | + response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls"); | ||
| 159 | + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); | ||
| 160 | + out = new BufferedOutputStream(response.getOutputStream()); | ||
| 161 | + excel(head, data, out); | ||
| 162 | + out.flush(); | ||
| 163 | + } catch (JsonParseException e) { | ||
| 164 | + // TODO Auto-generated catch block | ||
| 165 | + e.printStackTrace(); | ||
| 166 | + } catch (JsonMappingException e) { | ||
| 167 | + // TODO Auto-generated catch block | ||
| 168 | + e.printStackTrace(); | ||
| 169 | + } catch (IOException e) { | ||
| 170 | + // TODO Auto-generated catch block | ||
| 171 | + e.printStackTrace(); | ||
| 172 | + } finally { | ||
| 173 | + try { | ||
| 174 | + if (out != null) out.close(); | ||
| 175 | + } catch (IOException e) { | ||
| 176 | + e.printStackTrace(); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException { | ||
| 182 | + // 声明一个工作薄 | ||
| 183 | + HSSFWorkbook wb = new HSSFWorkbook(); | ||
| 184 | + // 生成一个表格 | ||
| 185 | + HSSFSheet sheet = wb.createSheet("1"); | ||
| 186 | + // 产生表格标题行 | ||
| 187 | + HSSFRow row = sheet.createRow(0); | ||
| 188 | + for (int i = 0;i < head.size();i++) { | ||
| 189 | + HSSFCell cell = row.createCell(i); | ||
| 190 | + HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe()); | ||
| 191 | + cell.setCellValue(text); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + int rownum = 1; | ||
| 195 | + for (Map<String, Object> map : data) { | ||
| 196 | + HSSFRow r = sheet.createRow(rownum); | ||
| 197 | + for (int i = 0;i < head.size();i++) { | ||
| 198 | + HSSFCell cell = r.createCell(i); | ||
| 199 | + HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField()))); | ||
| 200 | + cell.setCellValue(text); | ||
| 201 | + } | ||
| 202 | + rownum++; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + wb.write(out); | ||
| 206 | + wb.close(); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + final class Header { | ||
| 210 | + private String describe; | ||
| 211 | + private String field; | ||
| 212 | + | ||
| 213 | + Header(){ | ||
| 214 | + | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + Header(String describe, String field) { | ||
| 218 | + this.describe = describe; | ||
| 219 | + this.field = field; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + public String getDescribe() { | ||
| 223 | + return describe; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public void setDescribe(String describe) { | ||
| 227 | + this.describe = describe; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + public String getField() { | ||
| 231 | + return field; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + public void setField(String field) { | ||
| 235 | + this.field = field; | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | +} |
src/main/java/com/bsth/controller/DownloadController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/DownloadController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.io.BufferedInputStream; | ||
| 4 | +import java.io.BufferedOutputStream; | ||
| 5 | +import java.io.File; | ||
| 6 | +import java.io.FileInputStream; | ||
| 7 | +import java.io.IOException; | ||
| 8 | +import java.io.InputStream; | ||
| 9 | +import java.io.OutputStream; | ||
| 10 | +import java.net.URLDecoder; | ||
| 11 | + | ||
| 12 | +import javax.servlet.http.HttpServletResponse; | ||
| 13 | + | ||
| 14 | +import org.apache.commons.io.FileUtils; | ||
| 15 | +import org.springframework.context.annotation.Scope; | ||
| 16 | +import org.springframework.http.HttpHeaders; | ||
| 17 | +import org.springframework.http.HttpStatus; | ||
| 18 | +import org.springframework.http.MediaType; | ||
| 19 | +import org.springframework.http.ResponseEntity; | ||
| 20 | +import org.springframework.stereotype.Component; | ||
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * <一句话功能简述> | ||
| 25 | + * <功能详细描述> | ||
| 26 | + * | ||
| 27 | + * @author Administrator | ||
| 28 | + * @version [版本号, 2014年3月7日] | ||
| 29 | + * @see [相关类/方法] | ||
| 30 | + * @since [产品/模块版本] | ||
| 31 | + */ | ||
| 32 | +@Component | ||
| 33 | +@Scope("prototype") | ||
| 34 | +@RequestMapping("/downloadFile") | ||
| 35 | +public class DownloadController | ||
| 36 | +{ | ||
| 37 | + | ||
| 38 | + @RequestMapping("download2") | ||
| 39 | + public ResponseEntity<byte[]> download2(String fileName) throws IOException { | ||
| 40 | + String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 41 | + fileNames = fileNames + ".xls"; | ||
| 42 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileNames; | ||
| 43 | + System.out.println(moudelPath); | ||
| 44 | +// String path="D:\\export\\target\\"+jName+".xls"; | ||
| 45 | + File file=new File(moudelPath); | ||
| 46 | + HttpHeaders headers = new HttpHeaders(); | ||
| 47 | + String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | ||
| 48 | + headers.setContentDispositionFormData("attachment", fileNames); | ||
| 49 | + System.out.println( URLDecoder.decode(realFileName,"utf-8")); | ||
| 50 | + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); | ||
| 51 | + return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), | ||
| 52 | + headers, HttpStatus.CREATED); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @RequestMapping("download") | ||
| 56 | + public void download(HttpServletResponse response,String fileName) | ||
| 57 | + throws IOException { | ||
| 58 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 59 | + if(!fileName.contains(".xls")) | ||
| 60 | + fileName =fileName + ".xls"; | ||
| 61 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 62 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 63 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 64 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 65 | + byte[] buffer = new byte[fis.available()]; | ||
| 66 | + fis.read(buffer); | ||
| 67 | + fis.close(); | ||
| 68 | + response.reset(); | ||
| 69 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 70 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 71 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 72 | + response.setContentType("application/octet-stream"); | ||
| 73 | + os.write(buffer);// 输出文件 | ||
| 74 | + os.flush(); | ||
| 75 | + os.close(); | ||
| 76 | + file.delete(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @RequestMapping("downloadList") | ||
| 80 | + public void downloadList(HttpServletResponse response,String fileName) | ||
| 81 | + throws IOException { | ||
| 82 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 83 | + File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);// | ||
| 84 | + fileName = fileName + ".zip"; | ||
| 85 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 86 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 87 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 88 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 89 | + byte[] buffer = new byte[fis.available()]; | ||
| 90 | + fis.read(buffer); | ||
| 91 | + fis.close(); | ||
| 92 | + response.reset(); | ||
| 93 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 94 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 95 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 96 | + response.setContentType("application/octet-stream"); | ||
| 97 | + os.write(buffer);// 输出文件 | ||
| 98 | + os.flush(); | ||
| 99 | + os.close(); | ||
| 100 | + file.delete(); | ||
| 101 | + deleteFiles(files); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + @RequestMapping("downloadModel") | ||
| 106 | + public void downloadModel(HttpServletResponse response,String fileName) | ||
| 107 | + throws IOException { | ||
| 108 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 109 | + fileName =fileName + ".xls"; | ||
| 110 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 111 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 112 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 113 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 114 | + byte[] buffer = new byte[fis.available()]; | ||
| 115 | + fis.read(buffer); | ||
| 116 | + fis.close(); | ||
| 117 | + response.reset(); | ||
| 118 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 119 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 120 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 121 | + response.setContentType("application/octet-stream"); | ||
| 122 | + os.write(buffer);// 输出文件 | ||
| 123 | + os.flush(); | ||
| 124 | + os.close(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * 删除文件夹 | ||
| 130 | + * @param files | ||
| 131 | + * @return | ||
| 132 | + */ | ||
| 133 | + public Boolean deleteFiles(File files){ | ||
| 134 | + if (files.isDirectory()) { | ||
| 135 | + String[] children = files.list(); | ||
| 136 | + //递归删除目录中的子目录下 | ||
| 137 | + for (int i=0; i<children.length; i++) { | ||
| 138 | + boolean success = deleteFiles(new File(files, children[i])); | ||
| 139 | + if (!success) { | ||
| 140 | + return false; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + //目录此时为空,可以删除 | ||
| 145 | + return files.delete(); | ||
| 146 | + } | ||
| 147 | +} |
src/main/java/com/bsth/controller/IndexController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/IndexController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.io.BufferedInputStream; | ||
| 4 | +import java.io.IOException; | ||
| 5 | +import java.io.InputStream; | ||
| 6 | + | ||
| 7 | +import javax.servlet.http.HttpServletResponse; | ||
| 8 | + | ||
| 9 | +import org.apache.commons.lang3.StringUtils; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/") | ||
| 17 | +public class IndexController { | ||
| 18 | + | ||
| 19 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 20 | + | ||
| 21 | + String indexSource; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 构造函数 | ||
| 25 | + */ | ||
| 26 | + public IndexController() { | ||
| 27 | + BufferedInputStream bis = null; | ||
| 28 | + | ||
| 29 | + try { | ||
| 30 | + InputStream is = IndexController.class.getClassLoader().getResourceAsStream("static/index.html"); | ||
| 31 | + bis = new BufferedInputStream(is); | ||
| 32 | + StringBuilder source = new StringBuilder(); | ||
| 33 | + byte[] buffer = new byte[bis.available()]; | ||
| 34 | + | ||
| 35 | + while (bis.read(buffer) != -1) { | ||
| 36 | + source.append(new String(buffer)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + indexSource = source.toString(); | ||
| 40 | + } catch (Exception e) { | ||
| 41 | + logger.error("", e); | ||
| 42 | + } finally { | ||
| 43 | + try { | ||
| 44 | + bis.close(); | ||
| 45 | + } catch (IOException e) { | ||
| 46 | + logger.error("", e); | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * | ||
| 53 | + * @Title: index | ||
| 54 | + * @Description: TODO(输出首页 index.html) | ||
| 55 | + */ | ||
| 56 | + @RequestMapping | ||
| 57 | + public void index(String initFragment, HttpServletResponse resp) { | ||
| 58 | + | ||
| 59 | + // 初始打开的片段地址 | ||
| 60 | + String outStr = StringUtils.replace(indexSource, "^_^initFragment^_^", | ||
| 61 | + initFragment == null ? "" : initFragment); | ||
| 62 | + | ||
| 63 | + resp.setContentType("text/html;charset=UTF-8"); | ||
| 64 | + try { | ||
| 65 | + resp.getOutputStream().write(outStr.getBytes()); | ||
| 66 | + } catch (IOException e) { | ||
| 67 | + logger.error("", e); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + } | ||
| 71 | +} |
src/main/java/com/bsth/controller/LineController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/LineController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.Line; | ||
| 5 | +import com.bsth.entity.LineVersions; | ||
| 6 | +import com.bsth.service.LineService; | ||
| 7 | +import com.bsth.service.LineVersionsService; | ||
| 8 | +import com.bsth.util.GetUIDAndCode; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +import java.text.ParseException; | ||
| 16 | +import java.text.SimpleDateFormat; | ||
| 17 | +import java.util.Date; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * | ||
| 23 | + * @ClassName: LineController(线路控制器) | ||
| 24 | + * | ||
| 25 | + * @Extends : BaseController | ||
| 26 | + * | ||
| 27 | + * @Description: TODO(线路控制层) | ||
| 28 | + * | ||
| 29 | + * @Author bsth@lq | ||
| 30 | + * | ||
| 31 | + * @Date 2016年4月28日 上午9:21:17 | ||
| 32 | + * | ||
| 33 | + * @Version 公交调度系统BS版 0.1 | ||
| 34 | + * | ||
| 35 | + */ | ||
| 36 | +@RestController | ||
| 37 | +@RequestMapping("line") | ||
| 38 | +public class LineController extends BaseController<Line, Integer> { | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + private LineService service; | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 44 | + private LineVersionsService lineVersionsService; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获取线路编码与ID | ||
| 48 | + * | ||
| 49 | + * @return int <lineCode:线路编码> | ||
| 50 | + */ | ||
| 51 | + @RequestMapping(value = "getLineCode", method = RequestMethod.GET) | ||
| 52 | + public long getLineCode() { | ||
| 53 | + return GetUIDAndCode.getLineId(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 验证线路编码是否存在 | ||
| 58 | + * | ||
| 59 | + * @return Map < {valid: true }:是否通过验证> | ||
| 60 | + */ | ||
| 61 | + @RequestMapping(value = "lineCodeVerification", method = RequestMethod.GET) | ||
| 62 | + public String lineCodeVerification(@RequestParam(defaultValue = "lineCode") String lineCode) { | ||
| 63 | + return service.lineCodeVerification(lineCode); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * | ||
| 68 | + * 保存 | ||
| 69 | + * | ||
| 70 | + */ | ||
| 71 | + @RequestMapping(method = RequestMethod.POST) | ||
| 72 | + public Map<String, Object> save(Line t){ | ||
| 73 | + Map<String, Object> map = new HashMap<>(); | ||
| 74 | + if(t.getId()==null) { | ||
| 75 | + | ||
| 76 | + t.setId(Integer.valueOf(t.getLineCode())); | ||
| 77 | + | ||
| 78 | + } | ||
| 79 | + if( (t.getId().toString().length()) > 6 || service.lineCodeVerification(t.getLineCode()).equals("false") ) { | ||
| 80 | + | ||
| 81 | + map.put("status", ResponseCode.ERROR); | ||
| 82 | + return map; | ||
| 83 | + } | ||
| 84 | + // 添加线路版本 | ||
| 85 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 86 | + try { | ||
| 87 | + Date endDate = simpleDateFormat.parse("2088-08-08 00:00:00"); | ||
| 88 | + LineVersions lineVersions = new LineVersions(); | ||
| 89 | + lineVersions.setName("原始版本"); | ||
| 90 | + lineVersions.setLine(t); | ||
| 91 | + lineVersions.setLineCode(t.getLineCode()); | ||
| 92 | + lineVersions.setStartDate(new java.sql.Date(new Date().getTime())); | ||
| 93 | + lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));// 2088-8-8 00:00:00 | ||
| 94 | + lineVersions.setVersions(1); | ||
| 95 | + lineVersions.setStatus(1); | ||
| 96 | + // 先添加线路再添加版本 | ||
| 97 | + service.save(t); | ||
| 98 | + return lineVersionsService.save(lineVersions); | ||
| 99 | + } catch (ParseException e) { | ||
| 100 | + // TODO Auto-generated catch block | ||
| 101 | + e.printStackTrace(); | ||
| 102 | + map.put("status", ResponseCode.ERROR); | ||
| 103 | + return map; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * 更改 | ||
| 109 | + */ | ||
| 110 | + @RequestMapping(value="/update", method = RequestMethod.POST) | ||
| 111 | + public Map<String, Object> update(Line l){ | ||
| 112 | + Map<String, Object> map = new HashMap<>(); | ||
| 113 | + if((l.getId().toString().length()) > 6 || service.lineCodeVerification(l.getLineCode()).equals("true") ) { | ||
| 114 | + | ||
| 115 | + map.put("status", ResponseCode.ERROR); | ||
| 116 | + return map; | ||
| 117 | + } | ||
| 118 | + return service.update(l); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @RequestMapping(value ="/findById" , method = RequestMethod.GET) | ||
| 122 | + Line findByID(@RequestParam(defaultValue = "id") Integer id){ | ||
| 123 | + return service.findById(id); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * 删除线路 | ||
| 128 | + * @param id | ||
| 129 | + * @return | ||
| 130 | + */ | ||
| 131 | + @RequestMapping(value ="/remove" , method = RequestMethod.POST) | ||
| 132 | + public Map<String, Object> remove(Integer id){ | ||
| 133 | + return service.remove(id); | ||
| 134 | + } | ||
| 135 | +} |
src/main/java/com/bsth/controller/LineInformationController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/LineInformationController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | +import org.springframework.web.bind.annotation.RestController; | ||
| 9 | + | ||
| 10 | +import com.bsth.entity.LineInformation; | ||
| 11 | +import com.bsth.service.LineInformationService; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * | ||
| 15 | + * @ClassName: LineInformationController(线路标准信息控制器) | ||
| 16 | + * | ||
| 17 | + * @Extends : BaseController | ||
| 18 | + * | ||
| 19 | + * @Description: TODO(路段控制层) | ||
| 20 | + * | ||
| 21 | + * @Author bsth@lq | ||
| 22 | + * | ||
| 23 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("lineInformation") | ||
| 31 | +public class LineInformationController extends BaseController<LineInformation, Integer> { | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + LineInformationService lineInformationService; | ||
| 35 | + | ||
| 36 | + @RequestMapping("/line/multi") | ||
| 37 | + public List<LineInformation> findByLine(@RequestParam String lineCodes){ | ||
| 38 | + return lineInformationService.findByLine(lineCodes); | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/bsth/controller/LineVersionsController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/LineVersionsController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.LineVersions; | ||
| 13 | +import com.bsth.repository.LineRepository; | ||
| 14 | +import com.bsth.service.LineVersionsService; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * | ||
| 18 | + * @ClassName: LineController(线路版本控制器) | ||
| 19 | + * | ||
| 20 | + * @Extends : BaseController | ||
| 21 | + * | ||
| 22 | + * @Description: TODO(线路版本版控制层) | ||
| 23 | + * | ||
| 24 | + * @Author bsth@lq | ||
| 25 | + * | ||
| 26 | + * @Version 公交调度系统BS版 0.1 | ||
| 27 | + * | ||
| 28 | + */ | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("lineVersions") | ||
| 31 | +public class LineVersionsController extends BaseController<LineVersions, Integer> { | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + private LineVersionsService service; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + LineRepository lineRepository; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获取线路所有版本 | ||
| 41 | + */ | ||
| 42 | + @RequestMapping(value = "findLineVersionsMax", method = RequestMethod.GET) | ||
| 43 | + public LineVersions findLineVersionsMax(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 44 | + return service.findLineVersionsMax(lineId); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 获取线路所有版本 | ||
| 49 | + * | ||
| 50 | + */ | ||
| 51 | + @RequestMapping(value = "findByLineId", method = RequestMethod.GET) | ||
| 52 | + public List<LineVersions> getLineCode(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 53 | + return service.findByLineCode(lineId); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 根据id查询线路版本信息 | ||
| 58 | + * | ||
| 59 | + */ | ||
| 60 | + @RequestMapping(value = "findById", method = RequestMethod.GET) | ||
| 61 | + public LineVersions findOne(@RequestParam(defaultValue = "id") int id) { | ||
| 62 | + return service.findById(id); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 根据id修改线路版本信息 | ||
| 67 | + * | ||
| 68 | + */ | ||
| 69 | + @RequestMapping(value = "update", method = RequestMethod.POST) | ||
| 70 | + public Map<String, Object> update(@RequestParam Map<String, Object> map) { | ||
| 71 | + return service.update(map); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @RequestMapping(value = "add", method = RequestMethod.POST) | ||
| 75 | + public Map<String, Object> add(@RequestParam Map<String, Object> map) { | ||
| 76 | + return service.add(map); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 根据线路id获取当前版本号 | ||
| 81 | + * | ||
| 82 | + */ | ||
| 83 | + @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET) | ||
| 84 | + public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 85 | + return service.findCurrentVersion(lineId); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 根据id发布版本号(修改isupdate字段) | ||
| 90 | + */ | ||
| 91 | + @RequestMapping(value = "issueVersion", method = RequestMethod.POST) | ||
| 92 | + public Map<String, Object> issueVersion(@RequestParam(defaultValue = "id") int id) { | ||
| 93 | + return service.issueVersion(id); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | +} |
src/main/java/com/bsth/controller/PersonnelController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/PersonnelController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import com.bsth.data.pinyin.PersionPinYin; | ||
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 6 | +import com.bsth.entity.Personnel; | ||
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 8 | +import com.bsth.service.PersonnelService; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Created by xu on 16/6/15. | ||
| 21 | + */ | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping("personnel") | ||
| 24 | +public class PersonnelController extends BaseController<Personnel, Integer> { | ||
| 25 | + | ||
| 26 | + @Autowired | ||
| 27 | + private PersonnelService service; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 31 | + | ||
| 32 | + @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) | ||
| 33 | + public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { | ||
| 34 | + return service.sreachPersonnel(jobCode); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @RequestMapping(value = "/all_py", method = RequestMethod.GET) | ||
| 38 | + public List<PersionPinYin> findAll_PY(){ | ||
| 39 | + return persionPinYinBuffer.getAll(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/list_py", method = RequestMethod.GET) | ||
| 43 | + public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){ | ||
| 44 | + List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 45 | + return persionPinYinBuffer.getAll(auths); | ||
| 46 | + } | ||
| 47 | +} |
src/main/java/com/bsth/controller/RoadSpeedController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/RoadSpeedController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.RoadSpeed; | ||
| 13 | +import com.bsth.service.RoadSpeedService; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * @ClassName: RoadSpeedController(路段限速控制器) | ||
| 18 | + * | ||
| 19 | + * @Extends : BaseController | ||
| 20 | + * | ||
| 21 | + * @Description: TODO(路段限速控制层) | ||
| 22 | + * | ||
| 23 | + * @Author bsth@lq | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("roadSpeed") | ||
| 30 | +public class RoadSpeedController extends BaseController<RoadSpeed, Integer> { | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + private RoadSpeedService service; | ||
| 34 | + | ||
| 35 | + /*@RequestMapping(value="all", method = RequestMethod.GET) | ||
| 36 | + public List<RoadSpeed> allRoadSpeed(){ | ||
| 37 | + return service.allRoadSpeed(); | ||
| 38 | + }*/ | ||
| 39 | + | ||
| 40 | + @RequestMapping(value="save", method = RequestMethod.POST) | ||
| 41 | + public Map<String, Object> save(@RequestParam Map<String, Object> map){ | ||
| 42 | + return service.roadSpeedSave(map); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @RequestMapping(value="update", method = RequestMethod.POST) | ||
| 46 | + public Map<String, Object> update(@RequestParam Map<String, Object> map){ | ||
| 47 | + return service.update(map); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @RequestMapping(value="findById", method = RequestMethod.GET) | ||
| 51 | + public RoadSpeed findById(@RequestParam(defaultValue = "id") Integer id){ | ||
| 52 | + return service.findId(id); | ||
| 53 | + } | ||
| 54 | +} |
src/main/java/com/bsth/controller/SectionController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/SectionController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | + | ||
| 11 | +import com.bsth.entity.Section; | ||
| 12 | +import com.bsth.service.SectionService; | ||
| 13 | +import com.bsth.util.GetUIDAndCode; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * @ClassName: SectionController(路段控制器) | ||
| 18 | + * | ||
| 19 | + * @Extends : BaseController | ||
| 20 | + * | ||
| 21 | + * @Description: TODO(路段控制层) | ||
| 22 | + * | ||
| 23 | + * @Author bsth@lq | ||
| 24 | + * | ||
| 25 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 26 | + * | ||
| 27 | + * @Version 公交调度系统BS版 0.1 | ||
| 28 | + * | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("section") | ||
| 33 | +public class SectionController extends BaseController<Section, Integer> { | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + SectionService service; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 新增路段信息 | ||
| 40 | + * | ||
| 41 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | ||
| 42 | + * | ||
| 43 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | ||
| 44 | + * | ||
| 45 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | ||
| 46 | + * | ||
| 47 | + * @return map<SUCCESS:成功;ERROR:异常> | ||
| 48 | + */ | ||
| 49 | + @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | ||
| 50 | + public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { | ||
| 51 | + map.put("createBy", ""); | ||
| 52 | + map.put("updateBy", ""); | ||
| 53 | + return service.sectionSave(map); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @Description :TODO(编辑线路走向) | ||
| 58 | + * | ||
| 59 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 60 | + * | ||
| 61 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 62 | + */ | ||
| 63 | + @RequestMapping(value="sectionCut" , method = RequestMethod.POST) | ||
| 64 | + public Map<String, Object> sectionCut(@RequestParam Map<String, Object> map) { | ||
| 65 | + | ||
| 66 | + map.put("updateBy", ""); | ||
| 67 | + | ||
| 68 | + map.put("createBy", ""); | ||
| 69 | + | ||
| 70 | + map.put("createDate", ""); | ||
| 71 | + | ||
| 72 | + return service.sectionCut(map); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(编辑线路走向保存到线路历史表) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 83 | + @RequestMapping(value="sectionCutSaveLineLS" , method = RequestMethod.POST) | ||
| 84 | + public Map<String, Object> sectionCutSaveLineLS(@RequestParam Map<String, Object> map) { | ||
| 85 | + | ||
| 86 | + map.put("updateBy", ""); | ||
| 87 | + | ||
| 88 | + map.put("createBy", ""); | ||
| 89 | + | ||
| 90 | + return service.sectionCutSaveLineLS(map); | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * @Description :TODO(编辑线路走向) | ||
| 96 | + * | ||
| 97 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 98 | + * | ||
| 99 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 100 | + */ | ||
| 101 | + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | ||
| 102 | + public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | ||
| 103 | + | ||
| 104 | + map.put("updateBy", ""); | ||
| 105 | + | ||
| 106 | + map.put("createBy", ""); | ||
| 107 | + | ||
| 108 | + map.put("createDate", ""); | ||
| 109 | + | ||
| 110 | + return service.sectionUpdate(map); | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * @Description :TODO(编辑缓存线路走向) | ||
| 116 | + */ | ||
| 117 | + @RequestMapping(value="sectionCacheUpdate" , method = RequestMethod.POST) | ||
| 118 | + public Map<String, Object> sectionCacheUpdate(@RequestParam Map<String, Object> map) { | ||
| 119 | + | ||
| 120 | + map.put("updateBy", ""); | ||
| 121 | + | ||
| 122 | + map.put("createBy", ""); | ||
| 123 | + | ||
| 124 | + map.put("createDate", ""); | ||
| 125 | + | ||
| 126 | + return service.sectionCacheUpdate(map); | ||
| 127 | + | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * @Description :TODO(查询路段编码) | ||
| 132 | + * | ||
| 133 | + * @return int <sectionCode路段编码> | ||
| 134 | + */ | ||
| 135 | + @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) | ||
| 136 | + public long getSectionCode() { | ||
| 137 | + return GetUIDAndCode.getSectionId(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * @Description :TODO(把路段截取位双路名路段) | ||
| 142 | + * | ||
| 143 | + * @return int <sectionCode路段编码> | ||
| 144 | + */ | ||
| 145 | + @RequestMapping(value="doubleName" , method = RequestMethod.POST) | ||
| 146 | + public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { | ||
| 147 | + return service.doubleName(map); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | +} |
src/main/java/com/bsth/controller/SectionRouteController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/SectionRouteController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.SectionRoute; | ||
| 13 | +import com.bsth.entity.StationRouteCache; | ||
| 14 | +import com.bsth.service.SectionRouteService; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * | ||
| 18 | + * @ClassName: SectionRouteController(路段路由控制器) | ||
| 19 | + * | ||
| 20 | + * @Extends : BaseController | ||
| 21 | + * | ||
| 22 | + * @Description: TODO(路段路由控制层) | ||
| 23 | + * | ||
| 24 | + * @Author bsth@lq | ||
| 25 | + * | ||
| 26 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 27 | + * | ||
| 28 | + * @Version 公交调度系统BS版 0.1 | ||
| 29 | + * | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("sectionroute") | ||
| 34 | +public class SectionRouteController extends BaseController<SectionRoute, Integer> { | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + SectionRouteService routeService; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * @param map | ||
| 41 | + * @throws | ||
| 42 | + * @Description: TODO(批量撤销路段) | ||
| 43 | + */ | ||
| 44 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 45 | + public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) { | ||
| 46 | + return routeService.updateSectionRouteInfoFormId(map); | ||
| 47 | + } | ||
| 48 | + /** | ||
| 49 | + * @param id //路段路由id | ||
| 50 | + * @Description: TODO(撤销路段) | ||
| 51 | + */ | ||
| 52 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 53 | + public Map<String, Object> destroy(@RequestParam Integer id) { | ||
| 54 | + return routeService.destroy(id); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @param @param map | ||
| 59 | + * @throws | ||
| 60 | + * @Title: list | ||
| 61 | + * @Description: TODO(多条件查询) | ||
| 62 | + */ | ||
| 63 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 64 | + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | ||
| 65 | + return routeService.list(map); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @RequestMapping(value = "/cacheList", method = RequestMethod.GET) | ||
| 69 | + public List<StationRouteCache> cacheList(@RequestParam Map<String, Object> map) { | ||
| 70 | +// routeService.cacheList(map) | ||
| 71 | + return null; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * @Description :TODO(查询路段信息) | ||
| 76 | + * | ||
| 77 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 78 | + * | ||
| 79 | + * @return Map<String, Object> | ||
| 80 | + */ | ||
| 81 | + @RequestMapping(value = "/findSection" , method = RequestMethod.GET) | ||
| 82 | + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { | ||
| 83 | + return routeService.getSectionRoute(map); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * @Description :TODO(查询路段信息) | ||
| 89 | + * | ||
| 90 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 91 | + * | ||
| 92 | + * @return Map<String, Object> | ||
| 93 | + */ | ||
| 94 | + @RequestMapping(value = "/findCacheSection" , method = RequestMethod.GET) | ||
| 95 | + public List<Map<String, Object>> getSectionRouteCache(@RequestParam Map<String, Object> map) { | ||
| 96 | + return routeService.getSectionRouteCache(map); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * @Description : TODO(根据路段路由Id查询详情) | ||
| 101 | + * | ||
| 102 | + * @param map <id:路段路由ID> | ||
| 103 | + * | ||
| 104 | + * @return List<Map<String, Object>> | ||
| 105 | + */ | ||
| 106 | + @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET) | ||
| 107 | + public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) { | ||
| 108 | + return routeService.findSectionRouteInfoFormId(map); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * @Description :TODO(查询线路某方向下的上一个路段序号) | ||
| 113 | + * | ||
| 114 | + * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码> | ||
| 115 | + * | ||
| 116 | + * @return List<Map<String, Object>> | ||
| 117 | + */ | ||
| 118 | + @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET) | ||
| 119 | + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | ||
| 120 | + return routeService.findUpSectionRouteCode(map); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @RequestMapping(value = "/findCacheUpSectionRouteCode" , method = RequestMethod.GET) | ||
| 124 | + public List<Map<String, Object>> findCacheUpSectionRouteCode(@RequestParam Map<String, Object> map) { | ||
| 125 | + return routeService.findCacheUpSectionRouteCode(map); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * @Description :TODO(引用路段) | ||
| 130 | + * | ||
| 131 | + * @return List<Map<String, Object>> | ||
| 132 | + */ | ||
| 133 | + @RequestMapping(value = "/quoteSection" , method = RequestMethod.POST) | ||
| 134 | + public Map<String, Object> quoteSection(@RequestParam Map<String, Object> map) { | ||
| 135 | + return routeService.quoteSection(map); | ||
| 136 | + } | ||
| 137 | +} |
src/main/java/com/bsth/controller/SectionSpeedController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/SectionSpeedController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import com.bsth.entity.SectionSpeed; | ||
| 7 | +import com.bsth.service.SectionSpeedService; | ||
| 8 | + | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +@RestController | ||
| 14 | +@RequestMapping("sectionspeed") | ||
| 15 | +public class SectionSpeedController extends BaseController<SectionSpeed, Integer> { | ||
| 16 | + | ||
| 17 | + @Autowired | ||
| 18 | + private SectionSpeedService sectionSpeedService; | ||
| 19 | + | ||
| 20 | + /**@description TODO(新增路段限速) */ | ||
| 21 | + @RequestMapping(value="add" , method = RequestMethod.POST) | ||
| 22 | + public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { | ||
| 23 | + return sectionSpeedService.add(map); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /**@description TODO(修改路段) */ | ||
| 27 | + @RequestMapping(value="roadUpd" , method = RequestMethod.POST) | ||
| 28 | + public Map<String, Object> roadUpd(@RequestParam Map<String, Object> map) { | ||
| 29 | + return sectionSpeedService.roadUpd(map); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** @description TODO(根据线路ID与编码及方向查询路段限速信息) */ | ||
| 33 | + @RequestMapping(value="getSectionSpeedInfoList",method=RequestMethod.GET) | ||
| 34 | + public List<Map<String, Object>> getSectionSpeedInfoList(@RequestParam Map<String, Object> map){ | ||
| 35 | + return sectionSpeedService.getSectionSpeedInfo(map); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @Description :TODO(查询路段信息) | ||
| 40 | + * | ||
| 41 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 42 | + * | ||
| 43 | + * @return Map<String, Object> | ||
| 44 | + */ | ||
| 45 | + @RequestMapping(value = "/analyticSection" , method = RequestMethod.GET) | ||
| 46 | + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { | ||
| 47 | + return sectionSpeedService.analyticSection(map); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | +} |
src/main/java/com/bsth/controller/StationController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/StationController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.Station; | ||
| 4 | +import com.bsth.service.StationService; | ||
| 5 | +import com.bsth.util.GetUIDAndCode; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * | ||
| 18 | + * @ClassName: StationController(站点控制器) | ||
| 19 | + * | ||
| 20 | + * @Extends : BaseController | ||
| 21 | + * | ||
| 22 | + * @Description: TODO(站点控制层) | ||
| 23 | + * | ||
| 24 | + * @Author bsth@lq | ||
| 25 | + * | ||
| 26 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 27 | + * | ||
| 28 | + * @Version 公交调度系统BS版 0.1 | ||
| 29 | + * | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("station") | ||
| 34 | +public class StationController extends BaseController<Station, Integer> { | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private StationService service; | ||
| 38 | + | ||
| 39 | + /** 日志记录器 */ | ||
| 40 | + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 44 | + * | ||
| 45 | + * @param map: <point:坐标点; name:站点名> | ||
| 46 | + * | ||
| 47 | + */ | ||
| 48 | + @RequestMapping(value="matchStation" , method = RequestMethod.GET) | ||
| 49 | + public Map<String, Object> matchStation(@RequestParam Map<String, Object> map) { | ||
| 50 | + return service.matchStation(map); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @Description :TODO(系统规划保存数据) | ||
| 55 | + * | ||
| 56 | + * @param map <stationJSON:站点信息; | ||
| 57 | + * | ||
| 58 | + * - - - - - - sectionJSON:路段信息; | ||
| 59 | + * | ||
| 60 | + * - - - - - - dbType:坐标类型; | ||
| 61 | + * | ||
| 62 | + * - - - - - - destroy:是否撤销; | ||
| 63 | + * | ||
| 64 | + * - - - - - - directions:方向; | ||
| 65 | + * | ||
| 66 | + * - - - - - - lineId:线路ID; | ||
| 67 | + * | ||
| 68 | + * - - - - - - radius:圆半径 | ||
| 69 | + * | ||
| 70 | + * - - - - - - shapesType:图形类型 | ||
| 71 | + * | ||
| 72 | + * - - - - - - speedLimit:限速> | ||
| 73 | + * | ||
| 74 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 75 | + */ | ||
| 76 | + @RequestMapping(value="collectionSave" , method = RequestMethod.POST) | ||
| 77 | + public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { | ||
| 78 | + return service.systemSaveStations(map); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @RequestMapping(value="manualSave" , method = RequestMethod.POST) | ||
| 82 | + public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { | ||
| 83 | + return service.manualSave(map); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @RequestMapping(value="cacheSave" , method = RequestMethod.POST) | ||
| 87 | + public Map<String, Object> cacheSave(@RequestParam Map<String, Object> map) { | ||
| 88 | + return service.cacheSave(map); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @Description :TODO(新增站点保存) | ||
| 93 | + * | ||
| 94 | + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型; | ||
| 95 | + * | ||
| 96 | + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标; | ||
| 97 | + * | ||
| 98 | + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型; | ||
| 99 | + * | ||
| 100 | + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间 | ||
| 101 | + * | ||
| 102 | + * versions:版本号;x:城建坐标x;y:城建坐标y> | ||
| 103 | + * | ||
| 104 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 105 | + */ | ||
| 106 | + @RequestMapping(value="stationSave" , method = RequestMethod.POST) | ||
| 107 | + public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { | ||
| 108 | + map.put("createBy", ""); | ||
| 109 | + map.put("updateBy", ""); | ||
| 110 | + return service.stationSaveMap(map); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @Description :TODO(更新站点保存) | ||
| 115 | + * | ||
| 116 | + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型; | ||
| 117 | + * | ||
| 118 | + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标; | ||
| 119 | + * | ||
| 120 | + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型; | ||
| 121 | + * | ||
| 122 | + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间 | ||
| 123 | + * | ||
| 124 | + * versions:版本号;x:城建坐标x;y:城建坐标y> | ||
| 125 | + * | ||
| 126 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 127 | + */ | ||
| 128 | + @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) | ||
| 129 | + public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { | ||
| 130 | + map.put("updateBy", ""); | ||
| 131 | + return service.stationUpdate(map); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * @Description :TODO(更新缓存站点保存) | ||
| 136 | + * | ||
| 137 | + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型; | ||
| 138 | + * | ||
| 139 | + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标; | ||
| 140 | + * | ||
| 141 | + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型; | ||
| 142 | + * | ||
| 143 | + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间 | ||
| 144 | + * | ||
| 145 | + * versions:版本号;x:城建坐标x;y:城建坐标y> | ||
| 146 | + * | ||
| 147 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 148 | + */ | ||
| 149 | + @RequestMapping(value="stationCacheUpdate" , method = RequestMethod.POST) | ||
| 150 | + public Map<String, Object> stationCacheUpdate(@RequestParam Map<String, Object> map) { | ||
| 151 | + map.put("updateBy", ""); | ||
| 152 | + return service.stationCacheUpdate(map); | ||
| 153 | + } | ||
| 154 | + /** | ||
| 155 | + * @Description :TODO(更新内部编码) | ||
| 156 | + * @param stationCount,sectionCount 更新数 | ||
| 157 | + */ | ||
| 158 | + @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) | ||
| 159 | + public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { | ||
| 160 | + System.out.println(stationCount+" _ "+ sectionCount ); | ||
| 161 | + for(int i = 0; i < stationCount; i++) { | ||
| 162 | + System.out.println(i); | ||
| 163 | + GetUIDAndCode.getStationId(); | ||
| 164 | + } | ||
| 165 | + for(int j = 0; j < sectionCount; j++) { | ||
| 166 | + System.out.println(j); | ||
| 167 | + GetUIDAndCode.getSectionId(); | ||
| 168 | + } | ||
| 169 | + return 1; | ||
| 170 | + } | ||
| 171 | + /** | ||
| 172 | + * @Description :TODO(查询站点编码) | ||
| 173 | + * | ||
| 174 | + * @return int <stationCode站点编码> | ||
| 175 | + */ | ||
| 176 | + @RequestMapping(value="getStationCode" , method = RequestMethod.GET) | ||
| 177 | + public long getStationCode() { | ||
| 178 | + return GetUIDAndCode.getStationId(); | ||
| 179 | + | ||
| 180 | + } | ||
| 181 | + /** | ||
| 182 | + * @Description :TODO(查询站点编码) | ||
| 183 | + * | ||
| 184 | + * @return int <stationCode站点编码> | ||
| 185 | + */ | ||
| 186 | + @RequestMapping(value="stationCacheSave" , method = RequestMethod.POST) | ||
| 187 | + public Map<String, Object> stationCacheSave(@RequestParam Map<String, Object> map) { | ||
| 188 | + map.put("createBy", ""); | ||
| 189 | + map.put("updateBy", ""); | ||
| 190 | + return service.stationCacheSave(map); | ||
| 191 | + } | ||
| 192 | +} |
src/main/java/com/bsth/controller/StationRouteController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/StationRouteController.java | ||
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.StationRoute; | ||
| 4 | +import com.bsth.entity.StationRouteCache; | ||
| 5 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 6 | +import com.bsth.repository.StationRouteRepository; | ||
| 7 | +import com.bsth.service.StationRouteService; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Map; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * | ||
| 20 | + * @ClassName: StationRouteController(站点路由控制器) | ||
| 21 | + * | ||
| 22 | + * @Extends : BaseController | ||
| 23 | + * | ||
| 24 | + * @Description: TODO(站点路由控制层) | ||
| 25 | + * | ||
| 26 | + * @Author bsth@lq | ||
| 27 | + * | ||
| 28 | + * @Date 2016年5月03日 上午9:21:17 | ||
| 29 | + * | ||
| 30 | + * @Dersion 公交调度系统BS版 0.1 | ||
| 31 | + * | ||
| 32 | + */ | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("stationroute") | ||
| 35 | +public class StationRouteController extends BaseController<StationRoute, Integer> { | ||
| 36 | + | ||
| 37 | + @Autowired | ||
| 38 | + StationRouteService service; | ||
| 39 | + @Autowired | ||
| 40 | + StationRouteRepository stationRouteRepository; | ||
| 41 | + @Autowired | ||
| 42 | + StationRouteCacheRepository stationRouteCacheRepository; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @param @param map | ||
| 46 | + * @throws | ||
| 47 | + * @Title: list | ||
| 48 | + * @Description: TODO(多条件查询) | ||
| 49 | + */ | ||
| 50 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 51 | + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) { | ||
| 52 | + return service.list(map); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @RequestMapping(value = "/cacheList", method = RequestMethod.GET) | ||
| 56 | + public List<StationRouteCache> cacheList(@RequestParam Map<String, Object> map) { | ||
| 57 | + return service.cacheList(map); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @Description :TODO(查询路段信息) | ||
| 62 | + * | ||
| 63 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 64 | + * | ||
| 65 | + * @return Map<String, Object> | ||
| 66 | + */ | ||
| 67 | + @RequestMapping(value = "/export" , method = RequestMethod.GET) | ||
| 68 | + public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) { | ||
| 69 | + return service.getSectionRouteExport(id, resp); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @param map | ||
| 74 | + * @throws | ||
| 75 | + * @Description: TODO(批量撤销站点) | ||
| 76 | + */ | ||
| 77 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 78 | + public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) { | ||
| 79 | + return service.updateStationRouteInfoFormId(map); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * @Description :TODO(查询树站点与路段数据) | ||
| 84 | + * | ||
| 85 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 86 | + * | ||
| 87 | + * @return List<Map<String, Object>> | ||
| 88 | + */ | ||
| 89 | + @RequestMapping(value = "/findStations" , method = RequestMethod.GET) | ||
| 90 | + public List<Map<String, Object>> findStations(@RequestParam Map<String, Object> map) { | ||
| 91 | + return service.findPoints(map); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @RequestMapping(value = "/systemQuote" , method = RequestMethod.POST) | ||
| 95 | + public Map<String, Object> systemQuote(@RequestParam Map<String, Object> map) { | ||
| 96 | + return service.systemQuote(map); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * @Description :TODO(查询线路某方向下的站点序号与类型) | ||
| 101 | + * | ||
| 102 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 103 | + * | ||
| 104 | + * @return List<Map<String, Object>> | ||
| 105 | + */ | ||
| 106 | + @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET) | ||
| 107 | + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | ||
| 108 | + return service.findUpStationRouteCode(map); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * @Description :TODO(查询线路某方向下的站点序号与类型) | ||
| 113 | + */ | ||
| 114 | + @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) | ||
| 115 | + public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { | ||
| 116 | + return service.findCacheUpStationRouteCode(map); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * @Description :TODO(查询站点的下一个缓存站点) | ||
| 121 | + */ | ||
| 122 | + @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET) | ||
| 123 | + public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) { | ||
| 124 | + return service.findDownStationRoute(map); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 129 | + * | ||
| 130 | + * @param map <lineId:线路ID; direction:方向> | ||
| 131 | + * | ||
| 132 | + * @return List<Map<String, Object>> | ||
| 133 | + */ | ||
| 134 | + @RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET) | ||
| 135 | + public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) { | ||
| 136 | + return service.getStationRouteCenterPoints(map); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * @Description :TODO(查询线路某方向下所有站点) | ||
| 141 | + * | ||
| 142 | + * @param map <lineId:线路ID; direction:方向> | ||
| 143 | + * | ||
| 144 | + * @return List<Map<String, Object>> | ||
| 145 | + */ | ||
| 146 | + @RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET) | ||
| 147 | + public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) { | ||
| 148 | + return service.getStationRouteList(map); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 153 | + * | ||
| 154 | + * @param map <lineId:线路ID; direction:方向> | ||
| 155 | + * | ||
| 156 | + * @return List<Map<String, Object>> | ||
| 157 | + */ | ||
| 158 | + @RequestMapping(value = "/getStationRouteCacheCenterPoints" , method = RequestMethod.GET) | ||
| 159 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(@RequestParam Map<String, Object> map) { | ||
| 160 | + return service.getStationRouteCacheCenterPoints(map); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * @Description :TODO(撤销站点) | ||
| 165 | + * | ||
| 166 | + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | ||
| 167 | + * | ||
| 168 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 169 | + */ | ||
| 170 | + @RequestMapping(value = "/stationRouteIsDestroy" , method = RequestMethod.POST) | ||
| 171 | + public Map<String, Object> stationRouteIsDestroy(@RequestParam Map<String, Object> map) { | ||
| 172 | + return service.stationRouteIsDestroy(map); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * @Description : TODO(根据线路ID生成行单) | ||
| 177 | + * | ||
| 178 | + * @param map <id:线路ID> | ||
| 179 | + * | ||
| 180 | + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> | ||
| 181 | + */ | ||
| 182 | + @RequestMapping(value = "/usingSingle",method = RequestMethod.POST) | ||
| 183 | + public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) { | ||
| 184 | + return service.usingSingle(map); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * @Description : TODO(根据站点路由Id查询详情) | ||
| 190 | + * | ||
| 191 | + * @param map <id:站点路由ID> | ||
| 192 | + * | ||
| 193 | + * @return List<Map<String, Object>> | ||
| 194 | + */ | ||
| 195 | + @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET) | ||
| 196 | + public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) { | ||
| 197 | + return service.findStationRouteInfo(map); | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + @RequestMapping(value = "/stations", method = RequestMethod.GET) | ||
| 201 | + public List<Map<String, Object>> findStations(Integer xlid, Integer xldir) { | ||
| 202 | + return stationRouteRepository.findStations(xlid, xldir); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * | ||
| 207 | + * @Title: findByMultiLine | ||
| 208 | + * @Description: TODO(多线路路由查询) | ||
| 209 | + */ | ||
| 210 | + @RequestMapping(value = "/multiLine", method = RequestMethod.GET) | ||
| 211 | + public Map<String, Object> findByMultiLine(@RequestParam String lineIds){ | ||
| 212 | + return service.findByMultiLine(lineIds); | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + /** | ||
| 216 | + * | ||
| 217 | + * @Title: updSwitchDir | ||
| 218 | + * @Description: TODO(上下行切换) | ||
| 219 | + */ | ||
| 220 | + @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST) | ||
| 221 | + public Map<String, Object> updSwitchDir(@RequestParam String lineIds){ | ||
| 222 | + return service.updSwitchDir(lineIds); | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * | ||
| 227 | + * @Title: upddis | ||
| 228 | + * @Description: TODO(更新站距) | ||
| 229 | + */ | ||
| 230 | + @RequestMapping(value = "/upddis",method = RequestMethod.POST) | ||
| 231 | + public Map<String, Object> upddis(@RequestParam Map<String, Object> map) { | ||
| 232 | + return service.upddis(map); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * | ||
| 237 | + * @Title: findCacheStationRoute | ||
| 238 | + * @Description: TODO(查询缓存路由) | ||
| 239 | + */ | ||
| 240 | + @RequestMapping(value = "/findCacheStationRoute",method = RequestMethod.GET) | ||
| 241 | + public List<StationRouteCache> findCacheStationRoute(@RequestParam Map<String, Object> map) { | ||
| 242 | + int lineId = Integer.parseInt(map.get("lineId").toString()); | ||
| 243 | + int dir = Integer.parseInt(map.get("dir").toString()); | ||
| 244 | + return stationRouteCacheRepository.findstationRoute(lineId, dir); | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + /** | ||
| 248 | + * | ||
| 249 | + * @Title: findCachePoint | ||
| 250 | + * | ||
| 251 | + * @param map <lineId:线路ID; dir:方向> | ||
| 252 | + * | ||
| 253 | + * @Description: TODO(查询缓存路由) | ||
| 254 | + */ | ||
| 255 | + @RequestMapping(value = "/findCachePoint",method = RequestMethod.GET) | ||
| 256 | + public List<Map<String, Object>> findCachePoint(@RequestParam Map<String, Object> map) { | ||
| 257 | + int lineId = Integer.parseInt(map.get("lineId").toString()); | ||
| 258 | + int dir = Integer.parseInt(map.get("dir").toString()); | ||
| 259 | + return service.findCachePoint(lineId, dir); | ||
| 260 | + } | ||
| 261 | +} |
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/calc/CalcWaybillController.java | ||
| 1 | +package com.bsth.controller.calc; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.controller.BaseController; | ||
| 5 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 6 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 7 | +import com.bsth.service.calc.CalcWaybillService; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Created by 17/10/23. | ||
| 19 | + */ | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("calcWaybill") | ||
| 22 | +public class CalcWaybillController extends BaseController<CalcWaybill, Integer> { | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + private CalcWaybillService calcWaybillService; | ||
| 26 | + | ||
| 27 | + @RequestMapping(value="/generateNew") | ||
| 28 | + public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 29 | + String date = "", line = "", key=""; | ||
| 30 | + if(map.get("date")!=null){ | ||
| 31 | + date=map.get("date").toString().trim(); | ||
| 32 | + } | ||
| 33 | + if(map.get("line")!=null){ | ||
| 34 | + line=map.get("line").toString().trim(); | ||
| 35 | + } | ||
| 36 | + if(map.get("key")!=null){ | ||
| 37 | + key=map.get("key").toString().trim(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 41 | + m.put("date", date); | ||
| 42 | + m.put("line", line); | ||
| 43 | + m.put("key", key); | ||
| 44 | + try { | ||
| 45 | + | ||
| 46 | + m = calcWaybillService.generateNew(date, line); | ||
| 47 | + | ||
| 48 | + if(key.length() == 0){ | ||
| 49 | + m.put("status", calcWaybillService.calcDaily(date, line)); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } catch (Exception e) { | ||
| 53 | + // TODO: handle exception | ||
| 54 | + e.printStackTrace(); | ||
| 55 | + m.put("status", ResponseCode.ERROR); | ||
| 56 | + return m; | ||
| 57 | + } | ||
| 58 | + return m; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @RequestMapping(value="/statisticsDailyTj") | ||
| 62 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | ||
| 63 | + String gsdm=""; | ||
| 64 | + if(map.get("gsdm")!=null){ | ||
| 65 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 66 | + } | ||
| 67 | + String fgsdm=""; | ||
| 68 | + if(map.get("fgsdm")!=null){ | ||
| 69 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 70 | + } | ||
| 71 | + String line=""; | ||
| 72 | + if(map.get("line")!=null){ | ||
| 73 | + line=map.get("line").toString().trim(); | ||
| 74 | + } | ||
| 75 | + String date=""; | ||
| 76 | + if(map.get("date")!=null){ | ||
| 77 | + date=map.get("date").toString().trim(); | ||
| 78 | + } | ||
| 79 | + String date2=""; | ||
| 80 | + if(map.get("date2")!=null){ | ||
| 81 | + date2=map.get("date2").toString().trim(); | ||
| 82 | + } | ||
| 83 | + String xlName=""; | ||
| 84 | + if(map.get("xlName")!=null){ | ||
| 85 | + xlName=map.get("xlName").toString().trim(); | ||
| 86 | + } | ||
| 87 | + String type=""; | ||
| 88 | + if(map.get("type")!=null){ | ||
| 89 | + type=map.get("type").toString().trim(); | ||
| 90 | + } | ||
| 91 | + return calcWaybillService.statisticsDailyTj(gsdm,fgsdm,line,date,date2,xlName,type); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @RequestMapping(value="/generateDaliy") | ||
| 95 | + public Map<String, Object> generateDaliy(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 96 | + String date = "", line = ""; | ||
| 97 | + if(map.containsKey("date") && map.get("date")!=null){ | ||
| 98 | + date=map.get("date").toString().trim(); | ||
| 99 | + } | ||
| 100 | + if(map.containsKey("line") && map.get("line")!=null){ | ||
| 101 | + line=map.get("line").toString().trim(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 105 | + m.put("date", date); | ||
| 106 | + m.put("line", line); | ||
| 107 | + try { | ||
| 108 | + | ||
| 109 | + m.put("status", calcWaybillService.calcDaily(date, line)); | ||
| 110 | + | ||
| 111 | + } catch (Exception e) { | ||
| 112 | + // TODO: handle exception | ||
| 113 | + e.printStackTrace(); | ||
| 114 | + m.put("status", ResponseCode.ERROR); | ||
| 115 | + return m; | ||
| 116 | + } | ||
| 117 | + return m; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @RequestMapping(value="/calcStatisticsDaily") | ||
| 121 | + public List<CalcStatistics> calcStatisticsDaily(@RequestParam Map<String, Object> map){ | ||
| 122 | + String gsdm=""; | ||
| 123 | + if(map.get("gsdm")!=null){ | ||
| 124 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 125 | + } | ||
| 126 | + String fgsdm=""; | ||
| 127 | + if(map.get("fgsdm")!=null){ | ||
| 128 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 129 | + } | ||
| 130 | + String line=""; | ||
| 131 | + if(map.get("line")!=null){ | ||
| 132 | + line=map.get("line").toString().trim(); | ||
| 133 | + } | ||
| 134 | + String date=""; | ||
| 135 | + if(map.get("date")!=null){ | ||
| 136 | + date=map.get("date").toString().trim(); | ||
| 137 | + } | ||
| 138 | + String date2=""; | ||
| 139 | + if(map.get("date2")!=null){ | ||
| 140 | + date2=map.get("date2").toString().trim(); | ||
| 141 | + } | ||
| 142 | + String xlName=""; | ||
| 143 | + if(map.get("xlName")!=null){ | ||
| 144 | + xlName=map.get("xlName").toString().trim(); | ||
| 145 | + } | ||
| 146 | + String type=""; | ||
| 147 | + if(map.get("type")!=null){ | ||
| 148 | + type=map.get("type").toString().trim(); | ||
| 149 | + } | ||
| 150 | + String nature="0"; | ||
| 151 | + if(map.get("nature")!=null){ | ||
| 152 | + nature=map.get("nature").toString(); | ||
| 153 | + } | ||
| 154 | + return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type,nature); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + @RequestMapping(value="/calcStatisticsDaily2") | ||
| 158 | + public List<Map<String, Object>> calcStatisticsDaily2(@RequestParam Map<String, Object> map){ | ||
| 159 | + String gsdm=""; | ||
| 160 | + if(map.get("gsdm")!=null){ | ||
| 161 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 162 | + } | ||
| 163 | + String fgsdm=""; | ||
| 164 | + if(map.get("fgsdm")!=null){ | ||
| 165 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 166 | + } | ||
| 167 | + String line=""; | ||
| 168 | + if(map.get("line")!=null){ | ||
| 169 | + line=map.get("line").toString().trim(); | ||
| 170 | + } | ||
| 171 | + String date=""; | ||
| 172 | + if(map.get("date")!=null){ | ||
| 173 | + date=map.get("date").toString().trim(); | ||
| 174 | + } | ||
| 175 | + String date2=""; | ||
| 176 | + if(map.get("date2")!=null){ | ||
| 177 | + date2=map.get("date2").toString().trim(); | ||
| 178 | + } | ||
| 179 | + String xlName=""; | ||
| 180 | + if(map.get("xlName")!=null){ | ||
| 181 | + xlName=map.get("xlName").toString().trim(); | ||
| 182 | + } | ||
| 183 | + String type=""; | ||
| 184 | + if(map.get("type")!=null){ | ||
| 185 | + type=map.get("type").toString().trim(); | ||
| 186 | + } | ||
| 187 | + String nature="0"; | ||
| 188 | + if(map.get("nature")!=null){ | ||
| 189 | + nature=map.get("nature").toString(); | ||
| 190 | + } | ||
| 191 | + return calcWaybillService.calcStatisticsDaily2(gsdm,fgsdm,line,date,date2,xlName,type,nature); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + @RequestMapping(value="/generateLineMileage") | ||
| 195 | + public Map<String, Object> generateLineMileage(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 196 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 197 | + String date = "", line = ""; | ||
| 198 | + try { | ||
| 199 | + | ||
| 200 | + if(map.containsKey("date") && map.get("date")!=null){ | ||
| 201 | + date=map.get("date").toString().trim(); | ||
| 202 | + } | ||
| 203 | + if(map.containsKey("line") && map.get("line")!=null){ | ||
| 204 | + line=map.get("line").toString().trim(); | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + | ||
| 208 | + return calcWaybillService.calcLineMileage(date, line); | ||
| 209 | + | ||
| 210 | + } catch (Exception e) { | ||
| 211 | + // TODO: handle exception | ||
| 212 | + e.printStackTrace(); | ||
| 213 | + m.put("status", ResponseCode.ERROR); | ||
| 214 | + m.put("date", date); | ||
| 215 | + m.put("line", line); | ||
| 216 | + return m; | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + @RequestMapping(value="/generateBusMileage") | ||
| 221 | + public Map<String, Object> generateBusMileage(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 222 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 223 | + String date = "", line = ""; | ||
| 224 | + try { | ||
| 225 | + | ||
| 226 | + if(map.containsKey("date") && map.get("date")!=null){ | ||
| 227 | + date=map.get("date").toString().trim(); | ||
| 228 | + } | ||
| 229 | + if(map.containsKey("line") && map.get("line")!=null){ | ||
| 230 | + line=map.get("line").toString().trim(); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + | ||
| 234 | + return calcWaybillService.calcBusMileage(date, line); | ||
| 235 | + | ||
| 236 | + } catch (Exception e) { | ||
| 237 | + // TODO: handle exception | ||
| 238 | + e.printStackTrace(); | ||
| 239 | + m.put("status", ResponseCode.ERROR); | ||
| 240 | + m.put("date", date); | ||
| 241 | + m.put("line", line); | ||
| 242 | + return m; | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + @RequestMapping(value="/getLineMileage") | ||
| 247 | + public List<Map<String, Object>> getLineMileage(@RequestParam Map<String, Object> map){ | ||
| 248 | + String gsdm=""; | ||
| 249 | + if(map.get("gsdm")!=null){ | ||
| 250 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 251 | + } | ||
| 252 | + String fgsdm=""; | ||
| 253 | + if(map.get("fgsdm")!=null){ | ||
| 254 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 255 | + } | ||
| 256 | + String line=""; | ||
| 257 | + if(map.get("line")!=null){ | ||
| 258 | + line=map.get("line").toString().trim(); | ||
| 259 | + } | ||
| 260 | + String date=""; | ||
| 261 | + if(map.get("date")!=null){ | ||
| 262 | + date=map.get("date").toString().trim(); | ||
| 263 | + } | ||
| 264 | + String date2=""; | ||
| 265 | + if(map.get("date2")!=null){ | ||
| 266 | + date2=map.get("date2").toString().trim(); | ||
| 267 | + } | ||
| 268 | + String xlName=""; | ||
| 269 | + if(map.get("xlName")!=null){ | ||
| 270 | + xlName=map.get("xlName").toString().trim(); | ||
| 271 | + } | ||
| 272 | + String zt=""; | ||
| 273 | + if(map.get("zt")!=null){ | ||
| 274 | + zt=map.get("zt").toString(); | ||
| 275 | + } | ||
| 276 | + String by=""; | ||
| 277 | + if(map.get("by")!=null){ | ||
| 278 | + by=map.get("by").toString(); | ||
| 279 | + } | ||
| 280 | + String type=""; | ||
| 281 | + if(map.get("type")!=null){ | ||
| 282 | + type=map.get("type").toString().trim(); | ||
| 283 | + } | ||
| 284 | + return calcWaybillService.getLineMileage(gsdm, fgsdm, line, date, date2, xlName, zt, by, type); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + @RequestMapping(value="/getBusMileage") | ||
| 288 | + public List<Map<String, Object>> getBusMileage(@RequestParam Map<String, Object> map){ | ||
| 289 | + String line=""; | ||
| 290 | + if(map.get("line")!=null){ | ||
| 291 | + line=map.get("line").toString().trim(); | ||
| 292 | + } | ||
| 293 | + String date=""; | ||
| 294 | + if(map.get("date")!=null){ | ||
| 295 | + date=map.get("date").toString().trim(); | ||
| 296 | + } | ||
| 297 | + String date2=""; | ||
| 298 | + if(map.get("date2")!=null){ | ||
| 299 | + date2=map.get("date2").toString().trim(); | ||
| 300 | + } | ||
| 301 | + String xlName=""; | ||
| 302 | + if(map.get("xlName")!=null){ | ||
| 303 | + xlName=map.get("xlName").toString().trim(); | ||
| 304 | + } | ||
| 305 | + String zt=""; | ||
| 306 | + if(map.get("zt")!=null){ | ||
| 307 | + zt=map.get("zt").toString(); | ||
| 308 | + } | ||
| 309 | + String by=""; | ||
| 310 | + if(map.get("by")!=null){ | ||
| 311 | + by=map.get("by").toString(); | ||
| 312 | + } | ||
| 313 | + String type=""; | ||
| 314 | + if(map.get("type")!=null){ | ||
| 315 | + type=map.get("type").toString().trim(); | ||
| 316 | + } | ||
| 317 | + return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type); | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | +} |
src/main/java/com/bsth/controller/directive/DirectiveController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/directive/DirectiveController.java | ||
| 1 | +package com.bsth.controller.directive; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.entity.directive.D80; | ||
| 6 | +import com.bsth.entity.directive.DC0_A3; | ||
| 7 | +import com.bsth.entity.sys.SysUser; | ||
| 8 | +import com.bsth.security.util.SecurityUtils; | ||
| 9 | +import com.bsth.service.directive.DirectiveService; | ||
| 10 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | +import org.springframework.web.bind.annotation.RestController; | ||
| 16 | + | ||
| 17 | +import java.util.List; | ||
| 18 | +import java.util.Map; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * | ||
| 22 | + * @ClassName: DirectiveController | ||
| 23 | + * @Description: TODO(页面下发调度指令) .0 | ||
| 24 | + * @author PanZhao | ||
| 25 | + * @date 2016年6月8日 上午9:34:51 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("/directive") | ||
| 30 | +public class DirectiveController { | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + DirectiveService directiveService; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * | ||
| 37 | + * @Title: send60 | ||
| 38 | + * @Description: TODO(60协议短语下发) | ||
| 39 | + * @throws | ||
| 40 | + */ | ||
| 41 | + @RequestMapping(value = "/phrase", method = RequestMethod.POST) | ||
| 42 | + public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){ | ||
| 43 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 44 | + return directiveService.send60Phrase(nbbm, text, user.getUserName()); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * | ||
| 49 | + * @Title: send60Dispatch | ||
| 50 | + * @Description: TODO(班次信息下发) | ||
| 51 | + * @param @param id | ||
| 52 | + * @throws | ||
| 53 | + */ | ||
| 54 | + @RequestMapping(value = "/dispatch", method = RequestMethod.POST) | ||
| 55 | + public int send60Dispatch(@RequestParam Long id){ | ||
| 56 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 57 | + return directiveService.send60Dispatch(id, user.getUserName()); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * | ||
| 62 | + * @Title: lineChange | ||
| 63 | + * @Description: TODO(切换线路) | ||
| 64 | + * @param @param nbbm 车辆内部编码 | ||
| 65 | + * @param @param lineId 新线路编码 | ||
| 66 | + * @throws | ||
| 67 | + */ | ||
| 68 | + @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) | ||
| 69 | + public int lineChange(@RequestParam String nbbm, @RequestParam String lineId){ | ||
| 70 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 71 | + return directiveService.lineChange(nbbm, lineId, user.getUserName()); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * | ||
| 76 | + * @Title: lineChangeByDevice | ||
| 77 | + * @Description: TODO(切换线路) | ||
| 78 | + * @param @param deviceId 设备编码 | ||
| 79 | + * @param @param lineId 新线路编码 | ||
| 80 | + * @throws | ||
| 81 | + */ | ||
| 82 | + @RequestMapping(value = "/lineChangeByDevice", method = RequestMethod.POST) | ||
| 83 | + public int lineChangeByDevice(@RequestParam String deviceId, @RequestParam String lineId){ | ||
| 84 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 85 | + return directiveService.lineChangeByDeviceId(deviceId, lineId, user.getUserName()); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 刷新线路文件 | ||
| 90 | + * @param deviceId 设备号 | ||
| 91 | + * @return | ||
| 92 | + */ | ||
| 93 | + @RequestMapping(value = "/refreshLineFile", method = RequestMethod.POST) | ||
| 94 | + public int refreshLineFile(@RequestParam String deviceId){ | ||
| 95 | + return directiveService.refreshLineFile(deviceId); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * | ||
| 100 | + * @Title: upDownChange | ||
| 101 | + * @Description: TODO(上下行切换) | ||
| 102 | + * @param @param nbbm 车辆内部编码 | ||
| 103 | + * @param @param upDon | ||
| 104 | + * @throws | ||
| 105 | + */ | ||
| 106 | + @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | ||
| 107 | + public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ | ||
| 108 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 109 | + return directiveService.send60Operation(nbbm, 0, upDown, user.getUserName()); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * | ||
| 114 | + * @Title: upDownChange | ||
| 115 | + * @Description: TODO(状态切换,营运状态 和 上下行) | ||
| 116 | + * @param @param nbbm 车辆内部编码 | ||
| 117 | + * @param @param upDon | ||
| 118 | + * @throws | ||
| 119 | + */ | ||
| 120 | + @RequestMapping(value = "/stateChange", method = RequestMethod.POST) | ||
| 121 | + public int stateChange(@RequestParam String nbbm, @RequestParam Integer upDown, @RequestParam Integer state){ | ||
| 122 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 123 | + return directiveService.send60Operation(nbbm, state, upDown, user.getUserName()); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * | ||
| 128 | + * @Title: findNoCofm80 | ||
| 129 | + * @Description: TODO(根据线路获取未确认的80驾驶员上报数据) | ||
| 130 | + * @throws | ||
| 131 | + */ | ||
| 132 | + @RequestMapping(value = "/findNoCofm80", method = RequestMethod.GET) | ||
| 133 | + public Map<String, List<D80>> findNoCofm80(@RequestParam String lineCodes){ | ||
| 134 | + return directiveService.findNoCofm80(lineCodes); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + @RequestMapping(value = "/findAll80", method = RequestMethod.GET) | ||
| 138 | + public Map<String, Object> findAll80(@RequestParam Map<String, Object> map, | ||
| 139 | + @RequestParam(defaultValue = "0") int page, | ||
| 140 | + @RequestParam(defaultValue = "12") int size){ | ||
| 141 | + | ||
| 142 | + return directiveService.findAll80(map, page,size); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * | ||
| 147 | + * @Title: reply80 | ||
| 148 | + * @Description: TODO(回复80) | ||
| 149 | + * @param @param reply 0:同意 -1:不同意 | ||
| 150 | + * @throws | ||
| 151 | + */ | ||
| 152 | + @RequestMapping(value = "/reply80", method = RequestMethod.POST) | ||
| 153 | + public Map<String, Object> reply80(@RequestParam int id, @RequestParam int reply){ | ||
| 154 | + return directiveService.reply80(id, reply); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * | ||
| 159 | + * @Title: findDirective | ||
| 160 | + * @Description: TODO(查询调度指令) | ||
| 161 | + * @param @param nbbm 车辆 | ||
| 162 | + * @param @param dType 类型 | ||
| 163 | + * @param @param page 页号 | ||
| 164 | + * @param @param size 每页数量 | ||
| 165 | + * @throws | ||
| 166 | + */ | ||
| 167 | + @RequestMapping(value = "/list", method = RequestMethod.GET) | ||
| 168 | + public Map<String, Object> findDirective(String nbbms,@RequestParam int dType | ||
| 169 | + , @RequestParam(defaultValue = "0") int page, | ||
| 170 | + @RequestParam(defaultValue = "10") int size){ | ||
| 171 | + | ||
| 172 | + return directiveService.findDirective(nbbms, dType, page, size); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + @RequestMapping(value = "/c0a4", method = RequestMethod.POST) | ||
| 176 | + public Map<String, Object> c0a4(@RequestParam String nbbm){ | ||
| 177 | + return directiveService.sendC0A4(nbbm); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | ||
| 181 | + public int c0a3(String json){ | ||
| 182 | + json = StringEscapeUtils.unescapeHtml4(json); | ||
| 183 | + DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | ||
| 184 | + return directiveService.sendC0A3(c0a3); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + @RequestMapping(value = "/c0a5", method = RequestMethod.POST) | ||
| 188 | + public int c0a5(String json){ | ||
| 189 | + json = StringEscapeUtils.unescapeHtml4(json); | ||
| 190 | + return directiveService.sendC0A5(json); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 设备参数查询 | ||
| 195 | + * @return | ||
| 196 | + */ | ||
| 197 | + @RequestMapping(value = "/deviceCofigList", method = RequestMethod.GET) | ||
| 198 | + public Map<String, Object> deviceCofigList( | ||
| 199 | + @RequestParam Map<String, String> map, | ||
| 200 | + @RequestParam(defaultValue = "0") int page, | ||
| 201 | + @RequestParam(defaultValue = "10") int size){ | ||
| 202 | + return directiveService.deviceCofigList(map, page, size); | ||
| 203 | + } | ||
| 204 | +} |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/directive/UpstreamEntrance.java | ||
| 1 | +package com.bsth.controller.directive; | ||
| 2 | + | ||
| 3 | +import org.apache.commons.lang3.StringUtils; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 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.alibaba.fastjson.JSON; | ||
| 13 | +import com.alibaba.fastjson.JSONObject; | ||
| 14 | +import com.bsth.data.directive.DayOfDirectives; | ||
| 15 | +import com.bsth.data.pilot80.PilotReport; | ||
| 16 | +import com.bsth.entity.directive.D80; | ||
| 17 | +import com.bsth.entity.directive.DC0_A4; | ||
| 18 | +import com.bsth.entity.directive.DirectiveReponse; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * | ||
| 22 | + * @ClassName: UpstreamEntrance | ||
| 23 | + * @Description: TODO(车载网关HTTP上行入口) | ||
| 24 | + * @author PanZhao | ||
| 25 | + * @date 2016年6月7日 下午3:00:01 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("/control") | ||
| 30 | +public class UpstreamEntrance { | ||
| 31 | + | ||
| 32 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + DayOfDirectives dayOfDirectives; | ||
| 36 | + | ||
| 37 | + @Autowired | ||
| 38 | + PilotReport pilotReport; | ||
| 39 | + | ||
| 40 | + @RequestMapping(value = "/upstream", method = RequestMethod.POST) | ||
| 41 | + public String main(@RequestParam String json) { | ||
| 42 | + logger.info("upstream: " + json); | ||
| 43 | + try { | ||
| 44 | + JSONObject jsonParam = JSONObject.parseObject(json); | ||
| 45 | + | ||
| 46 | + // 60协议回复 | ||
| 47 | + if (jsonParam.getInteger("operCode") == null && jsonParam.getInteger("status") != null) { | ||
| 48 | + try { | ||
| 49 | + DirectiveReponse reply = JSON.toJavaObject(jsonParam, DirectiveReponse.class); | ||
| 50 | + dayOfDirectives.reply(reply); | ||
| 51 | + } catch (NumberFormatException e) { | ||
| 52 | + logger.error("NumberFormatException ,,,,一般是老数据,msgId太大"); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + // 80协议上报 | ||
| 56 | + else if (jsonParam.getInteger("operCode") == 0X80) { | ||
| 57 | + try { | ||
| 58 | + JSONObject data = jsonParam.getJSONObject("data"); | ||
| 59 | + switch (data.getShort("operCode2")) { | ||
| 60 | + case 0x26: | ||
| 61 | + // 驾驶员上报 | ||
| 62 | + D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | ||
| 63 | + if(d80!=null && StringUtils.isNotEmpty(d80.getDeviceId())) | ||
| 64 | + pilotReport.report(d80); | ||
| 65 | + break; | ||
| 66 | + | ||
| 67 | + case 0xA4: | ||
| 68 | + data.put("port", data.getString("port").trim()); | ||
| 69 | + data.put("posPort", data.getString("posPort").trim()); | ||
| 70 | + data.put("posIpAddress", data.getString("posIpAddress").trim()); | ||
| 71 | + data.put("ipAddress", data.getString("ipAddress").trim()); | ||
| 72 | + | ||
| 73 | + DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); | ||
| 74 | + pilotReport.report(c0a4); | ||
| 75 | + break; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + } catch (Exception e) { | ||
| 79 | + logger.error("", e); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + // 64协议 线路切换回复 | ||
| 83 | + else if (jsonParam.getInteger("operCode") == 0X64) { | ||
| 84 | + dayOfDirectives.reply64(jsonParam); | ||
| 85 | + } else | ||
| 86 | + logger.warn("未知的上行数据,p: " + json); | ||
| 87 | + | ||
| 88 | + } catch (Exception e) { | ||
| 89 | + logger.error("", e); | ||
| 90 | + } | ||
| 91 | + return "{\"errCode\":0}"; | ||
| 92 | + } | ||
| 93 | +} |
src/main/java/com/bsth/controller/excep/AbnormalController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/AbnormalController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import com.bsth.controller.BaseController; | ||
| 14 | +import com.bsth.entity.excep.Abnormal; | ||
| 15 | +import com.bsth.entity.sys.SysUser; | ||
| 16 | +import com.bsth.service.excep.AbnormalService; | ||
| 17 | +import com.bsth.util.PageObject; | ||
| 18 | + | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("abnormal") | ||
| 21 | +public class AbnormalController extends BaseController<SysUser, Integer>{ | ||
| 22 | + @Autowired | ||
| 23 | + private AbnormalService abnormalService; | ||
| 24 | + | ||
| 25 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 26 | + public PageObject<Abnormal> pagequery(@RequestParam Map<String, Object> map){ | ||
| 27 | + PageObject<Abnormal> pageObject = null; | ||
| 28 | + map.put("curPage", map.get("page").toString()); | ||
| 29 | + map.put("pageData","10"); | ||
| 30 | + pageObject=abnormalService.Pagequery(map); | ||
| 31 | + return pageObject; | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 38 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 39 | + try { | ||
| 40 | + map.put("isShow", 1); | ||
| 41 | +// modelMap = offlineService.getReport(map); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + e.printStackTrace(); | ||
| 44 | + } | ||
| 45 | + return modelMap; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +} |
src/main/java/com/bsth/controller/excep/NowAbnormalController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/NowAbnormalController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Abnormal; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.NowAbnormalService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("nowabnormal") | ||
| 20 | +public class NowAbnormalController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private NowAbnormalService nowAbnormalService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Abnormal> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Abnormal> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=nowAbnormalService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | +// modelMap = offlineService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/NowOfflineController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/NowOfflineController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Offline; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.NowOfflineService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("nowoffline") | ||
| 20 | +public class NowOfflineController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private NowOfflineService nowOfflineService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Offline> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Offline> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=nowOfflineService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | + modelMap = nowOfflineService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/NowOutboundController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/NowOutboundController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import com.bsth.controller.BaseController; | ||
| 15 | +import com.bsth.data.BasicData; | ||
| 16 | +import com.bsth.entity.excep.Outbound; | ||
| 17 | +import com.bsth.entity.excep.Speeding; | ||
| 18 | +import com.bsth.entity.sys.SysUser; | ||
| 19 | +import com.bsth.service.excep.NowOutboundService; | ||
| 20 | +import com.bsth.util.PageObject; | ||
| 21 | + | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping("nowbound") | ||
| 24 | +public class NowOutboundController extends BaseController<SysUser, Integer>{ | ||
| 25 | + @Autowired | ||
| 26 | + private NowOutboundService nowOutboundService; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 29 | + public PageObject<Outbound> pagequery(@RequestParam Map<String, Object> map){ | ||
| 30 | + PageObject<Outbound> pageObject = null; | ||
| 31 | + map.put("curPage", map.get("page").toString()); | ||
| 32 | + map.put("pageData","10"); | ||
| 33 | + pageObject=nowOutboundService.Pagequery(map); | ||
| 34 | + return pageObject; | ||
| 35 | + | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 40 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 41 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 42 | + try { | ||
| 43 | + map.put("isShow", 1); | ||
| 44 | + modelMap = nowOutboundService.getReport(map); | ||
| 45 | + } catch (Exception e) { | ||
| 46 | + e.printStackTrace(); | ||
| 47 | + } | ||
| 48 | + return modelMap; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 52 | + public List<Outbound> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 53 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 54 | + List<Outbound> listOutbound = nowOutboundService.findPosition(deviceid,startdate,enddate); | ||
| 55 | + return listOutbound; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | +} |
src/main/java/com/bsth/controller/excep/NowSpeedingController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/NowSpeedingController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import com.bsth.controller.BaseController; | ||
| 15 | +import com.bsth.data.BasicData; | ||
| 16 | +import com.bsth.entity.excep.Speeding; | ||
| 17 | +import com.bsth.entity.sys.SysUser; | ||
| 18 | +import com.bsth.service.excep.NowSpeedingService; | ||
| 19 | +import com.bsth.util.PageObject; | ||
| 20 | + | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("nowspeeding") | ||
| 23 | +public class NowSpeedingController extends BaseController<SysUser, Integer>{ | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + private NowSpeedingService nowSpeedingService; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 29 | + public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){ | ||
| 30 | + PageObject<Speeding> pageObject = null; | ||
| 31 | + map.put("curPage", map.get("page").toString()); | ||
| 32 | + map.put("pageData","10"); | ||
| 33 | + pageObject=nowSpeedingService.Pagequery(map); | ||
| 34 | + return pageObject; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 38 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 39 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 40 | + try { | ||
| 41 | + map.put("isShow", 1); | ||
| 42 | + modelMap = nowSpeedingService.getReport(map); | ||
| 43 | + } catch (Exception e) { | ||
| 44 | + e.printStackTrace(); | ||
| 45 | + } | ||
| 46 | + return modelMap; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 50 | + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 51 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 52 | + List<Speeding> listSpeeding = nowSpeedingService.findPosition(deviceid,startdate,enddate); | ||
| 53 | + return listSpeeding; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | +} |
src/main/java/com/bsth/controller/excep/OfflineController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/OfflineController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import com.bsth.controller.BaseController; | ||
| 14 | +import com.bsth.entity.excep.Offline; | ||
| 15 | +import com.bsth.entity.sys.SysUser; | ||
| 16 | +import com.bsth.service.excep.OfflineService; | ||
| 17 | +import com.bsth.util.PageObject; | ||
| 18 | + | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("offline") | ||
| 21 | +public class OfflineController extends BaseController<SysUser, Integer>{ | ||
| 22 | + @Autowired | ||
| 23 | + private OfflineService offlineService; | ||
| 24 | + | ||
| 25 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 26 | + public PageObject<Offline> pagequery(@RequestParam Map<String, Object> map){ | ||
| 27 | + PageObject<Offline> pageObject = null; | ||
| 28 | + map.put("curPage", map.get("page").toString()); | ||
| 29 | + map.put("pageData","10"); | ||
| 30 | + pageObject=offlineService.Pagequery(map); | ||
| 31 | + return pageObject; | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 38 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 39 | + try { | ||
| 40 | + map.put("isShow", 1); | ||
| 41 | + modelMap = offlineService.getReport(map); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + e.printStackTrace(); | ||
| 44 | + } | ||
| 45 | + return modelMap; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +} |
src/main/java/com/bsth/controller/excep/OutboundController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/OutboundController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Outbound; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.OutboundService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("bound") | ||
| 20 | +public class OutboundController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private OutboundService outboundService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Outbound> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Outbound> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=outboundService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | + modelMap = outboundService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/SpeedingController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/excep/SpeedingController.java | ||
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import com.bsth.controller.BaseController; | ||
| 15 | +import com.bsth.data.BasicData; | ||
| 16 | +import com.bsth.entity.excep.Speeding; | ||
| 17 | +import com.bsth.entity.sys.SysUser; | ||
| 18 | +import com.bsth.service.excep.SpeedingService; | ||
| 19 | +import com.bsth.util.PageObject; | ||
| 20 | + | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("speeding") | ||
| 23 | +public class SpeedingController extends BaseController<SysUser, Integer>{ | ||
| 24 | + @Autowired | ||
| 25 | + private SpeedingService speedingService; | ||
| 26 | + | ||
| 27 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 28 | + public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){ | ||
| 29 | + PageObject<Speeding> pageObject = null; | ||
| 30 | + map.put("curPage", map.get("page").toString()); | ||
| 31 | + map.put("pageData","10"); | ||
| 32 | + pageObject=speedingService.Pagequery(map); | ||
| 33 | + return pageObject; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 38 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 39 | + try { | ||
| 40 | + map.put("isShow", 1); | ||
| 41 | + modelMap = speedingService.getReport(map); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + e.printStackTrace(); | ||
| 44 | + } | ||
| 45 | + return modelMap; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 49 | + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 50 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 51 | + List<Speeding> listSpeeding = speedingService.findPosition(deviceid,startdate,enddate); | ||
| 52 | + return listSpeeding; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | +} |
src/main/java/com/bsth/controller/forecast/SampleController.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/forecast/SampleController.java | ||
| 1 | +package com.bsth.controller.forecast; | ||
| 2 | + | ||
| 3 | +import java.io.UnsupportedEncodingException; | ||
| 4 | +import java.net.URLDecoder; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +import com.alibaba.fastjson.JSON; | ||
| 16 | +import com.alibaba.fastjson.JSONObject; | ||
| 17 | +import com.bsth.common.ResponseCode; | ||
| 18 | +import com.bsth.controller.BaseController; | ||
| 19 | +import com.bsth.controller.forecast.dto.CreateSampleParam; | ||
| 20 | +import com.bsth.entity.forecast.Sample; | ||
| 21 | +import com.bsth.service.forecast.SampleService; | ||
| 22 | + | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("sample") | ||
| 25 | +public class SampleController extends BaseController<Sample, Long>{ | ||
| 26 | + | ||
| 27 | + @Autowired | ||
| 28 | + SampleService sampleService; | ||
| 29 | + | ||
| 30 | + Logger loger = LoggerFactory.getLogger(this.getClass()); | ||
| 31 | + | ||
| 32 | + @RequestMapping("/create/gps") | ||
| 33 | + public Map<String, Object> createDataByGps(@RequestParam String data){ | ||
| 34 | + Map<String, Object> rs = new HashMap<>(); | ||
| 35 | + try { | ||
| 36 | + data = URLDecoder.decode(data, "utf-8"); | ||
| 37 | + CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class); | ||
| 38 | + | ||
| 39 | + rs = sampleService.createDataByGps(param); | ||
| 40 | + } catch (UnsupportedEncodingException e) { | ||
| 41 | + loger.info("", e); | ||
| 42 | + rs.put("status", ResponseCode.ERROR); | ||
| 43 | + } | ||
| 44 | + return rs; | ||
| 45 | + } | ||
| 46 | +} |
src/main/java/com/bsth/controller/forecast/dto/CreateSampleParam.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/controller/forecast/dto/CreateSampleParam.java | ||
| 1 | +package com.bsth.controller.forecast.dto; | ||
| 2 | + | ||
| 3 | +import java.util.Set; | ||
| 4 | + | ||
| 5 | +public class CreateSampleParam { | ||
| 6 | + | ||
| 7 | + private String lineCode; | ||
| 8 | + | ||
| 9 | + private String startDate; | ||
| 10 | + | ||
| 11 | + private String endDate; | ||
| 12 | + | ||
| 13 | + private Integer updown; | ||
| 14 | + | ||
| 15 | + private Set<TimeRange> timeRange; | ||
| 16 | + | ||
| 17 | + public static class TimeRange{ | ||
| 18 | + private String s; | ||
| 19 | + private String e; | ||
| 20 | + private String tag; | ||
| 21 | + public String getS() { | ||
| 22 | + return s; | ||
| 23 | + } | ||
| 24 | + public void setS(String s) { | ||
| 25 | + this.s = s; | ||
| 26 | + } | ||
| 27 | + public String getE() { | ||
| 28 | + return e; | ||
| 29 | + } | ||
| 30 | + public void setE(String e) { | ||
| 31 | + this.e = e; | ||
| 32 | + } | ||
| 33 | + public String getTag() { | ||
| 34 | + return tag; | ||
| 35 | + } | ||
| 36 | + public void setTag(String tag) { | ||
| 37 | + this.tag = tag; | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public String getLineCode() { | ||
| 42 | + return lineCode; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public void setLineCode(String lineCode) { | ||
| 46 | + this.lineCode = lineCode; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public String getStartDate() { | ||
| 50 | + return startDate; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setStartDate(String startDate) { | ||
| 54 | + this.startDate = startDate; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public String getEndDate() { | ||
| 58 | + return endDate; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public void setEndDate(String endDate) { | ||
| 62 | + this.endDate = endDate; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public Integer getUpdown() { | ||
| 66 | + return updown; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setUpdown(Integer updown) { | ||
| 70 | + this.updown = updown; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public Set<TimeRange> getTimeRange() { | ||
| 74 | + return timeRange; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setTimeRange(Set<TimeRange> timeRange) { | ||
| 78 | + this.timeRange = timeRange; | ||
| 79 | + } | ||
| 80 | +} |