Commit b27fab8ec7e0096ff0e2bf0491fa56e7a16136a7
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into
minhang # Conflicts: # src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
Showing
75 changed files
with
2993 additions
and
400 deletions
Too many changes to show.
To preserve performance only 75 of 272 files are displayed.
README.md
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | * [掉线](#掉线) |
| 18 | 18 | * [调度消息下发接口HTTP](#调度消息下发接口) |
| 19 | 19 | * [调度消息上传接口HTTP](#调度消息上传接口) |
| 20 | + * [车辆历史GPS数据](#车辆历史GPS) | |
| 20 | 21 | |
| 21 | 22 | ---------- |
| 22 | 23 | |
| ... | ... | @@ -299,6 +300,91 @@ |
| 299 | 300 | | data.operCode | short | 二级协议 | |
| 300 | 301 | | data.requestAck | short | 请求应答字 0x06同意 0x15不同意| |
| 301 | 302 | |
| 303 | +```json | |
| 304 | +{ | |
| 305 | + "deviceId":12345, | |
| 306 | + "timestamp":44324, | |
| 307 | + "operCode":0xC0, | |
| 308 | + "data":{ | |
| 309 | + "operCode":0xa3, | |
| 310 | + "deviceId":12345, | |
| 311 | + "ipAddress":222.66.0.204, | |
| 312 | + "port":8899, | |
| 313 | + "reportMode":0, | |
| 314 | + "interval":0, | |
| 315 | + "distance":0, | |
| 316 | + "speedingThreshold":0, | |
| 317 | + "alarmThreshold":0, | |
| 318 | + "posIpAddress":0, | |
| 319 | + "posPort":0, | |
| 320 | + "delay":0, | |
| 321 | + "speedThreshold1":0, | |
| 322 | + "speedThreshold2":0, | |
| 323 | + "contrast":0, | |
| 324 | + "brightness":0, | |
| 325 | + "saturation":0 | |
| 326 | + } | |
| 327 | +} | |
| 328 | +``` | |
| 329 | +| .. | .. | .. | | |
| 330 | +| ---- | ---- | ---- | | |
| 331 | +| deviceId | string | 设备编号 | | |
| 332 | +| timestamp | long | 时间戳(ms) | | |
| 333 | +| operCode | short | 一级协议 | | |
| 334 | +| data.operCode | short | 二级协议 | | |
| 335 | +| data.deviceId | string | 设备编号| | |
| 336 | +| data.ipAddress | string | 网关IP地址| | |
| 337 | +| data.port | string | 网关端口| | |
| 338 | +| data.reportMode | short | 定时定距上报模式| | |
| 339 | +| data.interval | int | 定时上报时间间隔| | |
| 340 | +| data.distance | string | 定距上报距离间隔| | |
| 341 | +| data.speedingThreshold | short | 非线路状态超速阀门| | |
| 342 | +| data.alarmThreshold | short | 预警阀门| | |
| 343 | +| data.posIpAddress | string | pos机IP地址| | |
| 344 | +| data.posPort | string | pos机端口| | |
| 345 | +| data.delay | int | 延迟机关时间| | |
| 346 | +| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45| | |
| 347 | +| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35| | |
| 348 | +| data.deviceId | short | 对比度| | |
| 349 | +| data.deviceId | short | 亮度| | |
| 350 | +| data.deviceId | short | 饱和度| | |
| 351 | + | |
| 352 | +```json | |
| 353 | +{ | |
| 354 | + "deviceId":12345, | |
| 355 | + "timestamp":44324, | |
| 356 | + "operCode":0xC0, | |
| 357 | + "data":{ | |
| 358 | + "operCode":0xa4 | |
| 359 | + } | |
| 360 | +} | |
| 361 | +``` | |
| 362 | +| .. | .. | .. | | |
| 363 | +| ---- | ---- | ---- | | |
| 364 | +| deviceId | string | 设备编号 | | |
| 365 | +| timestamp | long | 时间戳(ms) | | |
| 366 | +| operCode | short | 一级协议 | | |
| 367 | +| data.operCode | short | 二级协议 | | |
| 368 | + | |
| 369 | +```json | |
| 370 | +{ | |
| 371 | + "deviceId":12345, | |
| 372 | + "timestamp":44324, | |
| 373 | + "operCode":0xC0, | |
| 374 | + "data":{ | |
| 375 | + "operCode":0xa5 | |
| 376 | + "programVersion":2 | |
| 377 | + } | |
| 378 | +} | |
| 379 | +``` | |
| 380 | +| .. | .. | .. | | |
| 381 | +| ---- | ---- | ---- | | |
| 382 | +| deviceId | string | 设备编号 | | |
| 383 | +| timestamp | long | 时间戳(ms) | | |
| 384 | +| operCode | short | 一级协议 | | |
| 385 | +| data.operCode | short | 二级协议 | | |
| 386 | +| data.programVersion | short | 程序版本 | | |
| 387 | + | |
| 302 | 388 | <span style="color: red">Response</span>: |
| 303 | 389 | ```json |
| 304 | 390 | { |
| ... | ... | @@ -306,7 +392,6 @@ |
| 306 | 392 | } |
| 307 | 393 | ``` |
| 308 | 394 | |
| 309 | - | |
| 310 | 395 | ### 调度消息上传接口 |
| 311 | 396 | ---------- |
| 312 | 397 | 上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream) |
| ... | ... | @@ -337,3 +422,34 @@ |
| 337 | 422 | "errCode":0 |
| 338 | 423 | } |
| 339 | 424 | ``` |
| 425 | + | |
| 426 | +### 车辆历史GPS | |
| 427 | +---------- | |
| 428 | +表名:BSTH_C_GPS_INFO | |
| 429 | + | |
| 430 | +| .. | .. | .. | | |
| 431 | +| ---- | ---- | ---- | | |
| 432 | +| cityCode | int | 城市代码 | | |
| 433 | +| industryCode | int | 行业代码 | | |
| 434 | +| companyCode | int | 企业代码 | | |
| 435 | +| lineId | int | 线路编号 | | |
| 436 | +| deviceId | string | 设备编号 | | |
| 437 | +| driverNo | int | 驾驶员工号 | | |
| 438 | +| carparkSerialNo | int | 停车场序列号 | | |
| 439 | +| carparkNo | string | 停车场编号 | | |
| 440 | +| stopSerialNo | int | 站点序列号 | | |
| 441 | +| stopNo | string | 停车场编号 | | |
| 442 | +| lon | float | 经度 | | |
| 443 | +| lat | float | 维度 | | |
| 444 | +| ts | long | 时间戳 | | |
| 445 | +| speedSensor | float | 发动机速度 | | |
| 446 | +| speedGps | float | gps速度 | | |
| 447 | +| direction | float | 角度0-359 | | |
| 448 | +| inTemp | int | 车内温度 | | |
| 449 | +| serviceState | long | 设备状态字 | | |
| 450 | +<<<<<<< HEAD | |
| 451 | +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | | |
| 452 | +======= | |
| 453 | +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | | |
| 454 | + | |
| 455 | +>>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50 | ... | ... |
src/main/java/com/bsth/Application.java
| ... | ... | @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary; |
| 16 | 16 | @SpringBootApplication |
| 17 | 17 | public class Application extends SpringBootServletInitializer { |
| 18 | 18 | |
| 19 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(11); | |
| 19 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(12); | |
| 20 | 20 | |
| 21 | 21 | @Override |
| 22 | 22 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ... | ... |
src/main/java/com/bsth/StartCommand.java
| ... | ... | @@ -23,37 +23,6 @@ public class StartCommand implements CommandLineRunner{ |
| 23 | 23 | @Autowired |
| 24 | 24 | SecurityMetadataSourceService invocationSecurityMetadataSourceService; |
| 25 | 25 | |
| 26 | - //public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(8); | |
| 27 | - | |
| 28 | - /*@Autowired | |
| 29 | - GpsRealDataRefreshThread gpsRefreshThread; | |
| 30 | - @Autowired | |
| 31 | - GetSchedulePlanThread getSchedulePlanThread; | |
| 32 | - @Autowired | |
| 33 | - CommonRefreshThread commonRefreshThread; | |
| 34 | - @Autowired | |
| 35 | - DirectivePersistenceThread directivePersistenceThread; | |
| 36 | - @Autowired | |
| 37 | - SchedulePersistenceThread SchedulePersistenceThread; | |
| 38 | - @Autowired | |
| 39 | - ArrivalThread gpsArrivalStationThread; | |
| 40 | - @Autowired | |
| 41 | - FirstScheduleIssuedThread firstScheduleIssuedThread; | |
| 42 | - | |
| 43 | - @Autowired | |
| 44 | - DirectiveService directiveService; | |
| 45 | - @Autowired | |
| 46 | - DirectiveBuffer directiveBuffer; | |
| 47 | - @Autowired | |
| 48 | - CarConfigInfoRepository carConfigInfoRepository; | |
| 49 | - | |
| 50 | - @Autowired | |
| 51 | - GpsOfflineMonitorThread gpsOfflineMonitorThread;*/ | |
| 52 | - | |
| 53 | - /*final static Long HOUR_TIME = 1000 * 60 * 60L; | |
| 54 | - | |
| 55 | - final static int HOUR_SECOND = 60 * 60;*/ | |
| 56 | - | |
| 57 | 26 | @Override |
| 58 | 27 | public void run(String... arg0){ |
| 59 | 28 | |
| ... | ... | @@ -61,91 +30,6 @@ public class StartCommand implements CommandLineRunner{ |
| 61 | 30 | //启动时加载所有资源 |
| 62 | 31 | invocationSecurityMetadataSourceService.loadResourceDefine(); |
| 63 | 32 | |
| 64 | - /** | |
| 65 | - * 车辆,设备,公司等常用的映射数据,每两小时刷新一次 | |
| 66 | - *//* | |
| 67 | - commonRefreshThread.start(); | |
| 68 | - scheduler.scheduleWithFixedDelay(commonRefreshThread, HOUR_SECOND * 2 , HOUR_SECOND * 2, TimeUnit.SECONDS); | |
| 69 | - //等映射数据加载完......睡一会吧 | |
| 70 | - Thread.sleep(4000); | |
| 71 | - | |
| 72 | - *//** | |
| 73 | - * GPS实时数据更新 线程 | |
| 74 | - * 每8秒和网关HTTP接口同步一次 | |
| 75 | - *//* | |
| 76 | - scheduler.scheduleWithFixedDelay(gpsRefreshThread, 0, 8, TimeUnit.SECONDS); | |
| 77 | - | |
| 78 | - *//** | |
| 79 | - * GPS 监控设备掉线行为 | |
| 80 | - * 每分钟检测一次 | |
| 81 | - *//* | |
| 82 | - scheduler.scheduleWithFixedDelay(gpsOfflineMonitorThread, 60, 60, TimeUnit.SECONDS); | |
| 83 | - | |
| 84 | - | |
| 85 | - *//** | |
| 86 | - * 每天 凌晨 2 点 抓取当天实际排班 | |
| 87 | - *//* | |
| 88 | - //启动时先run一次 | |
| 89 | - getSchedulePlanThread.start(); | |
| 90 | - scheduler.scheduleAtFixedRate(getSchedulePlanThread | |
| 91 | - , ((DateUtils.getTimesnight2() + HOUR_TIME * 2) - System.currentTimeMillis()) / 1000 | |
| 92 | - , 60 * 60 * 24, TimeUnit.SECONDS); | |
| 93 | - | |
| 94 | - *//** | |
| 95 | - * 调度指令两分钟入库一次 | |
| 96 | - * 指令会缓存在内存,直到收到所有响应再入库 | |
| 97 | - *//* | |
| 98 | - //从数据库恢复初始数据 | |
| 99 | - directiveBuffer.recovery(); | |
| 100 | - scheduler.scheduleWithFixedDelay(directivePersistenceThread, 20, 60 * 2, TimeUnit.SECONDS); | |
| 101 | - | |
| 102 | - *//** | |
| 103 | - * 每分钟将有变更的班次入库(不包括子任务) | |
| 104 | - * 单纯为了提高 线调操作 的响应速度 | |
| 105 | - *//* | |
| 106 | - scheduler.scheduleWithFixedDelay(SchedulePersistenceThread, 60 * 1, 60 * 1, TimeUnit.SECONDS); | |
| 107 | - | |
| 108 | - *//** | |
| 109 | - * 每15秒从数据库抓取到离站信息和班次匹配 | |
| 110 | - * (网关生成的到离站数据也是延迟批量入库,所以缩短该线程执行周期并不会提高 “实际到离站” 的实时性) | |
| 111 | - *//* | |
| 112 | - scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 35, 15, TimeUnit.SECONDS); | |
| 113 | - | |
| 114 | - *//** | |
| 115 | - * 首个调度指令下发(2分钟运行一次) | |
| 116 | - * 每辆车的第一个调度指令由该线程下发 | |
| 117 | - * 后续班次由 “实际终点到达” 事件触发指令下发 | |
| 118 | - *//* | |
| 119 | - scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS); | |
| 120 | - */ | |
| 121 | - | |
| 122 | -/* new Timer().schedule(new TimerTask() { | |
| 123 | - | |
| 124 | - @Override | |
| 125 | - public void run() { | |
| 126 | - List<CarConfigInfo> ccis = carConfigInfoRepository.findAll(); | |
| 127 | - Cars car; | |
| 128 | - Line line; | |
| 129 | - String lineCode; | |
| 130 | - System.out.println("ccis size: " + ccis.size()); | |
| 131 | - for(CarConfigInfo cci : ccis){ | |
| 132 | - car = cci.getCl(); | |
| 133 | - line = cci.getXl(); | |
| 134 | - lineCode = line.getLineCode(); | |
| 135 | - | |
| 136 | - String data = directiveService.createDeviceRefreshData(CommonMapped.vehicDeviceBiMap.inverse().get(car.getInsideCode()) | |
| 137 | - , Integer.parseInt(lineCode)); | |
| 138 | - System.out.println(data); | |
| 139 | - int code = HttpUtils.postJson(data); | |
| 140 | - System.out.println("车辆:" + car.getInsideCode() + "刷新线路:" + line.getLineCode()); | |
| 141 | - code = directiveService.lineChange(car.getInsideCode(), Integer.parseInt(lineCode)); | |
| 142 | - //directiveService.send60Phrase(car.getInsideCode(), ""); | |
| 143 | - System.out.println("返回值:" + code); | |
| 144 | - } | |
| 145 | - | |
| 146 | - } | |
| 147 | - }, 1000 * 10);*/ | |
| 148 | - | |
| 149 | 33 | } catch (Exception e) { |
| 150 | 34 | e.printStackTrace(); |
| 151 | 35 | } | ... | ... |
src/main/java/com/bsth/WebAppConfiguration.java
| ... | ... | @@ -2,18 +2,21 @@ package com.bsth; |
| 2 | 2 | |
| 3 | 3 | import javax.servlet.Filter; |
| 4 | 4 | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | 6 | import org.springframework.boot.context.embedded.FilterRegistrationBean; |
| 6 | 7 | import org.springframework.context.annotation.Bean; |
| 7 | 8 | import org.springframework.context.annotation.ComponentScan; |
| 8 | 9 | import org.springframework.context.annotation.Configuration; |
| 9 | 10 | import org.springframework.web.filter.CharacterEncodingFilter; |
| 10 | 11 | import org.springframework.web.filter.HttpPutFormContentFilter; |
| 12 | +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | |
| 11 | 13 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| 12 | 14 | import org.springframework.web.socket.config.annotation.EnableWebSocket; |
| 13 | 15 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; |
| 14 | 16 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; |
| 15 | 17 | |
| 16 | 18 | import com.bsth.filter.ResourceFilter; |
| 19 | +import com.bsth.oplog.http.HttpOpLogInterceptor; | |
| 17 | 20 | import com.bsth.websocket.WebSocketHandshakeInterceptor; |
| 18 | 21 | import com.bsth.websocket.handler.RealControlSocketHandler; |
| 19 | 22 | |
| ... | ... | @@ -22,12 +25,12 @@ import com.bsth.websocket.handler.RealControlSocketHandler; |
| 22 | 25 | @ComponentScan |
| 23 | 26 | public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer{ |
| 24 | 27 | |
| 28 | +// @Autowired | |
| 29 | +// HttpOpLogInterceptor httpOpLogInterceptor; | |
| 30 | + | |
| 25 | 31 | /** |
| 26 | - * | |
| 27 | 32 | * @Title: httpPutFormContentFilter |
| 28 | 33 | * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换) |
| 29 | - * @return Filter 返回类型 | |
| 30 | - * @throws | |
| 31 | 34 | */ |
| 32 | 35 | @Bean |
| 33 | 36 | public Filter httpPutFormContentFilter() { |
| ... | ... | @@ -35,11 +38,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | /** |
| 38 | - * | |
| 39 | 41 | * @Title: characterEncodingFilter |
| 40 | 42 | * @Description: TODO(编码过滤器) |
| 41 | - * @return Filter 返回类型 | |
| 42 | - * @throws | |
| 43 | 43 | */ |
| 44 | 44 | @Bean |
| 45 | 45 | public Filter characterEncodingFilter(){ |
| ... | ... | @@ -50,8 +50,6 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 50 | 50 | * |
| 51 | 51 | * @Title: resourceFilterRegistration |
| 52 | 52 | * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 ) |
| 53 | - * @return FilterRegistrationBean 返回类型 | |
| 54 | - * @throws | |
| 55 | 53 | */ |
| 56 | 54 | @Bean |
| 57 | 55 | public FilterRegistrationBean resourceFilterRegistration(){ |
| ... | ... | @@ -59,8 +57,18 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 59 | 57 | registration.setFilter(new ResourceFilter()); |
| 60 | 58 | registration.addUrlPatterns("/pages/*"); |
| 61 | 59 | return registration; |
| 62 | - } | |
| 63 | - | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * | |
| 64 | + * @Title: addInterceptors | |
| 65 | + * @Description: TODO(HTTP结构化访问日志记录 ) | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public void addInterceptors(InterceptorRegistry registry) { | |
| 69 | + registry.addInterceptor(httpOpLogInterceptor); | |
| 70 | + }*/ | |
| 71 | + | |
| 64 | 72 | @Override |
| 65 | 73 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { |
| 66 | 74 | //线调webSocket | ... | ... |
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -24,7 +24,7 @@ public class Constants { |
| 24 | 24 | /** |
| 25 | 25 | * 线调部分子页面不做拦截,便于浏览器缓存 |
| 26 | 26 | */ |
| 27 | - public static final String XD_CHILD_PAGES = "/pages/control/line/child_pages/**"; | |
| 27 | + public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | |
| 28 | 28 | public static final String XD_TEMPS = "/pages/control/line/temps/**"; |
| 29 | 29 | |
| 30 | 30 | //车载网关上行接口 | ... | ... |
src/main/java/com/bsth/controller/BaseController.java
| ... | ... | @@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile; |
| 17 | 17 | |
| 18 | 18 | import javax.servlet.http.HttpServletResponse; |
| 19 | 19 | import java.io.*; |
| 20 | +import java.util.ArrayList; | |
| 20 | 21 | import java.util.HashMap; |
| 21 | 22 | import java.util.List; |
| 22 | 23 | import java.util.Map; |
| ... | ... | @@ -54,18 +55,31 @@ public class BaseController<T, ID extends Serializable> { |
| 54 | 55 | @RequestParam(defaultValue = "id") String order, |
| 55 | 56 | @RequestParam(defaultValue = "DESC") String direction){ |
| 56 | 57 | |
| 57 | - Direction d; | |
| 58 | - | |
| 59 | - if(null != direction && direction.equals("ASC")) | |
| 60 | - d = Direction.ASC; | |
| 61 | - else | |
| 62 | - d = Direction.DESC; | |
| 63 | - | |
| 64 | 58 | // 允许多个字段排序,order可以写单个字段,也可以写多个字段 |
| 65 | 59 | // 多个字段格式:{col1},{col2},{col3},....,{coln} |
| 66 | - // 每个字段的排序方向都是一致,这个以后再看要不要改 | |
| 67 | - List<String> list = Splitter.on(",").trimResults().splitToList(order); | |
| 68 | - return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | |
| 60 | + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | |
| 61 | + // 多字段排序:DESC,ASC... | |
| 62 | + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | |
| 63 | + | |
| 64 | + if (order_dirs.size() == 1) { // 所有字段采用一种排序 | |
| 65 | + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) { | |
| 66 | + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.ASC, order_columns))); | |
| 67 | + } else { | |
| 68 | + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.DESC, order_columns))); | |
| 69 | + } | |
| 70 | + } else if (order_columns.size() == order_dirs.size()) { | |
| 71 | + List<Sort.Order> orderList = new ArrayList<>(); | |
| 72 | + for (int i = 0; i < order_columns.size(); i++) { | |
| 73 | + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | |
| 74 | + orderList.add(new Sort.Order(Direction.ASC, order_columns.get(i))); | |
| 75 | + } else { | |
| 76 | + orderList.add(new Sort.Order(Direction.DESC, order_columns.get(i))); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + return baseService.list(map, new PageRequest(page, size, new Sort(orderList))); | |
| 80 | + } else { | |
| 81 | + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | |
| 82 | + } | |
| 69 | 83 | } |
| 70 | 84 | |
| 71 | 85 | /** | ... | ... |
src/main/java/com/bsth/controller/CarDeviceController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 3 | 4 | import com.bsth.entity.CarDevice; |
| 5 | +import com.bsth.service.CarDeviceService; | |
| 6 | +import org.joda.time.DateTime; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 4 | 8 | import org.springframework.web.bind.annotation.RequestBody; |
| 5 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 6 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 7 | 11 | import org.springframework.web.bind.annotation.RestController; |
| 8 | 12 | |
| 13 | +import java.util.HashMap; | |
| 14 | +import java.util.Iterator; | |
| 9 | 15 | import java.util.Map; |
| 10 | 16 | |
| 11 | 17 | /** |
| 12 | 18 | * Created by xu on 16/6/15. |
| 13 | 19 | */ |
| 14 | 20 | @RestController |
| 15 | -@RequestMapping("carDevice") | |
| 21 | +@RequestMapping("cde") | |
| 16 | 22 | public class CarDeviceController extends BaseController<CarDevice, Long> { |
| 17 | - | |
| 23 | + @Autowired | |
| 24 | + private CarDeviceService carDeviceService; | |
| 18 | 25 | /** |
| 19 | 26 | * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody |
| 20 | 27 | * @Title: save |
| ... | ... | @@ -28,4 +35,22 @@ public class CarDeviceController extends BaseController<CarDevice, Long> { |
| 28 | 35 | public Map<String, Object> save(@RequestBody CarDevice t){ |
| 29 | 36 | return baseService.save(t); |
| 30 | 37 | } |
| 38 | + | |
| 39 | + @RequestMapping(value = "/validate/qyrq", method = RequestMethod.GET) | |
| 40 | + public Map<String, Object> validateQyrq(String qyrq, Integer xl, Integer cl) { | |
| 41 | + // 验证启用日期,必须是最大的日期,就是最晚的日期 | |
| 42 | + Map<String, Object> obj = new HashMap<>(); | |
| 43 | + obj.put("xl_eq", xl); | |
| 44 | + obj.put("cl_eq", cl); | |
| 45 | + obj.put("qyrq_ge", new DateTime(qyrq).toDate()); | |
| 46 | + Iterator<CarDevice> iterator = carDeviceService.list(obj).iterator(); | |
| 47 | + if (iterator.hasNext()) { | |
| 48 | + obj.clear(); | |
| 49 | + obj.put("status", ResponseCode.ERROR); | |
| 50 | + } else { | |
| 51 | + obj.clear(); | |
| 52 | + obj.put("status", ResponseCode.SUCCESS); | |
| 53 | + } | |
| 54 | + return obj; | |
| 55 | + } | |
| 31 | 56 | } | ... | ... |
src/main/java/com/bsth/controller/SectionSpeedController.java
0 → 100644
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.bsth.entity.SectionSpeed; | |
| 7 | +import com.bsth.service.SectionSpeedService; | |
| 8 | + | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.web.bind.annotation.*; | |
| 11 | + | |
| 12 | + | |
| 13 | +@RestController | |
| 14 | +@RequestMapping("sectionspeed") | |
| 15 | +public class SectionSpeedController extends BaseController<SectionSpeed, Integer> { | |
| 16 | + | |
| 17 | + @Autowired | |
| 18 | + private SectionSpeedService sectionSpeedService; | |
| 19 | + | |
| 20 | + /**@description TODO(新增路段限速) */ | |
| 21 | + @RequestMapping(value="add" , method = RequestMethod.POST) | |
| 22 | + public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { | |
| 23 | + return sectionSpeedService.add(map); | |
| 24 | + } | |
| 25 | + | |
| 26 | + /**@description TODO(修改路段) */ | |
| 27 | + @RequestMapping(value="roadUpd" , method = RequestMethod.POST) | |
| 28 | + public Map<String, Object> roadUpd(@RequestParam Map<String, Object> map) { | |
| 29 | + return sectionSpeedService.roadUpd(map); | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** @description TODO(根据线路ID与编码及方向查询路段限速信息) */ | |
| 33 | + @RequestMapping(value="getSectionSpeedInfoList",method=RequestMethod.GET) | |
| 34 | + public List<Map<String, Object>> getSectionSpeedInfoList(@RequestParam Map<String, Object> map){ | |
| 35 | + return sectionSpeedService.getSectionSpeedInfo(map); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * @Description :TODO(查询路段信息) | |
| 40 | + * | |
| 41 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | |
| 42 | + * | |
| 43 | + * @return Map<String, Object> | |
| 44 | + */ | |
| 45 | + @RequestMapping(value = "/analyticSection" , method = RequestMethod.GET) | |
| 46 | + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { | |
| 47 | + return sectionSpeedService.analyticSection(map); | |
| 48 | + } | |
| 49 | + | |
| 50 | +} | ... | ... |
src/main/java/com/bsth/controller/directive/DirectiveController.java
| ... | ... | @@ -3,13 +3,17 @@ package com.bsth.controller.directive; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 10 | 11 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 12 | |
| 13 | +import com.alibaba.fastjson.JSON; | |
| 14 | +import com.alibaba.fastjson.JSONObject; | |
| 12 | 15 | import com.bsth.entity.directive.D80; |
| 16 | +import com.bsth.entity.directive.DC0_A3; | |
| 13 | 17 | import com.bsth.entity.sys.SysUser; |
| 14 | 18 | import com.bsth.security.util.SecurityUtils; |
| 15 | 19 | import com.bsth.service.directive.DirectiveService; |
| ... | ... | @@ -130,4 +134,28 @@ public class DirectiveController { |
| 130 | 134 | |
| 131 | 135 | return directiveService.findDirective(nbbm, dType, page, size); |
| 132 | 136 | } |
| 137 | + | |
| 138 | + @RequestMapping(value = "/c0a4", method = RequestMethod.POST) | |
| 139 | + public int c0a4(@RequestParam String nbbm){ | |
| 140 | + return directiveService.sendC0A4(nbbm); | |
| 141 | + } | |
| 142 | + | |
| 143 | +// @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | |
| 144 | +// public int c0a3(@RequestParam DC0_A4 c0a4){ | |
| 145 | +// return directiveService.sendC0A3(c0a4); | |
| 146 | +// } | |
| 147 | + | |
| 148 | + @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | |
| 149 | + public int c0a3(String json){ | |
| 150 | + json = StringEscapeUtils.unescapeHtml4(json); | |
| 151 | + DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | |
| 152 | + return directiveService.sendC0A3(c0a3); | |
| 153 | + } | |
| 154 | + | |
| 155 | + @RequestMapping(value = "/c0a5", method = RequestMethod.POST) | |
| 156 | + public int c0a5(String json){ | |
| 157 | + json = StringEscapeUtils.unescapeHtml4(json); | |
| 158 | + //DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | |
| 159 | + return directiveService.sendC0A5(json); | |
| 160 | + } | |
| 133 | 161 | } | ... | ... |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| ... | ... | @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject; |
| 13 | 13 | import com.bsth.data.directive.DayOfDirectives; |
| 14 | 14 | import com.bsth.data.pilot80.PilotReport; |
| 15 | 15 | import com.bsth.entity.directive.D80; |
| 16 | +import com.bsth.entity.directive.DC0_A4; | |
| 16 | 17 | import com.bsth.entity.directive.DirectiveReponse; |
| 17 | 18 | |
| 18 | 19 | /** |
| ... | ... | @@ -53,10 +54,25 @@ public class UpstreamEntrance { |
| 53 | 54 | // 80协议上报 |
| 54 | 55 | else if (jsonParam.getInteger("operCode") == 0X80) { |
| 55 | 56 | try { |
| 56 | - D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | |
| 57 | - // 驾驶员上报 | |
| 58 | - if (d80.getData().getOperCode2() == 0x26) | |
| 57 | + JSONObject data = jsonParam.getJSONObject("data"); | |
| 58 | + switch (data.getShort("operCode2")) { | |
| 59 | + case 0x26: | |
| 60 | + // 驾驶员上报 | |
| 61 | + D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | |
| 59 | 62 | pilotReport.report(d80); |
| 63 | + break; | |
| 64 | + | |
| 65 | + case 0xA4: | |
| 66 | + data.put("port", data.getString("port").trim()); | |
| 67 | + data.put("posPort", data.getString("posPort").trim()); | |
| 68 | + data.put("posIpAddress", data.getString("posIpAddress").trim()); | |
| 69 | + data.put("ipAddress", data.getString("ipAddress").trim()); | |
| 70 | + | |
| 71 | + DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); | |
| 72 | + System.out.println(c0a4); | |
| 73 | + break; | |
| 74 | + } | |
| 75 | + | |
| 60 | 76 | } catch (Exception e) { |
| 61 | 77 | logger.error("", e); |
| 62 | 78 | } | ... | ... |
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -2,7 +2,9 @@ package com.bsth.controller.oil; |
| 2 | 2 | |
| 3 | 3 | import java.text.ParseException; |
| 4 | 4 | import java.text.SimpleDateFormat; |
| 5 | +import java.util.ArrayList; | |
| 5 | 6 | import java.util.Date; |
| 7 | +import java.util.Iterator; | |
| 6 | 8 | import java.util.List; |
| 7 | 9 | import java.util.Map; |
| 8 | 10 | |
| ... | ... | @@ -44,14 +46,47 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 44 | 46 | * @return |
| 45 | 47 | */ |
| 46 | 48 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 47 | - public List<Map<String, Object>> obtain(@RequestParam Map<String, Object> map){ | |
| 49 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ | |
| 48 | 50 | String rq=map.get("rq").toString(); |
| 49 | - List<Map<String, Object>> list=yblService.obtain(rq); | |
| 51 | + Map<String, Object> list=yblService.obtain(rq); | |
| 50 | 52 | System.out.println(); |
| 51 | 53 | return list; |
| 52 | 54 | } |
| 53 | 55 | |
| 54 | 56 | /** |
| 57 | + * 拆分油量 | |
| 58 | + * @param map | |
| 59 | + * @return | |
| 60 | + */ | |
| 61 | + @RequestMapping(value = "/sort",method = RequestMethod.GET) | |
| 62 | + public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | |
| 63 | + Map<String, Object> list=yblService.sort(map); | |
| 64 | + return list; | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 进场油量等于出场油量 | |
| 69 | + * @param map | |
| 70 | + * @return | |
| 71 | + */ | |
| 72 | + @RequestMapping(value = "/outAndIn",method = RequestMethod.GET) | |
| 73 | + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){ | |
| 74 | + Map<String, Object> list=yblService.outAndIn(map); | |
| 75 | + return list; | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 核对油量(有加油没里程) | |
| 80 | + * @param map | |
| 81 | + * @return | |
| 82 | + */ | |
| 83 | + @RequestMapping(value = "/checkYl",method = RequestMethod.GET) | |
| 84 | + public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){ | |
| 85 | + Map<String, Object> list=yblService.checkYl(map); | |
| 86 | + return list; | |
| 87 | + } | |
| 88 | + | |
| 89 | + /** | |
| 55 | 90 | * |
| 56 | 91 | * @Title: list |
| 57 | 92 | * @Description: TODO(多条件分页查询) | ... | ... |
src/main/java/com/bsth/controller/oil/YlxxbController.java
| 1 | 1 | package com.bsth.controller.oil; |
| 2 | 2 | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 4 | 9 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 10 | |
| 6 | 11 | import com.bsth.controller.BaseController; |
| 7 | 12 | import com.bsth.entity.oil.Ylxxb; |
| 13 | +import com.bsth.service.oil.YlxxbService; | |
| 14 | +import com.bsth.util.PageObject; | |
| 8 | 15 | |
| 9 | 16 | @RestController |
| 10 | 17 | @RequestMapping("ylxxb") |
| 11 | 18 | public class YlxxbController extends BaseController<Ylxxb, Integer>{ |
| 12 | - | |
| 19 | + @Autowired | |
| 20 | + private YlxxbService service; | |
| 21 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | |
| 22 | + public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){ | |
| 23 | + PageObject<Ylxxb> pagequery=null; | |
| 24 | + map.put("curPage", map.get("page").toString()); | |
| 25 | + map.put("pageData","10"); | |
| 26 | + pagequery=service.Pagequery(map); | |
| 27 | + return pagequery; | |
| 28 | + } | |
| 29 | + | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 核对油量(有加油没里程) | |
| 33 | + * @param map | |
| 34 | + * @return | |
| 35 | + */ | |
| 36 | + @RequestMapping(value = "/check",method = RequestMethod.GET) | |
| 37 | + public Map<String, Object> check(@RequestParam Map<String, Object> map){ | |
| 38 | + Map<String, Object> list=service.checkJsy(map); | |
| 39 | + return list; | |
| 40 | + } | |
| 13 | 41 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | +import java.util.HashMap; | |
| 4 | +import java.util.List; | |
| 3 | 5 | import java.util.Map; |
| 4 | 6 | |
| 5 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 6 | 8 | import org.springframework.web.bind.annotation.RestController; |
| 7 | 9 | |
| 10 | +import com.alibaba.fastjson.JSON; | |
| 11 | +import com.alibaba.fastjson.serializer.PropertyFilter; | |
| 8 | 12 | import com.bsth.data.BasicData; |
| 9 | 13 | |
| 10 | 14 | @RestController |
| ... | ... | @@ -21,4 +25,49 @@ public class BasicDataController { |
| 21 | 25 | public Map<String, String> findLineCodeMap(){ |
| 22 | 26 | return BasicData.lineCode2NameMap; |
| 23 | 27 | } |
| 28 | + | |
| 29 | + @RequestMapping("/parks") | |
| 30 | + public Map<String, String> findParks(){ | |
| 31 | + Map<String, String> rs = new HashMap<>(); | |
| 32 | + List<String> codes = BasicData.parkCodeList; | |
| 33 | + for(String code : codes){ | |
| 34 | + rs.put(code, BasicData.stationCode2NameMap.get(code)); | |
| 35 | + } | |
| 36 | + return rs; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @RequestMapping("/personnel") | |
| 40 | + public Map<String, Object> findPersonnelInfo(){ | |
| 41 | + Map<String, Object> rs = new HashMap<>(); | |
| 42 | + PersonnelFieldFilter filter=new PersonnelFieldFilter(); | |
| 43 | + //驾驶员 | |
| 44 | + rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | |
| 45 | + //售票员 | |
| 46 | + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter))); | |
| 47 | + return rs; | |
| 48 | + } | |
| 49 | + | |
| 50 | + @RequestMapping("/all_personnel") | |
| 51 | + public Map<String, String> all_personnel(){ | |
| 52 | + //Map<String, Object> rs = new HashMap<>(); | |
| 53 | + //PersonnelFieldFilter filter=new PersonnelFieldFilter(); | |
| 54 | + | |
| 55 | + //rs.put("list", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | |
| 56 | + return BasicData.allPerson; | |
| 57 | + } | |
| 58 | + | |
| 59 | + | |
| 60 | + public class PersonnelFieldFilter implements PropertyFilter{ | |
| 61 | + | |
| 62 | + String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"}; | |
| 63 | + @Override | |
| 64 | + public boolean apply(Object object, String name, Object value) { | |
| 65 | + for(String f : whiteList){ | |
| 66 | + if(name.equals(f)) | |
| 67 | + return true; | |
| 68 | + } | |
| 69 | + return false; | |
| 70 | + } | |
| 71 | + | |
| 72 | + } | |
| 24 | 73 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -7,6 +7,7 @@ import java.util.List; |
| 7 | 7 | import java.util.Map; |
| 8 | 8 | |
| 9 | 9 | import org.apache.commons.lang3.StringEscapeUtils; |
| 10 | +import org.drools.core.runtime.help.impl.XStreamJSon.JSonAbortWorkItemConverter; | |
| 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 12 | import org.springframework.web.bind.annotation.PathVariable; |
| 12 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
| ... | ... | @@ -14,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 14 | 15 | import org.springframework.web.bind.annotation.RequestParam; |
| 15 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 16 | 17 | |
| 18 | +import com.alibaba.fastjson.JSON; | |
| 19 | +import com.alibaba.fastjson.JSONArray; | |
| 17 | 20 | import com.bsth.controller.BaseController; |
| 21 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 22 | +import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 18 | 23 | import com.bsth.data.BasicData; |
| 19 | 24 | import com.bsth.data.schedule.DayOfSchedule; |
| 20 | 25 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -42,10 +47,12 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 42 | 47 | |
| 43 | 48 | /** |
| 44 | 49 | * |
| 50 | + * 改由通过 websocket 注册监听!!! | |
| 51 | + * | |
| 45 | 52 | * @Title: registerLine @Description: TODO(注册线路,后续才能收到数据推送) @param @param |
| 46 | 53 | * lineCodes @throws |
| 47 | 54 | * 用GET 防止监控模式下被拦截 |
| 48 | - */ | |
| 55 | + | |
| 49 | 56 | @RequestMapping(value = "/registerLine", method = RequestMethod.GET) |
| 50 | 57 | public int registerLine(@RequestParam String lineCodes) { |
| 51 | 58 | List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes); |
| ... | ... | @@ -58,7 +65,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 58 | 65 | BasicData.lineCode2SocketUserMap.put(line, userName); |
| 59 | 66 | |
| 60 | 67 | return 0; |
| 61 | - } | |
| 68 | + }*/ | |
| 62 | 69 | |
| 63 | 70 | /** |
| 64 | 71 | * |
| ... | ... | @@ -67,20 +74,19 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 67 | 74 | */ |
| 68 | 75 | @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) |
| 69 | 76 | public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, |
| 70 | - @RequestParam String dfsj, String clZbh, String jsy, String spy) { | |
| 71 | - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, clZbh, jsy, spy); | |
| 77 | + @RequestParam String dfsj/*, String clZbh, String jsy, String spy*/) { | |
| 78 | + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj/*, clZbh, jsy, spy*/); | |
| 72 | 79 | } |
| 73 | 80 | |
| 74 | 81 | /** |
| 75 | 82 | * |
| 76 | - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID | |
| 77 | - * ,分隔 @param @param spaceAdjust 自动调整后续间隔(1 是 -1 否) @param @param remarks | |
| 78 | - * 备注 @param @param reason 理由 @param @param spaceNum 间隔(分钟) @throws | |
| 83 | + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 | |
| 79 | 84 | */ |
| 80 | 85 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 81 | - public Map<String, Object> destroy(@RequestParam String idsStr, @RequestParam(defaultValue = "-1") int spaceAdjust, | |
| 82 | - @RequestParam String remarks, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum) { | |
| 83 | - return scheduleRealInfoService.destroy(idsStr, spaceAdjust, remarks, reason, spaceNum); | |
| 86 | + public Map<String, Object> destroy(@RequestParam String idsStr | |
| 87 | + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, | |
| 88 | + @RequestParam String remarks/*, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum*/) { | |
| 89 | + return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks/*, reason, spaceNum*/); | |
| 84 | 90 | } |
| 85 | 91 | |
| 86 | 92 | /** |
| ... | ... | @@ -380,4 +386,18 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 380 | 386 | public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ |
| 381 | 387 | return scheduleRealInfoService.realScheduleList(line,date); |
| 382 | 388 | } |
| 389 | + | |
| 390 | + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) | |
| 391 | + public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ | |
| 392 | + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); | |
| 393 | + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); | |
| 394 | + return scheduleRealInfoService.multi_tzrc(cpcs); | |
| 395 | + } | |
| 396 | + | |
| 397 | + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) | |
| 398 | + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ | |
| 399 | + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); | |
| 400 | + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class); | |
| 401 | + return scheduleRealInfoService.multi_dftz(dfsjcs); | |
| 402 | + } | |
| 383 | 403 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/dto/ChangePersonCar.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * @ClassName: ChangePersonCar | |
| 6 | + * @Description: TODO(换人换车) | |
| 7 | + * @author PanZhao | |
| 8 | + * @date 2016年10月30日 下午10:06:54 | |
| 9 | + * | |
| 10 | + */ | |
| 11 | +public class ChangePersonCar { | |
| 12 | + | |
| 13 | + /** 班次ID */ | |
| 14 | + private Long schId; | |
| 15 | + | |
| 16 | + /** 要更换的车辆自编号 */ | |
| 17 | + private String clZbh; | |
| 18 | + | |
| 19 | + /** 驾驶员 工号/姓名 */ | |
| 20 | + private String jsy; | |
| 21 | + | |
| 22 | + /** 售票员 工号/姓名 */ | |
| 23 | + private String spy; | |
| 24 | + | |
| 25 | + public Long getSchId() { | |
| 26 | + return schId; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setSchId(Long schId) { | |
| 30 | + this.schId = schId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getJsy() { | |
| 34 | + return jsy; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setJsy(String jsy) { | |
| 38 | + this.jsy = jsy; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getSpy() { | |
| 42 | + return spy; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setSpy(String spy) { | |
| 46 | + this.spy = spy; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getClZbh() { | |
| 50 | + return clZbh; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setClZbh(String clZbh) { | |
| 54 | + this.clZbh = clZbh; | |
| 55 | + } | |
| 56 | + | |
| 57 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/dto/DfsjChange.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * @ClassName: DfsjChange | |
| 6 | + * @Description: TODO(待发调整) | |
| 7 | + * @author PanZhao | |
| 8 | + * @date 2016年10月31日 上午1:00:11 | |
| 9 | + * | |
| 10 | + */ | |
| 11 | +public class DfsjChange { | |
| 12 | + | |
| 13 | + private Long schId; | |
| 14 | + | |
| 15 | + private String old_dfsj; | |
| 16 | + | |
| 17 | + private String new_dfsj; | |
| 18 | + | |
| 19 | + public Long getSchId() { | |
| 20 | + return schId; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setSchId(Long schId) { | |
| 24 | + this.schId = schId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getOld_dfsj() { | |
| 28 | + return old_dfsj; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setOld_dfsj(String old_dfsj) { | |
| 32 | + this.old_dfsj = old_dfsj; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getNew_dfsj() { | |
| 36 | + return new_dfsj; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setNew_dfsj(String new_dfsj) { | |
| 40 | + this.new_dfsj = new_dfsj; | |
| 41 | + } | |
| 42 | + | |
| 43 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/GuideboardInfoController.java
| ... | ... | @@ -8,8 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 9 | 9 | import org.springframework.web.bind.annotation.PathVariable; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 13 | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 13 | 17 | /** |
| 14 | 18 | * Created by xu on 16/5/11. |
| 15 | 19 | */ |
| ... | ... | @@ -31,4 +35,10 @@ public class GuideboardInfoController extends BaseController<GuideboardInfo, Lon |
| 31 | 35 | public GuideboardInfo findById(@PathVariable("id") Long aLong) { |
| 32 | 36 | return guideboardInfoRepository.findOneExtend(aLong); |
| 33 | 37 | } |
| 38 | + | |
| 39 | + | |
| 40 | + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET) | |
| 41 | + public List<Map<String, Object>> findLpName(Long ttid) { | |
| 42 | + return guideboardInfoRepository.findLpName(ttid); | |
| 43 | + } | |
| 34 | 44 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/RerunController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.controller.BaseController; | |
| 4 | +import com.bsth.entity.schedule.rule.RerunRule; | |
| 5 | +import com.bsth.repository.schedule.RerunRuleRepository; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.*; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by xu on 16/10/20. | |
| 13 | + */ | |
| 14 | +@RestController | |
| 15 | +@RequestMapping("rms") | |
| 16 | +public class RerunController extends BaseController<RerunRule, Long> { | |
| 17 | + | |
| 18 | + @Autowired | |
| 19 | + private RerunRuleRepository rerunRuleRepository; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public RerunRule findById(@PathVariable("id") Long aLong) { | |
| 23 | + return rerunRuleRepository.findOneExtend(aLong); | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 28 | + * @Title: save | |
| 29 | + * @Description: TODO(持久化对象) | |
| 30 | + * @param @param t | |
| 31 | + * @param @return 设定文件 | |
| 32 | + * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 33 | + * @throws | |
| 34 | + */ | |
| 35 | + @RequestMapping(method = RequestMethod.POST) | |
| 36 | + public Map<String, Object> save(@RequestBody RerunRule t){ | |
| 37 | + return baseService.save(t); | |
| 38 | + } | |
| 39 | + | |
| 40 | + | |
| 41 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
| ... | ... | @@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile; |
| 16 | 16 | |
| 17 | 17 | import java.util.HashMap; |
| 18 | 18 | import java.util.Iterator; |
| 19 | +import java.util.List; | |
| 19 | 20 | import java.util.Map; |
| 20 | 21 | |
| 21 | 22 | /** |
| ... | ... | @@ -111,4 +112,9 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 111 | 112 | public TTInfoDetail findById(@PathVariable("id") Long aLong) { |
| 112 | 113 | return ttInfoDetailRepository.findOneExtend(aLong); |
| 113 | 114 | } |
| 115 | + | |
| 116 | + @RequestMapping(value = "/bcdetail", method = RequestMethod.GET) | |
| 117 | + public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) { | |
| 118 | + return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId); | |
| 119 | + } | |
| 114 | 120 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
| ... | ... | @@ -3,8 +3,10 @@ package com.bsth.controller.schedule; |
| 3 | 3 | import com.bsth.service.TrafficManageService; |
| 4 | 4 | |
| 5 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 6 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 8 | 10 | import org.springframework.web.bind.annotation.RestController; |
| 9 | 11 | |
| 10 | 12 | /** |
| ... | ... | @@ -28,4 +30,58 @@ public class TrafficManageController { |
| 28 | 30 | throw new Exception(exp.getCause()); |
| 29 | 31 | } |
| 30 | 32 | } |
| 33 | + | |
| 34 | + @RequestMapping(value = "/setCL", method = RequestMethod.GET) | |
| 35 | + public String setCL() throws Exception { | |
| 36 | + try { | |
| 37 | + return trManageService.setCL(); | |
| 38 | + } catch (Exception exp) { | |
| 39 | + throw new Exception(exp.getCause()); | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + @RequestMapping(value = "/setSJ", method = RequestMethod.GET) | |
| 44 | + public String setSJ() throws Exception { | |
| 45 | + try { | |
| 46 | + return trManageService.setSJ(); | |
| 47 | + } catch (Exception exp) { | |
| 48 | + throw new Exception(exp.getCause()); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + @RequestMapping(value = "/setCS", method = RequestMethod.GET) | |
| 53 | + public String setCS() throws Exception { | |
| 54 | + try { | |
| 55 | + return trManageService.setCS(); | |
| 56 | + } catch (Exception exp) { | |
| 57 | + throw new Exception(exp.getCause()); | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + @RequestMapping(value = "/setSKB", method = RequestMethod.GET) | |
| 62 | + public String setSKB(@RequestParam("ids") String ids) throws Exception { | |
| 63 | + try { | |
| 64 | + return trManageService.setSKB(ids); | |
| 65 | + } catch (Exception exp) { | |
| 66 | + throw new Exception(exp.getCause()); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + @RequestMapping(value = "/setXLPC", method = RequestMethod.GET) | |
| 71 | + public String setXLPC() throws Exception { | |
| 72 | + try { | |
| 73 | + return trManageService.setXLPC(); | |
| 74 | + } catch (Exception exp) { | |
| 75 | + throw new Exception(exp.getCause()); | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + @RequestMapping(value = "/setJHBC", method = RequestMethod.GET) | |
| 80 | + public String setJHBC() throws Exception { | |
| 81 | + try { | |
| 82 | + return trManageService.setDDRB(); | |
| 83 | + } catch (Exception exp) { | |
| 84 | + throw new Exception(exp.getCause()); | |
| 85 | + } | |
| 86 | + } | |
| 31 | 87 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -17,12 +17,14 @@ import com.bsth.Application; |
| 17 | 17 | import com.bsth.entity.CarPark; |
| 18 | 18 | import com.bsth.entity.Cars; |
| 19 | 19 | import com.bsth.entity.Line; |
| 20 | +import com.bsth.entity.Personnel; | |
| 20 | 21 | import com.bsth.entity.Station; |
| 21 | 22 | import com.bsth.entity.StationRoute; |
| 22 | 23 | import com.bsth.entity.schedule.CarConfigInfo; |
| 23 | 24 | import com.bsth.repository.CarParkRepository; |
| 24 | 25 | import com.bsth.repository.CarsRepository; |
| 25 | 26 | import com.bsth.repository.LineRepository; |
| 27 | +import com.bsth.repository.PersonnelRepository; | |
| 26 | 28 | import com.bsth.repository.StationRepository; |
| 27 | 29 | import com.bsth.repository.StationRouteRepository; |
| 28 | 30 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| ... | ... | @@ -68,6 +70,20 @@ public class BasicData implements CommandLineRunner{ |
| 68 | 70 | //停车场 |
| 69 | 71 | public static List<String> parkCodeList; |
| 70 | 72 | |
| 73 | + //线路ID和shangHaiLinecode 对照 | |
| 74 | + public static Map<Integer, String> lineId2ShangHaiCodeMap; | |
| 75 | + | |
| 76 | + //线路Code和shangHaiLinecode 对照 | |
| 77 | + public static Map<String, String> lineCode2ShangHaiCodeMap; | |
| 78 | + | |
| 79 | + //驾驶员工号 和 personnel 对象映射 | |
| 80 | + public static Map<String, Personnel> jsyMap; | |
| 81 | + //售票员工号 和 personnel 对象映射 | |
| 82 | + public static Map<String, Personnel> spyMap; | |
| 83 | + //全量员工 工号和姓名对照 | |
| 84 | + public static Map<String, String> allPerson; | |
| 85 | + | |
| 86 | + | |
| 71 | 87 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 72 | 88 | |
| 73 | 89 | @Autowired |
| ... | ... | @@ -100,6 +116,9 @@ public class BasicData implements CommandLineRunner{ |
| 100 | 116 | @Autowired |
| 101 | 117 | StationRouteRepository stationRouteRepository; |
| 102 | 118 | |
| 119 | + @Autowired | |
| 120 | + PersonnelRepository personnelRepository; | |
| 121 | + | |
| 103 | 122 | |
| 104 | 123 | @Override |
| 105 | 124 | public void run() { |
| ... | ... | @@ -112,12 +131,18 @@ public class BasicData implements CommandLineRunner{ |
| 112 | 131 | */ |
| 113 | 132 | public int loadAllData(){ |
| 114 | 133 | try{ |
| 134 | + //设备信息 | |
| 115 | 135 | loadDeviceInfo(); |
| 136 | + //站点信息 | |
| 116 | 137 | loadStationInfo(); |
| 138 | + //线路信息 | |
| 117 | 139 | loadLineInfo(); |
| 140 | + //车辆和线路映射信息 | |
| 118 | 141 | loadNbbm2LineInfo(); |
| 119 | - | |
| 142 | + //站点路由信息 | |
| 120 | 143 | loadStationRouteInfo(); |
| 144 | + //人员信息 | |
| 145 | + loadPersonnelInfo(); | |
| 121 | 146 | logger.info("加载基础数据成功!," ); |
| 122 | 147 | }catch(Exception e){ |
| 123 | 148 | logger.error("加载基础数据时出现异常," , e); |
| ... | ... | @@ -213,15 +238,53 @@ public class BasicData implements CommandLineRunner{ |
| 213 | 238 | Line line; |
| 214 | 239 | BiMap<Integer, String> biMap = HashBiMap.create(); |
| 215 | 240 | Map<String, String> code2name = new HashMap<>(); |
| 241 | + Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | |
| 242 | + Map<String, String> code2SHcode = new HashMap<String, String>(); | |
| 216 | 243 | |
| 217 | 244 | while(iterator.hasNext()){ |
| 218 | 245 | line = iterator.next(); |
| 219 | 246 | biMap.put(line.getId(), line.getLineCode()); |
| 220 | 247 | code2name.put(line.getLineCode(), line.getName()); |
| 248 | + id2SHcode.put(line.getId(),line.getShanghaiLinecode()); | |
| 249 | + code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | |
| 221 | 250 | } |
| 222 | 251 | |
| 223 | 252 | lineId2CodeMap = biMap; |
| 224 | 253 | lineCode2NameMap = code2name; |
| 254 | + lineId2ShangHaiCodeMap = id2SHcode; | |
| 255 | + lineCode2ShangHaiCodeMap = code2SHcode; | |
| 256 | + } | |
| 257 | + | |
| 258 | + /** | |
| 259 | + * | |
| 260 | + * @Title: loadPersonnelInfo | |
| 261 | + * @Description: TODO(加载人员信息) | |
| 262 | + */ | |
| 263 | + public void loadPersonnelInfo() { | |
| 264 | + Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | |
| 265 | + | |
| 266 | + Map<String, Personnel> jsyTempMap=new HashMap<>() | |
| 267 | + , spyTempMap=new HashMap<>(); | |
| 268 | + Map<String, String> allPersonMap=new HashMap<>(); | |
| 269 | + | |
| 270 | + Personnel p; | |
| 271 | + | |
| 272 | + while(iterator.hasNext()){ | |
| 273 | + p = iterator.next(); | |
| 274 | + | |
| 275 | + if(p.getPosts() != null){ | |
| 276 | + if(p.getPosts().equals("1")) | |
| 277 | + jsyTempMap.put(p.getJobCode(), p); | |
| 278 | + else if(p.getPosts().equals("2")) | |
| 279 | + spyTempMap.put(p.getJobCode(), p); | |
| 280 | + } | |
| 281 | + | |
| 282 | + allPersonMap.put(p.getJobCode(), p.getPersonnelName()); | |
| 283 | + } | |
| 284 | + | |
| 285 | + jsyMap=jsyTempMap; | |
| 286 | + spyMap=spyTempMap; | |
| 287 | + allPerson=allPersonMap; | |
| 225 | 288 | } |
| 226 | 289 | } |
| 227 | 290 | } | ... | ... |
src/main/java/com/bsth/data/LineConfigData.java
| ... | ... | @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; |
| 15 | 15 | import com.bsth.entity.Line; |
| 16 | 16 | import com.bsth.entity.realcontrol.D80ReplyTemp; |
| 17 | 17 | import com.bsth.entity.realcontrol.LineConfig; |
| 18 | +import com.bsth.oplog.normal.OpLogger; | |
| 18 | 19 | import com.bsth.service.LineService; |
| 19 | 20 | import com.bsth.service.realcontrol.LineConfigService; |
| 20 | 21 | |
| ... | ... | @@ -39,6 +40,9 @@ public class LineConfigData implements CommandLineRunner { |
| 39 | 40 | |
| 40 | 41 | @Autowired |
| 41 | 42 | LineService lineService; |
| 43 | + | |
| 44 | + @Autowired | |
| 45 | + OpLogger opLog; | |
| 42 | 46 | |
| 43 | 47 | @Override |
| 44 | 48 | public void run(String... arg0) throws Exception { |
| ... | ... | @@ -47,6 +51,8 @@ public class LineConfigData implements CommandLineRunner { |
| 47 | 51 | Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); |
| 48 | 52 | while (itr.hasNext()) |
| 49 | 53 | setBuffer(itr.next()); |
| 54 | + | |
| 55 | + opLog.info("Line_config_data"); | |
| 50 | 56 | } |
| 51 | 57 | |
| 52 | 58 | public LineConfig get(String lineCode){ | ... | ... |
src/main/java/com/bsth/data/arrival/AnalyseArrivalData.java renamed to src/main/java/com/bsth/data/arrival/AnalyseData.java
| ... | ... | @@ -20,9 +20,9 @@ import com.bsth.data.BasicData; |
| 20 | 20 | * |
| 21 | 21 | */ |
| 22 | 22 | @Component |
| 23 | -public class AnalyseArrivalData { | |
| 23 | +public class AnalyseData { | |
| 24 | 24 | |
| 25 | - Logger logger = LoggerFactory.getLogger(AnalyseArrivalData.class); | |
| 25 | + Logger logger = LoggerFactory.getLogger(AnalyseData.class); | |
| 26 | 26 | |
| 27 | 27 | public void analyse(Set<String> cars){ |
| 28 | 28 | try{ | ... | ... |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| ... | ... | @@ -64,7 +64,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 64 | 64 | DayOfSchedule dayOfSchedule; |
| 65 | 65 | |
| 66 | 66 | @Autowired |
| 67 | - AnalyseArrivalData analyseData; | |
| 67 | + AnalyseData analyseData; | |
| 68 | 68 | |
| 69 | 69 | @Override |
| 70 | 70 | public void run() { |
| ... | ... | @@ -144,4 +144,4 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 144 | 144 | carIndexMap.put(nbbm, size); |
| 145 | 145 | return rs; |
| 146 | 146 | } |
| 147 | -} | |
| 147 | +} | |
| 148 | 148 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
| ... | ... | @@ -43,6 +43,7 @@ public class FirstScheduleCheckThread extends Thread{ |
| 43 | 43 | List<ScheduleRealInfo> schList; |
| 44 | 44 | ScheduleRealInfo first; |
| 45 | 45 | for(String car : cars){ |
| 46 | + | |
| 46 | 47 | schList = dayOfSchedule.findByNbbm(car); |
| 47 | 48 | |
| 48 | 49 | if(null == schList || schList.size() == 0) |
| ... | ... | @@ -54,7 +55,7 @@ public class FirstScheduleCheckThread extends Thread{ |
| 54 | 55 | && first.getBcType().equals("out")){ |
| 55 | 56 | |
| 56 | 57 | //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令 |
| 57 | - if(first.getJhlc() == null) | |
| 58 | + if(first.getJhlc() == null && first.getXlDir().equals(schList.get(1).getXlDir())) | |
| 58 | 59 | first = schList.get(1); |
| 59 | 60 | |
| 60 | 61 | //为首班补发指令 | ... | ... |
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
| ... | ... | @@ -61,7 +61,7 @@ public class ForecastRealServer implements CommandLineRunner { |
| 61 | 61 | @Override |
| 62 | 62 | public void run(String... arg0) throws Exception { |
| 63 | 63 | //2小时更新一次站点间耗时数据 |
| 64 | - Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); | |
| 64 | + //Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -72,7 +72,8 @@ public class GpsRealData implements CommandLineRunner{ |
| 72 | 72 | |
| 73 | 73 | @Override |
| 74 | 74 | public void run(String... arg0) throws Exception { |
| 75 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS); | |
| 75 | + logger.info("gpsDataLoader,20,6"); | |
| 76 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | public GpsEntity add(GpsEntity gps) { |
| ... | ... | @@ -188,6 +189,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 188 | 189 | |
| 189 | 190 | String nbbm; |
| 190 | 191 | //附加车辆内部编码 |
| 192 | + Integer updown; | |
| 191 | 193 | for(GpsEntity gps : list){ |
| 192 | 194 | nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); |
| 193 | 195 | if(StringUtils.isBlank(nbbm)) |
| ... | ... | @@ -196,11 +198,20 @@ public class GpsRealData implements CommandLineRunner{ |
| 196 | 198 | gps.setNbbm(nbbm); |
| 197 | 199 | |
| 198 | 200 | gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); |
| 201 | + if(gps.getUpDown() == -1){ | |
| 202 | + //如果走向未知,尝试根据站点纠正走向 | |
| 203 | + updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 204 | + if(updown != null) | |
| 205 | + gps.setUpDown(updown); | |
| 206 | + } | |
| 199 | 207 | gpsRealData.add(gps); |
| 200 | 208 | } |
| 201 | 209 | } else |
| 202 | 210 | logger.error("result is null"); |
| 203 | - } finally { | |
| 211 | + } catch(Exception e){ | |
| 212 | + logger.error("", e); | |
| 213 | + } | |
| 214 | + finally { | |
| 204 | 215 | if (null != httpClient) |
| 205 | 216 | httpClient.close(); |
| 206 | 217 | if(null != response) | ... | ... |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| ... | ... | @@ -3,7 +3,9 @@ package com.bsth.data.match; |
| 3 | 3 | import java.text.SimpleDateFormat; |
| 4 | 4 | import java.util.ArrayList; |
| 5 | 5 | import java.util.Collections; |
| 6 | +import java.util.HashMap; | |
| 6 | 7 | import java.util.List; |
| 8 | +import java.util.Map; | |
| 7 | 9 | import java.util.Set; |
| 8 | 10 | |
| 9 | 11 | import org.slf4j.Logger; |
| ... | ... | @@ -42,6 +44,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 42 | 44 | |
| 43 | 45 | private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); |
| 44 | 46 | |
| 47 | + private static Map<String, ExpectArrivalEnd> expectMap = new HashMap<>(); | |
| 48 | + | |
| 45 | 49 | /** |
| 46 | 50 | * |
| 47 | 51 | * @Title: start |
| ... | ... | @@ -69,6 +73,7 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 69 | 73 | |
| 70 | 74 | @Override |
| 71 | 75 | public void run() { |
| 76 | + | |
| 72 | 77 | //班次列表 |
| 73 | 78 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); |
| 74 | 79 | //进出起终点数据 |
| ... | ... | @@ -209,14 +214,25 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 209 | 214 | * @Description: TODO(车辆发出) |
| 210 | 215 | */ |
| 211 | 216 | public void carOut(MatchResult mr){ |
| 217 | + ScheduleRealInfo sch = mr.sch; | |
| 218 | + | |
| 219 | + if(expectMap.containsKey(nbbm)){ | |
| 220 | + ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 221 | + if(mr.ts < ead.getEndTime()) | |
| 222 | + return; | |
| 223 | + else | |
| 224 | + expectMap.remove(nbbm); | |
| 225 | + } | |
| 212 | 226 | //设置发车时间 |
| 213 | - mr.sch.setFcsjActualAll(mr.ts); | |
| 227 | + sch.setFcsjActualAll(mr.ts); | |
| 214 | 228 | //通知客户端 |
| 215 | - sendUtils.sendFcsj(mr.sch); | |
| 229 | + sendUtils.sendFcsj(sch); | |
| 216 | 230 | //持久化 |
| 217 | - dayOfSchedule.save(mr.sch); | |
| 231 | + dayOfSchedule.save(sch); | |
| 218 | 232 | //车辆当前执行班次 |
| 219 | - dayOfSchedule.addExecPlan(mr.sch); | |
| 233 | + dayOfSchedule.addExecPlan(sch); | |
| 234 | + //期望车辆到达的终点 | |
| 235 | + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); | |
| 220 | 236 | } |
| 221 | 237 | |
| 222 | 238 | /** |
| ... | ... | @@ -225,12 +241,30 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 225 | 241 | * @Description: TODO(车辆进入终点站) |
| 226 | 242 | */ |
| 227 | 243 | public void carInStop(MatchResult mr){ |
| 228 | - mr.sch.setZdsjActualAll(mr.ts); | |
| 244 | + ScheduleRealInfo sch = mr.sch; | |
| 245 | + String nbbm=sch.getClZbh(); | |
| 246 | + if(expectMap.containsKey(nbbm)){ | |
| 247 | + ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 248 | + if(mr.ts < ead.getEndTime() | |
| 249 | + && !mr.sch.getZdzCode().equals(ead.getEndStation())){ | |
| 250 | + return; | |
| 251 | + } | |
| 252 | + else | |
| 253 | + expectMap.remove(nbbm); | |
| 254 | + } | |
| 229 | 255 | |
| 230 | - int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh()); | |
| 231 | - ScheduleRealInfo next = dayOfSchedule.next(mr.sch); | |
| 256 | + //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。 | |
| 257 | + if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){ | |
| 258 | + int prve_nen = dayOfSchedule.prveNotExecNum(sch); | |
| 259 | + if(prve_nen > 0) | |
| 260 | + return; | |
| 261 | + } | |
| 262 | + | |
| 263 | + sch.setZdsjActualAll(mr.ts); | |
| 264 | + int doneSum = dayOfSchedule.doneSum(nbbm); | |
| 265 | + ScheduleRealInfo next = dayOfSchedule.next(sch); | |
| 232 | 266 | if(null != next){ |
| 233 | - next.setQdzArrDateSJ(mr.sch.getZdsjActual()); | |
| 267 | + next.setQdzArrDateSJ(sch.getZdsjActual()); | |
| 234 | 268 | //下发调度指令 |
| 235 | 269 | directiveService.send60Dispatch(next, doneSum, "到站@系统"); |
| 236 | 270 | |
| ... | ... | @@ -239,18 +273,18 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 239 | 273 | next.setFcsjActualAll(mr.ts); |
| 240 | 274 | |
| 241 | 275 | //套跑 -下发线路切换指令 |
| 242 | - if(!next.getXlBm().equals(mr.sch.getXlBm())) | |
| 243 | - directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 276 | + if(!next.getXlBm().equals(sch.getXlBm())) | |
| 277 | + directiveService.lineChange(nbbm, next.getXlBm(), "套跑@系统"); | |
| 244 | 278 | } |
| 245 | 279 | else//下发文本指令(已结束运营) |
| 246 | - directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统"); | |
| 280 | + directiveService.send60Phrase(nbbm, "到达终点 " + sch.getZdzName() + ",已完成当日所有排班。", "系统"); | |
| 247 | 281 | //通知客户端 |
| 248 | - sendUtils.sendZdsj(mr.sch, next, doneSum); | |
| 282 | + sendUtils.sendZdsj(sch, next, doneSum); | |
| 249 | 283 | //持久化 |
| 250 | - dayOfSchedule.save(mr.sch); | |
| 251 | - logger.info(mr.sch.getClZbh() + "移除正在执行班次," + mr.sch.getFcsj()); | |
| 284 | + dayOfSchedule.save(sch); | |
| 285 | + logger.info(sch.getClZbh() + "移除正在执行班次," + sch.getFcsj()); | |
| 252 | 286 | //移除车辆正在执行班次索引 |
| 253 | - dayOfSchedule.removeExecPlan(mr.sch.getClZbh()); | |
| 287 | + dayOfSchedule.removeExecPlan(nbbm); | |
| 254 | 288 | } |
| 255 | 289 | |
| 256 | 290 | /** |
| ... | ... | @@ -334,4 +368,14 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 334 | 368 | dayOfSchedule = arg0.getBean(DayOfSchedule.class); |
| 335 | 369 | directiveService = arg0.getBean(DirectiveService.class); |
| 336 | 370 | } |
| 371 | + | |
| 372 | + /** | |
| 373 | + * | |
| 374 | + * @Title: removeExpect | |
| 375 | + * @Description: TODO(清除预期站点) | |
| 376 | + * @param @param nbbm | |
| 377 | + */ | |
| 378 | + public void removeExpect(String nbbm){ | |
| 379 | + expectMap.remove(nbbm); | |
| 380 | + } | |
| 337 | 381 | } | ... | ... |
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
0 → 100644
| 1 | +package com.bsth.data.match; | |
| 2 | + | |
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * | |
| 7 | + * @ClassName: ExpectArrivalEnd | |
| 8 | + * @Description: TODO(期望车辆在某个时间段到达某个终点........) | |
| 9 | + * @author PanZhao | |
| 10 | + * @date 2016年11月2日 下午8:04:43 | |
| 11 | + * | |
| 12 | + */ | |
| 13 | +public class ExpectArrivalEnd { | |
| 14 | + | |
| 15 | + private String nbbm; | |
| 16 | + | |
| 17 | + private String endStation; | |
| 18 | + | |
| 19 | + private Long endTime; | |
| 20 | + | |
| 21 | + public static ExpectArrivalEnd getEndInstance(ScheduleRealInfo sch, long t){ | |
| 22 | + ExpectArrivalEnd ead = new ExpectArrivalEnd(); | |
| 23 | + ead.setNbbm(sch.getClZbh()); | |
| 24 | + ead.setEndStation(sch.getZdzCode()); | |
| 25 | + if(sch.getBcType().equals("out")) | |
| 26 | + ead.setEndTime(sch.getZdsjT()); | |
| 27 | + else{ | |
| 28 | + ead.setEndTime(sch.getZdsjT() - (sch.getDfsjT() - t)); | |
| 29 | + } | |
| 30 | + return ead; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getNbbm() { | |
| 34 | + return nbbm; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setNbbm(String nbbm) { | |
| 38 | + this.nbbm = nbbm; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getEndStation() { | |
| 42 | + return endStation; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setEndStation(String endStation) { | |
| 46 | + this.endStation = endStation; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public Long getEndTime() { | |
| 50 | + return endTime; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setEndTime(Long endTime) { | |
| 54 | + this.endTime = endTime; | |
| 55 | + } | |
| 56 | +} | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -24,10 +24,8 @@ import org.springframework.stereotype.Component; |
| 24 | 24 | import com.alibaba.fastjson.JSON; |
| 25 | 25 | import com.alibaba.fastjson.JSONArray; |
| 26 | 26 | import com.bsth.Application; |
| 27 | -import com.bsth.data.BasicData; | |
| 28 | 27 | import com.bsth.data.LineConfigData; |
| 29 | 28 | import com.bsth.data.directive.FirstScheduleCheckThread; |
| 30 | -import com.bsth.data.gpsdata.GpsEntity; | |
| 31 | 29 | import com.bsth.data.gpsdata.GpsRealData; |
| 32 | 30 | import com.bsth.data.schedule.thread.ScheduleLateThread; |
| 33 | 31 | import com.bsth.data.schedule.thread.SchedulePstThread; |
| ... | ... | @@ -120,13 +118,13 @@ public class DayOfSchedule implements CommandLineRunner { |
| 120 | 118 | @Override |
| 121 | 119 | public void run(String... arg0) throws Exception { |
| 122 | 120 | //翻班线程 |
| 123 | - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 120, TimeUnit.SECONDS); | |
| 121 | + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 240, TimeUnit.SECONDS); | |
| 124 | 122 | //入库 |
| 125 | - Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 123 | + //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 126 | 124 | //首班出场指令补发器 |
| 127 | - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS); | |
| 125 | + //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 120, TimeUnit.SECONDS); | |
| 128 | 126 | //班次误点扫描 |
| 129 | - Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 127 | + //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 130 | 128 | } |
| 131 | 129 | |
| 132 | 130 | public Map<String, String> getCurrSchDate() { |
| ... | ... | @@ -262,6 +260,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 262 | 260 | for(ScheduleRealInfo sch : remList){ |
| 263 | 261 | if(null != sch){ |
| 264 | 262 | nbbmScheduleMap.remove(sch.getClZbh(), sch); |
| 263 | + id2SchedulMap.remove(sch.getId()); | |
| 265 | 264 | count ++; |
| 266 | 265 | } |
| 267 | 266 | } |
| ... | ... | @@ -467,9 +466,23 @@ public class DayOfSchedule implements CommandLineRunner { |
| 467 | 466 | id2SchedulMap.put(sch.getId(), sch); |
| 468 | 467 | } |
| 469 | 468 | |
| 469 | + public void delete(ScheduleRealInfo sch) { | |
| 470 | + //ScheduleRealInfo sch = id2SchedulMap.get(id); | |
| 471 | + if(!sch.isSflj()) | |
| 472 | + return; | |
| 473 | + | |
| 474 | + nbbmScheduleMap.remove(sch.getClZbh(), sch); | |
| 475 | + id2SchedulMap.remove(sch.getId()); | |
| 476 | + //return sch; | |
| 477 | + } | |
| 478 | + | |
| 470 | 479 | public void calcQdzTimePlan(String nbbm){ |
| 471 | 480 | schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); |
| 472 | 481 | } |
| 482 | + | |
| 483 | + public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm){ | |
| 484 | + return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm)); | |
| 485 | + } | |
| 473 | 486 | |
| 474 | 487 | /** |
| 475 | 488 | * |
| ... | ... | @@ -507,6 +520,24 @@ public class DayOfSchedule implements CommandLineRunner { |
| 507 | 520 | } |
| 508 | 521 | return rs; |
| 509 | 522 | } |
| 523 | + | |
| 524 | + /** | |
| 525 | + * | |
| 526 | + * @Title: prveNotExecNum | |
| 527 | + * @Description: TODO(班次之前未执行班次数量) | |
| 528 | + */ | |
| 529 | + public int prveNotExecNum(ScheduleRealInfo sch){ | |
| 530 | + int n = 0; | |
| 531 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | |
| 532 | + for(ScheduleRealInfo s : list){ | |
| 533 | + if(s.getFcsjActual() == null && !s.isDestroy()) | |
| 534 | + n ++; | |
| 535 | + | |
| 536 | + if(s.getId().equals(sch.getId())) | |
| 537 | + break; | |
| 538 | + } | |
| 539 | + return n; | |
| 540 | + } | |
| 510 | 541 | |
| 511 | 542 | /** |
| 512 | 543 | * |
| ... | ... | @@ -564,7 +595,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 564 | 595 | |
| 565 | 596 | public void save(ScheduleRealInfo sch){ |
| 566 | 597 | //schRepository.save(sch); |
| 567 | - pstBuffer.add(sch); | |
| 598 | + //pstBuffer.add(sch); | |
| 568 | 599 | } |
| 569 | 600 | |
| 570 | 601 | |
| ... | ... | @@ -596,15 +627,6 @@ public class DayOfSchedule implements CommandLineRunner { |
| 596 | 627 | } |
| 597 | 628 | return outList; |
| 598 | 629 | } |
| 599 | - | |
| 600 | - public ScheduleRealInfo delete(Long id) { | |
| 601 | - ScheduleRealInfo sch = id2SchedulMap.get(id); | |
| 602 | - if(!sch.isSflj()) | |
| 603 | - return null; | |
| 604 | - | |
| 605 | - nbbmScheduleMap.remove(sch.getClZbh(), sch); | |
| 606 | - return sch; | |
| 607 | - } | |
| 608 | 630 | |
| 609 | 631 | public Set<String> allCar(){ |
| 610 | 632 | return nbbmScheduleMap.keySet(); |
| ... | ... | @@ -625,6 +647,33 @@ public class DayOfSchedule implements CommandLineRunner { |
| 625 | 647 | public Map<String, ScheduleRealInfo> execPlamMap(){ |
| 626 | 648 | return carExecutePlanMap; |
| 627 | 649 | } |
| 650 | + | |
| 651 | + /** | |
| 652 | + * @Title: changeCar | |
| 653 | + * @Description: TODO(班次换车) 返回有更新的班次 | |
| 654 | + * @param @param sch | |
| 655 | + * @param @param newClZbh 新的车辆自编号 | |
| 656 | + */ | |
| 657 | + public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch , String newClZbh){ | |
| 658 | + List<ScheduleRealInfo> ups = new ArrayList<>(); | |
| 659 | + String oldClzbh = sch.getClZbh(); | |
| 660 | + if(oldClzbh.equals(newClZbh)) | |
| 661 | + return ups; | |
| 662 | + | |
| 663 | + | |
| 664 | + //变更相关映射信息 | |
| 665 | + nbbmScheduleMap.remove(sch.getClZbh(), sch); | |
| 666 | + | |
| 667 | + sch.setClZbh(newClZbh); | |
| 668 | + nbbmScheduleMap.put(newClZbh, sch); | |
| 669 | + nbbm2SEStationMap.put(newClZbh, sch.getQdzCode()); | |
| 670 | + nbbm2SEStationMap.put(newClZbh, sch.getZdzCode()); | |
| 671 | + | |
| 672 | + //重新计算班次应到时间 | |
| 673 | + ups.addAll(updateQdzTimePlan(oldClzbh)); | |
| 674 | + ups.addAll(updateQdzTimePlan(newClZbh)); | |
| 675 | + return ups; | |
| 676 | + } | |
| 628 | 677 | |
| 629 | 678 | /** |
| 630 | 679 | * | ... | ... |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.data.schedule; |
| 2 | 2 | |
| 3 | 3 | import java.text.ParseException; |
| 4 | 4 | import java.text.SimpleDateFormat; |
| 5 | +import java.util.ArrayList; | |
| 5 | 6 | import java.util.Collections; |
| 6 | 7 | import java.util.Date; |
| 7 | 8 | import java.util.List; |
| ... | ... | @@ -44,15 +45,20 @@ public class SchAttrCalculator { |
| 44 | 45 | if (null == sch.getFcsjT()) |
| 45 | 46 | calcFcsjTime(sch); |
| 46 | 47 | |
| 48 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | |
| 47 | 49 | /* |
| 48 | 50 | * 早于线路开始运营时间的,加一天 |
| 49 | 51 | * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25 |
| 50 | - */ | |
| 51 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") | |
| 52 | + | |
| 53 | + | |
| 52 | 54 | ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); |
| 53 | 55 | long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime(); |
| 54 | 56 | if (st > sch.getFcsjT()) |
| 57 | + sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);*/ | |
| 58 | + | |
| 59 | + if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ | |
| 55 | 60 | sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); |
| 61 | + } | |
| 56 | 62 | |
| 57 | 63 | sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); |
| 58 | 64 | } catch (Exception e) { |
| ... | ... | @@ -108,6 +114,43 @@ public class SchAttrCalculator { |
| 108 | 114 | |
| 109 | 115 | /** |
| 110 | 116 | * |
| 117 | + * @Title: updateQdzTimePlan | |
| 118 | + * @Description: TODO(更新班次的起点应到时间,list 必须是同一辆车的班次) 并返回被更新的班次 | |
| 119 | + */ | |
| 120 | + public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){ | |
| 121 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 122 | + | |
| 123 | + List<ScheduleRealInfo> updateList = new ArrayList<>(); | |
| 124 | + int len = list.size(); | |
| 125 | + if(len == 0) | |
| 126 | + return updateList; | |
| 127 | + | |
| 128 | + ScheduleRealInfo prve = list.get(0), curr; | |
| 129 | + for(int i = 1; i < len; i ++){ | |
| 130 | + curr = list.get(i); | |
| 131 | + | |
| 132 | + if(prve.getZdzName().equals(curr.getQdzName())){ | |
| 133 | + | |
| 134 | + if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){ | |
| 135 | + prve = curr; | |
| 136 | + continue; | |
| 137 | + } | |
| 138 | + | |
| 139 | + curr.setQdzArrDateJH(prve.getZdsj()); | |
| 140 | + updateList.add(curr); | |
| 141 | + } | |
| 142 | + else{ | |
| 143 | + curr.setQdzArrDateJH(null); | |
| 144 | + updateList.add(curr); | |
| 145 | + } | |
| 146 | + prve = curr; | |
| 147 | + } | |
| 148 | + | |
| 149 | + return updateList; | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * | |
| 111 | 154 | * @Title: connectOutSchedule |
| 112 | 155 | * @Description: TODO(关联出场班次) |
| 113 | 156 | */ | ... | ... |
src/main/java/com/bsth/entity/CarDevice.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.sys.SysUser; | |
| 4 | + | |
| 3 | 5 | import javax.persistence.*; |
| 4 | 6 | import java.util.Date; |
| 5 | 7 | |
| ... | ... | @@ -15,17 +17,32 @@ public class CarDevice { |
| 15 | 17 | @GeneratedValue |
| 16 | 18 | private Long id; |
| 17 | 19 | |
| 18 | - /** 公司名称 */ | |
| 19 | - @Column(nullable = false) | |
| 20 | + /** 公司名称(留着,暂时不用) */ | |
| 21 | + @Column | |
| 20 | 22 | private String gsName; |
| 23 | + | |
| 24 | + /** 车辆id,关联bsth_c_cars */ | |
| 25 | + @Column(nullable = false) | |
| 26 | + private Integer cl; | |
| 21 | 27 | /** 内部编号(自编号) */ |
| 28 | + @Column(nullable = false) | |
| 22 | 29 | private String clZbh; |
| 30 | + | |
| 31 | + /** 关联 bsth_c_line 主键,不做mapping */ | |
| 32 | + @Column(nullable = false) | |
| 33 | + private Integer xl; | |
| 23 | 34 | /** 线路名称 */ |
| 35 | + @Column(nullable = false) | |
| 24 | 36 | private String xlName; |
| 37 | + /** 线路编码 */ | |
| 38 | + @Column(nullable = false) | |
| 39 | + private String xlBm; | |
| 25 | 40 | |
| 26 | 41 | /** 旧终端号 */ |
| 42 | + @Column(nullable = false) | |
| 27 | 43 | private String oldDeviceNo; |
| 28 | 44 | /** 新终端号 */ |
| 45 | + @Column(nullable = false) | |
| 29 | 46 | private String newDeviceNo; |
| 30 | 47 | /** 旧SIM卡号 */ |
| 31 | 48 | private String oldSimNo; |
| ... | ... | @@ -37,11 +54,24 @@ public class CarDevice { |
| 37 | 54 | /** 保修描述 */ |
| 38 | 55 | private String guaranteeDesc; |
| 39 | 56 | |
| 40 | - // 创建日期 | |
| 57 | + /** 启用日期 */ | |
| 58 | + @Column(nullable = false) | |
| 59 | + private Date qyrq; | |
| 60 | + | |
| 61 | + /** 是否删除(标记) */ | |
| 62 | + @Column(nullable = false) | |
| 63 | + private Boolean isCancel = false; | |
| 64 | + | |
| 65 | + /** 创建人 */ | |
| 66 | + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 67 | + private SysUser createBy; | |
| 68 | + /** 修改人 */ | |
| 69 | + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 70 | + private SysUser updateBy; | |
| 71 | + /** 创建日期 */ | |
| 41 | 72 | @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") |
| 42 | 73 | private Date createDate; |
| 43 | - | |
| 44 | - // 修改日期 | |
| 74 | + /** 修改日期 */ | |
| 45 | 75 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 46 | 76 | private Date updateDate; |
| 47 | 77 | |
| ... | ... | @@ -61,6 +91,14 @@ public class CarDevice { |
| 61 | 91 | this.gsName = gsName; |
| 62 | 92 | } |
| 63 | 93 | |
| 94 | + public Integer getCl() { | |
| 95 | + return cl; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setCl(Integer cl) { | |
| 99 | + this.cl = cl; | |
| 100 | + } | |
| 101 | + | |
| 64 | 102 | public String getClZbh() { |
| 65 | 103 | return clZbh; |
| 66 | 104 | } |
| ... | ... | @@ -69,6 +107,14 @@ public class CarDevice { |
| 69 | 107 | this.clZbh = clZbh; |
| 70 | 108 | } |
| 71 | 109 | |
| 110 | + public Integer getXl() { | |
| 111 | + return xl; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setXl(Integer xl) { | |
| 115 | + this.xl = xl; | |
| 116 | + } | |
| 117 | + | |
| 72 | 118 | public String getXlName() { |
| 73 | 119 | return xlName; |
| 74 | 120 | } |
| ... | ... | @@ -77,6 +123,14 @@ public class CarDevice { |
| 77 | 123 | this.xlName = xlName; |
| 78 | 124 | } |
| 79 | 125 | |
| 126 | + public String getXlBm() { | |
| 127 | + return xlBm; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setXlBm(String xlBm) { | |
| 131 | + this.xlBm = xlBm; | |
| 132 | + } | |
| 133 | + | |
| 80 | 134 | public String getOldDeviceNo() { |
| 81 | 135 | return oldDeviceNo; |
| 82 | 136 | } |
| ... | ... | @@ -125,6 +179,22 @@ public class CarDevice { |
| 125 | 179 | this.guaranteeDesc = guaranteeDesc; |
| 126 | 180 | } |
| 127 | 181 | |
| 182 | + public SysUser getCreateBy() { | |
| 183 | + return createBy; | |
| 184 | + } | |
| 185 | + | |
| 186 | + public void setCreateBy(SysUser createBy) { | |
| 187 | + this.createBy = createBy; | |
| 188 | + } | |
| 189 | + | |
| 190 | + public SysUser getUpdateBy() { | |
| 191 | + return updateBy; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public void setUpdateBy(SysUser updateBy) { | |
| 195 | + this.updateBy = updateBy; | |
| 196 | + } | |
| 197 | + | |
| 128 | 198 | public Date getCreateDate() { |
| 129 | 199 | return createDate; |
| 130 | 200 | } |
| ... | ... | @@ -140,4 +210,20 @@ public class CarDevice { |
| 140 | 210 | public void setUpdateDate(Date updateDate) { |
| 141 | 211 | this.updateDate = updateDate; |
| 142 | 212 | } |
| 213 | + | |
| 214 | + public Date getQyrq() { | |
| 215 | + return qyrq; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setQyrq(Date qyrq) { | |
| 219 | + this.qyrq = qyrq; | |
| 220 | + } | |
| 221 | + | |
| 222 | + public Boolean getIsCancel() { | |
| 223 | + return isCancel; | |
| 224 | + } | |
| 225 | + | |
| 226 | + public void setIsCancel(Boolean isCancel) { | |
| 227 | + this.isCancel = isCancel; | |
| 228 | + } | |
| 143 | 229 | } | ... | ... |
src/main/java/com/bsth/entity/Line.java
| ... | ... | @@ -25,116 +25,117 @@ import java.util.Date; |
| 25 | 25 | @Table(name = "bsth_c_line") |
| 26 | 26 | public class Line implements Serializable { |
| 27 | 27 | |
| 28 | - // 线路ID | |
| 29 | 28 | @Id |
| 30 | - /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/ | |
| 29 | + /** 线路ID 主键(唯一标识符) int length(11) */ | |
| 31 | 30 | private Integer id; |
| 32 | 31 | |
| 33 | - // 线路名称 | |
| 32 | + /** 线路名称 varchar length(50) 不能为空 */ | |
| 34 | 33 | private String name; |
| 35 | 34 | |
| 36 | - // 线路代码 | |
| 35 | + /** 线路编码 varchar length(50) 不能为空 */ | |
| 37 | 36 | private String lineCode; |
| 38 | 37 | |
| 39 | - // 英文名 | |
| 38 | + /** 英文名 varchar length(50) */ | |
| 40 | 39 | private String es; |
| 41 | 40 | |
| 42 | - // 简称 | |
| 41 | + /** 简称 varchar length(50) */ | |
| 43 | 42 | private String shortName; |
| 44 | 43 | |
| 45 | - // 起始站名称 | |
| 44 | + /** 起始站名称 varchar length(50) 不能为空 | |
| 45 | + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */ | |
| 46 | 46 | private String startStationName; |
| 47 | 47 | |
| 48 | - // 起始站首班车时间 00:00 | |
| 48 | + /** 终点站名称 varchar length(50) 不能为空 | |
| 49 | + * 该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值 */ | |
| 50 | + private String endStationName; | |
| 51 | + | |
| 52 | + /** 起始站首班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */ | |
| 49 | 53 | private String startStationFirstTime; |
| 50 | 54 | |
| 51 | - // 起始站末班车时间 00:00 | |
| 55 | + /** 起始站末班车时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空 */ | |
| 52 | 56 | private String startStationEndTime; |
| 53 | 57 | |
| 54 | - // 终点站名称 | |
| 55 | - private String endStationName; | |
| 56 | - | |
| 57 | - // 终点站首班时间 00:00 | |
| 58 | + /** 终点站首班时间 00:00 上海公交APP中某个接口所需要的字段值 varchar length(50) 不能为空*/ | |
| 58 | 59 | private String endStationFirstTime; |
| 59 | 60 | |
| 60 | - // 终点站末班时间 00:00 | |
| 61 | + /** 终点站末班时间 00:00 上海公交APP中某个接口所需要的字段值 */ | |
| 61 | 62 | private String endStationEndTime; |
| 62 | 63 | |
| 63 | - // 所属公司 | |
| 64 | + /** 所属公司 varchar length(50) */ | |
| 64 | 65 | private String company; |
| 65 | 66 | |
| 66 | - // 分公司 | |
| 67 | + /** 分公司 varchar length(50)*/ | |
| 67 | 68 | private String brancheCompany; |
| 68 | 69 | |
| 69 | - // 性质(线路类型) | |
| 70 | + /** 性质(线路类型) varchar length(50) */ | |
| 70 | 71 | private String nature; |
| 71 | 72 | |
| 72 | - // 线路等级 | |
| 73 | + /** 线路等级 varchar length(50) */ | |
| 73 | 74 | private String level; |
| 74 | 75 | |
| 75 | - // 线路长度 | |
| 76 | + /** 线路长度 */ | |
| 76 | 77 | private double length; |
| 77 | 78 | |
| 78 | - // 线路负责人 | |
| 79 | + /** 线路负责人 varchar length(50) */ | |
| 79 | 80 | private String chargeName; |
| 80 | 81 | |
| 81 | - // 负责人电话 | |
| 82 | + /** 负责人电话 varchar length(50) */ | |
| 82 | 83 | private String telephone; |
| 83 | 84 | |
| 84 | - // 是否撤销 | |
| 85 | + /** 是否撤销 <1:是;0:否> bit length(50) */ | |
| 85 | 86 | private Integer destroy; |
| 86 | 87 | |
| 87 | - // 是否夜宵线 | |
| 88 | + /** 是否夜宵线 <1:是;0:否> bit length(50)*/ | |
| 88 | 89 | private Integer supperLine; |
| 89 | 90 | |
| 90 | - // 起始调度电话 | |
| 91 | + /** 起始调度电话 varchar length(50) */ | |
| 91 | 92 | private String startPhone; |
| 92 | 93 | |
| 93 | - // 终点调度电话 | |
| 94 | + /** 终点调度电话 varchar length(50) */ | |
| 94 | 95 | private String endPhone; |
| 95 | 96 | |
| 96 | - // 开辟日期 | |
| 97 | + /** 开辟日期 date*/ | |
| 97 | 98 | @DateTimeFormat(pattern ="yyyy-MM-dd") |
| 98 | 99 | private Date openDate; |
| 99 | 100 | |
| 100 | - // 线路沿革 | |
| 101 | + /** 线路沿革 varchar length(50) */ | |
| 101 | 102 | private String history; |
| 102 | 103 | |
| 103 | - // 上海市线路编码 | |
| 104 | + /** 上海市线路编码 varchar length(50) */ | |
| 104 | 105 | private String shanghaiLinecode; |
| 105 | 106 | |
| 106 | - // 设备线路编码 | |
| 107 | + /** 设备线路编码 varchar length(50) */ | |
| 107 | 108 | private String eqLinecode; |
| 108 | 109 | |
| 109 | - /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ | |
| 110 | + /** 配置车辆总数 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11)*/ | |
| 110 | 111 | private Integer carSumNumber; |
| 111 | 112 | |
| 112 | - /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ | |
| 113 | + /** 空调车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ | |
| 113 | 114 | private Integer hvacCarNumber; |
| 114 | 115 | |
| 115 | - /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ | |
| 116 | + /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ | |
| 116 | 117 | private Integer ordCarNumber; |
| 117 | 118 | |
| 118 | - /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 */ | |
| 119 | + /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ | |
| 119 | 120 | private String carParkCode; |
| 120 | 121 | |
| 121 | - /** 线路规划类型 <0:双向;1:环线> */ | |
| 122 | + /** 线路规划类型 <0:双向;1:环线> int length(11) 运管处接口需要的字段 不能为空 */ | |
| 122 | 123 | private Integer linePlayType; |
| 123 | 124 | |
| 124 | - // 描述 | |
| 125 | + /** 描述 varchar length(255) */ | |
| 125 | 126 | private String descriptions; |
| 126 | 127 | |
| 127 | - // 创建人 | |
| 128 | + /** 创建人 int length(11) */ | |
| 128 | 129 | private Integer createBy; |
| 129 | 130 | |
| 130 | - // 修改人 | |
| 131 | + /** 修改人 int length(11) */ | |
| 131 | 132 | private Integer updateBy; |
| 132 | 133 | |
| 133 | - // 创建日期 | |
| 134 | + /** 创建日期 timestamp */ | |
| 134 | 135 | @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") |
| 135 | 136 | private Date createDate; |
| 136 | 137 | |
| 137 | - // 修改日期 | |
| 138 | + /** 修改日期 timestamp */ | |
| 138 | 139 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 139 | 140 | private Date updateDate; |
| 140 | 141 | ... | ... |
src/main/java/com/bsth/entity/Road.java
0 → 100644
| 1 | +package com.bsth.entity; | |
| 2 | + | |
| 3 | +import javax.persistence.Entity; | |
| 4 | +import javax.persistence.Id; | |
| 5 | +import javax.persistence.Table; | |
| 6 | + | |
| 7 | +@Entity | |
| 8 | +@Table(name = "bsth_c_road") | |
| 9 | +public class Road { | |
| 10 | + | |
| 11 | + @Id | |
| 12 | + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/ | |
| 13 | + private Integer id; | |
| 14 | + | |
| 15 | + // 路段编码 | |
| 16 | + private String roadCode; | |
| 17 | + | |
| 18 | + // 路段名称 | |
| 19 | + private String roadName; | |
| 20 | + | |
| 21 | + // 路段矢量(空间坐标点集合)--百度原始坐标坐标点 | |
| 22 | + private String broadVector; | |
| 23 | + | |
| 24 | + // 路段矢量(空间坐标点集合)--GPS坐标点 | |
| 25 | + private String groadVector; | |
| 26 | + | |
| 27 | + // 限速 | |
| 28 | + private Double speed; | |
| 29 | + | |
| 30 | + public Integer getId() { | |
| 31 | + return id; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setId(Integer id) { | |
| 35 | + this.id = id; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getRoadCode() { | |
| 39 | + return roadCode; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setRoadCode(String roadCode) { | |
| 43 | + this.roadCode = roadCode; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getRoadName() { | |
| 47 | + return roadName; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setRoadName(String roadName) { | |
| 51 | + this.roadName = roadName; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getBroadVector() { | |
| 55 | + return broadVector; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setBroadVector(String broadVector) { | |
| 59 | + this.broadVector = broadVector; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getGroadVector() { | |
| 63 | + return groadVector; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setGroadVector(String groadVector) { | |
| 67 | + this.groadVector = groadVector; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Double getSpeed() { | |
| 71 | + return speed; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setSpeed(Double speed) { | |
| 75 | + this.speed = speed; | |
| 76 | + } | |
| 77 | +} | ... | ... |
src/main/java/com/bsth/entity/SectionRoute.java
| ... | ... | @@ -52,6 +52,9 @@ public class SectionRoute { |
| 52 | 52 | // 是否撤销 |
| 53 | 53 | private Integer destroy; |
| 54 | 54 | |
| 55 | + /** 是否有路段限速数据 <0:无;1:有>*/ | |
| 56 | + private Integer isRoadeSpeed; | |
| 57 | + | |
| 55 | 58 | // 描述 |
| 56 | 59 | private String descriptions; |
| 57 | 60 | |
| ... | ... | @@ -76,6 +79,14 @@ public class SectionRoute { |
| 76 | 79 | // 线路信息 |
| 77 | 80 | @ManyToOne |
| 78 | 81 | private Line line; |
| 82 | + | |
| 83 | + public Integer getIsRoadeSpeed() { | |
| 84 | + return isRoadeSpeed; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setIsRoadeSpeed(Integer isRoadeSpeed) { | |
| 88 | + this.isRoadeSpeed = isRoadeSpeed; | |
| 89 | + } | |
| 79 | 90 | |
| 80 | 91 | public Integer getId() { |
| 81 | 92 | return id; | ... | ... |
src/main/java/com/bsth/entity/SectionSpeed.java
0 → 100644
| 1 | +package com.bsth.entity; | |
| 2 | + | |
| 3 | +import javax.persistence.Entity; | |
| 4 | +import javax.persistence.GeneratedValue; | |
| 5 | +import javax.persistence.GenerationType; | |
| 6 | +import javax.persistence.Id; | |
| 7 | +import javax.persistence.ManyToOne; | |
| 8 | +import javax.persistence.Table; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * @description TODO(路段限速) | |
| 12 | + * | |
| 13 | + * @author bsth@lq | |
| 14 | + * | |
| 15 | + * @date 2016年9月14日 14:15:42 | |
| 16 | + */ | |
| 17 | + | |
| 18 | + | |
| 19 | +@Entity | |
| 20 | +@Table(name = "bsth_c_sectionspeed") | |
| 21 | +public class SectionSpeed { | |
| 22 | + | |
| 23 | + @Id | |
| 24 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 25 | + private Integer id; | |
| 26 | + | |
| 27 | + // 线路信息 | |
| 28 | + @ManyToOne | |
| 29 | + private Line line; | |
| 30 | + | |
| 31 | + @ManyToOne | |
| 32 | + private Road road; | |
| 33 | + | |
| 34 | + /** 线路编码 */ | |
| 35 | + private String lineCode; | |
| 36 | + | |
| 37 | + private String roadCode; | |
| 38 | + | |
| 39 | + /** 方向*/ | |
| 40 | + private Integer directions; | |
| 41 | + | |
| 42 | + /** 序号*/ | |
| 43 | + private Integer code; | |
| 44 | + | |
| 45 | + /** 路段名称 */ | |
| 46 | + private String sName; | |
| 47 | + | |
| 48 | + public String getRoadCode() { | |
| 49 | + return roadCode; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setRoadCode(String roadCode) { | |
| 53 | + this.roadCode = roadCode; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public Road getRoad() { | |
| 57 | + return road; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setRoad(Road road) { | |
| 61 | + this.road = road; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public Integer getDirections() { | |
| 65 | + return directions; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setDirections(Integer directions) { | |
| 69 | + this.directions = directions; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public Integer getCode() { | |
| 73 | + return code; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setCode(Integer code) { | |
| 77 | + this.code = code; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public Integer getId() { | |
| 81 | + return id; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setId(Integer id) { | |
| 85 | + this.id = id; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public Line getLine() { | |
| 89 | + return line; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setLine(Line line) { | |
| 93 | + this.line = line; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getLineCode() { | |
| 97 | + return lineCode; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setLineCode(String lineCode) { | |
| 101 | + this.lineCode = lineCode; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getsName() { | |
| 105 | + return sName; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setsName(String sName) { | |
| 109 | + this.sName = sName; | |
| 110 | + } | |
| 111 | + | |
| 112 | +} | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A3.java
0 → 100644
| 1 | +package com.bsth.entity.directive; | |
| 2 | + | |
| 3 | +import javax.persistence.Embeddable; | |
| 4 | +import javax.persistence.Entity; | |
| 5 | +import javax.persistence.GeneratedValue; | |
| 6 | +import javax.persistence.Id; | |
| 7 | +import javax.persistence.Table; | |
| 8 | +import javax.persistence.Transient; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * | |
| 12 | + * @ClassName: DC0_A4 | |
| 13 | + * @Description: TODO(设备参数) | |
| 14 | + * @author PanZhao | |
| 15 | + * @date 2016年10月18日 下午5:22:36 | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Entity | |
| 19 | +@Table(name = "bsth_v_C0_A3") | |
| 20 | +public class DC0_A3 extends Directive{ | |
| 21 | + | |
| 22 | + @Id | |
| 23 | + @GeneratedValue | |
| 24 | + private Integer id; | |
| 25 | + | |
| 26 | + private DC0_A3Data data; | |
| 27 | + | |
| 28 | + @Embeddable | |
| 29 | + public static class DC0_A3Data { | |
| 30 | + /** | |
| 31 | + * 二级协议 | |
| 32 | + */ | |
| 33 | + private Short operCode2 = 0xA3; | |
| 34 | + /** 设备编号 */ | |
| 35 | + @Transient | |
| 36 | + private String deviceId; | |
| 37 | + /** 网关IP地址 */ | |
| 38 | + private String ipAddress; | |
| 39 | + /** 网关端口 */ | |
| 40 | + private int port; | |
| 41 | + /** 定时定距上报模式 */ | |
| 42 | + private short reportMode; | |
| 43 | + /** 定时上报时间间隔 */ | |
| 44 | + private int interval; | |
| 45 | + /** 定距上报距离间隔 */ | |
| 46 | + private String distance; | |
| 47 | + /** 非线路状态超速阀门 */ | |
| 48 | + private short speedingThreshold; | |
| 49 | + /** 预警阀门 */ | |
| 50 | + private short alarmThreshold; | |
| 51 | + /** pos机IP地址 */ | |
| 52 | + private String posIpAddress; | |
| 53 | + /** pos机端口 */ | |
| 54 | + private String posPort; | |
| 55 | + /** 延迟机关时间 */ | |
| 56 | + private int delay; | |
| 57 | + /** 中门视频切换到码表界面速度阀门 默认45 */ | |
| 58 | + private short speedThreshold1; | |
| 59 | + /** 码表界面切换到中门视频速度阀门 默认35 */ | |
| 60 | + private short speedThreshold2; | |
| 61 | + /** 对比度 */ | |
| 62 | + private short contrast; | |
| 63 | + /** 亮度 */ | |
| 64 | + private short brightness; | |
| 65 | + /** 饱和度 */ | |
| 66 | + private short saturation; | |
| 67 | + public Short getOperCode2() { | |
| 68 | + return operCode2; | |
| 69 | + } | |
| 70 | + public void setOperCode2(Short operCode2) { | |
| 71 | + this.operCode2 = operCode2; | |
| 72 | + } | |
| 73 | + public String getDeviceId() { | |
| 74 | + return deviceId; | |
| 75 | + } | |
| 76 | + public void setDeviceId(String deviceId) { | |
| 77 | + this.deviceId = deviceId; | |
| 78 | + } | |
| 79 | + public String getIpAddress() { | |
| 80 | + return ipAddress; | |
| 81 | + } | |
| 82 | + public void setIpAddress(String ipAddress) { | |
| 83 | + this.ipAddress = ipAddress; | |
| 84 | + } | |
| 85 | + public int getPort() { | |
| 86 | + return port; | |
| 87 | + } | |
| 88 | + public void setPort(int port) { | |
| 89 | + this.port = port; | |
| 90 | + } | |
| 91 | + public short getReportMode() { | |
| 92 | + return reportMode; | |
| 93 | + } | |
| 94 | + public void setReportMode(short reportMode) { | |
| 95 | + this.reportMode = reportMode; | |
| 96 | + } | |
| 97 | + public int getInterval() { | |
| 98 | + return interval; | |
| 99 | + } | |
| 100 | + public void setInterval(int interval) { | |
| 101 | + this.interval = interval; | |
| 102 | + } | |
| 103 | + public String getDistance() { | |
| 104 | + return distance; | |
| 105 | + } | |
| 106 | + public void setDistance(String distance) { | |
| 107 | + this.distance = distance; | |
| 108 | + } | |
| 109 | + public short getSpeedingThreshold() { | |
| 110 | + return speedingThreshold; | |
| 111 | + } | |
| 112 | + public void setSpeedingThreshold(short speedingThreshold) { | |
| 113 | + this.speedingThreshold = speedingThreshold; | |
| 114 | + } | |
| 115 | + public short getAlarmThreshold() { | |
| 116 | + return alarmThreshold; | |
| 117 | + } | |
| 118 | + public void setAlarmThreshold(short alarmThreshold) { | |
| 119 | + this.alarmThreshold = alarmThreshold; | |
| 120 | + } | |
| 121 | + public String getPosIpAddress() { | |
| 122 | + return posIpAddress; | |
| 123 | + } | |
| 124 | + public void setPosIpAddress(String posIpAddress) { | |
| 125 | + this.posIpAddress = posIpAddress; | |
| 126 | + } | |
| 127 | + public String getPosPort() { | |
| 128 | + return posPort; | |
| 129 | + } | |
| 130 | + public void setPosPort(String posPort) { | |
| 131 | + this.posPort = posPort; | |
| 132 | + } | |
| 133 | + public int getDelay() { | |
| 134 | + return delay; | |
| 135 | + } | |
| 136 | + public void setDelay(int delay) { | |
| 137 | + this.delay = delay; | |
| 138 | + } | |
| 139 | + public short getSpeedThreshold1() { | |
| 140 | + return speedThreshold1; | |
| 141 | + } | |
| 142 | + public void setSpeedThreshold1(short speedThreshold1) { | |
| 143 | + this.speedThreshold1 = speedThreshold1; | |
| 144 | + } | |
| 145 | + public short getSpeedThreshold2() { | |
| 146 | + return speedThreshold2; | |
| 147 | + } | |
| 148 | + public void setSpeedThreshold2(short speedThreshold2) { | |
| 149 | + this.speedThreshold2 = speedThreshold2; | |
| 150 | + } | |
| 151 | + public short getContrast() { | |
| 152 | + return contrast; | |
| 153 | + } | |
| 154 | + public void setContrast(short contrast) { | |
| 155 | + this.contrast = contrast; | |
| 156 | + } | |
| 157 | + public short getBrightness() { | |
| 158 | + return brightness; | |
| 159 | + } | |
| 160 | + public void setBrightness(short brightness) { | |
| 161 | + this.brightness = brightness; | |
| 162 | + } | |
| 163 | + public short getSaturation() { | |
| 164 | + return saturation; | |
| 165 | + } | |
| 166 | + public void setSaturation(short saturation) { | |
| 167 | + this.saturation = saturation; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + | |
| 171 | + public Integer getId() { | |
| 172 | + return id; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setId(Integer id) { | |
| 176 | + this.id = id; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public DC0_A3Data getData() { | |
| 180 | + return data; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setData(DC0_A3Data data) { | |
| 184 | + this.data = data; | |
| 185 | + } | |
| 186 | + | |
| 187 | +} | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A4.java
| 1 | 1 | package com.bsth.entity.directive; |
| 2 | 2 | |
| 3 | 3 | import javax.persistence.Embeddable; |
| 4 | +import javax.persistence.Entity; | |
| 4 | 5 | import javax.persistence.GeneratedValue; |
| 5 | 6 | import javax.persistence.Id; |
| 7 | +import javax.persistence.Table; | |
| 8 | +import javax.persistence.Transient; | |
| 6 | 9 | |
| 7 | 10 | /** |
| 8 | 11 | * |
| 9 | - * @ClassName: DC0_A4 | |
| 10 | - * @Description: TODO(参数查询) | |
| 12 | + * @ClassName: DC0_A4 | |
| 13 | + * @Description: TODO(设备参数) | |
| 11 | 14 | * @author PanZhao |
| 12 | 15 | * @date 2016年10月18日 下午5:22:36 |
| 13 | 16 | * |
| 14 | 17 | */ |
| 18 | +@Entity | |
| 19 | +@Table(name = "bsth_v_C0_A4") | |
| 15 | 20 | public class DC0_A4 extends Directive{ |
| 16 | 21 | |
| 17 | 22 | @Id |
| 18 | 23 | @GeneratedValue |
| 19 | 24 | private Integer id; |
| 20 | 25 | |
| 26 | + private DC0A4Data data; | |
| 21 | 27 | |
| 22 | 28 | @Embeddable |
| 23 | 29 | public static class DC0A4Data { |
| ... | ... | @@ -26,6 +32,7 @@ public class DC0_A4 extends Directive{ |
| 26 | 32 | */ |
| 27 | 33 | private Short operCode2; |
| 28 | 34 | /** 设备编号 */ |
| 35 | + @Transient | |
| 29 | 36 | private String deviceId; |
| 30 | 37 | /** 网关IP地址 */ |
| 31 | 38 | private String ipAddress; |
| ... | ... | @@ -43,5 +50,137 @@ public class DC0_A4 extends Directive{ |
| 43 | 50 | private short alarmThreshold; |
| 44 | 51 | /** pos机IP地址 */ |
| 45 | 52 | private String posIpAddress; |
| 53 | + /** pos机端口 */ | |
| 54 | + private String posPort; | |
| 55 | + /** 延迟机关时间 */ | |
| 56 | + private int delay; | |
| 57 | + /** 中门视频切换到码表界面速度阀门 默认45 */ | |
| 58 | + private short speedThreshold1; | |
| 59 | + /** 码表界面切换到中门视频速度阀门 默认35 */ | |
| 60 | + private short speedThreshold2; | |
| 61 | + /** 对比度 */ | |
| 62 | + private short contrast; | |
| 63 | + /** 亮度 */ | |
| 64 | + private short brightness; | |
| 65 | + /** 饱和度 */ | |
| 66 | + private short saturation; | |
| 67 | + public Short getOperCode2() { | |
| 68 | + return operCode2; | |
| 69 | + } | |
| 70 | + public void setOperCode2(Short operCode2) { | |
| 71 | + this.operCode2 = operCode2; | |
| 72 | + } | |
| 73 | + public String getDeviceId() { | |
| 74 | + return deviceId; | |
| 75 | + } | |
| 76 | + public void setDeviceId(String deviceId) { | |
| 77 | + this.deviceId = deviceId; | |
| 78 | + } | |
| 79 | + public String getIpAddress() { | |
| 80 | + return ipAddress; | |
| 81 | + } | |
| 82 | + public void setIpAddress(String ipAddress) { | |
| 83 | + this.ipAddress = ipAddress; | |
| 84 | + } | |
| 85 | + public int getPort() { | |
| 86 | + return port; | |
| 87 | + } | |
| 88 | + public void setPort(int port) { | |
| 89 | + this.port = port; | |
| 90 | + } | |
| 91 | + public short getReportMode() { | |
| 92 | + return reportMode; | |
| 93 | + } | |
| 94 | + public void setReportMode(short reportMode) { | |
| 95 | + this.reportMode = reportMode; | |
| 96 | + } | |
| 97 | + public int getInterval() { | |
| 98 | + return interval; | |
| 99 | + } | |
| 100 | + public void setInterval(int interval) { | |
| 101 | + this.interval = interval; | |
| 102 | + } | |
| 103 | + public String getDistance() { | |
| 104 | + return distance; | |
| 105 | + } | |
| 106 | + public void setDistance(String distance) { | |
| 107 | + this.distance = distance; | |
| 108 | + } | |
| 109 | + public short getSpeedingThreshold() { | |
| 110 | + return speedingThreshold; | |
| 111 | + } | |
| 112 | + public void setSpeedingThreshold(short speedingThreshold) { | |
| 113 | + this.speedingThreshold = speedingThreshold; | |
| 114 | + } | |
| 115 | + public short getAlarmThreshold() { | |
| 116 | + return alarmThreshold; | |
| 117 | + } | |
| 118 | + public void setAlarmThreshold(short alarmThreshold) { | |
| 119 | + this.alarmThreshold = alarmThreshold; | |
| 120 | + } | |
| 121 | + public String getPosIpAddress() { | |
| 122 | + return posIpAddress; | |
| 123 | + } | |
| 124 | + public void setPosIpAddress(String posIpAddress) { | |
| 125 | + this.posIpAddress = posIpAddress; | |
| 126 | + } | |
| 127 | + public String getPosPort() { | |
| 128 | + return posPort; | |
| 129 | + } | |
| 130 | + public void setPosPort(String posPort) { | |
| 131 | + this.posPort = posPort; | |
| 132 | + } | |
| 133 | + public int getDelay() { | |
| 134 | + return delay; | |
| 135 | + } | |
| 136 | + public void setDelay(int delay) { | |
| 137 | + this.delay = delay; | |
| 138 | + } | |
| 139 | + public short getSpeedThreshold1() { | |
| 140 | + return speedThreshold1; | |
| 141 | + } | |
| 142 | + public void setSpeedThreshold1(short speedThreshold1) { | |
| 143 | + this.speedThreshold1 = speedThreshold1; | |
| 144 | + } | |
| 145 | + public short getSpeedThreshold2() { | |
| 146 | + return speedThreshold2; | |
| 147 | + } | |
| 148 | + public void setSpeedThreshold2(short speedThreshold2) { | |
| 149 | + this.speedThreshold2 = speedThreshold2; | |
| 150 | + } | |
| 151 | + public short getContrast() { | |
| 152 | + return contrast; | |
| 153 | + } | |
| 154 | + public void setContrast(short contrast) { | |
| 155 | + this.contrast = contrast; | |
| 156 | + } | |
| 157 | + public short getBrightness() { | |
| 158 | + return brightness; | |
| 159 | + } | |
| 160 | + public void setBrightness(short brightness) { | |
| 161 | + this.brightness = brightness; | |
| 162 | + } | |
| 163 | + public short getSaturation() { | |
| 164 | + return saturation; | |
| 165 | + } | |
| 166 | + public void setSaturation(short saturation) { | |
| 167 | + this.saturation = saturation; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + | |
| 171 | + public Integer getId() { | |
| 172 | + return id; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setId(Integer id) { | |
| 176 | + this.id = id; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public DC0A4Data getData() { | |
| 180 | + return data; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setData(DC0A4Data data) { | |
| 184 | + this.data = data; | |
| 46 | 185 | } |
| 47 | 186 | } | ... | ... |
src/main/java/com/bsth/entity/oil/Ylb.java
| 1 | 1 | package com.bsth.entity.oil; |
| 2 | 2 | |
| 3 | +import java.text.DecimalFormat; | |
| 3 | 4 | import java.util.Date; |
| 4 | 5 | |
| 5 | 6 | import javax.persistence.Entity; |
| 6 | 7 | import javax.persistence.GeneratedValue; |
| 7 | 8 | import javax.persistence.Id; |
| 8 | 9 | import javax.persistence.Table; |
| 10 | +import javax.persistence.Transient; | |
| 9 | 11 | |
| 10 | 12 | import org.springframework.format.annotation.DateTimeFormat; |
| 11 | 13 | |
| 14 | +import com.bsth.data.BasicData; | |
| 15 | + | |
| 12 | 16 | @Entity |
| 13 | 17 | @Table(name = "bsth_c_ylb") |
| 14 | 18 | public class Ylb { |
| ... | ... | @@ -22,23 +26,23 @@ public class Ylb { |
| 22 | 26 | private String fgsdm; |
| 23 | 27 | private String nbbm; |
| 24 | 28 | private String jsy; |
| 25 | - private Double czlc; | |
| 26 | - private Double jzlc; | |
| 27 | - private Double czyl; | |
| 28 | - private Double jzyl; | |
| 29 | + private Double czlc=0.0; | |
| 30 | + private Double jzlc=0.0; | |
| 31 | + private Double czyl=0.0; | |
| 32 | + private Double jzyl=0.0; | |
| 29 | 33 | private Double jzl; |
| 30 | 34 | private int sfkt; |
| 31 | 35 | private String jhsj; |
| 32 | - private Double yh; | |
| 33 | - private Double sh; | |
| 36 | + private Double yh=0.0; | |
| 37 | + private Double sh=0.0; | |
| 34 | 38 | private String shyy; |
| 35 | - private Double zlc; | |
| 39 | + private Double zlc=0.0; | |
| 36 | 40 | private int yhlx; |
| 37 | 41 | private String rylx; |
| 38 | - private Double ns; | |
| 39 | - private Double fyylc; | |
| 40 | - private Double jhzlc; | |
| 41 | - private Double jhfyylc; | |
| 42 | + private Double ns=0.0; | |
| 43 | + private Double fyylc=0.0; | |
| 44 | + private Double jhzlc=0.0; | |
| 45 | + private Double jhfyylc=0.0; | |
| 42 | 46 | private int jhzbc; |
| 43 | 47 | private int jhbc; |
| 44 | 48 | private int sjzbc; |
| ... | ... | @@ -49,6 +53,16 @@ public class Ylb { |
| 49 | 53 | private int nylx; |
| 50 | 54 | //进场顺序(根据最先出场和最后进场来关联车辆的存油量) |
| 51 | 55 | private int jcsx; |
| 56 | + | |
| 57 | + @Transient | |
| 58 | + private String bglyh; | |
| 59 | + | |
| 60 | + @Transient | |
| 61 | + private String xlname; | |
| 62 | + | |
| 63 | + @Transient | |
| 64 | + private String gsname; | |
| 65 | + | |
| 52 | 66 | |
| 53 | 67 | public Integer getId() { |
| 54 | 68 | return id; |
| ... | ... | @@ -254,5 +268,38 @@ public class Ylb { |
| 254 | 268 | public void setJcsx(int jcsx){ |
| 255 | 269 | this.jcsx=jcsx; |
| 256 | 270 | } |
| 271 | + | |
| 272 | + public String getBglyh() { | |
| 273 | + if(this.getZlc()==0){ | |
| 274 | + return "0.00"; | |
| 275 | + }else{ | |
| 276 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 277 | + return df.format(this.getYh()/this.getZlc()*100); | |
| 278 | + } | |
| 279 | + } | |
| 280 | + | |
| 281 | + public void setBglyh(String bglyh) { | |
| 282 | + this.bglyh = bglyh; | |
| 283 | + } | |
| 284 | + | |
| 285 | + public String getXlname() { | |
| 286 | + return BasicData.lineCode2NameMap.get(this.xlbm); | |
| 287 | + } | |
| 288 | + | |
| 289 | + public void setXlname(String xlname) { | |
| 290 | + this.xlname = xlname; | |
| 291 | + } | |
| 292 | + | |
| 293 | + public String getGsname() { | |
| 294 | + return BasicData.nbbm2CompanyCodeMap.get(this.nbbm); | |
| 295 | + } | |
| 296 | + | |
| 297 | + public void setGsname(String gsname) { | |
| 298 | + this.gsname = gsname; | |
| 299 | + } | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 257 | 304 | |
| 258 | 305 | } | ... | ... |
src/main/java/com/bsth/entity/oil/Ylxxb.java
| ... | ... | @@ -6,6 +6,9 @@ import javax.persistence.Entity; |
| 6 | 6 | import javax.persistence.GeneratedValue; |
| 7 | 7 | import javax.persistence.Id; |
| 8 | 8 | import javax.persistence.Table; |
| 9 | +import javax.persistence.Transient; | |
| 10 | + | |
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | 12 | |
| 10 | 13 | @Entity |
| 11 | 14 | @Table(name = "bsth_c_ylxxb") |
| ... | ... | @@ -13,6 +16,7 @@ public class Ylxxb { |
| 13 | 16 | @Id |
| 14 | 17 | @GeneratedValue |
| 15 | 18 | private Integer id; |
| 19 | + @DateTimeFormat(pattern="yyyy-MM-dd") | |
| 16 | 20 | private Date yyrq; |
| 17 | 21 | private Date jlrq; |
| 18 | 22 | private String nbbm; |
| ... | ... | @@ -29,6 +33,12 @@ public class Ylxxb { |
| 29 | 33 | private String xgr; |
| 30 | 34 | private String fromgsdm; |
| 31 | 35 | private int nylx; |
| 36 | + @Transient | |
| 37 | + private String ldgh; | |
| 38 | + //0为接口数据,1为手工输入 | |
| 39 | + private int jylx=0; | |
| 40 | + | |
| 41 | + | |
| 32 | 42 | public Integer getId() { |
| 33 | 43 | return id; |
| 34 | 44 | } |
| ... | ... | @@ -131,6 +141,18 @@ public class Ylxxb { |
| 131 | 141 | public void setNylx(int nylx) { |
| 132 | 142 | this.nylx = nylx; |
| 133 | 143 | } |
| 144 | + public String getLdgh() { | |
| 145 | + return ldgh; | |
| 146 | + } | |
| 147 | + public void setLdgh(String ldgh) { | |
| 148 | + this.ldgh = ldgh; | |
| 149 | + } | |
| 150 | + public int getJylx() { | |
| 151 | + return jylx; | |
| 152 | + } | |
| 153 | + public void setJylx(int jylx) { | |
| 154 | + this.jylx = jylx; | |
| 155 | + } | |
| 134 | 156 | |
| 135 | 157 | |
| 136 | 158 | ... | ... |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| ... | ... | @@ -49,9 +49,9 @@ public class LineConfig { |
| 49 | 49 | /** 开始运营时间 HH:mm */ |
| 50 | 50 | private String startOpt; |
| 51 | 51 | |
| 52 | - /** 当天开始营运时间戳 */ | |
| 52 | + /** 当天开始营运时间戳 | |
| 53 | 53 | @Transient |
| 54 | - private long currStartTime; | |
| 54 | + private long currStartTime;*/ | |
| 55 | 55 | |
| 56 | 56 | /** 托管状态 */ |
| 57 | 57 | private boolean trust; | ... | ... |
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
| ... | ... | @@ -53,6 +53,10 @@ public class CarConfigInfo implements Serializable { |
| 53 | 53 | @Column(nullable = false) |
| 54 | 54 | private int isSwitch; |
| 55 | 55 | |
| 56 | + /** 是否删除(标记) */ | |
| 57 | + @Column(nullable = false) | |
| 58 | + private Boolean isCancel = false; | |
| 59 | + | |
| 56 | 60 | /** 创建人 */ |
| 57 | 61 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) |
| 58 | 62 | private SysUser createBy; |
| ... | ... | @@ -170,4 +174,12 @@ public class CarConfigInfo implements Serializable { |
| 170 | 174 | public void setUpdateDate(Date updateDate) { |
| 171 | 175 | this.updateDate = updateDate; |
| 172 | 176 | } |
| 177 | + | |
| 178 | + public Boolean getIsCancel() { | |
| 179 | + return isCancel; | |
| 180 | + } | |
| 181 | + | |
| 182 | + public void setIsCancel(Boolean isCancel) { | |
| 183 | + this.isCancel = isCancel; | |
| 184 | + } | |
| 173 | 185 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
| ... | ... | @@ -49,6 +49,9 @@ public class EmployeeConfigInfo { |
| 49 | 49 | @Formula(" dbbm + 0 ") |
| 50 | 50 | private Integer dbbmFormula; |
| 51 | 51 | |
| 52 | + /** 是否删除(标记) */ | |
| 53 | + @Column(nullable = false) | |
| 54 | + private Boolean isCancel = false; | |
| 52 | 55 | |
| 53 | 56 | /** 创建人 */ |
| 54 | 57 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) |
| ... | ... | @@ -96,6 +99,22 @@ public class EmployeeConfigInfo { |
| 96 | 99 | this.jsy = jsy; |
| 97 | 100 | } |
| 98 | 101 | |
| 102 | + public Personnel getSpy() { | |
| 103 | + return spy; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setSpy(Personnel spy) { | |
| 107 | + this.spy = spy; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public String getDbbm() { | |
| 111 | + return dbbm; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setDbbm(String dbbm) { | |
| 115 | + this.dbbm = dbbm; | |
| 116 | + } | |
| 117 | + | |
| 99 | 118 | public Integer getDbbmFormula() { |
| 100 | 119 | return dbbmFormula; |
| 101 | 120 | } |
| ... | ... | @@ -104,6 +123,14 @@ public class EmployeeConfigInfo { |
| 104 | 123 | this.dbbmFormula = dbbmFormula; |
| 105 | 124 | } |
| 106 | 125 | |
| 126 | + public Boolean getIsCancel() { | |
| 127 | + return isCancel; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setIsCancel(Boolean isCancel) { | |
| 131 | + this.isCancel = isCancel; | |
| 132 | + } | |
| 133 | + | |
| 107 | 134 | public SysUser getCreateBy() { |
| 108 | 135 | return createBy; |
| 109 | 136 | } |
| ... | ... | @@ -120,22 +147,6 @@ public class EmployeeConfigInfo { |
| 120 | 147 | this.updateBy = updateBy; |
| 121 | 148 | } |
| 122 | 149 | |
| 123 | - public Personnel getSpy() { | |
| 124 | - return spy; | |
| 125 | - } | |
| 126 | - | |
| 127 | - public void setSpy(Personnel spy) { | |
| 128 | - this.spy = spy; | |
| 129 | - } | |
| 130 | - | |
| 131 | - public String getDbbm() { | |
| 132 | - return dbbm; | |
| 133 | - } | |
| 134 | - | |
| 135 | - public void setDbbm(String dbbm) { | |
| 136 | - this.dbbm = dbbm; | |
| 137 | - } | |
| 138 | - | |
| 139 | 150 | public Date getCreateDate() { |
| 140 | 151 | return createDate; |
| 141 | 152 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
0 → 100644
| 1 | +package com.bsth.entity.schedule.rule; | |
| 2 | + | |
| 3 | +import com.bsth.entity.Line; | |
| 4 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 5 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 6 | +import com.bsth.entity.schedule.GuideboardInfo; | |
| 7 | +import com.bsth.entity.schedule.TTInfo; | |
| 8 | +import com.bsth.entity.sys.SysUser; | |
| 9 | + | |
| 10 | +import javax.persistence.*; | |
| 11 | +import java.util.Date; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 套跑规则。 | |
| 15 | + */ | |
| 16 | +@Entity | |
| 17 | +@Table(name = "bsth_c_s_rerun_rule") | |
| 18 | +@NamedEntityGraphs({ | |
| 19 | + @NamedEntityGraph(name = "dylp", attributeNodes = { | |
| 20 | + @NamedAttributeNode("rerunXl"), | |
| 21 | + @NamedAttributeNode("rerunTtinfo"), | |
| 22 | + @NamedAttributeNode("rerunLp"), | |
| 23 | + @NamedAttributeNode("useXl"), | |
| 24 | + @NamedAttributeNode("useLp"), | |
| 25 | + @NamedAttributeNode("useCarConfig"), | |
| 26 | + @NamedAttributeNode("useEmployeeConfig") | |
| 27 | + | |
| 28 | + // TODO:subgraph貌似没有用,再议 | |
| 29 | +// subgraphs = { | |
| 30 | +// @NamedSubgraph(name = "useCarConfig", attributeNodes = { | |
| 31 | +// @NamedAttributeNode("xl"), | |
| 32 | +// @NamedAttributeNode("cl") | |
| 33 | +// }), | |
| 34 | +// @NamedSubgraph(name = "useEmployeeConfig", attributeNodes = { | |
| 35 | +// @NamedAttributeNode("jsy"), | |
| 36 | +// @NamedAttributeNode("spy"), | |
| 37 | +// @NamedAttributeNode("xl") | |
| 38 | +// }) | |
| 39 | +// } | |
| 40 | + }) | |
| 41 | +}) | |
| 42 | + | |
| 43 | + | |
| 44 | +public class RerunRule { | |
| 45 | + /** 主键Id */ | |
| 46 | + @Id | |
| 47 | + @GeneratedValue | |
| 48 | + private Long id; | |
| 49 | + | |
| 50 | + /** 套跑线路 */ | |
| 51 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 52 | + private Line rerunXl; | |
| 53 | + /** 套跑时刻表 */ | |
| 54 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 55 | + private TTInfo rerunTtinfo; | |
| 56 | + /** 套跑路牌 */ | |
| 57 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 58 | + private GuideboardInfo rerunLp; | |
| 59 | + /** 套跑班次(时刻表明细ids,使用逗号连接) */ | |
| 60 | + private String rerunTtinfodetailIds; | |
| 61 | + | |
| 62 | + | |
| 63 | + /** 套跑类型(dylp;对应路牌,dybc:对应班车) */ | |
| 64 | + @Column(nullable = false) | |
| 65 | + private String rerunType; | |
| 66 | + | |
| 67 | + //--------- 对应路牌 ----------/ | |
| 68 | + /** 使用线路 */ | |
| 69 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 70 | + private Line useXl; | |
| 71 | + /** 使用路牌 */ | |
| 72 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 73 | + private GuideboardInfo useLp; | |
| 74 | + | |
| 75 | + //--------- 对应班车 ----------/ | |
| 76 | + /** 车辆配置 */ | |
| 77 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 78 | + private CarConfigInfo useCarConfig; | |
| 79 | + /** 人员配置 */ | |
| 80 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 81 | + private EmployeeConfigInfo useEmployeeConfig; | |
| 82 | + | |
| 83 | + /** 是否删除(标记) */ | |
| 84 | + @Column(nullable = false) | |
| 85 | + private Boolean isCancel = false; | |
| 86 | + | |
| 87 | + /** 创建人 */ | |
| 88 | + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 89 | + private SysUser createBy; | |
| 90 | + /** 修改人 */ | |
| 91 | + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 92 | + private SysUser updateBy; | |
| 93 | + /** 创建日期 */ | |
| 94 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 95 | + private Date createDate; | |
| 96 | + /** 修改日期 */ | |
| 97 | + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 98 | + private Date updateDate; | |
| 99 | + | |
| 100 | + public Long getId() { | |
| 101 | + return id; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setId(Long id) { | |
| 105 | + this.id = id; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public Line getRerunXl() { | |
| 109 | + return rerunXl; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setRerunXl(Line rerunXl) { | |
| 113 | + this.rerunXl = rerunXl; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public TTInfo getRerunTtinfo() { | |
| 117 | + return rerunTtinfo; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setRerunTtinfo(TTInfo rerunTtinfo) { | |
| 121 | + this.rerunTtinfo = rerunTtinfo; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public GuideboardInfo getRerunLp() { | |
| 125 | + return rerunLp; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public void setRerunLp(GuideboardInfo rerunLp) { | |
| 129 | + this.rerunLp = rerunLp; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public String getRerunTtinfodetailIds() { | |
| 133 | + return rerunTtinfodetailIds; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void setRerunTtinfodetailIds(String rerunTtinfodetailIds) { | |
| 137 | + this.rerunTtinfodetailIds = rerunTtinfodetailIds; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public String getRerunType() { | |
| 141 | + return rerunType; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setRerunType(String rerunType) { | |
| 145 | + this.rerunType = rerunType; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public Line getUseXl() { | |
| 149 | + return useXl; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setUseXl(Line useXl) { | |
| 153 | + this.useXl = useXl; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public GuideboardInfo getUseLp() { | |
| 157 | + return useLp; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setUseLp(GuideboardInfo useLp) { | |
| 161 | + this.useLp = useLp; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public CarConfigInfo getUseCarConfig() { | |
| 165 | + return useCarConfig; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public void setUseCarConfig(CarConfigInfo useCarConfig) { | |
| 169 | + this.useCarConfig = useCarConfig; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public EmployeeConfigInfo getUseEmployeeConfig() { | |
| 173 | + return useEmployeeConfig; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setUseEmployeeConfig(EmployeeConfigInfo useEmployeeConfig) { | |
| 177 | + this.useEmployeeConfig = useEmployeeConfig; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public SysUser getCreateBy() { | |
| 181 | + return createBy; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public void setCreateBy(SysUser createBy) { | |
| 185 | + this.createBy = createBy; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public SysUser getUpdateBy() { | |
| 189 | + return updateBy; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void setUpdateBy(SysUser updateBy) { | |
| 193 | + this.updateBy = updateBy; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public Date getCreateDate() { | |
| 197 | + return createDate; | |
| 198 | + } | |
| 199 | + | |
| 200 | + public void setCreateDate(Date createDate) { | |
| 201 | + this.createDate = createDate; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public Date getUpdateDate() { | |
| 205 | + return updateDate; | |
| 206 | + } | |
| 207 | + | |
| 208 | + public Boolean getIsCancel() { | |
| 209 | + return isCancel; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void setIsCancel(Boolean isCancel) { | |
| 213 | + this.isCancel = isCancel; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public void setUpdateDate(Date updateDate) { | |
| 217 | + this.updateDate = updateDate; | |
| 218 | + } | |
| 219 | +} | ... | ... |
src/main/java/com/bsth/entity/search/CustomerSpecs.java
| 1 | 1 | package com.bsth.entity.search; |
| 2 | 2 | |
| 3 | -import java.lang.reflect.Method; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.List; | |
| 6 | -import java.util.Map; | |
| 7 | -import java.util.Set; | |
| 8 | -import java.util.TreeSet; | |
| 9 | - | |
| 10 | -import javax.persistence.criteria.CriteriaBuilder; | |
| 11 | -import javax.persistence.criteria.CriteriaQuery; | |
| 12 | -import javax.persistence.criteria.Path; | |
| 13 | -import javax.persistence.criteria.Predicate; | |
| 14 | -import javax.persistence.criteria.Root; | |
| 15 | - | |
| 3 | +import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException; | |
| 16 | 4 | import org.apache.commons.lang3.StringUtils; |
| 17 | 5 | import org.slf4j.Logger; |
| 18 | 6 | import org.slf4j.LoggerFactory; |
| 19 | 7 | import org.springframework.data.jpa.domain.Specification; |
| 20 | 8 | |
| 21 | -import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException; | |
| 9 | +import javax.persistence.criteria.*; | |
| 10 | +import java.lang.reflect.Method; | |
| 11 | +import java.util.*; | |
| 22 | 12 | |
| 23 | 13 | /** |
| 24 | 14 | * |
| ... | ... | @@ -74,6 +64,14 @@ public class CustomerSpecs<T> implements Specification<T> { |
| 74 | 64 | // 值为空的不参与查询 |
| 75 | 65 | if (value == null || (value instanceof String && value.equals(""))) |
| 76 | 66 | continue; |
| 67 | + | |
| 68 | + // 如果是布尔值,转换,限定 'true','false' 字符串 | |
| 69 | + if ("true".equals(value)) { | |
| 70 | + value = Boolean.TRUE; | |
| 71 | + } | |
| 72 | + if ("false".equals(value)) { | |
| 73 | + value = Boolean.FALSE; | |
| 74 | + } | |
| 77 | 75 | |
| 78 | 76 | try { |
| 79 | 77 | if(!eSet.contains(searchs[1])) | ... | ... |
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| 1 | 1 | package com.bsth.entity.search; |
| 2 | 2 | |
| 3 | +import javax.persistence.criteria.CriteriaBuilder; | |
| 4 | +import javax.persistence.criteria.Path; | |
| 5 | +import javax.persistence.criteria.Predicate; | |
| 3 | 6 | import java.text.NumberFormat; |
| 4 | 7 | import java.text.ParseException; |
| 5 | 8 | import java.text.SimpleDateFormat; |
| 6 | 9 | import java.util.Date; |
| 7 | 10 | |
| 8 | -import javax.persistence.criteria.CriteriaBuilder; | |
| 9 | -import javax.persistence.criteria.Path; | |
| 10 | -import javax.persistence.criteria.Predicate; | |
| 11 | - | |
| 12 | 11 | /** |
| 13 | 12 | * |
| 14 | 13 | * @ClassName: PredicatesBuilder |
| ... | ... | @@ -44,13 +43,22 @@ public class PredicatesBuilder { |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | - public static Predicate ge(CriteriaBuilder cb,Path<Number> expression, Object object){ | |
| 48 | - try { | |
| 49 | - return cb.ge(expression, nf.parse(object.toString())); | |
| 50 | - } catch (ParseException e) { | |
| 51 | - e.printStackTrace(); | |
| 52 | - return null; | |
| 53 | - } | |
| 46 | + public static Predicate ge(CriteriaBuilder cb,Path<?> expression, Object object){ | |
| 47 | + Class<?> leftType = expression.getJavaType(); | |
| 48 | + Class<?> rightType = object.getClass(); | |
| 49 | + | |
| 50 | + if (leftType.isAssignableFrom(Number.class) && | |
| 51 | + rightType.isAssignableFrom(Number.class)) { // 判定是否是Number类型的子类 | |
| 52 | + return cb.ge((Path<Number>) expression, (Number) object); | |
| 53 | + } else if (leftType.isAssignableFrom(String.class) && | |
| 54 | + rightType.isAssignableFrom(String.class)) { // 判定是否是String类型的子类 | |
| 55 | + return cb.greaterThanOrEqualTo((Path<String>) expression, (String) object); | |
| 56 | + } else if (leftType.isAssignableFrom(Date.class) && | |
| 57 | + rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类 | |
| 58 | + return cb.greaterThanOrEqualTo((Path<Date>) expression, (Date) object); | |
| 59 | + } else { | |
| 60 | + throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); | |
| 61 | + } | |
| 54 | 62 | } |
| 55 | 63 | |
| 56 | 64 | public static Predicate lt(CriteriaBuilder cb,Path<Number> expression, Object object){ |
| ... | ... | @@ -62,13 +70,22 @@ public class PredicatesBuilder { |
| 62 | 70 | } |
| 63 | 71 | } |
| 64 | 72 | |
| 65 | - public static Predicate le(CriteriaBuilder cb,Path<Number> expression, Object object){ | |
| 66 | - try { | |
| 67 | - return cb.le(expression, nf.parse(object.toString())); | |
| 68 | - } catch (ParseException e) { | |
| 69 | - e.printStackTrace(); | |
| 70 | - return null; | |
| 71 | - } | |
| 73 | + public static Predicate le(CriteriaBuilder cb,Path<?> expression, Object object){ | |
| 74 | + Class<?> leftType = expression.getJavaType(); | |
| 75 | + Class<?> rightType = object.getClass(); | |
| 76 | + | |
| 77 | + if (leftType.isAssignableFrom(Number.class) && | |
| 78 | + rightType.isAssignableFrom(Number.class)) { // 判定是否是Number类型的子类 | |
| 79 | + return cb.le((Path<Number>) expression, (Number) object); | |
| 80 | + } else if (leftType.isAssignableFrom(String.class) && | |
| 81 | + rightType.isAssignableFrom(String.class)) { // 判定是否是String类型的子类 | |
| 82 | + return cb.lessThanOrEqualTo((Path<String>) expression, (String) object); | |
| 83 | + } else if (leftType.isAssignableFrom(Date.class) && | |
| 84 | + rightType.isAssignableFrom(Date.class)) { // 判定是否是Date类型的子类 | |
| 85 | + return cb.lessThanOrEqualTo((Path<Date>) expression, (Date) object); | |
| 86 | + } else { | |
| 87 | + throw new RuntimeException("ge 不支持类型组合:" + expression.getJavaType() + ">=" + object.getClass()); | |
| 88 | + } | |
| 72 | 89 | } |
| 73 | 90 | |
| 74 | 91 | public static Predicate prefixLike(CriteriaBuilder cb,Path<String> expression, Object object){ | ... | ... |
src/main/java/com/bsth/filter/ResourceFilter.java
| 1 | -package com.bsth.filter; | |
| 2 | - | |
| 3 | -import java.io.File; | |
| 4 | -import java.io.IOException; | |
| 5 | - | |
| 6 | -import javax.servlet.FilterChain; | |
| 7 | -import javax.servlet.ServletException; | |
| 8 | -import javax.servlet.http.HttpServletRequest; | |
| 9 | -import javax.servlet.http.HttpServletResponse; | |
| 10 | - | |
| 11 | -import org.apache.commons.lang3.StringUtils; | |
| 12 | - | |
| 13 | -import com.bsth.util.RequestUtils; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * | |
| 17 | - * @ClassName: ResourceFilter | |
| 18 | - * @Description: TODO(HTML片段过滤器) | |
| 19 | - * @author PanZhao | |
| 20 | - * @date 2016年3月19日 下午10:10:11 | |
| 21 | - * | |
| 22 | - */ | |
| 23 | -public class ResourceFilter extends BaseFilter { | |
| 24 | - | |
| 25 | - String[] params = new String[]{"no"}; | |
| 26 | - | |
| 27 | - @Override | |
| 28 | - public void doFilter(HttpServletRequest request, | |
| 29 | - HttpServletResponse response, FilterChain chain) | |
| 30 | - throws IOException, ServletException { | |
| 31 | - | |
| 32 | - String uri = request.getRequestURI(); | |
| 33 | - int len = uri.length(); | |
| 34 | - if (RequestUtils.isAjaxRequest(request) || | |
| 35 | - !uri.substring(len - 5, len).equals(".html")) { | |
| 36 | - super.doFilter(request, response, chain); | |
| 37 | - } else { | |
| 38 | - | |
| 39 | - String fPath = this.getClass().getResource("/").getPath() | |
| 40 | - + "static/" + uri; | |
| 41 | - | |
| 42 | - File f = new File(fPath); | |
| 43 | - | |
| 44 | - | |
| 45 | - if (f.exists() && f.isFile() ){ | |
| 46 | - request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);; | |
| 47 | - }else | |
| 48 | - response.sendRedirect("/"); | |
| 49 | - } | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 拼接参数 | |
| 54 | - * @param request | |
| 55 | - * @return | |
| 56 | - */ | |
| 57 | - public String joinParam(HttpServletRequest request){ | |
| 58 | - | |
| 59 | - StringBuilder sb = new StringBuilder(); | |
| 60 | - | |
| 61 | - String v | |
| 62 | - ,url = request.getRequestURI(); | |
| 63 | - for(String p : params){ | |
| 64 | - v = request.getParameter(p); | |
| 65 | - if(!StringUtils.isEmpty(v)) | |
| 66 | - sb.append("&" + p + "=" + v); | |
| 67 | - } | |
| 68 | - | |
| 69 | - if(sb.length() > 0) | |
| 70 | - url += "?" + sb.substring(1, sb.length()); | |
| 71 | - return url; | |
| 72 | - } | |
| 73 | -} | |
| 1 | +package com.bsth.filter; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.IOException; | |
| 5 | + | |
| 6 | +import javax.servlet.FilterChain; | |
| 7 | +import javax.servlet.ServletException; | |
| 8 | +import javax.servlet.http.HttpServletRequest; | |
| 9 | +import javax.servlet.http.HttpServletResponse; | |
| 10 | + | |
| 11 | +import org.apache.commons.lang3.StringUtils; | |
| 12 | + | |
| 13 | +import com.bsth.util.RequestUtils; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * | |
| 17 | + * @ClassName: ResourceFilter | |
| 18 | + * @Description: TODO(HTML片段过滤器) | |
| 19 | + * @author PanZhao | |
| 20 | + * @date 2016年3月19日 下午10:10:11 | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +public class ResourceFilter extends BaseFilter { | |
| 24 | + | |
| 25 | + String[] params = new String[]{"no"}; | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void doFilter(HttpServletRequest request, | |
| 29 | + HttpServletResponse response, FilterChain chain) | |
| 30 | + throws IOException, ServletException { | |
| 31 | + | |
| 32 | + String uri = request.getRequestURI(); | |
| 33 | + int len = uri.length(); | |
| 34 | + if (RequestUtils.isAjaxRequest(request) || | |
| 35 | + !uri.substring(len - 5, len).equals(".html")) { | |
| 36 | + super.doFilter(request, response, chain); | |
| 37 | + } else { | |
| 38 | + | |
| 39 | + String fPath = this.getClass().getResource("/").getPath() | |
| 40 | + + "static/" + uri; | |
| 41 | + | |
| 42 | + File f = new File(fPath); | |
| 43 | + | |
| 44 | + | |
| 45 | + if (f.exists() && f.isFile() ){ | |
| 46 | + request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);; | |
| 47 | + }else | |
| 48 | + response.sendRedirect("/"); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 拼接参数 | |
| 54 | + * @param request | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + public String joinParam(HttpServletRequest request){ | |
| 58 | + | |
| 59 | + StringBuilder sb = new StringBuilder(); | |
| 60 | + | |
| 61 | + String v | |
| 62 | + ,url = request.getRequestURI(); | |
| 63 | + for(String p : params){ | |
| 64 | + v = request.getParameter(p); | |
| 65 | + if(!StringUtils.isEmpty(v)) | |
| 66 | + sb.append("&" + p + "=" + v); | |
| 67 | + } | |
| 68 | + | |
| 69 | + if(sb.length() > 0) | |
| 70 | + url += "?" + sb.substring(1, sb.length()); | |
| 71 | + return url; | |
| 72 | + } | |
| 73 | +} | ... | ... |
src/main/java/com/bsth/oplog/Level.java
0 → 100644
src/main/java/com/bsth/oplog/Log.java
0 → 100644
| 1 | +package com.bsth.oplog; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +public class Log { | |
| 6 | + | |
| 7 | + private String userName; | |
| 8 | + | |
| 9 | + private Long timestamp; | |
| 10 | + | |
| 11 | + private String type; | |
| 12 | + | |
| 13 | + private String level; | |
| 14 | + | |
| 15 | + private String path; | |
| 16 | + | |
| 17 | + private String serverIp; | |
| 18 | + | |
| 19 | + private String clientIp; | |
| 20 | + | |
| 21 | + private String httpData; | |
| 22 | + | |
| 23 | + private Date month; | |
| 24 | + | |
| 25 | + private String callerClass; | |
| 26 | + | |
| 27 | + private String callerMethod; | |
| 28 | + | |
| 29 | + private Integer lineNumber; | |
| 30 | + | |
| 31 | + public String getPath() { | |
| 32 | + return path; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setPath(String path) { | |
| 36 | + this.path = path; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getServerIp() { | |
| 40 | + return serverIp; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setServerIp(String serverIp) { | |
| 44 | + this.serverIp = serverIp; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getHttpData() { | |
| 48 | + return httpData; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setHttpData(String httpData) { | |
| 52 | + this.httpData = httpData; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public Date getMonth() { | |
| 56 | + return month; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setMonth(Date month) { | |
| 60 | + this.month = month; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public String getType() { | |
| 64 | + return type; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setType(String type) { | |
| 68 | + this.type = type; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public String getLevel() { | |
| 72 | + return level; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setLevel(String level) { | |
| 76 | + this.level = level; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public String getCallerClass() { | |
| 80 | + return callerClass; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setCallerClass(String callerClass) { | |
| 84 | + this.callerClass = callerClass; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public String getCallerMethod() { | |
| 88 | + return callerMethod; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setCallerMethod(String callerMethod) { | |
| 92 | + this.callerMethod = callerMethod; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public String getClientIp() { | |
| 96 | + return clientIp; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setClientIp(String clientIp) { | |
| 100 | + this.clientIp = clientIp; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public String getUserName() { | |
| 104 | + return userName; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public void setUserName(String userName) { | |
| 108 | + this.userName = userName; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public Long getTimestamp() { | |
| 112 | + return timestamp; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public void setTimestamp(Long timestamp) { | |
| 116 | + this.timestamp = timestamp; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public Integer getLineNumber() { | |
| 120 | + return lineNumber; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public void setLineNumber(Integer lineNumber) { | |
| 124 | + this.lineNumber = lineNumber; | |
| 125 | + } | |
| 126 | +} | ... | ... |
src/main/java/com/bsth/oplog/db/DBHelper.java
0 → 100644
| 1 | +package com.bsth.oplog.db; | |
| 2 | + | |
| 3 | +import java.util.LinkedList; | |
| 4 | +import java.util.concurrent.TimeUnit; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.boot.CommandLineRunner; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +import com.bsth.Application; | |
| 11 | +import com.bsth.oplog.Log; | |
| 12 | +import com.bsth.oplog.db.mysql.DBPersistence; | |
| 13 | + | |
| 14 | +@Component | |
| 15 | +public class DBHelper implements CommandLineRunner{ | |
| 16 | + | |
| 17 | + private final static int maxBufSize = 1000; | |
| 18 | + private final static int fixedMinute = 10; | |
| 19 | + | |
| 20 | + private static LinkedList<Log> buffer = new LinkedList<>(); | |
| 21 | + | |
| 22 | + @Autowired | |
| 23 | + private FixedTimePersistenceThread fixedTimeThread; | |
| 24 | + | |
| 25 | + public void save(Log log){ | |
| 26 | + buffer.add(log); | |
| 27 | + | |
| 28 | + if(buffer.size() >= maxBufSize) | |
| 29 | + fixedTimeThread.start(); | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Component | |
| 33 | + public static class FixedTimePersistenceThread extends Thread{ | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + DBPersistence persistence; | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public void run() { | |
| 40 | + persistence.batchSave(buffer); | |
| 41 | + } | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void run(String... arg0) throws Exception { | |
| 46 | + Application.mainServices.scheduleWithFixedDelay(fixedTimeThread, fixedMinute, fixedMinute, TimeUnit.MINUTES); | |
| 47 | + } | |
| 48 | +} | ... | ... |
src/main/java/com/bsth/oplog/db/mysql/DBPersistence.java
0 → 100644
| 1 | +package com.bsth.oplog.db.mysql; | |
| 2 | + | |
| 3 | +import java.sql.Date; | |
| 4 | +import java.sql.PreparedStatement; | |
| 5 | +import java.sql.SQLException; | |
| 6 | +import java.util.ArrayList; | |
| 7 | +import java.util.LinkedList; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | |
| 14 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 15 | +import org.springframework.stereotype.Component; | |
| 16 | + | |
| 17 | +import com.bsth.oplog.Log; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * | |
| 21 | + * @ClassName: DBPersistence | |
| 22 | + * @Description: TODO(mysql 批量入库) | |
| 23 | + * @author PanZhao | |
| 24 | + * @date 2016年10月20日 上午9:44:00 | |
| 25 | + * | |
| 26 | + */ | |
| 27 | +@Component | |
| 28 | +public class DBPersistence { | |
| 29 | + | |
| 30 | + @Autowired | |
| 31 | + JdbcTemplate jdbcTemplate; | |
| 32 | + | |
| 33 | + Logger logger = LoggerFactory.getLogger(DBPersistence.class); | |
| 34 | + | |
| 35 | + public void batchSave(LinkedList<Log> list){ | |
| 36 | + String sql = "insert into bsth_c_sys_op_log" | |
| 37 | + + "(timestamp, path, type,level, caller_class, caller_method, user_name, client_ip, server_ip, month, http_data, line_number)" | |
| 38 | + + " values(?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 39 | + | |
| 40 | + | |
| 41 | + List<Log> saveList = new ArrayList<>(list.size()); | |
| 42 | + Log log; | |
| 43 | + while(true){ | |
| 44 | + log = list.poll(); | |
| 45 | + if(log != null) | |
| 46 | + saveList.add(log); | |
| 47 | + else | |
| 48 | + break; | |
| 49 | + } | |
| 50 | + | |
| 51 | + Date month = new Date(System.currentTimeMillis()); | |
| 52 | + | |
| 53 | + try { | |
| 54 | + jdbcTemplate.batchUpdate(sql, new LogBatchPreparedStatementSetter(saveList, month)); | |
| 55 | + } catch (Exception e) { | |
| 56 | + logger.error("操作日志入库失败", e); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + | |
| 60 | + private class LogBatchPreparedStatementSetter implements BatchPreparedStatementSetter{ | |
| 61 | + | |
| 62 | + List<Log> temList; | |
| 63 | + Date month; | |
| 64 | + | |
| 65 | + public LogBatchPreparedStatementSetter(final List<Log> list, Date month){ | |
| 66 | + this.temList = list; | |
| 67 | + this.month = month; | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | |
| 72 | + Log log = temList.get(i); | |
| 73 | + ps.setLong(1, log.getTimestamp()); | |
| 74 | + ps.setString(2, log.getPath()); | |
| 75 | + ps.setString(3, log.getType()); | |
| 76 | + ps.setString(4, log.getLevel()); | |
| 77 | + ps.setString(5, log.getCallerClass()); | |
| 78 | + ps.setString(6, log.getCallerMethod()); | |
| 79 | + ps.setString(7, log.getUserName()); | |
| 80 | + ps.setString(8, log.getClientIp()); | |
| 81 | + ps.setString(9, log.getServerIp()); | |
| 82 | + ps.setDate(10, month); | |
| 83 | + ps.setString(11, log.getHttpData()); | |
| 84 | + ps.setObject(12, log.getLineNumber()); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public int getBatchSize() { | |
| 89 | + return temList.size(); | |
| 90 | + } | |
| 91 | + } | |
| 92 | +} | ... | ... |
src/main/java/com/bsth/oplog/db/mysql/db.sql
0 → 100644
| 1 | +CREATE TABLE `bsth_c_sys_op_log` ( | |
| 2 | +`timestamp` bigint(20) NOT NULL , | |
| 3 | +`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 4 | +`caller_class` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 5 | +`caller_method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 6 | +`client_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 7 | +`http_data` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL , | |
| 8 | +`level` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 9 | +`month` date NOT NULL , | |
| 10 | +`path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 11 | +`server_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , | |
| 12 | +`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, | |
| 13 | +`line_number` int(11) NULL DEFAULT NULL | |
| 14 | +) | |
| 15 | +ENGINE=InnoDB | |
| 16 | +DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci | |
| 17 | +ROW_FORMAT=DYNAMIC | |
| 18 | + | |
| 19 | +PARTITION BY RANGE(TO_DAYS (month)) | |
| 20 | +( | |
| 21 | +PARTITION p201610 VALUES LESS THAN (TO_DAYS('2016-11-01')), | |
| 22 | +PARTITION p201611 VALUES LESS THAN (TO_DAYS('2016-12-01')), | |
| 23 | +PARTITION p201612 VALUES LESS THAN (TO_DAYS('2017-01-01')), | |
| 24 | + | |
| 25 | +PARTITION p201701 VALUES LESS THAN (TO_DAYS('2017-02-01')), | |
| 26 | +PARTITION p201702 VALUES LESS THAN (TO_DAYS('2017-03-01')), | |
| 27 | +PARTITION p201703 VALUES LESS THAN (TO_DAYS('2017-04-01')), | |
| 28 | +PARTITION p201704 VALUES LESS THAN (TO_DAYS('2017-05-01')), | |
| 29 | +PARTITION p201705 VALUES LESS THAN (TO_DAYS('2017-06-01')), | |
| 30 | +PARTITION p201706 VALUES LESS THAN (TO_DAYS('2017-07-01')), | |
| 31 | +PARTITION p201707 VALUES LESS THAN (TO_DAYS('2017-08-01')), | |
| 32 | +PARTITION p201708 VALUES LESS THAN (TO_DAYS('2017-09-01')), | |
| 33 | +PARTITION p201709 VALUES LESS THAN (TO_DAYS('2017-10-01')), | |
| 34 | +PARTITION p201710 VALUES LESS THAN (TO_DAYS('2017-11-01')), | |
| 35 | +PARTITION p201711 VALUES LESS THAN (TO_DAYS('2017-12-01')), | |
| 36 | +PARTITION p201712 VALUES LESS THAN (TO_DAYS('2018-01-01')), | |
| 37 | + | |
| 38 | + | |
| 39 | +PARTITION p201801 VALUES LESS THAN (TO_DAYS('2018-02-01')), | |
| 40 | +PARTITION p201802 VALUES LESS THAN (TO_DAYS('2018-03-01')), | |
| 41 | +PARTITION p201803 VALUES LESS THAN (TO_DAYS('2018-04-01')), | |
| 42 | +PARTITION p201804 VALUES LESS THAN (TO_DAYS('2018-05-01')), | |
| 43 | +PARTITION p201805 VALUES LESS THAN (TO_DAYS('2018-06-01')), | |
| 44 | +PARTITION p201806 VALUES LESS THAN (TO_DAYS('2018-07-01')), | |
| 45 | +PARTITION p201807 VALUES LESS THAN (TO_DAYS('2018-08-01')), | |
| 46 | +PARTITION p201808 VALUES LESS THAN (TO_DAYS('2018-09-01')), | |
| 47 | +PARTITION p201809 VALUES LESS THAN (TO_DAYS('2018-10-01')), | |
| 48 | +PARTITION p201810 VALUES LESS THAN (TO_DAYS('2018-11-01')), | |
| 49 | +PARTITION p201811 VALUES LESS THAN (TO_DAYS('2018-12-01')), | |
| 50 | +PARTITION p201812 VALUES LESS THAN (TO_DAYS('2019-01-01')), | |
| 51 | + | |
| 52 | +PARTITION p201901 VALUES LESS THAN (TO_DAYS('2019-02-01')), | |
| 53 | +PARTITION p201902 VALUES LESS THAN (TO_DAYS('2019-03-01')), | |
| 54 | +PARTITION p201903 VALUES LESS THAN (TO_DAYS('2019-04-01')), | |
| 55 | +PARTITION p201904 VALUES LESS THAN (TO_DAYS('2019-05-01')), | |
| 56 | +PARTITION p201905 VALUES LESS THAN (TO_DAYS('2019-06-01')), | |
| 57 | +PARTITION p201906 VALUES LESS THAN (TO_DAYS('2019-07-01')), | |
| 58 | +PARTITION p201907 VALUES LESS THAN (TO_DAYS('2019-08-01')), | |
| 59 | +PARTITION p201908 VALUES LESS THAN (TO_DAYS('2019-09-01')), | |
| 60 | +PARTITION p201909 VALUES LESS THAN (TO_DAYS('2019-10-01')), | |
| 61 | +PARTITION p201910 VALUES LESS THAN (TO_DAYS('2019-11-01')), | |
| 62 | +PARTITION p201911 VALUES LESS THAN (TO_DAYS('2019-12-01')), | |
| 63 | +PARTITION p201912 VALUES LESS THAN (TO_DAYS('2020-01-01')) | |
| 64 | + | |
| 65 | + | |
| 66 | +); | |
| 67 | + | ... | ... |
src/main/java/com/bsth/oplog/http/HttpOpLogInterceptor.java
0 → 100644
| 1 | +package com.bsth.oplog.http; | |
| 2 | + | |
| 3 | +import javax.servlet.http.HttpServletRequest; | |
| 4 | +import javax.servlet.http.HttpServletResponse; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Component; | |
| 8 | +import org.springframework.util.AntPathMatcher; | |
| 9 | +import org.springframework.util.PathMatcher; | |
| 10 | +import org.springframework.web.method.HandlerMethod; | |
| 11 | +import org.springframework.web.servlet.HandlerInterceptor; | |
| 12 | +import org.springframework.web.servlet.ModelAndView; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @ClassName: HttpOpLogger | |
| 17 | + * @Description: TODO(HTTP 接口日志拦截器) | |
| 18 | + * @author PanZhao | |
| 19 | + * @date 2016年10月20日 上午12:03:11 | |
| 20 | + * | |
| 21 | + */ | |
| 22 | +//@Component | |
| 23 | +public class HttpOpLogInterceptor implements HandlerInterceptor { | |
| 24 | + | |
| 25 | + private final PathMatcher pathMatcher = new AntPathMatcher(); | |
| 26 | + | |
| 27 | + // GET 白名单 | |
| 28 | + private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser","/dictionary/**", "/module/findByCurrentUser", "/gps/**", "/error/**" }; | |
| 29 | + | |
| 30 | + // POST 白名单 | |
| 31 | + private String[] httpPostWhiteList = { | |
| 32 | + "/control/upstream" | |
| 33 | + }; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + HttpRecorder httpRecorder; | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception arg3) | |
| 40 | + throws Exception { | |
| 41 | + | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object arg2, ModelAndView arg3) | |
| 46 | + throws Exception { | |
| 47 | + | |
| 48 | + String method = request.getMethod(), path = request.getRequestURI(); | |
| 49 | + // white list | |
| 50 | + String[] whiteList = method == "GET" ? httpGetWhiteList : httpPostWhiteList; | |
| 51 | + | |
| 52 | + if (!isWhiteURL(whiteList, path)) | |
| 53 | + httpRecorder.record(request, (HandlerMethod)arg2); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object arg2) throws Exception { | |
| 58 | + | |
| 59 | + return true; | |
| 60 | + } | |
| 61 | + | |
| 62 | + private boolean isWhiteURL(String[] whiteList, String currentURL) { | |
| 63 | + for (String whiteURL : whiteList) { | |
| 64 | + if (pathMatcher.match(whiteURL, currentURL)) { | |
| 65 | + return true; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + return false; | |
| 69 | + } | |
| 70 | +} | ... | ... |
src/main/java/com/bsth/oplog/http/HttpRecorder.java
0 → 100644
| 1 | +package com.bsth.oplog.http; | |
| 2 | + | |
| 3 | +import java.lang.reflect.Method; | |
| 4 | +import java.net.InetAddress; | |
| 5 | +import java.net.UnknownHostException; | |
| 6 | + | |
| 7 | +import javax.servlet.http.HttpServletRequest; | |
| 8 | + | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.stereotype.Component; | |
| 13 | +import org.springframework.web.method.HandlerMethod; | |
| 14 | + | |
| 15 | +import com.alibaba.fastjson.JSON; | |
| 16 | +import com.bsth.entity.sys.SysUser; | |
| 17 | +import com.bsth.oplog.Level; | |
| 18 | +import com.bsth.oplog.Log; | |
| 19 | +import com.bsth.oplog.db.DBHelper; | |
| 20 | +import com.bsth.security.util.SecurityUtils; | |
| 21 | +import com.bsth.util.IpUtils; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * | |
| 25 | + * @ClassName: HttpRecorder | |
| 26 | + * @Description: TODO(HTTP 日志记录器) | |
| 27 | + * @author PanZhao | |
| 28 | + * @date 2016年10月20日 下午12:56:56 | |
| 29 | + * | |
| 30 | + */ | |
| 31 | +@Component | |
| 32 | +public class HttpRecorder { | |
| 33 | + | |
| 34 | + Logger logger = LoggerFactory.getLogger(HttpRecorder.class); | |
| 35 | + | |
| 36 | + private final static int httpDataMaxLen = 500; | |
| 37 | + | |
| 38 | + @Autowired | |
| 39 | + DBHelper persistenceBuff; | |
| 40 | + | |
| 41 | + public void record(HttpServletRequest request, HandlerMethod method){ | |
| 42 | + Log log = new Log(); | |
| 43 | + | |
| 44 | + log.setType(request.getMethod().toUpperCase()); | |
| 45 | + log.setLevel(Level.INFO.toString()); | |
| 46 | + try { | |
| 47 | + log.setServerIp(InetAddress.getLocalHost().getHostAddress()); | |
| 48 | + } catch (UnknownHostException e) { | |
| 49 | + e.printStackTrace(); | |
| 50 | + } | |
| 51 | + | |
| 52 | + log.setPath(request.getRequestURI()); | |
| 53 | + //Caller | |
| 54 | + Method refMethod = method.getMethod(); | |
| 55 | + log.setCallerClass(refMethod.getDeclaringClass().getName()); | |
| 56 | + log.setCallerMethod(refMethod.getName()); | |
| 57 | + | |
| 58 | + //Primary Key | |
| 59 | + log.setTimestamp(System.currentTimeMillis()); | |
| 60 | + | |
| 61 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 62 | + if(user != null) | |
| 63 | + log.setUserName(user.getUserName()); | |
| 64 | + //request | |
| 65 | + log.setClientIp(IpUtils.getIpAddr(request)); | |
| 66 | + log.setHttpData(httpData(request)); | |
| 67 | + | |
| 68 | + //save | |
| 69 | + persistenceBuff.save(log); | |
| 70 | + } | |
| 71 | + | |
| 72 | + private String httpData(HttpServletRequest request){ | |
| 73 | + String rs = JSON.toJSONString(request.getParameterMap()); | |
| 74 | + | |
| 75 | + if(rs.length() > httpDataMaxLen) | |
| 76 | + rs = rs.substring(0, httpDataMaxLen); | |
| 77 | + | |
| 78 | + return rs.replaceAll("\"", "‘"); | |
| 79 | + } | |
| 80 | +} | ... | ... |
src/main/java/com/bsth/oplog/normal/OpLogger.java
0 → 100644
| 1 | +package com.bsth.oplog.normal; | |
| 2 | + | |
| 3 | +import java.net.InetAddress; | |
| 4 | +import java.net.UnknownHostException; | |
| 5 | + | |
| 6 | +import javax.servlet.http.HttpServletRequest; | |
| 7 | + | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +import com.bsth.entity.sys.SysUser; | |
| 12 | +import com.bsth.oplog.Log; | |
| 13 | +import com.bsth.oplog.db.DBHelper; | |
| 14 | +import com.bsth.security.util.SecurityUtils; | |
| 15 | +import com.bsth.util.IpUtils; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @ClassName: OpLogger | |
| 20 | + * @Description: TODO(常规的操作日志记录器) | |
| 21 | + * @author PanZhao | |
| 22 | + * @date 2016年10月21日 上午12:52:30 | |
| 23 | + * | |
| 24 | + */ | |
| 25 | +@Component | |
| 26 | +public class OpLogger { | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + DBHelper dbHelper; | |
| 30 | + | |
| 31 | + public void info(String path){ | |
| 32 | + save(getInitLog(path)); | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void info(String path, HttpServletRequest request){ | |
| 36 | + Log log = getInitLog(path); | |
| 37 | + | |
| 38 | + if(request != null){ | |
| 39 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 40 | + if(user != null) | |
| 41 | + log.setUserName(user.getUserName()); | |
| 42 | + | |
| 43 | + log.setClientIp(IpUtils.getIpAddr(request)); | |
| 44 | + } | |
| 45 | + | |
| 46 | + save(log); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void info(String path, HttpServletRequest request, String description){ | |
| 50 | + | |
| 51 | + } | |
| 52 | + | |
| 53 | + public static Log getInitLog(String path){ | |
| 54 | + Log log = new Log(); | |
| 55 | + log.setTimestamp(System.currentTimeMillis()); | |
| 56 | + log.setPath(path); | |
| 57 | + log.setType("NORMAL"); | |
| 58 | + | |
| 59 | + //get caller | |
| 60 | + StackTraceElement[] stack = (new Throwable()).getStackTrace(); | |
| 61 | + //注意调用链的顺序,此时2为实际调用者 | |
| 62 | + StackTraceElement caller = stack[2]; | |
| 63 | + | |
| 64 | + log.setCallerClass(caller.getClassName()); | |
| 65 | + log.setCallerMethod(caller.getMethodName()); | |
| 66 | + log.setLineNumber(caller.getLineNumber()); | |
| 67 | + | |
| 68 | + try { | |
| 69 | + log.setServerIp(InetAddress.getLocalHost().getHostAddress()); | |
| 70 | + } catch (UnknownHostException e) { | |
| 71 | + e.printStackTrace(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + return log; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void save(Log log){ | |
| 78 | + dbHelper.save(log); | |
| 79 | + } | |
| 80 | +} | ... | ... |
src/main/java/com/bsth/repository/CarsRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import org.springframework.data.jpa.repository.Query; | |
| 3 | 6 | import org.springframework.stereotype.Repository; |
| 4 | 7 | |
| 5 | 8 | import com.bsth.entity.Cars; |
| ... | ... | @@ -7,4 +10,6 @@ import com.bsth.entity.Cars; |
| 7 | 10 | @Repository |
| 8 | 11 | public interface CarsRepository extends BaseRepository<Cars, Integer>{ |
| 9 | 12 | |
| 13 | + @Query(value="select s from Cars s where s.id in(select e.cl.id from CarConfigInfo e where e.xl.id = ?1) ") | |
| 14 | + List<Cars> findCarsByLineId(Integer lineId); | |
| 10 | 15 | } | ... | ... |
src/main/java/com/bsth/repository/PersonnelRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.Personnel; | |
| 4 | - | |
| 5 | 3 | import java.util.List; |
| 6 | 4 | |
| 5 | +import com.bsth.entity.Personnel; | |
| 7 | 6 | import org.springframework.data.jpa.repository.Query; |
| 8 | 7 | import org.springframework.stereotype.Repository; |
| 9 | 8 | |
| ... | ... | @@ -12,4 +11,10 @@ import org.springframework.stereotype.Repository; |
| 12 | 11 | */ |
| 13 | 12 | @Repository |
| 14 | 13 | public interface PersonnelRepository extends BaseRepository<Personnel, Integer> { |
| 14 | + | |
| 15 | + @Query(value="select s from Personnel s where s.id in(select e.jsy.id from EmployeeConfigInfo e where e.xl.id = ?1) ") | |
| 16 | + List<Personnel> findJsysByLineId(Integer lineId); | |
| 17 | + | |
| 18 | + @Query(value="select s from Personnel s where s.id in(select e.spy.id from EmployeeConfigInfo e where e.xl.id = ?1) ") | |
| 19 | + List<Personnel> findSpysByLineId(Integer lineId); | |
| 15 | 20 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
| ... | ... | @@ -58,7 +58,7 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 58 | 58 | |
| 59 | 59 | "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+ |
| 60 | 60 | |
| 61 | - "?6 , GEOMFROMTEXT(?7) , GEOMFROMTEXT(?8) , ?9 , ?10 ,"+ | |
| 61 | + "?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+ | |
| 62 | 62 | |
| 63 | 63 | "?11 , ?12 , ?13 , ?14 , ?15 ,"+ |
| 64 | 64 | |
| ... | ... | @@ -83,8 +83,8 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 83 | 83 | @Transactional |
| 84 | 84 | @Modifying |
| 85 | 85 | @Query(value="UPDATE bsth_c_section SET " + |
| 86 | - "gsection_vector = GEOMFROMTEXT(?2) , " + | |
| 87 | - "bsection_vector = GEOMFROMTEXT(?3)," + | |
| 86 | + "gsection_vector = ST_GeomFromText(?2) , " + | |
| 87 | + "bsection_vector = ST_GeomFromText(?3)," + | |
| 88 | 88 | "section_code = ?4," + |
| 89 | 89 | "section_name = ?5," + |
| 90 | 90 | "croses_road = ?6," + | ... | ... |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| ... | ... | @@ -157,4 +157,9 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 157 | 157 | " FROM bsth_c_sectionroute c " + |
| 158 | 158 | " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) |
| 159 | 159 | List<Object[]> sectionRouteVector(Integer lineId,Integer directions); |
| 160 | + | |
| 161 | + @Transactional | |
| 162 | + @Modifying | |
| 163 | + @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) | |
| 164 | + void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); | |
| 160 | 165 | } | ... | ... |
src/main/java/com/bsth/repository/SectionSpeedRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import org.springframework.data.jpa.repository.Modifying; | |
| 6 | +import org.springframework.data.jpa.repository.Query; | |
| 7 | +import org.springframework.stereotype.Repository; | |
| 8 | +import org.springframework.transaction.annotation.Transactional; | |
| 9 | + | |
| 10 | +import com.bsth.entity.SectionSpeed; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * @description TODO(路段限速持久层) | |
| 14 | + * | |
| 15 | + * @author Administrator | |
| 16 | + * | |
| 17 | + * @date 2016年9月21日 13:31:25 | |
| 18 | + */ | |
| 19 | +@Repository | |
| 20 | +public interface SectionSpeedRepository extends BaseRepository<SectionSpeed, Integer>{ | |
| 21 | + | |
| 22 | + | |
| 23 | + @Transactional | |
| 24 | + @Modifying | |
| 25 | + @Query(value="INSERT INTO bsth_c_sectionspeed (" + | |
| 26 | + "line , line_code , directions , `code` , s_name,road,road_code ) " + | |
| 27 | + " VALUES (" + | |
| 28 | + "?1 , ?2 , ?3 , ?4 , ?5,?6,?7)", nativeQuery=true) | |
| 29 | + /** @description TODO(路段限速保存) @param (<line:线路ID;versions:版本号;destroy:是否撤销;directions:方向;sValue:限速;code:路段序号> )*/ | |
| 30 | + /** @param (<lineCode:线路编码;sName:路段名称;sType:路段类型;bLineStr:路段矢量百度坐标;gLineStr:路段矢量WGS坐标;descriptions:说明>)*/ | |
| 31 | + void add(Integer line,String lineCode,Integer directions,Integer code,String sName,Integer road,String road_code); | |
| 32 | + | |
| 33 | + @Transactional | |
| 34 | + @Modifying | |
| 35 | + @Query(value="INSERT INTO bsth_c_road("+ | |
| 36 | + "broad_vector,groad_vector,road_code,road_name,speed,id)"+ | |
| 37 | + " VALUES(" + | |
| 38 | + "ST_GeomFromText(?1),ST_GeomFromText(?2),?3,?4,?5,?6)", nativeQuery=true) | |
| 39 | + void insertRoad(String broad_vector,String groad_vector,String road_code,String road_name,Double speed,Integer id); | |
| 40 | + | |
| 41 | + @Query(value="SELECT b.`name` as linename, a.speedid, a.bLineStr ,a.line_code,a.s_name,a.speed ,a.line,a.codenumb,a.road,a.directions FROM ("+ | |
| 42 | + " SELECT p.id AS speedid,p.line,p.line_code,p.road,p.directions,p.`code` AS codenumb,p.s_name,ST_AsText(r.broad_vector) AS bLineStr,r.speed FROM ("+ | |
| 43 | + " SELECT s.id,s.line,s.line_code,s.road,s.directions,s.`code`,s.s_name FROM bsth_c_sectionspeed s where s.line =?1 and s.line_code=?2 and s.directions=?3) p LEFT JOIN bsth_c_road r ON p.road = r.id) a "+ | |
| 44 | + " LEFT JOIN bsth_c_line b ON a.line = b.id ORDER BY codenumb asc",nativeQuery = true) | |
| 45 | + List<Object[]> getSectionSpeedInfo(int lineId, String lineCode, int directions); | |
| 46 | + | |
| 47 | + /** 获取路网数据 */ | |
| 48 | + @Query(value="SELECT ST_AsText(g.bdjw) as SHAPE , id as id ,ldbh,mc FROM jjwgps_t_gjldb g where g.bdjw is not null ",nativeQuery = true) | |
| 49 | + List<Object[]> getroadNet(); | |
| 50 | + | |
| 51 | + /** */ | |
| 52 | + @Query(value="SELECT ST_Contains(ST_Buffer(ST_GeomFromText(?1),0.0005),ST_GeomFromText(?2)) AS result",nativeQuery = true) | |
| 53 | + int ST_Contains(String g1,String g2); | |
| 54 | + | |
| 55 | + | |
| 56 | + @Query(value="SELECT id FROM bsth_c_road r where r.road_code = ?1",nativeQuery = true) | |
| 57 | + Integer validateRoade(String raodCode); | |
| 58 | + | |
| 59 | + @Transactional | |
| 60 | + @Modifying | |
| 61 | + @Query(value="UPDATE bsth_c_sectionspeed set `code` =?1 where id=?2",nativeQuery = true) | |
| 62 | + void roadUpdCode(Integer code,Integer sSpeedId); | |
| 63 | + | |
| 64 | + @Transactional | |
| 65 | + @Modifying | |
| 66 | + @Query(value="UPDATE bsth_c_road set road_name = ?1 ,speed =?2 where id= ?3",nativeQuery = true) | |
| 67 | + void sSpeedUpd(String roadName,Double speed ,Integer id); | |
| 68 | + | |
| 69 | +} | ... | ... |
src/main/java/com/bsth/repository/StationRepository.java
| ... | ... | @@ -61,7 +61,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> { |
| 61 | 61 | "create_by,update_by,id) " + |
| 62 | 62 | " VALUES(" + |
| 63 | 63 | "?1 , ?2 , ?3 , ?4 , ?5," + |
| 64 | - "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," + | |
| 64 | + "?6 , ?7 , ?8 , ?9 , ST_GeomFromText(?10),ST_GeomFromText(?11)," + | |
| 65 | 65 | "?12 ,?13, ?14, ?15, ?16," + |
| 66 | 66 | "?17,?18,?19)", nativeQuery=true) |
| 67 | 67 | public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints, |
| ... | ... | @@ -93,8 +93,8 @@ public interface StationRepository extends BaseRepository<Station, Integer> { |
| 93 | 93 | "g_laty = ?7 , " + |
| 94 | 94 | "x = ?8 , " + |
| 95 | 95 | "y = ?9 , " + |
| 96 | - "b_polygon_grid = GeomFromText(?10) , " + | |
| 97 | - "g_polygon_grid = GeomFromText(?11) , " + | |
| 96 | + "b_polygon_grid = ST_GeomFromText(?10) , " + | |
| 97 | + "g_polygon_grid = ST_GeomFromText(?11) , " + | |
| 98 | 98 | "destroy = ?12 , " + |
| 99 | 99 | "radius = ?13 , " + |
| 100 | 100 | "shapes_type = ?14 , " + | ... | ... |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| 1 | 1 | package com.bsth.repository.oil; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 3 | 4 | import java.util.List; |
| 5 | +import java.util.Map; | |
| 4 | 6 | |
| 5 | 7 | import org.springframework.data.jpa.repository.Modifying; |
| 6 | 8 | import org.springframework.data.jpa.repository.Query; |
| ... | ... | @@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ |
| 19 | 21 | */ |
| 20 | 22 | @Transactional |
| 21 | 23 | @Modifying |
| 22 | - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)-to_days(rq)=1",nativeQuery=true) | |
| 24 | + @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1" | |
| 25 | + + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and " | |
| 26 | + + " to_days(?1)-to_days(b.rq)=1 ) group by nbbm",nativeQuery=true) | |
| 23 | 27 | List<Ylb> obtainYlbefore(String rq); |
| 24 | 28 | |
| 25 | 29 | /** |
| ... | ... | @@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ |
| 31 | 35 | @Modifying |
| 32 | 36 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true) |
| 33 | 37 | List<Ylb> obtainYl(String rq); |
| 38 | + | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 查询当天总的加注量和总里程 | |
| 42 | + * @param rq | |
| 43 | + * @return | |
| 44 | + */ | |
| 45 | + @Transactional | |
| 46 | + @Modifying | |
| 47 | + @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true) | |
| 48 | + List<Object[]> sumLcYl(String nbbm,Date rq); | |
| 34 | 49 | } | ... | ... |
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
| ... | ... | @@ -21,4 +21,10 @@ public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{ |
| 21 | 21 | @Modifying |
| 22 | 22 | @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true) |
| 23 | 23 | List<Ylxxb> obtainYlxx(String rq); |
| 24 | + | |
| 25 | + @Transactional | |
| 26 | + @Modifying | |
| 27 | + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nbbm =?2 and jylx=1",nativeQuery=true) | |
| 28 | + List<Ylxxb> obtainYlxx2(String rq,String nbbm); | |
| 29 | + | |
| 24 | 30 | } | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -20,7 +20,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 20 | 20 | List<ScheduleRealInfo> findByLines(List<String> lines); |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName order by (lpName+1)") | |
| 23 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") | |
| 24 | 24 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 25 | 25 | |
| 26 | 26 | @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") |
| ... | ... | @@ -83,4 +83,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 83 | 83 | |
| 84 | 84 | @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual") |
| 85 | 85 | List<Map<String,Object>> yesterdayDataList(String line,String date); |
| 86 | + | |
| 87 | + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | |
| 88 | + List<ScheduleRealInfo> setLD(String date); | |
| 89 | + | |
| 90 | + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh") | |
| 91 | + List<ScheduleRealInfo> setLDGroup(String date); | |
| 92 | + | |
| 93 | + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh") | |
| 94 | + List<ScheduleRealInfo> setLCYHGroup(String date); | |
| 95 | + | |
| 96 | + @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm") | |
| 97 | + List<ScheduleRealInfo> setDDRBGroup(String date); | |
| 86 | 98 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/GuideboardInfoRepository.java
| 1 | 1 | package com.bsth.repository.schedule; |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | +import java.util.Map; | |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 6 | 7 | import com.bsth.entity.schedule.GuideboardInfo; |
| ... | ... | @@ -29,4 +30,11 @@ public interface GuideboardInfoRepository extends BaseRepository<GuideboardInfo, |
| 29 | 30 | |
| 30 | 31 | @Query(value = " SELECT g FROM GuideboardInfo g where g.lpName like ?1") |
| 31 | 32 | List<GuideboardInfo> findLpName(String lpName); |
| 33 | + | |
| 34 | + @Query(value = "" + | |
| 35 | + "select new map(td.lp.id as lpId, td.lp.lpName as lpName) " + | |
| 36 | + "from TTInfoDetail td " + | |
| 37 | + "where td.ttinfo.id=?1 " + | |
| 38 | + "group by td.ttinfo.id, td.lp.id, td.lp.lpName") | |
| 39 | + List<Map<String, Object>> findLpName(Long ttid); | |
| 32 | 40 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/RerunRuleRepository.java
0 → 100644
| 1 | +package com.bsth.repository.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.rule.RerunRule; | |
| 4 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | |
| 5 | +import com.bsth.repository.BaseRepository; | |
| 6 | +import org.springframework.data.domain.Page; | |
| 7 | +import org.springframework.data.domain.Pageable; | |
| 8 | +import org.springframework.data.jpa.domain.Specification; | |
| 9 | +import org.springframework.data.jpa.repository.EntityGraph; | |
| 10 | +import org.springframework.data.jpa.repository.Query; | |
| 11 | +import org.springframework.stereotype.Repository; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by xu on 16/10/18. | |
| 15 | + */ | |
| 16 | +@Repository | |
| 17 | +public interface RerunRuleRepository extends BaseRepository<RerunRule, Long> { | |
| 18 | + @EntityGraph(value = "dylp", type = EntityGraph.EntityGraphType.FETCH) | |
| 19 | + @Override | |
| 20 | + Page<RerunRule> findAll(Specification<RerunRule> spec, Pageable pageable); | |
| 21 | + | |
| 22 | + @EntityGraph(value = "dylp", type = EntityGraph.EntityGraphType.FETCH) | |
| 23 | + @Query("select cc from RerunRule cc where cc.id=?1") | |
| 24 | + RerunRule findOneExtend(Long aLong); | |
| 25 | +} | ... | ... |
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
| 1 | 1 | package com.bsth.repository.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Cars; | |
| 3 | 4 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | 5 | import com.bsth.repository.BaseRepository; |
| 5 | 6 | |
| ... | ... | @@ -24,8 +25,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 24 | 25 | List<SchedulePlanInfo> findByDate(Date date); |
| 25 | 26 | |
| 26 | 27 | Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate); |
| 27 | - | |
| 28 | - | |
| 28 | + | |
| 29 | 29 | @Query(value = " select " + |
| 30 | 30 | "xl as xlId, " + |
| 31 | 31 | "xl_name as xlName, " + |
| ... | ... | @@ -45,7 +45,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 45 | 45 | "where bc_type = 'out' and " + |
| 46 | 46 | "xl = ?1 and " + |
| 47 | 47 | "schedule_date = ?2 " + |
| 48 | - "group by xl_name, schedule_date, lp_name " + | |
| 48 | + "group by xl_name, schedule_date, lp, lp_name, cl, cl_zbh " + | |
| 49 | 49 | "order by xl_name, schedule_date, lp ", nativeQuery = true) |
| 50 | 50 | List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate); |
| 51 | 51 | |
| ... | ... | @@ -117,5 +117,8 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 117 | 117 | @Param("p5") Date scheduleDate, |
| 118 | 118 | @Param("p6") String lpName, |
| 119 | 119 | @Param("p7") Integer spyId_src); |
| 120 | + | |
| 121 | + @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 order by s.xlBm,clZbh,lp,xlDir") | |
| 122 | + List<SchedulePlanInfo> findLineScheduleBc(String scheduleDate); | |
| 120 | 123 | |
| 121 | 124 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
| ... | ... | @@ -35,4 +35,7 @@ public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Lon |
| 35 | 35 | @Query(value = "select max(tt.fcno) as mx from bsth_c_s_ttinfo_detail tt where tt.xl =?1 and tt.ttinfo =?2", nativeQuery = true) |
| 36 | 36 | Long findMaxFcno(Integer xlid, Long ttinfoid); |
| 37 | 37 | |
| 38 | + @Query(value = "select tt from TTInfoDetail tt where tt.xl.id = ?1 and tt.ttinfo.id = ?2 and tt.lp.id = ?3 order by tt.fcno asc") | |
| 39 | + List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId); | |
| 40 | + | |
| 38 | 41 | } | ... | ... |
src/main/java/com/bsth/security/SecurityMetadataSourceService.java
| ... | ... | @@ -66,8 +66,6 @@ public class SecurityMetadataSourceService implements |
| 66 | 66 | String method = invocation.getRequest().getMethod(); |
| 67 | 67 | String url = method.toLowerCase() + "#" + invocation.getRequestUrl(); |
| 68 | 68 | |
| 69 | - System.out.println(url); | |
| 70 | - | |
| 71 | 69 | int symIndex = url.indexOf("?"); |
| 72 | 70 | if(symIndex != -1){ |
| 73 | 71 | url = url.substring(0, symIndex); | ... | ... |
src/main/java/com/bsth/service/SectionSpeedService.java
0 → 100644
| 1 | +package com.bsth.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.bsth.entity.SectionSpeed; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 16/5/31. | |
| 10 | + */ | |
| 11 | +public interface SectionSpeedService extends BaseService<SectionSpeed, Integer> { | |
| 12 | + | |
| 13 | + /** @description TODO(新增路段限速) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/ | |
| 14 | + Map<String, Object> add(Map<String, Object> map); | |
| 15 | + | |
| 16 | + /** @description TODO(修改路段) @return map ({status:SUCCESS}成功 或者 {status:ERROR}失败) @param map (路段限速信息)*/ | |
| 17 | + Map<String, Object> roadUpd(Map<String, Object> map); | |
| 18 | + | |
| 19 | + List<Map<String, Object>> getSectionSpeedInfo(Map<String, Object> map); | |
| 20 | + | |
| 21 | + /** 解析路段 */ | |
| 22 | + List<Map<String, Object>> analyticSection(Map<String,Object> map); | |
| 23 | + | |
| 24 | +} | ... | ... |
src/main/java/com/bsth/service/TrafficManageService.java
| ... | ... | @@ -20,10 +20,54 @@ import com.bsth.entity.Line; |
| 20 | 20 | public interface TrafficManageService { |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * 获取线路编码 | |
| 23 | + * 上传线路信息 | |
| 24 | 24 | * |
| 25 | - * @return long <lineCode:线路编码> | |
| 25 | + * @return 调用接口返回信息 | |
| 26 | 26 | */ |
| 27 | 27 | String setXL(); |
| 28 | 28 | |
| 29 | + /** | |
| 30 | + * 上传车辆信息 | |
| 31 | + * | |
| 32 | + * @return 调用接口返回信息 | |
| 33 | + */ | |
| 34 | + String setCL(); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 上传司机信息 | |
| 38 | + * @return 调用接口返回信息 | |
| 39 | + */ | |
| 40 | + String setSJ(); | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 上传超速数据 | |
| 44 | + * | |
| 45 | + * @return 调用接口返回信息 | |
| 46 | + */ | |
| 47 | + String setCS(); | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 上传线路班次时刻表数据 | |
| 51 | + * | |
| 52 | + * @return 调用接口返回信息 | |
| 53 | + */ | |
| 54 | + String setSKB(String ids); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 线路人员车辆配置信息 | |
| 58 | + * @return 调用接口返回信息 | |
| 59 | + */ | |
| 60 | + String setXLPC(); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 线路计划班次表 | |
| 64 | + * @return 调用接口返回信息 | |
| 65 | + */ | |
| 66 | + String setJHBC(); | |
| 67 | + | |
| 68 | + String setLD(); | |
| 69 | + | |
| 70 | + String setLCYH(); | |
| 71 | + | |
| 72 | + String setDDRB(); | |
| 29 | 73 | } | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveService.java
| ... | ... | @@ -7,6 +7,7 @@ import java.util.Map; |
| 7 | 7 | import com.bsth.entity.directive.D60; |
| 8 | 8 | import com.bsth.entity.directive.D64; |
| 9 | 9 | import com.bsth.entity.directive.D80; |
| 10 | +import com.bsth.entity.directive.DC0_A3; | |
| 10 | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | 12 | import com.bsth.service.BaseService; |
| 12 | 13 | |
| ... | ... | @@ -82,4 +83,10 @@ public interface DirectiveService extends BaseService<D60, Integer>{ |
| 82 | 83 | Map<String, Object> findAll80(Map<String, Object> map, int page, int size); |
| 83 | 84 | |
| 84 | 85 | D64 save64(D64 d64); |
| 86 | + | |
| 87 | + int sendC0A4(String nbbm); | |
| 88 | + | |
| 89 | + int sendC0A3(DC0_A3 c0a4); | |
| 90 | + | |
| 91 | + int sendC0A5(String json); | |
| 85 | 92 | } | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -30,6 +30,7 @@ import com.bsth.data.schedule.DayOfSchedule; |
| 30 | 30 | import com.bsth.entity.directive.D60; |
| 31 | 31 | import com.bsth.entity.directive.D64; |
| 32 | 32 | import com.bsth.entity.directive.D80; |
| 33 | +import com.bsth.entity.directive.DC0_A3; | |
| 33 | 34 | import com.bsth.entity.directive.Directive; |
| 34 | 35 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 35 | 36 | import com.bsth.entity.sys.SysUser; |
| ... | ... | @@ -273,8 +274,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 273 | 274 | return null; |
| 274 | 275 | } |
| 275 | 276 | } |
| 276 | - upDown = gpsData.getUpDown(); | |
| 277 | - state = gpsData.getState(); | |
| 277 | + else{ | |
| 278 | + upDown = gpsData.getUpDown(); | |
| 279 | + state = gpsData.getState(); | |
| 280 | + } | |
| 278 | 281 | } else { |
| 279 | 282 | upDown = Integer.parseInt(sch.getXlDir()); |
| 280 | 283 | state = 0; |
| ... | ... | @@ -470,4 +473,32 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 470 | 473 | public D64 save64(D64 d64) { |
| 471 | 474 | return d64Repository.save(d64); |
| 472 | 475 | } |
| 476 | + | |
| 477 | + @Override | |
| 478 | + public int sendC0A4(String nbbm) { | |
| 479 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 480 | + | |
| 481 | + Map<String, Object> c0a4 = new HashMap<>(); | |
| 482 | + c0a4.put("deviceId", deviceId); | |
| 483 | + c0a4.put("timestamp", System.currentTimeMillis()); | |
| 484 | + c0a4.put("operCode", (short)0xC0); | |
| 485 | + | |
| 486 | + Map<String, Object> data = new HashMap<>(); | |
| 487 | + data.put("deviceId", deviceId); | |
| 488 | + data.put("operCode2", (short)0xA4); | |
| 489 | + c0a4.put("data", data); | |
| 490 | + | |
| 491 | + return GatewayHttpUtils.postJson(JSON.toJSONString(c0a4)); | |
| 492 | + } | |
| 493 | + | |
| 494 | + @Override | |
| 495 | + public int sendC0A3(DC0_A3 c0a3) { | |
| 496 | + GatewayHttpUtils.postJson(JSON.toJSONString(c0a3)); | |
| 497 | + return 0; | |
| 498 | + } | |
| 499 | + | |
| 500 | + @Override | |
| 501 | + public int sendC0A5(String json) { | |
| 502 | + return GatewayHttpUtils.postJson(json); | |
| 503 | + } | |
| 473 | 504 | } | ... | ... |
src/main/java/com/bsth/service/impl/CarDeviceServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 3 | 4 | import com.bsth.entity.CarDevice; |
| 5 | +import com.bsth.entity.Cars; | |
| 6 | +import com.bsth.entity.schedule.rule.RerunRule; | |
| 7 | +import com.bsth.repository.CarDeviceRepository; | |
| 8 | +import com.bsth.repository.CarsRepository; | |
| 4 | 9 | import com.bsth.service.CarDeviceService; |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | 11 | import org.springframework.stereotype.Service; |
| 6 | 12 | |
| 13 | +import javax.transaction.Transactional; | |
| 14 | +import java.util.HashMap; | |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 7 | 17 | /** |
| 8 | 18 | * Created by xu on 16/6/15. |
| 9 | 19 | */ |
| 10 | 20 | @Service |
| 11 | 21 | public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService { |
| 22 | + @Autowired | |
| 23 | + private CarDeviceRepository carDeviceRepository; | |
| 24 | + @Autowired | |
| 25 | + private CarsRepository carsRepository; | |
| 26 | + | |
| 27 | + @Transactional | |
| 28 | + @Override | |
| 29 | + public Map<String, Object> save(CarDevice carDevice) { | |
| 30 | + Map<String, Object> map = new HashMap<>(); | |
| 31 | + | |
| 32 | + try { | |
| 33 | + // 查找对应的车辆基础信息,更新设备编号数据 | |
| 34 | + Cars cars = carsRepository.findOne(carDevice.getCl()); | |
| 35 | + cars.setEquipmentCode(carDevice.getNewDeviceNo()); | |
| 36 | + // 保存车辆设备信息 | |
| 37 | + carDeviceRepository.save(carDevice); | |
| 38 | + map.put("status", ResponseCode.SUCCESS); | |
| 39 | + map.put("t", carDevice); | |
| 40 | + } catch(Exception e) { | |
| 41 | + map.put("status", ResponseCode.ERROR); | |
| 42 | + logger.error("save erro.", e); | |
| 43 | + } | |
| 44 | + | |
| 45 | + return map; | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Transactional | |
| 49 | + @Override | |
| 50 | + public Map<String, Object> delete(Long aLong) { | |
| 51 | + // 获取作废数据 | |
| 52 | + CarDevice carDevice = carDeviceRepository.findOne(aLong); | |
| 53 | + | |
| 54 | + toogleIsCancel(carDevice); | |
| 55 | + | |
| 56 | + Map<String, Object> map = new HashMap<>(); | |
| 57 | + map.put("status", ResponseCode.SUCCESS); | |
| 58 | + | |
| 59 | + return map; | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 撤销/作废切换。 | |
| 64 | + * @param rerunRule | |
| 65 | + */ | |
| 66 | + private void toogleIsCancel(CarDevice carDevice) { | |
| 67 | + boolean isCancel = carDevice.getIsCancel(); | |
| 68 | + if (isCancel) { | |
| 69 | + carDevice.setIsCancel(false); | |
| 70 | + } else { | |
| 71 | + carDevice.setIsCancel(true); | |
| 72 | + } | |
| 73 | + } | |
| 12 | 74 | } | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -181,10 +181,14 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 181 | 181 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 182 | 182 | |
| 183 | 183 | // WGS坐标点集合 |
| 184 | - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 184 | + String gsectionVector = null; | |
| 185 | + if(!sectionsWJPpoints.equals("")) | |
| 186 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 185 | 187 | |
| 186 | 188 | // 原坐标点集合 |
| 187 | - String bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | |
| 189 | + String bsectionVectorS = null; | |
| 190 | + if(!sectionsBpoints.equals("")) | |
| 191 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | |
| 188 | 192 | |
| 189 | 193 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 190 | 194 | ... | ... |