|
@@ -11,6 +11,7 @@ import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; |
|
|
import com.telpo.dipperposition.service.IProvinceInfoService; |
|
|
import com.telpo.dipperposition.service.IProvinceInfoService; |
|
|
import com.telpo.dipperposition.service.IpProvinceService; |
|
|
import com.telpo.dipperposition.service.IpProvinceService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
import org.apache.logging.log4j.util.PropertiesUtil; |
|
|
import org.apache.logging.log4j.util.PropertiesUtil; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -67,13 +68,20 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS |
|
|
dataMap.put("key", ipPositionRequestKey); |
|
|
dataMap.put("key", ipPositionRequestKey); |
|
|
StringBuffer buffer = okHttpUtil.getQueryString(ipPositionRequestPath, dataMap); |
|
|
StringBuffer buffer = okHttpUtil.getQueryString(ipPositionRequestPath, dataMap); |
|
|
if (ObjectUtils.isNotEmpty(buffer)) { |
|
|
if (ObjectUtils.isNotEmpty(buffer)) { |
|
|
JSONObject provinceJson = JSONObject.parseObject(buffer.toString()); |
|
|
|
|
|
String province = (String)provinceJson.get("province"); |
|
|
|
|
|
if (ObjectUtils.isEmpty(province)) { |
|
|
|
|
|
log.debug("json is :" + buffer.toString()); |
|
|
|
|
|
|
|
|
String provinceBuffer = buffer.toString(); |
|
|
|
|
|
if (StringUtils.isEmpty(provinceBuffer)) { |
|
|
|
|
|
log.debug("IP省份获取错误,结果为空"); |
|
|
return null; |
|
|
return null; |
|
|
|
|
|
} else { |
|
|
|
|
|
log.debug("IP省份获取错误,结果为:" + provinceBuffer); |
|
|
|
|
|
JSONObject provinceJson = JSONObject.parseObject(provinceBuffer); |
|
|
|
|
|
String province = (String)provinceJson.get("province"); |
|
|
|
|
|
if (ObjectUtils.isEmpty(province)) { |
|
|
|
|
|
log.debug("json is :" + buffer.toString()); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return province; |
|
|
} |
|
|
} |
|
|
return province; |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 意外错误 |
|
|
// 意外错误 |
|
|
log.debug("ip address is null"); |
|
|
log.debug("ip address is null"); |
|
|