|
@@ -74,7 +74,7 @@ public class AddressQueryEngine {
|
|
|
for (String addr : addrs) {
|
|
|
// 创建请求
|
|
|
addressResult = szxSearchByName(addr);
|
|
|
- if (addressResult != null) {
|
|
|
+ if (addressResult != null && addressResult.getData().size() > 0 && ifRuleData(addressResult.getData().get(0).getScore())) {
|
|
|
addressResult.setCode(AddressResultEnum.SZX_SUCCESS);
|
|
|
addressResult.setMessage("成功");
|
|
|
return getCjWgWgwByLoc(addressResult);
|
|
@@ -95,6 +95,25 @@ public class AddressQueryEngine {
|
|
|
return addressResult;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 使用市中心的地名地址搜索后,如果结果不理想,则使用高德地名地址接口请求
|
|
|
+ *
|
|
|
+ * @param score 市中心地名地址接口返回的最高打分
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean ifRuleData(String score) {
|
|
|
+ if (score.contains("rule_")) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ return Float.parseFloat(score) > 1.8;
|
|
|
+ } catch (Exception e) {
|
|
|
+// 防患于未然,也许会有什么空值,异常值……
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/***
|
|
|
* 市四中心地名搜索
|
|
|
* @param address
|