Przeglądaj źródła

mongodb访问方式变更

tags/v1.0.0^2
林万龙 3 lat temu
rodzic
commit
e17954f5a2
2 zmienionych plików z 13 dodań i 5 usunięć
  1. +0
    -0
      setup_pro.sh
  2. +13
    -5
      src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java

setup_production.sh → setup_pro.sh Wyświetl plik


+ 13
- 5
src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz