|
|
@@ -70,11 +70,17 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS |
|
|
|
} |
|
|
|
//log.debug("IP省份获取错误,结果为:" + result); |
|
|
|
JSONObject provinceJson = JSONObject.parseObject(result); |
|
|
|
String province = (String)provinceJson.get("province"); |
|
|
|
if (ObjectUtils.isEmpty(province)) { |
|
|
|
log.debug("json is :" + buffer.toString()); |
|
|
|
return null; |
|
|
|
String province = null; |
|
|
|
try { |
|
|
|
province = (String)provinceJson.get("province"); |
|
|
|
if (ObjectUtils.isEmpty(province)) { |
|
|
|
log.debug("json is :" + buffer.toString()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("JSONObject分析出错,provinceJson:" + provinceJson); |
|
|
|
} |
|
|
|
|
|
|
|
return province; |
|
|
|
} |
|
|
|
} else { |
|
|
@@ -116,7 +122,7 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS |
|
|
|
//this.centerProvinceFilePath = positionConfig.getCenterProvinceFilePath(); |
|
|
|
// (1) 获取省会城市信息 |
|
|
|
String centerAddress = getIpPositionProvince(ipAddress); |
|
|
|
if (ObjectUtils.isEmpty(centerAddress) || centerAddress.equals("0")) { |
|
|
|
if (centerAddress == null || ObjectUtils.isEmpty(centerAddress) || centerAddress.equals("0")) { |
|
|
|
log.warn("IP地址非法,无法获取辅助位置信息!"); |
|
|
|
// 返回武汉的定位数据 |
|
|
|
centerAddress = this.centerProvince; |
|
|
@@ -132,10 +138,16 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS |
|
|
|
String utf8CenterAddress = new String(utf8, "UTF-8"); |
|
|
|
log.debug("centerAddress is " + utf8CenterAddress); |
|
|
|
|
|
|
|
ProvinceInfoEntity entity = provinceInfoService.getProvinceInfo(utf8CenterAddress); |
|
|
|
if (entity != null) { |
|
|
|
lonValue = entity.getLon(); |
|
|
|
altValue = entity.getAlt(); |
|
|
|
if (utf8CenterAddress.endsWith("省") || utf8CenterAddress.endsWith("区") || utf8CenterAddress.endsWith("市")) { |
|
|
|
|
|
|
|
ProvinceInfoEntity entity = provinceInfoService.getProvinceInfo(utf8CenterAddress); |
|
|
|
if (entity != null) { |
|
|
|
lonValue = entity.getLon(); |
|
|
|
altValue = entity.getAlt(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.error("非法省份:" + utf8CenterAddress); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(e.getMessage()); |
|
|
|