Commit b0ddb170b200513c2f0ea0cea3ed4cea892e68ea
1 parent
d2f2c84d
添加误点提示功能,dubbo配置,相关pom.xml修改,后端GpsController调用dubbo服务,前端修改页面和js
Showing
12 changed files
with
271 additions
and
5 deletions
pom.xml
| ... | ... | @@ -194,6 +194,12 @@ |
| 194 | 194 | <groupId>net.sourceforge.jexcelapi</groupId> |
| 195 | 195 | <artifactId>jxl</artifactId> |
| 196 | 196 | <version>2.6.12</version> |
| 197 | + <exclusions> | |
| 198 | + <exclusion> | |
| 199 | + <groupId>log4j</groupId> | |
| 200 | + <artifactId>log4j</artifactId> | |
| 201 | + </exclusion> | |
| 202 | + </exclusions> | |
| 197 | 203 | </dependency> |
| 198 | 204 | <dependency> |
| 199 | 205 | <groupId>rhino</groupId> |
| ... | ... | @@ -295,6 +301,87 @@ |
| 295 | 301 | <artifactId>jpinyin</artifactId> |
| 296 | 302 | <version>1.1.8</version> |
| 297 | 303 | </dependency> |
| 304 | + | |
| 305 | + <!-- dubbo 需要的jar start --> | |
| 306 | + <dependency> | |
| 307 | + <groupId>com.alibaba</groupId> | |
| 308 | + <artifactId>dubbo</artifactId> | |
| 309 | + <!--<version>2.6.3</version>--> | |
| 310 | + <version>2.5.3</version> | |
| 311 | + <exclusions> | |
| 312 | + <exclusion> | |
| 313 | + <groupId>org.springframework</groupId> | |
| 314 | + <artifactId>spring</artifactId> | |
| 315 | + </exclusion> | |
| 316 | + <exclusion> | |
| 317 | + <groupId>log4j</groupId> | |
| 318 | + <artifactId>log4j</artifactId> | |
| 319 | + </exclusion> | |
| 320 | + </exclusions> | |
| 321 | + </dependency> | |
| 322 | + | |
| 323 | + <dependency> | |
| 324 | + <groupId>org.apache.zookeeper</groupId> | |
| 325 | + <artifactId>zookeeper</artifactId> | |
| 326 | + <version>3.4.5</version> | |
| 327 | + <exclusions> | |
| 328 | + <exclusion> | |
| 329 | + <groupId>log4j</groupId> | |
| 330 | + <artifactId>log4j</artifactId> | |
| 331 | + </exclusion> | |
| 332 | + <exclusion> | |
| 333 | + <groupId>org.slf4j</groupId> | |
| 334 | + <artifactId>slf4j-log4j12</artifactId> | |
| 335 | + </exclusion> | |
| 336 | + </exclusions> | |
| 337 | + </dependency> | |
| 338 | + | |
| 339 | + <dependency> | |
| 340 | + <groupId>com.101tec</groupId> | |
| 341 | + <artifactId>zkclient</artifactId> | |
| 342 | + <version>0.3</version> | |
| 343 | + <exclusions> | |
| 344 | + <exclusion> | |
| 345 | + <groupId>log4j</groupId> | |
| 346 | + <artifactId>log4j</artifactId> | |
| 347 | + </exclusion> | |
| 348 | + </exclusions> | |
| 349 | + </dependency> | |
| 350 | + | |
| 351 | + <!-- plan common工程依赖 --> | |
| 352 | + <dependency> | |
| 353 | + <groupId>com.bsth.control_v2</groupId> | |
| 354 | + <artifactId>plan_module-common</artifactId> | |
| 355 | + <version>1.0-SNAPSHOT</version> | |
| 356 | + </dependency> | |
| 357 | + <!-- plan common config 工程依赖 --> | |
| 358 | + <dependency> | |
| 359 | + <groupId>com.bsth.control_v2</groupId> | |
| 360 | + <artifactId>plan_module-common-config</artifactId> | |
| 361 | + <version>1.0-SNAPSHOT</version> | |
| 362 | + </dependency> | |
| 363 | + <!-- real common 依赖 --> | |
| 364 | + <dependency> | |
| 365 | + <groupId>com.bsth.control_v3</groupId> | |
| 366 | + <artifactId>real_module-common</artifactId> | |
| 367 | + <version>0.0.1-SNAPSHOT</version> | |
| 368 | + </dependency> | |
| 369 | + <dependency> | |
| 370 | + <groupId>org.slf4j</groupId> | |
| 371 | + <artifactId>slf4j-api</artifactId> | |
| 372 | + <version>1.7.7</version> | |
| 373 | + </dependency> | |
| 374 | + <dependency> | |
| 375 | + <groupId>ch.qos.logback</groupId> | |
| 376 | + <artifactId>logback-classic</artifactId> | |
| 377 | + <version>1.1.3</version> | |
| 378 | + </dependency> | |
| 379 | + <dependency> | |
| 380 | + <groupId>org.slf4j</groupId> | |
| 381 | + <artifactId>log4j-over-slf4j</artifactId> | |
| 382 | + <version>1.7.7</version> | |
| 383 | + </dependency> | |
| 384 | + | |
| 298 | 385 | </dependencies> |
| 299 | 386 | |
| 300 | 387 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/controller/gps/GpsController.java
| 1 | 1 | package com.bsth.controller.gps; |
| 2 | 2 | |
| 3 | +import com.alibaba.dubbo.config.annotation.Reference; | |
| 4 | +import com.bsth.control_v3.real_module.common.dto.VehicleArrivalStopRealMonitorDto; | |
| 5 | +import com.bsth.control_v3.real_module.common.service.LateReminderServiceFacade; | |
| 3 | 6 | import com.bsth.data.BasicData; |
| 4 | 7 | import com.bsth.data.gpsdata_v2.GpsRealData; |
| 5 | 8 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| ... | ... | @@ -10,6 +13,8 @@ import com.bsth.data.schedule.e_state_check.entity.SCodeInfo; |
| 10 | 13 | import com.bsth.service.gps.GpsService; |
| 11 | 14 | import com.bsth.service.gps.entity.GpsSpeed; |
| 12 | 15 | import com.google.common.base.Splitter; |
| 16 | +import org.slf4j.Logger; | |
| 17 | +import org.slf4j.LoggerFactory; | |
| 13 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 19 | import org.springframework.web.bind.annotation.*; |
| 15 | 20 | |
| ... | ... | @@ -23,6 +28,8 @@ import java.util.Map; |
| 23 | 28 | @RestController |
| 24 | 29 | @RequestMapping("gps") |
| 25 | 30 | public class GpsController { |
| 31 | + /** 日志处理器 */ | |
| 32 | + private static final Logger LOG = LoggerFactory.getLogger(GpsController.class); | |
| 26 | 33 | |
| 27 | 34 | @Autowired |
| 28 | 35 | GpsRealData gpsRealData; |
| ... | ... | @@ -33,6 +40,9 @@ public class GpsController { |
| 33 | 40 | @Autowired |
| 34 | 41 | OverspeedProcess overspeedProcess; |
| 35 | 42 | |
| 43 | + @Reference | |
| 44 | + LateReminderServiceFacade lateReminderServiceFacade; | |
| 45 | + | |
| 36 | 46 | @RequestMapping(value = "/real/all") |
| 37 | 47 | public Map<String, Object> search(@RequestParam Map<String, Object> map, |
| 38 | 48 | @RequestParam(defaultValue = "0") int page, |
| ... | ... | @@ -62,8 +72,21 @@ public class GpsController { |
| 62 | 72 | //班次站点检查信息 |
| 63 | 73 | List<SCodeInfo> scis = ScheduleStationCodeChecker.findByLineIdx(lineArray); |
| 64 | 74 | |
| 75 | + // 扩展到达站预测时间(使用外部模块处理) | |
| 76 | + Map<String, VehicleArrivalStopRealMonitorDto> arrivalStopRealMonitorMap = new HashMap<>(); | |
| 77 | + if (lateReminderServiceFacade == null) { | |
| 78 | + LOG.warn("LateReminderServiceFacade服务未导入,请检查dubbo相关配置!"); | |
| 79 | + } | |
| 80 | + try { | |
| 81 | + // 按照车牌作为key,映射map | |
| 82 | + arrivalStopRealMonitorMap.putAll(lateReminderServiceFacade.getVehicleArrivalStopRealMonitorInfo_cph(lineArray)); | |
| 83 | + } catch (Exception exp) { | |
| 84 | + LOG.warn("LateReminderServiceFacade远端调用异常,请检查dubbo服务部署情况!", exp); | |
| 85 | + } | |
| 86 | + | |
| 65 | 87 | rs.put("gpsList", gpsList); |
| 66 | 88 | rs.put("overspeedList", overspeedList); |
| 89 | + rs.put("arrivalStopRealMonitorMap", arrivalStopRealMonitorMap); | |
| 67 | 90 | rs.put("scis", scis); |
| 68 | 91 | return rs; |
| 69 | 92 | } | ... | ... |
src/main/resources/application-dev.properties
src/main/resources/application-prod.properties
src/main/resources/dubbo/config-dev.properties
0 → 100644
| 1 | +# application名字 | |
| 2 | +spring.dubbo.application.name=bsth_control_v_multi_service | |
| 3 | +# zookeeper注册中心地址 | |
| 4 | +spring.dubbo.registry=zookeeper://127.0.0.1:2181 | |
| 5 | +# protocol配置 | |
| 6 | +spring.dubbo.protocol.name=dubbo | |
| 7 | +spring.dubbo.protocol.port=30881 | |
| 8 | + | |
| 9 | +#----------- dubbo:consumer 性能调优选项 -------------# | |
| 10 | +# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | |
| 11 | +spring.dubbo.consumer.timeout=1800000 | |
| 12 | +# 远程服务调用重试次数,0表示不需要重试 | |
| 13 | +spring.dubbo.consumer.retries=0 | |
| 14 | +#----------- dubbo:consumer 服务治理选项 -------------# | |
| 15 | +# 启动不检查提供者是否存在 | |
| 16 | +spring.dubbo.consumer.check=false | ... | ... |
src/main/resources/dubbo/config-prod.properties
0 → 100644
| 1 | +# application名字 | |
| 2 | +spring.dubbo.application.name=bsth_control_v_multi_service | |
| 3 | +# zookeeper注册中心地址 | |
| 4 | +spring.dubbo.registry=zookeeper://127.0.0.1:2181 | |
| 5 | +# protocol配置 | |
| 6 | +spring.dubbo.protocol.name=dubbo | |
| 7 | +spring.dubbo.protocol.port=30881 | |
| 8 | + | |
| 9 | +#----------- dubbo:consumer 性能调优选项 -------------# | |
| 10 | +# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | |
| 11 | +spring.dubbo.consumer.timeout=1800000 | |
| 12 | +# 远程服务调用重试次数,0表示不需要重试 | |
| 13 | +spring.dubbo.consumer.retries=0 | |
| 14 | +#----------- dubbo:consumer 服务治理选项 -------------# | |
| 15 | +# 启动不检查提供者是否存在 | |
| 16 | +spring.dubbo.consumer.check=false | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
| ... | ... | @@ -17,7 +17,13 @@ |
| 17 | 17 | <span class="abnormal-text">已离线</span> |
| 18 | 18 | {{/if}} |
| 19 | 19 | </a> |
| 20 | + | |
| 21 | + {{if _as_isLate}} | |
| 22 | + <button class="uk-button uk-button-mini uk-button-primary">预测误点</button> | |
| 23 | + {{/if}} | |
| 20 | 24 | </div> |
| 25 | + | |
| 26 | + | |
| 21 | 27 | <div> |
| 22 | 28 | <span class="field">车牌号:</span>{{plateNo}} |
| 23 | 29 | </div> |
| ... | ... | @@ -47,9 +53,18 @@ |
| 47 | 53 | <span class="field">速度:</span>{{speed>99?'..':speed}}</div> |
| 48 | 54 | <div> |
| 49 | 55 | <span class="field">时间:</span>{{dateStr}}</div> |
| 50 | - {{if expectStopTime!=null}} | |
| 51 | - <div> | |
| 52 | - 预计 {{expectStopTime}} 分钟到达终点</div> | |
| 56 | + <!--{{if expectStopTime!=null}}--> | |
| 57 | + <!--<div>--> | |
| 58 | + <!--预计 {{expectStopTime}} 分钟到达终点</div>--> | |
| 59 | + <!--{{/if}}--> | |
| 60 | + | |
| 61 | + | |
| 62 | + {{if _plan_ftime}} | |
| 63 | + <div>计划 {{_plan_ftime}} 到达终点站</div> | |
| 64 | + {{/if}} | |
| 65 | + | |
| 66 | + {{if _as_ftime}} | |
| 67 | + <div>预计 {{_as_ftime}} 到达终点站</div> | |
| 53 | 68 | {{/if}} |
| 54 | 69 | </div> |
| 55 | 70 | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_gps.js
| ... | ... | @@ -61,6 +61,9 @@ var gb_data_gps = (function () { |
| 61 | 61 | this.sch = schArray[this.schId]; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + // 误点提示信息 | |
| 65 | + refreshData_lateReminder(rs, this); | |
| 66 | + | |
| 64 | 67 | //时间格式化 |
| 65 | 68 | this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss'); |
| 66 | 69 | realData[this.deviceId] = this; |
| ... | ... | @@ -81,6 +84,36 @@ var gb_data_gps = (function () { |
| 81 | 84 | |
| 82 | 85 | }; |
| 83 | 86 | |
| 87 | + var refreshData_lateReminder = function(rs, gps) { | |
| 88 | + // 到站实时数据信息(用于计算误点) | |
| 89 | + var _arrivalStopRealMonitorMap = rs.arrivalStopRealMonitorMap; | |
| 90 | + | |
| 91 | + // 获取cph | |
| 92 | + var _cph = gps.nbbm && gb_data_basic.nbbm2PlateMap()[gps.nbbm]; | |
| 93 | + // 获取到站提示信息 | |
| 94 | + var _info = _cph && _arrivalStopRealMonitorMap[_cph]; | |
| 95 | + | |
| 96 | + // 获取预计到终点站时间 | |
| 97 | + var _future_time = _info && _info.toFutureStopTime && moment(_info.toFutureStopTime); | |
| 98 | + // 获取计划到终点站时间 | |
| 99 | + var _plan_time = gps.sch && gps.sch.zdsjT && moment(gps.sch.zdsjT); | |
| 100 | + | |
| 101 | + // 设置误点提示 | |
| 102 | + if (_future_time && _plan_time) { | |
| 103 | + if (_future_time.isAfter(_plan_time)) { | |
| 104 | + gps._as_isLate = true; | |
| 105 | + } | |
| 106 | + } | |
| 107 | + | |
| 108 | + // 设置计划到终点站时间提示 | |
| 109 | + gps._plan_ftime = _plan_time && _plan_time.format("HH:mm"); | |
| 110 | + // 设置预计到终点站时间提示 | |
| 111 | + gps._as_ftime = _future_time && _future_time.format("HH:mm"); | |
| 112 | + | |
| 113 | + // console.log(gps.sch); | |
| 114 | + | |
| 115 | + }; | |
| 116 | + | |
| 84 | 117 | var startFixedTime; |
| 85 | 118 | var fixedTimeRefresh = function () { |
| 86 | 119 | if (startFixedTime) | ... | ... |
src/main/resources/static/real_control_v2/js/north/tabs.js
| ... | ... | @@ -68,7 +68,34 @@ var gb_tabs = (function() { |
| 68 | 68 | //文件载入完毕 |
| 69 | 69 | res_load_ep.emitLater('load_tab'); |
| 70 | 70 | |
| 71 | + // 根据gps的相关数据,切换tab页面 | |
| 72 | + var _trigger_tab_Fun = function(gps) { | |
| 73 | + // tab跳转 | |
| 74 | + var tabIndex = 0; | |
| 75 | + var lineCode = gps.lineId; | |
| 76 | + $('.north-tabs .uk-tab li.tab-line').each(function(index, element) { | |
| 77 | + var _code = $(element).data('code'); | |
| 78 | + if (_code == lineCode) { | |
| 79 | + // li.tab-line 是从第3个tab页开始的 | |
| 80 | + tabIndex = index + 2; | |
| 81 | + return false; | |
| 82 | + } | |
| 83 | + }); | |
| 84 | + UIkit.switcher($('.north-tabs>ul.uk-tab')).show(tabIndex); | |
| 85 | + | |
| 86 | + // 班次自动选择 | |
| 87 | + var schId = gps.schId; | |
| 88 | + var sch = gb_schedule_table.findScheduleByLine(lineCode)[schId]; | |
| 89 | + var dl = gb_schedule_table.scroToDl(sch); | |
| 90 | + gb_schedule_table.reset_drag_active_all(dl); | |
| 91 | + dl.find('dd:eq(5)').trigger('click'); | |
| 92 | + | |
| 93 | + // $('.line_schedule[data-id=' + lineCode + '] dl[data-id=' + gps.schId + ']').find('dd:eq(5)').trigger('click'); | |
| 94 | + | |
| 95 | + }; | |
| 96 | + | |
| 71 | 97 | return { |
| 72 | - init: init | |
| 98 | + init: init, | |
| 99 | + triggerTab: _trigger_tab_Fun | |
| 73 | 100 | }; |
| 74 | 101 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
| ... | ... | @@ -297,7 +297,7 @@ var gb_svg_chart = (function () { |
| 297 | 297 | |
| 298 | 298 | abmStatus = this['abnormalStatus']; |
| 299 | 299 | suffix = ''; |
| 300 | - if(abmStatus != 'offline'){ | |
| 300 | + if(abmStatus != 'offline') { | |
| 301 | 301 | this['abnormalClaszz'] = true; |
| 302 | 302 | if(abmStatus=='outBounds') |
| 303 | 303 | suffix = '界'; |
| ... | ... | @@ -307,6 +307,12 @@ var gb_svg_chart = (function () { |
| 307 | 307 | suffix = '掉'; |
| 308 | 308 | else |
| 309 | 309 | this['abnormalClaszz'] = false; |
| 310 | + | |
| 311 | + // 误点提示 | |
| 312 | + if (this['_as_isLate']) { | |
| 313 | + this['abnormalClaszz'] = true; | |
| 314 | + suffix += "误"; // suffix叠加 | |
| 315 | + } | |
| 310 | 316 | } |
| 311 | 317 | else |
| 312 | 318 | this['abnormalClaszz'] = false; | ... | ... |
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
| ... | ... | @@ -45,6 +45,14 @@ var gb_svg_tooltip = (function () { |
| 45 | 45 | visible: function () { |
| 46 | 46 | show_baidu_map($('.tip_map_wrap', this)[0], gps); |
| 47 | 47 | rect.dblclick(fiexdTip); |
| 48 | + | |
| 49 | + if (gps._as_isLate) { // 存在误点可点击 | |
| 50 | + var _tool_tip_ = this; | |
| 51 | + $('button', _tool_tip_).click(function() { | |
| 52 | + gb_tabs.triggerTab(gps); | |
| 53 | + $(_tool_tip_).qtip("hide"); | |
| 54 | + }); | |
| 55 | + } | |
| 48 | 56 | } |
| 49 | 57 | } |
| 50 | 58 | }); | ... | ... |
src/main/resources/static/real_control_v2_mobile/js/utils/svg_chart_tooltip.js
| ... | ... | @@ -14,6 +14,7 @@ var gb_svg_tooltip = (function () { |
| 14 | 14 | return; |
| 15 | 15 | var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); |
| 16 | 16 | addPlateNo(gps); |
| 17 | + addLateReminder(gps); | |
| 17 | 18 | $(this).qtip({ |
| 18 | 19 | show: { |
| 19 | 20 | ready: true, |
| ... | ... | @@ -219,6 +220,36 @@ var gb_svg_tooltip = (function () { |
| 219 | 220 | }catch (e){} |
| 220 | 221 | } |
| 221 | 222 | |
| 223 | + /** | |
| 224 | + * 为GPS附加误点提示功能 | |
| 225 | + * @param gpsArray | |
| 226 | + */ | |
| 227 | + function addLateReminder(gpsArray) { | |
| 228 | + if (!isArray(gpsArray)) | |
| 229 | + gpsArray = [gpsArray]; | |
| 230 | + try { | |
| 231 | + $.each(gpsArray, function() { | |
| 232 | + // 计算误点提示的相关字段 | |
| 233 | + if (this.plateNo) { | |
| 234 | + var _info = gb_data_gps.getArrivalStopRealMonitorInfoByCph(this.plateNo); | |
| 235 | + if (_info) { | |
| 236 | + var _future_time = moment(_info.toFutureStopTime); | |
| 237 | + var _plan_time = moment(this.sch.zdsjT); | |
| 238 | + if (_future_time.isAfter(_plan_time)) { | |
| 239 | + // 可能误点 | |
| 240 | + this._as_isLate = true; | |
| 241 | + } | |
| 242 | + this._as_ftime = _future_time.format("hh:mm"); | |
| 243 | + } | |
| 244 | + } | |
| 245 | + | |
| 246 | + }); | |
| 247 | + } catch (e) { | |
| 248 | + | |
| 249 | + } | |
| 250 | + | |
| 251 | + } | |
| 252 | + | |
| 222 | 253 | return { |
| 223 | 254 | update: updateFixedTip, |
| 224 | 255 | refresh: refresh, | ... | ... |