新增地址联想Pro
This commit is contained in:
+53
-2
@@ -249,7 +249,7 @@ public class AddrSvcController {
|
|||||||
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
|
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(model.getKeyword())) {
|
if (StringUtils.isBlank(model.getKeywords())) {
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("关键字不能为空"));
|
mav.setModel(BasicModel.buildBadRequestModel("关键字不能为空"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ public class AddrSvcController {
|
|||||||
Map<String, String> params = new HashMap<String, String>();
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
params.put("city", model.getCity());
|
params.put("city", model.getCity());
|
||||||
params.put("region", model.getRegion());
|
params.put("region", model.getRegion());
|
||||||
params.put("keywords", model.getKeyword());
|
params.put("keywords", model.getKeywords());
|
||||||
params.put("page", "0");
|
params.put("page", "0");
|
||||||
params.put("size", String.valueOf(model.getMax() == 0 ? 20 : (model.getMax() > 100 ? 100 : model.getMax())));
|
params.put("size", String.valueOf(model.getMax() == 0 ? 20 : (model.getMax() > 100 ? 100 : model.getMax())));
|
||||||
try {
|
try {
|
||||||
@@ -735,6 +735,57 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址联想-PRO
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object addressAssociationAction(AddressModel model) {
|
||||||
|
|
||||||
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
|
if (StringUtils.isBlank(model.getKeywords()) && (StringUtils.isBlank(model.getLat()) && StringUtils.isBlank(model.getLng()))) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("关键字或经纬度必填一个"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest request = new HttpRequest();
|
||||||
|
JSONObject json = null;
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
|
||||||
|
params.put("district", StringUtils.isNotBlank(model.getDistrict()) ? model.getDistrict() : null);
|
||||||
|
params.put("keywords", StringUtils.isNotBlank(model.getKeywords()) ? model.getKeywords() : null);
|
||||||
|
if (StringUtils.isNotBlank(model.getLng()) && StringUtils.isNotBlank(model.getLat())) {
|
||||||
|
params.put("lat",model.getLat());
|
||||||
|
params.put("lng",model.getLng());
|
||||||
|
}
|
||||||
|
Integer radius = model.getRadius();
|
||||||
|
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
|
||||||
|
try {
|
||||||
|
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/addressAssociation", params, "UTF-8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/addressAssociation", params, "UTF-8");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json != null) {
|
||||||
|
int code = json.getInt("msgCode");
|
||||||
|
String msg = json.getString("msg");
|
||||||
|
BasicModel basicModel = new BasicModel(code, msg);
|
||||||
|
if (json.containsKey("result")) {
|
||||||
|
basicModel.setResult(json.get("result"));
|
||||||
|
}
|
||||||
|
mav.setModel(basicModel);
|
||||||
|
} else {
|
||||||
|
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||||
|
}
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDistrictStatService(DistrictStatService districtStatService) {
|
public void setDistrictStatService(DistrictStatService districtStatService) {
|
||||||
this.districtStatService = districtStatService;
|
this.districtStatService = districtStatService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class AddressModel extends FangjiaApiModel {
|
|||||||
// 是否用于检查
|
// 是否用于检查
|
||||||
private String dataLevel;
|
private String dataLevel;
|
||||||
|
|
||||||
private String keyword;
|
private String keywords;
|
||||||
//是否使用地图poi数据
|
//是否使用地图poi数据
|
||||||
private boolean useMap;
|
private boolean useMap;
|
||||||
|
|
||||||
@@ -46,6 +46,9 @@ public class AddressModel extends FangjiaApiModel {
|
|||||||
private String showFullValue;
|
private String showFullValue;
|
||||||
//是否显示涉农测试用字段值
|
//是否显示涉农测试用字段值
|
||||||
private String showTestValue;
|
private String showTestValue;
|
||||||
|
|
||||||
|
private String lat;
|
||||||
|
private String lng;
|
||||||
public boolean isContainsLocation() {
|
public boolean isContainsLocation() {
|
||||||
return containsLocation;
|
return containsLocation;
|
||||||
}
|
}
|
||||||
@@ -239,12 +242,12 @@ public class AddressModel extends FangjiaApiModel {
|
|||||||
this.dataLevel = dataLevel;
|
this.dataLevel = dataLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKeyword() {
|
public String getKeywords() {
|
||||||
return keyword;
|
return keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyword(String keyword) {
|
public void setKeywords(String keywords) {
|
||||||
this.keyword = keyword;
|
this.keywords = keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRegion() {
|
public String getRegion() {
|
||||||
@@ -278,4 +281,20 @@ public class AddressModel extends FangjiaApiModel {
|
|||||||
public void setShowTestValue(String showTestValue) {
|
public void setShowTestValue(String showTestValue) {
|
||||||
this.showTestValue = showTestValue;
|
this.showTestValue = showTestValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLat() {
|
||||||
|
return lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLat(String lat) {
|
||||||
|
this.lat = lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLng() {
|
||||||
|
return lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLng(String lng) {
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user