上海银行接口
This commit is contained in:
+72
-13
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 涉农识别-新规则-基础版本
|
* 涉农识别-新规则-基础版本
|
||||||
@@ -725,7 +784,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object villageIdentifyAction(AddressModel model) {
|
public Object villageIdentifyAction(AddressModel model){
|
||||||
|
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
if (StringUtils.isBlank(model.getAddress())) {
|
if (StringUtils.isBlank(model.getAddress())) {
|
||||||
@@ -861,7 +920,7 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, String> senRequest(String address, String type) throws IOException {
|
private static Map<String, String> senRequest (String address, String type) throws IOException {
|
||||||
String targetURL = "http://146.56.217.44:9010/uams/farmer/all/v3/sign";
|
String targetURL = "http://146.56.217.44:9010/uams/farmer/all/v3/sign";
|
||||||
String proxyHost = "tunnel2.qg.net";
|
String proxyHost = "tunnel2.qg.net";
|
||||||
int proxyPort = 14186;
|
int proxyPort = 14186;
|
||||||
@@ -974,7 +1033,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object villageIdentifyStandardAction(AddressModel model) {
|
public Object villageIdentifyStandardAction (AddressModel model){
|
||||||
|
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
if (StringUtils.isBlank(model.getAddress())) {
|
if (StringUtils.isBlank(model.getAddress())) {
|
||||||
@@ -1024,7 +1083,7 @@ public class AddrSvcController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Object addressAssociationAction(AddressModel model) {
|
public Object addressAssociationAction (AddressModel model){
|
||||||
|
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
if (StringUtils.isBlank(model.getKeywords()) && (StringUtils.isBlank(model.getLat()) && StringUtils.isBlank(model.getLng()))) {
|
if (StringUtils.isBlank(model.getKeywords()) && (StringUtils.isBlank(model.getLat()) && StringUtils.isBlank(model.getLng()))) {
|
||||||
@@ -1074,7 +1133,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object listCityAction(AddressModel model) {
|
public Object listCityAction (AddressModel model){
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
@@ -1134,7 +1193,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object listProvinceAction(AddressModel model) {
|
public Object listProvinceAction (AddressModel model){
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
@@ -1186,7 +1245,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object listDistrictAction(AddressModel model) {
|
public Object listDistrictAction (AddressModel model){
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
@@ -1247,7 +1306,7 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object listTownshipAction(AddressModel model) {
|
public Object listTownshipAction (AddressModel model){
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
@@ -1315,7 +1374,7 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object levelAction(AddressModel model) {
|
public Object levelAction (AddressModel model){
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
HttpRequest request = new HttpRequest();
|
HttpRequest request = new HttpRequest();
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
@@ -1348,15 +1407,15 @@ public class AddrSvcController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistrictStatService(DistrictStatService districtStatService) {
|
public void setDistrictStatService (DistrictStatService districtStatService){
|
||||||
this.districtStatService = districtStatService;
|
this.districtStatService = districtStatService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistrictService(DistrictService districtService) {
|
public void setDistrictService (DistrictService districtService){
|
||||||
this.districtService = districtService;
|
this.districtService = districtService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVillageIdentifyService(VillageIdentifyService villageIdentifyService) {
|
public void setVillageIdentifyService (VillageIdentifyService villageIdentifyService){
|
||||||
this.villageIdentifyService = villageIdentifyService;
|
this.villageIdentifyService = villageIdentifyService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user