update
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ import java.util.*;
|
||||
*
|
||||
* @since 2025/9/16
|
||||
*/
|
||||
//@Authority(role = Role.USER)
|
||||
@Authority(role = Role.USER)
|
||||
public class CommercialController {
|
||||
|
||||
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区","村庄");
|
||||
|
||||
+43
-16
@@ -815,7 +815,7 @@ public class OfficeController {
|
||||
}
|
||||
/* 先到CPDB库中查找写字楼 */
|
||||
District district = null;
|
||||
Double ratio = null;//getUserPriceRatio(request);
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
|
||||
if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())) {
|
||||
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), "office");
|
||||
@@ -880,10 +880,15 @@ public class OfficeController {
|
||||
pager.setPageSize(50);
|
||||
}
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(30);
|
||||
}
|
||||
|
||||
Double unitPrice = null;
|
||||
if(model.getMinPrice() == null){
|
||||
unitPrice = evaluation.getUnitPrice();
|
||||
if(ratio != null){
|
||||
unitPrice = unitPrice * ratio;
|
||||
}
|
||||
if(evaluation != null) {
|
||||
minPrice = evaluation.getUnitPrice() - evaluation.getUnitPrice() * 0.1;
|
||||
maxPrice = evaluation.getUnitPrice() + evaluation.getUnitPrice().intValue() * 0.1;
|
||||
@@ -900,8 +905,11 @@ public class OfficeController {
|
||||
Double lng = district.getLng()/10000000000.0;
|
||||
Double lat = district.getLat()/10000000000.0;
|
||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, DataUtil.getDoubleRound(2, minPrice), DataUtil.getDoubleRound(2, maxPrice), "office_rent", pager.getPageSize());
|
||||
List<BusinessCaseDto> createBusiness = createSample(houseSelf, "office_rent", district, ratio, lng, lat);
|
||||
List<BusinessCaseDto> createBusiness = createSample(houseSelf, "office_rent", district, ratio, lng, lat, unitPrice);
|
||||
|
||||
if(createBusiness!=null && createBusiness.size()>5){
|
||||
createBusiness = createBusiness.subList(0,5);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(createBusiness));
|
||||
if(createBusiness!=null && createBusiness.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
@@ -1168,7 +1176,7 @@ public class OfficeController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private List<BusinessCaseDto> createSample(List<DealSample> seawaterDtos, String cat, District district, Double ratio, Double lng, Double lat){
|
||||
private List<BusinessCaseDto> createSample(List<DealSample> seawaterDtos, String cat, District district, Double ratio, Double lng, Double lat, final Double unitPrice){
|
||||
if(seawaterDtos != null && seawaterDtos.size()>0){
|
||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||
for(DealSample house : seawaterDtos){
|
||||
@@ -1178,17 +1186,17 @@ public class OfficeController {
|
||||
dto.setDistrict(house.getDistrict());
|
||||
dto.setName(house.getName());
|
||||
|
||||
if(ratio != null){
|
||||
Integer totalPrice = (int) (house.getTotalPrice()*ratio);
|
||||
if(cat.equals("office_rent")){
|
||||
Double dayPrice = totalPrice/(house.getSize()*30);
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}else{
|
||||
Integer avgPrie = (int)(totalPrice/house.getSize());
|
||||
dto.setUnitPrice(avgPrie);
|
||||
}
|
||||
dto.setTotalPrice(totalPrice);
|
||||
}else{
|
||||
// if(ratio != null){
|
||||
// Integer totalPrice = (int) (house.getTotalPrice()*ratio);
|
||||
// if(cat.equals("office_rent")){
|
||||
// Double dayPrice = totalPrice/(house.getSize()*30);
|
||||
// dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
// }else{
|
||||
// Integer avgPrie = (int)(totalPrice/house.getSize());
|
||||
// dto.setUnitPrice(avgPrie);
|
||||
// }
|
||||
// dto.setTotalPrice(totalPrice);
|
||||
// }else{
|
||||
if(cat.equals("office_rent")){
|
||||
Double dayPrice = house.getTotalPrice()/(house.getSize()*30);
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
@@ -1197,7 +1205,7 @@ public class OfficeController {
|
||||
}
|
||||
dto.setTotalPrice(house.getTotalPrice());
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
if(StringUtils.isNotBlank(house.getType())){
|
||||
dto.setEstateType(house.getType());
|
||||
@@ -1212,6 +1220,25 @@ public class OfficeController {
|
||||
|
||||
dtos.add(dto);
|
||||
}
|
||||
|
||||
if(unitPrice!=null){
|
||||
Collections.sort(dtos, new Comparator<BusinessCaseDto>() {
|
||||
@Override
|
||||
public int compare(BusinessCaseDto dto1, BusinessCaseDto dto2) {
|
||||
double diff1 = Math.abs(dto1.getUnitPrice().doubleValue() - unitPrice);
|
||||
double diff2 = Math.abs(dto2.getUnitPrice().doubleValue() - unitPrice);
|
||||
|
||||
if (diff1 < diff2) {
|
||||
return -1;
|
||||
} else if (diff1 > diff2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return dtos;
|
||||
}
|
||||
return null;
|
||||
|
||||
+42
-16
@@ -546,7 +546,7 @@ public class OfficeSellController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
Double ratio = null;//getUserPriceRatio(request);
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
/* 先到CPDB库中查找写字楼 */
|
||||
District district = null;
|
||||
|
||||
@@ -615,11 +615,16 @@ public class OfficeSellController {
|
||||
pager.setPageSize(50);
|
||||
}
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(30);
|
||||
}
|
||||
|
||||
Double unitPrice = null;
|
||||
if(model.getMinPrice() == null){
|
||||
if(evaluation != null) {
|
||||
unitPrice = evaluation.getUnitPrice();
|
||||
if(ratio != null){
|
||||
unitPrice = unitPrice * ratio;
|
||||
}
|
||||
int minPrice = (int) (evaluation.getUnitPrice().intValue() - evaluation.getUnitPrice() * 0.1);
|
||||
model.setMinPrice(minPrice);
|
||||
|
||||
@@ -638,8 +643,11 @@ public class OfficeSellController {
|
||||
Double lng = district.getLng()/10000000000.0;
|
||||
Double lat = district.getLat()/10000000000.0;
|
||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, model.getMinPrice(), model.getMaxPrice(), "office_sell", pager.getPageSize());
|
||||
List<BusinessCaseDto> createBusiness = createSample(houseSelf, "office_sell", district, ratio, lng, lat);
|
||||
List<BusinessCaseDto> createBusiness = createSample(houseSelf, "office_sell", district, ratio, lng, lat, unitPrice);
|
||||
|
||||
if(createBusiness!=null && createBusiness.size()>5){
|
||||
createBusiness = createBusiness.subList(0,5);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(createBusiness));
|
||||
if(createBusiness !=null && createBusiness.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
@@ -880,7 +888,7 @@ public class OfficeSellController {
|
||||
}
|
||||
|
||||
|
||||
private List<BusinessCaseDto> createSample(List<DealSample> seawaterDtos, String cat, District district, Double ratio, Double lng, Double lat){
|
||||
private List<BusinessCaseDto> createSample(List<DealSample> seawaterDtos, String cat, District district, Double ratio, Double lng, Double lat, final Double unitPrice){
|
||||
if(seawaterDtos != null && seawaterDtos.size()>0){
|
||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||
for(DealSample house : seawaterDtos){
|
||||
@@ -890,17 +898,17 @@ public class OfficeSellController {
|
||||
dto.setDistrict(house.getDistrict());
|
||||
dto.setName(house.getName());
|
||||
|
||||
if(ratio != null){
|
||||
Integer totalPrice = (int) (house.getTotalPrice()*ratio);
|
||||
if(cat.equals("office_rent")){
|
||||
Double dayPrice = totalPrice/(house.getSize()*30);
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}else{
|
||||
Integer avgPrie = BigDecimal.valueOf(totalPrice/house.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
dto.setUnitPrice(avgPrie);
|
||||
}
|
||||
dto.setTotalPrice(totalPrice);
|
||||
}else{
|
||||
// if(ratio != null){
|
||||
// Integer totalPrice = (int) (house.getTotalPrice()*ratio);
|
||||
// if(cat.equals("office_rent")){
|
||||
// Double dayPrice = totalPrice/(house.getSize()*30);
|
||||
// dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
// }else{
|
||||
// Integer avgPrie = BigDecimal.valueOf(totalPrice/house.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
// dto.setUnitPrice(avgPrie);
|
||||
// }
|
||||
// dto.setTotalPrice(totalPrice);
|
||||
// }else{
|
||||
if(cat.equals("office_rent")){
|
||||
Double dayPrice = house.getTotalPrice()/(house.getSize()*30);
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
@@ -909,7 +917,7 @@ public class OfficeSellController {
|
||||
}
|
||||
dto.setTotalPrice(house.getTotalPrice());
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
if(StringUtils.isNotBlank(house.getType())){
|
||||
dto.setEstateType(house.getType());
|
||||
@@ -923,6 +931,24 @@ public class OfficeSellController {
|
||||
dto.setCaseDate(DateUtil.formatByPattern(house.getCaseDate(),"yyyy-MM-dd"));
|
||||
dtos.add(dto);
|
||||
}
|
||||
|
||||
if(unitPrice!=null){
|
||||
Collections.sort(dtos, new Comparator<BusinessCaseDto>() {
|
||||
@Override
|
||||
public int compare(BusinessCaseDto dto1, BusinessCaseDto dto2) {
|
||||
double diff1 = Math.abs(dto1.getUnitPrice().doubleValue() - unitPrice);
|
||||
double diff2 = Math.abs(dto2.getUnitPrice().doubleValue() - unitPrice);
|
||||
|
||||
if (diff1 < diff2) {
|
||||
return -1;
|
||||
} else if (diff1 > diff2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
return null;
|
||||
|
||||
+58
-27
@@ -130,7 +130,7 @@ import com.google.common.collect.Sets;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
|
||||
//@Authority(role = Role.USER)
|
||||
@Authority(role = Role.USER)
|
||||
public class PropertyController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||
private DistrictService districtService;
|
||||
@@ -6657,18 +6657,21 @@ public class PropertyController {
|
||||
pager.setPageSize(50);
|
||||
}
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(30);
|
||||
}
|
||||
Double ratio = null;//getUserPriceRatio(request);
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
Double minPrice = null;
|
||||
Double maxPrice = null;
|
||||
|
||||
Double avgPrice = null;
|
||||
if(district != null){
|
||||
if(model.getMinPrice() == null){
|
||||
SqmetreRent rent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), "district");
|
||||
|
||||
if(rent != null) {
|
||||
double avgPrice = DataUtil.getRound(2, rent.getAvgPrice().intValue()/30);
|
||||
avgPrice = Double.valueOf(DataUtil.getRound(2, rent.getAvgPrice().intValue()/30));
|
||||
if(ratio!=null){
|
||||
avgPrice = avgPrice * ratio;
|
||||
}
|
||||
minPrice = avgPrice - avgPrice * 0.1;
|
||||
maxPrice = avgPrice + avgPrice * 0.1;
|
||||
}
|
||||
@@ -6684,11 +6687,14 @@ public class PropertyController {
|
||||
if(caseDtos.size() < pager.getPageSize()){
|
||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(district.getLng()/10000000000.0, district.getLat()/10000000000.0, minPrice, maxPrice, "rent", pager.getPageSize());
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseSample(caseDtos, houseSelf, model.getShowSource(), ratio, district.getLng()/10000000000.0, district.getLat()/10000000000.0);
|
||||
caseDtos = createHouseSample(caseDtos, houseSelf, model.getShowSource(), ratio, district.getLng()/10000000000.0, district.getLat()/10000000000.0, avgPrice);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(caseDtos!=null && caseDtos.size()>5){
|
||||
caseDtos = caseDtos.subList(0,5);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
if(caseDtos!=null && caseDtos.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
@@ -6769,21 +6775,24 @@ public class PropertyController {
|
||||
pager.setPageSize(50);
|
||||
}
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(30);
|
||||
}
|
||||
Double ratio = null;//getUserPriceRatio(request);
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
Integer minPrice = null;
|
||||
Integer maxPrice = null;
|
||||
|
||||
Double avgPrice = null;
|
||||
if(district != null){
|
||||
if(model.getMinPrice() == null){
|
||||
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district.getCity(), district.getRegion(), district.getName()));
|
||||
if(statBo != null) {
|
||||
Integer avgPrice = null;
|
||||
|
||||
if(StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().equals("±ðÊû")){
|
||||
avgPrice = statBo.getVillaDistrictStat().getAvg_price_2b();
|
||||
avgPrice = Double.valueOf(statBo.getVillaDistrictStat().getAvg_price_2b());
|
||||
}else{
|
||||
avgPrice = statBo.getDistrictStat().getAvg_price_2b();
|
||||
avgPrice = Double.valueOf(statBo.getDistrictStat().getAvg_price_2b());
|
||||
}
|
||||
if(ratio != null){
|
||||
avgPrice = avgPrice * ratio;
|
||||
}
|
||||
minPrice = (int)(avgPrice - avgPrice * 0.1);
|
||||
maxPrice = (int)(avgPrice + avgPrice * 0.1);
|
||||
@@ -6800,11 +6809,15 @@ public class PropertyController {
|
||||
if(caseDtos.size() < pager.getPageSize()){
|
||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(district.getLng()/10000000000.0, district.getLat()/10000000000.0, minPrice, maxPrice, "sell", pager.getPageSize());
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseSample(caseDtos, houseSelf, model.getShowSource(), ratio, district.getLng()/10000000000.0, district.getLat()/10000000000.0);
|
||||
caseDtos = createHouseSample(caseDtos, houseSelf, model.getShowSource(), ratio, district.getLng()/10000000000.0, district.getLat()/10000000000.0, avgPrice);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(caseDtos!=null && caseDtos.size()>5){
|
||||
caseDtos = caseDtos.subList(0,5);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
if(caseDtos!=null && caseDtos.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
@@ -6849,7 +6862,7 @@ public class PropertyController {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<HouseCaseDto> createHouseSample(List<HouseCaseDto> caseDtos, List<DealSample> houses, Integer showSource, Double ratio, Double lng, Double lat){
|
||||
private List<HouseCaseDto> createHouseSample(List<HouseCaseDto> caseDtos, List<DealSample> houses, Integer showSource, Double ratio, Double lng, Double lat,final Double unitPrice){
|
||||
if (houses != null && !houses.isEmpty()) {
|
||||
Set<String> seenIds = new HashSet<String>();
|
||||
Iterator<DealSample> iterator = houses.iterator();
|
||||
@@ -6875,17 +6888,17 @@ public class PropertyController {
|
||||
caseDto.setSize(house.getSize() == null || house.getSize() == 0 ? null : house.getSize());
|
||||
|
||||
if(house.getTotalPrice()!=null){
|
||||
if(ratio!=null){
|
||||
Integer totalPrice = new BigDecimal(house.getTotalPrice() * ratio).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
caseDto.setTotalPrice(totalPrice);
|
||||
if(house.getCat().equals("sell")){
|
||||
caseDto.setUnitPrice(new BigDecimal(totalPrice/house.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue());
|
||||
}else if(house.getCat().equals("rent")){
|
||||
// Double dayPrice = house.getTotalPrice()/(30*house.getArea());
|
||||
Double dayPrice = totalPrice/(30*house.getSize());
|
||||
caseDto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}
|
||||
}else{
|
||||
// if(ratio!=null){
|
||||
// Integer totalPrice = new BigDecimal(house.getTotalPrice() * ratio).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
// caseDto.setTotalPrice(totalPrice);
|
||||
// if(house.getCat().equals("sell")){
|
||||
// caseDto.setUnitPrice(new BigDecimal(totalPrice/house.getSize()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue());
|
||||
// }else if(house.getCat().equals("rent")){
|
||||
//// Double dayPrice = house.getTotalPrice()/(30*house.getArea());
|
||||
// Double dayPrice = totalPrice/(30*house.getSize());
|
||||
// caseDto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
// }
|
||||
// }else{
|
||||
caseDto.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice());
|
||||
if(house.getCat().equals("sell")){
|
||||
caseDto.setUnitPrice(house.getUnitPrice());
|
||||
@@ -6893,7 +6906,7 @@ public class PropertyController {
|
||||
Double dayPrice = house.getTotalPrice()/(30*house.getSize());
|
||||
caseDto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
caseDto.setDirection(house.getDirection());
|
||||
caseDto.setDecoration(house.getDecoration());
|
||||
@@ -6913,6 +6926,24 @@ public class PropertyController {
|
||||
caseDtos.add(caseDto);
|
||||
}
|
||||
}
|
||||
if(unitPrice!=null){
|
||||
Collections.sort(caseDtos, new Comparator<HouseCaseDto>() {
|
||||
@Override
|
||||
public int compare(HouseCaseDto dto1, HouseCaseDto dto2) {
|
||||
double diff1 = Math.abs(dto1.getUnitPrice().doubleValue() - unitPrice);
|
||||
double diff2 = Math.abs(dto2.getUnitPrice().doubleValue() - unitPrice);
|
||||
|
||||
if (diff1 < diff2) {
|
||||
return -1;
|
||||
} else if (diff1 > diff2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
return caseDtos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user