Commit 5ada920536cfc5c558083f528abd63af33089b15
1 parent
3ef63285
update...
Showing
4 changed files
with
31 additions
and
7 deletions
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
| @@ -148,8 +148,6 @@ public class GpsRealData { | @@ -148,8 +148,6 @@ public class GpsRealData { | ||
| 148 | gps.setRemark("执行 " + sch.getXlName() + " " + sch.getDfsj() + " 班次"); | 148 | gps.setRemark("执行 " + sch.getXlName() + " " + sch.getDfsj() + " 班次"); |
| 149 | gps.setPlanCode(sch.getXlBm()); | 149 | gps.setPlanCode(sch.getXlBm()); |
| 150 | } | 150 | } |
| 151 | - else | ||
| 152 | - gps.setRemark(null); | ||
| 153 | }else | 151 | }else |
| 154 | gps.setRemark(null); | 152 | gps.setRemark(null); |
| 155 | 153 |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -323,13 +323,13 @@ public class GpsServiceImpl implements GpsService { | @@ -323,13 +323,13 @@ public class GpsServiceImpl implements GpsService { | ||
| 323 | return map.containsKey(key)?Float.parseFloat(map.get(key).toString()):-1; | 323 | return map.containsKey(key)?Float.parseFloat(map.get(key).toString()):-1; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | - private List<DeviceChange> findDeviceChangeLogs(String nbbm, long t, long st){ | 326 | + private List<DeviceChange> findDeviceChangeLogs(String nbbm, long et, long st){ |
| 327 | List<DeviceChange> dcs = null; | 327 | List<DeviceChange> dcs = null; |
| 328 | List<DeviceChange> rs = new ArrayList<>(); | 328 | List<DeviceChange> rs = new ArrayList<>(); |
| 329 | try{ | 329 | try{ |
| 330 | 330 | ||
| 331 | //JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); | 331 | //JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 332 | - dcs = jdbcTemplate.query("select cl_zbh as nbbm,new_device_no as device,UNIX_TIMESTAMP(qyrq) * 1000 as st from bsth_c_car_device where cl_zbh='"+nbbm+"' and UNIX_TIMESTAMP(qyrq)<" + (t / 1000) | 332 | + dcs = jdbcTemplate.query("select cl_zbh as nbbm,new_device_no as device,old_device_no as old_device,UNIX_TIMESTAMP(qyrq) * 1000 as st from bsth_c_car_device where cl_zbh='"+nbbm+"'" |
| 333 | , BeanPropertyRowMapper.newInstance(DeviceChange.class)); | 333 | , BeanPropertyRowMapper.newInstance(DeviceChange.class)); |
| 334 | 334 | ||
| 335 | 335 | ||
| @@ -340,13 +340,30 @@ public class GpsServiceImpl implements GpsService { | @@ -340,13 +340,30 @@ public class GpsServiceImpl implements GpsService { | ||
| 340 | } | 340 | } |
| 341 | }); | 341 | }); |
| 342 | 342 | ||
| 343 | + //生成一条初始记录 | ||
| 344 | + if(dcs.size() > 0){ | ||
| 345 | + DeviceChange first = dcs.get(0); | ||
| 346 | + | ||
| 347 | + DeviceChange initDv = new DeviceChange(); | ||
| 348 | + initDv.setDevice(first.getOldDevice()); | ||
| 349 | + if(StringUtils.isNotEmpty(initDv.getDevice())){ | ||
| 350 | + initDv.setNbbm(first.getNbbm()); | ||
| 351 | + initDv.setSt(0); | ||
| 352 | + initDv.setEt(first.getSt()); | ||
| 353 | + dcs.add(0, initDv); | ||
| 354 | + } | ||
| 355 | + } | ||
| 343 | for(int i = 0,len=dcs.size(); i < len - 1; i++){ | 356 | for(int i = 0,len=dcs.size(); i < len - 1; i++){ |
| 344 | dcs.get(i).setEt(dcs.get(i + 1).getSt()); | 357 | dcs.get(i).setEt(dcs.get(i + 1).getSt()); |
| 345 | } | 358 | } |
| 346 | 359 | ||
| 347 | for(DeviceChange dc : dcs){ | 360 | for(DeviceChange dc : dcs){ |
| 348 | - if(dc.getEt() > st || dc.getEt()==0) | ||
| 349 | - rs.add(dc); | 361 | + if(dc.getEt() < st && dc.getEt() != 0) |
| 362 | + continue; | ||
| 363 | + if(dc.getSt() > et) | ||
| 364 | + continue; | ||
| 365 | + | ||
| 366 | + rs.add(dc); | ||
| 350 | } | 367 | } |
| 351 | }catch (Exception e){ | 368 | }catch (Exception e){ |
| 352 | logger.error("", e); | 369 | logger.error("", e); |
src/main/java/com/bsth/service/gps/entity/DeviceChange.java
| @@ -7,6 +7,7 @@ package com.bsth.service.gps.entity; | @@ -7,6 +7,7 @@ package com.bsth.service.gps.entity; | ||
| 7 | public class DeviceChange { | 7 | public class DeviceChange { |
| 8 | 8 | ||
| 9 | private String nbbm; | 9 | private String nbbm; |
| 10 | + private String oldDevice; | ||
| 10 | private String device; | 11 | private String device; |
| 11 | private long st; | 12 | private long st; |
| 12 | private long et; | 13 | private long et; |
| @@ -53,4 +54,12 @@ public class DeviceChange { | @@ -53,4 +54,12 @@ public class DeviceChange { | ||
| 53 | public void setType(int type) { | 54 | public void setType(int type) { |
| 54 | this.type = type; | 55 | this.type = type; |
| 55 | } | 56 | } |
| 57 | + | ||
| 58 | + public String getOldDevice() { | ||
| 59 | + return oldDevice; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setOldDevice(String oldDevice) { | ||
| 63 | + this.oldDevice = oldDevice; | ||
| 64 | + } | ||
| 56 | } | 65 | } |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/left.html
| @@ -231,7 +231,7 @@ | @@ -231,7 +231,7 @@ | ||
| 231 | var deviceStr='', fs='YYYY-MM-DD HH:mm'; | 231 | var deviceStr='', fs='YYYY-MM-DD HH:mm'; |
| 232 | for(var i=0,dc;dc=rs.dcs[i++];){ | 232 | for(var i=0,dc;dc=rs.dcs[i++];){ |
| 233 | deviceStr+=dc.device + ','; | 233 | deviceStr+=dc.device + ','; |
| 234 | - dc.stStr = moment(dc.st).format(fs); | 234 | + dc.stStr = dc.st>0?moment(dc.st).format(fs):''; |
| 235 | dc.etStr = dc.et>0?moment(dc.et).format(fs):''; | 235 | dc.etStr = dc.et>0?moment(dc.et).format(fs):''; |
| 236 | } | 236 | } |
| 237 | deviceStr=deviceStr.substr(0, deviceStr.length-1); | 237 | deviceStr=deviceStr.substr(0, deviceStr.length-1); |