Commit 933f4e6afdca45cd96f66f3527b4ba5a1b53ec4a

Authored by 潘钊
1 parent 964e396b

update

src/main/java/com/bsth/data/BasicData.java
@@ -7,6 +7,8 @@ import java.util.List; @@ -7,6 +7,8 @@ import java.util.List;
7 import java.util.Map; 7 import java.util.Map;
8 import java.util.concurrent.TimeUnit; 8 import java.util.concurrent.TimeUnit;
9 9
  10 +import com.bsth.data.dto.SEPoint;
  11 +import org.apache.commons.lang3.StringUtils;
10 import org.slf4j.Logger; 12 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,258 +35,275 @@ import com.google.common.collect.HashBiMap; @@ -33,258 +35,275 @@ import com.google.common.collect.HashBiMap;
33 import com.google.common.collect.TreeMultimap; 35 import com.google.common.collect.TreeMultimap;
34 36
35 /** 37 /**
36 - * 38 + * @author PanZhao
37 * @ClassName: BasicData 39 * @ClassName: BasicData
38 * @Description: TODO(基础的映射数据) 40 * @Description: TODO(基础的映射数据)
39 - * @author PanZhao  
40 * @date 2016年8月10日 下午3:27:45 41 * @date 2016年8月10日 下午3:27:45
41 - *  
42 */ 42 */
43 @Component 43 @Component
44 -public class BasicData implements CommandLineRunner{  
45 -  
46 - //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)  
47 - public static BiMap<String, String> deviceId2NbbmMap;  
48 -  
49 - //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)  
50 - public static Map<String, String> nbbm2CompanyCodeMap;  
51 -  
52 - //站点编码和名称对照,包括停车场 (K: 站点编码 ,V:站点名称)  
53 - public static Map<String, String> stationCode2NameMap;  
54 -  
55 - //车辆和线路对照  
56 - public static Map<String, Line> nbbm2LineMap;  
57 -  
58 - //线路和用户对照 用于webSocket定向推送消息(用户进入线调时写入数据)  
59 - public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create();  
60 -  
61 - //线路ID和code 对照  
62 - public static BiMap<Integer, String> lineId2CodeMap;  
63 -  
64 - //线路编码和名称对照  
65 - public static Map<String, String> lineCode2NameMap;  
66 -  
67 - //线路编码_站点编码 == 0|1 上下行  
68 - public static Map<String, Integer> lineStationUpDownMap;  
69 -  
70 - //停车场  
71 - public static List<String> parkCodeList;  
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 -  
87 - static Logger logger = LoggerFactory.getLogger(BasicData.class);  
88 -  
89 - @Autowired  
90 - BasicDataLoader dataLoader;  
91 -  
92 - @Override  
93 - public void run(String... arg0) throws Exception {  
94 - Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS);  
95 - }  
96 -  
97 -  
98 - @Component  
99 - public static class BasicDataLoader extends Thread{  
100 -  
101 - @Autowired  
102 - CarsRepository carsRepository;  
103 -  
104 - @Autowired  
105 - StationRepository stationRepository;  
106 -  
107 - @Autowired  
108 - CarParkRepository carParkRepository;  
109 -  
110 - @Autowired  
111 - CarConfigInfoRepository carConfigInfoRepository;  
112 -  
113 - @Autowired  
114 - LineRepository lineRepository;  
115 -  
116 - @Autowired  
117 - StationRouteRepository stationRouteRepository;  
118 -  
119 - @Autowired  
120 - PersonnelRepository personnelRepository;  
121 -  
122 -  
123 - @Override  
124 - public void run() {  
125 - loadAllData();  
126 - }  
127 -  
128 - /**  
129 - * @Title: loadAllData  
130 - * @Description: TODO(加载所有数据)  
131 - */  
132 - public int loadAllData(){  
133 - try{  
134 - //设备信息  
135 - loadDeviceInfo();  
136 - //站点信息  
137 - loadStationInfo();  
138 - //线路信息  
139 - loadLineInfo();  
140 - //车辆和线路映射信息  
141 - loadNbbm2LineInfo();  
142 - //站点路由信息  
143 - loadStationRouteInfo();  
144 - //人员信息  
145 - loadPersonnelInfo();  
146 - logger.info("加载基础数据成功!," );  
147 - }catch(Exception e){  
148 - logger.error("加载基础数据时出现异常," , e);  
149 - }  
150 - return 0;  
151 - }  
152 -  
153 -  
154 - private void loadStationRouteInfo() {  
155 - Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();  
156 - Map<String, Integer> map = new HashMap<>();  
157 - StationRoute route;  
158 -  
159 - while(iterator.hasNext()){  
160 - route = iterator.next();  
161 - map.put(route.getLineCode() + "_" + route.getStationCode(), route.getDirections());  
162 - }  
163 - lineStationUpDownMap = map;  
164 - }  
165 -  
166 - /**  
167 - * @Title: loadDeviceInfo  
168 - * @Description: TODO(加载设备相关信息)  
169 - */  
170 - public void loadDeviceInfo(){  
171 - BiMap<String, String> deviceId2Nbbm = HashBiMap.create();  
172 - //车辆和公司代码对照  
173 - Map<String, String> nbbm2CompanyCode = new HashMap<>();  
174 - Iterator<Cars> carIterator = carsRepository.findAll().iterator();  
175 - Cars car;  
176 - while(carIterator.hasNext()){  
177 - car = carIterator.next();  
178 - deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode());  
179 - nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());  
180 - }  
181 -  
182 - deviceId2NbbmMap = deviceId2Nbbm;  
183 - nbbm2CompanyCodeMap = nbbm2CompanyCode;  
184 - }  
185 -  
186 - /**  
187 - * @Title: loadStationInfo  
188 - * @Description: TODO(加载站点信息)  
189 - */  
190 - public void loadStationInfo(){  
191 - Map<String, String> stationCode2Name = new HashMap<>();  
192 - Iterator<Station> iterator = stationRepository.findAll().iterator();  
193 - //站点  
194 - Station station;  
195 - while(iterator.hasNext()){  
196 - station = iterator.next();  
197 - stationCode2Name.put(station.getStationCod(), station.getStationName());  
198 - }  
199 - //停车场  
200 - Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator();  
201 -  
202 - List<String> parkCodes = new ArrayList<>();  
203 -  
204 - CarPark carPark;  
205 - while(iterator2.hasNext()){  
206 - carPark = iterator2.next();  
207 - stationCode2Name.put(carPark.getParkCode(), carPark.getParkName());  
208 -  
209 - parkCodes.add(carPark.getParkCode());  
210 - }  
211 - parkCodeList = parkCodes;  
212 - stationCode2NameMap = stationCode2Name;  
213 - }  
214 -  
215 - /**  
216 - * @Title: loadNbbm2LineInfo  
217 - * @Description: TODO(车辆和线路对照)  
218 - */  
219 - public void loadNbbm2LineInfo(){  
220 - Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator();  
221 - Map<String, Line> ccMap = new HashMap<>();  
222 -  
223 - CarConfigInfo cci;  
224 - while(allIterator.hasNext()){  
225 - cci = allIterator.next();  
226 - ccMap.put(cci.getCl().getInsideCode(), cci.getXl());  
227 - }  
228 - nbbm2LineMap = ccMap;  
229 - }  
230 -  
231 - /**  
232 - * @Title: loadLineInfo  
233 - * @Description: TODO(加载线路相关信息)  
234 - */  
235 - public void loadLineInfo(){  
236 - Iterator<Line> iterator = lineRepository.findAll().iterator();  
237 -  
238 - Line line;  
239 - BiMap<Integer, String> biMap = HashBiMap.create();  
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>();  
243 -  
244 - while(iterator.hasNext()){  
245 - line = iterator.next();  
246 - biMap.put(line.getId(), line.getLineCode());  
247 - code2name.put(line.getLineCode(), line.getName());  
248 - id2SHcode.put(line.getId(),line.getShanghaiLinecode());  
249 - code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());  
250 - }  
251 -  
252 - lineId2CodeMap = biMap;  
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;  
288 - }  
289 - } 44 +public class BasicData implements CommandLineRunner {
  45 +
  46 + //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
  47 + public static BiMap<String, String> deviceId2NbbmMap;
  48 +
  49 + //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)
  50 + public static Map<String, String> nbbm2CompanyCodeMap;
  51 +
  52 + //站点编码和名称对照,包括停车场 (K: 站点编码 ,V:站点名称)
  53 + public static Map<String, String> stationCode2NameMap;
  54 +
  55 + //线路起终点对照(线路编码_上下行_起终点) 1024_0_B (1024上行起点)
  56 + public static Map<String, String> lineSEPointMap;
  57 +
  58 + //车辆和线路对照
  59 + public static Map<String, Line> nbbm2LineMap;
  60 +
  61 + //线路和用户对照 用于webSocket定向推送消息(用户进入线调时写入数据)
  62 + //public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create();
  63 +
  64 + //线路ID和code 对照
  65 + public static BiMap<Integer, String> lineId2CodeMap;
  66 +
  67 + //线路编码和名称对照
  68 + public static Map<String, String> lineCode2NameMap;
  69 +
  70 + //线路编码_站点编码 == 0|1 上下行
  71 + public static Map<String, Integer> lineStationUpDownMap;
  72 +
  73 + //停车场
  74 + public static List<String> parkCodeList;
  75 +
  76 + //线路ID和shangHaiLinecode 对照
  77 + public static Map<Integer, String> lineId2ShangHaiCodeMap;
  78 +
  79 + //线路Code和shangHaiLinecode 对照
  80 + public static Map<String, String> lineCode2ShangHaiCodeMap;
  81 +
  82 + //驾驶员工号 和 personnel 对象映射
  83 + public static Map<String, Personnel> jsyMap;
  84 + //售票员工号 和 personnel 对象映射
  85 + public static Map<String, Personnel> spyMap;
  86 + //全量员工 工号和姓名对照
  87 + public static Map<String, String> allPerson;
  88 +
  89 +
  90 + static Logger logger = LoggerFactory.getLogger(BasicData.class);
  91 +
  92 + @Autowired
  93 + BasicDataLoader dataLoader;
  94 +
  95 + @Override
  96 + public void run(String... arg0) throws Exception {
  97 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS);
  98 + }
  99 +
  100 +
  101 + @Component
  102 + public static class BasicDataLoader extends Thread {
  103 +
  104 + @Autowired
  105 + CarsRepository carsRepository;
  106 +
  107 + @Autowired
  108 + StationRepository stationRepository;
  109 +
  110 + @Autowired
  111 + CarParkRepository carParkRepository;
  112 +
  113 + @Autowired
  114 + CarConfigInfoRepository carConfigInfoRepository;
  115 +
  116 + @Autowired
  117 + LineRepository lineRepository;
  118 +
  119 + @Autowired
  120 + StationRouteRepository stationRouteRepository;
  121 +
  122 + @Autowired
  123 + PersonnelRepository personnelRepository;
  124 +
  125 +
  126 + @Override
  127 + public void run() {
  128 + loadAllData();
  129 + }
  130 +
  131 + /**
  132 + * @Title: loadAllData
  133 + * @Description: TODO(加载所有数据)
  134 + */
  135 + public int loadAllData() {
  136 + try {
  137 + //设备信息
  138 + loadDeviceInfo();
  139 + //站点信息
  140 + loadStationInfo();
  141 + //线路信息
  142 + loadLineInfo();
  143 + //车辆和线路映射信息
  144 + loadNbbm2LineInfo();
  145 + //站点路由信息
  146 + loadStationRouteInfo();
  147 + //人员信息
  148 + loadPersonnelInfo();
  149 + logger.info("加载基础数据成功!,");
  150 + } catch (Exception e) {
  151 + logger.error("加载基础数据时出现异常,", e);
  152 + }
  153 + return 0;
  154 + }
  155 +
  156 +
  157 + private void loadStationRouteInfo() {
  158 + Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();
  159 +
  160 + Map<String, String> sePointMap = new HashMap<>();
  161 + //lineSEPointMap
  162 + Map<String, Integer> map = new HashMap<>();
  163 +
  164 + StationRoute route;
  165 + while (iterator.hasNext()) {
  166 + route = iterator.next();
  167 + map.put(route.getLineCode() + "_" + route.getStationCode(), route.getDirections());
  168 +
  169 + if (route.getStationMark() != null &&
  170 + (route.getStationMark().equals("B") || route.getStationMark().equals("E"))) {
  171 + sePointMap.put(route.getLineCode() + "_"
  172 + + route.getDirections()
  173 + + "_" + route.getStationMark(), route.getStationCode());
  174 + }
  175 + }
  176 + lineStationUpDownMap = map;
  177 + lineSEPointMap = sePointMap;
  178 + }
  179 +
  180 + /**
  181 + * @Title: loadDeviceInfo
  182 + * @Description: TODO(加载设备相关信息)
  183 + */
  184 + public void loadDeviceInfo() {
  185 + BiMap<String, String> deviceId2Nbbm = HashBiMap.create();
  186 + //车辆和公司代码对照
  187 + Map<String, String> nbbm2CompanyCode = new HashMap<>();
  188 + Iterator<Cars> carIterator = carsRepository.findAll().iterator();
  189 + Cars car;
  190 + while (carIterator.hasNext()) {
  191 + car = carIterator.next();
  192 + deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode());
  193 + nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());
  194 + }
  195 +
  196 + deviceId2NbbmMap = deviceId2Nbbm;
  197 + nbbm2CompanyCodeMap = nbbm2CompanyCode;
  198 + }
  199 +
  200 + /**
  201 + * @Title: loadStationInfo
  202 + * @Description: TODO(加载站点信息)
  203 + */
  204 + public void loadStationInfo() {
  205 + Map<String, String> stationCode2Name = new HashMap<>();
  206 + Iterator<Station> iterator = stationRepository.findAll().iterator();
  207 + //站点
  208 + Station station;
  209 + while (iterator.hasNext()) {
  210 + station = iterator.next();
  211 + stationCode2Name.put(station.getStationCod(), station.getStationName());
  212 + }
  213 + //停车场
  214 + Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator();
  215 +
  216 + List<String> parkCodes = new ArrayList<>();
  217 +
  218 + CarPark carPark;
  219 + while (iterator2.hasNext()) {
  220 + carPark = iterator2.next();
  221 + stationCode2Name.put(carPark.getParkCode(), carPark.getParkName());
  222 +
  223 + parkCodes.add(carPark.getParkCode());
  224 + }
  225 + parkCodeList = parkCodes;
  226 + stationCode2NameMap = stationCode2Name;
  227 + }
  228 +
  229 + /**
  230 + * @Title: loadNbbm2LineInfo
  231 + * @Description: TODO(车辆和线路对照)
  232 + */
  233 + public void loadNbbm2LineInfo() {
  234 + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator();
  235 + Map<String, Line> ccMap = new HashMap<>();
  236 +
  237 + CarConfigInfo cci;
  238 + while (allIterator.hasNext()) {
  239 + cci = allIterator.next();
  240 + ccMap.put(cci.getCl().getInsideCode(), cci.getXl());
  241 + }
  242 + nbbm2LineMap = ccMap;
  243 + }
  244 +
  245 + /**
  246 + * @Title: loadLineInfo
  247 + * @Description: TODO(加载线路相关信息)
  248 + */
  249 + public void loadLineInfo() {
  250 + Iterator<Line> iterator = lineRepository.findAll().iterator();
  251 +
  252 + Line line;
  253 + BiMap<Integer, String> biMap = HashBiMap.create();
  254 + Map<String, String> code2name = new HashMap<>();
  255 + Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
  256 + Map<String, String> code2SHcode = new HashMap<String, String>();
  257 +
  258 + while (iterator.hasNext()) {
  259 + line = iterator.next();
  260 + biMap.put(line.getId(), line.getLineCode());
  261 + code2name.put(line.getLineCode(), line.getName());
  262 + id2SHcode.put(line.getId(), line.getShanghaiLinecode());
  263 + code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());
  264 + }
  265 +
  266 + lineId2CodeMap = biMap;
  267 + lineCode2NameMap = code2name;
  268 + lineId2ShangHaiCodeMap = id2SHcode;
  269 + lineCode2ShangHaiCodeMap = code2SHcode;
  270 + }
  271 +
  272 + /**
  273 + * @Title: loadPersonnelInfo
  274 + * @Description: TODO(加载人员信息)
  275 + */
  276 + public void loadPersonnelInfo() {
  277 + Iterator<Personnel> iterator = personnelRepository.findAll().iterator();
  278 +
  279 + Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>();
  280 + Map<String, String> allPersonMap = new HashMap<>();
  281 +
  282 + Personnel p;
  283 + String jobCode;
  284 + while (iterator.hasNext()) {
  285 + p = iterator.next();
  286 +
  287 + jobCode = p.getJobCode();
  288 + if (StringUtils.isEmpty(jobCode))
  289 + continue;
  290 +
  291 + if (jobCode.indexOf("-") != -1) {
  292 + jobCode = jobCode.split("-")[1];
  293 + }
  294 + if (p.getPosts() != null) {
  295 + if (p.getPosts().equals("1"))
  296 + jsyTempMap.put(jobCode, p);
  297 + else if (p.getPosts().equals("2"))
  298 + spyTempMap.put(jobCode, p);
  299 + }
  300 +
  301 + allPersonMap.put(jobCode, p.getPersonnelName());
  302 + }
  303 +
  304 + jsyMap = jsyTempMap;
  305 + spyMap = spyTempMap;
  306 + allPerson = allPersonMap;
  307 + }
  308 + }
290 } 309 }
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -71,6 +71,9 @@ public class GpsEntity { @@ -71,6 +71,9 @@ public class GpsEntity {
71 71
72 private int version; 72 private int version;
73 73
  74 + /** 是否起终点站 */
  75 + private boolean sEPoint;
  76 +
74 public Integer getCompanyCode() { 77 public Integer getCompanyCode() {
75 return companyCode; 78 return companyCode;
76 } 79 }
@@ -238,4 +241,12 @@ public class GpsEntity { @@ -238,4 +241,12 @@ public class GpsEntity {
238 public void setVersion(int version) { 241 public void setVersion(int version) {
239 this.version = version; 242 this.version = version;
240 } 243 }
  244 +
  245 + public boolean issEPoint() {
  246 + return sEPoint;
  247 + }
  248 +
  249 + public void setsEPoint(boolean sEPoint) {
  250 + this.sEPoint = sEPoint;
  251 + }
241 } 252 }
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -28,7 +28,7 @@ import com.bsth.util.ConfigUtil; @@ -28,7 +28,7 @@ import com.bsth.util.ConfigUtil;
28 import com.google.common.collect.TreeMultimap; 28 import com.google.common.collect.TreeMultimap;
29 29
30 /** 30 /**
31 - * 31 + *
32 * @ClassName: GpsRealData 32 * @ClassName: GpsRealData
33 * @Description: TODO(实时GPS数据集合) 33 * @Description: TODO(实时GPS数据集合)
34 * @author PanZhao 34 * @author PanZhao
@@ -37,25 +37,25 @@ import com.google.common.collect.TreeMultimap; @@ -37,25 +37,25 @@ import com.google.common.collect.TreeMultimap;
37 */ 37 */
38 @Component 38 @Component
39 public class GpsRealData implements CommandLineRunner{ 39 public class GpsRealData implements CommandLineRunner{
40 - 40 +
41 static Logger logger = LoggerFactory.getLogger(GpsRealData.class); 41 static Logger logger = LoggerFactory.getLogger(GpsRealData.class);
42 - 42 +
43 private static Map<String, GpsEntity> gpsMap; 43 private static Map<String, GpsEntity> gpsMap;
44 - 44 +
45 //按线路分组设备号 45 //按线路分组设备号
46 private static TreeMultimap<String, String> lineCode2Devices; 46 private static TreeMultimap<String, String> lineCode2Devices;
47 47
48 // 网关数据接口地址 48 // 网关数据接口地址
49 private static String url; 49 private static String url;
50 - 50 +
51 @Autowired 51 @Autowired
52 GpsDataLoader gpsDataLoader; 52 GpsDataLoader gpsDataLoader;
53 - 53 +
54 @Autowired 54 @Autowired
55 DayOfSchedule dayOfSchedule; 55 DayOfSchedule dayOfSchedule;
56 - 56 +
57 @Autowired 57 @Autowired
58 - ForecastRealServer forecastRealServer; 58 + ForecastRealServer forecastRealServer;
59 /** 59 /**
60 * 构造函数 60 * 构造函数
61 */ 61 */
@@ -64,11 +64,11 @@ public class GpsRealData implements CommandLineRunner{ @@ -64,11 +64,11 @@ public class GpsRealData implements CommandLineRunner{
64 lineCode2Devices = TreeMultimap.create(); 64 lineCode2Devices = TreeMultimap.create();
65 url = ConfigUtil.get("http.gps.real.url"); 65 url = ConfigUtil.get("http.gps.real.url");
66 } 66 }
67 - 67 +
68 @Override 68 @Override
69 public void run(String... arg0) throws Exception { 69 public void run(String... arg0) throws Exception {
70 logger.info("gpsDataLoader,20,6"); 70 logger.info("gpsDataLoader,20,6");
71 - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); 71 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 4, TimeUnit.SECONDS);
72 } 72 }
73 73
74 public GpsEntity add(GpsEntity gps) { 74 public GpsEntity add(GpsEntity gps) {
@@ -88,27 +88,28 @@ public class GpsRealData implements CommandLineRunner{ @@ -88,27 +88,28 @@ public class GpsRealData implements CommandLineRunner{
88 gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); 88 gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm()));
89 } 89 }
90 } 90 }
91 - 91 +
92 gpsMap.put(device, gps); 92 gpsMap.put(device, gps);
93 - lineCode2Devices.put(gps.getLineId(), device); 93 + if(StringUtils.isNotEmpty(gps.getLineId()))
  94 + lineCode2Devices.put(gps.getLineId(), device);
94 return gps; 95 return gps;
95 } 96 }
96 97
97 /** 98 /**
98 - * 99 + *
99 * @Title: get @Description: TODO(设备号获取GPS) 100 * @Title: get @Description: TODO(设备号获取GPS)
100 */ 101 */
101 public GpsEntity get(String deviceId) { 102 public GpsEntity get(String deviceId) {
102 return gpsMap.get(deviceId); 103 return gpsMap.get(deviceId);
103 } 104 }
104 - 105 +
105 /** 106 /**
106 - * 107 + *
107 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws 108 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws
108 */ 109 */
109 public List<GpsEntity> getByLine(String lineCode) { 110 public List<GpsEntity> getByLine(String lineCode) {
110 NavigableSet<String> set = lineCode2Devices.get(lineCode); 111 NavigableSet<String> set = lineCode2Devices.get(lineCode);
111 - 112 +
112 List<GpsEntity> rs = new ArrayList<>(); 113 List<GpsEntity> rs = new ArrayList<>();
113 GpsEntity gps; 114 GpsEntity gps;
114 ScheduleRealInfo sch; 115 ScheduleRealInfo sch;
@@ -117,19 +118,19 @@ public class GpsRealData implements CommandLineRunner{ @@ -117,19 +118,19 @@ public class GpsRealData implements CommandLineRunner{
117 //过滤异常GPS数据 118 //过滤异常GPS数据
118 if(gps.isAbnormal()) 119 if(gps.isAbnormal())
119 continue; 120 continue;
120 - 121 +
121 sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); 122 sch = dayOfSchedule.execPlamMap().get(gps.getNbbm());
122 if(null != sch) 123 if(null != sch)
123 gps.setSchId(sch.getId()); 124 gps.setSchId(sch.getId());
124 rs.add(gps); 125 rs.add(gps);
125 } 126 }
126 - 127 +
127 return rs; 128 return rs;
128 } 129 }
129 - 130 +
130 public List<GpsEntity> get(List<String> pArray){ 131 public List<GpsEntity> get(List<String> pArray){
131 List<GpsEntity> list = new ArrayList<>(); 132 List<GpsEntity> list = new ArrayList<>();
132 - 133 +
133 for(String code : pArray) 134 for(String code : pArray)
134 list.addAll(getByLine(code)); 135 list.addAll(getByLine(code));
135 return list; 136 return list;
@@ -138,11 +139,11 @@ public class GpsRealData implements CommandLineRunner{ @@ -138,11 +139,11 @@ public class GpsRealData implements CommandLineRunner{
138 public Set<String> allDevices(){ 139 public Set<String> allDevices(){
139 return gpsMap.keySet(); 140 return gpsMap.keySet();
140 } 141 }
141 - 142 +
142 public GpsEntity findByDeviceId(String deviceId) { 143 public GpsEntity findByDeviceId(String deviceId) {
143 return gpsMap.get(deviceId); 144 return gpsMap.get(deviceId);
144 } 145 }
145 - 146 +
146 public Collection<GpsEntity> all(){ 147 public Collection<GpsEntity> all(){
147 return gpsMap.values(); 148 return gpsMap.values();
148 } 149 }
@@ -152,9 +153,9 @@ public class GpsRealData implements CommandLineRunner{ @@ -152,9 +153,9 @@ public class GpsRealData implements CommandLineRunner{
152 } 153 }
153 @Component 154 @Component
154 public static class GpsDataLoader extends Thread{ 155 public static class GpsDataLoader extends Thread{
155 - 156 +
156 Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); 157 Logger logger = LoggerFactory.getLogger(GpsDataLoader.class);
157 - 158 +
158 @Autowired 159 @Autowired
159 GpsRealData gpsRealData; 160 GpsRealData gpsRealData;
160 161
@@ -166,7 +167,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -166,7 +167,7 @@ public class GpsRealData implements CommandLineRunner{
166 logger.error("", e); 167 logger.error("", e);
167 } 168 }
168 } 169 }
169 - 170 +
170 public void load() throws Exception { 171 public void load() throws Exception {
171 List<GpsEntity> list = new ArrayList<>(); 172 List<GpsEntity> list = new ArrayList<>();
172 CloseableHttpClient httpClient = null; 173 CloseableHttpClient httpClient = null;
@@ -174,7 +175,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -174,7 +175,7 @@ public class GpsRealData implements CommandLineRunner{
174 try { 175 try {
175 httpClient = HttpClients.createDefault(); 176 httpClient = HttpClients.createDefault();
176 HttpGet get = new HttpGet(url); 177 HttpGet get = new HttpGet(url);
177 - 178 +
178 response = httpClient.execute(get); 179 response = httpClient.execute(get);
179 180
180 HttpEntity entity = response.getEntity(); 181 HttpEntity entity = response.getEntity();
@@ -183,32 +184,41 @@ public class GpsRealData implements CommandLineRunner{ @@ -183,32 +184,41 @@ public class GpsRealData implements CommandLineRunner{
183 BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); 184 BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent()));
184 StringBuffer stringBuffer = new StringBuffer(); 185 StringBuffer stringBuffer = new StringBuffer();
185 String str = ""; 186 String str = "";
186 - while ((str = br.readLine()) != null) 187 + while ((str = br.readLine()) != null)
187 stringBuffer.append(str); 188 stringBuffer.append(str);
188 189
189 JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); 190 JSONObject jsonObj = JSON.parseObject(stringBuffer.toString());
190 191
191 - if (jsonObj != null) 192 + if (jsonObj != null)
192 list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); 193 list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class);
193 - 194 +
194 String nbbm; 195 String nbbm;
195 - //附加车辆内部编码  
196 - Integer updown;  
197 for(GpsEntity gps : list){ 196 for(GpsEntity gps : list){
198 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); 197 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
199 if(StringUtils.isBlank(nbbm)) 198 if(StringUtils.isBlank(nbbm))
200 gps.setAbnormal(true);//标记为异常数据 199 gps.setAbnormal(true);//标记为异常数据
201 else 200 else
202 gps.setNbbm(nbbm); 201 gps.setNbbm(nbbm);
203 - 202 +
204 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); 203 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
  204 + gpsRealData.add(gps);
  205 +
  206 + //纠正走向
  207 + correctUpdown(gps);
  208 + /*if(issEPoint(gps))
  209 + continue;
  210 +
  211 + //如果走向未知,尝试根据站点纠正走向
205 if(gps.getUpDown() == -1){ 212 if(gps.getUpDown() == -1){
206 - //如果走向未知,尝试根据站点纠正走向  
207 - updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); 213 + updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
208 if(updown != null) 214 if(updown != null)
209 gps.setUpDown(updown); 215 gps.setUpDown(updown);
210 } 216 }
211 - gpsRealData.add(gps); 217 + //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向
  218 + updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
  219 + if(updown != null && !gps.getUpDown().equals(updown)){
  220 + gps.setUpDown(updown);
  221 + }*/
212 } 222 }
213 } else 223 } else
214 logger.error("result is null"); 224 logger.error("result is null");
@@ -222,5 +232,54 @@ public class GpsRealData implements CommandLineRunner{ @@ -222,5 +232,54 @@ public class GpsRealData implements CommandLineRunner{
222 response.close(); 232 response.close();
223 } 233 }
224 } 234 }
  235 +
  236 + /**
  237 + * 是否是起终点
  238 + * @param gps
  239 + * @return
  240 + */
  241 + public boolean isSEPoint(GpsEntity gps){
  242 + String key = gps.getLineId()+"_"+gps.getUpDown()+"_"
  243 + ,stationCode;
  244 +
  245 + if(BasicData.lineSEPointMap.containsKey(key+"B")){
  246 + stationCode = BasicData.lineSEPointMap.get(key+"B");
  247 + if(gps.getStopNo().equals(stationCode)){
  248 + gps.setsEPoint(true);
  249 + return true;
  250 + }
  251 + }
  252 + else if(BasicData.lineSEPointMap.containsKey(key+"E")){
  253 + stationCode = BasicData.lineSEPointMap.get(key+"E");
  254 + if(gps.getStopNo().equals(stationCode)){
  255 + gps.setsEPoint(true);
  256 + return true;
  257 + }
  258 + }
  259 + return false;
  260 + }
  261 +
  262 + /**
  263 + * 纠正上下行
  264 + * @param gps
  265 + */
  266 + public void correctUpdown(GpsEntity gps){
  267 + Integer updown;
  268 + //如果走向未知,尝试根据站点纠正走向
  269 + if(gps.getUpDown() == -1){
  270 + updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
  271 + if(updown != null)
  272 + gps.setUpDown(updown);
  273 + }
  274 +
  275 + if(isSEPoint(gps))
  276 + return;
  277 +
  278 + //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向
  279 + updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
  280 + if(updown != null && !gps.getUpDown().equals(updown)){
  281 + gps.setUpDown(updown);
  282 + }
  283 + }
225 } 284 }
226 } 285 }
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -130,11 +130,11 @@ public class DayOfSchedule implements CommandLineRunner { @@ -130,11 +130,11 @@ public class DayOfSchedule implements CommandLineRunner {
130 //翻班线程 130 //翻班线程
131 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); 131 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
132 //入库 132 //入库
133 - //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); 133 + Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
134 //首班出场指令补发器 134 //首班出场指令补发器
135 - //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); 135 + Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
136 //班次误点扫描 136 //班次误点扫描
137 - //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); 137 + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
138 138
139 //每天凌晨2点20提交数据到运管处 139 //每天凌晨2点20提交数据到运管处
140 long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis(); 140 long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis();
src/main/resources/static/real_control_v2/css/line_schedule.css
@@ -827,4 +827,23 @@ input.i-cbox[type=checkbox]{ @@ -827,4 +827,23 @@ input.i-cbox[type=checkbox]{
827 827
828 .qtip.sch-tl-tip{ 828 .qtip.sch-tl-tip{
829 max-width: 335px; 829 max-width: 335px;
  830 +}
  831 +
  832 +.sfsj-sch-detail{
  833 + list-style: none;
  834 + padding: 5px 0px;
  835 + margin-bottom: 3px;
  836 +}
  837 +.sfsj-sch-detail li{
  838 + font-size: 14px;
  839 + line-height: 24px;
  840 +}
  841 +
  842 +.sfsj-sch-detail li span{
  843 + display: inline-block;
  844 + width: 65px;
  845 + text-align: right;
  846 + color: #bab6b6;
  847 + font-family: 微软雅黑;
  848 + font-size: 13px;
830 } 849 }
831 \ No newline at end of file 850 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
@@ -67,15 +67,15 @@ @@ -67,15 +67,15 @@
67 </dd> 67 </dd>
68 <dd data-sort-val={{sch.dfsjT}} dbclick dbclick-type="dfsj" dbclick-val="{{sch.dfsj}}">{{sch.dfsj}}</dd> 68 <dd data-sort-val={{sch.dfsjT}} dbclick dbclick-type="dfsj" dbclick-val="{{sch.dfsj}}">{{sch.dfsj}}</dd>
69 <dd class=" 69 <dd class="
70 - {{if sch.status==-1}}  
71 - tl-qrlb  
72 - {{else if sch.status==2}}  
73 - tl-yzx  
74 - {{else if sch.status==1}}  
75 - tl-zzzx  
76 - {{else if sch.status == 0 && sch.late}}  
77 - tl-wd  
78 - {{/if}}"> 70 + {{if sch.status==-1}}
  71 + tl-qrlb
  72 + {{else if sch.status==2}}
  73 + tl-yzx
  74 + {{else if sch.status==1}}
  75 + tl-zzzx
  76 + {{else if sch.status == 0 && sch.late}}
  77 + tl-wd
  78 + {{/if}} fcsjActualCell" >
79 {{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span> 79 {{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span>
80 </dd> 80 </dd>
81 <dd data-uk-observe> 81 <dd data-uk-observe>
@@ -111,19 +111,19 @@ @@ -111,19 +111,19 @@
111 </dd> 111 </dd>
112 </script> 112 </script>
113 113
114 -<script id="line-schedule-sfsj-temp" type="text/html">  
115 -<dd class="  
116 -{{if status==-1}}  
117 - tl-qrlb  
118 -{{else if status==2}}  
119 - tl-yzx  
120 -{{else if status==1}}  
121 - tl-zzzx  
122 -{{else if status == 0 && late}}  
123 - tl-wd  
124 -{{/if}}">  
125 - {{fcsjActual}}<span class="fcsj-diff">{{fcsj_diff}}</span>  
126 - </dd> 114 + <script id="line-schedule-sfsj-temp" type="text/html">
  115 + <dd class="
  116 + {{if status==-1}}
  117 + tl-qrlb
  118 + {{else if status==2}}
  119 + tl-yzx
  120 + {{else if status==1}}
  121 + tl-zzzx
  122 + {{else if status == 0 && late}}
  123 + tl-wd
  124 + {{/if}}">
  125 + {{fcsjActual}}<span class="fcsj-diff">{{fcsj_diff}}</span>
  126 + </dd>
127 </script> 127 </script>
128 128
129 <script id="line-schedule-nbbm-temp" type="text/html"> 129 <script id="line-schedule-nbbm-temp" type="text/html">
@@ -132,4 +132,18 @@ @@ -132,4 +132,18 @@
132 {{clZbh}} 132 {{clZbh}}
133 </dd> 133 </dd>
134 </script> 134 </script>
  135 +
  136 + <script id="sfsj_sch-detail-temp" type="text/html">
  137 + <ul class="sfsj-sch-detail">
  138 + <li><span>路牌:</span>{{lpName}}</li>
  139 + <li><span>车辆:</span>{{clZbh}}</li>
  140 + <li><span>计发:</span>{{fcsj}}</li>
  141 + <li><span>实发:</span>{{fcsjActual}}</li>
  142 + <li><span>计达:</span>{{zdsj}}</li>
  143 + <li><span>实达:</span>{{zdsjActual}}</li>
  144 + <li><span>驾驶员:</span>{{jName}}</li>
  145 + <li><span>售票员:</span>{{sName}}</li>
  146 + <li><span>终点站:</span>{{zdzName}}</li>
  147 + </ul>
  148 + </script>
135 </div> 149 </div>
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
@@ -77,11 +77,6 @@ @@ -77,11 +77,6 @@
77 "id": 2.2, 77 "id": 2.2,
78 "text": "设备上报记录", 78 "text": "设备上报记录",
79 "event": "device_report" 79 "event": "device_report"
80 - },  
81 - {  
82 - "id": 2.3,  
83 - "text": "轨迹回放",  
84 - "event": "play_back"  
85 } 80 }
86 ] 81 ]
87 }, 82 },
src/main/resources/static/real_control_v2/js/home/line_panel.js
@@ -82,6 +82,9 @@ var gb_home_line_panel = (function() { @@ -82,6 +82,9 @@ var gb_home_line_panel = (function() {
82 var cells = e.find('dd'); 82 var cells = e.find('dd');
83 $(cells[1]).text(t.speed); 83 $(cells[1]).text(t.speed);
84 $(cells[2]).html(t.expectStopTime == null ? '' : t.expectStopTime); 84 $(cells[2]).html(t.expectStopTime == null ? '' : t.expectStopTime);
  85 +
  86 + if(!t.stationName)
  87 + t.stationName='';
85 $(cells[3]).text(t.stationName).attr('title', t.stationName); 88 $(cells[3]).text(t.stationName).attr('title', t.stationName);
86 89
87 //班次信息 90 //班次信息
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -65,10 +65,37 @@ var gb_schedule_table = (function() { @@ -65,10 +65,37 @@ var gb_schedule_table = (function() {
65 //dbclick event 65 //dbclick event
66 gb_schedule_table_dbclick.init(); 66 gb_schedule_table_dbclick.init();
67 67
  68 + fcsjActualCellQtip();
68 cb && cb(); 69 cb && cb();
69 }); 70 });
70 } 71 }
71 72
  73 + function fcsjActualCellQtip(){
  74 + //单击实发单元格显示详细信息
  75 + $('dd.fcsjActualCell').qtip({
  76 + show: 'click',
  77 + content: {
  78 + text: function(e) {
  79 + var lineCode=$(e.target).parents('li.line_schedule').data('id')
  80 + ,id=$(e.target).parent().data('id')
  81 + ,sch=line2Schedule[lineCode][id];
  82 + return temps['sfsj_sch-detail-temp'](sch);
  83 + }
  84 + }
  85 + ,style: {
  86 + classes: 'qtip-dark qtip-rounded qtip-shadow'
  87 + },
  88 + hide: {
  89 + fixed: true,
  90 + delay: 300
  91 + },
  92 + position: {
  93 + my: 'center left',
  94 + at: 'center right'
  95 + }
  96 + });
  97 + }
  98 +
72 //重置序号 99 //重置序号
73 var reset_seq_no = function(dls) { 100 var reset_seq_no = function(dls) {
74 dls.each(function(i, dl) { 101 dls.each(function(i, dl) {
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
@@ -221,10 +221,20 @@ var gb_svg_chart = (function() { @@ -221,10 +221,20 @@ var gb_svg_chart = (function() {
221 var svgs = $('.line-chart[data-code=' + lineCode + ']'), 221 var svgs = $('.line-chart[data-code=' + lineCode + ']'),
222 data = gb_data_gps.gpsByLineCode(lineCode); 222 data = gb_data_gps.gpsByLineCode(lineCode);
223 223
224 - line_gps_index[lineCode] = gps_index_mapp(data); 224 + var list=[];
  225 + //过滤数据,起终点站附加 方向标识
  226 + $.each(data, function(){
  227 + if(!this.stopNo || this.stopNo=='')
  228 + return true;
  229 + if(this.sEPoint)
  230 + this.stopNo=this.stopNo+'_'+this.state;
  231 + list.push(this);
  232 + });
  233 +
  234 + line_gps_index[lineCode] = gps_index_mapp(list);
225 $.each(svgs, function() { 235 $.each(svgs, function() {
226 //绘制gps 236 //绘制gps
227 - draw_gps(this, data); 237 + draw_gps(this, list);
228 //聚合gps 238 //聚合gps
229 marker_clusterer(this, lineCode); 239 marker_clusterer(this, lineCode);
230 }); 240 });
src/main/resources/static/real_control_v2/js/utils/svg_chart_map.js
@@ -20,7 +20,7 @@ var gb_svg_map_util = (function () { @@ -20,7 +20,7 @@ var gb_svg_map_util = (function () {
20 20
21 map.addOverlay(polyline); 21 map.addOverlay(polyline);
22 22
23 - $.each(gb_data_basic.stationRoutes(gps.lineId), function () { 23 + $.each(gb_data_basic.stationRoutes(gps.lineId), function (i) {
24 if (this.directions == gps.upDown) { 24 if (this.directions == gps.upDown) {
25 try { 25 try {
26 var marker = drawStationMarker(this); 26 var marker = drawStationMarker(this);
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
@@ -57,10 +57,10 @@ var gb_svg_tooltip = (function() { @@ -57,10 +57,10 @@ var gb_svg_tooltip = (function() {
57 // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); 57 // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]);
58 //获取聚合的gps 58 //获取聚合的gps
59 var lineCode=$(this).parents('svg').data('code') 59 var lineCode=$(this).parents('svg').data('code')
60 - ,stop=$(this).parent().attr('_id').split('_')[1] 60 + ,stop=$(this).parent().attr('_id').substr(7)//merger_
61 ,gpsArray=searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop); 61 ,gpsArray=searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop);
62 62
63 - console.log('gpsArray...',gpsArray); 63 + console.log('stop...',stop);
64 $(this).qtip({ 64 $(this).qtip({
65 show: { 65 show: {
66 ready: true, 66 ready: true,
src/main/resources/static/real_control_v2/js/utils/svg_data_convert.js
@@ -20,7 +20,7 @@ var gb_svg_data_convert = (function() { @@ -20,7 +20,7 @@ var gb_svg_data_convert = (function() {
20 downS = nvl_get(down, j), 20 downS = nvl_get(down, j),
21 op = { 21 op = {
22 name: [upS.stationName], 22 name: [upS.stationName],
23 - id: [upS.stationCode, downS.stationCode], 23 + id: [get_station_code(upS), get_station_code(downS)],
24 type: 2, 24 type: 2,
25 stationMark: upS.stationMark//站点标记 25 stationMark: upS.stationMark//站点标记
26 }; 26 };
@@ -85,14 +85,14 @@ var gb_svg_data_convert = (function() { @@ -85,14 +85,14 @@ var gb_svg_data_convert = (function() {
85 85
86 var upSort = function(a, b) { 86 var upSort = function(a, b) {
87 return a.stationRouteCode - b.stationRouteCode; 87 return a.stationRouteCode - b.stationRouteCode;
88 - } 88 + };
89 89
90 var downSort = function(a, b) { 90 var downSort = function(a, b) {
91 return b.stationRouteCode - a.stationRouteCode; 91 return b.stationRouteCode - a.stationRouteCode;
92 - } 92 + };
93 93
94 var station_indexof = function(array, station, start) { 94 var station_indexof = function(array, station, start) {
95 - var res = -1 95 + var res = -1;
96 for (var i = start, obj; obj = array[i++];) { 96 for (var i = start, obj; obj = array[i++];) {
97 if (obj.stationName == station.stationName) { 97 if (obj.stationName == station.stationName) {
98 res = i; 98 res = i;
@@ -100,10 +100,17 @@ var gb_svg_data_convert = (function() { @@ -100,10 +100,17 @@ var gb_svg_data_convert = (function() {
100 } 100 }
101 } 101 }
102 return res; 102 return res;
103 - } 103 + };
  104 +
  105 + var get_station_code=function (station) {
  106 + if(station.stationMark=='B' || station.stationMark=='E')
  107 + return station.stationCode+'_'+station.directions;
  108 + else
  109 + return station.stationCode;
  110 + };
104 111
105 var nvl_get = function(list, index) { 112 var nvl_get = function(list, index) {
106 return list[index] == null ? {} : list[index]; 113 return list[index] == null ? {} : list[index];
107 - } 114 + };
108 return {mergeRoute: mergeRoute}; 115 return {mergeRoute: mergeRoute};
109 })(); 116 })();
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
  1 +.z-depth-2 {
  2 + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  3 +}
  4 +
  5 +.map-system-msg a{
  6 + position: absolute;
  7 + z-index: 2;
  8 + top: 20px;
  9 + background: red;
  10 + color: white;
  11 + padding: 7px;
  12 + left: calc(50% - 150px);
  13 + border-radius: 5px;
  14 + font-size: 20px;
  15 + cursor: pointer;
  16 +}
  17 +
1 #real_map_container{ 18 #real_map_container{
2 width: 100%; 19 width: 100%;
3 height: 100%; 20 height: 100%;
src/main/resources/static/real_control_v2/mapmonitor/js/config.js 0 → 100644
  1 +/** 地图配置信息 */
  2 +
  3 +var gb_map_config=(function () {
  4 +
  5 + var defaultConfig={
  6 + //地图类型
  7 + map_type: 'baidu',
  8 + //实时路况
  9 + traffic: false
  10 +
  11 + };
  12 +})();
0 \ No newline at end of file 13 \ No newline at end of file
src/main/resources/static/real_control_v2/mapmonitor/js/real.js
@@ -51,7 +51,10 @@ var mapmonitor_load_ep = EventProxy.create(&#39;load_iMap&#39;, &#39;load_baidu&#39;, &#39;load_gaod @@ -51,7 +51,10 @@ var mapmonitor_load_ep = EventProxy.create(&#39;load_iMap&#39;, &#39;load_baidu&#39;, &#39;load_gaod
51 51
52 $(".color_block").spectrum({ 52 $(".color_block").spectrum({
53 color: "#f00", 53 color: "#f00",
54 - showInput: true 54 + showInput: true,
  55 + chooseText: "确定",
  56 + cancelText: "取消",
  57 + preferredFormat: "hex"
55 }); 58 });
56 }); 59 });
57 60
src/main/resources/static/real_control_v2/mapmonitor/real.html
@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/form-advanced.gradient.min.css"/> 5 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/form-advanced.gradient.min.css"/>
6 <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/> 6 <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/>
7 7
  8 +<div class="map-system-msg">
  9 + <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank">当前地图模块正在维护升级,点这里打开原版地图。</a>
  10 +</div>
  11 +
8 <div id="real_map_container"></div> 12 <div id="real_map_container"></div>
9 <div class="real_right_gps_panel"> 13 <div class="real_right_gps_panel">
10 <form class="uk-form" data-uk-margin=""> 14 <form class="uk-form" data-uk-margin="">
@@ -36,8 +40,9 @@ @@ -36,8 +40,9 @@
36 <div class="uk-form-row"> 40 <div class="uk-form-row">
37 <span class="uk-form-label">空间数据</span> 41 <span class="uk-form-label">空间数据</span>
38 <div class="uk-form-controls"> 42 <div class="uk-form-controls">
39 - <label><input type="checkbox" checked> 绘制站点</label>  
40 - <label><input type="checkbox" > 绘制电子围栏</label> 43 + <label><input type="checkbox" checked> 站点</label>
  44 + <label><input type="checkbox" > 电子围栏</label>
  45 + <label><input type="checkbox" > 停车场</label>
41 </div> 46 </div>
42 </div> 47 </div>
43 48
@@ -59,30 +64,51 @@ @@ -59,30 +64,51 @@
59 </div> 64 </div>
60 65
61 <div class="uk-form-row"> 66 <div class="uk-form-row">
62 - <span class="uk-form-label">车辆图标颜色</span> 67 + <span class="uk-form-label">车辆颜色</span>
63 <div class="uk-form-controls"> 68 <div class="uk-form-controls">
64 <div class="color_block"> 69 <div class="color_block">
65 上行 70 上行
66 <div class="sp-placeholder"> 71 <div class="sp-placeholder">
67 - <div class="sp-placeholder-color" style="background-color: rgb(221, 221, 221);"></div> 72 + <div class="sp-placeholder-color" ></div>
68 </div> 73 </div>
69 </div> 74 </div>
70 75
71 <div class="color_block"> 76 <div class="color_block">
72 下行 77 下行
73 <div class="sp-placeholder"> 78 <div class="sp-placeholder">
74 - <div class="sp-placeholder-color" style="background-color: rgb(196, 91, 91);"></div> 79 + <div class="sp-placeholder-color" ></div>
75 </div> 80 </div>
76 </div> 81 </div>
77 82
78 <div class="color_block"> 83 <div class="color_block">
79 - 未知走向 84 + 非营运
80 <div class="sp-placeholder"> 85 <div class="sp-placeholder">
81 - <div class="sp-placeholder-color" style="background-color: rgb(102, 96, 96);"></div> 86 + <div class="sp-placeholder-color" ></div>
82 </div> 87 </div>
83 </div> 88 </div>
84 </div> 89 </div>
85 </div> 90 </div>
  91 +
  92 + <div class="uk-form-row">
  93 + <span class="uk-form-label">路段颜色</span>
  94 + <div class="uk-form-controls">
  95 + <div class="color_block">
  96 + 上行
  97 + <div class="sp-placeholder">
  98 + <div class="sp-placeholder-color" ></div>
  99 + </div>
  100 + </div>
  101 +
  102 + <div class="color_block">
  103 + 下行
  104 + <div class="sp-placeholder">
  105 + <div class="sp-placeholder-color" ></div>
  106 + </div>
  107 + </div>
  108 + </div>
  109 + </div>
  110 +
  111 + <br>
86 </form> 112 </form>
87 </div> 113 </div>
88 </div> 114 </div>