From e8201b6c183b81e5300302edb33f33d129b4ab60 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Wed, 20 Jan 2021 19:04:22 +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 --- .../impl/DipperAstPosAsyncTaskServiceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 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 eea974f..c122805 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -67,14 +67,19 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS dataMap.put("ip", ipAddress); dataMap.put("key", ipPositionRequestKey); StringBuffer buffer = okHttpUtil.getQueryString(ipPositionRequestPath, dataMap); - if (ObjectUtils.isNotEmpty(buffer)) { - String provinceBuffer = buffer.toString(); - if (StringUtils.isEmpty(provinceBuffer)) { + JSONObject paramObject = new JSONObject(); + String result = okHttpUtil.postJsonParams(buffer.toString(), paramObject.toJSONString()); + if (ObjectUtils.isNotEmpty(result)) { + if (StringUtils.isEmpty(result)) { log.debug("IP省份获取错误,结果为空"); return null; } else { - log.debug("IP省份获取错误,结果为:" + provinceBuffer); - JSONObject provinceJson = JSONObject.parseObject(provinceBuffer); + if (result.equals("FAIL")) { + log.debug("IP省份获取错误,结果为FAIL"); + return null; + } + 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());