From 46fc92d62d88a06122499a0c21ad6c2b86e99fa9 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Wed, 20 Jan 2021 21:34:48 +0800 Subject: [PATCH] =?UTF-8?q?mongodb=E8=AE=BF=E9=97=AE=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DipperAstPosAsyncTaskServiceImpl.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java index 98ccfd2..b4f72e6 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -136,7 +136,8 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS createIPProvince(ipAddress, centerAddress); } - String lonAndAlt = null; + String lonValue = null; + String altValue = null; try { byte[] utf8 = centerAddress.getBytes("UTF-8"); String utf8CenterAddress = new String(utf8, "UTF-8"); @@ -144,7 +145,8 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS ProvinceInfoEntity entity = provinceInfoService.getProvinceInfo(utf8CenterAddress); if (entity != null) { - lonAndAlt = entity.getProvince(); + lonValue = entity.getLon(); + altValue = entity.getAlt(); } } catch (Exception e) { log.error(e.getMessage()); @@ -152,29 +154,29 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS // (2) 处理返回结果 - if (lonAndAlt == null) { + if (lonValue == null) { // null处理 log.error("系统错误,请联系系统管理员。"); return null; } // push to GNNS Server - return getCmdOfPos(lonAndAlt); + return getCmdOfPos(lonValue, altValue); } // 组装命令发送给设备 - private String getCmdOfPos(String astPos) { + private String getCmdOfPos(String lonStr, String altStr) { // 时间和位置不是从服务器获取,而是本地生成 - String[] astPosArray = astPos.split(","); - String lan = astPosArray[0].trim(); - String alt = astPosArray[1].trim(); - double lanValue = Double.parseDouble(lan) * 10000000; +// String[] astPosArray = astPos.split(","); +// String lan = astPosArray[0].trim(); +// String alt = astPosArray[1].trim(); + double lanValue = Double.parseDouble(lonStr) * 10000000; long lanLongValue = Double.doubleToLongBits(lanValue); if (lanLongValue < 0) { lanLongValue = lanLongValue + 4294967295L + 1; } - double altValue = Double.parseDouble(alt) * 10000000; + double altValue = Double.parseDouble(altStr) * 10000000; long altLongValue = Double.doubleToLongBits(altValue); if (altLongValue < 0) { altLongValue = altLongValue + 4294967295L + 1;