国信所需接口封装
This commit is contained in:
+8
-5
@@ -80,13 +80,13 @@ 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("address", model.getAddress());
|
params.put("address", model.getAddress());
|
||||||
params.put("addressAssessment","true");
|
params.put("addressAssessment", "true");
|
||||||
try {
|
try {
|
||||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/formatNinelevel", params, "UTF-8");
|
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/formatNinelevel", params, "UTF-8");
|
||||||
if (json != null) {
|
if (json != null) {
|
||||||
int code = json.getInt("status");
|
int code = json.getInt("status");
|
||||||
String msg = json.getString("msg");
|
String msg = json.getString("msg");
|
||||||
BasicModel basicModel = new BasicModel(code, msg);
|
BasicModel basicModel = new BasicModel(code == 0 ? 200 : 0, msg);
|
||||||
if (json.containsKey("result")) {
|
if (json.containsKey("result")) {
|
||||||
JSONObject result = json.getJSONObject("result");
|
JSONObject result = json.getJSONObject("result");
|
||||||
result.remove("formatAddress");
|
result.remove("formatAddress");
|
||||||
@@ -127,7 +127,7 @@ public class AddrSvcController {
|
|||||||
if (json != null) {
|
if (json != null) {
|
||||||
int code = json.getInt("status");
|
int code = json.getInt("status");
|
||||||
String msg = json.getString("msg");
|
String msg = json.getString("msg");
|
||||||
BasicModel basicModel = new BasicModel(code, msg);
|
BasicModel basicModel = new BasicModel(code == 0 ? 200 : 0, msg);
|
||||||
if (json.containsKey("result")) {
|
if (json.containsKey("result")) {
|
||||||
DistrictIdentifyDto districtIdentifyDto = CommonDtoUtils.transformV(DistrictIdentifyDto.class, json.get("result"));
|
DistrictIdentifyDto districtIdentifyDto = CommonDtoUtils.transformV(DistrictIdentifyDto.class, json.get("result"));
|
||||||
JSONObject result = json.getJSONObject("result");
|
JSONObject result = json.getJSONObject("result");
|
||||||
@@ -284,7 +284,7 @@ public class AddrSvcController {
|
|||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
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("district", model.getRegion());
|
||||||
params.put("keywords", model.getKeywords());
|
params.put("keywords", model.getKeywords());
|
||||||
params.put("page", "0");
|
params.put("page", "0");
|
||||||
params.put("offset", String.valueOf(model.getMax() == 0 ? 10 : (model.getMax() > 100 ? 100 : model.getMax())));
|
params.put("offset", String.valueOf(model.getMax() == 0 ? 10 : (model.getMax() > 100 ? 100 : model.getMax())));
|
||||||
@@ -297,7 +297,7 @@ public class AddrSvcController {
|
|||||||
if (json.containsKey("result")) {
|
if (json.containsKey("result")) {
|
||||||
JSONArray jsonArray = json.getJSONArray("result");
|
JSONArray jsonArray = json.getJSONArray("result");
|
||||||
if (jsonArray.size() > 0) {
|
if (jsonArray.size() > 0) {
|
||||||
basicModel.setResult(CommonDtoUtils.transformListV(DistrictDto.class,jsonArray));
|
basicModel.setResult(CommonDtoUtils.transformListV(DistrictDto.class, jsonArray));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mav.setModel(basicModel);
|
mav.setModel(basicModel);
|
||||||
@@ -969,6 +969,7 @@ public class AddrSvcController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Object addressAssociationAction(AddressModel model) {
|
public Object addressAssociationAction(AddressModel model) {
|
||||||
|
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
@@ -1111,6 +1112,7 @@ public class AddrSvcController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域级行政区划查询接口
|
* 区域级行政区划查询接口
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -1160,6 +1162,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();
|
||||||
|
|||||||
Reference in New Issue
Block a user