Commit 0407fb9a44661b327c44662a48dd4a2d64f06e82

Authored by 潘钊
1 parent ee338482

update...

src/main/java/com/bsth/service/gps/GpsService.java
1 package com.bsth.service.gps; 1 package com.bsth.service.gps;
2 2
  3 +import com.bsth.service.gps.entity.GpsSpeed_DTO;
  4 +
3 import java.util.List; 5 import java.util.List;
4 import java.util.Map; 6 import java.util.Map;
5 7
@@ -20,4 +22,6 @@ public interface GpsService { @@ -20,4 +22,6 @@ public interface GpsService {
20 Map<String,Object> gpsCompletion(long schId); 22 Map<String,Object> gpsCompletion(long schId);
21 23
22 Map<String,Object> history_v2(String nbbm, long st, long et); 24 Map<String,Object> history_v2(String nbbm, long st, long et);
  25 +
  26 + List<GpsSpeed_DTO> speeds(String nbbm, long st, long et);
23 } 27 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -11,6 +11,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -11,6 +11,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 import com.bsth.repository.CarParkRepository; 11 import com.bsth.repository.CarParkRepository;
12 import com.bsth.repository.StationRepository; 12 import com.bsth.repository.StationRepository;
13 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 13 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  14 +import com.bsth.service.gps.entity.GpsSpeed_DTO;
14 import com.bsth.service.gps.entity.HistoryGps_DTO; 15 import com.bsth.service.gps.entity.HistoryGps_DTO;
15 import com.bsth.service.gps.entity.Road_DTO; 16 import com.bsth.service.gps.entity.Road_DTO;
16 import com.bsth.util.DateUtils; 17 import com.bsth.util.DateUtils;
@@ -192,7 +193,6 @@ public class GpsServiceImpl implements GpsService { @@ -192,7 +193,6 @@ public class GpsServiceImpl implements GpsService {
192 return (int) (Long.parseLong(o1.get("ts").toString()) - Long.parseLong(o2.get("ts").toString())); 193 return (int) (Long.parseLong(o1.get("ts").toString()) - Long.parseLong(o2.get("ts").toString()));
193 } 194 }
194 }); 195 });
195 - ;  
196 return list; 196 return list;
197 } 197 }
198 198
@@ -210,7 +210,7 @@ public class GpsServiceImpl implements GpsService { @@ -210,7 +210,7 @@ public class GpsServiceImpl implements GpsService {
210 Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv); 210 Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv);
211 211
212 String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in (" 212 String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in ("
213 - + inv + ") and ts > ? and ts < ?"; 213 + + inv + ") and ts > ? and ts < ? ORDER BY device_id,ts,stop_no";
214 try { 214 try {
215 conn = DBUtils_MS.getConnection(); 215 conn = DBUtils_MS.getConnection();
216 ps = conn.prepareStatement(sql); 216 ps = conn.prepareStatement(sql);
@@ -296,6 +296,9 @@ public class GpsServiceImpl implements GpsService { @@ -296,6 +296,9 @@ public class GpsServiceImpl implements GpsService {
296 prefix = lineId + "_" + updown + "_"; 296 prefix = lineId + "_" + updown + "_";
297 stationName = BasicData.getStationNameByCode(rs.getString("STOP_NO"), prefix); 297 stationName = BasicData.getStationNameByCode(rs.getString("STOP_NO"), prefix);
298 298
  299 + if(StringUtils.isEmpty(stationName))
  300 + continue;
  301 +
299 arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), lineId, 302 arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), lineId,
300 updown, rs.getString("STOP_NO"), rs.getInt("IN_OUT"), rs.getLong("CREATE_DATE"), 303 updown, rs.getString("STOP_NO"), rs.getInt("IN_OUT"), rs.getLong("CREATE_DATE"),
301 rs.getInt("WEEKS_YEAR"), stationName); 304 rs.getInt("WEEKS_YEAR"), stationName);
@@ -534,8 +537,12 @@ public class GpsServiceImpl implements GpsService { @@ -534,8 +537,12 @@ public class GpsServiceImpl implements GpsService {
534 } 537 }
535 } 538 }
536 539
  540 + //超速数据
  541 +
  542 +
  543 +
537 rs.put("status", ResponseCode.SUCCESS); 544 rs.put("status", ResponseCode.SUCCESS);
538 - rs.put("list", list); 545 + rs.put("list", removeDuplicate(list));
539 }catch (Exception e){ 546 }catch (Exception e){
540 logger.error("", e); 547 logger.error("", e);
541 rs.put("status", ResponseCode.ERROR); 548 rs.put("status", ResponseCode.ERROR);
@@ -543,6 +550,15 @@ public class GpsServiceImpl implements GpsService { @@ -543,6 +550,15 @@ public class GpsServiceImpl implements GpsService {
543 return rs; 550 return rs;
544 } 551 }
545 552
  553 + @Override
  554 + public List<GpsSpeed_DTO> speeds(String nbbm, long st, long et) {
  555 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  556 + String sql = "select vehicle, line, up_down, lon, lat, speed,timestamp from bsth_c_speeding where vehicle=? and timestamp>? and timestamp<?";
  557 +
  558 + jdbcTemplate.queryForList(sql, deviceId, st, et);
  559 + return null;
  560 + }
  561 +
546 private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads){ 562 private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads){
547 double min = -1,distance; 563 double min = -1,distance;
548 Road_DTO nearRoad = null; 564 Road_DTO nearRoad = null;
@@ -559,6 +575,19 @@ public class GpsServiceImpl implements GpsService { @@ -559,6 +575,19 @@ public class GpsServiceImpl implements GpsService {
559 gps.setRoadMinDistance(min); 575 gps.setRoadMinDistance(min);
560 } 576 }
561 577
  578 + /**
  579 + * 去重复
  580 + * @param list
  581 + * @return
  582 + */
  583 + private Set<HistoryGps_DTO> removeDuplicate(List<HistoryGps_DTO> list){
  584 + Set<HistoryGps_DTO> set = new HashSet<>();
  585 + for(HistoryGps_DTO gps : list){
  586 + set.add(gps);
  587 + }
  588 + return set;
  589 + }
  590 +
562 private void sortGpsList(final Field f, List<GpsEntity> rs) { 591 private void sortGpsList(final Field f, List<GpsEntity> rs) {
563 Collections.sort(rs, new Comparator<GpsEntity>() { 592 Collections.sort(rs, new Comparator<GpsEntity>() {
564 593
src/main/java/com/bsth/service/gps/entity/GpsOutbound_DTO.java 0 → 100644
  1 +package com.bsth.service.gps.entity;
  2 +
  3 +/**
  4 + * 越界异常 dto
  5 + * Created by panzhao on 2017/4/7.
  6 + */
  7 +public class GpsOutbound_DTO {
  8 +
  9 + /**
  10 + * 设备号
  11 + */
  12 + private String deviceId;
  13 +
  14 + /**
  15 + * 自编号
  16 + */
  17 + private String nbbm;
  18 +
  19 + /**
  20 + * 越界开始时间
  21 + */
  22 + private long st;
  23 +
  24 + /**
  25 + * 越界结束时间
  26 + */
  27 + private long et;
  28 +
  29 + /**
  30 + * 越界点位集合
  31 + */
  32 + private String locations;
  33 +
  34 + public String getDeviceId() {
  35 + return deviceId;
  36 + }
  37 +
  38 + public void setDeviceId(String deviceId) {
  39 + this.deviceId = deviceId;
  40 + }
  41 +
  42 + public String getNbbm() {
  43 + return nbbm;
  44 + }
  45 +
  46 + public void setNbbm(String nbbm) {
  47 + this.nbbm = nbbm;
  48 + }
  49 +
  50 + public long getSt() {
  51 + return st;
  52 + }
  53 +
  54 + public void setSt(long st) {
  55 + this.st = st;
  56 + }
  57 +
  58 + public long getEt() {
  59 + return et;
  60 + }
  61 +
  62 + public void setEt(long et) {
  63 + this.et = et;
  64 + }
  65 +
  66 + public String getLocations() {
  67 + return locations;
  68 + }
  69 +
  70 + public void setLocations(String locations) {
  71 + this.locations = locations;
  72 + }
  73 +}
src/main/java/com/bsth/service/gps/entity/GpsSpeed.java 0 → 100644
  1 +package com.bsth.service.gps.entity;
  2 +
  3 +/**
  4 + * 超速异常 -数据库序列化格式
  5 + * Created by panzhao on 2017/4/7.
  6 + */
  7 +public class GpsSpeed {
  8 +
  9 + private String vehicle;
  10 +
  11 + private String line;
  12 +
  13 + private int up_down;
  14 +
  15 + private float lon;
  16 +
  17 + private float lat;
  18 +
  19 + private float speed;
  20 +
  21 + private long timestamp;
  22 +
  23 + public String getVehicle() {
  24 + return vehicle;
  25 + }
  26 +
  27 + public void setVehicle(String vehicle) {
  28 + this.vehicle = vehicle;
  29 + }
  30 +
  31 + public String getLine() {
  32 + return line;
  33 + }
  34 +
  35 + public void setLine(String line) {
  36 + this.line = line;
  37 + }
  38 +
  39 + public int getUp_down() {
  40 + return up_down;
  41 + }
  42 +
  43 + public void setUp_down(int up_down) {
  44 + this.up_down = up_down;
  45 + }
  46 +
  47 + public float getLon() {
  48 + return lon;
  49 + }
  50 +
  51 + public void setLon(float lon) {
  52 + this.lon = lon;
  53 + }
  54 +
  55 + public float getLat() {
  56 + return lat;
  57 + }
  58 +
  59 + public void setLat(float lat) {
  60 + this.lat = lat;
  61 + }
  62 +
  63 + public float getSpeed() {
  64 + return speed;
  65 + }
  66 +
  67 + public void setSpeed(float speed) {
  68 + this.speed = speed;
  69 + }
  70 +
  71 + public long getTimestamp() {
  72 + return timestamp;
  73 + }
  74 +
  75 + public void setTimestamp(long timestamp) {
  76 + this.timestamp = timestamp;
  77 + }
  78 +}
src/main/java/com/bsth/service/gps/entity/GpsSpeed_DTO.java 0 → 100644
  1 +package com.bsth.service.gps.entity;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.data.BasicData;
  6 +
  7 +import java.util.*;
  8 +
  9 +/**
  10 + * 超速异常 dto
  11 + * Created by panzhao on 2017/4/7.
  12 + */
  13 +public class GpsSpeed_DTO {
  14 +
  15 + public static List<GpsSpeed_DTO> create(List<Map<String, Object>> mapList){
  16 + //默认都是一辆车的数据
  17 + List<GpsSpeed> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsSpeed.class);
  18 +
  19 + //排序
  20 + Collections.sort(list, new Comparator<GpsSpeed>() {
  21 + @Override
  22 + public int compare(GpsSpeed o1, GpsSpeed o2) {
  23 + return (int) (o1.getTimestamp() - o2.getTimestamp());
  24 + }
  25 + });
  26 +
  27 + List<GpsSpeed_DTO> rsList = new ArrayList<>();
  28 + GpsSpeed_DTO dto = null;
  29 + //合并连续数据
  30 + for(GpsSpeed gs : list){
  31 +
  32 + if(dto == null){
  33 + dto = new GpsSpeed_DTO();
  34 + dto.setDeviceId(gs.getVehicle());
  35 + dto.setNbbm(BasicData.deviceId2NbbmMap.get(gs.getVehicle()));
  36 + dto.setSt(gs.getTimestamp());
  37 + dto.setSpeed(gs.getSpeed());
  38 + }
  39 + else{
  40 +
  41 + }
  42 + }
  43 +
  44 + return null;
  45 + }
  46 +
  47 + /**
  48 + * 设备号
  49 + */
  50 + private String deviceId;
  51 +
  52 + /**
  53 + * 自编号
  54 + */
  55 + private String nbbm;
  56 +
  57 + /**
  58 + * 超速开始时间
  59 + */
  60 + private long st;
  61 +
  62 + /**
  63 + * 超速结束时间
  64 + */
  65 + private long et;
  66 +
  67 + /**
  68 + * 速度
  69 + */
  70 + private float speed;
  71 +
  72 + public String getDeviceId() {
  73 + return deviceId;
  74 + }
  75 +
  76 + public void setDeviceId(String deviceId) {
  77 + this.deviceId = deviceId;
  78 + }
  79 +
  80 + public String getNbbm() {
  81 + return nbbm;
  82 + }
  83 +
  84 + public void setNbbm(String nbbm) {
  85 + this.nbbm = nbbm;
  86 + }
  87 +
  88 + public long getSt() {
  89 + return st;
  90 + }
  91 +
  92 + public void setSt(long st) {
  93 + this.st = st;
  94 + }
  95 +
  96 + public long getEt() {
  97 + return et;
  98 + }
  99 +
  100 + public void setEt(long et) {
  101 + this.et = et;
  102 + }
  103 +
  104 + public float getSpeed() {
  105 + return speed;
  106 + }
  107 +
  108 + public void setSpeed(float speed) {
  109 + this.speed = speed;
  110 + }
  111 +}
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTO.java
@@ -17,12 +17,12 @@ import java.util.Map; @@ -17,12 +17,12 @@ import java.util.Map;
17 */ 17 */
18 public class HistoryGps_DTO { 18 public class HistoryGps_DTO {
19 19
20 - public static List<HistoryGps_DTO> craete(List<Map<String, Object>> mapList){ 20 + public static List<HistoryGps_DTO> craete(List<Map<String, Object>> mapList) {
21 List<HistoryGps_DTO> list = JSONObject.parseArray(JSON.toJSONString(mapList), HistoryGps_DTO.class); 21 List<HistoryGps_DTO> list = JSONObject.parseArray(JSON.toJSONString(mapList), HistoryGps_DTO.class);
22 22
23 GeometryFactory geometryFactory = new GeometryFactory(); 23 GeometryFactory geometryFactory = new GeometryFactory();
24 Point point; 24 Point point;
25 - for(HistoryGps_DTO gps : list){ 25 + for (HistoryGps_DTO gps : list) {
26 point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); 26 point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
27 gps.setPoint(point); 27 gps.setPoint(point);
28 } 28 }
@@ -56,11 +56,32 @@ public class HistoryGps_DTO { @@ -56,11 +56,32 @@ public class HistoryGps_DTO {
56 @JsonIgnore 56 @JsonIgnore
57 private Point point; 57 private Point point;
58 58
59 - /** 路段 */ 59 + /**
  60 + * 路段
  61 + */
60 private Road_DTO road; 62 private Road_DTO road;
61 - /** 和路段的最短距离 */ 63 + /**
  64 + * 和路段的最短距离
  65 + */
62 private double roadMinDistance; 66 private double roadMinDistance;
63 67
  68 + @Override
  69 + public int hashCode() {
  70 + return this.toString().hashCode();
  71 + }
  72 +
  73 + @Override
  74 + public boolean equals(Object obj) {
  75 + HistoryGps_DTO g2 = (HistoryGps_DTO) obj;
  76 + return this.toString().equals(g2.toString());
  77 + }
  78 +
  79 +
  80 + @Override
  81 + public String toString() {
  82 + return (this.getDeviceId() + "_" + (inout_stop_info==null?this.getStopNo():inout_stop_info.getStopName()) + "_" + this.getTs() + "_" + this.getLon() + "_" + this.getLat());
  83 + }
  84 +
64 public double getGcj_lon() { 85 public double getGcj_lon() {
65 return gcj_lon; 86 return gcj_lon;
66 } 87 }
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
@@ -7,8 +7,10 @@ var gb_safe_driv = (function () { @@ -7,8 +7,10 @@ var gb_safe_driv = (function () {
7 'A1': '手部违规', 7 'A1': '手部违规',
8 'A2': '摄像头偏离', 8 'A2': '摄像头偏离',
9 'A3': '安全带', 9 'A3': '安全带',
10 - 'A4': '手臂袖章',  
11 - 'A5': '脸部检测' 10 + 'A4': '未戴袖章',
  11 + 'A5': '眨眼/疲劳驾驶',
  12 + 'A6': '打哈欠/打瞌睡',
  13 + 'A7': '与人交谈'
12 }; 14 };
13 15
14 var $wrap = $('.safe_driv_pop_wrap'); 16 var $wrap = $('.safe_driv_pop_wrap');
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
@@ -298,14 +298,15 @@ @@ -298,14 +298,15 @@
298 var modal = '#map-playback2-modal', gpsArray; 298 var modal = '#map-playback2-modal', gpsArray;
299 299
300 $(modal).on('init', function (e, data) { 300 $(modal).on('init', function (e, data) {
301 - try{ 301 + try {
302 //初始化地图 302 //初始化地图
303 map = new BMap.Map($('.map-wrap', modal)[0]); 303 map = new BMap.Map($('.map-wrap', modal)[0]);
304 //中心点和缩放级别 304 //中心点和缩放级别
305 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16); 305 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16);
306 map.enableScrollWheelZoom(); 306 map.enableScrollWheelZoom();
307 - }catch (e){  
308 - console.log(e);} 307 + } catch (e) {
  308 + console.log(e);
  309 + }
309 310
310 //固定表头 311 //固定表头
311 gb_ct_table.fixedHead($('.road_table_wrap', modal)); 312 gb_ct_table.fixedHead($('.road_table_wrap', modal));
@@ -361,79 +362,86 @@ @@ -361,79 +362,86 @@
361 */ 362 */
362 var searchForm = (function () { 363 var searchForm = (function () {
363 364
364 - var f = $('.playBackForm', modal);  
365 -  
366 - var init = function (data) {  
367 - //设置初始值  
368 - if (data.nbbm)  
369 - $('[name=nbbm]', f).val(data.nbbm);  
370 - var st = moment().subtract(2, 'hour');  
371 - if (data.st)  
372 - st = moment(data.st, 'YYYY-MM-DD HH:mm');  
373 - $('[name=sDate]', f).val(st.format('YYYY-MM-DD'));  
374 - $('[name=sTime]', f).val(st.format('HH:mm'));  
375 - var et = moment();  
376 - if (data.et)  
377 - et = moment(data.et, 'YYYY-MM-DD HH:mm');  
378 - $('[name=eDate]', f).val(et.format('YYYY-MM-DD'));  
379 - $('[name=eTime]', f).val(et.format('HH:mm'));  
380 -  
381 - //搜索事件  
382 - $('button[type=submit]', f).on('click', search);  
383 - };  
384 -  
385 - var setNbbm = function (v) {  
386 - $('[name=nbbm]', f).val(v);  
387 - };  
388 -  
389 - var ONE_DAY = 60 * 60 * 24;  
390 - var MIN_SPACE = 60;  
391 - var search = function (e) {  
392 - e.stopPropagation();  
393 - var data = f.serializeJSON();  
394 -  
395 - //校验时间间隔  
396 - var fs = 'YYYY-MM-DDHH:mm';  
397 - var st = parseInt(moment(data.sDate + data.sTime, fs).format('X'));  
398 - var et = parseInt(moment(data.eDate + data.eTime, fs).format('X'));  
399 -  
400 - if (et < st)  
401 - notify_err('结束时间不能小于开始时间');  
402 - else if ((et - st) > ONE_DAY)  
403 - notify_err('最大间隔24小时!');  
404 - else if ((et - st) < MIN_SPACE)  
405 - notify_err('最小间隔1分钟!');  
406 - else {  
407 - $.ajax({  
408 - url: '/gps/history_v2/' + data.nbbm,  
409 - traditional: true,  
410 - data: {st: st, et: et},  
411 - success: function (rs) {  
412 - gpsArray = rs.list;  
413 - if (!rs || rs.length == 0) {  
414 - notify_err('没有搜索到轨迹数据!');  
415 - return;  
416 - }  
417 -  
418 - //排序  
419 - gpsArray.sort(function (a, b) {  
420 - return a.ts - b.ts; 365 + var f = $('.playBackForm', modal);
  366 +
  367 + var init = function (data) {
  368 + //设置初始值
  369 + /*if (data.nbbm)
  370 + $('[name=nbbm]', f).val(data.nbbm);
  371 + var st = moment().subtract(2, 'hour');
  372 + if (data.st)
  373 + st = moment(data.st, 'YYYY-MM-DD HH:mm');
  374 + $('[name=sDate]', f).val(st.format('YYYY-MM-DD'));
  375 + $('[name=sTime]', f).val(st.format('HH:mm'));
  376 + var et = moment();
  377 + if (data.et)
  378 + et = moment(data.et, 'YYYY-MM-DD HH:mm');
  379 + $('[name=eDate]', f).val(et.format('YYYY-MM-DD'));
  380 + $('[name=eTime]', f).val(et.format('HH:mm'));*/
  381 +
  382 +
  383 + $('[name=nbbm]', f).val('W0A-157');
  384 + $('[name=sDate]', f).val('2017-04-06');
  385 + $('[name=sTime]', f).val('07:49');
  386 +
  387 + $('[name=eDate]', f).val('2017-04-06');
  388 + $('[name=eTime]', f).val('09:49');
  389 + //搜索事件
  390 + $('button[type=submit]', f).on('click', search);
  391 + };
  392 +
  393 + var setNbbm = function (v) {
  394 + $('[name=nbbm]', f).val(v);
  395 + };
  396 +
  397 + var ONE_DAY = 60 * 60 * 24;
  398 + var MIN_SPACE = 60;
  399 + var search = function (e) {
  400 + e.stopPropagation();
  401 + var data = f.serializeJSON();
  402 +
  403 + //校验时间间隔
  404 + var fs = 'YYYY-MM-DDHH:mm';
  405 + var st = parseInt(moment(data.sDate + data.sTime, fs).format('X'));
  406 + var et = parseInt(moment(data.eDate + data.eTime, fs).format('X'));
  407 +
  408 + if (et < st)
  409 + notify_err('结束时间不能小于开始时间');
  410 + else if ((et - st) > ONE_DAY)
  411 + notify_err('最大间隔24小时!');
  412 + else if ((et - st) < MIN_SPACE)
  413 + notify_err('最小间隔1分钟!');
  414 + else {
  415 + $.ajax({
  416 + url: '/gps/history_v2/' + data.nbbm,
  417 + traditional: true,
  418 + data: {st: st, et: et},
  419 + success: function (rs) {
  420 + gpsArray = rs.list;
  421 + if (!rs || rs.length == 0) {
  422 + notify_err('没有搜索到轨迹数据!');
  423 + return;
  424 + }
  425 +
  426 + //排序
  427 + gpsArray.sort(function (a, b) {
  428 + return parseInt((a.ts - b.ts) + '' + (a.stop_no - b.stop_no));
  429 + });
  430 + console.log('gpsArray', gpsArray);
  431 + //行车轨迹
  432 + trailTableObj.showInitData(gpsArray);
  433 + //到离站信息
  434 + inOutStationTableObj.showInitData(gpsArray);
  435 + }
421 }); 436 });
422 - console.log('gpsArray', gpsArray);  
423 - //行车轨迹  
424 - trailTableObj.showInitData(gpsArray);  
425 - //到离站信息  
426 - inOutStationTableObj.showInitData(gpsArray);  
427 } 437 }
428 - });  
429 - }  
430 - return false;  
431 - };  
432 - return {  
433 - init: init,  
434 - setNbbm: setNbbm  
435 - };  
436 - })(); 438 + return false;
  439 + };
  440 + return {
  441 + init: init,
  442 + setNbbm: setNbbm
  443 + };
  444 + })();
437 445
438 /** 446 /**
439 * 行车轨迹表格 447 * 行车轨迹表格
@@ -449,7 +457,8 @@ @@ -449,7 +457,8 @@
449 if (i > 0 && array[array.length - 1].road.road_CODE == gps.road.road_CODE) 457 if (i > 0 && array[array.length - 1].road.road_CODE == gps.road.road_CODE)
450 array.pop(); 458 array.pop();
451 } 459 }
452 - catch (e) {} 460 + catch (e) {
  461 + }
453 462
454 if (gps.road) 463 if (gps.road)
455 array.push(gps); 464 array.push(gps);
@@ -470,32 +479,40 @@ @@ -470,32 +479,40 @@
470 */ 479 */
471 var inOutStationTableObj = (function () { 480 var inOutStationTableObj = (function () {
472 481
473 - var data = []; 482 + var data, f, prev;
474 var showInitData = function (list) { 483 var showInitData = function (list) {
475 clear(); 484 clear();
476 data = []; 485 data = [];
477 486
478 $.each(list, function (i, gps) { 487 $.each(list, function (i, gps) {
479 - if(gps['inout_stop'] == -1) 488 +
  489 + prev = data[data.length - 1];
  490 + if (gps['inout_stop'] == -1)
480 return true; 491 return true;
481 492
482 - if(gps['inout_stop'] == 1){ 493 + if (gps['inout_stop'] == 0) {
  494 + //连续进站信号,取第一个
  495 + if(prev['out_ts'] == null
  496 + && prev['stopName'] == gps['inout_stop_info'].stopName){
  497 + return true;
  498 + }
483 data.push(createIn(gps)); 499 data.push(createIn(gps));
484 } 500 }
485 - else if(gps['inout_stop'] == 0){  
486 - matchOut(data[data.length - 1], gps); 501 + else if (gps['inout_stop'] == 1) {
  502 + f = matchOut(prev, gps);
  503 + if(f)
  504 + data.push(f);
487 } 505 }
488 }); 506 });
489 507
490 //格式化时间 508 //格式化时间
491 $.each(data, function () { 509 $.each(data, function () {
492 - if(this.in_ts) 510 + if (this.in_ts)
493 this.in_time_str = moment(this.in_ts).format('HH:mm.ss'); 511 this.in_time_str = moment(this.in_ts).format('HH:mm.ss');
494 - if(this.out_ts) 512 + if (this.out_ts)
495 this.out_time_str = moment(this.out_ts).format('HH:mm.ss'); 513 this.out_time_str = moment(this.out_ts).format('HH:mm.ss');
496 }); 514 });
497 515
498 - console.log('data', data);  
499 var htmlStr = template('multi_inout_info_cont_temp', {list: data}); 516 var htmlStr = template('multi_inout_info_cont_temp', {list: data});
500 $('.inout_table_wrap .ct_table_body', modal).html(htmlStr); 517 $('.inout_table_wrap .ct_table_body', modal).html(htmlStr);
501 }; 518 };
@@ -523,12 +540,18 @@ @@ -523,12 +540,18 @@
523 }; 540 };
524 541
525 542
526 - var matchOut = function (info, gps) {  
527 - if(!info)  
528 - return;  
529 - var outInfo = gps['inout_stop_info'];  
530 - if(info.stopName == outInfo.stopName){  
531 - info['out_ts'] = outInfo.ts; 543 + var matchOut = function (prevInfo, gps) {
  544 + var oi = gps['inout_stop_info'];
  545 + if(prevInfo && prevInfo.stopName == oi.stopName){
  546 + prevInfo['out_ts'] = oi.ts;
  547 + return null;
  548 + }
  549 + else {
  550 + return {
  551 + out_ts: oi.ts,
  552 + stopNo: oi.stopNo,
  553 + stopName: oi.stopName
  554 + }
532 } 555 }
533 }; 556 };
534 557
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 var gb_map_play_back = (function () { 3 var gb_map_play_back = (function () {
4 4
5 var dom; 5 var dom;
6 - $.get('/real_control_v2/mapmonitor/fragments/playback/main.html', function (rs) { 6 + $.get('/real_control_v2/mapmonitor/fragments/playback_v2/main.html', function (rs) {
7 dom = rs; 7 dom = rs;
8 }); 8 });
9 9
@@ -13,10 +13,11 @@ var gb_map_play_back = (function () { @@ -13,10 +13,11 @@ var gb_map_play_back = (function () {
13 gb_map_imap.call('closeWin', deviceId); 13 gb_map_imap.call('closeWin', deviceId);
14 14
15 //show modal 15 //show modal
16 - var modal = '#map-playback-modal';  
17 - $(document.body).append(dom);  
18 - UIkit.modal(modal, {bgclose: false}).show();  
19 - $(modal).trigger('show_form', {deviceId: deviceId, nbbm: nbbm}); 16 + open_modal_dom(dom, {deviceId: deviceId, nbbm: nbbm});
  17 + //var modal = '#map-playback2-modal';
  18 + //$(document.body).append(dom);
  19 + //UIkit.modal(modal, {bgclose: false}).show();
  20 + //$(modal).trigger('show_form', {deviceId: deviceId, nbbm: nbbm});
20 }; 21 };
21 22
22 //导出excel 23 //导出excel