Commit ed5682ac by huangjinxin

feat:添加逆地址解析接口

1 parent 279faae8
package com.dituhui.pea.pojo.saas.req;
import lombok.Data;
@Data
public class AdministrativeDistrictReq {
/**
* 经纬度
*/
private String points;
/**
* 坐标编码
*/
private String coordType = "gcj02ll";
}
package com.dituhui.pea.pojo.saas.resp;
import java.util.List;
public class AdministrativeDistrictResp {
private String admincode;
private String name;
private String fullName;
private String level;
private GovPosition govPosition;
private String acode;
private String abbreviation;
private List<String> districtNames;
private SubNames subNames;
public void setAdmincode(String admincode) {
this.admincode = admincode;
}
public String getAdmincode() {
return admincode;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getFullName() {
return fullName;
}
public void setLevel(String level) {
this.level = level;
}
public String getLevel() {
return level;
}
public void setGovPosition(GovPosition govPosition) {
this.govPosition = govPosition;
}
public GovPosition getGovPosition() {
return govPosition;
}
public void setAcode(String acode) {
this.acode = acode;
}
public String getAcode() {
return acode;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getAbbreviation() {
return abbreviation;
}
public void setDistrictNames(List<String> districtNames) {
this.districtNames = districtNames;
}
public List<String> getDistrictNames() {
return districtNames;
}
public void setSubNames(SubNames subNames) {
this.subNames = subNames;
}
public SubNames getSubNames() {
return subNames;
}
}
\ No newline at end of file
package com.dituhui.pea.pojo.saas.resp;
public class GovPosition {
private long x;
private long y;
public void setX(long x) {
this.x = x;
}
public long getX() {
return x;
}
public void setY(long y) {
this.y = y;
}
public long getY() {
return y;
}
}
\ No newline at end of file
package com.dituhui.pea.pojo.saas.resp;
public class SubNames {
private String province;
private String town;
private String city;
private String county;
public void setProvince(String province) {
this.province = province;
}
public String getProvince() {
return province;
}
public void setTown(String town) {
this.town = town;
}
public String getTown() {
return town;
}
public void setCity(String city) {
this.city = city;
}
public String getCity() {
return city;
}
public void setCounty(String county) {
this.county = county;
}
public String getCounty() {
return county;
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import com.dituhui.pea.order.dto.SaasXyFendanDTO;
import com.dituhui.pea.order.feign.ISaaSRemoteService;
import com.dituhui.pea.pojo.fendan.FenDanEsResult;
import com.dituhui.pea.pojo.fendan.FendanDTO;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.experimental.Accessors;
......@@ -80,8 +82,6 @@ public class SaasUtils {
* 根据提供的地址信息,获取对应的片区图层
*/
public List<BlockInfo> queryBlocksByXy(FendanDTO fendanDTO) {
long t = System.currentTimeMillis();
log.info("===> queryBlocksByXySingleT({})", t);
String webResultStr = saasRemoteService.single(ak, fendanDTO);
log.info("queryBlocksByXySingle返回结果: ===> {}", webResultStr);
SaasWebResult webResult = JSONObject.parseObject(webResultStr, SaasWebResult.class);
......@@ -106,6 +106,22 @@ public class SaasUtils {
}
/**
* 根据提供的地址信息,获取对应的片区图层
*/
public List<AdministrativeDistrictResp> getAdminDistrict(AdministrativeDistrictReq districtReq) {
String webResultStr = saasRemoteService.getAdminDistrict(ak, districtReq);
log.info("queryBlocksByXySingle返回结果: ===> {}", webResultStr);
SaasWebResult webResult = JSONObject.parseObject(webResultStr, SaasWebResult.class);
log.info("queryBlocksByXySingle返回结果: ===> {}", webResult.getResult());
if (!webResult.getCode().equals("S001")) {
return null;
}
List<AdministrativeDistrictResp> administrativeDistrictResp = JSONObject.parseObject(JSONObject.toJSONString(webResult.getResult()), List.class);
return administrativeDistrictResp;
}
public List<BlockInfo> queryBlocksByAddress(String address) {
// 根据坐标 查询分单接口,获得区块、图层列表 ===> 查询map_block_info表,根据优先级,确定 工作队;
// 根据工作队+图层,查询 capacity_team_stat,返回
......
......@@ -5,6 +5,8 @@ import com.dituhui.pea.order.dto.param.OrderDTO;
import com.dituhui.pea.order.dto.param.OrgGroupInfo;
import com.dituhui.pea.order.dto.param.OrgTeamInfo;
import com.dituhui.pea.order.service.FendanService;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -29,4 +31,9 @@ public class FendanController {
public Result<List<OrgGroupInfo>> fendanToGroup(@RequestBody OrderDTO.OrderCreateRequest request) {
return fendanService.fendanToGroup(request);
}
@RequestMapping(value = "getAdminDistrict", method = RequestMethod.POST)
public Result<List<AdministrativeDistrictResp>> getAdminDistrict(@RequestBody AdministrativeDistrictReq req) {
return fendanService.getAdminDistrict(req);
}
}
......@@ -3,6 +3,7 @@ package com.dituhui.pea.order.feign;
import com.dituhui.pea.common.SaasWebResult;
import com.dituhui.pea.pojo.fendan.FenDanEsResult;
import com.dituhui.pea.pojo.fendan.FendanDTO;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -35,6 +36,7 @@ public interface ISaaSRemoteService {
@PostMapping("/saas/fendan/distribute/single")
public String single(@RequestParam String ak, @RequestBody FendanDTO fendanDTO);
//@PostMapping("/saas/fendan/distribute/single")
//public SaasWebResult single(@RequestParam("ak") String ak, @RequestParam("t") String t, @RequestBody FendanDTO fendanDTO);
@PostMapping("/saas/baseData/area/getDistrictByRegion")
public String getAdminDistrict(@RequestParam("ak") String ak, @RequestBody AdministrativeDistrictReq districtReq);
}
......@@ -4,6 +4,8 @@ import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dto.param.OrderDTO;
import com.dituhui.pea.order.dto.param.OrgGroupInfo;
import com.dituhui.pea.order.dto.param.OrgTeamInfo;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
import java.util.List;
......@@ -24,4 +26,6 @@ public interface FendanService {
* @return
*/
Result<List<OrgGroupInfo>> fendanToGroup(OrderDTO.OrderCreateRequest request);
Result<List<AdministrativeDistrictResp>> getAdminDistrict(AdministrativeDistrictReq req);
}
......@@ -11,6 +11,8 @@ import com.dituhui.pea.order.dto.param.OrgTeamInfo;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.FendanService;
import com.dituhui.pea.pojo.fendan.FendanDTO;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -200,6 +202,11 @@ public class FendanServiceImpl implements FendanService {
return Result.success(orgGroupTeamInfos);
}
@Override
public Result<List<AdministrativeDistrictResp>> getAdminDistrict(AdministrativeDistrictReq req) {
return Result.success(saasUtils.getAdminDistrict(req));
}
/**
* 筛选品牌
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!