|
|
@@ -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; |
|
|
|