Commit e0e4519326739fb2b28ba8cd3ab01d2798b54e14

Authored by panzh
1 parent ecfdcc98

update...

src/main/java/com/bsth/data/history/HistoryConsumeTimeDataHandler.java
... ... @@ -102,7 +102,7 @@ public class HistoryConsumeTimeDataHandler {
102 102 return rs;
103 103 }
104 104  
105   - public static GpsEntity prevIn(String device){
  105 + public static GpsEntity prevIn(String device) {
106 106 return lastInStationMap.get(device);
107 107 }
108 108  
... ... @@ -207,20 +207,24 @@ public class HistoryConsumeTimeDataHandler {
207 207 || gps.getStationCode().equals(prev.getStationCode()))
208 208 return;
209 209  
210   - GpsEntity lastInGps = lastInStationMap.get(gps.getDeviceId());
  210 + String device = gps.getDeviceId();
  211 +
  212 + GpsEntity lastInGps = lastInStationMap.get(device);
211 213 if (null == lastInGps)
212   - lastInStationMap.put(gps.getDeviceId(), gps);
  214 + lastInStationMap.put(device, gps);
213 215  
214 216 if (gps.getUpDown().intValue() != prev.getUpDown().intValue()
215 217 || null == lastInGps
216 218 || !lastInGps.getStationCode().equals(prev.getStationCode())
217 219 || prev.getTimestamp() - lastInGps.getTimestamp() > 1000 * 60 * 60) {
  220 +
  221 + lastInStationMap.remove(device);
218 222 return;
219 223 }
220 224  
221 225 StationConsumeTime sct = StationConsumeTime.getInstance(lastInGps, gps);
222 226 pstQueue.add(sct);
223   - lastInStationMap.put(gps.getDeviceId(), gps);
  227 + lastInStationMap.put(device, gps);
224 228 }
225 229  
226 230 @Component
... ...