Commit 922a65c09fe5a152fa374dc37b28f72566ec4395

Authored by 潘钊
1 parent 112c42c9

update...

Showing 22 changed files with 318 additions and 194 deletions
src/main/java/com/bsth/data/BasicData.java
@@ -13,7 +13,6 @@ import org.slf4j.Logger; @@ -13,7 +13,6 @@ import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.boot.CommandLineRunner; 15 import org.springframework.boot.CommandLineRunner;
16 -import org.springframework.core.annotation.Order;  
17 import org.springframework.stereotype.Component; 16 import org.springframework.stereotype.Component;
18 17
19 import java.util.*; 18 import java.util.*;
@@ -26,7 +25,6 @@ import java.util.concurrent.TimeUnit; @@ -26,7 +25,6 @@ import java.util.concurrent.TimeUnit;
26 * @date 2016年8月10日 下午3:27:45 25 * @date 2016年8月10日 下午3:27:45
27 */ 26 */
28 @Component 27 @Component
29 -@Order(value = 1)  
30 public class BasicData implements CommandLineRunner { 28 public class BasicData implements CommandLineRunner {
31 29
32 //公司代码和公司名对照(K: 公司编码,V:公司名) 30 //公司代码和公司名对照(K: 公司编码,V:公司名)
@@ -83,9 +81,13 @@ public class BasicData implements CommandLineRunner { @@ -83,9 +81,13 @@ public class BasicData implements CommandLineRunner {
83 81
84 @Override 82 @Override
85 public void run(String... arg0) throws Exception { 83 public void run(String... arg0) throws Exception {
86 - Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 2, TimeUnit.HOURS); 84 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 2, 2, TimeUnit.HOURS);
87 } 85 }
88 86
  87 + public static String getStationNameByCode(String code, String prefix){
  88 + String name = stationCode2NameMap.get(code);
  89 + return name != null? name: stationCode2NameMap.get(prefix + code);
  90 + }
89 91
90 @Component 92 @Component
91 public static class BasicDataLoader extends Thread { 93 public static class BasicDataLoader extends Thread {
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
@@ -86,7 +86,7 @@ public class ForecastRealServer implements CommandLineRunner { @@ -86,7 +86,7 @@ public class ForecastRealServer implements CommandLineRunner {
86 //终点站 86 //终点站
87 String eStation = null; 87 String eStation = null;
88 //当前执行班次 88 //当前执行班次
89 - ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm); 89 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(nbbm);
90 if(null != sch) 90 if(null != sch)
91 eStation = sch.getZdzCode(); 91 eStation = sch.getZdzCode();
92 92
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -66,22 +66,41 @@ public class GpsRealData implements CommandLineRunner { @@ -66,22 +66,41 @@ public class GpsRealData implements CommandLineRunner {
66 @Override 66 @Override
67 public void run(String... arg0) throws Exception { 67 public void run(String... arg0) throws Exception {
68 logger.info("gpsDataLoader,20,5"); 68 logger.info("gpsDataLoader,20,5");
69 - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); 69 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 30, TimeUnit.SECONDS);
70 } 70 }
71 71
72 public void put(GpsEntity gps) { 72 public void put(GpsEntity gps) {
73 String device = gps.getDeviceId(); 73 String device = gps.getDeviceId();
74 - gpsMap.put(device, gps); 74 + GpsEntity old = gpsMap.get(device);
  75 +
  76 + try {
  77 + if (!StringUtils.isEmpty(gps.getStopNo())) {
  78 + //站点编码改变
  79 + if (null == old || !gps.getStopNo().equals(old.getStopNo())) {
  80 + gps.setArrTime(gps.getTimestamp());
  81 + //预测到达终点时间
  82 + forecastRealServer.forecast(gps.getNbbm(), gps);
  83 + } else {
  84 + gps.setArrTime(old.getArrTime());
  85 + //不预测, 重新计算终点时间
  86 + gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm()));
  87 + }
  88 + }
  89 + } catch (Exception e) {
  90 + logger.error("", e);
  91 + }
75 92
76 - if (StringUtils.isNotBlank(gps.getLineId())){ 93 + //刷新对照
  94 + gpsMap.put(device, gps);
  95 + if (StringUtils.isNotBlank(gps.getLineId())) {
77 //站点名称 96 //站点名称
78 gps.setStationName(getStationName(gps)); 97 gps.setStationName(getStationName(gps));
79 lineCode2Devices.put(gps.getLineId(), device); 98 lineCode2Devices.put(gps.getLineId(), device);
80 } 99 }
81 } 100 }
82 101
83 - public String getStationName(GpsEntity gps){  
84 - return BasicData.stationCode2NameMap.get(gps.getLineId() + "_" + gps.getUpDown() + gps.getStopNo()); 102 + public String getStationName(GpsEntity gps) {
  103 + return BasicData.getStationNameByCode(gps.getStopNo(), gps.getLineId() + "_" + gps.getUpDown() + "_");
85 } 104 }
86 105
87 /** 106 /**
@@ -103,7 +122,7 @@ public class GpsRealData implements CommandLineRunner { @@ -103,7 +122,7 @@ public class GpsRealData implements CommandLineRunner {
103 for (String device : set) { 122 for (String device : set) {
104 gps = gpsMap.get(device); 123 gps = gpsMap.get(device);
105 //过滤异常GPS数据 124 //过滤异常GPS数据
106 - if (gps.isAbnormal()) 125 + if (gps == null || gps.isAbnormal())
107 continue; 126 continue;
108 127
109 sch = dayOfSchedule.execPlanMap().get(gps.getNbbm()); 128 sch = dayOfSchedule.execPlanMap().get(gps.getNbbm());
@@ -206,8 +225,6 @@ public class GpsRealData implements CommandLineRunner { @@ -206,8 +225,6 @@ public class GpsRealData implements CommandLineRunner {
206 gps.setNbbm(nbbm); 225 gps.setNbbm(nbbm);
207 //有更新的点位 226 //有更新的点位
208 updateList.add(gps); 227 updateList.add(gps);
209 - //实时GPS数据集  
210 - gpsRealData.put(gps);  
211 } 228 }
212 //分析数据 229 //分析数据
213 gpsRealAnalyse.analyse(updateList); 230 gpsRealAnalyse.analyse(updateList);
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
1 package com.bsth.data.gpsdata.arrival; 1 package com.bsth.data.gpsdata.arrival;
2 2
3 import com.bsth.data.gpsdata.GpsEntity; 3 import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.GpsRealData;
4 import com.bsth.data.gpsdata.arrival.handlers.*; 5 import com.bsth.data.gpsdata.arrival.handlers.*;
5 import com.bsth.data.gpsdata.arrival.utils.CircleQueue; 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
@@ -33,6 +34,9 @@ public class GpsRealAnalyse { @@ -33,6 +34,9 @@ public class GpsRealAnalyse {
33 @Autowired 34 @Autowired
34 ReverseSignalHandle reverseSignalHandle; 35 ReverseSignalHandle reverseSignalHandle;
35 36
  37 + @Autowired
  38 + GpsRealData gpsRealData;
  39 +
36 //50个线程 40 //50个线程
37 static ExecutorService threadPool = Executors.newFixedThreadPool(50); 41 static ExecutorService threadPool = Executors.newFixedThreadPool(50);
38 42
@@ -45,6 +49,10 @@ public class GpsRealAnalyse { @@ -45,6 +49,10 @@ public class GpsRealAnalyse {
45 try { 49 try {
46 //等待子线程结束 50 //等待子线程结束
47 count.await(); 51 count.await();
  52 +
  53 + //加入实时gps对照
  54 + for(GpsEntity gps: list)
  55 + gpsRealData.put(gps);
48 } catch (InterruptedException e) { 56 } catch (InterruptedException e) {
49 logger.error("", e); 57 logger.error("", e);
50 } 58 }
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -181,7 +181,7 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -181,7 +181,7 @@ public class InOutStationSignalHandle extends SignalHandle{
181 //持久化 181 //持久化
182 dayOfSchedule.save(sch); 182 dayOfSchedule.save(sch);
183 //下发调度指令 183 //下发调度指令
184 - directiveService.send60Dispatch(next, doneSum, "到站@系统"); 184 + //directiveService.send60Dispatch(next, doneSum, "到站@系统");
185 185
186 //准备执行下一个班次 186 //准备执行下一个班次
187 if (next != null) { 187 if (next != null) {
src/main/java/com/bsth/data/gpsdata/arrival/utils/ScheduleSignalState.java
@@ -100,7 +100,8 @@ public class ScheduleSignalState { @@ -100,7 +100,8 @@ public class ScheduleSignalState {
100 100
101 //记录信号状态 101 //记录信号状态
102 SignalState signalState = SignalState.reverseSignalSTate(sch, reverse); 102 SignalState signalState = SignalState.reverseSignalSTate(sch, reverse);
103 - signalStateData.put(signalState); 103 + if(signalState != null)
  104 + signalStateData.put(signalState);
104 } 105 }
105 } 106 }
106 107
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -2,6 +2,8 @@ package com.bsth.data.schedule; @@ -2,6 +2,8 @@ package com.bsth.data.schedule;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
  5 +import com.bsth.Application;
  6 +import com.bsth.data.BasicData;
5 import com.bsth.data.LineConfigData; 7 import com.bsth.data.LineConfigData;
6 import com.bsth.data.directive.FirstScheduleCheckThread; 8 import com.bsth.data.directive.FirstScheduleCheckThread;
7 import com.bsth.data.gpsdata.GpsRealData; 9 import com.bsth.data.gpsdata.GpsRealData;
@@ -33,6 +35,7 @@ import org.springframework.stereotype.Component; @@ -33,6 +35,7 @@ import org.springframework.stereotype.Component;
33 import java.text.ParseException; 35 import java.text.ParseException;
34 import java.text.SimpleDateFormat; 36 import java.text.SimpleDateFormat;
35 import java.util.*; 37 import java.util.*;
  38 +import java.util.concurrent.TimeUnit;
36 39
37 /** 40 /**
38 * @author PanZhao 41 * @author PanZhao
@@ -82,6 +85,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -82,6 +85,9 @@ public class DayOfSchedule implements CommandLineRunner {
82 @Autowired 85 @Autowired
83 GpsRealData gpsRealData; 86 GpsRealData gpsRealData;
84 87
  88 + @Autowired
  89 + BasicData.BasicDataLoader basicDataLoader;
  90 +
85 /** 91 /**
86 * 线路当前使用的排班的日期 92 * 线路当前使用的排班的日期
87 */ 93 */
@@ -122,13 +128,14 @@ public class DayOfSchedule implements CommandLineRunner { @@ -122,13 +128,14 @@ public class DayOfSchedule implements CommandLineRunner {
122 128
123 @Override 129 @Override
124 public void run(String... arg0) throws Exception { 130 public void run(String... arg0) throws Exception {
  131 + basicDataLoader.loadAllData();
125 //从数据库恢复排班 132 //从数据库恢复排班
126 - //dataRecovery(); 133 + dataRecovery();
127 134
128 //翻班线程 135 //翻班线程
129 -// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); 136 + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
130 //入库 137 //入库
131 -// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); 138 + Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
132 //首班出场指令补发器 139 //首班出场指令补发器
133 // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); 140 // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
134 //班次误点扫描 141 //班次误点扫描
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -14,7 +14,6 @@ import com.bsth.repository.schedule.*; @@ -14,7 +14,6 @@ import com.bsth.repository.schedule.*;
14 import com.bsth.service.TrafficManageService; 14 import com.bsth.service.TrafficManageService;
15 import com.bsth.util.TimeUtils; 15 import com.bsth.util.TimeUtils;
16 import com.bsth.util.db.DBUtils_MS; 16 import com.bsth.util.db.DBUtils_MS;
17 -import com.bsth.webService.trafficManage.geotool.services.Internal;  
18 import com.bsth.webService.trafficManage.geotool.services.InternalPortType; 17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 18 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
20 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
@@ -105,7 +104,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -105,7 +104,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
105 104
106 105
107 // 运管处接口 106 // 运管处接口
108 - private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint(); 107 + private InternalPortType portType = null;//new Internal().getInternalHttpSoap11Endpoint();
109 private WebServiceSoap ssop ; 108 private WebServiceSoap ssop ;
110 { 109 {
111 try { 110 try {
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
@@ -17,65 +17,66 @@ import javax.transaction.Transactional; @@ -17,65 +17,66 @@ import javax.transaction.Transactional;
17 import java.util.Map; 17 import java.util.Map;
18 18
19 @Service 19 @Service
20 -public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{ 20 +public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService {
21 21
22 /*@Autowired 22 /*@Autowired
23 - ScheduleRealInfoServiceImpl scheduleRealInfoService;*/  
24 -  
25 - @Autowired  
26 - ScheduleRealInfoRepository scheduleRealInfoRepository;  
27 -  
28 - @Autowired  
29 - ChildTaskPlanRepository childTaskPlanRepository;  
30 -  
31 - @Autowired  
32 - DayOfSchedule dayOfSchedule;  
33 -  
34 - @Autowired  
35 - Arrival2Schedule arrival2Schedule;  
36 -  
37 - @Autowired  
38 - JdbcTemplate jdbcTemplate;  
39 -  
40 - @Transactional  
41 - @Override  
42 - public Map<String, Object> save(ChildTaskPlan t) {  
43 - Map<String, Object> rs;  
44 - //保存起终点名称  
45 - Map<String, String> map = BasicData.stationCode2NameMap;  
46 -  
47 - t.setStartStationName(map.get(t.getStartStation()));  
48 - t.setEndStationName(map.get(t.getEndStation()));  
49 - //先持久化子任务  
50 - rs = super.save(t);  
51 - //再关联主任务  
52 - ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());  
53 - sch.getcTasks().add(t);  
54 - dayOfSchedule.save(sch);  
55 -  
56 - rs.put("t", sch);  
57 -  
58 - if(sch.getZdsjActual() == null)  
59 - arrival2Schedule.removeExpect(sch.getClZbh());  
60 - return rs;  
61 - }  
62 -  
63 - @Override  
64 - public Map<String, Object> delete(Long id) {  
65 - Map<String, Object> rs;  
66 -  
67 - ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);  
68 - //解除和主任务关联  
69 - ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());  
70 - sch.getcTasks().remove(cPlan);  
71 - //删除关联表数据  
72 - jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real="+sch.getId()+" and c_tasks="+cPlan.getId());  
73 -  
74 - //删除子任务  
75 - rs = super.delete(id);  
76 - dayOfSchedule.save(sch);  
77 -  
78 - rs.put("t", sch);  
79 - return rs;  
80 - } 23 + ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
  24 +
  25 + @Autowired
  26 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  27 +
  28 + @Autowired
  29 + ChildTaskPlanRepository childTaskPlanRepository;
  30 +
  31 + @Autowired
  32 + DayOfSchedule dayOfSchedule;
  33 +
  34 + @Autowired
  35 + Arrival2Schedule arrival2Schedule;
  36 +
  37 + @Autowired
  38 + JdbcTemplate jdbcTemplate;
  39 +
  40 + @Transactional
  41 + @Override
  42 + public Map<String, Object> save(ChildTaskPlan t) {
  43 + ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  44 + Map<String, Object> rs;
  45 + //保存起终点名称
  46 + Map<String, String> map = BasicData.stationCode2NameMap;
  47 + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  48 +
  49 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  50 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  51 + //先持久化子任务
  52 + rs = super.save(t);
  53 + //再关联主任务
  54 + sch.getcTasks().add(t);
  55 + dayOfSchedule.save(sch);
  56 +
  57 + rs.put("t", sch);
  58 +
  59 + if (sch.getZdsjActual() == null)
  60 + arrival2Schedule.removeExpect(sch.getClZbh());
  61 + return rs;
  62 + }
  63 +
  64 + @Override
  65 + public Map<String, Object> delete(Long id) {
  66 + Map<String, Object> rs;
  67 +
  68 + ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);
  69 + //解除和主任务关联
  70 + ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
  71 + sch.getcTasks().remove(cPlan);
  72 + //删除关联表数据
  73 + jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real=" + sch.getId() + " and c_tasks=" + cPlan.getId());
  74 +
  75 + //删除子任务
  76 + rs = super.delete(id);
  77 + dayOfSchedule.save(sch);
  78 +
  79 + rs.put("t", sch);
  80 + return rs;
  81 + }
81 } 82 }
src/main/resources/static/real_control_v2/css/main.css
@@ -165,8 +165,8 @@ svg.line-chart g.item:nth-last-child(3)&gt;text { @@ -165,8 +165,8 @@ svg.line-chart g.item:nth-last-child(3)&gt;text {
165 } 165 }
166 166
167 svg.line-chart g.gps-wrap>rect { 167 svg.line-chart g.gps-wrap>rect {
168 - width: 28px;  
169 - height: 24px; 168 + width: 34px;
  169 + height: 18px;
170 /*fill: #fff;*/ 170 /*fill: #fff;*/
171 rx: 4px; 171 rx: 4px;
172 cursor: pointer; 172 cursor: pointer;
@@ -188,7 +188,7 @@ svg.line-chart g.gps-wrap&gt;rect.hover { @@ -188,7 +188,7 @@ svg.line-chart g.gps-wrap&gt;rect.hover {
188 188
189 svg.line-chart g.gps-wrap>text { 189 svg.line-chart g.gps-wrap>text {
190 font-size: 13px; 190 font-size: 13px;
191 - transform: translate(3px, 17px); 191 + transform: translate(2px, 14px);
192 pointer-events: none; 192 pointer-events: none;
193 } 193 }
194 194
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
@@ -19,11 +19,12 @@ @@ -19,11 +19,12 @@
19 </div> 19 </div>
20 <div> 20 <div>
21 <span class="field">速度:</span>{{speed}}</div> 21 <span class="field">速度:</span>{{speed}}</div>
22 - <hr> 22 + <div>
  23 + <span class="field">时间:</span>{{dateStr}}</div>
  24 + {{if expectStopTime!=null}}
23 <div> 25 <div>
24 预计 {{expectStopTime}} 分钟到达终点</div> 26 预计 {{expectStopTime}} 分钟到达终点</div>
25 - <!-- <hr> -->  
26 - <!-- <div class="subtitle">更新时间: 10:34.26</div> --> 27 + {{/if}}
27 <div class="tip_map_wrap"></div> 28 <div class="tip_map_wrap"></div>
28 </div> 29 </div>
29 </div> 30 </div>
@@ -43,12 +44,15 @@ @@ -43,12 +44,15 @@
43 <div> 44 <div>
44 <span class="field">设备:</span>{{gps.deviceId}} 45 <span class="field">设备:</span>{{gps.deviceId}}
45 </div> 46 </div>
46 - <div> 47 + <div style="color: #747272;">
  48 + {{gps.dateStr}}
  49 + </div>
  50 + <!--<div>
47 <span class="field">进站时间:</span>? 51 <span class="field">进站时间:</span>?
48 </div> 52 </div>
49 <div> 53 <div>
50 <span class="field">计划发出:</span>? 54 <span class="field">计划发出:</span>?
51 - </div> 55 + </div>-->
52 56
53 </div> 57 </div>
54 </div> 58 </div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_major.html
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </div> 15 </div>
16 <div class="uk-width-1-2"> 16 <div class="uk-width-1-2">
17 <div class="uk-form-row"> 17 <div class="uk-form-row">
18 - <label class="uk-form-label" style="width: 75px;">放站至</label> 18 + <label class="uk-form-label" style="width: 75px;">放站至</label>
19 <div class="uk-form-controls" style="margin-left: 75px;"> 19 <div class="uk-form-controls" style="margin-left: 75px;">
20 <select name="endStation"> 20 <select name="endStation">
21 </select> 21 </select>
@@ -53,11 +53,31 @@ @@ -53,11 +53,31 @@
53 53
54 var remarks; 54 var remarks;
55 function refreshDirectiveStr() { 55 function refreshDirectiveStr() {
  56 +
  57 + var $qdz = $('[name=startStation]')
  58 + , $zdz = $('[name=endStation]');
56 //指令内容 59 //指令内容
57 - var qdzName = $('[name=startStation]').find("option:selected").text()  
58 - , zdzName = $('[name=endStation]').find("option:selected").text();  
59 - remarks=' 由 ' + qdzName + ' 放站至 ' + zdzName;  
60 - $('[name=directiveStr]', modal).text('班次:'+sch.dfsj+remarks).trigger('input'); 60 + var qdzName = $qdz.find("option:selected").text()
  61 + , zdzName = $zdz.find("option:selected").text();
  62 +
  63 + //只修改起点
  64 + if(sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()){
  65 + remarks = ' 从 '+ sch.qdzName +' 待客至 ' + qdzName + ' ,放站至 ' + zdzName;
  66 + }
  67 + //只修改终点
  68 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()){
  69 + remarks = ' 从 '+ sch.qdzName +' 放站至 ' + zdzName + ' 开始待客';
  70 + }
  71 + //起终点都改变
  72 + else if(sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()){
  73 + remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName + ' 开始待客';
  74 + }
  75 + //起终点都不改变
  76 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()){
  77 + remarks = ' 从 '+ qdzName +' 放站至 ' + zdzName;
  78 + }
  79 +
  80 + $('[name=directiveStr]', modal).text('班次:' + sch.dfsj + remarks).trigger('input');
61 } 81 }
62 82
63 $('[name=startStation]', modal).on('change', function () { 83 $('[name=startStation]', modal).on('change', function () {
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/bc_type_venting.html
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div class="uk-grid"> 6 <div class="uk-grid">
7 <div class="uk-width-1-2"> 7 <div class="uk-width-1-2">
8 <div class="uk-form-row"> 8 <div class="uk-form-row">
9 - <label class="uk-form-label" style="width: 75px;"></label> 9 + <label class="uk-form-label" style="width: 75px;">起点</label>
10 <div class="uk-form-controls" style="margin-left: 75px;"> 10 <div class="uk-form-controls" style="margin-left: 75px;">
11 <select name="startStation"> 11 <select name="startStation">
12 </select> 12 </select>
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </div> 15 </div>
16 <div class="uk-width-1-2"> 16 <div class="uk-width-1-2">
17 <div class="uk-form-row"> 17 <div class="uk-form-row">
18 - <label class="uk-form-label" style="width: 75px;">直放至</label> 18 + <label class="uk-form-label" style="width: 75px;">终点</label>
19 <div class="uk-form-controls" style="margin-left: 75px;"> 19 <div class="uk-form-controls" style="margin-left: 75px;">
20 <select name="endStation"> 20 <select name="endStation">
21 </select> 21 </select>
@@ -53,12 +53,30 @@ @@ -53,12 +53,30 @@
53 53
54 var remarks; 54 var remarks;
55 function refreshDirectiveStr() { 55 function refreshDirectiveStr() {
  56 + var $qdz = $('[name=startStation]')
  57 + , $zdz = $('[name=endStation]');
56 //指令内容 58 //指令内容
57 - var qdzName = $('[name=startStation]').find("option:selected").text()  
58 - , zdzName = $('[name=endStation]').find("option:selected").text(); 59 + var qdzName = $qdz.find("option:selected").text()
  60 + , zdzName = $zdz.find("option:selected").text();
59 61
60 - remarks=' 由 ' + qdzName + ' 直放至 ' + zdzName;  
61 - $('[name=directiveStr]', modal).text('班次:'+sch.dfsj+ remarks).trigger('input'); 62 + //只修改起点
  63 + if(sch.qdzCode != $qdz.val() && sch.zdzCode == $zdz.val()){
  64 + remarks = ' 从 '+ sch.qdzName +' 待客至 ' + qdzName + ' ,直放至 ' + zdzName;
  65 + }
  66 + //只修改终点
  67 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode != $zdz.val()){
  68 + remarks = ' 从 '+ sch.qdzName +' 直放至 ' + zdzName + ' 开始待客';
  69 + }
  70 + //起终点都改变
  71 + else if(sch.qdzCode != $qdz.val() && sch.zdzCode != $zdz.val()){
  72 + remarks = ' 从 '+ qdzName +' 直放至 ' + zdzName + ' 开始待客';
  73 + }
  74 + //起终点都不改变
  75 + else if(sch.qdzCode == $qdz.val() && sch.zdzCode == $zdz.val()){
  76 + remarks = ' 从 '+ qdzName +' 直放至 ' + zdzName;
  77 + }
  78 +
  79 + $('[name=directiveStr]', modal).text('班次:' + sch.dfsj + remarks).trigger('input');
62 } 80 }
63 81
64 $('[name=startStation]', modal).on('change', function () { 82 $('[name=startStation]', modal).on('change', function () {
@@ -98,7 +116,7 @@ @@ -98,7 +116,7 @@
98 f.on('success.form.fv', function (e) { 116 f.on('success.form.fv', function (e) {
99 e.preventDefault(); 117 e.preventDefault();
100 var data = $(this).serializeJSON(); 118 var data = $(this).serializeJSON();
101 - // notify_wait('准备下发指令') 119 + // notify_wait('准备下发指令')
102 //下发指令 120 //下发指令
103 $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) { 121 $.post('/directive/phrase', {nbbm: sch.clZbh, text: data.directiveStr}, function (rs) {
104 if (rs == 0) { 122 if (rs == 0) {
@@ -128,7 +146,10 @@ @@ -128,7 +146,10 @@
128 146
129 function changeBcType() { 147 function changeBcType() {
130 //将班次类型调整为直放 148 //将班次类型调整为直放
131 - gb_common.$post('/realSchedule/changeBcType/'+sch.id, {bcType: 'venting', remarks: remarks}, function(rs){ 149 + gb_common.$post('/realSchedule/changeBcType/' + sch.id, {
  150 + bcType: 'venting',
  151 + remarks: remarks
  152 + }, function (rs) {
132 UIkit.modal(modal).hide(); 153 UIkit.modal(modal).hide();
133 gb_schedule_table.updateSchedule(rs.t); 154 gb_schedule_table.updateSchedule(rs.t);
134 //触发父容器刷新事件 155 //触发父容器刷新事件
src/main/resources/static/real_control_v2/js/data/data_gps.js
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 var gb_data_gps = (function() { 3 var gb_data_gps = (function() {
4 4
5 //fixed time refresh delay 5 //fixed time refresh delay
6 - var delay = 1000 * 6; 6 + var delay = 1000 * 60;
7 //deviceId ——> gps 7 //deviceId ——> gps
8 var realData = {}; 8 var realData = {};
9 //refresh after callback 9 //refresh after callback
@@ -51,8 +51,10 @@ var gb_data_gps = (function() { @@ -51,8 +51,10 @@ var gb_data_gps = (function() {
51 } else 51 } else
52 addArr.push(this); 52 addArr.push(this);
53 //起终点 拼接方向标识 53 //起终点 拼接方向标识
54 - if(this.sEPoint)  
55 - this.stopNo=this.stopNo+'_'+this.upDown; 54 + /*if(this.sEPoint)
  55 + this.stopNo=this.stopNo+'_'+this.upDown;*/
  56 + //时间格式化
  57 + this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
56 realData[this.deviceId] = this; 58 realData[this.deviceId] = this;
57 }); 59 });
58 60
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -190,4 +190,6 @@ var gb_schedule_context_menu = (function() { @@ -190,4 +190,6 @@ var gb_schedule_context_menu = (function() {
190 } 190 }
191 } 191 }
192 }); 192 });
  193 +
  194 + return callbackHandler;
193 })(); 195 })();
src/main/resources/static/real_control_v2/js/line_schedule/dbclick.js
@@ -67,15 +67,23 @@ var gb_schedule_table_dbclick = (function() { @@ -67,15 +67,23 @@ var gb_schedule_table_dbclick = (function() {
67 'cancel': { 67 'cancel': {
68 name: '取消', 68 name: '取消',
69 icon: "delete" 69 icon: "delete"
70 - },  
71 - 'save': {  
72 - name: '保存',  
73 - icon: "edit"  
74 } 70 }
75 } 71 }
76 }); 72 });
  73 +
  74 + var sfsjCellClick = function (elem) {
  75 + elem.dblclick(function () {
  76 +
  77 + var id = $(this).parent().data('id'),
  78 + lineCode = $(this).parents('li.line_schedule').data('id');
  79 +
  80 + var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
  81 + gb_schedule_context_menu.fcxxwt(sch);
  82 + });
  83 + };
77 84
78 return { 85 return {
79 - init: init 86 + init: init,
  87 + sfsjCellClick:sfsjCellClick
80 }; 88 };
81 })(); 89 })();
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -108,6 +108,9 @@ var gb_schedule_table = (function () { @@ -108,6 +108,9 @@ var gb_schedule_table = (function () {
108 } 108 }
109 }); 109 });
110 }); 110 });
  111 +
  112 + //双击
  113 + gb_schedule_table_dbclick.sfsjCellClick($('dd.fcsjActualCell'));
111 } 114 }
112 115
113 //重置序号 116 //重置序号
@@ -192,20 +195,20 @@ var gb_schedule_table = (function () { @@ -192,20 +195,20 @@ var gb_schedule_table = (function () {
192 if (!isArray(schArr)) 195 if (!isArray(schArr))
193 schArr = [schArr]; 196 schArr = [schArr];
194 197
195 - var tMaps={}; 198 + var tMaps = {};
196 $.each(schArr, function () { 199 $.each(schArr, function () {
197 line2Schedule[this.xlBm][this.id] = this; 200 line2Schedule[this.xlBm][this.id] = this;
198 updateDom(this); 201 updateDom(this);
199 //线路_车辆 过滤重复数据 202 //线路_车辆 过滤重复数据
200 - tMaps[this.xlBm+'_'+this.clZbh]=1; 203 + tMaps[this.xlBm + '_' + this.clZbh] = 1;
201 }); 204 });
202 205
203 - /* //重新标记末班  
204 - var ts=[];  
205 - for(var k in tMaps){  
206 - ts = k.split('_');  
207 - markerLastByNbbm(ts[0], ts[1]);  
208 - }*/ 206 + /* //重新标记末班
  207 + var ts=[];
  208 + for(var k in tMaps){
  209 + ts = k.split('_');
  210 + markerLastByNbbm(ts[0], ts[1]);
  211 + }*/
209 }; 212 };
210 213
211 //update dom 214 //update dom
@@ -218,10 +221,10 @@ var gb_schedule_table = (function () { @@ -218,10 +221,10 @@ var gb_schedule_table = (function () {
218 //车辆自编号 221 //车辆自编号
219 $(dds[2]).replaceWith(temps['line-schedule-nbbm-temp'](sch)); 222 $(dds[2]).replaceWith(temps['line-schedule-nbbm-temp'](sch));
220 //if (sch.qdzArrDateJH) 223 //if (sch.qdzArrDateJH)
221 - $(dds[3]).text(sch.qdzArrDateJH?sch.qdzArrDateJH:''); 224 + $(dds[3]).text(sch.qdzArrDateJH ? sch.qdzArrDateJH : '');
222 225
223 //if (sch.qdzArrDateSJ) 226 //if (sch.qdzArrDateSJ)
224 - $(dds[4]).text(sch.qdzArrDateSJ?sch.qdzArrDateSJ:''); 227 + $(dds[4]).text(sch.qdzArrDateSJ ? sch.qdzArrDateSJ : '');
225 228
226 //计发时间 229 //计发时间
227 $(dds[5]).replaceWith(temps['line-schedule-fcsj-temp'](sch)); 230 $(dds[5]).replaceWith(temps['line-schedule-fcsj-temp'](sch));
@@ -229,7 +232,9 @@ var gb_schedule_table = (function () { @@ -229,7 +232,9 @@ var gb_schedule_table = (function () {
229 232
230 //实发时间 233 //实发时间
231 calc_sch_real_shift(sch); 234 calc_sch_real_shift(sch);
232 - var sfsjDd = temps['line-schedule-sfsj-temp'](sch); 235 + var sfsjDd = $(temps['line-schedule-sfsj-temp'](sch));
  236 + //双击
  237 + gb_schedule_table_dbclick.sfsjCellClick(sfsjDd);
233 $(dds[7]).replaceWith(sfsjDd); 238 $(dds[7]).replaceWith(sfsjDd);
234 if (sch.remarks) 239 if (sch.remarks)
235 $(dds[8]).html('<span title="' + sch.remarks + '" data-uk-tooltip="{pos:\'top-left\'}">' + sch.remarks + '</span>'); 240 $(dds[8]).html('<span title="' + sch.remarks + '" data-uk-tooltip="{pos:\'top-left\'}">' + sch.remarks + '</span>');
@@ -239,7 +244,7 @@ var gb_schedule_table = (function () { @@ -239,7 +244,7 @@ var gb_schedule_table = (function () {
239 //信号状态标记 244 //信号状态标记
240 gb_signal_state.marker_sch(sch); 245 gb_signal_state.marker_sch(sch);
241 //班次是车辆的最后一班 246 //班次是车辆的最后一班
242 - if(dl.hasClass('dl-last-sch')) 247 + if (dl.hasClass('dl-last-sch'))
243 markerLastSch([sch]); 248 markerLastSch([sch]);
244 }; 249 };
245 250
@@ -420,13 +425,13 @@ var gb_schedule_table = (function () { @@ -420,13 +425,13 @@ var gb_schedule_table = (function () {
420 425
421 //清除线路下指定班次的 末班标记 426 //清除线路下指定班次的 末班标记
422 var removeMarkers = function (lineCode, array) { 427 var removeMarkers = function (lineCode, array) {
423 - var idx=[]; 428 + var idx = [];
424 $.each(array, function () { 429 $.each(array, function () {
425 idx.push(this.id); 430 idx.push(this.id);
426 }); 431 });
427 432
428 - $('dl.dl-last-sch','li.line_schedule[data-id=' + lineCode + ']').each(function () {  
429 - if($(this).hasClass('dl-last-sch') && idx.indexOf($(this).data('id'))){ 433 + $('dl.dl-last-sch', 'li.line_schedule[data-id=' + lineCode + ']').each(function () {
  434 + if ($(this).hasClass('dl-last-sch') && idx.indexOf($(this).data('id'))) {
430 $(this).removeClass('dl-last-sch').find('.last-sch-sunken').remove(); 435 $(this).removeClass('dl-last-sch').find('.last-sch-sunken').remove();
431 } 436 }
432 }); 437 });
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
1 /* 线路模拟图 */ 1 /* 线路模拟图 */
2 2
3 -var gb_svg_chart = (function() { 3 +var gb_svg_chart = (function () {
4 4
5 //chart height 5 //chart height
6 var chart_height = 123; 6 var chart_height = 123;
@@ -11,22 +11,22 @@ var gb_svg_chart = (function() { @@ -11,22 +11,22 @@ var gb_svg_chart = (function() {
11 //svg namespace 11 //svg namespace
12 var svgns = 'http://www.w3.org/2000/svg'; 12 var svgns = 'http://www.w3.org/2000/svg';
13 13
14 - var calc_text_y = function(t) { 14 + var calc_text_y = function (t) {
15 return (chart_height - (chart_height / t_max_size * t.length)) / 2 + 5; 15 return (chart_height - (chart_height / t_max_size * t.length)) / 2 + 5;
16 }, 16 },
17 - cat_text = function(t) { 17 + cat_text = function (t) {
18 return t.length > t_max_size ? t.substr(0, t_max_size) : t; 18 return t.length > t_max_size ? t.substr(0, t_max_size) : t;
19 }, 19 },
20 - get_width = function(wrap) { 20 + get_width = function (wrap) {
21 return wrap.actual('outerWidth'); 21 return wrap.actual('outerWidth');
22 }, 22 },
23 - get_height = function(wrap) { 23 + get_height = function (wrap) {
24 var h = wrap.actual('outerHeight'); 24 var h = wrap.actual('outerHeight');
25 //隐藏元素取最外层的高度 25 //隐藏元素取最外层的高度
26 return h < 20 ? wrap.parent().actual('outerHeight') - 2 : h; 26 return h < 20 ? wrap.parent().actual('outerHeight') - 2 : h;
27 } 27 }
28 28
29 - var draw_line = function(lineCode, wrap) { 29 + var draw_line = function (lineCode, wrap) {
30 30
31 var data = gb_svg_data_convert.mergeRoute(gb_data_basic.stationRoutes(lineCode)), 31 var data = gb_svg_data_convert.mergeRoute(gb_data_basic.stationRoutes(lineCode)),
32 len = data.length; 32 len = data.length;
@@ -36,22 +36,22 @@ var gb_svg_chart = (function() { @@ -36,22 +36,22 @@ var gb_svg_chart = (function() {
36 //x scale 36 //x scale
37 , 37 ,
38 xScale = d3.scale.linear().range([x_padd, w - x_padd]).domain([0, len - 1]), 38 xScale = d3.scale.linear().range([x_padd, w - x_padd]).domain([0, len - 1]),
39 - cx = function(d, i) { 39 + cx = function (d, i) {
40 return xScale(i); 40 return xScale(i);
41 }, 41 },
42 - cy = function() { 42 + cy = function () {
43 return (h - chart_height) / 2; 43 return (h - chart_height) / 2;
44 }, 44 },
45 - ty = function(d) { 45 + ty = function (d) {
46 return cy() + calc_text_y(cat_text(d.name[0])); 46 return cy() + calc_text_y(cat_text(d.name[0]));
47 } 47 }
48 //line generator 48 //line generator
49 , 49 ,
50 upLine = d3.svg.line().x(xScale).y(cy), 50 upLine = d3.svg.line().x(xScale).y(cy),
51 - downLine = d3.svg.line().x(xScale).y(function() { 51 + downLine = d3.svg.line().x(xScale).y(function () {
52 return cy() + chart_height 52 return cy() + chart_height
53 }), 53 }),
54 - multi_text = function(d, i, that) { 54 + multi_text = function (d, i, that) {
55 55
56 var dText = document.createElementNS(svgns, 'text'), 56 var dText = document.createElementNS(svgns, 'text'),
57 t = cat_text(d.name[1]); 57 t = cat_text(d.name[1]);
@@ -82,14 +82,14 @@ var gb_svg_chart = (function() { @@ -82,14 +82,14 @@ var gb_svg_chart = (function() {
82 'station_link': true 82 'station_link': true
83 }; 83 };
84 items.append('path').classed(p_clzz) 84 items.append('path').classed(p_clzz)
85 - .attr('d', function(d, i) { 85 + .attr('d', function (d, i) {
86 return i < len - 1 ? upLine([i, i + 1]) : ''; 86 return i < len - 1 ? upLine([i, i + 1]) : '';
87 }); 87 });
88 88
89 //down station link path 89 //down station link path
90 p_clzz.down = true; 90 p_clzz.down = true;
91 items.append('path').classed(p_clzz) 91 items.append('path').classed(p_clzz)
92 - .attr('d', function(d, i) { 92 + .attr('d', function (d, i) {
93 return i < len - 1 ? downLine([i, i + 1]) : ''; 93 return i < len - 1 ? downLine([i, i + 1]) : '';
94 }); 94 });
95 95
@@ -97,40 +97,44 @@ var gb_svg_chart = (function() { @@ -97,40 +97,44 @@ var gb_svg_chart = (function() {
97 var c_clzz = { 97 var c_clzz = {
98 'station_circle': true 98 'station_circle': true
99 }; 99 };
100 - items.select(function (d) {return d.type!=1?this:null;}) 100 + items.select(function (d) {
  101 + return d.type != 1 ? this : null;
  102 + })
101 .append('circle').classed(c_clzz) 103 .append('circle').classed(c_clzz)
102 .attr('cx', cx) 104 .attr('cx', cx)
103 .attr('cy', cy) 105 .attr('cy', cy)
104 - .attr('data-id', function(d) { 106 + .attr('data-id', function (d) {
105 return d.id[0]; 107 return d.id[0];
106 }); 108 });
107 109
108 //down circle 110 //down circle
109 c_clzz.down = true; 111 c_clzz.down = true;
110 - items.select(function (d) {return d.type!=0?this:null;}) 112 + items.select(function (d) {
  113 + return d.type != 0 ? this : null;
  114 + })
111 .append('circle').classed(c_clzz) 115 .append('circle').classed(c_clzz)
112 .attr('cx', cx) 116 .attr('cx', cx)
113 - .attr('cy', function(d, i) { 117 + .attr('cy', function (d, i) {
114 return cy(d, i) + chart_height; 118 return cy(d, i) + chart_height;
115 }) 119 })
116 - .attr('data-id', function(d) {  
117 - return d.type==1?d.id[0]:d.id[1]; 120 + .attr('data-id', function (d) {
  121 + return d.type == 1 ? d.id[0] : d.id[1];
118 }); 122 });
119 123
120 //station name text 124 //station name text
121 items.append('text').classed({ 125 items.append('text').classed({
122 - 'station_text': true,  
123 - 'up': function(d) {  
124 - return d.type == 3 ? true : false;  
125 - }  
126 - })  
127 - .text(function(d) { 126 + 'station_text': true,
  127 + 'up': function (d) {
  128 + return d.type == 3 ? true : false;
  129 + }
  130 + })
  131 + .text(function (d) {
128 return cat_text(d.name[0]); 132 return cat_text(d.name[0]);
129 }) 133 })
130 - .attr('title', function(d) { 134 + .attr('title', function (d) {
131 return d.name[0]; 135 return d.name[0];
132 }) 136 })
133 - .attr('x', function(d, i) { 137 + .attr('x', function (d, i) {
134 return d.type == 3 ? multi_text(d, i, this) : cx(d, i) 138 return d.type == 3 ? multi_text(d, i, this) : cx(d, i)
135 }) 139 })
136 .attr('y', ty); 140 .attr('y', ty);
@@ -149,90 +153,95 @@ var gb_svg_chart = (function() { @@ -149,90 +153,95 @@ var gb_svg_chart = (function() {
149 // ----- draw gps ------ 153 // ----- draw gps ------
150 //gps 按线路站点分组后的下标映射 154 //gps 按线路站点分组后的下标映射
151 var line_gps_index = {}; 155 var line_gps_index = {};
152 - var get_circle = function(dataId, svg) { 156 + var get_circle = function (dataId, svg) {
153 try { 157 try {
154 var circle = $('.station_circle[data-id=' + dataId + ']', svg); 158 var circle = $('.station_circle[data-id=' + dataId + ']', svg);
155 if (circle.length == 0) 159 if (circle.length == 0)
156 circle = null; 160 circle = null;
157 - }catch (e){ 161 + } catch (e) {
158 console.log('get_circle error! station_circle data-id:' + dataId); 162 console.log('get_circle error! station_circle data-id:' + dataId);
159 return null; 163 return null;
160 } 164 }
161 return circle; 165 return circle;
162 }, 166 },
163 - gx = function(gps, svg) {  
164 - var circle = get_circle(gps.stopNo, svg); 167 + gx = function (gps, svg) {
  168 + var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
165 if (!circle) return -100; 169 if (!circle) return -100;
166 170
167 return circle.attr('cx') - 14; 171 return circle.attr('cx') - 14;
168 }, 172 },
169 - gy = function(gps, svg) {  
170 - var circle = get_circle(gps.stopNo, svg); 173 + gy = function (gps, svg) {
  174 + var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
171 if (!circle) return -100; 175 if (!circle) return -100;
172 176
173 var cy = parseInt(circle.attr('cy')), 177 var cy = parseInt(circle.attr('cy')),
174 - index = line_gps_index[gps.lineId][gps.stopNo][gps.deviceId]; 178 + index = line_gps_index[gps.lineId][gps.stopNo + '_' + gps.upDown][gps.deviceId];
175 179
176 - return gps.upDown == 0 ? cy - 31 - (index * 28) : cy + 7 + (index * 28); 180 + return gps.upDown == 0 ? cy - 25 - (index * 21) : cy + 7 + (index * 21);
177 }, 181 },
178 - ups_gps = function(d) { 182 + ups_gps = function (d) {
179 return d.gpsUps; 183 return d.gpsUps;
180 }, 184 },
181 - downs_gps = function(d) { 185 + downs_gps = function (d) {
182 return d.gpsDowns; 186 return d.gpsDowns;
183 }, 187 },
184 - gps_index_mapp = function(data) { 188 + gps_index_mapp = function (data) {
185 var rs = {}; 189 var rs = {};
186 - var dataGroupStop = gb_common.groupBy(data, 'stopNo'); 190 + var dataGroupStop = gb_svg_data_convert.groupByStationAndUpdown(data);
187 for (var stopNo in dataGroupStop) { 191 for (var stopNo in dataGroupStop) {
188 rs[stopNo] = {}; 192 rs[stopNo] = {};
189 - $.each(dataGroupStop[stopNo], function(i, gps) { 193 + $.each(dataGroupStop[stopNo], function (i, gps) {
190 rs[stopNo][gps.deviceId] = i; 194 rs[stopNo][gps.deviceId] = i;
191 }); 195 });
192 } 196 }
193 return rs; 197 return rs;
194 }, 198 },
195 - g_text = function(d) {  
196 - var len = (d.nbbm == false ? 0 : d.nbbm.length);  
197 - return len > 3 ? d.nbbm.substr(len - 3) : d.nbbm; 199 + g_text = function (d) {
  200 + var len = (d.nbbm == false ? 0 : d.nbbm.length)
  201 + , t = len > 3 ? d.nbbm.substr(len - 3) : d.nbbm;
  202 +
  203 + if (d.nbbm.indexOf('-') > 1) {
  204 + t = d.nbbm.substr(d.nbbm.indexOf('-') - 1, 1) + t;
  205 + }
  206 + return t;
198 }, 207 },
199 - gps_key = function(d) { 208 + gps_key = function (d) {
200 return d.deviceId; 209 return d.deviceId;
201 }, 210 },
202 - gps_update_point = function(e, svg) {  
203 - e.transition().attr('x', function(d) {  
204 - return gx(d, svg);  
205 - })  
206 - .attr('y', function(d) { 211 + gps_update_point = function (e, svg) {
  212 + e.transition().attr('x', function (d) {
  213 + return gx(d, svg);
  214 + })
  215 + .attr('y', function (d) {
207 return gy(d, svg); 216 return gy(d, svg);
208 }) 217 })
209 - .attr('updown', function(d) { 218 + .attr('updown', function (d) {
210 return d.upDown; 219 return d.upDown;
211 }); 220 });
212 //update tip position 221 //update tip position
213 gb_svg_tooltip.update(e); 222 gb_svg_tooltip.update(e);
214 }, 223 },
215 - rct_id = function(d) { 224 + rct_id = function (d) {
216 return 'rct_' + d.deviceId; 225 return 'rct_' + d.deviceId;
217 }, 226 },
218 - tx_id = function(d) { 227 + tx_id = function (d) {
219 return 'tx_' + d.deviceId; 228 return 'tx_' + d.deviceId;
220 } 229 }
221 230
222 - var setGps = function(lineCode) { 231 + var setGps = function (lineCode) {
223 var svgs = $('.line-chart[data-code=' + lineCode + ']'), 232 var svgs = $('.line-chart[data-code=' + lineCode + ']'),
224 data = gb_data_gps.gpsByLineCode(lineCode); 233 data = gb_data_gps.gpsByLineCode(lineCode);
225 234
226 - var list=[]; 235 + var list = [];
227 //过滤无站点字段的数据 236 //过滤无站点字段的数据
228 - $.each(data, function(){  
229 - if(!this.stopNo || this.stopNo=='') 237 + $.each(data, function () {
  238 + if (!this.stopNo || this.stopNo == '')
230 return true; 239 return true;
231 list.push(this); 240 list.push(this);
232 }); 241 });
233 242
234 line_gps_index[lineCode] = gps_index_mapp(list); 243 line_gps_index[lineCode] = gps_index_mapp(list);
235 - $.each(svgs, function() { 244 + $.each(svgs, function () {
236 //绘制gps 245 //绘制gps
237 draw_gps(this, list); 246 draw_gps(this, list);
238 //聚合gps 247 //聚合gps
@@ -241,7 +250,7 @@ var gb_svg_chart = (function() { @@ -241,7 +250,7 @@ var gb_svg_chart = (function() {
241 250
242 }; 251 };
243 252
244 - var draw_gps = function(svg, data) { 253 + var draw_gps = function (svg, data) {
245 //remove merge_hide class 254 //remove merge_hide class
246 $('.merge_hide', svg).removeAttr('class'); 255 $('.merge_hide', svg).removeAttr('class');
247 256
@@ -256,22 +265,22 @@ var gb_svg_chart = (function() { @@ -256,22 +265,22 @@ var gb_svg_chart = (function() {
256 gps_update_point(ts, svg); 265 gps_update_point(ts, svg);
257 }; 266 };
258 267
259 - var marker_clusterer = function(svg, lineCode) {  
260 - //debugger 268 + var marker_clusterer = function (svg, lineCode) {
  269 + //debugger
261 var gpsArr, idxMapp = line_gps_index[lineCode]; 270 var gpsArr, idxMapp = line_gps_index[lineCode];
262 - //svgs = $('.line-chart[data-code=' + lineCode + ']'); 271 + //svgs = $('.line-chart[data-code=' + lineCode + ']');
263 for (var stopNo in idxMapp) { 272 for (var stopNo in idxMapp) {
264 gpsArr = gb_common.get_keys(idxMapp[stopNo]); 273 gpsArr = gb_common.get_keys(idxMapp[stopNo]);
265 //remove old merger point 274 //remove old merger point
266 $('g[_id=' + 'merger_' + stopNo + ']', svg).remove(); 275 $('g[_id=' + 'merger_' + stopNo + ']', svg).remove();
267 if (gpsArr.length <= 2) 276 if (gpsArr.length <= 2)
268 - continue; 277 + continue;
269 278
270 marker_clusterer_merge(svg, stopNo, gpsArr); 279 marker_clusterer_merge(svg, stopNo, gpsArr);
271 } 280 }
272 } 281 }
273 282
274 - var marker_clusterer_merge = function(svg, stopNo, gpsArr) { 283 + var marker_clusterer_merge = function (svg, stopNo, gpsArr) {
275 //stop circle 284 //stop circle
276 var circle = get_circle(stopNo, svg); 285 var circle = get_circle(stopNo, svg);
277 if (!circle) return; 286 if (!circle) return;
@@ -282,7 +291,7 @@ var gb_svg_chart = (function() { @@ -282,7 +291,7 @@ var gb_svg_chart = (function() {
282 291
283 var svg = d3.select(svg); 292 var svg = d3.select(svg);
284 //hide old element 293 //hide old element
285 - $.each(gpsArr, function(i, d) { 294 + $.each(gpsArr, function (i, d) {
286 $('rect[_id=rct_' + d + '],text[_id=tx_' + d + ']').attr('class', 'merge_hide'); 295 $('rect[_id=rct_' + d + '],text[_id=tx_' + d + ']').attr('class', 'merge_hide');
287 }); 296 });
288 297
@@ -292,7 +301,7 @@ var gb_svg_chart = (function() { @@ -292,7 +301,7 @@ var gb_svg_chart = (function() {
292 }); 301 });
293 //merge rect 302 //merge rect
294 mergerG.append('rect').attr('x', x - 12) 303 mergerG.append('rect').attr('x', x - 12)
295 - .attr('y', function() { 304 + .attr('y', function () {
296 return isDown ? y + 7 : y - 32; 305 return isDown ? y + 7 : y - 32;
297 }); 306 });
298 //merge text 307 //merge text
src/main/resources/static/real_control_v2/js/utils/svg_chart_map.js
@@ -37,14 +37,15 @@ var gb_svg_map_util = (function () { @@ -37,14 +37,15 @@ var gb_svg_map_util = (function () {
37 37
38 var drawStationMarker = function (routeItem) { 38 var drawStationMarker = function (routeItem) {
39 var station = routeItem.station, 39 var station = routeItem.station,
  40 + name = routeItem.stationName,
40 coord = TransGPS.wgsToBD(station.gLaty, station.gLonx); 41 coord = TransGPS.wgsToBD(station.gLaty, station.gLonx);
41 42
42 var marker = new BMap.Marker(new BMap.Point(coord.lng, coord.lat)); 43 var marker = new BMap.Marker(new BMap.Point(coord.lng, coord.lat));
43 44
44 //label 45 //label
45 - var offsetX = Math.abs(station.stationName.length / 2 * 12), 46 + var offsetX = Math.abs(name.length / 2 * 12),
46 offsetY = -20, 47 offsetY = -20,
47 - label = new BMap.Label(station.stationName, { 48 + label = new BMap.Label(name, {
48 offset: new BMap.Size(-offsetX, offsetY) 49 offset: new BMap.Size(-offsetX, offsetY)
49 }); 50 });
50 51
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
@@ -13,6 +13,7 @@ var gb_svg_tooltip = (function () { @@ -13,6 +13,7 @@ var gb_svg_tooltip = (function () {
13 if (rect.attr('aria-describedby')) 13 if (rect.attr('aria-describedby'))
14 return; 14 return;
15 var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); 15 var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]);
  16 + console.log('gps', gps);
16 $(this).qtip({ 17 $(this).qtip({
17 show: { 18 show: {
18 ready: true, 19 ready: true,
@@ -151,7 +152,7 @@ var gb_svg_tooltip = (function () { @@ -151,7 +152,7 @@ var gb_svg_tooltip = (function () {
151 function searchByStop(list, stop) { 152 function searchByStop(list, stop) {
152 var rs = []; 153 var rs = [];
153 $.each(list, function () { 154 $.each(list, function () {
154 - if (this.stopNo == stop) 155 + if ((this.stopNo + '_' + this.upDown) == stop)
155 rs.push(this); 156 rs.push(this);
156 }); 157 });
157 return rs; 158 return rs;
src/main/resources/static/real_control_v2/js/utils/svg_data_convert.js
@@ -103,14 +103,30 @@ var gb_svg_data_convert = (function() { @@ -103,14 +103,30 @@ var gb_svg_data_convert = (function() {
103 }; 103 };
104 104
105 var get_station_code=function (station) { 105 var get_station_code=function (station) {
106 - if(station.stationMark=='B' || station.stationMark=='E') 106 + /*if(station.stationMark=='B' || station.stationMark=='E')
107 return station.stationCode+'_'+station.directions; 107 return station.stationCode+'_'+station.directions;
108 else 108 else
109 - return station.stationCode; 109 + return station.stationCode;*/
  110 + return station.stationCode+'_'+station.directions;
110 }; 111 };
111 112
112 var nvl_get = function(list, index) { 113 var nvl_get = function(list, index) {
113 return list[index] == null ? {} : list[index]; 114 return list[index] == null ? {} : list[index];
114 }; 115 };
115 - return {mergeRoute: mergeRoute}; 116 +
  117 + var groupByStationAndUpdown = function (data) {
  118 + //gb_common.groupBy(data, 'stopNo')
  119 + var rs = {},
  120 + key;
  121 + $.each(data, function () {
  122 + key = this['stopNo'] + '_' + this['upDown'];
  123 + if (!rs[key])
  124 + rs[key] = [];
  125 +
  126 + rs[key].push(this);
  127 + });
  128 +
  129 + return rs;
  130 + };
  131 + return {mergeRoute: mergeRoute, groupByStationAndUpdown: groupByStationAndUpdown};
116 })(); 132 })();
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
@@ -394,7 +394,7 @@ var gb_map_baidu = (function(){ @@ -394,7 +394,7 @@ var gb_map_baidu = (function(){
394 //线路名 394 //线路名
395 gps.lineName = gb_data_basic.lineCode2NameAll()[gps.lineId]; 395 gps.lineName = gb_data_basic.lineCode2NameAll()[gps.lineId];
396 //时间 396 //时间
397 - gps.dateStr = moment(gps.timestamp).format('YYYY-MM-DD HH:mm:ss'); 397 + //gps.dateStr = moment(gps.timestamp).format('YYYY-MM-DD HH:mm:ss');
398 398
399 marker.infoWindow.setContent(gb_map_overlay_mge.map_gps_win_temp(gps)); 399 marker.infoWindow.setContent(gb_map_overlay_mge.map_gps_win_temp(gps));
400 map.openInfoWindow(marker.infoWindow, marker.point); 400 map.openInfoWindow(marker.infoWindow, marker.point);