|
@@ -15,10 +15,13 @@ import com.leeroa.dydb.datasource.utils.HouseUtils;
|
|
|
import com.leeroa.dydb.price.domain.CommunityPrice;
|
|
|
import com.leeroa.dydb.price.domain.CommunityQuery;
|
|
|
import com.leeroa.dydb.utils.DoubleUtils;
|
|
|
+import com.leeroa.dydb.utils.amap.Address;
|
|
|
+import com.leeroa.dydb.utils.amap.AddressUtils;
|
|
|
import com.leeroa.dydb.zhaoshang.bo.QueryLogBo;
|
|
|
import com.leeroa.dydb.zhaoshang.dao.QueryLogDao;
|
|
|
import com.leeroa.dydb.zhaoshang.domain.QueryLog;
|
|
|
import com.leeroa.dydb.zhaoshang.service.QueryLogService;
|
|
|
+import com.leeroa.dydb.zhaoshang.utils.SignUtils;
|
|
|
import com.leeroa.dydb.zhaoshang.vo.QueryLogVo;
|
|
|
import com.michael.core.beans.BeanWrapBuilder;
|
|
|
import com.michael.core.beans.BeanWrapCallback;
|
|
@@ -247,10 +250,16 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
cq.setQueryTime(DateUtils.formatDatetime(now));
|
|
|
|
|
|
String address = ql.getAddress();
|
|
|
- String houseName = ql.getName();
|
|
|
+ String houseName = SignUtils.removeInvalidNumbers(ql.getName());
|
|
|
|
|
|
- // 获取城市,如果不是成都市的,则返回
|
|
|
- String cityName = HouseUtils.getCity(address);
|
|
|
+
|
|
|
+ String cityName = null;
|
|
|
+
|
|
|
+ if (address.contains("成都")){
|
|
|
+ cityName = "成都市";
|
|
|
+ }else {
|
|
|
+ cityName = AddressUtils.isInChengdu(address)?"成都市":null;
|
|
|
+ }
|
|
|
// if (cityName != null && !cityName.contains("成都")) {
|
|
|
// log.info("招商查询,非成都地区,直接返回:{}", address);
|
|
|
// cq.setStatus("N");
|
|
@@ -260,7 +269,10 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
|
|
|
// }
|
|
|
// 获取区县,如果不是成都市的,也返回
|
|
|
- String areaName = HouseUtils.getArea(address);
|
|
|
+// String areaName = HouseUtils.getArea(address);
|
|
|
+// if (StringUtils.isNotEmpty(areaName)){
|
|
|
+// areaName = areaName.substring(0,areaName.length()-1);
|
|
|
+// }
|
|
|
// if (StringUtils.isNotEmpty(areaName) && HouseUtils.AREA_OTHER.contains(areaName)) {
|
|
|
// log.info("招商查询,非成都地区,直接返回:{}", address);
|
|
|
// cq.setStatus("N");
|
|
@@ -316,6 +328,7 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
|
|
|
// 根据小区名称获取小区的数据
|
|
|
CommunityPrice communityPrice = null;
|
|
|
+
|
|
|
while (true) {
|
|
|
// communityPrice = (CommunityPrice) session.createCriteria(CommunityPrice.class)
|
|
|
// .add(Restrictions.eq("houses", houseName))
|
|
@@ -329,9 +342,9 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
if (StringUtils.isNotEmpty(cityName)){
|
|
|
criteria.add(Restrictions.eq("cityName",cityName));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(areaName)){
|
|
|
- criteria.add(Restrictions.eq("areaName",areaName));
|
|
|
- }
|
|
|
+// if (StringUtils.isNotEmpty(areaName)){
|
|
|
+// criteria.add(Restrictions.like("areaName",areaName,MatchMode.START));
|
|
|
+// }
|
|
|
criteria.addOrder(Order.desc("priceUpdateTime"));
|
|
|
criteria.setMaxResults(1);
|
|
|
communityPrice = (CommunityPrice) criteria.uniqueResult();
|
|
@@ -362,9 +375,9 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
if (StringUtils.isNotEmpty(cityName)){
|
|
|
criteria1.add(Restrictions.eq("cityName",cityName));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(areaName)){
|
|
|
- criteria1.add(Restrictions.eq("areaName",areaName));
|
|
|
- }
|
|
|
+// if (StringUtils.isNotEmpty(areaName)){
|
|
|
+// criteria1.add(Restrictions.eq("areaName",areaName));
|
|
|
+// }
|
|
|
criteria1.addOrder(Order.desc("priceUpdateTime"));
|
|
|
criteria1.setMaxResults(1);
|
|
|
communityPrice = (CommunityPrice) criteria1.uniqueResult();
|
|
@@ -457,15 +470,27 @@ public class QueryLogServiceImpl implements QueryLogService, BeanWrapCallback<Qu
|
|
|
// .addOrder(Order.desc("priceUpdateTime"))
|
|
|
// .setMaxResults(1)
|
|
|
// .uniqueResult();
|
|
|
-
|
|
|
+ Address add = AddressUtils.parseAddress(address);
|
|
|
+ StringBuffer addx = new StringBuffer();
|
|
|
+ if (StringUtils.isNotEmpty(add.getRoad())){
|
|
|
+ addx.append(add.getRoad());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(add.getRoadNumber())){
|
|
|
+ addx.append(add.getRoadNumber());
|
|
|
+ }
|
|
|
Criteria criteria = session.createCriteria(CommunityPrice.class);
|
|
|
- criteria.add(Restrictions.like("address", houseName,MatchMode.ANYWHERE));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(addx.toString())){
|
|
|
+ criteria.add(Restrictions.like("address", addx.toString(),MatchMode.ANYWHERE));
|
|
|
+ }else {
|
|
|
+ criteria.add(Restrictions.like("address", houseName,MatchMode.ANYWHERE));
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(cityName)){
|
|
|
criteria.add(Restrictions.eq("cityName",cityName));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(areaName)){
|
|
|
- criteria.add(Restrictions.eq("areaName",areaName));
|
|
|
- }
|
|
|
+// if (StringUtils.isNotEmpty(areaName)){
|
|
|
+// criteria.add(Restrictions.like("areaName",areaName,MatchMode.START));
|
|
|
+// }
|
|
|
criteria.addOrder(Order.desc("priceUpdateTime"));
|
|
|
criteria.setMaxResults(1);
|
|
|
communityPrice = (CommunityPrice) criteria.uniqueResult();
|