parent
9a1355a379
commit
15afa8326f
@ -0,0 +1,12 @@
|
|||||||
|
package com.internal.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DicDistrict {
|
||||||
|
|
||||||
|
private String addressCode;
|
||||||
|
private String addressName;
|
||||||
|
private String parentAddressCode;
|
||||||
|
private Integer level;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.taxi.servicemap.controller;
|
||||||
|
|
||||||
|
import com.internal.dto.ResponseResult;
|
||||||
|
import com.taxi.servicemap.service.DicDistrictService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class DicDistrictController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DicDistrictService dicDistrictService;
|
||||||
|
|
||||||
|
@GetMapping("/dic-district")
|
||||||
|
public ResponseResult initDicDistrict(String keywords){
|
||||||
|
return dicDistrictService.initDicDistrict(keywords);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.taxi.servicemap.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.internal.dto.DicDistrict;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface DicDistrictMapper extends BaseMapper<DicDistrict> {
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.taxi.servicemap.service;
|
||||||
|
|
||||||
|
import com.internal.contant.AmapConfigConstant;
|
||||||
|
import com.internal.dto.ResponseResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DicDistrictService {
|
||||||
|
|
||||||
|
|
||||||
|
//?keywords=%E4%B8%AD%E5%9B%BD&subdistrict=3&key=01d85ea8f7db65efc370cfec18ff6397
|
||||||
|
|
||||||
|
@Value("${amap.key}")
|
||||||
|
private String amapKey;
|
||||||
|
|
||||||
|
|
||||||
|
public ResponseResult initDicDistrict(String keywords){
|
||||||
|
//拼接请求的URL
|
||||||
|
StringBuilder url = new StringBuilder();
|
||||||
|
url.append(AmapConfigConstant.DISTRICT_URL);
|
||||||
|
url.append("?");
|
||||||
|
url.append("keywords="+keywords);
|
||||||
|
url.append("&");
|
||||||
|
url.append("subdistrict=3");
|
||||||
|
url.append("&");
|
||||||
|
url.append("key="+amapKey);
|
||||||
|
System.out.println(url.toString());
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue