优化匹配接口
This commit is contained in:
+1
@@ -619,6 +619,7 @@ public class AddressController {
|
|||||||
params.setProvince(model.getProvince());
|
params.setProvince(model.getProvince());
|
||||||
params.setUseMap(model.isUseMap());
|
params.setUseMap(model.isUseMap());
|
||||||
params.setDebugName(model.getDebugName());
|
params.setDebugName(model.getDebugName());
|
||||||
|
params.setPropertyType(model.getPropertyType());
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Building building = addressParserService.parser(params);
|
Building building = addressParserService.parser(params);
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class AddesssMatchModel extends FangjiaApiModel {
|
|||||||
private boolean useMap;
|
private boolean useMap;
|
||||||
private String address_1;
|
private String address_1;
|
||||||
private String address_2;
|
private String address_2;
|
||||||
|
private String propertyType;
|
||||||
|
|
||||||
private String showCode;
|
private String showCode;
|
||||||
|
|
||||||
@@ -153,4 +154,12 @@ public class AddesssMatchModel extends FangjiaApiModel {
|
|||||||
public void setShowCode(String showCode) {
|
public void setShowCode(String showCode) {
|
||||||
this.showCode = showCode;
|
this.showCode = showCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPropertyType() {
|
||||||
|
return propertyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyType(String propertyType) {
|
||||||
|
this.propertyType = propertyType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-1
@@ -10,6 +10,7 @@ import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
|||||||
import com.fangjia.dal.mongo.model.bkoff.HouseLoudong;
|
import com.fangjia.dal.mongo.model.bkoff.HouseLoudong;
|
||||||
import com.fangjia.dal.mongo.model.bkoff.Loudong;
|
import com.fangjia.dal.mongo.model.bkoff.Loudong;
|
||||||
import com.fangjia.dal.seaweed.dao.SeaweedDao;
|
import com.fangjia.dal.seaweed.dao.SeaweedDao;
|
||||||
|
import com.fangjia.dal.seaweed.model.District;
|
||||||
import com.fangjia.dal.seaweed.model.Seaweed;
|
import com.fangjia.dal.seaweed.model.Seaweed;
|
||||||
import com.fangjia.service.address.mode.*;
|
import com.fangjia.service.address.mode.*;
|
||||||
import com.fangjia.service.address.processor.AddressDistrictProcessors;
|
import com.fangjia.service.address.processor.AddressDistrictProcessors;
|
||||||
@@ -436,8 +437,27 @@ public class AddressParserServiceImpl implements AddressParserService {
|
|||||||
AddressScoreResult scoreResult = findMatchedMetaData(addr, buildingType, metaDataType);
|
AddressScoreResult scoreResult = findMatchedMetaData(addr, buildingType, metaDataType);
|
||||||
if(scoreResult.getResult().size() > 0){
|
if(scoreResult.getResult().size() > 0){
|
||||||
AddressMatchMetaData matchedMate = scoreResult.getResult().get(0);
|
AddressMatchMetaData matchedMate = scoreResult.getResult().get(0);
|
||||||
|
|
||||||
|
|
||||||
if(matchedMate.getMetaDataType() == MetaDataType.CPDB){
|
if(matchedMate.getMetaDataType() == MetaDataType.CPDB){
|
||||||
return new Building(districtService.findById(matchedMate.getId(), MATCH_PROPERTY_FIELDS), scoreResult.getScore(matchedMate));
|
District district = districtService.findById(matchedMate.getId(), MATCH_PROPERTY_FIELDS);
|
||||||
|
if("1".equals(addr.getPropertyType())){
|
||||||
|
if(!district.getEstateType2().equals("别墅") || !district.getName().endsWith("别墅")){
|
||||||
|
District districtNew = districtService.findDistrict(new DistrictKey(district.getCity(), district.getRegion(), district.getName() + "别墅"), district.getCategory());
|
||||||
|
if(districtNew != null){
|
||||||
|
district = districtNew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if("2".equals(addr.getPropertyType())){
|
||||||
|
if(!district.getEstateType2().equals("商住") || !district.getName().endsWith("商住楼")){
|
||||||
|
District districtNew = districtService.findDistrict(new DistrictKey(district.getCity(), district.getRegion(), district.getName() + "商住楼"), district.getCategory());
|
||||||
|
if(districtNew != null){
|
||||||
|
district = districtNew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Building(districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS), scoreResult.getScore(matchedMate));
|
||||||
}else{
|
}else{
|
||||||
return new Building(matchedMate, scoreResult.getScore(matchedMate));
|
return new Building(matchedMate, scoreResult.getScore(matchedMate));
|
||||||
}
|
}
|
||||||
@@ -500,6 +520,7 @@ public class AddressParserServiceImpl implements AddressParserService {
|
|||||||
addr.setProvince(params.getProvince());
|
addr.setProvince(params.getProvince());
|
||||||
addr.setDebugName(params.getDebugName());
|
addr.setDebugName(params.getDebugName());
|
||||||
addr.setUseMap(params.isUseMap());
|
addr.setUseMap(params.isUseMap());
|
||||||
|
addr.setPropertyType(params.getPropertyType());
|
||||||
return AddressProcessors.process(addr);
|
return AddressProcessors.process(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class Address {
|
public class Address {
|
||||||
|
|
||||||
|
private String propertyType;
|
||||||
private String province;
|
private String province;
|
||||||
private String city;
|
private String city;
|
||||||
private String district;
|
private String district;
|
||||||
@@ -769,6 +770,14 @@ public class Address {
|
|||||||
this.geoRegion = geoRegion;
|
this.geoRegion = geoRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPropertyType() {
|
||||||
|
return propertyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyType(String propertyType) {
|
||||||
|
this.propertyType = propertyType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Address{" +
|
return "Address{" +
|
||||||
|
|||||||
+9
-1
@@ -14,7 +14,7 @@ public class MatchParams {
|
|||||||
private String suggestName;
|
private String suggestName;
|
||||||
/**调试时断点小区名*/
|
/**调试时断点小区名*/
|
||||||
private String debugName;
|
private String debugName;
|
||||||
|
private String propertyType;
|
||||||
/**用户输入地址*/
|
/**用户输入地址*/
|
||||||
private String address;
|
private String address;
|
||||||
/**建筑类型解析出对应的建筑物*/
|
/**建筑类型解析出对应的建筑物*/
|
||||||
@@ -135,4 +135,12 @@ public class MatchParams {
|
|||||||
public void setDebugName(String debugName) {
|
public void setDebugName(String debugName) {
|
||||||
this.debugName = debugName;
|
this.debugName = debugName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPropertyType() {
|
||||||
|
return propertyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyType(String propertyType) {
|
||||||
|
this.propertyType = propertyType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user