新增江苏农行调用房源接口
This commit is contained in:
+78
-1
@@ -20,6 +20,7 @@ import com.fangjia.open.FangjiaApiUtil;
|
||||
import com.fangjia.open.HttpCode;
|
||||
import com.fangjia.open.OpenHttpCodeEnum;
|
||||
import com.fangjia.open.dto.HouseDto;
|
||||
import com.fangjia.open.dto.UniversalDto;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
@@ -28,6 +29,7 @@ import com.fangjia.open.model.HouseSearchModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.FileDao;
|
||||
import com.fangjia.open.ws.query.CollateralSampleQuery;
|
||||
import com.fangjia.open.ws.query.SampleQuery;
|
||||
import com.fangjia.open.ws.query.ShopCollateralSampleQuery;
|
||||
import com.fangjia.service.address.AddressParser;
|
||||
import com.fangjia.service.bo.Collateral;
|
||||
@@ -65,7 +67,6 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
public class HouseController {
|
||||
|
||||
@@ -322,6 +323,45 @@ public class HouseController {
|
||||
return queryBeans;
|
||||
}
|
||||
|
||||
|
||||
private List<CollateralSampleQueryBean> convertSampileQueryToBean(SampleQuery... queries) throws Exception{
|
||||
|
||||
List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>(queries.length);
|
||||
for(SampleQuery q : queries){
|
||||
|
||||
CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
|
||||
BeanUtils.copyProperties(q, queryBean);
|
||||
|
||||
|
||||
String propertyTypeCode = queryBean.getPropertyTypeCode();
|
||||
if(!Arrays.asList("01", "02", "03").contains(propertyTypeCode)){
|
||||
throw new Exception("propertyTypeCode取值非法");
|
||||
}
|
||||
String cat = "district";
|
||||
District property = districtService.findByNameAndAlias(queryBean.getCity(), queryBean.getDistrict(), queryBean.getBuildingName(), cat);
|
||||
if(property == null){
|
||||
throw new Exception("未找到该小区");
|
||||
}
|
||||
queryBean.setProperty(property);
|
||||
Integer decrCondCode = queryBean.getDecrCondCode();
|
||||
if(decrCondCode == null){
|
||||
decrCondCode = 2;
|
||||
}
|
||||
if(decrCondCode > 5 || decrCondCode < 1){
|
||||
throw new Exception("decrCondCode取值非法");
|
||||
}
|
||||
Integer towardDirectCode = queryBean.getTowardDirectCode();
|
||||
if(towardDirectCode == null){
|
||||
towardDirectCode = 3;
|
||||
}
|
||||
if(towardDirectCode > 10 || towardDirectCode < 1){
|
||||
throw new Exception("towardDirectCode取值非法");
|
||||
}
|
||||
queryBeans.add(queryBean);
|
||||
}
|
||||
return queryBeans;
|
||||
}
|
||||
|
||||
public Object detailAction(HousePublishModel model){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
@@ -774,6 +814,43 @@ public class HouseController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object caseAction(@Valid SampleQuery sampleQuery){
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
List<CollateralSampleQueryBean> querys = null;
|
||||
try{
|
||||
querys = convertSampileQueryToBean(sampleQuery);
|
||||
}catch (Exception e){
|
||||
mav.setModel(BasicModel.buildBadRequestModel(e.getMessage()));
|
||||
return mav;
|
||||
}
|
||||
if(null == sampleQuery.getMax()){
|
||||
sampleQuery.setMax(10);
|
||||
}
|
||||
List<Collateral> collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax());
|
||||
Collateral collateral = collaterals.get(0);
|
||||
List<Sample> samples = collateral.getSample();
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
if(samples!= null && samples.size()>=2){
|
||||
Sample minSample = samples.get(samples.size()-2);
|
||||
Sample maxSample = samples.get(samples.size()-1);
|
||||
dto.append("minUnitPrice", minSample.getUnitPrice());
|
||||
dto.append("maxUnitPrice", maxSample.getUnitPrice());
|
||||
}
|
||||
if(samples.size()>2){
|
||||
dto.append("datas", samples.subList(0, samples.size()-2));
|
||||
}else{
|
||||
dto.append("datas", samples);
|
||||
}
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dto));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private List<HousePojo> fillDistrictInfoForHouse(FacetQueryResult<com.fangjia.service.bo.HouseBo> houseList, Date endDate,
|
||||
District district, boolean showDetail, boolean matchModel) {
|
||||
FacetQueryResult<HousePojo> list = new FacetQueryResult<HousePojo>();
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.fangjia.open.ws.query;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
public class SampleQuery {
|
||||
|
||||
|
||||
/**城市*/
|
||||
@NotBlank
|
||||
private String city;
|
||||
|
||||
/**区域*/
|
||||
@NotBlank
|
||||
private String district;
|
||||
|
||||
@NotBlank
|
||||
/**小区名*/
|
||||
private String buildingName;
|
||||
/**楼栋名称*/
|
||||
private String buildingNoName;
|
||||
/**物业类型编码*/
|
||||
private String propertyTypeCode;
|
||||
/**是否有电梯 0:无 1:有*/
|
||||
private Integer isElevator;
|
||||
/**总楼层*/
|
||||
private Integer aboveFloorAmount;
|
||||
/**所在楼层*/
|
||||
private Integer floorNumber;
|
||||
/**
|
||||
* 装修情况编码
|
||||
* 1:毛坯
|
||||
* 2:简装(默认)
|
||||
* 3:精装
|
||||
* 4:豪装
|
||||
* */
|
||||
private Integer decrCondCode;
|
||||
/**面积**/
|
||||
private Double strctureArea;
|
||||
/**
|
||||
* 朝向情况编码
|
||||
* 1:西南
|
||||
* 2:东南
|
||||
* 3:南(默认)
|
||||
* 4:西北
|
||||
* 5:东北
|
||||
* 6:东
|
||||
* 7:西
|
||||
* 8:北
|
||||
* 9:东西
|
||||
* 10:南北
|
||||
* */
|
||||
private Integer towardDirectCode;
|
||||
|
||||
private Date updateDate;
|
||||
|
||||
private String address;
|
||||
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
private Integer max;
|
||||
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getBuildingName() {
|
||||
return buildingName;
|
||||
}
|
||||
|
||||
public void setBuildingName(String buildingName) {
|
||||
this.buildingName = buildingName;
|
||||
}
|
||||
|
||||
public String getBuildingNoName() {
|
||||
return buildingNoName;
|
||||
}
|
||||
|
||||
public void setBuildingNoName(String buildingNoName) {
|
||||
this.buildingNoName = buildingNoName;
|
||||
}
|
||||
|
||||
public String getPropertyTypeCode() {
|
||||
return propertyTypeCode;
|
||||
}
|
||||
|
||||
public void setPropertyTypeCode(String propertyTypeCode) {
|
||||
this.propertyTypeCode = propertyTypeCode;
|
||||
}
|
||||
|
||||
public Integer getIsElevator() {
|
||||
return isElevator;
|
||||
}
|
||||
|
||||
public void setIsElevator(Integer isElevator) {
|
||||
this.isElevator = isElevator;
|
||||
}
|
||||
|
||||
public Integer getAboveFloorAmount() {
|
||||
return aboveFloorAmount;
|
||||
}
|
||||
|
||||
public void setAboveFloorAmount(Integer aboveFloorAmount) {
|
||||
this.aboveFloorAmount = aboveFloorAmount;
|
||||
}
|
||||
|
||||
public Integer getFloorNumber() {
|
||||
return floorNumber;
|
||||
}
|
||||
|
||||
public void setFloorNumber(Integer floorNumber) {
|
||||
this.floorNumber = floorNumber;
|
||||
}
|
||||
|
||||
public Double getStrctureArea() {
|
||||
return strctureArea;
|
||||
}
|
||||
|
||||
public void setStrctureArea(Double strctureArea) {
|
||||
this.strctureArea = strctureArea;
|
||||
}
|
||||
|
||||
public Integer getDecrCondCode() {
|
||||
return decrCondCode;
|
||||
}
|
||||
|
||||
public void setDecrCondCode(Integer decrCondCode) {
|
||||
this.decrCondCode = decrCondCode;
|
||||
}
|
||||
|
||||
public Integer getTowardDirectCode() {
|
||||
return towardDirectCode;
|
||||
}
|
||||
|
||||
public void setTowardDirectCode(Integer towardDirectCode) {
|
||||
this.towardDirectCode = towardDirectCode;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user