行政区接口
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.service.GeoService;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.seata.common.util.HttpClientUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -40,6 +45,21 @@ public class GeoServiceImpl implements GeoService {
|
||||
}
|
||||
return jsonObject.getJSONObject("regeocode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String district(String keywords, String subdistrict) {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
//超掌柜生活-用户端
|
||||
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
|
||||
param.put("keywords", keywords);
|
||||
param.put("subdistrict", "1");
|
||||
if (StringUtils.isNotBlank(subdistrict)) {
|
||||
param.put("subdistrict", "2");
|
||||
}
|
||||
param.put("extensions", "base");
|
||||
String s = HttpUtil.get("https://restapi.amap.com/v3/config/district", param);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user