Commit 57dc87b83bd39bd824c9fb575e663d6698503ecc
1 parent
cbc35119
update...
Showing
2 changed files
with
17 additions
and
1 deletions
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.utils; |
| 2 | 2 | |
| 3 | +import com.bsth.data.gpsdata_v2.GpsRealData; | |
| 3 | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 4 | 5 | import org.slf4j.Logger; |
| 5 | 6 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -24,7 +25,22 @@ public class GpsDataUtils { |
| 24 | 25 | List<GpsEntity> rs = new ArrayList<>(); |
| 25 | 26 | |
| 26 | 27 | try { |
| 28 | + GpsEntity prev; | |
| 27 | 29 | for (GpsEntity gps : list) { |
| 30 | + prev = GpsRealData.get(gps.getDeviceId()); | |
| 31 | + | |
| 32 | + //不接收过期数据 | |
| 33 | + if(prev != null){ | |
| 34 | + | |
| 35 | + if(gps.getTimestamp().longValue() < prev.getTimestamp().longValue()) | |
| 36 | + continue; | |
| 37 | + | |
| 38 | + if(prev.getTimestamp().equals(gps.getTimestamp())&& | |
| 39 | + prev.getLat().equals(gps.getLat()) && | |
| 40 | + prev.getLon().equals(gps.getLon())) | |
| 41 | + continue; | |
| 42 | + } | |
| 43 | + | |
| 28 | 44 | if (gps.getValid() == 0 && Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) < 1000 * 60 * 20) |
| 29 | 45 | rs.add(gps); |
| 30 | 46 | } | ... | ... |