Commit 62493ac8b12c9e8075422f0b27e4a9f4138f0622

Authored by 潘钊
1 parent 6e1bdc9c

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.GpsOutbound_DTO;
3 import com.bsth.service.gps.entity.GpsSpeed_DTO; 4 import com.bsth.service.gps.entity.GpsSpeed_DTO;
4 5
5 import java.util.List; 6 import java.util.List;
@@ -24,4 +25,6 @@ public interface GpsService { @@ -24,4 +25,6 @@ public interface GpsService {
24 Map<String,Object> history_v2(String nbbm, long st, long et); 25 Map<String,Object> history_v2(String nbbm, long st, long et);
25 26
26 List<GpsSpeed_DTO> speeds(String nbbm, long st, long et); 27 List<GpsSpeed_DTO> speeds(String nbbm, long st, long et);
  28 +
  29 + List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et);
27 } 30 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -11,9 +11,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -11,9 +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;  
15 -import com.bsth.service.gps.entity.HistoryGps_DTO;  
16 -import com.bsth.service.gps.entity.Road_DTO; 14 +import com.bsth.service.gps.entity.*;
17 import com.bsth.util.DateUtils; 15 import com.bsth.util.DateUtils;
18 import com.bsth.util.TransGPS; 16 import com.bsth.util.TransGPS;
19 import com.bsth.util.TransGPS.Location; 17 import com.bsth.util.TransGPS.Location;
@@ -207,7 +205,7 @@ public class GpsServiceImpl implements GpsService { @@ -207,7 +205,7 @@ public class GpsServiceImpl implements GpsService {
207 inv = inv.substring(0, inv.length() - 1); 205 inv = inv.substring(0, inv.length() - 1);
208 206
209 // 查询到离站数据 207 // 查询到离站数据
210 - Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv); 208 + Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear, st, et, inv);
211 209
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 (" 210 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 < ? ORDER BY device_id,ts,stop_no"; 211 + inv + ") and ts > ? and ts < ? ORDER BY device_id,ts,stop_no";
@@ -296,7 +294,7 @@ public class GpsServiceImpl implements GpsService { @@ -296,7 +294,7 @@ public class GpsServiceImpl implements GpsService {
296 prefix = lineId + "_" + updown + "_"; 294 prefix = lineId + "_" + updown + "_";
297 stationName = BasicData.getStationNameByCode(rs.getString("STOP_NO"), prefix); 295 stationName = BasicData.getStationNameByCode(rs.getString("STOP_NO"), prefix);
298 296
299 - if(StringUtils.isEmpty(stationName)) 297 + if (StringUtils.isEmpty(stationName))
300 continue; 298 continue;
301 299
302 arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), lineId, 300 arr = new ArrivalEntity(rs.getString("DEVICE_ID"), rs.getLong("TS"), lineId,
@@ -447,7 +445,7 @@ public class GpsServiceImpl implements GpsService { @@ -447,7 +445,7 @@ public class GpsServiceImpl implements GpsService {
447 return rs; 445 return rs;
448 } 446 }
449 447
450 - if(sch.isReissue()){ 448 + if (sch.isReissue()) {
451 rs.put("status", ResponseCode.ERROR); 449 rs.put("status", ResponseCode.ERROR);
452 rs.put("msg", "你不能重复这个操作"); 450 rs.put("msg", "你不能重复这个操作");
453 return rs; 451 return rs;
@@ -456,7 +454,7 @@ public class GpsServiceImpl implements GpsService { @@ -456,7 +454,7 @@ public class GpsServiceImpl implements GpsService {
456 String sql = "select * from bsth_gps_template where line_id='" + sch.getXlBm() + "' and up_down=" + sch.getXlDir(); 454 String sql = "select * from bsth_gps_template where line_id='" + sch.getXlBm() + "' and up_down=" + sch.getXlDir();
457 List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 455 List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
458 456
459 - if(list.size() == 0){ 457 + if (list.size() == 0) {
460 rs.put("status", ResponseCode.ERROR); 458 rs.put("status", ResponseCode.ERROR);
461 rs.put("msg", "缺少模板数据,请联系系统管理员!!"); 459 rs.put("msg", "缺少模板数据,请联系系统管理员!!");
462 return rs; 460 return rs;
@@ -473,21 +471,20 @@ public class GpsServiceImpl implements GpsService { @@ -473,21 +471,20 @@ public class GpsServiceImpl implements GpsService {
473 int diff = (int) (sch.getDfsjT() - Long.parseLong(fs.get("ts").toString()) - 1000 * 70); 471 int diff = (int) (sch.getDfsjT() - Long.parseLong(fs.get("ts").toString()) - 1000 * 70);
474 472
475 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); 473 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh());
476 - for(Map<String, Object> map : list){ 474 + for (Map<String, Object> map : list) {
477 map.put("device_id", deviceId); 475 map.put("device_id", deviceId);
478 map.put("ts", Long.parseLong(map.get("ts").toString()) + diff); 476 map.put("ts", Long.parseLong(map.get("ts").toString()) + diff);
479 } 477 }
480 478
481 - String sqlBefore = "insert into bsth_c_template("  
482 - ,sqlValues = " values("; 479 + String sqlBefore = "insert into bsth_c_template(", sqlValues = " values(";
483 480
484 Set<String> ks = fs.keySet(); 481 Set<String> ks = fs.keySet();
485 - for(String k : ks){ 482 + for (String k : ks) {
486 sqlBefore += (k + ","); 483 sqlBefore += (k + ",");
487 sqlValues += "?,"; 484 sqlValues += "?,";
488 } 485 }
489 sqlBefore = sqlBefore.substring(0, sqlBefore.length() - 1) + ", create_ts)"; 486 sqlBefore = sqlBefore.substring(0, sqlBefore.length() - 1) + ", create_ts)";
490 - sqlValues = sqlValues.substring(0, sqlValues.length() - 1) + ", "+System.currentTimeMillis()+")"; 487 + sqlValues = sqlValues.substring(0, sqlValues.length() - 1) + ", " + System.currentTimeMillis() + ")";
491 sql = sqlBefore + " " + sqlValues; 488 sql = sqlBefore + " " + sqlValues;
492 489
493 Connection conn = DBUtils_MS.getConnection(); 490 Connection conn = DBUtils_MS.getConnection();
@@ -495,9 +492,9 @@ public class GpsServiceImpl implements GpsService { @@ -495,9 +492,9 @@ public class GpsServiceImpl implements GpsService {
495 ps = conn.prepareStatement(sql); 492 ps = conn.prepareStatement(sql);
496 int fsize = ks.size(); 493 int fsize = ks.size();
497 List<Object> vs; 494 List<Object> vs;
498 - for(Map<String, Object> map : list){ 495 + for (Map<String, Object> map : list) {
499 vs = new ArrayList<>(map.values()); 496 vs = new ArrayList<>(map.values());
500 - for(int i = 0; i < fsize; i ++){ 497 + for (int i = 0; i < fsize; i++) {
501 ps.setObject(i + 1, vs.get(i)); 498 ps.setObject(i + 1, vs.get(i));
502 } 499 }
503 ps.addBatch(); 500 ps.addBatch();
@@ -526,24 +523,27 @@ public class GpsServiceImpl implements GpsService { @@ -526,24 +523,27 @@ public class GpsServiceImpl implements GpsService {
526 try { 523 try {
527 //获取历史gps 数据 524 //获取历史gps 数据
528 List<HistoryGps_DTO> list = HistoryGps_DTO.craete(history(new String[]{nbbm}, st, et)); 525 List<HistoryGps_DTO> list = HistoryGps_DTO.craete(history(new String[]{nbbm}, st, et));
529 - if(list!=null && list.size() > 0){ 526 + if (list != null && list.size() > 0) {
530 //获取路段信息 527 //获取路段信息
531 String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)"; 528 String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)";
532 List<Road_DTO> roads = Road_DTO.craete(jdbcTemplate.queryForList(sql, list.get(0).getLineId())); 529 List<Road_DTO> roads = Road_DTO.craete(jdbcTemplate.queryForList(sql, list.get(0).getLineId()));
533 530
534 //为GPS数据关联路段信息 531 //为GPS数据关联路段信息
535 - for(HistoryGps_DTO gps : list){ 532 + for (HistoryGps_DTO gps : list) {
536 matchRoadToGps(gps, roads); 533 matchRoadToGps(gps, roads);
537 } 534 }
538 } 535 }
539 536
540 //超速数据 537 //超速数据
541 -  
542 - 538 + List<GpsSpeed_DTO> speedList = speeds(nbbm, st, et);
  539 + //越界数据
  540 + List<GpsOutbound_DTO> outboundList = outbounds(nbbm, st, et);
543 541
544 rs.put("status", ResponseCode.SUCCESS); 542 rs.put("status", ResponseCode.SUCCESS);
545 rs.put("list", removeDuplicate(list)); 543 rs.put("list", removeDuplicate(list));
546 - }catch (Exception e){ 544 + rs.put("speedList", speedList);
  545 + rs.put("outboundList", outboundList);
  546 + } catch (Exception e) {
547 logger.error("", e); 547 logger.error("", e);
548 rs.put("status", ResponseCode.ERROR); 548 rs.put("status", ResponseCode.ERROR);
549 } 549 }
@@ -555,14 +555,30 @@ public class GpsServiceImpl implements GpsService { @@ -555,14 +555,30 @@ public class GpsServiceImpl implements GpsService {
555 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); 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<?"; 556 String sql = "select vehicle, line, up_down, lon, lat, speed,timestamp from bsth_c_speeding where vehicle=? and timestamp>? and timestamp<?";
557 557
558 - jdbcTemplate.queryForList(sql, deviceId, st, et);  
559 - return null; 558 + return GpsSpeed_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st * 1000, et * 1000));
560 } 559 }
561 560
562 - private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads){  
563 - double min = -1,distance; 561 + @Override
  562 + public List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et) {
  563 + /**
  564 + * 如果 st 和 et 跨了周分区,也只查询st 分区的数据。
  565 + */
  566 + st = st * 1000;
  567 + et = et * 1000;
  568 + //按周分区
  569 + Calendar weekCal = Calendar.getInstance();
  570 + weekCal.setTimeInMillis(st);
  571 + int weekYear = weekCal.get(Calendar.WEEK_OF_YEAR);
  572 + //设备号
  573 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  574 + String sql = "select vehicle,line,up_down,lon,lat,timestamp from bsth_c_outbound where weeks_year="+weekYear+" and vehicle=? and timestamp>? and timestamp<?";
  575 + return GpsOutbound_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st, et));
  576 + }
  577 +
  578 + private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads) {
  579 + double min = -1, distance;
564 Road_DTO nearRoad = null; 580 Road_DTO nearRoad = null;
565 - for(Road_DTO road : roads){ 581 + for (Road_DTO road : roads) {
566 distance = GeoUtils.getDistanceFromLine(road.getLineStr(), gps.getPoint()); 582 distance = GeoUtils.getDistanceFromLine(road.getLineStr(), gps.getPoint());
567 583
568 if (min > distance || min == -1) { 584 if (min > distance || min == -1) {
@@ -577,12 +593,13 @@ public class GpsServiceImpl implements GpsService { @@ -577,12 +593,13 @@ public class GpsServiceImpl implements GpsService {
577 593
578 /** 594 /**
579 * 去重复 595 * 去重复
  596 + *
580 * @param list 597 * @param list
581 * @return 598 * @return
582 */ 599 */
583 - private Set<HistoryGps_DTO> removeDuplicate(List<HistoryGps_DTO> list){ 600 + private Set<HistoryGps_DTO> removeDuplicate(List<HistoryGps_DTO> list) {
584 Set<HistoryGps_DTO> set = new HashSet<>(); 601 Set<HistoryGps_DTO> set = new HashSet<>();
585 - for(HistoryGps_DTO gps : list){ 602 + for (HistoryGps_DTO gps : list) {
586 set.add(gps); 603 set.add(gps);
587 } 604 }
588 return set; 605 return set;
src/main/java/com/bsth/service/gps/entity/GpsOutbound.java 0 → 100644
  1 +package com.bsth.service.gps.entity;
  2 +
  3 +/**
  4 + * 越界异常 --ms数据库格式
  5 + * Created by panzhao on 2017/4/9.
  6 + */
  7 +public class GpsOutbound {
  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 long timestamp;
  20 +
  21 + public String location(){
  22 + return lon + "," + lat;
  23 + }
  24 +
  25 + public String getVehicle() {
  26 + return vehicle;
  27 + }
  28 +
  29 + public void setVehicle(String vehicle) {
  30 + this.vehicle = vehicle;
  31 + }
  32 +
  33 + public String getLine() {
  34 + return line;
  35 + }
  36 +
  37 + public void setLine(String line) {
  38 + this.line = line;
  39 + }
  40 +
  41 + public int getUp_down() {
  42 + return up_down;
  43 + }
  44 +
  45 + public void setUp_down(int up_down) {
  46 + this.up_down = up_down;
  47 + }
  48 +
  49 + public float getLon() {
  50 + return lon;
  51 + }
  52 +
  53 + public void setLon(float lon) {
  54 + this.lon = lon;
  55 + }
  56 +
  57 + public float getLat() {
  58 + return lat;
  59 + }
  60 +
  61 + public void setLat(float lat) {
  62 + this.lat = lat;
  63 + }
  64 +
  65 + public long getTimestamp() {
  66 + return timestamp;
  67 + }
  68 +
  69 + public void setTimestamp(long timestamp) {
  70 + this.timestamp = timestamp;
  71 + }
  72 +}
src/main/java/com/bsth/service/gps/entity/GpsOutbound_DTO.java
1 package com.bsth.service.gps.entity; 1 package com.bsth.service.gps.entity;
2 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 +
3 /** 9 /**
4 * 越界异常 dto 10 * 越界异常 dto
5 * Created by panzhao on 2017/4/7. 11 * Created by panzhao on 2017/4/7.
6 */ 12 */
7 public class GpsOutbound_DTO { 13 public class GpsOutbound_DTO {
8 14
  15 + public static List<GpsOutbound_DTO> create(List<Map<String, Object>> mapList){
  16 + //默认都是一辆车的数据
  17 + List<GpsOutbound> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsOutbound.class);
  18 + GpsOutbound outbound;
  19 +
  20 + //排序
  21 + Collections.sort(list, new Comparator<GpsOutbound>() {
  22 + @Override
  23 + public int compare(GpsOutbound o1, GpsOutbound o2) {
  24 + return (int) (o1.getTimestamp() - o2.getTimestamp());
  25 + }
  26 + });
  27 +
  28 + int space = 1000 * 60;
  29 + int size = list.size();
  30 + StringBuffer locations = new StringBuffer("");
  31 +
  32 + List<GpsOutbound_DTO> rsList = new ArrayList<>();
  33 + GpsOutbound_DTO dto = null;
  34 +
  35 + for(int i = 0; i < size; i++){
  36 + outbound = list.get(i);
  37 + locations.append(outbound.location() + ";");
  38 + if(dto == null){
  39 + dto = new GpsOutbound_DTO();
  40 + dto.setDeviceId(outbound.getVehicle());
  41 + dto.setNbbm(BasicData.deviceId2NbbmMap.get(outbound.getVehicle()));
  42 + dto.setSt(outbound.getTimestamp());
  43 + }
  44 + else{
  45 + //越界结束
  46 + if((i < size - 1 && list.get(i + 1).getTimestamp() - outbound.getTimestamp() > space)){
  47 + dto.setEt(outbound.getTimestamp());
  48 + dto.setLocations(locations.toString());
  49 +
  50 + rsList.add(dto);
  51 + dto = null;
  52 + locations = new StringBuffer("");
  53 + continue;
  54 + }
  55 +
  56 + if(i == size - 1)
  57 + rsList.add(dto);
  58 + }
  59 + }
  60 +
  61 + return rsList;
  62 + }
  63 +
9 /** 64 /**
10 * 设备号 65 * 设备号
11 */ 66 */
@@ -31,6 +86,8 @@ public class GpsOutbound_DTO { @@ -31,6 +86,8 @@ public class GpsOutbound_DTO {
31 */ 86 */
32 private String locations; 87 private String locations;
33 88
  89 + private String abnormalType = "outbound";
  90 +
34 public String getDeviceId() { 91 public String getDeviceId() {
35 return deviceId; 92 return deviceId;
36 } 93 }
@@ -70,4 +127,12 @@ public class GpsOutbound_DTO { @@ -70,4 +127,12 @@ public class GpsOutbound_DTO {
70 public void setLocations(String locations) { 127 public void setLocations(String locations) {
71 this.locations = locations; 128 this.locations = locations;
72 } 129 }
  130 +
  131 + public String getAbnormalType() {
  132 + return abnormalType;
  133 + }
  134 +
  135 + public void setAbnormalType(String abnormalType) {
  136 + this.abnormalType = abnormalType;
  137 + }
73 } 138 }
src/main/java/com/bsth/service/gps/entity/GpsSpeed.java
1 package com.bsth.service.gps.entity; 1 package com.bsth.service.gps.entity;
2 2
3 /** 3 /**
4 - * 超速异常 -数据库序列化格式 4 + * 超速异常 -ms数据库格式
5 * Created by panzhao on 2017/4/7. 5 * Created by panzhao on 2017/4/7.
6 */ 6 */
7 public class GpsSpeed { 7 public class GpsSpeed {
src/main/java/com/bsth/service/gps/entity/GpsSpeed_DTO.java
@@ -15,7 +15,7 @@ public class GpsSpeed_DTO { @@ -15,7 +15,7 @@ public class GpsSpeed_DTO {
15 public static List<GpsSpeed_DTO> create(List<Map<String, Object>> mapList){ 15 public static List<GpsSpeed_DTO> create(List<Map<String, Object>> mapList){
16 //默认都是一辆车的数据 16 //默认都是一辆车的数据
17 List<GpsSpeed> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsSpeed.class); 17 List<GpsSpeed> list = JSONObject.parseArray(JSON.toJSONString(mapList), GpsSpeed.class);
18 - 18 + GpsSpeed gs;
19 //排序 19 //排序
20 Collections.sort(list, new Comparator<GpsSpeed>() { 20 Collections.sort(list, new Comparator<GpsSpeed>() {
21 @Override 21 @Override
@@ -24,11 +24,14 @@ public class GpsSpeed_DTO { @@ -24,11 +24,14 @@ public class GpsSpeed_DTO {
24 } 24 }
25 }); 25 });
26 26
  27 + int space = 1000 * 60;
  28 + int size = list.size();
  29 +
27 List<GpsSpeed_DTO> rsList = new ArrayList<>(); 30 List<GpsSpeed_DTO> rsList = new ArrayList<>();
28 GpsSpeed_DTO dto = null; 31 GpsSpeed_DTO dto = null;
29 - //合并连续数据  
30 - for(GpsSpeed gs : list){  
31 32
  33 + for(int i = 0; i < size; i++){
  34 + gs = list.get(i);
32 if(dto == null){ 35 if(dto == null){
33 dto = new GpsSpeed_DTO(); 36 dto = new GpsSpeed_DTO();
34 dto.setDeviceId(gs.getVehicle()); 37 dto.setDeviceId(gs.getVehicle());
@@ -37,11 +40,23 @@ public class GpsSpeed_DTO { @@ -37,11 +40,23 @@ public class GpsSpeed_DTO {
37 dto.setSpeed(gs.getSpeed()); 40 dto.setSpeed(gs.getSpeed());
38 } 41 }
39 else{ 42 else{
40 - 43 + //超速结束
  44 + if((i < size - 1 && list.get(i + 1).getTimestamp() - gs.getTimestamp() > space)){
  45 + dto.setEt(gs.getTimestamp());
  46 + rsList.add(dto);
  47 + dto = null;
  48 + continue;
  49 + }
  50 +
  51 + //记录最大速度
  52 + if(gs.getSpeed() > dto.getSpeed())
  53 + dto.setSpeed(gs.getSpeed());
  54 +
  55 + if(i == size - 1)
  56 + rsList.add(dto);
41 } 57 }
42 } 58 }
43 -  
44 - return null; 59 + return rsList;
45 } 60 }
46 61
47 /** 62 /**
@@ -69,6 +84,8 @@ public class GpsSpeed_DTO { @@ -69,6 +84,8 @@ public class GpsSpeed_DTO {
69 */ 84 */
70 private float speed; 85 private float speed;
71 86
  87 + private String abnormalType = "speed";
  88 +
72 public String getDeviceId() { 89 public String getDeviceId() {
73 return deviceId; 90 return deviceId;
74 } 91 }
@@ -108,4 +125,12 @@ public class GpsSpeed_DTO { @@ -108,4 +125,12 @@ public class GpsSpeed_DTO {
108 public void setSpeed(float speed) { 125 public void setSpeed(float speed) {
109 this.speed = speed; 126 this.speed = speed;
110 } 127 }
  128 +
  129 + public String getAbnormalType() {
  130 + return abnormalType;
  131 + }
  132 +
  133 + public void setAbnormalType(String abnormalType) {
  134 + this.abnormalType = abnormalType;
  135 + }
111 } 136 }
src/main/resources/static/real_control_v2/assets/imgs/icon/pause.png 0 → 100644

2.29 KB

src/main/resources/static/real_control_v2/assets/imgs/icon/play.png 0 → 100644

2.36 KB

src/main/resources/static/real_control_v2/mapmonitor/css/real.css
@@ -800,4 +800,103 @@ input[type=checkbox].disabled{ @@ -800,4 +800,103 @@ input[type=checkbox].disabled{
800 .cc_info_accordion{ 800 .cc_info_accordion{
801 height: calc(100% - 40px); 801 height: calc(100% - 40px);
802 overflow: auto; 802 overflow: auto;
  803 +}
  804 +
  805 +.map-wrap-tools{
  806 + position: absolute;
  807 + top: 0;
  808 + width: 100%;
  809 + background: #ffffff;
  810 + z-index: 10;
  811 + box-shadow: 3px 1px 8px 0 rgba(0, 0, 0, 0.12), 1px 0px 8px 0 rgba(0, 0, 0, 0.12);
  812 + height: 70px;
  813 + display: none;
  814 +}
  815 +
  816 +.map-container{
  817 + width: 100%;
  818 + height: 100%;
  819 +}
  820 +
  821 +#map-playback2-modal .uk-modal-close{
  822 + z-index: 11;
  823 +}
  824 +
  825 +.map-wrap-tools .ct-progress-bar{
  826 + position: absolute;
  827 + height: 11px;
  828 + width: 100%;
  829 + bottom: 0;
  830 + cursor: pointer;
  831 + /*border-top: 5px solid white;*/
  832 +}
  833 +
  834 +.map-wrap-tools .ct-progress-bar .scale{
  835 + width: 85%;
  836 + height: 6px;
  837 + border-top: 5px solid white;
  838 + background: #2bc2d5;
  839 +}
  840 +
  841 +.map-wrap-tools .btns{
  842 + padding: 5px 10px 0 25px;
  843 +}
  844 +
  845 +.map-wrap-tools .btns>span.ct_btn{
  846 + cursor: pointer;
  847 +}
  848 +
  849 +.map-wrap-tools .btns>.play_btn{
  850 + width: 48px;
  851 + height: 48px;
  852 + display: inline-block;
  853 + background: url("/real_control_v2/assets/imgs/icon/play.png");
  854 + margin-right: 10px;
  855 +}
  856 +
  857 +.map-wrap-tools .btns>.play_btn.play{
  858 + background: url("/real_control_v2/assets/imgs/icon/pause.png");
  859 +}
  860 +
  861 +.map-wrap-tools .btns>.play_btn:hover{
  862 + box-shadow: 0px 0px 8px 0 rgba(220, 35, 35, 0.61), 0px 0px 8px 0 rgba(206, 50, 50, 0.26);
  863 + border-radius: 35px;
  864 +}
  865 +
  866 +.map-wrap-tools .btns>.multi-items{
  867 + display: inline-block;
  868 + vertical-align: top;
  869 + background: #e7e4e4;
  870 + padding: 7px 15px;
  871 + margin: 12px 5px;
  872 + border-radius: 5px;
  873 +}
  874 +
  875 +.map-wrap-tools .btns>.multi-items label{
  876 + margin-right: 10px;
  877 +}
  878 +
  879 +.map-wrap-tools .btns>.multi-items label:last-child{
  880 + margin-right: 0;
  881 +}
  882 +
  883 +.map-wrap-tools .ct_btn.text-panel{
  884 + vertical-align: top;
  885 + display: inline-block;
  886 + margin-top: 8px;
  887 + margin-left: 15px;
  888 + font-size: 13px;
  889 +}
  890 +
  891 +.map-wrap-tools .ct_btn.a.export-excel {
  892 + color: #F44336;
  893 +}
  894 +
  895 +.map-wrap-tools .ct_btn.clock{
  896 + display: inline-block;
  897 + vertical-align: top;
  898 + margin-top: 22px;
  899 + font-size: 22px;
  900 + color: #8b8686;
  901 + margin-right: 10px;
803 } 902 }
804 \ No newline at end of file 903 \ No newline at end of file
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
@@ -78,127 +78,6 @@ @@ -78,127 +78,6 @@
78 </dl> 78 </dl>
79 </div> 79 </div>
80 <div class="ct_table_body"> 80 <div class="ct_table_body">
81 - <dl>  
82 - <dd>超速(80)</dd>  
83 - <dd>05:00.20</dd>  
84 - <dd>05:00.20</dd>  
85 - <dd></dd>  
86 - </dl>  
87 - <dl>  
88 - <dd>越界</dd>  
89 - <dd>05:00.20</dd>  
90 - <dd>05:00.20</dd>  
91 - <dd></dd>  
92 - </dl>  
93 - <dl>  
94 - <dd>超速(80)</dd>  
95 - <dd>05:00.20</dd>  
96 - <dd>05:00.20</dd>  
97 - <dd></dd>  
98 - </dl>  
99 - <dl>  
100 - <dd>越界</dd>  
101 - <dd>05:00.20</dd>  
102 - <dd>05:00.20</dd>  
103 - <dd></dd>  
104 - </dl>  
105 - <dl>  
106 - <dd>超速(180)</dd>  
107 - <dd>05:00.20</dd>  
108 - <dd>05:00.20</dd>  
109 - <dd></dd>  
110 - </dl>  
111 - <dl>  
112 - <dd>越界</dd>  
113 - <dd>05:00.20</dd>  
114 - <dd>05:00.20</dd>  
115 - <dd></dd>  
116 - </dl>  
117 - <dl>  
118 - <dd>超速(80)</dd>  
119 - <dd>05:00.20</dd>  
120 - <dd>05:00.20</dd>  
121 - <dd></dd>  
122 - </dl>  
123 - <dl>  
124 - <dd>越界</dd>  
125 - <dd>05:00.20</dd>  
126 - <dd>05:00.20</dd>  
127 - <dd></dd>  
128 - </dl>  
129 - <dl>  
130 - <dd>超速(80)</dd>  
131 - <dd>05:00.20</dd>  
132 - <dd>05:00.20</dd>  
133 - <dd></dd>  
134 - </dl>  
135 - <dl>  
136 - <dd>越界</dd>  
137 - <dd>05:00.20</dd>  
138 - <dd>05:00.20</dd>  
139 - <dd></dd>  
140 - </dl>  
141 - <dl>  
142 - <dd>超速(80)</dd>  
143 - <dd>05:00.20</dd>  
144 - <dd>05:00.20</dd>  
145 - <dd></dd>  
146 - </dl>  
147 - <dl>  
148 - <dd>越界</dd>  
149 - <dd>05:00.20</dd>  
150 - <dd>05:00.20</dd>  
151 - <dd></dd>  
152 - </dl>  
153 - <dl>  
154 - <dd>超速(80)</dd>  
155 - <dd>05:00.20</dd>  
156 - <dd>05:00.20</dd>  
157 - <dd></dd>  
158 - </dl>  
159 - <dl>  
160 - <dd>越界</dd>  
161 - <dd>05:00.20</dd>  
162 - <dd>05:00.20</dd>  
163 - <dd></dd>  
164 - </dl>  
165 - <dl>  
166 - <dd>超速(80)</dd>  
167 - <dd>05:00.20</dd>  
168 - <dd>05:00.20</dd>  
169 - <dd></dd>  
170 - </dl>  
171 - <dl>  
172 - <dd>越界</dd>  
173 - <dd>05:00.20</dd>  
174 - <dd>05:00.20</dd>  
175 - <dd></dd>  
176 - </dl>  
177 - <dl>  
178 - <dd>超速(80)</dd>  
179 - <dd>05:00.20</dd>  
180 - <dd>05:00.20</dd>  
181 - <dd></dd>  
182 - </dl>  
183 - <dl>  
184 - <dd>越界</dd>  
185 - <dd>05:00.20</dd>  
186 - <dd>05:00.20</dd>  
187 - <dd></dd>  
188 - </dl>  
189 - <dl>  
190 - <dd>超速(80)</dd>  
191 - <dd>05:00.20</dd>  
192 - <dd>05:00.20</dd>  
193 - <dd></dd>  
194 - </dl>  
195 - <dl>  
196 - <dd>越界</dd>  
197 - <dd>05:00.20</dd>  
198 - <dd>05:00.20</dd>  
199 - <dd></dd>  
200 - </dl>  
201 -  
202 </div> 81 </div>
203 </div> 82 </div>
204 </div> 83 </div>
@@ -254,7 +133,55 @@ @@ -254,7 +133,55 @@
254 </div> 133 </div>
255 </div> 134 </div>
256 </div> 135 </div>
257 - <div class="uk-width-medium-7-10 uk-height-viewport map-wrap"> 136 + <div class="uk-width-medium-7-10 uk-height-viewport map-wrap" style="padding-left: 0;position: relative;">
  137 + <div class="map-wrap-tools uk-animation-slide-top">
  138 + <div class="btns">
  139 + <span class="ct_btn play_btn"></span>
  140 + <span class="ct_btn clock">
  141 + 08:20.10
  142 + </span>
  143 + <div class="multi-items">
  144 + <form class="uk-form">
  145 + <label>
  146 + <input type="radio" name="playSpeed"> x1
  147 + </label>
  148 + <label>
  149 + <input type="radio" name="playSpeed"> x5
  150 + </label>
  151 + <label>
  152 + <input type="radio" name="playSpeed"> x10
  153 + </label>
  154 + <label>
  155 + <input type="radio" name="playSpeed"> x20
  156 + </label>
  157 + </form>
  158 + </div>
  159 + <div class="multi-items">
  160 + <form class="uk-form">
  161 + <label>
  162 + <input type="checkbox"> 站点
  163 + </label>
  164 + <label>
  165 + <input type="checkbox"> 缓冲区
  166 + </label>
  167 + <label>
  168 + <input type="checkbox"> 站点名称
  169 + </label>
  170 + <label>
  171 + 停车场 <i class="uk-icon-angle-down"></i>
  172 + </label>
  173 + </form>
  174 + </div>
  175 + <span class="ct_btn text-panel">
  176 + <span>约12.58公里,1258个GPS点</span><br>
  177 + <a class="export-excel"><i class="uk-icon-file-excel-o"></i> 导出轨迹</a>
  178 + </span>
  179 + </div>
  180 + <div class="ct-progress-bar" >
  181 + <div class="scale"></div>
  182 + </div>
  183 + </div>
  184 + <div class="map-container"></div>
258 </div> 185 </div>
259 </div> 186 </div>
260 </div> 187 </div>
@@ -293,6 +220,23 @@ @@ -293,6 +220,23 @@
293 </dl> 220 </dl>
294 {{/each}} 221 {{/each}}
295 </script> 222 </script>
  223 +
  224 + <script id="abnormal_table_cont_temp" type="text/html">
  225 + {{each array as item i}}
  226 + <dl>
  227 + <dd>
  228 + {{if item.abnormalType == 'speed'}}
  229 + 超速({{item.speed}})
  230 + {{else if item.abnormalType == 'outbound'}}
  231 + 越界
  232 + {{/if}}
  233 + </dd>
  234 + <dd>{{item.st_str}}</dd>
  235 + <dd>{{item.et_str}}</dd>
  236 + <dd></dd>
  237 + </dl>
  238 + {{/each}}
  239 + </script>
296 <script> 240 <script>
297 (function () { 241 (function () {
298 var modal = '#map-playback2-modal', gpsArray; 242 var modal = '#map-playback2-modal', gpsArray;
@@ -300,7 +244,7 @@ @@ -300,7 +244,7 @@
300 $(modal).on('init', function (e, data) { 244 $(modal).on('init', function (e, data) {
301 try { 245 try {
302 //初始化地图 246 //初始化地图
303 - map = new BMap.Map($('.map-wrap', modal)[0]); 247 + map = new BMap.Map($('.map-container', modal)[0]);
304 //中心点和缩放级别 248 //中心点和缩放级别
305 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16); 249 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16);
306 map.enableScrollWheelZoom(); 250 map.enableScrollWheelZoom();
@@ -380,9 +324,9 @@ @@ -380,9 +324,9 @@
380 $('[name=eTime]', f).val(et.format('HH:mm'));*/ 324 $('[name=eTime]', f).val(et.format('HH:mm'));*/
381 325
382 326
383 - $('[name=nbbm]', f).val('W0A-157'); 327 + $('[name=nbbm]', f).val('W0A-018');
384 $('[name=sDate]', f).val('2017-04-06'); 328 $('[name=sDate]', f).val('2017-04-06');
385 - $('[name=sTime]', f).val('07:49'); 329 + $('[name=sTime]', f).val('04:49');
386 330
387 $('[name=eDate]', f).val('2017-04-06'); 331 $('[name=eDate]', f).val('2017-04-06');
388 $('[name=eTime]', f).val('09:49'); 332 $('[name=eTime]', f).val('09:49');
@@ -427,11 +371,14 @@ @@ -427,11 +371,14 @@
427 gpsArray.sort(function (a, b) { 371 gpsArray.sort(function (a, b) {
428 return parseInt((a.ts - b.ts) + '' + (a.stop_no - b.stop_no)); 372 return parseInt((a.ts - b.ts) + '' + (a.stop_no - b.stop_no));
429 }); 373 });
430 - console.log('gpsArray', gpsArray);  
431 //行车轨迹 374 //行车轨迹
432 trailTableObj.showInitData(gpsArray); 375 trailTableObj.showInitData(gpsArray);
433 //到离站信息 376 //到离站信息
434 inOutStationTableObj.showInitData(gpsArray); 377 inOutStationTableObj.showInitData(gpsArray);
  378 + //异常信息
  379 + abnormalTableObj.showInitData(rs['outboundList'], rs['speedList']);
  380 + //show 工具条
  381 + mapTools.show();
435 } 382 }
436 }); 383 });
437 } 384 }
@@ -492,7 +439,7 @@ @@ -492,7 +439,7 @@
492 439
493 if (gps['inout_stop'] == 0) { 440 if (gps['inout_stop'] == 0) {
494 //连续进站信号,取第一个 441 //连续进站信号,取第一个
495 - if(prev['out_ts'] == null 442 + if(prev && prev['out_ts'] == null
496 && prev['stopName'] == gps['inout_stop_info'].stopName){ 443 && prev['stopName'] == gps['inout_stop_info'].stopName){
497 return true; 444 return true;
498 } 445 }
@@ -519,11 +466,6 @@ @@ -519,11 +466,6 @@
519 466
520 var add = function (gps) { 467 var add = function (gps) {
521 468
522 - /*if (gps.inout_stop == -1)  
523 - return;  
524 -  
525 - var htmlStr = template('', {obj: gps['inout_stop_info']});  
526 - $('.inout_table_wrap .ct_table .ct_table_body', modal).html(htmlStr);*/  
527 }; 469 };
528 470
529 var clear = function () { 471 var clear = function () {
@@ -559,6 +501,59 @@ @@ -559,6 +501,59 @@
559 showInitData: showInitData 501 showInitData: showInitData
560 }; 502 };
561 })(); 503 })();
  504 +
  505 + /**
  506 + * 异常信息表格
  507 + * @type {{showInitData}}
  508 + */
  509 + var abnormalTableObj = (function () {
  510 +
  511 + var showInitData = function () {
  512 + var array = [];
  513 + for(var i = 0; i < arguments.length; i ++){
  514 + array = array.concat(arguments[i]);
  515 + }
  516 + //格式化时间
  517 + $.each(array, function () {
  518 + if(this.st)
  519 + this.st_str = moment(this.st).format('HH:mm.ss');
  520 + if(this.et)
  521 + this.et_str = moment(this.et).format('HH:mm.ss');
  522 + });
  523 +
  524 + var htmlStr = template('abnormal_table_cont_temp', {array: array});
  525 + $('.abnormal_table .ct_table_body', modal).html(htmlStr);
  526 + };
  527 +
  528 + return {
  529 + showInitData: showInitData
  530 + }
  531 + })();
  532 +
  533 + /**
  534 + * 工具条相关
  535 + */
  536 + var mapTools = (function () {
  537 +
  538 + $('.map-wrap-tools .play_btn', modal).on('click', function () {
  539 + if($(this).hasClass('play')){
  540 + //暂停
  541 + $(this).removeClass('play');
  542 + }
  543 + else {
  544 + //播放
  545 + $(this).addClass('play');
  546 + }
  547 + });
  548 +
  549 + var show = function () {
  550 + $('.map-wrap-tools').show();
  551 + };
  552 +
  553 + return {
  554 + show: show
  555 + }
  556 + })();
562 })(); 557 })();
563 </script> 558 </script>
564 </div> 559 </div>
565 \ No newline at end of file 560 \ No newline at end of file