上海银行接口
This commit is contained in:
+59
@@ -718,6 +718,65 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 涉农识别-新规则-上海银行
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object boscVillageIdentifyAction(AddressModel model) {
|
||||||
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
|
if (StringUtils.isBlank(model.getAddress())) {
|
||||||
|
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);
|
||||||
|
String address = model.getAddress();
|
||||||
|
params.put("address", address);
|
||||||
|
String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null;
|
||||||
|
params.put("type", type);
|
||||||
|
try {
|
||||||
|
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/shzxVillageIdentify", params, "UTF-8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/shzxVillageIdentify", params, "UTF-8");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json != null) {
|
||||||
|
if (json.containsKey("result")) {
|
||||||
|
int code = json.getInt("msgCode");
|
||||||
|
String msg = json.getString("msg");
|
||||||
|
BasicModel basicModel = new BasicModel(code, msg);
|
||||||
|
HashMap<String, String> map = new HashMap<String, String>();
|
||||||
|
//我们的结果
|
||||||
|
JSONObject result = json.getJSONObject("result");
|
||||||
|
if (result.containsKey("addrArea")) {
|
||||||
|
map.put("addrArea", result.getString("addrArea"));
|
||||||
|
}
|
||||||
|
if (result.containsKey("devDistrictName")) {
|
||||||
|
map.put("devDistrictName", result.getString("devDistrictName"));
|
||||||
|
}
|
||||||
|
if (result.containsKey("countyGovTown")) {
|
||||||
|
map.put("countyGovTown", result.getString("countyGovTown"));
|
||||||
|
}
|
||||||
|
if (result.containsKey("town")) {
|
||||||
|
map.put("town", result.getString("town"));
|
||||||
|
}
|
||||||
|
basicModel.setResult(map);
|
||||||
|
mav.setModel(basicModel);
|
||||||
|
} else {
|
||||||
|
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 涉农识别-新规则-基础版本
|
* 涉农识别-新规则-基础版本
|
||||||
|
|||||||
Reference in New Issue
Block a user