Commit f95dc66b9d480d5a51b3a8782a4715a4b7d23614

Authored by 潘钊
1 parent b69e5ebb

update...

src/main/java/com/bsth/controller/realcontrol/RealMapController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
  3 +import com.bsth.data.gpsdata.arrival.GeoCacheData;
  4 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
3 5 import com.bsth.service.realcontrol.RealMapService;
4 6 import org.springframework.beans.factory.annotation.Autowired;
5 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
6 9 import org.springframework.web.bind.annotation.RequestParam;
7 10 import org.springframework.web.bind.annotation.RestController;
8 11  
... ... @@ -74,4 +77,9 @@ public class RealMapController {
74 77 public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){
75 78 return realMapService.multiSectionRoute(codeIdx);
76 79 }
  80 +
  81 + @RequestMapping(value = "/lockAndFlxedTimeEnabled", method = RequestMethod.POST)
  82 + public void lockAndFlxedTimeEnabled(TimedEnableStationRoute tes){
  83 + GeoCacheData.tesMap.put(tes.getLineCode(), tes);
  84 + }
77 85 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata.arrival;
2 2  
3 3 import com.bsth.data.gpsdata.GpsEntity;
4 4 import com.bsth.data.gpsdata.arrival.entity.StationRoute;
  5 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
5 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 7 import com.bsth.data.gpsdata.arrival.utils.StationRouteComp;
7 8 import com.google.common.collect.ArrayListMultimap;
... ... @@ -53,6 +54,10 @@ public class GeoCacheData {
53 54 //线路限速信息
54 55 private static Map<String, Double> speedLimitMap;
55 56  
  57 + //需要定时刷新的站点路由
  58 + public static Map<String, TimedEnableStationRoute> tesMap = new HashMap<>();
  59 + //TimedEnableStationRoute
  60 +
56 61 @Autowired
57 62 JdbcTemplate jdbcTemplate;
58 63  
... ... @@ -282,6 +287,28 @@ public class GeoCacheData {
282 287 connectStationRoute(tempMap.get(key));
283 288 }
284 289  
  290 + //定时启用的站点走向
  291 + if(tesMap.size() > 0){
  292 + List<String> rems = new ArrayList<>();
  293 + long t = System.currentTimeMillis();
  294 + for(TimedEnableStationRoute tes : tesMap.values()){
  295 + if(tes.getEnableTime() > t){
  296 + logger.info("锁住站点路由," + tes.getLineCode());
  297 + tempMap.replaceValues(tes.getLineCode() + "_0", stationCacheMap.get(tes.getLineCode() + "_0"));
  298 + tempMap.replaceValues(tes.getLineCode() + "_1", stationCacheMap.get(tes.getLineCode() + "_1"));
  299 + }
  300 + else
  301 + rems.add(tes.getLineCode());
  302 + }
  303 +
  304 + //remove
  305 + if(rems.size() > 0){
  306 + for(String lineCode : rems){
  307 + logger.info("启用路由," + lineCode);
  308 + tesMap.remove(lineCode);
  309 + }
  310 + }
  311 + }
285 312 stationCacheMap = tempMap;
286 313 routeCodeMap = codeMap;
287 314 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/TimedEnableStationRoute.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.entity;
  2 +
  3 +/**
  4 + * 定时启用站点路由
  5 + * Created by panzhao on 2017/8/28.
  6 + */
  7 +public class TimedEnableStationRoute {
  8 +
  9 + private String lineCode;
  10 +
  11 + private Long enableTime;
  12 +
  13 + public String getLineCode() {
  14 + return lineCode;
  15 + }
  16 +
  17 + public void setLineCode(String lineCode) {
  18 + this.lineCode = lineCode;
  19 + }
  20 +
  21 + public Long getEnableTime() {
  22 + return enableTime;
  23 + }
  24 +
  25 + public void setEnableTime(Long enableTime) {
  26 + this.enableTime = enableTime;
  27 + }
  28 +}
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -117,8 +117,7 @@ public class SchAttrCalculator {
117 117 for(int i = 1; i < len; i ++){
118 118 curr = list.get(i);
119 119  
120   - if(prve.getZdzName().equals(curr.getQdzName())
121   - || prve.getZdzCode().equals(curr.getQdzCode())){
  120 + if(isJoin(prve, curr)){
122 121 curr.setQdzArrDatejh(prve.getZdsj());
123 122 if(StringUtils.isNotEmpty(prve.getZdsjActual()))
124 123 curr.setQdzArrDatesj(prve.getZdsjActual());
... ... @@ -126,6 +125,13 @@ public class SchAttrCalculator {
126 125 prve = curr;
127 126 }
128 127 }
  128 +
  129 + private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) {
  130 + return prve.getZdzName().equals(curr.getQdzName())//名称相等
  131 + || prve.getZdzCode().equals(curr.getQdzCode())//编码相等
  132 + || prve.getZdzName().startsWith(curr.getQdzName())//起始包括
  133 + || curr.getQdzName().startsWith(prve.getZdzName());//起始包括
  134 + }
129 135  
130 136 /**
131 137 *
... ...
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
... ... @@ -64,7 +64,7 @@ input[type=checkbox].disabled{
64 64 position: absolute;
65 65 z-index: 2;
66 66 top: 20px;
67   - background: red;
  67 + background: white;
68 68 color: white;
69 69 padding: 7px 25px 7px 7px;
70 70 right: calc(50% - 250px);
... ... @@ -87,14 +87,17 @@ input[type=checkbox].disabled{
87 87 box-shadow: none;
88 88 }
89 89  
90   -.map-system-msg.flex-left a:before{
91   - content: '老版本地图';
  90 +.map-system-msg.flex-left a.now_map{
  91 + top: 35px;
  92 + width: 50px;
  93 +}
  94 +
  95 +.map-system-msg.flex-left a:after{
92 96 position: absolute;
93 97 width: 100%;
94 98 z-index: 2;
95 99 height: 100%;
96 100 background: #ffffff;
97   - top: 0;
98 101 left: 0;
99 102 text-align: center;
100 103 font-size: 12px;
... ... @@ -102,6 +105,26 @@ input[type=checkbox].disabled{
102 105 color: #969696;
103 106 }
104 107  
  108 +.map-system-msg.flex-left a.old_map:after{
  109 + content: '老版本地图';
  110 + top: 0;
  111 +}
  112 +
  113 +.map-system-msg.flex-left a.now_map>i{
  114 + font-size: 12px;
  115 + vertical-align: top;
  116 + color: #535151;
  117 + margin-top: -1px;
  118 +}
  119 +
  120 +.map-system-msg.flex-left a.now_map:after{
  121 + content: '单屏地图';
  122 + top: 0;
  123 + left: 20px;
  124 + text-align: left;
  125 + text-indent: 7px;
  126 +}
  127 +
105 128 .map-system-msg a:hover{
106 129 text-decoration: none;
107 130 }
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/config.js
... ... @@ -111,6 +111,8 @@ var gb_map_config = (function () {
111 111 function trafficSwitch(val) {
112 112 //修改配置项
113 113 set('traffic', this.checked);
  114 +
  115 + gb_map_imap.call('transparent_line', this.checked);
114 116 gb_map_imap.call('traffic', this.checked);
115 117 }
116 118  
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
... ... @@ -57,6 +57,19 @@ var gb_map_baidu = (function(){
57 57  
58 58 //根据ID保存映射
59 59 polylines[opt.id]=_pLines;
  60 + }
  61 + ,
  62 + transparent_line: function (checked) {
  63 + for(var id in polylines){
  64 + for(var i=0,polyline;polyline=polylines[id][i++];){
  65 + if(polyline.isVisible()){
  66 + if(checked)
  67 + polyline.setStrokeOpacity(0);
  68 + else
  69 + polyline.setStrokeOpacity(1);
  70 + }
  71 + }
  72 + }
60 73 },
61 74 traffic: function (enable) {
62 75 if(enable)
... ...
src/main/resources/static/real_control_v2/mapmonitor/real.html
... ... @@ -6,7 +6,10 @@
6 6 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/progress.gradient.min.css" merge="map_plugins">
7 7  
8 8 <div class="map-system-msg flex-left">
9   - <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"></a>
  9 + <a class="z-depth-2 old_map" href="/pages/mapmonitor/alone/wrap.html" target="_blank"></a>
  10 + <a class="z-depth-2 now_map" href="/real_control_v2/mapmonitor/alone_page/alone_wrap.html" target="_blank">
  11 + <i class="uk-icon-send-o"></i>
  12 + </a>
10 13 </div>
11 14  
12 15 <div id="real_map_container"></div>
... ...