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