Commit f1286ea3111ce3073919552c7ed740e2f9c2037b

Authored by lizhuojun
1 parent 54228753

gps轨迹回放

src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -250,10 +250,9 @@ public class GpsServiceImpl implements GpsService { @@ -250,10 +250,9 @@ public class GpsServiceImpl implements GpsService {
250 boolean isFirstNotValid=true; 250 boolean isFirstNotValid=true;
251 boolean isFirstLonlatZero=true; 251 boolean isFirstLonlatZero=true;
252 Map<String, Object> map = null; 252 Map<String, Object> map = null;
  253 + int index=0;
253 for(Map<String, Object> rs : dataList){ 254 for(Map<String, Object> rs : dataList){
254 - int index=dataList.indexOf(rs);  
255 if (index< dataList.size()-1&&!map_get_str( rs,"LINE_ID").equals(map_get_str( dataList.get(index+1),"LINE_ID"))){ 255 if (index< dataList.size()-1&&!map_get_str( rs,"LINE_ID").equals(map_get_str( dataList.get(index+1),"LINE_ID"))){
256 -  
257 Line cLine =lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID"))); 256 Line cLine =lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID")));
258 Line nextLine =lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID"))); 257 Line nextLine =lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID")));
259 if (cLine!=null&&nextLine!=null){ 258 if (cLine!=null&&nextLine!=null){
@@ -337,14 +336,14 @@ public class GpsServiceImpl implements GpsService { @@ -337,14 +336,14 @@ public class GpsServiceImpl implements GpsService {
337 //路段编码 336 //路段编码
338 map.put("section_code", map_get_str(rs,"SECTION_CODE")); 337 map.put("section_code", map_get_str(rs,"SECTION_CODE"));
339 list.add(map); 338 list.add(map);
  339 + index++;
340 } 340 }
341 341
342 if (lineSet.size()>0){ 342 if (lineSet.size()>0){
343 - List listvs=new ArrayList(); 343 + List<Map<String,Object>> vlist=new ArrayList<>();
344 for (String s : lineSet) { 344 for (String s : lineSet) {
345 int lineId=Integer.parseInt(s); 345 int lineId=Integer.parseInt(s);
346 List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId); 346 List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId);
347 - List<Map<String,Object>> vlist=new ArrayList<>();  
348 Map<String,Object> vMap; 347 Map<String,Object> vMap;
349 Long qt=0L; 348 Long qt=0L;
350 if (lvs!=null&&!lvs.isEmpty()){ 349 if (lvs!=null&&!lvs.isEmpty()){
@@ -353,27 +352,28 @@ public class GpsServiceImpl implements GpsService { @@ -353,27 +352,28 @@ public class GpsServiceImpl implements GpsService {
353 Long sd=lv.getStartDate().getTime(); 352 Long sd=lv.getStartDate().getTime();
354 Long ed=lv.getEndDate().getTime(); 353 Long ed=lv.getEndDate().getTime();
355 if (sd<st&&et<ed){ 354 if (sd<st&&et<ed){
  355 + vMap.put("line",s);
356 vMap.put("version",lv.getVersions()); 356 vMap.put("version",lv.getVersions());
357 vMap.put("vtime","all"); 357 vMap.put("vtime","all");
358 - vlist.add(vMap);  
359 }else if(sd<st&&et>ed&&st<ed){ 358 }else if(sd<st&&et>ed&&st<ed){
  359 + vMap.put("line",s);
360 vMap.put("version",lv.getVersions()); 360 vMap.put("version",lv.getVersions());
361 vMap.put("endTime",lv.getEndDate().getTime()); 361 vMap.put("endTime",lv.getEndDate().getTime());
362 vMap.put("abnormalType","versionSwitch"); 362 vMap.put("abnormalType","versionSwitch");
  363 + vMap.put("startTime",st);
363 vMap.put("st",lv.getEndDate().getTime()); 364 vMap.put("st",lv.getEndDate().getTime());
364 - //vMap.put("et",lvs.indexOf(lv)==lvs.size()-1?lv.getEndDate().getTime():lvs.get(lvs.indexOf(lv)+1).getStartDate().getTime());  
365 qt=lv.getEndDate().getTime(); 365 qt=lv.getEndDate().getTime();
366 - vlist.add(vMap);  
367 }else if(st<sd&&et<ed&&sd<et){ 366 }else if(st<sd&&et<ed&&sd<et){
  367 + vMap.put("line",s);
368 vMap.put("version",lv.getVersions()); 368 vMap.put("version",lv.getVersions());
369 vMap.put("startTime",lv.getStartDate().getTime()); 369 vMap.put("startTime",lv.getStartDate().getTime());
  370 + vMap.put("endTime",et);
  371 + }
  372 + if (!vMap.isEmpty()) {
370 vlist.add(vMap); 373 vlist.add(vMap);
371 } 374 }
372 } 375 }
373 } 376 }
374 - if (vlist.size()>0){  
375 - listvs.add(vlist);  
376 - }  
377 if (vlist.size()>1){ 377 if (vlist.size()>1){
378 Map<String,Object> VSmap=new HashMap<>(); 378 Map<String,Object> VSmap=new HashMap<>();
379 VSmap.put("abnormalType","vserionSwitch"); 379 VSmap.put("abnormalType","vserionSwitch");
@@ -381,7 +381,7 @@ public class GpsServiceImpl implements GpsService { @@ -381,7 +381,7 @@ public class GpsServiceImpl implements GpsService {
381 versionSwitchList.add(VSmap); 381 versionSwitchList.add(VSmap);
382 } 382 }
383 } 383 }
384 - rsMap.put("lineVerson",listvs); 384 + rsMap.put("lineVerson",vlist);
385 } 385 }
386 // 按时间排序 386 // 按时间排序
387 Collections.sort(list, new Comparator<Map<String, Object>>() { 387 Collections.sort(list, new Comparator<Map<String, Object>>() {
src/main/resources/static/pages/control/lineallot_v2/main.html
@@ -511,8 +511,7 @@ @@ -511,8 +511,7 @@
511 if (rs) { 511 if (rs) {
512 for(var lineCode in rs) 512 for(var lineCode in rs)
513 storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); 513 storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode]));
514 -  
515 - eq.emit('cache_route'); 514 + //eq.emit('cache_route');
516 } 515 }
517 }); 516 });
518 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { 517 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) {
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/right.html
@@ -189,6 +189,7 @@ @@ -189,6 +189,7 @@
189 * 播放 189 * 播放
190 */ 190 */
191 $('.top-btn-list .play', rightWrap).on('click', function () { 191 $('.top-btn-list .play', rightWrap).on('click', function () {
  192 + debugger
192 if (toolsDisabled()) 193 if (toolsDisabled())
193 return; 194 return;
194 if (!$(this).hasClass('pause')) { 195 if (!$(this).hasClass('pause')) {
@@ -342,7 +343,10 @@ @@ -342,7 +343,10 @@
342 343
343 function drawRoadPolyline(lineCode, upDown, lineVersion) { 344 function drawRoadPolyline(lineCode, upDown, lineVersion) {
344 //从localStorage获取路段 345 //从localStorage获取路段
345 - routes = JSON.parse(storage.getItem(lineCode + "_" + lineVersion + '_route')); 346 + if (lineVersion==0)
  347 + routes = JSON.parse(storage.getItem(lineCode + '_route'));
  348 + else
  349 + routes = JSON.parse(storage.getItem(lineCode + "_" + lineVersion + '_route'));
346 if (!routes) { 350 if (!routes) {
347 var name = gb_data_basic.lineCode2NameAll()[lineCode]; 351 var name = gb_data_basic.lineCode2NameAll()[lineCode];
348 notify_err("缺少" + name + "的路段信息,请选择" + name + "进入线调"); 352 notify_err("缺少" + name + "的路段信息,请选择" + name + "进入线调");
@@ -377,7 +381,7 @@ @@ -377,7 +381,7 @@
377 381
378 var array = stations[upDown], psm, zdMarkers = []; 382 var array = stations[upDown], psm, zdMarkers = [];
379 $.each(array, function () { 383 $.each(array, function () {
380 - if (this.versions == lineVersion) { 384 + if (this.versions == lineVersion||lineVersion==0) {
381 385
382 //坐标转换 386 //坐标转换
383 var coord = TransGPS.wgsToBD(this.lat, this.lon); 387 var coord = TransGPS.wgsToBD(this.lat, this.lon);
@@ -404,7 +408,7 @@ @@ -404,7 +408,7 @@
404 408
405 var array = stations[upDown], obj, buffs = []; 409 var array = stations[upDown], obj, buffs = [];
406 $.each(array, function () { 410 $.each(array, function () {
407 - if (this.versions == lineVersion) { 411 + if (this.versions == lineVersion||lineVersion==0) {
408 if (this.shapesType == 'r') 412 if (this.shapesType == 'r')
409 obj = drawCircle(new BMap.Point(this.bd_lon, this.bd_lat), this.radius); 413 obj = drawCircle(new BMap.Point(this.bd_lon, this.bd_lat), this.radius);
410 else if (this.shapesType == 'd') 414 else if (this.shapesType == 'd')
@@ -439,7 +443,7 @@ @@ -439,7 +443,7 @@
439 } 443 }
440 var array = stations[upDown], tMarkers = []; 444 var array = stations[upDown], tMarkers = [];
441 $.each(array, function () { 445 $.each(array, function () {
442 - if (this.versions == lineVersion) { 446 + if (this.versions == lineVersion||lineVersion==0) {
443 447
444 var width = this.stationName.length * 12; 448 var width = this.stationName.length * 12;
445 var label = new BMap.Label(this.stationName, { 449 var label = new BMap.Label(this.stationName, {
@@ -692,17 +696,19 @@ @@ -692,17 +696,19 @@
692 696
693 function getLineVersionAnddrawCarMarker(gps) { 697 function getLineVersionAnddrawCarMarker(gps) {
694 if (lineVersionList.length > 0) { 698 if (lineVersionList.length > 0) {
  699 + var isNotLine=0
695 for (var i = 0; i < lineVersionList.length; i++) { 700 for (var i = 0; i < lineVersionList.length; i++) {
696 - if (lineVersionList[i].length > 0) {  
697 - for (var j = 0; j < lineVersionList[i].length; j++) {  
698 - if ((lineVersionList[i][j].endTime && lineVersionList[i][j].endTime > gps.timestamp) || (lineVersionList[i][j].startTime && lineVersionList[i][j].startTime < gps.timestamp) || (lineVersionList[i][j].vtime && lineVersionList[i][j].vtime == 'all')) {  
699 - drawCarMarker(gps, lineVersionList[i][j].version);//更新GPS点位  
700 - }  
701 - }  
702 -  
703 - 701 + if(lineVersionList[i].line!=gps.lineId)
  702 + isNotLine++;
  703 + if (lineVersionList[i]&&lineVersionList[i].line==gps.lineId&&(lineVersionList[i].endTime && lineVersionList[i].endTime > gps.timestamp&&lineVersionList[i].startTime && lineVersionList[i].startTime < gps.timestamp||lineVersionList[i].vtime && lineVersionList[i].vtime == 'all')) {
  704 + drawCarMarker(gps, lineVersionList[i].version);//更新GPS点位
  705 + }else if(lineVersionList[i].length == 0){
  706 + drawCarMarker(gps, 0);//除非线路没有版本信息
704 } 707 }
705 } 708 }
  709 + if(isNotLine==lineVersionList.length){
  710 + drawCarMarker(gps, 0);//除非线路没有正确的版本信息
  711 + }
706 } else { 712 } else {
707 drawCarMarker(gps, 0);//除非线路没有版本信息 713 drawCarMarker(gps, 0);//除非线路没有版本信息
708 } 714 }