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