商铺修改
This commit is contained in:
+29
-17
@@ -116,15 +116,18 @@ public class CommercialController {
|
|||||||
if(mav.model()!=null){
|
if(mav.model()!=null){
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
Double ratio = null;//getUserPriceRatio(request);
|
Double ratio = getUserPriceRatio(request);
|
||||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_EVALUATE);
|
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_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("unitPrice") && json.containsKey("location")) {
|
if (json.containsKey("unitPrice") && json.containsKey("location")) {
|
||||||
Integer unitPrice = null;
|
Double unitPrice = null;
|
||||||
if(json.get("unitPrice") != null){
|
if(json.get("unitPrice") != null){
|
||||||
unitPrice = (Integer) json.get("unitPrice");
|
unitPrice = (Double) json.get("unitPrice");
|
||||||
|
if(ratio!=null){
|
||||||
|
unitPrice = unitPrice * ratio;
|
||||||
|
}
|
||||||
int minPrice = (int) (unitPrice - unitPrice * 0.1);
|
int minPrice = (int) (unitPrice - unitPrice * 0.1);
|
||||||
model.setMinPrice(minPrice);
|
model.setMinPrice(minPrice);
|
||||||
|
|
||||||
@@ -141,12 +144,17 @@ public class CommercialController {
|
|||||||
JSONObject locObj = json.getJSONObject("location");
|
JSONObject locObj = json.getJSONObject("location");
|
||||||
Double lng = locObj.getDouble("lon");
|
Double lng = locObj.getDouble("lon");
|
||||||
Double lat = locObj.getDouble("lat");
|
Double lat = locObj.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", 30);
|
||||||
List<BusinessCaseDto> dtos = createSample(houseSelf, "sell", ratio, lng, lat, unitPrice.doubleValue());
|
List<BusinessCaseDto> dtos = createSample(houseSelf, "sell", ratio, lng, lat, unitPrice.doubleValue());
|
||||||
|
|
||||||
|
if(dtos!=null && dtos.size()>5){
|
||||||
|
dtos = dtos.subList(0,5);
|
||||||
|
}
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||||
if(dtos!=null && dtos.size()<5){
|
if(dtos!=null && dtos.size()<5){
|
||||||
BasicModel.markNoDataRequest();
|
BasicModel.markNoDataRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||||
@@ -280,17 +288,17 @@ public class CommercialController {
|
|||||||
dto.setName(sample.getName());
|
dto.setName(sample.getName());
|
||||||
// dto.setLocation(sample.getString("location"));
|
// dto.setLocation(sample.getString("location"));
|
||||||
|
|
||||||
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 avgPrice = BigDecimal.valueOf(totalPrice/sample.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
// Integer avgPrice = BigDecimal.valueOf(totalPrice/sample.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||||
dto.setUnitPrice(avgPrice);
|
// dto.setUnitPrice(avgPrice);
|
||||||
}
|
// }
|
||||||
dto.setTotalPrice(totalPrice);
|
// dto.setTotalPrice(totalPrice);
|
||||||
}else{
|
// }else{
|
||||||
if(cat.equals("rent")){
|
if(cat.equals("rent")){
|
||||||
Double dayPrice = sample.getTotalPrice()/(sample.getSize()*30);
|
Double dayPrice = sample.getTotalPrice()/(sample.getSize()*30);
|
||||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||||
@@ -298,7 +306,7 @@ public class CommercialController {
|
|||||||
dto.setUnitPrice(sample.getUnitPrice());
|
dto.setUnitPrice(sample.getUnitPrice());
|
||||||
}
|
}
|
||||||
dto.setTotalPrice(sample.getTotalPrice());
|
dto.setTotalPrice(sample.getTotalPrice());
|
||||||
}
|
// }
|
||||||
dto.setSize(sample.getSize());
|
dto.setSize(sample.getSize());
|
||||||
if(StringUtils.isNotBlank(sample.getType())){
|
if(StringUtils.isNotBlank(sample.getType())){
|
||||||
dto.setEstateType(sample.getType());
|
dto.setEstateType(sample.getType());
|
||||||
@@ -383,7 +391,7 @@ public class CommercialController {
|
|||||||
if(mav.model()!=null){
|
if(mav.model()!=null){
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
Double ratio = null;//getUserPriceRatio(request);
|
Double ratio = getUserPriceRatio(request);
|
||||||
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"))) {
|
||||||
@@ -394,6 +402,9 @@ public class CommercialController {
|
|||||||
Double unitPrice = null;
|
Double unitPrice = null;
|
||||||
if(json.get("unitPrice") != null){
|
if(json.get("unitPrice") != null){
|
||||||
unitPrice = (Double) json.get("unitPrice");
|
unitPrice = (Double) json.get("unitPrice");
|
||||||
|
if(ratio!=null){
|
||||||
|
unitPrice = unitPrice * ratio;
|
||||||
|
}
|
||||||
minPrice = unitPrice - unitPrice * 0.1;
|
minPrice = unitPrice - unitPrice * 0.1;
|
||||||
maxPrice = unitPrice + unitPrice * 0.1;
|
maxPrice = unitPrice + unitPrice * 0.1;
|
||||||
|
|
||||||
@@ -409,6 +420,7 @@ public class CommercialController {
|
|||||||
Double lng = locObj.getDouble("lon");
|
Double lng = locObj.getDouble("lon");
|
||||||
Double lat = locObj.getDouble("lat");
|
Double lat = locObj.getDouble("lat");
|
||||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, DataUtil.getDoubleRound(2, minPrice), DataUtil.getDoubleRound(2, maxPrice), "shop_rent", 30);
|
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, DataUtil.getDoubleRound(2, minPrice), DataUtil.getDoubleRound(2, maxPrice), "shop_rent", 30);
|
||||||
|
|
||||||
List<BusinessCaseDto> dtos = createSample(houseSelf, "rent", ratio, lng, lat, unitPrice);
|
List<BusinessCaseDto> dtos = createSample(houseSelf, "rent", ratio, lng, lat, unitPrice);
|
||||||
|
|
||||||
if(dtos!=null && dtos.size()>5){
|
if(dtos!=null && dtos.size()>5){
|
||||||
|
|||||||
Reference in New Issue
Block a user