Commit 5b73cfbf by 杨林龙
2 parents cd5a6292 a1bbcc64
......@@ -447,12 +447,18 @@ public class HdaoGpsComponent {
dataGpsLocation.setLat(lat);
double[] googleGps = GpsCorrect.gpsToGoogle(Double.parseDouble(lat), Double.parseDouble(lng));
dataGpsLocation.setElat(String.valueOf(googleGps[0]));
dataGpsLocation.setElng(String.valueOf(googleGps[1]));
String elng = LocationUtil.latlng(googleGps[1]);
String elat = LocationUtil.latlng(googleGps[0]);
dataGpsLocation.setElat(elat);
dataGpsLocation.setElng(elng);
double[] baiduGps = GpsCorrect.gpsToBaidu(Double.parseDouble(lat), Double.parseDouble(lng));
dataGpsLocation.setBlat(String.valueOf(baiduGps[0]));
dataGpsLocation.setBlng(String.valueOf(baiduGps[1]));
String blng = LocationUtil.latlng(baiduGps[1]);
String blat = LocationUtil.latlng(baiduGps[0]);
dataGpsLocation.setBlat(blat);
dataGpsLocation.setBlng(blng);
dataGpsLocation.setAddress(resp.value.gps.addr);
dataGpsLocation.setDateTime(dataBsLocation.getGpsTime());
......@@ -823,7 +829,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 +840,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) {
......
......@@ -91,7 +91,8 @@ public class DeviceUtils {
}
//否则 在6分钟内并且有速度 则为行驶中
if (deviceLogin.getStayStatus() != null && deviceLogin.getStayStatus() == 2 && deviceLogin.getSpeed() != null && deviceLogin.getSpeed() > 0) {
// 取消速度限制,速度的判定交给大数据计算
if (deviceLogin.getStayStatus() != null && deviceLogin.getStayStatus() == 2) {
//行驶状态
deviceStatus.setStatus(ConstantsDevice.DEVICE_STATUS_DRIVING);
return;
......
......@@ -15,7 +15,7 @@ public class LocationUtil {
/**
* 转化数据部门的位置点
* */
*/
public static String latlng(int value) {
DecimalFormat df = new DecimalFormat("#.000000");
String ret = df.format((double) value / 1000000D);
......@@ -23,6 +23,14 @@ public class LocationUtil {
}
/**
* 转化数据部门的位置点 格式化
*/
public static String latlng(Double value) {
DecimalFormat df = new DecimalFormat("#.000000");
return df.format(value);
}
/**
* 计算两点之间的实际距离
*
* @param long1 第一个点的经度
......@@ -53,6 +61,7 @@ public class LocationUtil {
/**
* int值转换
*
* @param strValue
* @return
*/
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!