湖北征信商铺定制接口
This commit is contained in:
+33
-12
@@ -139,7 +139,7 @@ public class CommercialController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Double lng = json.getDouble("lng");
|
Double lng = json.getDouble("lng");
|
||||||
Double lat = json.getDouble("lat");
|
Double lat = json.getDouble("lat");
|
||||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, model.getMinPrice(), model.getMaxPrice(), "shop_sell", 5);
|
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, model.getMinPrice(), model.getMaxPrice(), "shop_sell", 5);
|
||||||
List<BusinessCaseDto> dtos = createSample(houseSelf, "sell", ratio, lng, lat);
|
List<BusinessCaseDto> dtos = createSample(houseSelf, "sell", ratio, lng, lat);
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||||
@@ -147,9 +147,10 @@ public class CommercialController {
|
|||||||
BasicModel.markNoDataRequest();
|
BasicModel.markNoDataRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||||
}
|
}
|
||||||
@@ -252,7 +253,7 @@ public class CommercialController {
|
|||||||
|
|
||||||
dto.setSize(jsonObject.getDouble("size"));
|
dto.setSize(jsonObject.getDouble("size"));
|
||||||
if(jsonObject.containsKey("type")){
|
if(jsonObject.containsKey("type")){
|
||||||
dto.setType(jsonObject.getString("type"));
|
dto.setEstateType(jsonObject.getString("type"));
|
||||||
}
|
}
|
||||||
if(jsonObject.containsKey("floor")){
|
if(jsonObject.containsKey("floor")){
|
||||||
dto.setFloor(jsonObject.getInt("floor"));
|
dto.setFloor(jsonObject.getInt("floor"));
|
||||||
@@ -280,11 +281,11 @@ public class CommercialController {
|
|||||||
if(ratio != null){
|
if(ratio != null){
|
||||||
Integer totalPrice = (int)(sample.getTotalPrice().intValue() * ratio);
|
Integer totalPrice = (int)(sample.getTotalPrice().intValue() * ratio);
|
||||||
if(cat.equals("rent")){
|
if(cat.equals("rent")){
|
||||||
Double dayPrice = totalPrice/sample.getSize()*30;
|
Double dayPrice = totalPrice/(sample.getSize()*30);
|
||||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||||
}else{
|
}else{
|
||||||
Integer avgPrie = (int)(totalPrice/sample.getSize());
|
Integer avgPrice = BigDecimal.valueOf(totalPrice/sample.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||||
dto.setUnitPrice(avgPrie);
|
dto.setUnitPrice(avgPrice);
|
||||||
}
|
}
|
||||||
dto.setTotalPrice(totalPrice);
|
dto.setTotalPrice(totalPrice);
|
||||||
}else{
|
}else{
|
||||||
@@ -298,7 +299,7 @@ public class CommercialController {
|
|||||||
}
|
}
|
||||||
dto.setSize(sample.getSize());
|
dto.setSize(sample.getSize());
|
||||||
if(StringUtils.isNotBlank(sample.getType())){
|
if(StringUtils.isNotBlank(sample.getType())){
|
||||||
dto.setType(sample.getType());
|
dto.setEstateType(sample.getType());
|
||||||
}
|
}
|
||||||
if(sample.getFloor()!=null){
|
if(sample.getFloor()!=null){
|
||||||
dto.setFloor(sample.getFloor());
|
dto.setFloor(sample.getFloor());
|
||||||
@@ -366,8 +367,27 @@ public class CommercialController {
|
|||||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
||||||
if (json != null) {
|
if (json != null) {
|
||||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||||
if (json.containsKey("case")) {
|
if (json.containsKey("unitPrice") && json.containsKey("lng")) {
|
||||||
List<BusinessCaseDto> dtos = createBusiness((JSONArray) json.get("case"), "rent", ratio);
|
|
||||||
|
Double minPrice = null;
|
||||||
|
Double maxPrice = null;
|
||||||
|
if(json.get("unitPrice") != null){
|
||||||
|
Double unitPrice = (Double) json.get("unitPrice");
|
||||||
|
minPrice = unitPrice - unitPrice * 0.1;
|
||||||
|
maxPrice = unitPrice + unitPrice * 0.1;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if(model.getMinPrice() != null && model.getMinPrice()>0){
|
||||||
|
minPrice = model.getMinPrice().doubleValue();
|
||||||
|
}
|
||||||
|
if(model.getMaxPrice() != null && model.getMaxPrice()>0){
|
||||||
|
minPrice = model.getMaxPrice().doubleValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Double lng = json.getDouble("lng");
|
||||||
|
Double lat = json.getDouble("lat");
|
||||||
|
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, DataUtil.getDoubleRound(2, minPrice), DataUtil.getDoubleRound(2, maxPrice), "shop_rent", 5);
|
||||||
|
List<BusinessCaseDto> dtos = createSample(houseSelf, "rent", ratio, lng, lat);
|
||||||
|
|
||||||
|
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||||
@@ -375,9 +395,10 @@ public class CommercialController {
|
|||||||
BasicModel.markNoDataRequest();
|
BasicModel.markNoDataRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1143,7 +1143,7 @@ public class OfficeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getEstateType())){
|
if(StringUtils.isNotBlank(house.getEstateType())){
|
||||||
dto.setType(house.getEstateType());
|
dto.setEstateType(house.getEstateType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getLocation()) && district.getLat()!=null){
|
if(StringUtils.isNotBlank(house.getLocation()) && district.getLat()!=null){
|
||||||
@@ -1198,7 +1198,7 @@ public class OfficeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getType())){
|
if(StringUtils.isNotBlank(house.getType())){
|
||||||
dto.setType(house.getType());
|
dto.setEstateType(house.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Double> locationMap = (Map) house.getLocation();
|
Map<String, Double> locationMap = (Map) house.getLocation();
|
||||||
|
|||||||
+3
-3
@@ -853,7 +853,7 @@ public class OfficeSellController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getEstateType())){
|
if(StringUtils.isNotBlank(house.getEstateType())){
|
||||||
dto.setType(house.getEstateType());
|
dto.setEstateType(house.getEstateType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getLocation()) && district.getLat()!=null){
|
if(StringUtils.isNotBlank(house.getLocation()) && district.getLat()!=null){
|
||||||
@@ -894,7 +894,7 @@ public class OfficeSellController {
|
|||||||
Double dayPrice = totalPrice/(house.getSize()*30);
|
Double dayPrice = totalPrice/(house.getSize()*30);
|
||||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||||
}else{
|
}else{
|
||||||
Integer avgPrie = (int)(totalPrice/house.getSize());
|
Integer avgPrie = BigDecimal.valueOf(totalPrice/house.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||||
dto.setUnitPrice(avgPrie);
|
dto.setUnitPrice(avgPrie);
|
||||||
}
|
}
|
||||||
dto.setTotalPrice(totalPrice);
|
dto.setTotalPrice(totalPrice);
|
||||||
@@ -910,7 +910,7 @@ public class OfficeSellController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(house.getType())){
|
if(StringUtils.isNotBlank(house.getType())){
|
||||||
dto.setType(house.getType());
|
dto.setEstateType(house.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Double> locationMap = (Map) house.getLocation();
|
Map<String, Double> locationMap = (Map) house.getLocation();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class BusinessCaseDto {
|
|||||||
private Integer totalPrice;//总价(单位:元)
|
private Integer totalPrice;//总价(单位:元)
|
||||||
private Integer floor;//所在楼层
|
private Integer floor;//所在楼层
|
||||||
private String caseDate;//案例时间(如: 2013-07-12)
|
private String caseDate;//案例时间(如: 2013-07-12)
|
||||||
private String type;//类型
|
private String estateType;//类型
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@@ -102,11 +102,11 @@ public class BusinessCaseDto {
|
|||||||
this.caseDate = caseDate;
|
this.caseDate = caseDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getEstateType() {
|
||||||
return type;
|
return estateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
public void setEstateType(String estateType) {
|
||||||
this.type = type;
|
this.estateType = estateType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user