|
|
@@ -145,23 +145,25 @@ public class CabinetUtil {
|
|
|
if(StrUtil.isNotEmpty(car.getDeviceInfos())){
|
|
|
JSONUtil.parseArray(car.getDeviceInfos()).forEach(item->{
|
|
|
JSONObject c = (JSONObject)item;
|
|
|
- if(c.getStr("type").equals("gps")){
|
|
|
- GpsData gpsData = RedisUtils.getCacheObject(StringUtils.format("gps_{}", c.getStr("code")));
|
|
|
- //1小时就离线
|
|
|
- Map<String,Object> map=new HashMap<>();
|
|
|
- if(gpsData.getTs()==null){
|
|
|
- gpsData.setTs(DateUtil.date());
|
|
|
+ try {
|
|
|
+ if (c.getStr("type").equals("gps")) {
|
|
|
+ GpsData gpsData = RedisUtils.getCacheObject(StringUtils.format("gps_{}", c.getStr("code")));
|
|
|
+ //1小时就离线
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (gpsData.getTs() == null) {
|
|
|
+ gpsData.setTs(DateUtil.date());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DateUtil.current() - gpsData.getTs().getTime() > 1000 * 60 * 60) {
|
|
|
+ map.put("code", c.getStr("code"));
|
|
|
+ map.put("time", DatePattern.NORM_DATETIME_FORMAT.format(gpsData.getTs()));
|
|
|
+ map.put("station", car.getCarNum());
|
|
|
+ CacheUtils.put("offline", c.getStr("code"), map);
|
|
|
+ } else {
|
|
|
+ CacheUtils.put("offline", c.getStr("code"), map);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if(DateUtil.current() - gpsData.getTs().getTime()> 1000*60*60){
|
|
|
- map.put("code",c.getStr("code"));
|
|
|
- map.put("time", DatePattern.NORM_DATETIME_FORMAT.format(gpsData.getTs()));
|
|
|
- map.put("station",car.getCarNum());
|
|
|
- CacheUtils.put("offline",c.getStr("code"),map);
|
|
|
- }else{
|
|
|
- CacheUtils.put("offline",c.getStr("code"),map);
|
|
|
- }
|
|
|
- }
|
|
|
+ }catch (Exception e){}
|
|
|
|
|
|
});
|
|
|
}
|