diff --git a/setup_production.sh b/setup_pro.sh similarity index 100% rename from setup_production.sh rename to setup_pro.sh 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 51aa1d3..eea974f 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -11,6 +11,7 @@ import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; import com.telpo.dipperposition.service.IProvinceInfoService; import com.telpo.dipperposition.service.IpProvinceService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.logging.log4j.util.PropertiesUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -67,13 +68,20 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS dataMap.put("key", ipPositionRequestKey); StringBuffer buffer = okHttpUtil.getQueryString(ipPositionRequestPath, dataMap); 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; + } 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 { // 意外错误 log.debug("ip address is null");