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
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -323,13 +323,13 @@ public class GpsServiceImpl implements GpsService { |
| 323 | 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 | 327 | List<DeviceChange> dcs = null; |
| 328 | 328 | List<DeviceChange> rs = new ArrayList<>(); |
| 329 | 329 | try{ |
| 330 | 330 | |
| 331 | 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 | 333 | , BeanPropertyRowMapper.newInstance(DeviceChange.class)); |
| 334 | 334 | |
| 335 | 335 | |
| ... | ... | @@ -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 | 356 | for(int i = 0,len=dcs.size(); i < len - 1; i++){ |
| 344 | 357 | dcs.get(i).setEt(dcs.get(i + 1).getSt()); |
| 345 | 358 | } |
| 346 | 359 | |
| 347 | 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 | 368 | }catch (Exception e){ |
| 352 | 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 | 7 | public class DeviceChange { |
| 8 | 8 | |
| 9 | 9 | private String nbbm; |
| 10 | + private String oldDevice; | |
| 10 | 11 | private String device; |
| 11 | 12 | private long st; |
| 12 | 13 | private long et; |
| ... | ... | @@ -53,4 +54,12 @@ public class DeviceChange { |
| 53 | 54 | public void setType(int type) { |
| 54 | 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 | 231 | var deviceStr='', fs='YYYY-MM-DD HH:mm'; |
| 232 | 232 | for(var i=0,dc;dc=rs.dcs[i++];){ |
| 233 | 233 | deviceStr+=dc.device + ','; |
| 234 | - dc.stStr = moment(dc.st).format(fs); | |
| 234 | + dc.stStr = dc.st>0?moment(dc.st).format(fs):''; | |
| 235 | 235 | dc.etStr = dc.et>0?moment(dc.et).format(fs):''; |
| 236 | 236 | } |
| 237 | 237 | deviceStr=deviceStr.substr(0, deviceStr.length-1); | ... | ... |