|
@@ -8,6 +8,7 @@ import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.vo.response.AddressComponent;
|
|
|
import com.fdkankan.manage.vo.response.IpAddressVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URL;
|
|
@@ -111,7 +112,11 @@ public class ProvinceUtils {
|
|
|
try {
|
|
|
String s = HttpUtil.get(String.format(getAddressByIpHost,ip,amapKey));
|
|
|
JSONObject jsonObject = JSON.parseObject(s);
|
|
|
- return JSONObject.toJavaObject(jsonObject, IpAddressVo.class);
|
|
|
+ IpAddressVo javaObject = JSONObject.toJavaObject(jsonObject, IpAddressVo.class);
|
|
|
+ if(StringUtils.isNotBlank(javaObject.getProvince())){
|
|
|
+ javaObject.setCountry("中国");
|
|
|
+ }
|
|
|
+ return javaObject;
|
|
|
}catch (Exception e){
|
|
|
log.info("ip地址转换地址失败:{},{}",ip,e);
|
|
|
}
|