Commit 2d0b53b2 by 杨林龙

优化Wifi定位获取数据

1 parent 9d0db017
......@@ -823,7 +823,7 @@ public class HdaoGpsComponent {
//解析mac地址获取定位
WifiMapInfoModel wifiMapInfoModel = MapUtil.getWifiLoactionByMac(macStr.toString());
if (wifiMapInfoModel == null || wifiMapInfoModel.getLocation() == null || wifiMapInfoModel.getType().equals("0")) {
log.info("解析mac 获取地址失败。定位类型:" + wifiMapInfoModel.getType());
log.info("解析mac 获取地址失败。定位数据:" + JSONUtil.toJsonStr(wifiMapInfoModel));
return null;
}
String[] lngLat = wifiMapInfoModel.getLocation().split(",");
......@@ -834,6 +834,7 @@ public class HdaoGpsComponent {
gpsLocation.setLat(lngLat[0]);
gpsLocation.setLng(lngLat[1]);
gpsLocation.setStoreTime(DateUtil.formatDateTime(date));
gpsLocation.setDateTime(DateUtil.formatDateTime(date));
return gpsLocation;
}
......
......@@ -177,7 +177,7 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
ZonedDateTime nowTime = ZonedDateTime.now();
GpsLocation gpsLocation = gpsBsData.getGpsLocation();
if (gpsLocation != null) {
if (gpsLocation != null && gpsLocation.getDateTime() != null) {
ZonedDateTime dateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(DateUtils.parse(gpsLocation.getDateTime()).toInstant().toEpochMilli()), ZoneId.systemDefault());
Duration duration = Duration.between(nowTime, dateTime).abs();
if (duration.toDays() <= 3) {
......@@ -185,7 +185,7 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
}
}
GpsLocation bsLocation = gpsBsData.getBsLocation();
if (bsLocation != null) {
if (bsLocation != null && bsLocation.getDateTime() != null) {
ZonedDateTime dateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(DateUtils.parse(bsLocation.getDateTime()).toInstant().toEpochMilli()), ZoneId.systemDefault());
Duration duration = Duration.between(nowTime, dateTime).abs();
if (duration.toDays() <= 3) {
......@@ -193,7 +193,7 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
}
}
GpsLocation wifiLocation = gpsBsData.getWifiLocation();
if (wifiLocation != null) {
if (wifiLocation != null && wifiLocation.getDateTime() != null) {
ZonedDateTime dateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(DateUtils.parse(wifiLocation.getDateTime()).toInstant().toEpochMilli()), ZoneId.systemDefault());
Duration duration = Duration.between(nowTime, dateTime).abs();
if (duration.toDays() <= 3) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!