|
@@ -1,9 +1,8 @@
|
|
|
package com.leeroa.dydb.price.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.leeroa.base.log.LogHelper;
|
|
|
import com.leeroa.base.parameter.service.ParameterContainer;
|
|
|
-import com.leeroa.base.utils.sql.TemplateUtils;
|
|
|
-import com.leeroa.cache.ConfigCache;
|
|
|
import com.leeroa.core.index.domain.IndexWeightDetail;
|
|
|
import com.leeroa.core.index.utils.IndexWeightUtils;
|
|
|
import com.leeroa.core.index.utils.RegUtils;
|
|
@@ -23,19 +22,17 @@ import com.leeroa.dydb.price.domain.CommunityPrice;
|
|
|
import com.leeroa.dydb.price.domain.CommunityPriceHistory;
|
|
|
import com.leeroa.dydb.price.domain.ViewHousePrice;
|
|
|
import com.leeroa.dydb.price.service.CommunityPriceService;
|
|
|
-import com.leeroa.dydb.price.vo.AddressVO;
|
|
|
import com.leeroa.dydb.price.vo.CommunityPriceVo;
|
|
|
import com.leeroa.dydb.price.vo.DataSourcePriceVO;
|
|
|
import com.leeroa.dydb.price.vo.PriceTempVO;
|
|
|
import com.leeroa.dydb.utils.DoubleUtils;
|
|
|
import com.leeroa.dydb.utils.PriceUtils;
|
|
|
-import com.leeroa.dydb.utils.baidu.*;
|
|
|
+import com.leeroa.dydb.utils.amap.AMapTask;
|
|
|
import com.michael.core.beans.BeanWrapBuilder;
|
|
|
import com.michael.core.beans.BeanWrapCallback;
|
|
|
import com.michael.core.hibernate.HibernateUtils;
|
|
|
import com.michael.core.hibernate.validator.ValidatorUtils;
|
|
|
import com.michael.core.pager.PageVo;
|
|
|
-import com.michael.utils.collection.CollectionUtils;
|
|
|
import com.michael.utils.date.DateUtils;
|
|
|
import com.michael.utils.number.IntegerUtils;
|
|
|
import com.michael.utils.string.StringUtils;
|
|
@@ -53,6 +50,7 @@ import org.springframework.util.Assert;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigInteger;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
@@ -175,92 +173,92 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
|
|
|
@Override
|
|
|
public void batchInitBaiduInfo(List<CommunityPrice> data) {
|
|
|
- final int total = data.size();
|
|
|
- LogHelper.info("%s-->批量更新所有小区的地址信息 ---------- %s", Thread.currentThread().getName(), total);
|
|
|
- final Session session = HibernateUtils.getSession();
|
|
|
- final int batch = 30;
|
|
|
- int index = 0;
|
|
|
- for (CommunityPrice datum : data) {
|
|
|
- index++;
|
|
|
-
|
|
|
- // 如果有经纬度,但是没有地址(说明数据来源于链家)则从百度获取地址
|
|
|
- String longitude = datum.getLongitude();
|
|
|
- if (StringUtils.isNotEmpty(longitude) && StringUtils.isEmpty(datum.getAddress())) {
|
|
|
- BaiduResponseData baiduData = BaiduMapUtils.getByXY(datum.getLongitude(), datum.getLatitude());
|
|
|
- if (baiduData != null && 0 == baiduData.getStatus()) {
|
|
|
- BaiduResult result = baiduData.getResult();
|
|
|
- BaiduXY xy = result.getLocation();
|
|
|
- if (xy != null && StringUtils.isNotEmpty(xy.getLng())) {
|
|
|
- datum.setLongitude(xy.getLng());
|
|
|
- }
|
|
|
- if (xy != null && StringUtils.isNotEmpty(xy.getLat())) {
|
|
|
- datum.setLatitude(xy.getLat());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(result.getAddress())) {
|
|
|
- datum.setAddress(result.getAddress());
|
|
|
- }
|
|
|
- BaiduData foo = result.getDetail();
|
|
|
- if (StringUtils.isNotEmpty(datum.getBizName()) && StringUtils.isNotEmpty(result.getBizNames())) {
|
|
|
- datum.setBizName(result.getBizNames().split(",")[0]);
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(datum.getProvinceName())) {
|
|
|
- datum.setProvinceName(foo.getProvince());
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(datum.getCityName())) {
|
|
|
- datum.setCityName(foo.getCity());
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(datum.getAreaName())) {
|
|
|
- datum.setAreaName(StringUtils.emptyDefault(foo.getDistrict(), foo.getTown()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 如果地址依旧为空,则通过小区名称来查询
|
|
|
- if (StringUtils.isEmpty(datum.getAddress())) {
|
|
|
- BaiduResponseData baiduData = BaiduMapUtils.get(datum.getHouses());
|
|
|
- if (StringUtils.equals(baiduData.getMessage(), "ok")) {
|
|
|
- // 成功解析数据
|
|
|
- if (CollectionUtils.isNotEmpty(baiduData.getResults())) {
|
|
|
- BaiduData bd = baiduData.getResults().get(0);
|
|
|
- datum.setBaiduName(bd.getName());
|
|
|
- //更新省市区街道
|
|
|
- if (StringUtils.isNotEmpty(datum.getProvinceName())) {
|
|
|
- datum.setProvinceName(HouseUtils.formatProvince(bd.getProvince()));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(datum.getCityName())) {
|
|
|
- datum.setCityName(bd.getCity());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(datum.getAreaName())) {
|
|
|
- datum.setAreaName(bd.getArea());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(datum.getAddress())) {
|
|
|
- datum.setAddress(bd.getAddress());
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(datum.getLongitude()) && bd.getLocation() != null) {
|
|
|
- BaiduXY xy = bd.getLocation();
|
|
|
- datum.setLatitude(xy.getLat());
|
|
|
- datum.setLongitude(xy.getLng());
|
|
|
- }
|
|
|
- // 如果使用严谨模式,则名称必须一致才可以。等待手动确认
|
|
|
- if (!bd.getName().equals(datum.getHouses())) {
|
|
|
- String name1 = bd.getName().replaceAll("\\s+", "").replaceAll("([\\w东西南北]+区)?([一二三四五六七八九]期)?(·-_)?", "");
|
|
|
- String name2 = datum.getHouses().replaceAll("\\s+", "").replaceAll("([\\w东西南北]+区)?([一二三四五六七八九]期)?(·-_)?", "");
|
|
|
- }
|
|
|
- }
|
|
|
- datum.setMapType("baidu");
|
|
|
- session.update(datum);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (index % batch == 0) {
|
|
|
- LogHelper.info("%s-->批量更新所有小区的地址信息 ---- %s/%s ---", Thread.currentThread().getName(), index, total);
|
|
|
- session.flush();
|
|
|
- session.clear();
|
|
|
- }
|
|
|
- }
|
|
|
- session.flush();
|
|
|
- session.clear();
|
|
|
- LogHelper.info("%s-->批量更新所有小区的地址信息 ---------- OK!!!", Thread.currentThread().getName());
|
|
|
+// final int total = data.size();
|
|
|
+// LogHelper.info("%s-->批量更新所有小区的地址信息 ---------- %s", Thread.currentThread().getName(), total);
|
|
|
+// final Session session = HibernateUtils.getSession();
|
|
|
+// final int batch = 30;
|
|
|
+// int index = 0;
|
|
|
+// for (CommunityPrice datum : data) {
|
|
|
+// index++;
|
|
|
+//
|
|
|
+// // 如果有经纬度,但是没有地址(说明数据来源于链家)则从百度获取地址
|
|
|
+// String longitude = datum.getLongitude();
|
|
|
+// if (StringUtils.isNotEmpty(longitude) && StringUtils.isEmpty(datum.getAddress())) {
|
|
|
+// BaiduResponseData baiduData = BaiduMapUtils.getByXY(datum.getLongitude(), datum.getLatitude());
|
|
|
+// if (baiduData != null && 0 == baiduData.getStatus()) {
|
|
|
+// BaiduResult result = baiduData.getResult();
|
|
|
+// BaiduXY xy = result.getLocation();
|
|
|
+// if (xy != null && StringUtils.isNotEmpty(xy.getLng())) {
|
|
|
+// datum.setLongitude(xy.getLng());
|
|
|
+// }
|
|
|
+// if (xy != null && StringUtils.isNotEmpty(xy.getLat())) {
|
|
|
+// datum.setLatitude(xy.getLat());
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(result.getAddress())) {
|
|
|
+// datum.setAddress(result.getAddress());
|
|
|
+// }
|
|
|
+// BaiduData foo = result.getDetail();
|
|
|
+// if (StringUtils.isNotEmpty(datum.getBizName()) && StringUtils.isNotEmpty(result.getBizNames())) {
|
|
|
+// datum.setBizName(result.getBizNames().split(",")[0]);
|
|
|
+// }
|
|
|
+// if (StringUtils.isEmpty(datum.getProvinceName())) {
|
|
|
+// datum.setProvinceName(foo.getProvince());
|
|
|
+// }
|
|
|
+// if (StringUtils.isEmpty(datum.getCityName())) {
|
|
|
+// datum.setCityName(foo.getCity());
|
|
|
+// }
|
|
|
+// if (StringUtils.isEmpty(datum.getAreaName())) {
|
|
|
+// datum.setAreaName(StringUtils.emptyDefault(foo.getDistrict(), foo.getTown()));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 如果地址依旧为空,则通过小区名称来查询
|
|
|
+// if (StringUtils.isEmpty(datum.getAddress())) {
|
|
|
+// BaiduResponseData baiduData = BaiduMapUtils.get(datum.getHouses());
|
|
|
+// if (StringUtils.equals(baiduData.getMessage(), "ok")) {
|
|
|
+// // 成功解析数据
|
|
|
+// if (CollectionUtils.isNotEmpty(baiduData.getResults())) {
|
|
|
+// BaiduData bd = baiduData.getResults().get(0);
|
|
|
+// datum.setBaiduName(bd.getName());
|
|
|
+// //更新省市区街道
|
|
|
+// if (StringUtils.isNotEmpty(datum.getProvinceName())) {
|
|
|
+// datum.setProvinceName(HouseUtils.formatProvince(bd.getProvince()));
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(datum.getCityName())) {
|
|
|
+// datum.setCityName(bd.getCity());
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(datum.getAreaName())) {
|
|
|
+// datum.setAreaName(bd.getArea());
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(datum.getAddress())) {
|
|
|
+// datum.setAddress(bd.getAddress());
|
|
|
+// }
|
|
|
+// if (StringUtils.isEmpty(datum.getLongitude()) && bd.getLocation() != null) {
|
|
|
+// BaiduXY xy = bd.getLocation();
|
|
|
+// datum.setLatitude(xy.getLat());
|
|
|
+// datum.setLongitude(xy.getLng());
|
|
|
+// }
|
|
|
+// // 如果使用严谨模式,则名称必须一致才可以。等待手动确认
|
|
|
+// if (!bd.getName().equals(datum.getHouses())) {
|
|
|
+// String name1 = bd.getName().replaceAll("\\s+", "").replaceAll("([\\w东西南北]+区)?([一二三四五六七八九]期)?(·-_)?", "");
|
|
|
+// String name2 = datum.getHouses().replaceAll("\\s+", "").replaceAll("([\\w东西南北]+区)?([一二三四五六七八九]期)?(·-_)?", "");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// datum.setMapType("baidu");
|
|
|
+// session.update(datum);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (index % batch == 0) {
|
|
|
+// LogHelper.info("%s-->批量更新所有小区的地址信息 ---- %s/%s ---", Thread.currentThread().getName(), index, total);
|
|
|
+// session.flush();
|
|
|
+// session.clear();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// session.flush();
|
|
|
+// session.clear();
|
|
|
+// LogHelper.info("%s-->批量更新所有小区的地址信息 ---------- OK!!!", Thread.currentThread().getName());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -320,11 +318,11 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
communityPrice.setPriceUpdateTime(new Date());
|
|
|
|
|
|
// 判断地址是否发生了变化
|
|
|
- AddressVO vo = getAddressByName(communityPrice.getHouses());
|
|
|
- if (vo != null && StringUtils.notEquals(vo.getAddress(), communityPrice.getAddress())) {
|
|
|
- log.info("小区地址位置发生变化 - {} : {} -> {}", communityPrice.getHouses(), communityPrice.getAddress(), vo.getAddress());
|
|
|
- communityPrice.setAddress(vo.getAddress());
|
|
|
- }
|
|
|
+// AddressVO vo = getAddressByName(communityPrice.getHouses());
|
|
|
+// if (vo != null && StringUtils.notEquals(vo.getAddress(), communityPrice.getAddress())) {
|
|
|
+// log.info("小区地址位置发生变化 - {} : {} -> {}", communityPrice.getHouses(), communityPrice.getAddress(), vo.getAddress());
|
|
|
+// communityPrice.setAddress(vo.getAddress());
|
|
|
+// }
|
|
|
|
|
|
// 判断价格是否改变,如果改变了,则保存历史记录
|
|
|
if (DoubleUtils.notEquals(newAvgPrice, communityPrice.getPrice())) {
|
|
@@ -405,6 +403,7 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
return time;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
|
private void loadAllDataSourceHouse(Set<String> houseSet, Date time, Date lastPriceDate) {
|
|
|
|
|
@@ -492,7 +491,7 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
public void deleteRepeatCommunity() {
|
|
|
final Session session = HibernateUtils.getSession();
|
|
|
// 获取所有名称重复的数据
|
|
|
- String sql = "select houses,count(distinct id) as total,max(createdDatetime) as createdDatetime\n" +
|
|
|
+ String sql = "select houses,count(distinct id) as total,max(id) as maxId\n" +
|
|
|
"from db_price_community where houses is not null \n" +
|
|
|
"group by houses having total > 1";
|
|
|
List<Map<String, Object>> data = SQLUtils.listMap(sql, null);
|
|
@@ -500,10 +499,10 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
log.info("开始删除重复的小区...共有 {} 个小区符合条件!", data.size());
|
|
|
data.forEach(k -> {
|
|
|
String houseName = k.get("houses").toString();
|
|
|
- Date maxDate = (Date) k.get("createdDatetime");
|
|
|
- long total = session.createSQLQuery("delete from db_price_community where houses=:houses and createdDatetime<:createdDatetime")
|
|
|
+ String maxId = k.get("maxId").toString();
|
|
|
+ long total = session.createSQLQuery("delete from db_price_community where houses=:houses and id !=:maxId")
|
|
|
.setParameter("houses", houseName)
|
|
|
- .setParameter("createdDatetime", maxDate)
|
|
|
+ .setParameter("maxId", maxId)
|
|
|
.executeUpdate();
|
|
|
log.info("删除重复的小区:{},共计 {} 条!", houseName, total);
|
|
|
count.add(BigInteger.valueOf(total));
|
|
@@ -557,76 +556,112 @@ public class CommunityPriceServiceImpl implements CommunityPriceService, BeanWra
|
|
|
.uniqueResult();
|
|
|
}
|
|
|
|
|
|
+ // @Override
|
|
|
+// public AddressVO getAddressByName(String houses) {
|
|
|
+// if (StringUtils.isEmpty(houses)) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// Map<String, Object> params = new HashMap<>();
|
|
|
+// params.put("houses", houses);
|
|
|
+// String sql = TemplateUtils.getTemplate("fmt/query_address.fmt", params, ConfigCache.isDebug());
|
|
|
+// List<Map<String, Object>> data = com.leeroa.base.utils.sql.SQLUtils.listMap(sql, params);
|
|
|
+// if (data == null || data.isEmpty()) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// Set<String> addressSet = new HashSet<>();
|
|
|
+// AddressVO vo = new AddressVO();
|
|
|
+// for (Map<String, Object> map : data) {
|
|
|
+// String address = (String) map.get("address");
|
|
|
+// if (address == null) {
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// // 解析街道
|
|
|
+// String[] addressArray = address.split("[,,/;;]");
|
|
|
+// for (String fooAddress : addressArray) {
|
|
|
+// // 获取到地址
|
|
|
+// if (vo.getProvince() == null) {
|
|
|
+// String province = HouseUtils.getProvince(address);
|
|
|
+// vo.setProvince(province);
|
|
|
+// }
|
|
|
+// if (vo.getCity() == null) {
|
|
|
+// String city = HouseUtils.getCity(address);
|
|
|
+// vo.setCity(city);
|
|
|
+// }
|
|
|
+// if (vo.getArea() == null) {
|
|
|
+// String area = HouseUtils.getArea(address);
|
|
|
+// if (HouseUtils.AREA_CHENGDU.contains(area)) {
|
|
|
+// vo.setArea(area);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// String street = HouseUtils.getStreet(fooAddress);
|
|
|
+// // 如果没有解析出地址,则跳过
|
|
|
+// if (StringUtils.isEmpty(street)) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// addressSet.add(street);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// StringBuilder builder = new StringBuilder("");
|
|
|
+// for (String fooAddress : addressSet) {
|
|
|
+// String street = HouseUtils.getStreet(fooAddress);
|
|
|
+// // 如果没有解析出地址,则跳过
|
|
|
+// if (StringUtils.isEmpty(street)) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// // 如果地址中已经包含,则跳过
|
|
|
+// if (builder.indexOf(street) != -1) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// // 如果是当前门牌号包含了之前的地址,则直接替换。
|
|
|
+// if (street.contains(builder.toString())) {
|
|
|
+// builder.delete(0, builder.length());
|
|
|
+// builder.append(",").append(street);
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// // 追加
|
|
|
+// builder.append(",").append(street);
|
|
|
+// }
|
|
|
+// if (builder.length() > 0) {
|
|
|
+// String newAddress = builder.substring(1);
|
|
|
+// vo.setAddress(newAddress);
|
|
|
+// }
|
|
|
+// return vo;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
- public AddressVO getAddressByName(String houses) {
|
|
|
- if (StringUtils.isEmpty(houses)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("houses", houses);
|
|
|
- String sql = TemplateUtils.getTemplate("fmt/query_address.fmt", params, ConfigCache.isDebug());
|
|
|
- List<Map<String, Object>> data = com.leeroa.base.utils.sql.SQLUtils.listMap(sql, params);
|
|
|
- if (data == null || data.isEmpty()) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- Set<String> addressSet = new HashSet<>();
|
|
|
- AddressVO vo = new AddressVO();
|
|
|
- for (Map<String, Object> map : data) {
|
|
|
- String address = (String) map.get("address");
|
|
|
- if (address == null) {
|
|
|
- break;
|
|
|
- }
|
|
|
- // 解析街道
|
|
|
- String[] addressArray = address.split("[,,/;;]");
|
|
|
- for (String fooAddress : addressArray) {
|
|
|
- // 获取到地址
|
|
|
- if (vo.getProvince() == null) {
|
|
|
- String province = HouseUtils.getProvince(address);
|
|
|
- vo.setProvince(province);
|
|
|
- }
|
|
|
- if (vo.getCity() == null) {
|
|
|
- String city = HouseUtils.getCity(address);
|
|
|
- vo.setCity(city);
|
|
|
- }
|
|
|
- if (vo.getArea() == null) {
|
|
|
- String area = HouseUtils.getArea(address);
|
|
|
- if (HouseUtils.AREA_CHENGDU.contains(area)) {
|
|
|
- vo.setArea(area);
|
|
|
+ public void updateAddressByAMap() {
|
|
|
+ List<Map<String, Object>> maps = SQLUtils.listMap("select id,cityName,houses,address from db_price_community where " +
|
|
|
+ "address is null and cityName is not null and houses is not null", null);
|
|
|
+ if (CollectionUtil.isNotEmpty(maps)){
|
|
|
+ final Session session = HibernateUtils.getSession();
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
+ for(Map<String,Object> x : maps){
|
|
|
+ String id = x.get("id").toString();
|
|
|
+ String cityName = x.get("cityName").toString();
|
|
|
+ String houses = x.get("houses").toString();
|
|
|
+ AMapTask task = new AMapTask(cityName,houses);
|
|
|
+ Future<List<String>> future = executorService.submit(task);
|
|
|
+ try {
|
|
|
+ List<String> result = future.get();
|
|
|
+ if (CollectionUtil.isNotEmpty(result)){
|
|
|
+ String xAddresses = org.apache.commons.lang.StringUtils.strip(result.toString(), "[]");
|
|
|
+ session.createSQLQuery("update db_price_community set address = :address where id = :id")
|
|
|
+ .setParameter("address",xAddresses)
|
|
|
+ .setParameter("id",id).executeUpdate();
|
|
|
+ log.info("更新{},{}小区=====>地址:成功", cityName,houses);
|
|
|
}
|
|
|
+ if (result==null){
|
|
|
+ LogHelper.info("高德API接口返回异常,中止请求。");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } catch (InterruptedException | ExecutionException e) {
|
|
|
+ // 异常处理
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- String street = HouseUtils.getStreet(fooAddress);
|
|
|
- // 如果没有解析出地址,则跳过
|
|
|
- if (StringUtils.isEmpty(street)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- addressSet.add(street);
|
|
|
}
|
|
|
+ executorService.shutdown();
|
|
|
}
|
|
|
- StringBuilder builder = new StringBuilder("");
|
|
|
- for (String fooAddress : addressSet) {
|
|
|
- String street = HouseUtils.getStreet(fooAddress);
|
|
|
- // 如果没有解析出地址,则跳过
|
|
|
- if (StringUtils.isEmpty(street)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 如果地址中已经包含,则跳过
|
|
|
- if (builder.indexOf(street) != -1) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 如果是当前门牌号包含了之前的地址,则直接替换。
|
|
|
- if (street.contains(builder.toString())) {
|
|
|
- builder.delete(0, builder.length());
|
|
|
- builder.append(",").append(street);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 追加
|
|
|
- builder.append(",").append(street);
|
|
|
- }
|
|
|
- if (builder.length() > 0) {
|
|
|
- String newAddress = builder.substring(1);
|
|
|
- vo.setAddress(newAddress);
|
|
|
- }
|
|
|
- return vo;
|
|
|
}
|
|
|
|
|
|
@Override
|