商铺修改

This commit is contained in:
2026-01-29 19:06:12 +08:00
parent 5e4b2e20da
commit 2d2bf820ba
@@ -116,15 +116,18 @@ public class CommercialController {
if(mav.model()!=null){
return mav;
}
Double ratio = null;//getUserPriceRatio(request);
Double ratio = getUserPriceRatio(request);
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_EVALUATE);
if (json != null) {
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
if (json.containsKey("unitPrice") && json.containsKey("location")) {
Integer unitPrice = null;
Double 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);
model.setMinPrice(minPrice);
@@ -141,12 +144,17 @@ public class CommercialController {
JSONObject locObj = json.getJSONObject("location");
Double lng = locObj.getDouble("lon");
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());
if(dtos!=null && dtos.size()>5){
dtos = dtos.subList(0,5);
}
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
if(dtos!=null && dtos.size()<5){
BasicModel.markNoDataRequest();
}
}
} else{
mav.setModel(BasicModel.buildOKModel().setResult(null));
@@ -280,17 +288,17 @@ public class CommercialController {
dto.setName(sample.getName());
// dto.setLocation(sample.getString("location"));
if(ratio != null){
Integer totalPrice = (int)(sample.getTotalPrice().intValue() * ratio);
if(cat.equals("rent")){
Double dayPrice = totalPrice/(sample.getSize()*30);
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
}else{
Integer avgPrice = BigDecimal.valueOf(totalPrice/sample.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
dto.setUnitPrice(avgPrice);
}
dto.setTotalPrice(totalPrice);
}else{
// if(ratio != null){
// Integer totalPrice = (int)(sample.getTotalPrice().intValue() * ratio);
// if(cat.equals("rent")){
// Double dayPrice = totalPrice/(sample.getSize()*30);
// dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
// }else{
// Integer avgPrice = BigDecimal.valueOf(totalPrice/sample.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
// dto.setUnitPrice(avgPrice);
// }
// dto.setTotalPrice(totalPrice);
// }else{
if(cat.equals("rent")){
Double dayPrice = sample.getTotalPrice()/(sample.getSize()*30);
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
@@ -298,7 +306,7 @@ public class CommercialController {
dto.setUnitPrice(sample.getUnitPrice());
}
dto.setTotalPrice(sample.getTotalPrice());
}
// }
dto.setSize(sample.getSize());
if(StringUtils.isNotBlank(sample.getType())){
dto.setEstateType(sample.getType());
@@ -383,7 +391,7 @@ public class CommercialController {
if(mav.model()!=null){
return mav;
}
Double ratio = null;//getUserPriceRatio(request);
Double ratio = getUserPriceRatio(request);
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
if (json != null) {
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
@@ -394,6 +402,9 @@ public class CommercialController {
Double unitPrice = null;
if(json.get("unitPrice") != null){
unitPrice = (Double) json.get("unitPrice");
if(ratio!=null){
unitPrice = unitPrice * ratio;
}
minPrice = unitPrice - unitPrice * 0.1;
maxPrice = unitPrice + unitPrice * 0.1;
@@ -409,6 +420,7 @@ public class CommercialController {
Double lng = locObj.getDouble("lon");
Double lat = locObj.getDouble("lat");
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);
if(dtos!=null && dtos.size()>5){