新增楼盘评级
This commit is contained in:
+50
@@ -2134,6 +2134,56 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 楼盘评级
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object propertyRatingAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getId())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
try {
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("city", model.getCity());
|
||||
reqBody.put("address", model.getAddress());
|
||||
reqBody.put("id", model.getId());
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/propertyRating", reqBody, headers, "UTF-8");
|
||||
if (result != null) {
|
||||
try {
|
||||
json = JSONObject.fromObject(result);
|
||||
} catch (Exception e) {
|
||||
json = null;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 楼盘评级
|
||||
*
|
||||
|
||||
+13
@@ -9,6 +9,11 @@ package com.fangjia.open.model;
|
||||
*/
|
||||
public class CommunitySummaryRequestDto extends FangjiaApiModel {
|
||||
|
||||
/**
|
||||
* 小区ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@@ -86,4 +91,12 @@ public class CommunitySummaryRequestDto extends FangjiaApiModel {
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user