加id
This commit is contained in:
+2
@@ -223,6 +223,7 @@ public class CommercialController {
|
|||||||
for(int i=0 ;i < cases.size(); i++){
|
for(int i=0 ;i < cases.size(); i++){
|
||||||
JSONObject jsonObject = cases.getJSONObject(i);
|
JSONObject jsonObject = cases.getJSONObject(i);
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(jsonObject.getString("id"));
|
||||||
dto.setCity(jsonObject.getString("city"));
|
dto.setCity(jsonObject.getString("city"));
|
||||||
dto.setDistrict(jsonObject.getString("district"));
|
dto.setDistrict(jsonObject.getString("district"));
|
||||||
dto.setName(jsonObject.getString("name"));
|
dto.setName(jsonObject.getString("name"));
|
||||||
@@ -273,6 +274,7 @@ public class CommercialController {
|
|||||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||||
for(DealSample sample : cases){
|
for(DealSample sample : cases){
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(sample.getId());
|
||||||
dto.setCity(sample.getCity());
|
dto.setCity(sample.getCity());
|
||||||
dto.setDistrict(sample.getDistrict());
|
dto.setDistrict(sample.getDistrict());
|
||||||
dto.setName(sample.getName());
|
dto.setName(sample.getName());
|
||||||
|
|||||||
@@ -1118,6 +1118,7 @@ public class OfficeController {
|
|||||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||||
for(SeawaterDto house : seawaterDtos){
|
for(SeawaterDto house : seawaterDtos){
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(house.getId());
|
||||||
dto.setCity(house.getCity());
|
dto.setCity(house.getCity());
|
||||||
dto.setDistrict(house.getDistrict());
|
dto.setDistrict(house.getDistrict());
|
||||||
dto.setName(house.getName());
|
dto.setName(house.getName());
|
||||||
@@ -1172,6 +1173,7 @@ public class OfficeController {
|
|||||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||||
for(DealSample house : seawaterDtos){
|
for(DealSample house : seawaterDtos){
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(house.getId());
|
||||||
dto.setCity(house.getCity());
|
dto.setCity(house.getCity());
|
||||||
dto.setDistrict(house.getDistrict());
|
dto.setDistrict(house.getDistrict());
|
||||||
dto.setName(house.getName());
|
dto.setName(house.getName());
|
||||||
|
|||||||
+2
@@ -827,6 +827,7 @@ public class OfficeSellController {
|
|||||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||||
for(SeawaterDto house : seawaterDtos){
|
for(SeawaterDto house : seawaterDtos){
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(house.getId());
|
||||||
dto.setCity(house.getCity());
|
dto.setCity(house.getCity());
|
||||||
dto.setDistrict(house.getDistrict());
|
dto.setDistrict(house.getDistrict());
|
||||||
dto.setName(house.getName());
|
dto.setName(house.getName());
|
||||||
@@ -884,6 +885,7 @@ public class OfficeSellController {
|
|||||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||||
for(DealSample house : seawaterDtos){
|
for(DealSample house : seawaterDtos){
|
||||||
BusinessCaseDto dto = new BusinessCaseDto();
|
BusinessCaseDto dto = new BusinessCaseDto();
|
||||||
|
dto.setId(house.getId());
|
||||||
dto.setCity(house.getCity());
|
dto.setCity(house.getCity());
|
||||||
dto.setDistrict(house.getDistrict());
|
dto.setDistrict(house.getDistrict());
|
||||||
dto.setName(house.getName());
|
dto.setName(house.getName());
|
||||||
|
|||||||
+117
-1
@@ -130,7 +130,7 @@ import com.google.common.collect.Sets;
|
|||||||
import com.mongodb.BasicDBObject;
|
import com.mongodb.BasicDBObject;
|
||||||
import com.mongodb.DBObject;
|
import com.mongodb.DBObject;
|
||||||
|
|
||||||
@Authority(role = Role.USER)
|
//@Authority(role = Role.USER)
|
||||||
public class PropertyController {
|
public class PropertyController {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||||
private DistrictService districtService;
|
private DistrictService districtService;
|
||||||
@@ -6698,6 +6698,122 @@ public class PropertyController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 湖北征信定制接口
|
||||||
|
* @param model
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object sellSampleAction(PropertyEvaluationModel model, HttpServletRequest request){
|
||||||
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
|
mav.setViewType("rest");
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(model.getCity())) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
District district = null;
|
||||||
|
String estateType = null;
|
||||||
|
if(StringUtils.isNotBlank(model.getPropertyType())){
|
||||||
|
if(model.getPropertyType().equals("0")){
|
||||||
|
estateType = "普通住宅";
|
||||||
|
}else if(model.getPropertyType().equals("1")){
|
||||||
|
estateType = "别墅";
|
||||||
|
}else if(model.getPropertyType().equals("2")){
|
||||||
|
estateType = "商住";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())){
|
||||||
|
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) {
|
||||||
|
JSONObject resultObject = null;
|
||||||
|
if(StringUtils.isNotBlank(model.getAddress())){
|
||||||
|
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "property", false);
|
||||||
|
}else if(StringUtils.isNotBlank(model.getName())){
|
||||||
|
if(estateType !=null && estateType.equals("别墅") && !model.getName().contains("别墅")){
|
||||||
|
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName()+"别墅", "property", false);
|
||||||
|
}else{
|
||||||
|
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "property", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resultObject != null){
|
||||||
|
String id = (String) resultObject.get("id");
|
||||||
|
district = districtService.findById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(district == null && StringUtils.isBlank(model.getLocation())){
|
||||||
|
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<HouseCaseDto> caseDtos = new ArrayList<HouseCaseDto>();
|
||||||
|
|
||||||
|
Pager pager = new Pager();
|
||||||
|
pager.setStartRow(0);
|
||||||
|
if (model.getPageSize() != null) {
|
||||||
|
if(model.getPageSize() <=50){
|
||||||
|
pager.setPageSize(model.getPageSize());
|
||||||
|
}else{
|
||||||
|
pager.setPageSize(50);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pager.setPageSize(5);
|
||||||
|
}
|
||||||
|
Double ratio = null;//getUserPriceRatio(request);
|
||||||
|
Integer minPrice = null;
|
||||||
|
Integer maxPrice = 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();
|
||||||
|
}else{
|
||||||
|
avgPrice = statBo.getDistrictStat().getAvg_price_2b();
|
||||||
|
}
|
||||||
|
minPrice = (int)(avgPrice - avgPrice * 0.1);
|
||||||
|
maxPrice = (int)(avgPrice + avgPrice * 0.1);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(model.getMinPrice() != null){
|
||||||
|
minPrice = model.getMinPrice();
|
||||||
|
}
|
||||||
|
if(model.getMaxPrice() != null){
|
||||||
|
maxPrice = model.getMaxPrice();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||||
|
if(caseDtos!=null && caseDtos.size()<5){
|
||||||
|
BasicModel.markNoDataRequest();
|
||||||
|
}
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<HouseCaseDto> createDealHouseCase(List<HouseCaseDto> caseDtos, List<DealPrice> dealPrices,int distance, Integer showSource){
|
private List<HouseCaseDto> createDealHouseCase(List<HouseCaseDto> caseDtos, List<DealPrice> dealPrices,int distance, Integer showSource){
|
||||||
if(dealPrices!=null && dealPrices.size()>0){
|
if(dealPrices!=null && dealPrices.size()>0){
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<String>();
|
||||||
|
|||||||
Reference in New Issue
Block a user