Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
@@ -21,6 +21,15 @@ spec:
|
||||
project: fangjia-open
|
||||
app: fangjia
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: NotIn
|
||||
values:
|
||||
- "sha-216"
|
||||
imagePullSecrets:
|
||||
- name: nexus-registry-secret
|
||||
containers:
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<constructor-arg value="${fangjia.seaweed.port}" />
|
||||
</bean>
|
||||
|
||||
<bean id="seawater" class="com.fangjia.datastore.driver.DataStore">
|
||||
<constructor-arg value="${fangjia.seawater.host}" />
|
||||
<constructor-arg value="${fangjia.seawater.port}" />
|
||||
</bean>
|
||||
<!-- <bean id="seawater" class="com.fangjia.datastore.driver.DataStore">-->
|
||||
<!-- <constructor-arg value="${fangjia.seawater.host}" />-->
|
||||
<!-- <constructor-arg value="${fangjia.seawater.port}" />-->
|
||||
<!-- </bean>-->
|
||||
|
||||
<bean id="abstractDataStoreDao" class="com.fangjia.dal.DatastoreDaoImpl"
|
||||
abstract="true">
|
||||
@@ -34,7 +34,6 @@
|
||||
</bean>
|
||||
|
||||
<bean id="abstractSeawaterDao" class="com.fangjia.dal.SeawaterDaoImpl" abstract="true">
|
||||
<property name="seawater" ref="seawater" />
|
||||
</bean>
|
||||
<!--
|
||||
<bean id="abstractAutoStoreDao" class="com.fangjia.dal.auto.AutoStoreDaoImpl" abstract="true">
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
public class AvmUrls {
|
||||
/**
|
||||
* 商铺出售评估及样例房源
|
||||
*/
|
||||
public static final String SHOPSELL_EVALUATE = "/avmWeb/shopSell";
|
||||
|
||||
|
||||
/**
|
||||
* 商铺出租评估及样例房源
|
||||
*/
|
||||
public static final String SHOPRENT_EVALUATE = "/avmWeb/shopRent";
|
||||
|
||||
}
|
||||
@@ -1036,6 +1036,7 @@ public class DataUtil {
|
||||
keyword = DataUtil.toDBCcase(keyword.replace(";", " "));
|
||||
keyword = keyword.replaceAll(SPACIAL_PATTERN, "");
|
||||
// keyword = QueryParser.escape(keyword.trim()).trim();
|
||||
keyword = keyword.replace("\"", "");
|
||||
keyword = keyword.trim();
|
||||
for (String reservedWord : new String[] { "AND", "OR" }) {
|
||||
if (keyword.contains(reservedWord)) {
|
||||
@@ -1875,7 +1876,24 @@ public class DataUtil {
|
||||
}
|
||||
|
||||
|
||||
public static int generateRandomNumber(String address) {
|
||||
// 使用地址的哈希值作为随机种子
|
||||
long seed = address.hashCode();
|
||||
Random random = new Random(seed);
|
||||
|
||||
// 生成一个初始随机数来决定范围
|
||||
int initialRandom = random.nextInt();
|
||||
|
||||
int result;
|
||||
if (initialRandom > 0) {
|
||||
// 生成2到10之间的随机数(包含2和10)
|
||||
result = random.nextInt(9) + 2; // nextInt(9) 生成 0-8,+2 后得到 2-10
|
||||
} else {
|
||||
// 生成-5到-2之间的随机数(包含-5和-2)
|
||||
result = random.nextInt(4) - 5; // nextInt(4) 生成 0-3,-5 后得到 -5到-2
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1556,8 +1556,17 @@ public class DateUtil {
|
||||
return c.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加日期的天数
|
||||
* 此方法用于给定一个日期后,增加指定数量的天数
|
||||
*
|
||||
* @param date 原始日期
|
||||
* @param amount 要增加的天数,正数表示未来日期,负数表示过去日期
|
||||
* @return 增加天数后的日期
|
||||
*/
|
||||
public static Date add(Date date,int amount){
|
||||
return add(date,Calendar.DATE,amount);
|
||||
// 调用另一个重载的add方法,将Calendar.DATE作为参数,表示按天数增加
|
||||
return add(date,Calendar.DATE,amount);
|
||||
}
|
||||
|
||||
public static String addMonth(Date date, int month){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -261,7 +262,9 @@ public class GeoUtils {
|
||||
|
||||
public static Map<String, String> parserByGaode(String city, String address) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", city);
|
||||
if(StringUtils.isNotBlank(city)){
|
||||
params.put("city", city);
|
||||
}
|
||||
params.put("address", address);
|
||||
String content;
|
||||
|
||||
@@ -319,6 +322,7 @@ public class GeoUtils {
|
||||
private static String getGaodeKey(String endpoint) {
|
||||
// 实现获取高德 API key 的逻辑
|
||||
return "8796b9dfb3889b57c38e2fff1b7e51bd";
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -78,4 +78,7 @@ public class MongoUtils {
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
public enum ThreadLocalKey {
|
||||
ServerArea, AnalyticsDetail, Ip, RequestUrl, DisableCache, RefererUrl, DaoExecuteCounter, FromSpider, UserId,FpkCity,FpkLat,FpkLng
|
||||
ServerArea, AnalyticsDetail, Ip, RequestUrl, DisableCache, RefererUrl, DaoExecuteCounter, FromSpider, UserId,FpkCity,FpkLat,FpkLng,RequestId,
|
||||
}
|
||||
|
||||
+31
-38
@@ -28,6 +28,9 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.service.datastore.*;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@@ -105,19 +108,6 @@ import com.fangjia.dal.mongo.fangjia.model.LoanLeads;
|
||||
import com.fangjia.dal.mongo.fangjia.model.LoanProduct;
|
||||
import com.fangjia.dal.mongo.fangjia.model.LoanProductTag;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.AddressMatchLog;
|
||||
import com.fangjia.dal.mongo.model.CityNewPrice;
|
||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.FangjiaCommonLog;
|
||||
import com.fangjia.dal.mongo.model.HouseLoudong;
|
||||
import com.fangjia.dal.mongo.model.HousePrice;
|
||||
import com.fangjia.dal.mongo.model.InputUserInfo;
|
||||
import com.fangjia.dal.mongo.model.IpCount;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.dal.mongo.model.SnapData;
|
||||
import com.fangjia.dal.mongo.model.ThirdIpCount;
|
||||
import com.fangjia.dal.mongo.model.bkoff.AdLog;
|
||||
import com.fangjia.dal.mongo.model.bkoff.Advertisement;
|
||||
import com.fangjia.dal.mongo.pds.model.AlgorithmRule;
|
||||
@@ -145,16 +135,6 @@ import com.fangjia.service.chart.generator.ChartGenerator;
|
||||
import com.fangjia.service.chart.ofc.bean.OfcStyleConfig;
|
||||
import com.fangjia.service.common.CookieName;
|
||||
import com.fangjia.service.cpc.CpcService;
|
||||
import com.fangjia.service.datastore.DistrictDto;
|
||||
import com.fangjia.service.datastore.DistrictSellStatService;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.datastore.IpCountService;
|
||||
import com.fangjia.service.datastore.RegionStatService;
|
||||
import com.fangjia.service.datastore.ReportDistrictInfoService;
|
||||
import com.fangjia.service.datastore.SchoolService;
|
||||
import com.fangjia.service.datastore.ThirdIpCountService;
|
||||
import com.fangjia.service.datastore.bean.DistrictQueryBean;
|
||||
import com.fangjia.service.datastore.bean.EvaluationBeforeLoanBean;
|
||||
import com.fangjia.service.datastore.bean.HousePicEnum;
|
||||
@@ -173,13 +153,6 @@ import com.fangjia.service.fangjia.LoanProductService;
|
||||
import com.fangjia.service.fangjia.LoanProductTagService;
|
||||
import com.fangjia.service.fsh.CityNewPriceService;
|
||||
import com.fangjia.service.menu.MenuCategoryEnum;
|
||||
import com.fangjia.service.mongo.fangjia.AddressMatchLogService;
|
||||
import com.fangjia.service.mongo.fangjia.CopyrightConfigService;
|
||||
import com.fangjia.service.mongo.fangjia.FangjiaCommonLogService;
|
||||
import com.fangjia.service.mongo.fangjia.InputUserInfoService;
|
||||
import com.fangjia.service.mongo.fangjia.MetroService;
|
||||
import com.fangjia.service.mongo.fangjia.ServerAreaService;
|
||||
import com.fangjia.service.mongo.fangjia.SnapDataService;
|
||||
import com.fangjia.service.news.NewsService;
|
||||
import com.fangjia.service.pds.AlgorithmRuleService;
|
||||
import com.fangjia.service.pds.DistrictHouseNumberService;
|
||||
@@ -212,6 +185,8 @@ public class EvaluationController {
|
||||
private SnapDataService snapDataService;
|
||||
private HouseService houseService;
|
||||
private RegionStatService regionStatService;
|
||||
private CitySellStatService citySellStatService;
|
||||
private RegionSellStatService regionSellStatService;
|
||||
private MenuService menuService;
|
||||
private CpcService cpcService;
|
||||
private DistrictStatRentService districtStatRentService;
|
||||
@@ -3626,23 +3601,34 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
|
||||
|
||||
private Map<String,Integer> buildStatJson(String city, String region, String block, Date startDate) {
|
||||
List<RegionStat> regionStatList = null;
|
||||
List<CitySellStat> citySellStats = null;
|
||||
List<RegionSellStat> regionSellStats = null;
|
||||
Map<String, String> oprions = new HashMap<String, String>();
|
||||
Date currentDate = new Date();
|
||||
if (city != null && region != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, region, null, startDate, currentDate);
|
||||
regionSellStats = regionSellStatService.findRegionSellStat(city, region, Integer.parseInt(DateUtil.formatByPattern(startDate, "yyyyMM")), Integer.parseInt(DateUtil.formatByPattern(currentDate, "yyyyMM")));
|
||||
oprions.put("name", region);
|
||||
} else if (city != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, null, null, startDate, currentDate);
|
||||
citySellStats = citySellStatService.findCitySellStat(city, Integer.parseInt(DateUtil.formatByPattern(startDate, "yyyyMM")), Integer.parseInt(DateUtil.formatByPattern(currentDate, "yyyyMM")));
|
||||
oprions.put("name", city);
|
||||
}
|
||||
|
||||
if (regionStatList == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM");
|
||||
for (RegionStat re : regionStatList) {
|
||||
map.put(format.format(DateUtil.getBeforeDay(re.getWeekend(), -1)),re.getAvgPrice());
|
||||
if (CollectionUtils.isNotEmpty(regionStatList)) {
|
||||
for (RegionStat re : regionStatList) {
|
||||
map.put(format.format(DateUtil.getBeforeDay(re.getWeekend(), -1)), re.getAvgPrice());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(citySellStats)) {
|
||||
for (CitySellStat re : citySellStats) {
|
||||
map.put(re.getDate().toString().substring(0, 4) + "." + re.getDate().toString().substring(4, 6), re.getAvgPrice());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(regionSellStats)) {
|
||||
for (RegionSellStat re : regionSellStats) {
|
||||
map.put(re.getDate().toString().substring(0, 4) + "." + re.getDate().toString().substring(4, 6), re.getAvgPrice());
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -4749,5 +4735,12 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
|
||||
public void setIpCountService(IpCountService ipCountService) {
|
||||
this.ipCountService = ipCountService;
|
||||
}
|
||||
|
||||
|
||||
public void setCitySellStatService(CitySellStatService citySellStatService) {
|
||||
this.citySellStatService = citySellStatService;
|
||||
}
|
||||
|
||||
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
|
||||
this.regionSellStatService = regionSellStatService;
|
||||
}
|
||||
}
|
||||
|
||||
+135
-29
@@ -14,8 +14,12 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fangjia.core.City;
|
||||
import com.fangjia.coresite.model.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.service.bo.*;
|
||||
import com.fangjia.service.datastore.*;
|
||||
import com.fangjia.service.mongo.fangjia.RegionSellStatService;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@@ -39,21 +43,9 @@ import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
||||
import com.fangjia.dal.datastore.model.News;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.CityTradeStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictNewPrice;
|
||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictTradeStat;
|
||||
import com.fangjia.dal.mongo.model.RegionBlock;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.service.datastore.DistrictSellStatService;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.datastore.RegionStatService;
|
||||
import com.fangjia.service.datastore.bean.HousePicEnum;
|
||||
import com.fangjia.service.datastore.bean.HouseQueryBean;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.district.TradeStatService;
|
||||
import com.fangjia.service.fsh.DistrictNewPriceService;
|
||||
@@ -82,6 +74,9 @@ public class TrendController {
|
||||
private static int QUARTER_WEEK = 13;
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(TrendController.class);
|
||||
|
||||
private CitySellStatService citySellStatService;
|
||||
private RegionSellStatService regionSellStatService;
|
||||
|
||||
public Object trendChartAction(TrendModel model, HttpServletRequest request) {
|
||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||
if (trendView != null) {
|
||||
@@ -171,7 +166,9 @@ public class TrendController {
|
||||
|
||||
model.setRegionItems(getRegionItems(model));
|
||||
model.setBlockItems(getRegionBlocks(model));
|
||||
model.setCityStatInfoBos(findCitysAvgPrice(10));
|
||||
|
||||
List<CitySellStat> citySellStats = citySellStatService.getAllWithCurrMonths(city, 2);
|
||||
model.setCityStatInfoBos(findCitysAvgPricePlus(city,citySellStats.get(0).getDate(), 10));
|
||||
model.setDefaultCityName(city);
|
||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||
if (trendView == null) {
|
||||
@@ -182,15 +179,15 @@ public class TrendController {
|
||||
//DistrictStatBo statBo = getDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||
DistrictStatBo statBo = getNearestDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||
model.setDistrictStatBo(statBo);
|
||||
} else if (trendView.getType().equals(ViewType.region) || trendView.getType().equals(ViewType.block)) {
|
||||
} else if (trendView.getType().equals(ViewType.region)) {
|
||||
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
||||
RegionStatBo regionStat = getNearestRegionStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
||||
model.setRegionStatBo(regionStat);
|
||||
RegionSellStatBo regionSellStatBo = getNearestRegionSellStat(trendView.getCityName(), trendView.getRegion());
|
||||
model.setRegionSellStatBo(regionSellStatBo);
|
||||
model.setRegion(trendView.getRegion());
|
||||
} else if (trendView.getType().equals(ViewType.city)) {
|
||||
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), null, null);
|
||||
RegionStatBo regionStat = getNearestRegionStat(trendView.getCityName(), null, null);
|
||||
model.setRegionStatBo(regionStat);
|
||||
CitySellStatBo citySellStat = getNearestCitySellStat(trendView.getCityName());
|
||||
model.setCitySellStatBo(citySellStat);
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +272,30 @@ public class TrendController {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
private List<CityStatInfoBo> findCitysAvgPricePlus(String city, Integer startDate, int limit){
|
||||
List<CityStatInfoBo> cityStatInfoBos = new ArrayList<CityStatInfoBo>();
|
||||
List<CitySellStat> citySellStats = citySellStatService.findCityOrderByAvgPrice(null, startDate, limit);
|
||||
for(int i=0;i<citySellStats.size();i++){
|
||||
|
||||
CitySellStat regionStat = citySellStats.get(i);
|
||||
|
||||
CityStatInfoBo cityStatInfoBo = new CityStatInfoBo();
|
||||
|
||||
String cityName = regionStat.getCity();
|
||||
int avg_price = regionStat.getAvgPrice();
|
||||
|
||||
cityStatInfoBo.setSeq(i+1);
|
||||
cityStatInfoBo.setCity(cityName);
|
||||
cityStatInfoBo.setAvgPrice(regionStat.getAvgPrice());
|
||||
cityStatInfoBo.setHuanBi((int) (regionStat.getMom()*10000));
|
||||
cityStatInfoBo.setTongBi((int) (regionStat.getYoy()*10000));
|
||||
cityStatInfoBos.add(cityStatInfoBo);
|
||||
}
|
||||
return cityStatInfoBos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ³ÇÊз¿¼ÛÅÅÐÐ
|
||||
*/
|
||||
@@ -676,31 +697,51 @@ public class TrendController {
|
||||
|
||||
private List<JSONObject> buildStatJson(String city, String region, String block, int weeks) {
|
||||
List<RegionStat> regionStatList = null;
|
||||
List<CitySellStat> citySellStatList = null;
|
||||
List<RegionSellStat> regionSellStatList = null;
|
||||
Map<String, String> oprions = new HashMap<String, String>();
|
||||
Date currentDate = new Date();
|
||||
if (city != null && region != null && block != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, region, block, currentDate, weeks);
|
||||
oprions.put("name", block + "°å¿é");
|
||||
} else if (city != null && region != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, region, null, currentDate, weeks);
|
||||
//regionStatList = regionStatService.findRegionStat(city, region, null, currentDate, weeks);
|
||||
int month = weeks / 4;
|
||||
regionSellStatList = regionSellStatService.getAllWithCurrMonths(city, region, month);
|
||||
oprions.put("name", region);
|
||||
} else if (city != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, null, null, currentDate, weeks);
|
||||
//regionStatList = regionStatService.findRegionStat(city, null, null, currentDate, weeks);
|
||||
int month = weeks / 4;
|
||||
citySellStatList = citySellStatService.getAllWithCurrMonths(city, month);
|
||||
oprions.put("name", city);
|
||||
}
|
||||
|
||||
List<JSONObject> ret = new ArrayList<JSONObject>();
|
||||
if (regionStatList == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
JSONArray splineJa = new JSONArray();
|
||||
|
||||
for (RegionStat re : regionStatList) {
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(DateUtil.getBeforeDay(re.getWeekend(), -1).getTime());
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
if (CollectionUtils.isNotEmpty(regionStatList)) {
|
||||
for (RegionStat re : regionStatList) {
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(DateUtil.getBeforeDay(re.getWeekend(), -1).getTime());
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
}
|
||||
} else if (CollectionUtils.isNotEmpty(citySellStatList)) {
|
||||
for (int i = citySellStatList.size() - 1; i >= 0; i--) {
|
||||
CitySellStat re = citySellStatList.get(i);
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(DateUtil.getBeforeDay(DateUtil.parseDate(re.getDate().toString(), "yyyyMM"), -1).getTime());
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
}
|
||||
} else if (CollectionUtils.isNotEmpty(regionSellStatList)) {
|
||||
for (int i = regionSellStatList.size() - 1; i >= 0; i--) {
|
||||
RegionSellStat re = regionSellStatList.get(i);
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(DateUtil.getBeforeDay(DateUtil.parseDate(re.getDate().toString(), "yyyyMM"), -1).getTime());
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
}
|
||||
}
|
||||
|
||||
if (splineJa.length() > 0) {
|
||||
@@ -826,6 +867,64 @@ public class TrendController {
|
||||
seriesOptions.addAll(data);
|
||||
}
|
||||
}
|
||||
private CitySellStatBo getNearestCitySellStat(String city) {
|
||||
CitySellStatBo ret = null;
|
||||
List<CitySellStat> citySellStats = null;
|
||||
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtils.addMonths(new Date(), -3), "yyyyMM"));
|
||||
citySellStats = citySellStatService.findNearCityStat(city, startDate, 2);
|
||||
if(citySellStats!=null && citySellStats.size()>0){
|
||||
CitySellStatBo bo = new CitySellStatBo();
|
||||
if(citySellStats.size()==2){
|
||||
bo.setAvgPrice(citySellStats.get(0).getAvgPrice());
|
||||
bo.setLastTimeAvgPrice(citySellStats.get(1).getAvgPrice());
|
||||
int monthMarkup = (citySellStats.get(0).getAvgPrice()-citySellStats.get(1).getAvgPrice())*10000/citySellStats.get(1).getAvgPrice();
|
||||
bo.setMonthMarkup(monthMarkup);
|
||||
|
||||
}else{
|
||||
bo.setAvgPrice(citySellStats.get(0).getAvgPrice());
|
||||
}
|
||||
|
||||
CitySellStat rs = citySellStatService.findStartStat(city);
|
||||
if(rs!=null){
|
||||
bo.setStartDate(rs.getDate() / 100);
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* ÇøÓò¾ù¼Û
|
||||
*
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
private RegionSellStatBo getNearestRegionSellStat(String city, String region) {
|
||||
RegionSellStatBo ret = null;
|
||||
List<RegionSellStat> regionSellStats = null;
|
||||
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtils.addMonths(new Date(), -3), "yyyyMM"));
|
||||
regionSellStats = regionSellStatService.findNearCityStat(city, region, startDate, 2);
|
||||
if(regionSellStats!=null && regionSellStats.size()>0){
|
||||
RegionSellStatBo bo = new RegionSellStatBo();
|
||||
if(regionSellStats.size()==2){
|
||||
bo.setAvgPrice(regionSellStats.get(0).getAvgPrice());
|
||||
bo.setLastTimeAvgPrice(regionSellStats.get(1).getAvgPrice());
|
||||
int monthMarkup = (regionSellStats.get(0).getAvgPrice()-regionSellStats.get(1).getAvgPrice())*10000/regionSellStats.get(1).getAvgPrice();
|
||||
bo.setMonthMarkup(monthMarkup);
|
||||
|
||||
}else{
|
||||
bo.setAvgPrice(regionSellStats.get(0).getAvgPrice());
|
||||
}
|
||||
|
||||
RegionSellStat rs = regionSellStatService.findStartStat(city, region);
|
||||
if(rs!=null){
|
||||
bo.setStartDate(rs.getDate() / 100);
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private RegionStatBo getNearestRegionStat(String city, String region, String block){
|
||||
RegionStatBo ret = null;
|
||||
@@ -1284,4 +1383,11 @@ public class TrendController {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
|
||||
public void setCitySellStatService(CitySellStatService citySellStatService) {
|
||||
this.citySellStatService = citySellStatService;
|
||||
}
|
||||
|
||||
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
|
||||
this.regionSellStatService = regionSellStatService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
private String trendDesc;
|
||||
private DistrictStatBo districtStatBo;
|
||||
private RegionStatBo regionStatBo;
|
||||
private CitySellStatBo citySellStatBo;
|
||||
private RegionSellStatBo regionSellStatBo;
|
||||
private String affectKeyword;
|
||||
private int chartWidth;
|
||||
private int chartHeight;
|
||||
@@ -330,4 +332,20 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
public void setCityStatInfoBos(List<CityStatInfoBo> cityStatInfoBos) {
|
||||
this.cityStatInfoBos = cityStatInfoBos;
|
||||
}
|
||||
|
||||
public CitySellStatBo getCitySellStatBo() {
|
||||
return citySellStatBo;
|
||||
}
|
||||
|
||||
public void setCitySellStatBo(CitySellStatBo citySellStatBo) {
|
||||
this.citySellStatBo = citySellStatBo;
|
||||
}
|
||||
|
||||
public RegionSellStatBo getRegionSellStatBo() {
|
||||
return regionSellStatBo;
|
||||
}
|
||||
|
||||
public void setRegionSellStatBo(RegionSellStatBo regionSellStatBo) {
|
||||
this.regionSellStatBo = regionSellStatBo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,21 +104,34 @@
|
||||
|
||||
|
||||
<div class="trend trend01">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<div class="trend01a">
|
||||
<div class="herder"><p><span class="text_56">${affectValue}房产</span>均价走势</p></div>
|
||||
<p><small><#if districtStatBo??>${districtStatBo.startYear!}<#else><#if regionStatBo?? && regionStatBo.startDate??>${regionStatBo.startDate?string('yyyy')}</#if></#if>-${.now?string('yyyy')} | 周度 | 元/㎡ | 数据来源:房价网</small></p>
|
||||
<p>
|
||||
<small><#if districtStatBo??>${districtStatBo.startYear!}
|
||||
<#elseif citySellStatBo?? && citySellStatBo.startDate??>${citySellStatBo.startDate}
|
||||
<#elseif regionSellStatBo?? && regionSellStatBo.startDate??>${regionSellStatBo.startDate}
|
||||
</#if>
|
||||
-${.now?string('yyyy')} | 周度 | 元/㎡ | 数据来源:房价网</small></p>
|
||||
<p class="mobile01 description">${descWord}</p>
|
||||
</div>
|
||||
</#if>
|
||||
|
||||
<div class="trend01b">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
|
||||
<#if districtStatBo??>
|
||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
||||
<div><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
<#elseif citySellStatBo??>
|
||||
<div><em>${citySellStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em>${citySellStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if citySellStatBo.monthMarkup gte 0>up<#else>down</#if>"><i></i>${(citySellStatBo.monthMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
<#elseif regionSellStatBo??>
|
||||
<div><em>${regionSellStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em>${regionSellStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if regionSellStatBo.monthMarkup gte 0>up<#else>down</#if>"><i></i>${(regionSellStatBo.monthMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
<#elseif regionStatBo??>
|
||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
||||
@@ -145,21 +158,21 @@
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<#if blockItems?? && blockItems?size gt 0>
|
||||
<span><a><#if block??>${block!}<#else>板块</#if></a><i></i>
|
||||
<div class="noteText dn" id="blockDiv">
|
||||
<font></font>
|
||||
<a <#if !(block??)>class="cur"</#if> href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${region!}" /><@d_param name="block" value="" /><@d_param name="type" value="${type!}" /></@d_url>">不限</a>
|
||||
<#list blockItems as item>
|
||||
<a href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${item.name!}" /><@d_param name="type" value="${type!}" /></@d_url>" title="最新${item.caption}房价走势">${item.caption}</a>
|
||||
</#list>
|
||||
</div>
|
||||
</span>
|
||||
</#if>
|
||||
<#-- <#if blockItems?? && blockItems?size gt 0>-->
|
||||
<#-- <span><a><#if block??>${block!}<#else>板块</#if></a><i></i>-->
|
||||
<#-- <div class="noteText dn" id="blockDiv">-->
|
||||
<#-- <font></font>-->
|
||||
<#-- <a <#if !(block??)>class="cur"</#if> href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${region!}" /><@d_param name="block" value="" /><@d_param name="type" value="${type!}" /></@d_url>">不限</a>-->
|
||||
<#-- <#list blockItems as item>-->
|
||||
<#-- <a href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${item.name!}" /><@d_param name="type" value="${type!}" /></@d_url>" title="最新${item.caption}房价走势">${item.caption}</a>-->
|
||||
<#-- </#list>-->
|
||||
<#-- </div>-->
|
||||
<#-- </span>-->
|
||||
<#-- </#if>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="trend_content">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<ul class="chartTools01">
|
||||
<li><a id="exportButton">下载</a></li>
|
||||
<li><a id="printButton">打印</a></li>
|
||||
@@ -181,7 +194,7 @@
|
||||
</#if>
|
||||
<div class="chart" style="padding:20px;">
|
||||
<div id="container">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<img class="loading" src="${staticUrl}/images/bgtu/fangjia/trend-loading.gif?v=${version}">
|
||||
<#else>
|
||||
<div class="nofound">
|
||||
@@ -478,7 +491,7 @@
|
||||
var down_pic_temp = 0;
|
||||
$(document).ready(function(){
|
||||
//走势图
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<#if type??>
|
||||
<#if type == '4' || type == 'quarter'>
|
||||
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}®ion=${region!}&block=${block!}&keyword=${keyword!}';
|
||||
|
||||
@@ -103,12 +103,12 @@
|
||||
<div class="trend01b">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo??>
|
||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
<#elseif regionStatBo??>
|
||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em>${regionStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if regionStatBo.weekendMarkup gte 0>up<#else>down</#if>"><i></i>${(regionStatBo.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
@@ -110,8 +110,8 @@ public abstract class SeawaterDaoImpl<E extends SeawaterEntity> extends Abstract
|
||||
}
|
||||
}
|
||||
|
||||
public void setSeawater(DataStore seawater) {
|
||||
this.seawater = seawater;
|
||||
}
|
||||
// public void setSeawater(DataStore seawater) {
|
||||
// this.seawater = seawater;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
public class SeawaterQuery {
|
||||
|
||||
private String id;
|
||||
private List<String> ids;
|
||||
private String cat;
|
||||
private String region;
|
||||
private String districtName;
|
||||
@@ -38,6 +39,7 @@ public class SeawaterQuery {
|
||||
|
||||
private Integer radius;
|
||||
private String level;
|
||||
private List<String> tags;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@@ -278,4 +280,20 @@ public class SeawaterQuery {
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,16 @@ package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hubingliang on 2016/12/8.
|
||||
*/
|
||||
public interface CitySellStatDao extends MongoDao<CitySellStat> {
|
||||
|
||||
List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hubingliang on 2016/12/8.
|
||||
*/
|
||||
public class CitySellStatDaoImpl extends MongoDaoImpl<CitySellStat> implements CitySellStatDao {
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
|
||||
if (startDate!=null) {
|
||||
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
List<SortParam> sortParms = new ArrayList<SortParam>(1);
|
||||
sortParms.add(new SortParam("date", true));
|
||||
List<CitySellStat> statList = findAllByParams(params, sortParms);
|
||||
return statList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.CommunityRate;
|
||||
|
||||
public interface CommunityRateDao extends MongoDao<CommunityRate> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.CommunityRate;
|
||||
|
||||
public class CommunityRateDaoImpl extends MongoDaoImpl<CommunityRate> implements CommunityRateDao{
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RegionSellStatDao extends MongoDao<RegionSellStat> {
|
||||
|
||||
List<RegionSellStat> findRegionSellStat(String city, String region, Integer startDate, Integer endDate);
|
||||
|
||||
}
|
||||
|
||||
+22
@@ -1,9 +1,31 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RegionSellStatDaoImpl extends MongoDaoImpl<RegionSellStat>
|
||||
implements RegionSellStatDao {
|
||||
|
||||
@Override
|
||||
public List<RegionSellStat> findRegionSellStat(String city, String region, Integer startDate, Integer endDate) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("region", region));
|
||||
params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
|
||||
if (startDate!=null) {
|
||||
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
List<SortParam> sortParms = new ArrayList<SortParam>(1);
|
||||
sortParms.add(new SortParam("date", true));
|
||||
List<RegionSellStat> statList = findAllByParams(params, sortParms);
|
||||
return statList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao.shop;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.ShopRentStat;
|
||||
|
||||
public interface ShopRentStatDao extends MongoDao<ShopRentStat> {
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.dal.mongo.dao.shop;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.ShopRentStat;
|
||||
|
||||
public class ShopRentStatDaoImpl extends MongoDaoImpl<ShopRentStat> implements ShopRentStatDao {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao.shop;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.ShopSellStat;
|
||||
|
||||
public interface ShopSellStatDao extends MongoDao<ShopSellStat> {
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.dal.mongo.dao.shop;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.ShopSellStat;
|
||||
|
||||
public class ShopSellStatDaoImpl extends MongoDaoImpl<ShopSellStat> implements ShopSellStatDao {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,990 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia_stat.community_rate")
|
||||
public class CommunityRate implements MongoEntity {
|
||||
|
||||
private static final long serialVersionUID = 8312754864385108472L;
|
||||
private String id;
|
||||
private String commId;
|
||||
private String city;
|
||||
private String region;
|
||||
private String regionRating;
|
||||
private String name;
|
||||
private String block;
|
||||
private String blockRating;
|
||||
private String address;
|
||||
private Integer avgPrice;
|
||||
private Double sqmetreRent;
|
||||
private Double yoy;
|
||||
private Double rentToPriceRatio;
|
||||
private Integer halfOnYearSellNum;
|
||||
private Double totalScore;
|
||||
private Double communityQualityScore;
|
||||
private Double communityPriceScore;
|
||||
private Double locationAdvantageScore;
|
||||
private Double flowabilityScore;
|
||||
private Double livingFacilitiesScore;
|
||||
private Double educationScore;
|
||||
private Double hospitalScore;
|
||||
private String rating;
|
||||
private String communityQualityRating;
|
||||
private String communityPriceRating;
|
||||
private String locationAdvantageRating;
|
||||
private String flowabilityRating;
|
||||
private String livingFacilitiesRating;
|
||||
private String educationRating;
|
||||
private String hospitalRating;
|
||||
private Integer supermarketNum;
|
||||
private Integer parkNum;
|
||||
private Integer cateringNum;
|
||||
private Integer mallNum;
|
||||
private Integer kindergartenNum;
|
||||
private Integer keyPrimarySchoolNum;
|
||||
private Integer ordinaryPrimarySchoolNum;
|
||||
private Integer keyMiddleSchoolNum;
|
||||
private Integer ordinaryMiddleSchoolNum;
|
||||
private Integer topThreeHospitalNum;
|
||||
private Integer non3aHospitalNum;
|
||||
private Integer buildYear;
|
||||
private Double cubagePercent;
|
||||
private Double virescencePercent;
|
||||
private Double estateCharge;
|
||||
private String estateType;
|
||||
private Integer cityRank;
|
||||
private Integer cityTotalRank;
|
||||
private Integer regionRank;
|
||||
private Integer regionTotalRank;
|
||||
private Integer blockTotalRank;
|
||||
private Integer blockRank;
|
||||
private Integer cityCommunityQualityRank;
|
||||
private Integer cityCommunityQualityTotalRank;
|
||||
private Integer regionCommunityQualityRank;
|
||||
private Integer regionCommunityQualityTotalRank;
|
||||
private Integer blockCommunityQualityTotalRank;
|
||||
private Integer blockCommunityQualityRank;
|
||||
private Integer cityCommunityPriceRank;
|
||||
private Integer cityCommunityPriceTotalRank;
|
||||
private Integer regionCommunityPriceRank;
|
||||
private Integer regionCommunityPriceTotalRank;
|
||||
private Integer blockCommunityPriceTotalRank;
|
||||
private Integer blockCommunityPriceRank;
|
||||
private Integer cityLocationAdvantageRank;
|
||||
private Integer cityLocationAdvantageTotalRank;
|
||||
private Integer regionLocationAdvantageRank;
|
||||
private Integer regionLocationAdvantageTotalRank;
|
||||
private Integer blockLocationAdvantageTotalRank;
|
||||
private Integer blockLocationAdvantageRank;
|
||||
private Integer cityFlowabilityRank;
|
||||
private Integer cityFlowabilityTotalRank;
|
||||
private Integer regionFlowabilityRank;
|
||||
private Integer regionFlowabilityTotalRank;
|
||||
private Integer blockFlowabilityTotalRank;
|
||||
private Integer blockFlowabilityRank;
|
||||
private Integer cityLivingFacilitiesRank;
|
||||
private Integer cityLivingFacilitiesTotalRank;
|
||||
private Integer regionLivingFacilitiesRank;
|
||||
private Integer regionLivingFacilitiesTotalRank;
|
||||
private Integer blockLivingFacilitiesTotalRank;
|
||||
private Integer blockLivingFacilitiesRank;
|
||||
private Integer cityEducationRank;
|
||||
private Integer cityEducationTotalRank;
|
||||
private Integer regionEducationRank;
|
||||
private Integer regionEducationTotalRank;
|
||||
private Integer blockEducationTotalRank;
|
||||
private Integer blockEducationRank;
|
||||
private Integer cityHospitalRank;
|
||||
private Integer cityHospitalTotalRank;
|
||||
private Integer regionHospitalRank;
|
||||
private Integer regionHospitalTotalRank;
|
||||
private Integer blockHospitalTotalRank;
|
||||
private Integer blockHospitalRank;
|
||||
private Date mDate;
|
||||
private Date cDate;
|
||||
private Integer resistanceCoef;
|
||||
|
||||
// Getter and Setter ����
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "comm_id")
|
||||
public String getCommId() {
|
||||
return commId;
|
||||
}
|
||||
|
||||
public void setCommId(String commId) {
|
||||
this.commId = commId;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "region")
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
@Column(name = "region_rating")
|
||||
public String getRegionRating() {
|
||||
return regionRating;
|
||||
}
|
||||
|
||||
public void setRegionRating(String regionRating) {
|
||||
this.regionRating = regionRating;
|
||||
}
|
||||
|
||||
@Column(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "block")
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Column(name = "block_rating")
|
||||
public String getBlockRating() {
|
||||
return blockRating;
|
||||
}
|
||||
|
||||
public void setBlockRating(String blockRating) {
|
||||
this.blockRating = blockRating;
|
||||
}
|
||||
|
||||
@Column(name = "address")
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Column(name = "avg_price")
|
||||
public Integer getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
@Column(name = "sqmetre_rent")
|
||||
public Double getSqmetreRent() {
|
||||
return sqmetreRent;
|
||||
}
|
||||
|
||||
public void setSqmetreRent(Double sqmetreRent) {
|
||||
this.sqmetreRent = sqmetreRent;
|
||||
}
|
||||
|
||||
@Column(name = "yoy")
|
||||
public Double getYoy() {
|
||||
return yoy;
|
||||
}
|
||||
|
||||
public void setYoy(Double yoy) {
|
||||
this.yoy = yoy;
|
||||
}
|
||||
|
||||
@Column(name = "rent_to_price_ratio")
|
||||
public Double getRentToPriceRatio() {
|
||||
return rentToPriceRatio;
|
||||
}
|
||||
|
||||
public void setRentToPriceRatio(Double rentToPriceRatio) {
|
||||
this.rentToPriceRatio = rentToPriceRatio;
|
||||
}
|
||||
|
||||
@Column(name = "half_on_year_sell_num")
|
||||
public Integer getHalfOnYearSellNum() {
|
||||
return halfOnYearSellNum;
|
||||
}
|
||||
|
||||
public void setHalfOnYearSellNum(Integer halfOnYearSellNum) {
|
||||
this.halfOnYearSellNum = halfOnYearSellNum;
|
||||
}
|
||||
|
||||
@Column(name = "total_score")
|
||||
public Double getTotalScore() {
|
||||
return totalScore;
|
||||
}
|
||||
|
||||
public void setTotalScore(Double totalScore) {
|
||||
this.totalScore = totalScore;
|
||||
}
|
||||
|
||||
@Column(name = "community_quality_score")
|
||||
public Double getCommunityQualityScore() {
|
||||
return communityQualityScore;
|
||||
}
|
||||
|
||||
public void setCommunityQualityScore(Double communityQualityScore) {
|
||||
this.communityQualityScore = communityQualityScore;
|
||||
}
|
||||
|
||||
@Column(name = "community_price_score")
|
||||
public Double getCommunityPriceScore() {
|
||||
return communityPriceScore;
|
||||
}
|
||||
|
||||
public void setCommunityPriceScore(Double communityPriceScore) {
|
||||
this.communityPriceScore = communityPriceScore;
|
||||
}
|
||||
|
||||
@Column(name = "location_advantage_score")
|
||||
public Double getLocationAdvantageScore() {
|
||||
return locationAdvantageScore;
|
||||
}
|
||||
|
||||
public void setLocationAdvantageScore(Double locationAdvantageScore) {
|
||||
this.locationAdvantageScore = locationAdvantageScore;
|
||||
}
|
||||
|
||||
@Column(name = "flowability_score")
|
||||
public Double getFlowabilityScore() {
|
||||
return flowabilityScore;
|
||||
}
|
||||
|
||||
public void setFlowabilityScore(Double flowabilityScore) {
|
||||
this.flowabilityScore = flowabilityScore;
|
||||
}
|
||||
|
||||
@Column(name = "living_facilities_score")
|
||||
public Double getLivingFacilitiesScore() {
|
||||
return livingFacilitiesScore;
|
||||
}
|
||||
|
||||
public void setLivingFacilitiesScore(Double livingFacilitiesScore) {
|
||||
this.livingFacilitiesScore = livingFacilitiesScore;
|
||||
}
|
||||
|
||||
@Column(name = "education_score")
|
||||
public Double getEducationScore() {
|
||||
return educationScore;
|
||||
}
|
||||
|
||||
public void setEducationScore(Double educationScore) {
|
||||
this.educationScore = educationScore;
|
||||
}
|
||||
|
||||
@Column(name = "hospital_score")
|
||||
public Double getHospitalScore() {
|
||||
return hospitalScore;
|
||||
}
|
||||
|
||||
public void setHospitalScore(Double hospitalScore) {
|
||||
this.hospitalScore = hospitalScore;
|
||||
}
|
||||
|
||||
@Column(name = "rating")
|
||||
public String getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(String rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
@Column(name = "community_quality_rating")
|
||||
public String getCommunityQualityRating() {
|
||||
return communityQualityRating;
|
||||
}
|
||||
|
||||
public void setCommunityQualityRating(String communityQualityRating) {
|
||||
this.communityQualityRating = communityQualityRating;
|
||||
}
|
||||
|
||||
@Column(name = "community_price_rating")
|
||||
public String getCommunityPriceRating() {
|
||||
return communityPriceRating;
|
||||
}
|
||||
|
||||
public void setCommunityPriceRating(String communityPriceRating) {
|
||||
this.communityPriceRating = communityPriceRating;
|
||||
}
|
||||
|
||||
@Column(name = "location_advantage_rating")
|
||||
public String getLocationAdvantageRating() {
|
||||
return locationAdvantageRating;
|
||||
}
|
||||
|
||||
public void setLocationAdvantageRating(String locationAdvantageRating) {
|
||||
this.locationAdvantageRating = locationAdvantageRating;
|
||||
}
|
||||
|
||||
@Column(name = "flowability_rating")
|
||||
public String getFlowabilityRating() {
|
||||
return flowabilityRating;
|
||||
}
|
||||
|
||||
public void setFlowabilityRating(String flowabilityRating) {
|
||||
this.flowabilityRating = flowabilityRating;
|
||||
}
|
||||
|
||||
@Column(name = "living_facilities_rating")
|
||||
public String getLivingFacilitiesRating() {
|
||||
return livingFacilitiesRating;
|
||||
}
|
||||
|
||||
public void setLivingFacilitiesRating(String livingFacilitiesRating) {
|
||||
this.livingFacilitiesRating = livingFacilitiesRating;
|
||||
}
|
||||
|
||||
@Column(name = "education_rating")
|
||||
public String getEducationRating() {
|
||||
return educationRating;
|
||||
}
|
||||
|
||||
public void setEducationRating(String educationRating) {
|
||||
this.educationRating = educationRating;
|
||||
}
|
||||
|
||||
@Column(name = "hospital_rating")
|
||||
public String getHospitalRating() {
|
||||
return hospitalRating;
|
||||
}
|
||||
|
||||
public void setHospitalRating(String hospitalRating) {
|
||||
this.hospitalRating = hospitalRating;
|
||||
}
|
||||
|
||||
@Column(name = "supermarket_num")
|
||||
public Integer getSupermarketNum() {
|
||||
return supermarketNum;
|
||||
}
|
||||
|
||||
public void setSupermarketNum(Integer supermarketNum) {
|
||||
this.supermarketNum = supermarketNum;
|
||||
}
|
||||
|
||||
@Column(name = "park_num")
|
||||
public Integer getParkNum() {
|
||||
return parkNum;
|
||||
}
|
||||
|
||||
public void setParkNum(Integer parkNum) {
|
||||
this.parkNum = parkNum;
|
||||
}
|
||||
|
||||
@Column(name = "catering_num")
|
||||
public Integer getCateringNum() {
|
||||
return cateringNum;
|
||||
}
|
||||
|
||||
public void setCateringNum(Integer cateringNum) {
|
||||
this.cateringNum = cateringNum;
|
||||
}
|
||||
|
||||
@Column(name = "mall_num")
|
||||
public Integer getMallNum() {
|
||||
return mallNum;
|
||||
}
|
||||
|
||||
public void setMallNum(Integer mallNum) {
|
||||
this.mallNum = mallNum;
|
||||
}
|
||||
|
||||
@Column(name = "kindergarten_num")
|
||||
public Integer getKindergartenNum() {
|
||||
return kindergartenNum;
|
||||
}
|
||||
|
||||
public void setKindergartenNum(Integer kindergartenNum) {
|
||||
this.kindergartenNum = kindergartenNum;
|
||||
}
|
||||
|
||||
@Column(name = "key_primary_school_num")
|
||||
public Integer getKeyPrimarySchoolNum() {
|
||||
return keyPrimarySchoolNum;
|
||||
}
|
||||
|
||||
public void setKeyPrimarySchoolNum(Integer keyPrimarySchoolNum) {
|
||||
this.keyPrimarySchoolNum = keyPrimarySchoolNum;
|
||||
}
|
||||
|
||||
@Column(name = "ordinary_primary_school_num")
|
||||
public Integer getOrdinaryPrimarySchoolNum() {
|
||||
return ordinaryPrimarySchoolNum;
|
||||
}
|
||||
|
||||
public void setOrdinaryPrimarySchoolNum(Integer ordinaryPrimarySchoolNum) {
|
||||
this.ordinaryPrimarySchoolNum = ordinaryPrimarySchoolNum;
|
||||
}
|
||||
|
||||
@Column(name = "key_middle_school_num")
|
||||
public Integer getKeyMiddleSchoolNum() {
|
||||
return keyMiddleSchoolNum;
|
||||
}
|
||||
|
||||
public void setKeyMiddleSchoolNum(Integer keyMiddleSchoolNum) {
|
||||
this.keyMiddleSchoolNum = keyMiddleSchoolNum;
|
||||
}
|
||||
|
||||
@Column(name = "ordinary_middle_school_num")
|
||||
public Integer getOrdinaryMiddleSchoolNum() {
|
||||
return ordinaryMiddleSchoolNum;
|
||||
}
|
||||
|
||||
public void setOrdinaryMiddleSchoolNum(Integer ordinaryMiddleSchoolNum) {
|
||||
this.ordinaryMiddleSchoolNum = ordinaryMiddleSchoolNum;
|
||||
}
|
||||
|
||||
@Column(name = "top_three_hospital_num")
|
||||
public Integer getTopThreeHospitalNum() {
|
||||
return topThreeHospitalNum;
|
||||
}
|
||||
|
||||
public void setTopThreeHospitalNum(Integer topThreeHospitalNum) {
|
||||
this.topThreeHospitalNum = topThreeHospitalNum;
|
||||
}
|
||||
|
||||
@Column(name = "non_3a_hospital_num")
|
||||
public Integer getNon3aHospitalNum() {
|
||||
return non3aHospitalNum;
|
||||
}
|
||||
|
||||
public void setNon3aHospitalNum(Integer non3aHospitalNum) {
|
||||
this.non3aHospitalNum = non3aHospitalNum;
|
||||
}
|
||||
|
||||
@Column(name = "build_year")
|
||||
public Integer getBuildYear() {
|
||||
return buildYear;
|
||||
}
|
||||
|
||||
public void setBuildYear(Integer buildYear) {
|
||||
this.buildYear = buildYear;
|
||||
}
|
||||
|
||||
@Column(name = "cubage_percent")
|
||||
public Double getCubagePercent() {
|
||||
return cubagePercent;
|
||||
}
|
||||
|
||||
public void setCubagePercent(Double cubagePercent) {
|
||||
this.cubagePercent = cubagePercent;
|
||||
}
|
||||
|
||||
@Column(name = "virescence_percent")
|
||||
public Double getVirescencePercent() {
|
||||
return virescencePercent;
|
||||
}
|
||||
|
||||
public void setVirescencePercent(Double virescencePercent) {
|
||||
this.virescencePercent = virescencePercent;
|
||||
}
|
||||
|
||||
@Column(name = "estate_charge")
|
||||
public Double getEstateCharge() {
|
||||
return estateCharge;
|
||||
}
|
||||
|
||||
public void setEstateCharge(Double estateCharge) {
|
||||
this.estateCharge = estateCharge;
|
||||
}
|
||||
|
||||
@Column(name = "estate_type")
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
|
||||
@Column(name = "city_rank")
|
||||
public Integer getCityRank() {
|
||||
return cityRank;
|
||||
}
|
||||
|
||||
public void setCityRank(Integer cityRank) {
|
||||
this.cityRank = cityRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_total_rank")
|
||||
public Integer getCityTotalRank() {
|
||||
return cityTotalRank;
|
||||
}
|
||||
|
||||
public void setCityTotalRank(Integer cityTotalRank) {
|
||||
this.cityTotalRank = cityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_rank")
|
||||
public Integer getRegionRank() {
|
||||
return regionRank;
|
||||
}
|
||||
|
||||
public void setRegionRank(Integer regionRank) {
|
||||
this.regionRank = regionRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_total_rank")
|
||||
public Integer getRegionTotalRank() {
|
||||
return regionTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionTotalRank(Integer regionTotalRank) {
|
||||
this.regionTotalRank = regionTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_total_rank")
|
||||
public Integer getBlockTotalRank() {
|
||||
return blockTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockTotalRank(Integer blockTotalRank) {
|
||||
this.blockTotalRank = blockTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_rank")
|
||||
public Integer getBlockRank() {
|
||||
return blockRank;
|
||||
}
|
||||
|
||||
public void setBlockRank(Integer blockRank) {
|
||||
this.blockRank = blockRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_community_quality_rank")
|
||||
public Integer getCityCommunityQualityRank() {
|
||||
return cityCommunityQualityRank;
|
||||
}
|
||||
|
||||
public void setCityCommunityQualityRank(Integer cityCommunityQualityRank) {
|
||||
this.cityCommunityQualityRank = cityCommunityQualityRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_community_quality_total_rank")
|
||||
public Integer getCityCommunityQualityTotalRank() {
|
||||
return cityCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
public void setCityCommunityQualityTotalRank(Integer cityCommunityQualityTotalRank) {
|
||||
this.cityCommunityQualityTotalRank = cityCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_community_quality_rank")
|
||||
public Integer getRegionCommunityQualityRank() {
|
||||
return regionCommunityQualityRank;
|
||||
}
|
||||
|
||||
public void setRegionCommunityQualityRank(Integer regionCommunityQualityRank) {
|
||||
this.regionCommunityQualityRank = regionCommunityQualityRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_community_quality_total_rank")
|
||||
public Integer getRegionCommunityQualityTotalRank() {
|
||||
return regionCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionCommunityQualityTotalRank(Integer regionCommunityQualityTotalRank) {
|
||||
this.regionCommunityQualityTotalRank = regionCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_community_quality_total_rank")
|
||||
public Integer getBlockCommunityQualityTotalRank() {
|
||||
return blockCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockCommunityQualityTotalRank(Integer blockCommunityQualityTotalRank) {
|
||||
this.blockCommunityQualityTotalRank = blockCommunityQualityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_community_quality_rank")
|
||||
public Integer getBlockCommunityQualityRank() {
|
||||
return blockCommunityQualityRank;
|
||||
}
|
||||
|
||||
public void setBlockCommunityQualityRank(Integer blockCommunityQualityRank) {
|
||||
this.blockCommunityQualityRank = blockCommunityQualityRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_community_price_rank")
|
||||
public Integer getCityCommunityPriceRank() {
|
||||
return cityCommunityPriceRank;
|
||||
}
|
||||
|
||||
public void setCityCommunityPriceRank(Integer cityCommunityPriceRank) {
|
||||
this.cityCommunityPriceRank = cityCommunityPriceRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_community_price_total_rank")
|
||||
public Integer getCityCommunityPriceTotalRank() {
|
||||
return cityCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
public void setCityCommunityPriceTotalRank(Integer cityCommunityPriceTotalRank) {
|
||||
this.cityCommunityPriceTotalRank = cityCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_community_price_rank")
|
||||
public Integer getRegionCommunityPriceRank() {
|
||||
return regionCommunityPriceRank;
|
||||
}
|
||||
|
||||
public void setRegionCommunityPriceRank(Integer regionCommunityPriceRank) {
|
||||
this.regionCommunityPriceRank = regionCommunityPriceRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_community_price_total_rank")
|
||||
public Integer getRegionCommunityPriceTotalRank() {
|
||||
return regionCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionCommunityPriceTotalRank(Integer regionCommunityPriceTotalRank) {
|
||||
this.regionCommunityPriceTotalRank = regionCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_community_price_total_rank")
|
||||
public Integer getBlockCommunityPriceTotalRank() {
|
||||
return blockCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockCommunityPriceTotalRank(Integer blockCommunityPriceTotalRank) {
|
||||
this.blockCommunityPriceTotalRank = blockCommunityPriceTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_community_price_rank")
|
||||
public Integer getBlockCommunityPriceRank() {
|
||||
return blockCommunityPriceRank;
|
||||
}
|
||||
|
||||
public void setBlockCommunityPriceRank(Integer blockCommunityPriceRank) {
|
||||
this.blockCommunityPriceRank = blockCommunityPriceRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_location_advantage_rank")
|
||||
public Integer getCityLocationAdvantageRank() {
|
||||
return cityLocationAdvantageRank;
|
||||
}
|
||||
|
||||
public void setCityLocationAdvantageRank(Integer cityLocationAdvantageRank) {
|
||||
this.cityLocationAdvantageRank = cityLocationAdvantageRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_location_advantage_total_rank")
|
||||
public Integer getCityLocationAdvantageTotalRank() {
|
||||
return cityLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
public void setCityLocationAdvantageTotalRank(Integer cityLocationAdvantageTotalRank) {
|
||||
this.cityLocationAdvantageTotalRank = cityLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_location_advantage_rank")
|
||||
public Integer getRegionLocationAdvantageRank() {
|
||||
return regionLocationAdvantageRank;
|
||||
}
|
||||
|
||||
public void setRegionLocationAdvantageRank(Integer regionLocationAdvantageRank) {
|
||||
this.regionLocationAdvantageRank = regionLocationAdvantageRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_location_advantage_total_rank")
|
||||
public Integer getRegionLocationAdvantageTotalRank() {
|
||||
return regionLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionLocationAdvantageTotalRank(Integer regionLocationAdvantageTotalRank) {
|
||||
this.regionLocationAdvantageTotalRank = regionLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_location_advantage_total_rank")
|
||||
public Integer getBlockLocationAdvantageTotalRank() {
|
||||
return blockLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockLocationAdvantageTotalRank(Integer blockLocationAdvantageTotalRank) {
|
||||
this.blockLocationAdvantageTotalRank = blockLocationAdvantageTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_location_advantage_rank")
|
||||
public Integer getBlockLocationAdvantageRank() {
|
||||
return blockLocationAdvantageRank;
|
||||
}
|
||||
|
||||
public void setBlockLocationAdvantageRank(Integer blockLocationAdvantageRank) {
|
||||
this.blockLocationAdvantageRank = blockLocationAdvantageRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_flowability_rank")
|
||||
public Integer getCityFlowabilityRank() {
|
||||
return cityFlowabilityRank;
|
||||
}
|
||||
|
||||
public void setCityFlowabilityRank(Integer cityFlowabilityRank) {
|
||||
this.cityFlowabilityRank = cityFlowabilityRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_flowability_total_rank")
|
||||
public Integer getCityFlowabilityTotalRank() {
|
||||
return cityFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
public void setCityFlowabilityTotalRank(Integer cityFlowabilityTotalRank) {
|
||||
this.cityFlowabilityTotalRank = cityFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_flowability_rank")
|
||||
public Integer getRegionFlowabilityRank() {
|
||||
return regionFlowabilityRank;
|
||||
}
|
||||
|
||||
public void setRegionFlowabilityRank(Integer regionFlowabilityRank) {
|
||||
this.regionFlowabilityRank = regionFlowabilityRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_flowability_total_rank")
|
||||
public Integer getRegionFlowabilityTotalRank() {
|
||||
return regionFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionFlowabilityTotalRank(Integer regionFlowabilityTotalRank) {
|
||||
this.regionFlowabilityTotalRank = regionFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_flowability_total_rank")
|
||||
public Integer getBlockFlowabilityTotalRank() {
|
||||
return blockFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockFlowabilityTotalRank(Integer blockFlowabilityTotalRank) {
|
||||
this.blockFlowabilityTotalRank = blockFlowabilityTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_flowability_rank")
|
||||
public Integer getBlockFlowabilityRank() {
|
||||
return blockFlowabilityRank;
|
||||
}
|
||||
|
||||
public void setBlockFlowabilityRank(Integer blockFlowabilityRank) {
|
||||
this.blockFlowabilityRank = blockFlowabilityRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_living_facilities_rank")
|
||||
public Integer getCityLivingFacilitiesRank() {
|
||||
return cityLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
public void setCityLivingFacilitiesRank(Integer cityLivingFacilitiesRank) {
|
||||
this.cityLivingFacilitiesRank = cityLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_living_facilities_total_rank")
|
||||
public Integer getCityLivingFacilitiesTotalRank() {
|
||||
return cityLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
public void setCityLivingFacilitiesTotalRank(Integer cityLivingFacilitiesTotalRank) {
|
||||
this.cityLivingFacilitiesTotalRank = cityLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_living_facilities_rank")
|
||||
public Integer getRegionLivingFacilitiesRank() {
|
||||
return regionLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
public void setRegionLivingFacilitiesRank(Integer regionLivingFacilitiesRank) {
|
||||
this.regionLivingFacilitiesRank = regionLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_living_facilities_total_rank")
|
||||
public Integer getRegionLivingFacilitiesTotalRank() {
|
||||
return regionLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionLivingFacilitiesTotalRank(Integer regionLivingFacilitiesTotalRank) {
|
||||
this.regionLivingFacilitiesTotalRank = regionLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_living_facilities_total_rank")
|
||||
public Integer getBlockLivingFacilitiesTotalRank() {
|
||||
return blockLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockLivingFacilitiesTotalRank(Integer blockLivingFacilitiesTotalRank) {
|
||||
this.blockLivingFacilitiesTotalRank = blockLivingFacilitiesTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_living_facilities_rank")
|
||||
public Integer getBlockLivingFacilitiesRank() {
|
||||
return blockLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
public void setBlockLivingFacilitiesRank(Integer blockLivingFacilitiesRank) {
|
||||
this.blockLivingFacilitiesRank = blockLivingFacilitiesRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_education_rank")
|
||||
public Integer getCityEducationRank() {
|
||||
return cityEducationRank;
|
||||
}
|
||||
|
||||
public void setCityEducationRank(Integer cityEducationRank) {
|
||||
this.cityEducationRank = cityEducationRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_education_total_rank")
|
||||
public Integer getCityEducationTotalRank() {
|
||||
return cityEducationTotalRank;
|
||||
}
|
||||
|
||||
public void setCityEducationTotalRank(Integer cityEducationTotalRank) {
|
||||
this.cityEducationTotalRank = cityEducationTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_education_rank")
|
||||
public Integer getRegionEducationRank() {
|
||||
return regionEducationRank;
|
||||
}
|
||||
|
||||
public void setRegionEducationRank(Integer regionEducationRank) {
|
||||
this.regionEducationRank = regionEducationRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_education_total_rank")
|
||||
public Integer getRegionEducationTotalRank() {
|
||||
return regionEducationTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionEducationTotalRank(Integer regionEducationTotalRank) {
|
||||
this.regionEducationTotalRank = regionEducationTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_education_total_rank")
|
||||
public Integer getBlockEducationTotalRank() {
|
||||
return blockEducationTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockEducationTotalRank(Integer blockEducationTotalRank) {
|
||||
this.blockEducationTotalRank = blockEducationTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_education_rank")
|
||||
public Integer getBlockEducationRank() {
|
||||
return blockEducationRank;
|
||||
}
|
||||
|
||||
public void setBlockEducationRank(Integer blockEducationRank) {
|
||||
this.blockEducationRank = blockEducationRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_hospital_rank")
|
||||
public Integer getCityHospitalRank() {
|
||||
return cityHospitalRank;
|
||||
}
|
||||
|
||||
public void setCityHospitalRank(Integer cityHospitalRank) {
|
||||
this.cityHospitalRank = cityHospitalRank;
|
||||
}
|
||||
|
||||
@Column(name = "city_hospital_total_rank")
|
||||
public Integer getCityHospitalTotalRank() {
|
||||
return cityHospitalTotalRank;
|
||||
}
|
||||
|
||||
public void setCityHospitalTotalRank(Integer cityHospitalTotalRank) {
|
||||
this.cityHospitalTotalRank = cityHospitalTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_hospital_rank")
|
||||
public Integer getRegionHospitalRank() {
|
||||
return regionHospitalRank;
|
||||
}
|
||||
|
||||
public void setRegionHospitalRank(Integer regionHospitalRank) {
|
||||
this.regionHospitalRank = regionHospitalRank;
|
||||
}
|
||||
|
||||
@Column(name = "region_hospital_total_rank")
|
||||
public Integer getRegionHospitalTotalRank() {
|
||||
return regionHospitalTotalRank;
|
||||
}
|
||||
|
||||
public void setRegionHospitalTotalRank(Integer regionHospitalTotalRank) {
|
||||
this.regionHospitalTotalRank = regionHospitalTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_hospital_total_rank")
|
||||
public Integer getBlockHospitalTotalRank() {
|
||||
return blockHospitalTotalRank;
|
||||
}
|
||||
|
||||
public void setBlockHospitalTotalRank(Integer blockHospitalTotalRank) {
|
||||
this.blockHospitalTotalRank = blockHospitalTotalRank;
|
||||
}
|
||||
|
||||
@Column(name = "block_hospital_rank")
|
||||
public Integer getBlockHospitalRank() {
|
||||
return blockHospitalRank;
|
||||
}
|
||||
|
||||
public void setBlockHospitalRank(Integer blockHospitalRank) {
|
||||
this.blockHospitalRank = blockHospitalRank;
|
||||
}
|
||||
|
||||
@Column(name = "m_date")
|
||||
public Date getMDate() {
|
||||
return mDate;
|
||||
}
|
||||
|
||||
public void setMDate(Date mDate) {
|
||||
this.mDate = mDate;
|
||||
}
|
||||
|
||||
@Column(name = "c_date")
|
||||
public Date getCDate() {
|
||||
return cDate;
|
||||
}
|
||||
|
||||
public void setCDate(Date cDate) {
|
||||
this.cDate = cDate;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "resistance_coef")
|
||||
public Integer getResistanceCoef() {
|
||||
return resistanceCoef;
|
||||
}
|
||||
|
||||
public void setResistanceCoef(Integer resistanceCoef) {
|
||||
this.resistanceCoef = resistanceCoef;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,8 @@ public class DistrictAnalyData implements MongoEntity {
|
||||
private String tag;
|
||||
private String economic;
|
||||
private Double halfYearMarkup;
|
||||
private Integer valueRate;
|
||||
private String commId;
|
||||
|
||||
|
||||
@Id
|
||||
@@ -501,4 +503,21 @@ public class DistrictAnalyData implements MongoEntity {
|
||||
public void setHalfYearMarkup(Double halfYearMarkup) {
|
||||
this.halfYearMarkup = halfYearMarkup;
|
||||
}
|
||||
|
||||
@Column(name = "value_rate")
|
||||
public Integer getValueRate() {
|
||||
return valueRate;
|
||||
}
|
||||
|
||||
public void setValueRate(Integer valueRate) {
|
||||
this.valueRate = valueRate;
|
||||
}
|
||||
@Column(name = "comm_id")
|
||||
public String getCommId() {
|
||||
return commId;
|
||||
}
|
||||
|
||||
public void setCommId(String commId) {
|
||||
this.commId = commId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,18 @@ public class Evaluation implements MongoEntity {
|
||||
* Â¥²ãÃèÊö
|
||||
*/
|
||||
private String floorDesc;
|
||||
/**
|
||||
* ²éѯ·¶Î§
|
||||
*/
|
||||
private Integer radius;
|
||||
/**
|
||||
* Ñù±¾IDS
|
||||
*/
|
||||
private String sampleIds;
|
||||
/**
|
||||
* ÉÌÆÌ±êÇ©
|
||||
*/
|
||||
private String tags;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
@@ -1066,4 +1078,31 @@ public class Evaluation implements MongoEntity {
|
||||
public void setFloorDesc(String floorDesc) {
|
||||
this.floorDesc = floorDesc;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public Integer getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(Integer radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Column(name = "sample_ids")
|
||||
public String getSampleIds() {
|
||||
return sampleIds;
|
||||
}
|
||||
|
||||
public void setSampleIds(String sampleIds) {
|
||||
this.sampleIds = sampleIds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia_stat.shop_rent_stat")
|
||||
public class ShopRentStat implements MongoEntity {
|
||||
private static final long serialVersionUID = 4425229045088250573L;
|
||||
|
||||
private String id;
|
||||
private String cat;
|
||||
private String city;
|
||||
private String district;
|
||||
private Integer date;
|
||||
private Double avgPrice;
|
||||
private String name;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "cat")
|
||||
public String getCat() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
public void setCat(String cat) {
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
@Column(name = "date")
|
||||
public Integer getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Integer date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Column(name = "avg_price")
|
||||
public Double getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(Double avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
@Column(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia_stat.shop_sell_stat")
|
||||
public class ShopSellStat implements MongoEntity {
|
||||
private static final long serialVersionUID = 4425229045088250573L;
|
||||
|
||||
private String id;
|
||||
private String cat;
|
||||
private String city;
|
||||
private String district;
|
||||
private Integer date;
|
||||
private Integer avgPrice;
|
||||
private String name;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "cat")
|
||||
public String getCat() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
public void setCat(String cat) {
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
@Column(name = "date")
|
||||
public Integer getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Integer date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Column(name = "avg_price")
|
||||
public Integer getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
@Column(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class Township implements MongoEntity {
|
||||
private String street;
|
||||
private String pid;
|
||||
private String id;
|
||||
private String hasGov;
|
||||
@JSONField(name = "tjj_province_code")
|
||||
private String tjjProvinceCode;
|
||||
|
||||
@@ -325,4 +326,13 @@ public class Township implements MongoEntity {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Column(name = "has_gov")
|
||||
public String getHasGov() {
|
||||
return hasGov;
|
||||
}
|
||||
|
||||
public void setHasGov(String hasGov) {
|
||||
this.hasGov = hasGov;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.dal.mongo.tool.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -73,6 +74,7 @@ public class OpenUriLog implements MongoEntity {
|
||||
private Map<String, Object> resMap;
|
||||
private String parameterMaps;
|
||||
private String tid;
|
||||
private Double cost;
|
||||
|
||||
public String getParameterMaps() {
|
||||
return this.parameterMaps;
|
||||
@@ -238,6 +240,14 @@ public class OpenUriLog implements MongoEntity {
|
||||
this.tid = tid;
|
||||
}
|
||||
|
||||
@Column(name = "cost")
|
||||
public Double getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void setCost(Double cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.dal.seawater.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.SeawaterQuery;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
@@ -10,21 +11,24 @@ import com.fangjia.dal.seawater.model.Seawater;
|
||||
*/
|
||||
public interface SeawaterDao extends com.fangjia.dal.SeawaterDao<Seawater> {
|
||||
|
||||
long findSeawatersCountFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Integer room, String root,String table);
|
||||
|
||||
Seawater findByIdFromEs(String id,String table);
|
||||
long findSeawatersCountFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Integer room, String root, String table);
|
||||
|
||||
List<Seawater> findSeawatersFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit , String table);
|
||||
Seawater findByIdFromEs(String id, String table);
|
||||
|
||||
List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit);
|
||||
List<Seawater> findSeawatersFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit, String table);
|
||||
|
||||
List<Seawater> findSeawatersByQuery(SeawaterQuery query);
|
||||
List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit);
|
||||
|
||||
long findSeawatersCountByQuery(SeawaterQuery query);
|
||||
List<Seawater> findSeawatersByQuery(SeawaterQuery query);
|
||||
|
||||
void batchDeleteByParams(SeawaterQuery query);
|
||||
long findSeawatersCountByQuery(SeawaterQuery query);
|
||||
|
||||
void batchUpdateEstateType(SeawaterQuery query);
|
||||
void batchDeleteByParams(SeawaterQuery query);
|
||||
|
||||
void batchUpdateEstateType(SeawaterQuery query);
|
||||
|
||||
List<Map<String, Object>> samplesNum(String city, String region, String name, String cat,int size,
|
||||
int startPDate, int endPDate, String sort, boolean order);
|
||||
}
|
||||
|
||||
+199
-1
@@ -329,6 +329,9 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
} catch (Exception e) {
|
||||
seawater.setpDate(0);
|
||||
}
|
||||
if (source.containsKey("publish_date")) {
|
||||
seawater.setPublishDate(source.getString("publish_date"));
|
||||
}
|
||||
if (source.containsKey("url")) {
|
||||
seawater.setUrl(source.getString("url"));
|
||||
}
|
||||
@@ -392,6 +395,24 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if (source.containsKey("business_status")) {
|
||||
seawater.setBusinessStatus(source.getString("business_status"));
|
||||
}
|
||||
if (source.containsKey("tags")) {
|
||||
List<String> tagsList = new ArrayList<String>();
|
||||
JSONArray jsonArray = source.getJSONArray("tags");
|
||||
int size = jsonArray.size();
|
||||
for (int n = 0; n < size; n++) {
|
||||
tagsList.add(jsonArray.getString(n));
|
||||
}
|
||||
seawater.setTags(StringUtils.join(tagsList, ","));
|
||||
}
|
||||
if (source.containsKey("image_urls")) {
|
||||
List<String> imageList = new ArrayList<String>();
|
||||
JSONArray jsonArray = source.getJSONArray("image_urls");
|
||||
int size = jsonArray.size();
|
||||
for (int n = 0; n < size; n++) {
|
||||
imageList.add(jsonArray.getString(n));
|
||||
}
|
||||
seawater.setImageUrls(StringUtils.join(imageList, ","));
|
||||
}
|
||||
try {
|
||||
seawater.setDistance((int) jsonList.get(i).getJSONArray("sort").getDouble(0));
|
||||
} catch (Exception e) {
|
||||
@@ -621,6 +642,13 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(query.getIds() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("_id", query.getIds());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getCat())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cat", query.getCat());
|
||||
@@ -748,7 +776,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(query.getSortField())) {
|
||||
if (reqBody.size()==0 && StringUtils.isNotBlank(query.getSortField())) {
|
||||
JSONObject jsonOrder = new JSONObject();
|
||||
if (query.getOrder()) {
|
||||
jsonOrder.put("order", "asc");
|
||||
@@ -777,6 +805,17 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if (query.getTags() != null && query.getTags().size() > 0) {
|
||||
Set<String> tagsList = new LinkedHashSet<String>(query.getTags());
|
||||
for (String tag : tagsList) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("tags", tag);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
queryJson.put("must", jsonList);
|
||||
ArrayList<JSONObject> filterList = new ArrayList<JSONObject>();
|
||||
if (filter.size() > 0) {
|
||||
@@ -1003,4 +1042,163 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
return reqBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> samplesNum(String city, String region, String name, String cat, int size,
|
||||
int startPDate, int endPDate, String sort, boolean order) {
|
||||
JSONObject jsonObject = getSamplesNum(city, region, name, cat, size, startPDate, endPDate, sort, order);
|
||||
return parseMonthlyAggToList(jsonObject);
|
||||
}
|
||||
|
||||
public JSONObject getSamplesNum(String city, String region, String name, String cat,int size,
|
||||
int startPDate, int endPDate,String sort, boolean order) {
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("size", 0);
|
||||
|
||||
// 1. 构建 bool.must 查询条件
|
||||
List<JSONObject> mustList = new ArrayList<JSONObject>();
|
||||
|
||||
if (StringUtils.isNotBlank(city)) {
|
||||
JSONObject term = new JSONObject();
|
||||
term.put("city", city);
|
||||
JSONObject termWrapper = new JSONObject();
|
||||
termWrapper.put("term", term);
|
||||
mustList.add(termWrapper);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(region)) {
|
||||
JSONObject term = new JSONObject();
|
||||
term.put("region", region);
|
||||
JSONObject termWrapper = new JSONObject();
|
||||
termWrapper.put("term", term);
|
||||
mustList.add(termWrapper);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
JSONObject term = new JSONObject();
|
||||
term.put("district_name", name);
|
||||
JSONObject termWrapper = new JSONObject();
|
||||
termWrapper.put("term", term);
|
||||
mustList.add(termWrapper);
|
||||
}
|
||||
if (StringUtils.isNotBlank(cat)) {
|
||||
JSONObject term = new JSONObject();
|
||||
term.put("cat", cat);
|
||||
JSONObject termWrapper = new JSONObject();
|
||||
termWrapper.put("term", term);
|
||||
mustList.add(termWrapper);
|
||||
}
|
||||
// 日期范围条件
|
||||
JSONObject dateRange = new JSONObject();
|
||||
dateRange.put("gte", startPDate);
|
||||
dateRange.put("lte", endPDate);
|
||||
JSONObject range = new JSONObject();
|
||||
range.put("p_date", dateRange);
|
||||
JSONObject rangeWrapper = new JSONObject();
|
||||
rangeWrapper.put("range", range);
|
||||
mustList.add(rangeWrapper);
|
||||
|
||||
// 组合 bool 查询
|
||||
JSONObject boolQuery = new JSONObject();
|
||||
boolQuery.put("must", mustList);
|
||||
JSONObject query = new JSONObject();
|
||||
query.put("bool", boolQuery);
|
||||
reqBody.put("query", query);
|
||||
|
||||
// 2. 构建聚合 monthly_histogram
|
||||
JSONObject dateHistogram = new JSONObject();
|
||||
dateHistogram.put("field", "publish_date");
|
||||
dateHistogram.put("calendar_interval", "month");
|
||||
dateHistogram.put("format", "yyyy-MM");
|
||||
JSONObject orderJson = new JSONObject();
|
||||
orderJson.put("_key", "asc");
|
||||
dateHistogram.put("order",orderJson);
|
||||
|
||||
// avg_price 子聚合
|
||||
JSONObject avgPriceAgg = new JSONObject();
|
||||
JSONObject avgJson = new JSONObject();
|
||||
avgJson.put("field", "avg_price");
|
||||
avgPriceAgg.put("avg", avgJson);
|
||||
|
||||
// moving_avg 子聚合
|
||||
JSONObject movingFn = new JSONObject();
|
||||
movingFn.put("buckets_path", "avg_price");
|
||||
movingFn.put("window", 3);
|
||||
movingFn.put("script", "MovingFunctions.unweightedAvg(values)");
|
||||
|
||||
JSONObject movingAvgAgg = new JSONObject();
|
||||
movingAvgAgg.put("moving_fn", movingFn);
|
||||
|
||||
// 子聚合集合
|
||||
JSONObject subAggs = new JSONObject();
|
||||
subAggs.put("avg_price", avgPriceAgg);
|
||||
subAggs.put("moving_avg", movingAvgAgg);
|
||||
|
||||
// 整体聚合
|
||||
JSONObject monthlyHistogramAgg = new JSONObject();
|
||||
monthlyHistogramAgg.put("date_histogram", dateHistogram);
|
||||
monthlyHistogramAgg.put("aggs", subAggs);
|
||||
|
||||
JSONObject aggs = new JSONObject();
|
||||
aggs.put("monthly_histogram", monthlyHistogramAgg);
|
||||
|
||||
reqBody.put("aggs", aggs);
|
||||
|
||||
// 3. 发送请求
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
Base64 token = new Base64();
|
||||
String authenticationEncoding = token.encodeAsString((ES_USER + ":" + ES_PASSWORD).getBytes());
|
||||
headers.put("Authorization", "Basic " + authenticationEncoding);
|
||||
|
||||
try {
|
||||
String url = "http://es.fangjia.com:9200/latest_seawater/_search?rest_total_hits_as_int=true";
|
||||
String response = request.postWithBody(url, reqBody, headers, "UTF-8");
|
||||
return JSONObject.fromObject(response);
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static List<Map<String, Object>> parseMonthlyAggToList(JSONObject response) {
|
||||
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
if (response == null) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
JSONObject aggs = response.optJSONObject("aggregations");
|
||||
if (aggs == null) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
JSONObject monthGroup = aggs.optJSONObject("monthly_histogram");
|
||||
if (monthGroup == null) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
JSONArray buckets = monthGroup.optJSONArray("buckets");
|
||||
if (buckets == null) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
for (int i = 0; i < buckets.size(); i++) {
|
||||
JSONObject bucket = buckets.getJSONObject(i);
|
||||
String monthKey = bucket.optString("key_as_string");
|
||||
int docCount = bucket.optInt("doc_count", 0);
|
||||
int avgPrice = bucket.getJSONObject("moving_avg").optInt("value",0);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("month", monthKey);
|
||||
map.put("count", docCount);
|
||||
map.put("avgPrice", avgPrice);
|
||||
|
||||
resultList.add(map);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,9 @@ public class Seawater implements SeawaterEntity {
|
||||
|
||||
private String businessStatus;
|
||||
|
||||
private String tags;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
@@ -572,4 +575,22 @@ public class Seawater implements SeawaterEntity {
|
||||
public void setBusinessStatus(String businessStatus) {
|
||||
this.businessStatus = businessStatus;
|
||||
}
|
||||
|
||||
@Column(name = "tags")
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Column(name = "image_urls")
|
||||
public String getImageUrls() {
|
||||
return imageUrls;
|
||||
}
|
||||
|
||||
public void setImageUrls(String imageUrls) {
|
||||
this.imageUrls = imageUrls;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.fangjia.dal.seawater.model;
|
||||
|
||||
public class SeawaterDto {
|
||||
|
||||
private String id;
|
||||
private String city;
|
||||
private String district;
|
||||
private String name;
|
||||
private String fitment;
|
||||
private Double area;
|
||||
private Double unitPrice;
|
||||
private String publishDate;
|
||||
private String floorInfo;
|
||||
|
||||
private String estateType;
|
||||
private String bedKind;
|
||||
|
||||
private String address;
|
||||
|
||||
private String districtName;
|
||||
|
||||
private String tags;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String location;
|
||||
|
||||
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 getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFitment() {
|
||||
return fitment;
|
||||
}
|
||||
|
||||
public void setFitment(String fitment) {
|
||||
this.fitment = fitment;
|
||||
}
|
||||
|
||||
public Double getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(Double area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public Double getUnitPrice() {
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(Double unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
public String getPublishDate() {
|
||||
return publishDate;
|
||||
}
|
||||
|
||||
public void setPublishDate(String publishDate) {
|
||||
this.publishDate = publishDate;
|
||||
}
|
||||
|
||||
public String getFloorInfo() {
|
||||
return floorInfo;
|
||||
}
|
||||
|
||||
public void setFloorInfo(String floorInfo) {
|
||||
this.floorInfo = floorInfo;
|
||||
}
|
||||
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
|
||||
public String getBedKind() {
|
||||
return bedKind;
|
||||
}
|
||||
|
||||
public void setBedKind(String bedKind) {
|
||||
this.bedKind = bedKind;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public String getImageUrls() {
|
||||
return imageUrls;
|
||||
}
|
||||
|
||||
public void setImageUrls(String imageUrls) {
|
||||
this.imageUrls = imageUrls;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class APIConstant {
|
||||
public static final long SUPER_USER_ID = 1007497l;
|
||||
|
||||
public static final String IS_RETURN_DATA = "IS_RETURN_DATA";
|
||||
public static final String API_COST_KEY = "api_cost_key";
|
||||
|
||||
static { // ³õʼ»¯±äÁ¿
|
||||
|
||||
|
||||
+131
-128
@@ -1,9 +1,11 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.APIConstant;
|
||||
import com.fangjia.open.FangjiaApiUtil;
|
||||
import com.fangjia.open.dto.addressGovernance.DistrictDto;
|
||||
import com.fangjia.open.dto.addressGovernance.DistrictIdentifyDto;
|
||||
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
|
||||
@@ -18,7 +20,9 @@ import com.fangjia.open.util.CommonDtoUtils;
|
||||
import com.fangjia.service.bo.DistrictAvgBo;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.mongo.fangjia.TownshipService;
|
||||
import com.fangjia.service.mongo.fangjia.VillageIdentifyService;
|
||||
import com.fangjia.service.open.DistrictAnalyDataService;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -58,6 +62,8 @@ public class AddrSvcController {
|
||||
private DistrictStatService districtStatService;
|
||||
private DistrictService districtService;
|
||||
private VillageIdentifyService villageIdentifyService;
|
||||
private DistrictAnalyDataService districtAnalyDataService;
|
||||
private TownshipService townshipService;
|
||||
|
||||
/**
|
||||
* 地址结构化
|
||||
@@ -179,7 +185,27 @@ public class AddrSvcController {
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result")));
|
||||
StructureAndCompleteDto structureAndCompleteDto = CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result"));
|
||||
if("1".equals(model.getShowCode())){
|
||||
if(StringUtils.isNotBlank(structureAndCompleteDto.getProvinceCode())){
|
||||
structureAndCompleteDto.setProvinceCode(structureAndCompleteDto.getProvinceCode().substring(0, 6));
|
||||
}
|
||||
if(StringUtils.isNotBlank(structureAndCompleteDto.getCityCode())){
|
||||
structureAndCompleteDto.setCityCode(structureAndCompleteDto.getCityCode().substring(0, 6));
|
||||
}
|
||||
if(StringUtils.isNotBlank(structureAndCompleteDto.getDistrictCode())){
|
||||
structureAndCompleteDto.setDistrictCode(structureAndCompleteDto.getDistrictCode().substring(0, 6));
|
||||
}
|
||||
if(StringUtils.isNotBlank(structureAndCompleteDto.getTownshipCode())){
|
||||
structureAndCompleteDto.setTownshipCode(structureAndCompleteDto.getTownshipCode().substring(0, 9));
|
||||
}
|
||||
}else{
|
||||
structureAndCompleteDto.setProvinceCode(null);
|
||||
structureAndCompleteDto.setCityCode(null);
|
||||
structureAndCompleteDto.setDistrictCode(null);
|
||||
structureAndCompleteDto.setTownshipCode(null);
|
||||
}
|
||||
basicModel.setResult(structureAndCompleteDto);
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
@@ -455,6 +481,49 @@ public class AddrSvcController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 楼盘价值识别接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object valueRateAction(AddesssMatchModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
|
||||
params.put("address", model.getAddress());
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaDataService/valueRate", params, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaDataService/valueRate", params, "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("msgCode");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(json.get("result"));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
private static final Map<String, String> areaMap = new HashMap<String, String>() {
|
||||
{
|
||||
// 添加键值对到 Map 中
|
||||
@@ -507,13 +576,21 @@ public class AddrSvcController {
|
||||
if (json.containsKey("result")) {
|
||||
//我们的结果
|
||||
JSONObject result = json.getJSONObject("result");
|
||||
//我们省级及以上有开发区,直接用我们的结果
|
||||
if (result.containsKey("devDistrictName")) {
|
||||
basicModel.setResult(result);
|
||||
if (result.containsKey("devDistrictName") && StringUtils.isNotBlank(result.get("devDistrictName").toString())) {
|
||||
// basicModel.setResult(result);
|
||||
if(result.containsKey("countyGov") && StringUtils.isNotBlank(result.get("countyGov").toString())){
|
||||
result.put("countyGov","");
|
||||
}
|
||||
}
|
||||
basicModel.setResult(result);
|
||||
|
||||
|
||||
//我们省级及以上有开发区,直接用我们的结果
|
||||
/*if (result.containsKey("devDistrictName")) {
|
||||
basicModel.setResult(result);
|
||||
} else if (!"2".equals(type)) { // 对私的不用齐梁
|
||||
basicModel.setResult(result);
|
||||
} else {
|
||||
}else {
|
||||
try {
|
||||
//如果是江苏省或者浙江省 调用齐梁的结果
|
||||
if (result.containsKey("province") && ("中国".equals(result.getString("province")))) {
|
||||
@@ -563,7 +640,7 @@ public class AddrSvcController {
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
@@ -928,7 +1005,41 @@ public class AddrSvcController {
|
||||
if (json.containsKey("result")) {
|
||||
//我们的结果
|
||||
JSONObject result = json.getJSONObject("result");
|
||||
String userId = FangjiaApiUtil.parseUserId(model.getToken());
|
||||
if("对私".equals(villageType) && ("1007801".equals(userId) || "1007497".equals(userId))){
|
||||
result.remove("verifyFlag");
|
||||
if(result.containsKey("district")){
|
||||
String district = result.getString("district");
|
||||
if(district != null){
|
||||
if(district.endsWith("区")){
|
||||
result.put("verifyFlag", "非农");
|
||||
}else if(result.containsKey("countyGov") && StringUtils.isNotBlank(result.getString("countyGov"))){
|
||||
String countyGov = result.getString("countyGov");
|
||||
if("是".equals(countyGov)){
|
||||
result.put("verifyFlag", "非农");
|
||||
} else if ("否".equals(countyGov)) {
|
||||
result.put("verifyFlag", "农");
|
||||
}
|
||||
}else if(result.containsKey("townCode")){
|
||||
String townCode = result.getString("townCode");
|
||||
Township township = townshipService.findTownshipByCode(townCode);
|
||||
if(township != null){
|
||||
String countyGov = "是".equals(township.getHasGov())?"是":"否";
|
||||
result.put("countyGov", countyGov);
|
||||
if("是".equals(countyGov)){
|
||||
result.put("verifyFlag", "非农");
|
||||
} else {
|
||||
result.put("verifyFlag", "农");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
basicModel.setResult(result);
|
||||
if (!result.containsKey("verifyFlag") || StringUtils.isBlank(result.getString("verifyFlag"))) {
|
||||
basicModel.markNoData();
|
||||
}
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
@@ -998,7 +1109,6 @@ public class AddrSvcController {
|
||||
basicModel.setResult(resultMap);
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
// params.put("showTestValue", "2");
|
||||
Integer radius = model.getRadius();
|
||||
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
|
||||
try {
|
||||
@@ -1010,8 +1120,6 @@ public class AddrSvcController {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("msgCode");
|
||||
String msg = json.getString("msg");
|
||||
@@ -1019,66 +1127,10 @@ public class AddrSvcController {
|
||||
if (json.containsKey("result")) {
|
||||
//我们的结果
|
||||
JSONObject result = json.getJSONObject("result");
|
||||
//我们省级及以上有开发区,直接用我们的结果
|
||||
if (result.containsKey("devDistrictName")) {
|
||||
basicModel.setResult(result);
|
||||
} else if (!"2".equals(type)) { // 对私的不用齐梁
|
||||
basicModel.setResult(result);
|
||||
} else {
|
||||
try {
|
||||
//如果是江苏省或者浙江省 调用齐梁的结果
|
||||
// if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
|
||||
// 齐梁不可用,屏蔽
|
||||
if (result.containsKey("province") && ("中国".equals(result.getString("province")))) {
|
||||
|
||||
//结果比较,如果涉农结果不一致
|
||||
//调用齐梁 type :1 对公 0 对私
|
||||
//我们 type :1 对私 2 对共
|
||||
String qltype = "2".equals(type) ? "1" : "0";
|
||||
Map<String, String> map = senRequest(address, qltype);
|
||||
// 涉农结果不一样
|
||||
if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
|
||||
// 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
|
||||
if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
|
||||
basicModel.setResult(result);
|
||||
mav.setModel(basicModel);
|
||||
return mav;
|
||||
}
|
||||
//有市辖建制镇, 或者城市不一样 用我们
|
||||
if (result.containsKey("city")) {
|
||||
if ("是".equals(result.get("administrativeTowns")) || (!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
|
||||
basicModel.setResult(result);
|
||||
} else {
|
||||
map.put("addrVerify", "地址有效");
|
||||
map.put("addrArea", addrArea(map, type));
|
||||
map.put("countyLevelCity", countyLevelCity(map));
|
||||
map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
basicModel.setResult(map);
|
||||
}
|
||||
} else {
|
||||
map.put("addrVerify", "地址有效");
|
||||
map.put("addrArea", addrArea(map, type));
|
||||
map.put("countyLevelCity", countyLevelCity(map));
|
||||
map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
basicModel.setResult(map);
|
||||
}
|
||||
|
||||
} else {
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
} else {
|
||||
basicModel.setResult(result);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
if (!result.containsKey("verifyFlag") || StringUtils.isBlank(result.getString("verifyFlag"))) {
|
||||
basicModel.markNoData();
|
||||
}
|
||||
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
@@ -1157,8 +1209,6 @@ public class AddrSvcController {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("msgCode");
|
||||
String msg = json.getString("msg");
|
||||
@@ -1166,65 +1216,10 @@ public class AddrSvcController {
|
||||
if (json.containsKey("result")) {
|
||||
//我们的结果
|
||||
JSONObject result = json.getJSONObject("result");
|
||||
//我们省级及以上有开发区,直接用我们的结果
|
||||
if (result.containsKey("devDistrictName")) {
|
||||
basicModel.setResult(result);
|
||||
} else if (!"2".equals(type)) { // 对私的不用齐梁
|
||||
basicModel.setResult(result);
|
||||
} else {
|
||||
try {
|
||||
//如果是江苏省或者浙江省 调用齐梁的结果
|
||||
// if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
|
||||
if (result.containsKey("province") && ("中国".equals(result.getString("province")))) {
|
||||
|
||||
//结果比较,如果涉农结果不一致
|
||||
//调用齐梁 type :1 对公 0 对私
|
||||
//我们 type :1 对私 2 对共
|
||||
String qltype = "2".equals(type) ? "1" : "0";
|
||||
Map<String, String> map = senRequest(address, qltype);
|
||||
// 涉农结果不一样
|
||||
if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
|
||||
// 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
|
||||
if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
|
||||
basicModel.setResult(result);
|
||||
mav.setModel(basicModel);
|
||||
return mav;
|
||||
}
|
||||
//有市辖建制镇, 或者城市不一样 用我们
|
||||
if (result.containsKey("city")) {
|
||||
if ("是".equals(result.get("administrativeTowns")) || (!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
|
||||
basicModel.setResult(result);
|
||||
} else {
|
||||
map.put("addrVerify", "地址有效");
|
||||
map.put("addrArea", addrArea(map, type));
|
||||
map.put("countyLevelCity", countyLevelCity(map));
|
||||
map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
basicModel.setResult(map);
|
||||
}
|
||||
} else {
|
||||
map.put("addrVerify", "地址有效");
|
||||
map.put("addrArea", addrArea(map, type));
|
||||
map.put("countyLevelCity", countyLevelCity(map));
|
||||
map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
basicModel.setResult(map);
|
||||
}
|
||||
|
||||
} else {
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
} else {
|
||||
basicModel.setResult(result);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
if (!result.containsKey("verifyFlag") || StringUtils.isBlank(result.getString("verifyFlag"))) {
|
||||
basicModel.markNoData();
|
||||
}
|
||||
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
@@ -1732,4 +1727,12 @@ public class AddrSvcController {
|
||||
public void setVillageIdentifyService(VillageIdentifyService villageIdentifyService) {
|
||||
this.villageIdentifyService = villageIdentifyService;
|
||||
}
|
||||
|
||||
public void setDistrictAnalyDataService(DistrictAnalyDataService districtAnalyDataService) {
|
||||
this.districtAnalyDataService = districtAnalyDataService;
|
||||
}
|
||||
|
||||
public void setTownshipService(TownshipService townshipService) {
|
||||
this.townshipService = townshipService;
|
||||
}
|
||||
}
|
||||
|
||||
+59
-42
@@ -1,7 +1,11 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.open.model.*;
|
||||
import com.fangjia.service.address.mode.Address;
|
||||
import com.fangjia.service.datastore.CommunityRateService;
|
||||
import com.sun.xml.bind.v2.TODO;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
@@ -25,10 +29,6 @@ import com.fangjia.dal.SrQuery;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.AddressCheck;
|
||||
import com.fangjia.dal.mongo.model.CommData;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.RegionBlock;
|
||||
import com.fangjia.dal.mongo.open.model.WaitCrawlKeywords;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.APIConstant;
|
||||
@@ -96,6 +96,7 @@ public class AddressController {
|
||||
private HouseLoudongService houseLoudongService;
|
||||
private FjtEvaluationService fjtEvaluationService;
|
||||
private AddressMatchProxyService addressMatchProxyService;
|
||||
private CommunityRateService communityRateService;
|
||||
|
||||
private final static String AK = OpenConfig.getConfig().getBaiduAk();
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(AddressController.class);
|
||||
@@ -2090,8 +2091,8 @@ public class AddressController {
|
||||
public Object communitySummaryAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getId())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址和id不能同时为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@@ -2108,6 +2109,7 @@ public class AddressController {
|
||||
reqBody.put("maxFloor", model.getMaxFloor());
|
||||
reqBody.put("housePurpose", model.getHousePurpose());
|
||||
reqBody.put("memo", model.getMemo());
|
||||
reqBody.put("seaweedId", model.getId());
|
||||
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/communitySummary", reqBody, headers, "UTF-8");
|
||||
if (result != null) {
|
||||
@@ -2141,48 +2143,58 @@ public class AddressController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object propertyRatingAction(CommunitySummaryRequestDto model) {
|
||||
|
||||
public Object propertyRatingAction(CommunitySummaryRequestDto model){
|
||||
// type:all 输出所有字段,否则只输出文档中的字段
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getId())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("小区ID或地址不能为空"));
|
||||
return mav;
|
||||
BasicModel resultModel = new BasicModel(HttpStatusCodeEnum.OK);
|
||||
String city = model.getCity();
|
||||
String address = model.getAddress();
|
||||
String id = model.getId();
|
||||
// 借用原有字段 memo :备注 当 memo 为all的时候输出全部字段,默认输出文档中的字段
|
||||
String memo = model.getMemo();
|
||||
|
||||
//TODO 根据城市和地址查询
|
||||
if ((StringUtils.isBlank(city) && StringUtils.isBlank(address) || StringUtils.isBlank(id))) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("需要小区ID或者城市+地址参数组合"));
|
||||
}
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
try {
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
reqBody.put("city", model.getCity());
|
||||
reqBody.put("address", model.getAddress());
|
||||
reqBody.put("id", model.getId());
|
||||
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/propertyRating", reqBody, headers, "UTF-8");
|
||||
if (result != null) {
|
||||
try {
|
||||
json = JSONObject.fromObject(result);
|
||||
} catch (Exception e) {
|
||||
json = null;
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
CommunityRate communityRate = communityRateService.findBySeeweadId(id);
|
||||
if (communityRate != null) {
|
||||
if ("all".equals(memo)) {
|
||||
// 为all的时候输出全部字段
|
||||
resultModel.setResult(communityRate);
|
||||
}else {
|
||||
// 默认输出文档中的字段
|
||||
CommunityRate communityRateResult = new CommunityRate();
|
||||
communityRateResult.setCity(communityRate.getCity());
|
||||
communityRateResult.setAddress(communityRate.getAddress());
|
||||
communityRateResult.setAvgPrice(communityRate.getAvgPrice());
|
||||
communityRateResult.setName(communityRate.getName());
|
||||
communityRateResult.setRating(communityRate.getRating());
|
||||
communityRateResult.setTotalScore(communityRate.getTotalScore());
|
||||
communityRateResult.setCommunityQualityRating(communityRate.getCommunityQualityRating());
|
||||
communityRateResult.setCommunityQualityScore(communityRate.getCommunityQualityScore());
|
||||
communityRateResult.setCommunityPriceRating(communityRate.getCommunityPriceRating());
|
||||
communityRateResult.setCommunityPriceScore(communityRate.getCommunityPriceScore());
|
||||
communityRateResult.setLocationAdvantageRating(communityRate.getLocationAdvantageRating());
|
||||
communityRateResult.setLocationAdvantageScore(communityRate.getLocationAdvantageScore());
|
||||
communityRateResult.setFlowabilityRating(communityRate.getFlowabilityRating());
|
||||
communityRateResult.setFlowabilityScore(communityRate.getFlowabilityScore());
|
||||
communityRateResult.setLivingFacilitiesRating(communityRate.getLivingFacilitiesRating());
|
||||
communityRateResult.setLivingFacilitiesScore(communityRate.getLivingFacilitiesScore());
|
||||
communityRateResult.setEducationRating(communityRate.getEducationRating());
|
||||
communityRateResult.setEducationScore(communityRate.getEducationScore());
|
||||
communityRateResult.setHospitalRating(communityRate.getHospitalRating());
|
||||
communityRateResult.setHospitalScore(communityRate.getHospitalScore());
|
||||
resultModel.setResult(communityRateResult);
|
||||
}
|
||||
mav.setModel(resultModel);
|
||||
}else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("未找到该小区"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
basicModel.setResult(json.get("result"));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
return mav;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3455,6 +3467,7 @@ public class AddressController {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
public void setAddressService(AddressService addressService) {
|
||||
this.addressService = addressService;
|
||||
}
|
||||
@@ -3510,4 +3523,8 @@ public class AddressController {
|
||||
public void setAddressMatchProxyService(AddressMatchProxyService addressMatchProxyService) {
|
||||
this.addressMatchProxyService = addressMatchProxyService;
|
||||
}
|
||||
|
||||
public void setCommunityRateService(CommunityRateService communityRateService) {
|
||||
this.communityRateService = communityRateService;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-49
@@ -452,18 +452,18 @@ public class CityController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object avgPrice2Action(@Param(name = "city") String city, @Param(name = "periodCount") Integer periodCount,@Param(name = "periodType") String periodType) {
|
||||
public Object avgPrice2Action(@Param(name = "city") String city, @Param(name = "periodCount") Integer periodCount) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if(!RegionData.isCity(city)){
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if(StringUtils.isNotBlank(formatCity)){
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
}else{
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
@@ -473,57 +473,41 @@ public class CityController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
if(null == periodCount || 0 == periodCount){
|
||||
periodCount = 1;
|
||||
}
|
||||
if(periodCount < 1 || periodCount>156){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-156]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(periodType)){
|
||||
periodType = "weekly";
|
||||
}else{
|
||||
if(!"weekly".equals(periodType) && !"monthly".equals(periodType)){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodModel值非法,合法值为:weekly,monthly"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
if("weekly".equals(periodType)){
|
||||
calendar.add(Calendar.DATE, -periodCount*7);
|
||||
}else{
|
||||
calendar.add(Calendar.MONTH, -periodCount);
|
||||
}
|
||||
|
||||
List<RegionStat> regionStats = regionStatService.findRegionBlockStat(city,null,null,calendar.getTime(),new Date(),periodType);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
if (null == periodCount || 0 == periodCount) {
|
||||
periodCount = 1;
|
||||
}
|
||||
if (periodCount < 1 || periodCount > 36) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-36]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.MONTH, -periodCount);
|
||||
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH) + 1; // 注意:月份从 0 开始,需要加 1
|
||||
int montyInt = year * 100 + month;
|
||||
List<CitySellStat> cityStats = citySellStatService.findNearCityStat(city, montyInt, periodCount);
|
||||
if (CollectionUtils.isEmpty(cityStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if(regionStats.size() > periodCount){
|
||||
regionStats = regionStats.subList(regionStats.size() - periodCount,regionStats.size());
|
||||
}
|
||||
List<Map<String,Object>> result = new ArrayList<Map<String,Object>>(periodCount);
|
||||
for (RegionStat regionStat : regionStats) {
|
||||
Map<String,Object> item = new LinkedHashMap<String,Object>();
|
||||
item.put("city", regionStat.getCity());
|
||||
item.put("avgPrice", String.valueOf(regionStat.getAvgPrice()));
|
||||
if("monthly".equals(periodType)){
|
||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM"));
|
||||
}else{
|
||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM-dd"));
|
||||
}
|
||||
item.put("changePercent", String.valueOf(regionStat.getMarkup() / 100d));
|
||||
result.add(item);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
if (cityStats.size() > periodCount) {
|
||||
cityStats = cityStats.subList(cityStats.size() - periodCount, cityStats.size());
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(periodCount);
|
||||
for (CitySellStat cityStat : cityStats) {
|
||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||
item.put("city", cityStat.getCity());
|
||||
item.put("avgPrice", String.valueOf(cityStat.getAvgPrice()));
|
||||
item.put("date", cityStat.getDate() / 100 + "-" + String.format("%02d", cityStat.getDate() % 100));
|
||||
item.put("changePercent", String.format("%.2f", cityStat.getMom() * 100));
|
||||
result.add(item);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 城市均价范围Action
|
||||
*
|
||||
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.AvmUrls;
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.HttpRequestException;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.AddesssMatchModel;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.CommercialModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 商业地产
|
||||
*
|
||||
* @since 2025/9/16
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public class CommercialController {
|
||||
|
||||
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区","村庄");
|
||||
|
||||
public Object shopSellEvaluateAction(CommercialModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("avgPrice", Long.valueOf(json.getString("unitPrice")));
|
||||
resultMap.put("totalPrice", Long.valueOf(json.getString("totalPrice")));
|
||||
|
||||
if (model.getShowSample()!=null && model.getShowSample()==1 && json.containsKey("case")) {
|
||||
resultMap.put("samples", json.get("case"));
|
||||
}
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultMap));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object shopSellSampleAction(CommercialModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
List<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
|
||||
if (json.containsKey("case")) {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(json.get("case")));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object shopRentEvaluateAction(CommercialModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("avgPrice", Long.valueOf(json.getString("unitPrice")));
|
||||
resultMap.put("totalPrice", Long.valueOf(json.getString("totalPrice")));
|
||||
|
||||
if (model.getShowSample()!=null && model.getShowSample()==1 && json.containsKey("case")) {
|
||||
resultMap.put("samples", json.get("case"));
|
||||
}
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultMap));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object shopRentSampleAction(CommercialModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
List<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
|
||||
if (json.containsKey("case")) {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(json.get("case")));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private RestfulModelAndView checkParmas(CommercialModel model, RestfulModelAndView mav){
|
||||
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getLocation())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:地址或经纬度不为空"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getSize()==null || model.getEstateType()==null ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:面积,商铺类型为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getPassengerFlow() != null && (model.getPassengerFlow() <0 || model.getPassengerFlow() > 2)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("客流量取值非法,正确范围[0,2]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getLeaseStability() != null && (model.getLeaseStability() <0 || model.getLeaseStability() > 3)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("租约稳定性取值非法,正确范围[0,3]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getSellType()!= null && (model.getSellType() <0 || model.getSellType() > 1)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("出售方式取值非法,正确范围[0,1]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getEstateType()!= null && (model.getEstateType() <0 || model.getEstateType() > 7)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("商铺类型取值非法,正确范围[0,7]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getDecorationCost()!=null && (model.getDecorationCost() <0 || model.getDecorationCost() > 1000)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("商铺装修费用取值非法,正确范围[0,1000]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getDecorationYear()!=null && (model.getDecorationYear() <0 || model.getDecorationYear() > 50)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("商铺装修年限取值非法,正确范围[0,50]"));
|
||||
return mav;
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
private JSONObject locationEvaluateApi(CommercialModel model, String uri){
|
||||
//商铺类型---0:临街商铺 1:住宅底商 2:购物百货中心 3:写字楼商铺 4:档口摊位 5:市场类商铺 6:交通设施商铺 7:旅游商铺
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
if(StringUtils.isNotBlank(model.getAddress())){
|
||||
params.put("address", model.getAddress());
|
||||
}
|
||||
if(StringUtils.isNotBlank(model.getLocation())){
|
||||
params.put("location", model.getLocation());
|
||||
}
|
||||
|
||||
params.put("area", String.valueOf(model.getSize()));
|
||||
params.put("estateType", String.valueOf(model.getEstateType()));
|
||||
|
||||
if(model.getPassengerFlow()!=null){
|
||||
params.put("passengerFlow", String.valueOf(model.getPassengerFlow()));
|
||||
}
|
||||
if(model.getLeaseStability()!=null){
|
||||
params.put("leaseStability", String.valueOf(model.getLeaseStability()));
|
||||
}
|
||||
if(model.getSellType()!=null){
|
||||
params.put("sellType", String.valueOf(model.getSellType()));
|
||||
}
|
||||
|
||||
if(model.getDecorationCost()!=null){
|
||||
params.put("decorationCost", String.valueOf(model.getDecorationCost()));
|
||||
}
|
||||
if(model.getDecorationYear()!=null){
|
||||
params.put("decorationYear", String.valueOf(model.getDecorationYear()));
|
||||
}
|
||||
|
||||
if(model.getFloor()!=null){
|
||||
params.put("floor", String.valueOf(model.getFloor()));
|
||||
}
|
||||
|
||||
if(model.getMaxFloor()!=null){
|
||||
params.put("height", String.valueOf(model.getMaxFloor()));
|
||||
}
|
||||
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:30020"+ uri, params, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:30020"+ uri, params, "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
+43
-19
@@ -1,9 +1,8 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.mongo.model.AdministrativeDivision;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.AdministrativeDivision;
|
||||
import com.fangjia.dal.mongo.model.ApiUserCfg;
|
||||
import com.fangjia.dal.mongo.model.DistrictFacilitys;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
@@ -17,7 +16,10 @@ import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.*;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.HouseInfomationModel;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.CommonDtoUtils;
|
||||
import com.fangjia.open.util.CommonUtils;
|
||||
import com.fangjia.open.ws.query.SampleQuery;
|
||||
@@ -26,9 +28,13 @@ import com.fangjia.service.api.ApiUserCfgService;
|
||||
import com.fangjia.service.bo.Collateral;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.fangjia.service.bo.Sample;
|
||||
import com.fangjia.service.datastore.*;
|
||||
import com.fangjia.service.datastore.CzbankSampleService;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.OpenApiLogService;
|
||||
import com.fangjia.service.datastore.bean.CollateralSampleQueryBean;
|
||||
import com.fangjia.service.district.*;
|
||||
import com.fangjia.service.district.DistrictFacilitysService;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseLoudongService;
|
||||
import com.fangjia.service.mongo.bkoff.LoudongService;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
@@ -90,6 +96,8 @@ public class ComprehensiveQueryController {
|
||||
|
||||
private EvaluateRatioService evaluateRatioService;
|
||||
|
||||
private AdministrativeMappingService administrativeMappingService;
|
||||
|
||||
private static final int EVALUATE_SHOW_DETAIL = 1;
|
||||
private static final Map<String, String> PROPERTY_TYPES = new HashMap<String, String>() {
|
||||
{
|
||||
@@ -215,7 +223,7 @@ public class ComprehensiveQueryController {
|
||||
HouseValueInformationDto houseValueInformation = new HouseValueInformationDto();
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
|
||||
if (StringUtils.isBlank(model.getAddress()) || StringUtils.isBlank(String.valueOf(model.getSize()))) {
|
||||
if (StringUtils.isBlank(model.getAddress()) || model.getSize() == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址(address),面积(size)为必填字段"));
|
||||
return mav;
|
||||
}
|
||||
@@ -226,19 +234,22 @@ public class ComprehensiveQueryController {
|
||||
}
|
||||
|
||||
String cityStr = model.getCity();
|
||||
if (StringUtils.isNotBlank(cityStr) && cityStr.matches("\\d+")) {
|
||||
AdministrativeDivision administrativeDivision = administrativeDivisionService.findcityByCode(cityStr);
|
||||
if (administrativeDivision == null) {
|
||||
String districtStr = model.getDistrict();
|
||||
String cityShort = model.getCity();
|
||||
if (StringUtils.isNotBlank(cityStr) && cityStr.matches("\\d+") && StringUtils.isBlank(districtStr)) {
|
||||
cityShort = administrativeMappingService.findCityShortByCityCode(cityStr);
|
||||
if (StringUtils.isBlank(cityShort)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
|
||||
return mav;
|
||||
}
|
||||
String city = administrativeDivision.getCityShort();
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("³ÇÊдúÂë´íÎó"));
|
||||
} else if (StringUtils.isNotBlank(districtStr) && districtStr.matches("\\d+")) {
|
||||
cityShort = administrativeMappingService.findDistrictShortByDistrictCode(cityStr, districtStr);
|
||||
if (StringUtils.isBlank(cityShort)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("ÇøÏØ´úÂë´íÎó"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(city);
|
||||
}
|
||||
model.setCity(cityShort);
|
||||
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
@@ -248,16 +259,18 @@ public class ComprehensiveQueryController {
|
||||
communityAvgPriceParams.put("category", "district");
|
||||
communityAvgPriceParams.put("useMap", "true");
|
||||
communityAvgPriceParams.put("suggestName", String.valueOf(model.getName()));
|
||||
communityAvgPriceParams.put("preciseLevel", "strict");
|
||||
// communityAvgPriceParams.put("preciseLevel", "strict");
|
||||
communityAvgPriceParams.put("propertyType", model.getPropertyType());
|
||||
communityAvgPriceParams.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB");
|
||||
JSONObject matchResponse = null;
|
||||
try {
|
||||
matchResponse = httpRequest.getJsonContent("http://open.fangjia.com/address/match", communityAvgPriceParams, "UTF-8");
|
||||
// matchResponse = httpRequest.getJsonContent("http://192.168.0.19:31080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8");
|
||||
} catch (HttpRequestException e) {
|
||||
} catch (
|
||||
HttpRequestException e) {
|
||||
|
||||
}
|
||||
|
||||
// 去掉经纬度解析
|
||||
// if (matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
|
||||
// //加上高德获取经纬度 和 根据经纬度估值
|
||||
@@ -293,12 +306,14 @@ public class ComprehensiveQueryController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String id = matchResponse.getJSONObject("result").getString("id");
|
||||
District district = districtService.findById(id);
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, matchResponse.getJSONObject("result"));
|
||||
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district));
|
||||
if (null != statBo) {
|
||||
@@ -350,7 +365,8 @@ public class ComprehensiveQueryController {
|
||||
propertyEvaluationModel.setName(district.getName());
|
||||
try {
|
||||
evaluateAction(propertyEvaluationModel, httpServletRequest, houseValueInformation, mav);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (
|
||||
IllegalAccessException e) {
|
||||
|
||||
}
|
||||
// 价格下调10%
|
||||
@@ -370,17 +386,19 @@ public class ComprehensiveQueryController {
|
||||
sampleQuery.setStrctureArea(model.getSize());
|
||||
sampleQuery.setAddress(model.getAddress());
|
||||
|
||||
// RestfulModelAndView houseCaseMav = new RestfulModelAndView();
|
||||
// RestfulModelAndView houseCaseMav = new RestfulModelAndView();
|
||||
List<CollateralSampleQueryBean> querys = null;
|
||||
try {
|
||||
querys = convertSampileQueryToBean(district, sampleQuery);
|
||||
} catch (Exception e) {
|
||||
} catch (
|
||||
Exception e) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel(e.getMessage()));
|
||||
return mav;
|
||||
}
|
||||
if (null == sampleQuery.getMax()) {
|
||||
sampleQuery.setMax(10);
|
||||
}
|
||||
|
||||
// 此处慢
|
||||
long start = System.currentTimeMillis();
|
||||
List<Collateral> collaterals = czbankSampleService.findSampleForBse(querys, sampleQuery.getMax());
|
||||
@@ -432,7 +450,9 @@ public class ComprehensiveQueryController {
|
||||
}
|
||||
// 将周边POI数据放到结果集
|
||||
houseValueInformation.setSurroundingPoi(facilitys);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation));
|
||||
mav.setModel(BasicModel.buildOKModel().
|
||||
|
||||
setResult(houseValueInformation));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@@ -1388,5 +1408,9 @@ public class ComprehensiveQueryController {
|
||||
public void setAdministrativeDivisionService(AdministrativeDivisionService administrativeDivisionService) {
|
||||
this.administrativeDivisionService = administrativeDivisionService;
|
||||
}
|
||||
|
||||
public void setAdministrativeMappingService(AdministrativeMappingService administrativeMappingService) {
|
||||
this.administrativeMappingService = administrativeMappingService;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.ThreadLocalData;
|
||||
import com.fangjia.core.util.ThreadLocalKey;
|
||||
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
|
||||
@@ -24,6 +25,7 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -55,6 +57,13 @@ public class Controller {
|
||||
return mav;
|
||||
}
|
||||
|
||||
@Authority(role = Role.NONE)
|
||||
public Object ipAction(HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(UniversalDto.newDto().append("ip", AnalyticsUtil.getIpAddress(request))));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存刷新接口
|
||||
*
|
||||
|
||||
+27
-35
@@ -17,10 +17,8 @@ import com.fangjia.service.datastore.RegionStatService;
|
||||
import com.fangjia.service.district.DistrictFacilitysService;
|
||||
import com.fangjia.service.district.DistrictStatRentService;
|
||||
import com.fangjia.service.district.RegionStatRentService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageAnalyService;
|
||||
import com.fangjia.service.mongo.fangjia.RegionBlockService;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
|
||||
import com.fangjia.service.mongo.fangjia.SeaweedImagesService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONException;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -69,7 +67,6 @@ import com.fangjia.service.index.BoostQueryPolicy;
|
||||
import com.fangjia.service.menu.Menu;
|
||||
import com.fangjia.service.menu.MenuCategoryEnum;
|
||||
import com.fangjia.service.mongo.bkoff.ExtractDistrictService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictHouseService;
|
||||
import com.fangjia.service.open.DistrictBo;
|
||||
import com.fangjia.service.sql.ApiUserService;
|
||||
import com.fangjia.service.web.MenuService;
|
||||
@@ -94,6 +91,7 @@ public class DistrictController {
|
||||
private RegionStatRentService regionStatRentService;
|
||||
private DistrictFacilitysService districtFacilitysService;
|
||||
private SeaweedImagesService seaweedImagesService;
|
||||
private RegionStatTrendService regionStatTrendService;
|
||||
|
||||
|
||||
public static final String[] COLUMNS = {"id", "name", "estateType", "buildType", "licence", "buildArea", "allArea",
|
||||
@@ -692,42 +690,30 @@ public class DistrictController {
|
||||
if (model.getPeriodCount() == null) {
|
||||
model.setPeriodCount(1);
|
||||
}
|
||||
if (model.getPeriodCount() < 1 || model.getPeriodCount() > 156) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-156]"));
|
||||
if (model.getPeriodCount() < 1 || model.getPeriodCount() > 36) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-36]"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(model.getPeriodType())) {
|
||||
model.setPeriodType("weekly");
|
||||
} else {
|
||||
if (!"weekly".equals(model.getPeriodType()) && !"monthly".equals(model.getPeriodType())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("periodModel值非法,合法值为:weekly,monthly"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
if ("weekly".equals(model.getPeriodType())) {
|
||||
calendar.add(Calendar.DATE, -model.getPeriodCount().intValue() * 7);
|
||||
} else {
|
||||
calendar.add(Calendar.MONTH, -model.getPeriodCount().intValue());
|
||||
}
|
||||
List<RegionStat> regionStats = regionStatService.findRegionBlockStat(model.getCity(), model.getDistrict(), null, calendar.getTime(), new Date(), model.getPeriodType());
|
||||
if (regionStats.size() > model.getPeriodCount()) {
|
||||
regionStats = regionStats.subList(regionStats.size() - model.getPeriodCount(), regionStats.size());
|
||||
calendar.add(Calendar.MONTH, -model.getPeriodCount());
|
||||
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH) + 1; // 注意:月份从 0 开始,需要加 1
|
||||
int montyInt = year * 100 + month;
|
||||
List<RegionStatTrend> datas = regionStatTrendService.getAllWithMonths(model.getCity(), region, model.getPeriodCount());
|
||||
|
||||
if (datas.size() > model.getPeriodCount()) {
|
||||
datas = datas.subList(datas.size() - model.getPeriodCount(), datas.size());
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
|
||||
for (RegionStat regionStat : regionStats) {
|
||||
for (RegionStatTrend regionStat : datas) {
|
||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||
item.put("city", regionStat.getCity());
|
||||
item.put("district", regionStat.getRegion());
|
||||
item.put("block", regionStat.getBlock());
|
||||
item.put("avgPrice", String.valueOf(regionStat.getAvgPrice()));
|
||||
if ("monthly".equals(model.getPeriodType())) {
|
||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM"));
|
||||
} else {
|
||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM-dd"));
|
||||
}
|
||||
item.put("changePercent", String.valueOf(regionStat.getMarkup() / 100d));
|
||||
item.put("date", regionStat.getDate() / 100 + "-" + String.format("%02d", regionStat.getDate() % 100));
|
||||
item.put("changePercent", String.format("%.2f", regionStat.getMom() * 100));
|
||||
result.add(item);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
@@ -1186,7 +1172,7 @@ public class DistrictController {
|
||||
data.put("bus", model.getBus());
|
||||
data.put("bank", model.getBank());
|
||||
data.put("atm", model.getAtm());
|
||||
data.put("metro",model.getMetro());
|
||||
data.put("metro", model.getMetro());
|
||||
districtService.updateDistrictFacilitysById(data, model.getId());
|
||||
} else {
|
||||
DistrictFacilitys districtFacilitys = CommonDtoUtils.transformV(DistrictFacilitys.class, model);
|
||||
@@ -1199,7 +1185,7 @@ public class DistrictController {
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (value != null && !value.isEmpty()) {
|
||||
value = value.replaceAll("\\[", "").replaceAll("]", "").replaceAll(" ","");
|
||||
value = value.replaceAll("\\[", "").replaceAll("]", "").replaceAll(" ", "");
|
||||
String[] splitValues = value.split(","); // 按逗号分割
|
||||
|
||||
// 遍历数组并过滤空字符串
|
||||
@@ -1285,6 +1271,7 @@ public class DistrictController {
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object deletePicAction(DistrictModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
@@ -1292,21 +1279,22 @@ public class DistrictController {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
||||
return mav;
|
||||
}
|
||||
seaweedImagesService.deleteImage(model.getId(),model.getUrl(),model.getPicType(), model.getRoomType());
|
||||
seaweedImagesService.deleteImage(model.getId(), model.getUrl(), model.getPicType(), model.getRoomType());
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "删除成功"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object addPicAction(DistrictModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (model.getImageUrls()!=null){
|
||||
if (model.getImageUrls() != null) {
|
||||
model.setImageUrls(convertToList(model.getImageUrls().toString()));
|
||||
}
|
||||
if (StringUtils.isBlank(model.getId())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
||||
return mav;
|
||||
}
|
||||
seaweedImagesService.addImage(model.getId(),model.getImageUrls(),model.getPicType(), model.getRoomType());
|
||||
seaweedImagesService.addImage(model.getId(), model.getImageUrls(), model.getPicType(), model.getRoomType());
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "添加成功"));
|
||||
return mav;
|
||||
}
|
||||
@@ -1435,4 +1423,8 @@ public class DistrictController {
|
||||
public void setSeaweedImagesService(SeaweedImagesService seaweedImagesService) {
|
||||
this.seaweedImagesService = seaweedImagesService;
|
||||
}
|
||||
|
||||
public void setRegionStatTrendService(RegionStatTrendService regionStatTrendService) {
|
||||
this.regionStatTrendService = regionStatTrendService;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -71,7 +71,8 @@ public class FilesController {
|
||||
if(StringUtils.isNotBlank(model.getFilename())){
|
||||
filename = model.getFilename();
|
||||
}
|
||||
GridFSInputFile gridFSInputFile = fileDao.saveToGridFs(file.getInputStream(), filename, contentType);
|
||||
String type = model.getType();
|
||||
GridFSInputFile gridFSInputFile = fileDao.saveToGridFs(file.getInputStream(), filename, contentType, type);
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
if(OpenConfig.getConfig().isProductionEnvironment()){
|
||||
dto.append("link", "http://static.fangjia.com/stc/files/" + gridFSInputFile.get("_id").toString());
|
||||
|
||||
+3
-187
@@ -6,28 +6,9 @@ import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.AddressModel;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Authenticator;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -101,17 +82,12 @@ public class GdBankController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("µØÖ·²»ÄÜΪ¿Õ"));
|
||||
return mav;
|
||||
}
|
||||
String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null;
|
||||
String address = model.getAddress();
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
|
||||
//params.put("type", type);
|
||||
//params.put("redis", (model.getRadius() != null && model.getRadius() != 0) ? model.getRadius().toString() : null);
|
||||
params.put("address", model.getAddress());
|
||||
//params.put("showFullValue", "2");
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
@@ -126,69 +102,11 @@ public class GdBankController {
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if (json.containsKey("result")) {
|
||||
//我们的结果
|
||||
JSONObject result = json.getJSONObject("result");
|
||||
//我们省级及以上有开发区,直接用我们的结果
|
||||
if (!result.containsKey("verifyFlag") || StringUtils.isBlank(result.getString("verifyFlag"))) {
|
||||
basicModel.markNoData();
|
||||
}
|
||||
basicModel.setResult(result);
|
||||
// if (result.containsKey("devDistrictName")) {
|
||||
// } else {
|
||||
// try {
|
||||
// // 我们是县政府,且涉农结果为农,取我们结果,因为光大部分逻辑调整
|
||||
// if ("是".equals(result.get("countyGov")) && "农".equals(result.get("verifyFlag"))) {
|
||||
// basicModel.setResult(result);
|
||||
// mav.setModel(basicModel);
|
||||
// return mav;
|
||||
// }
|
||||
// //如果是江苏省或者浙江省 调用齐梁的结果
|
||||
// if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
|
||||
// //结果比较,如果涉农结果不一致
|
||||
// //调用齐梁 type :1 对公 0 对私
|
||||
// //我们 type :1 对私 2 对共
|
||||
// String qltype = "2".equals(type) ? "1" : "0";
|
||||
// Map<String, String> map = senRequest(address, qltype);
|
||||
// // 涉农结果不一样
|
||||
// if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
|
||||
// // 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
|
||||
// if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
|
||||
// basicModel.setResult(result);
|
||||
// mav.setModel(basicModel);
|
||||
// return mav;
|
||||
// }
|
||||
// //城市不一样 用我们
|
||||
// if (result.containsKey("city")) {
|
||||
// if ((!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
|
||||
// basicModel.setResult(result);
|
||||
// } else {
|
||||
// map.put("addrVerify", "地址有效");
|
||||
// map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
// map.put("addrArea", addrArea(map, type));
|
||||
// map.put("countyLevelCity", countyLevelCity(map));
|
||||
// basicModel.setResult(map);
|
||||
// }
|
||||
// } else {
|
||||
// map.put("addrVerify", "地址有效");
|
||||
// map.put("typeName", areaMap.get(map.get("typeCode")));
|
||||
// map.put("addrArea", addrArea(map, type));
|
||||
// map.put("countyLevelCity", countyLevelCity(map));
|
||||
// basicModel.setResult(map);
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// basicModel.setResult(result);
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// basicModel.setResult(result);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// basicModel.setResult(result);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
@@ -197,106 +115,4 @@ public class GdBankController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
private static Map<String, String> senRequest(String address, String type) throws IOException {
|
||||
String targetURL = "http://146.56.217.44:9010/uams/farmer/all/v3/sign";
|
||||
String proxyHost = "tunnel2.qg.net";
|
||||
int proxyPort = 14186;
|
||||
final String proxyUsername = "113BBC06";
|
||||
final String proxyPassword = "3B2FBD05B0AF";
|
||||
String jsonData = "{\"address\":\"" + address + "\",\"type\":\"" + type + "\"}";
|
||||
String authKey = proxyUsername;
|
||||
String password = proxyPassword;
|
||||
String auth = authKey + ":" + password;
|
||||
String authHeader = "Basic " + new BASE64Encoder().encode(auth.getBytes(Charset.forName("UTF-8")));
|
||||
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(targetURL);
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
|
||||
}
|
||||
});
|
||||
httpPost.setHeader("Content-Type", "application/json");
|
||||
httpPost.setHeader("Accept", "*/*");
|
||||
httpPost.setHeader("Host", "146.56.217.44:9010");
|
||||
httpPost.setHeader("Proxy-Authorization", authHeader);
|
||||
StringEntity stringEntity = new StringEntity(jsonData, ContentType.APPLICATION_JSON);
|
||||
httpPost.setEntity(stringEntity);
|
||||
|
||||
CloseableHttpResponse httpResponse = null;
|
||||
int retryCount = 2; // 设置重试次数
|
||||
int retryDelay = 10; // 设置重试延迟时间(毫秒)
|
||||
boolean success = false;
|
||||
for (int i = 0; i < retryCount; i++) {
|
||||
try {
|
||||
httpResponse = httpClient.execute(httpPost);
|
||||
success = true;
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
System.err.println("代理请求失败,进行重试...");
|
||||
try {
|
||||
Thread.sleep(retryDelay);
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
HttpEntity responseEntity = httpResponse.getEntity();
|
||||
String responseString = EntityUtils.toString(responseEntity);
|
||||
|
||||
// 使用 Gson 解析 JSON 字符串
|
||||
Gson gson = new Gson();
|
||||
JsonObject jsonObject = gson.fromJson(responseString, JsonObject.class);
|
||||
|
||||
|
||||
// 创建 Map 存储各个值
|
||||
Map<String, String> dataMap = new HashMap<String, String>();
|
||||
|
||||
// 获取各个值并放入 Map
|
||||
// dataMap.put("code", jsonObject.get("code").getAsString());
|
||||
// dataMap.put("msg", jsonObject.get("msg").getAsString());
|
||||
JsonElement dataElement = jsonObject.get("data");
|
||||
if (dataElement != null && !dataElement.isJsonNull() && dataElement.isJsonObject()) {
|
||||
JsonObject data = dataElement.getAsJsonObject();
|
||||
// 在这里继续处理 data 对象
|
||||
|
||||
if (data != null && !data.isJsonNull()) {
|
||||
|
||||
// dataMap.put("version", data.get("version").getAsString());
|
||||
dataMap.put("province", data.get("province").getAsString());
|
||||
dataMap.put("city", data.get("city").getAsString());
|
||||
dataMap.put("district", data.get("district").getAsString());
|
||||
dataMap.put("town", data.get("town").getAsString());
|
||||
dataMap.put("committee", data.get("village").getAsString());
|
||||
dataMap.put("provinceCode", data.get("provinceCode").getAsString());
|
||||
dataMap.put("cityCode", data.get("cityCode").getAsString());
|
||||
dataMap.put("districtCode", data.get("districtCode").getAsString());
|
||||
dataMap.put("townCode", data.get("townCode").getAsString());
|
||||
dataMap.put("committeeCode", data.get("villageCode").getAsString());
|
||||
dataMap.put("typeCode", data.get("areaCode").getAsString());
|
||||
dataMap.put("verifyFlag", "0".equals(data.get("farmer").getAsString()) ? "非农" : "农");
|
||||
dataMap.put("countyGov", "0".equals(data.get("isGovt").getAsString()) ? "否" : "是");
|
||||
// dataMap.put("govtAddr", data.get("govtAddr").isJsonNull() ? null : data.get("govtAddr").getAsString()); // 对于可能为 null 的值,需要判断是否为空
|
||||
JsonArray indusParkList = data.get("indusParkList").isJsonNull() ? null : data.get("indusParkList").getAsJsonArray();
|
||||
|
||||
if (indusParkList != null) {
|
||||
JsonObject jsonObject1 = gson.fromJson(indusParkList.get(0), JsonObject.class);
|
||||
dataMap.put("devDistrictName", jsonObject1.get("indusParkName").getAsString());
|
||||
dataMap.put("devDistrict", "是");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse.close();
|
||||
return dataMap;
|
||||
} else {
|
||||
System.err.println("重试次数已用完,请求失败。");
|
||||
}
|
||||
|
||||
httpClient.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+98
-11
@@ -295,12 +295,20 @@ public class HouseController {
|
||||
CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
|
||||
BeanUtils.copyProperties(q, queryBean);
|
||||
String city = queryBean.getCity();
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(q.getDistrict());
|
||||
if (fangjiaOfficialAreaMap == null) {
|
||||
throw new Exception("地区信息无法映射到房价网的地区信息->(province:" + q.getProvince() + " ,city: " + q.getCity() + " ,district: " + q.getDistrict() + ")");
|
||||
if(StringUtils.isNotBlank(q.getDistrict())){
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(q.getDistrict());
|
||||
if (fangjiaOfficialAreaMap == null) {
|
||||
throw new Exception("地区信息无法映射到房价网的地区信息->(province:" + q.getProvince() + " ,city: " + q.getCity() + " ,district: " + q.getDistrict() + ")");
|
||||
}
|
||||
queryBean.setFangjiaCity(fangjiaOfficialAreaMap.getFangjiaCity());
|
||||
queryBean.setFangjiaDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict());
|
||||
}else{
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjiaCity(q.getCity());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
throw new Exception("地区信息无法映射到房价网的地区信息->(province:" + q.getProvince() + " ,city: " + q.getCity());
|
||||
}
|
||||
queryBean.setFangjiaCity(fangjiaOfficialAreaMap.getFangjiaCity());
|
||||
}
|
||||
queryBean.setFangjiaCity(fangjiaOfficialAreaMap.getFangjiaCity());
|
||||
queryBean.setFangjiaDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict());
|
||||
|
||||
String propertyTypeCode = queryBean.getPropertyTypeCode();
|
||||
if (!PROPERTY_TYPE_CODE_LIST.contains(propertyTypeCode)) {
|
||||
@@ -900,6 +908,13 @@ public class HouseController {
|
||||
List<String> type2 = Arrays.asList("1", "0");
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
String city = model.getCity();
|
||||
String region = model.getRegion();
|
||||
String districtName = model.getName();
|
||||
if (StringUtils.isNotBlank(districtName) && (StringUtils.isBlank(city) || StringUtils.isBlank(region))) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city,region,name为一组参数"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLocationType()) && !type3.contains(model.getLocationType())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数(locationType)有误"));
|
||||
return mav;
|
||||
@@ -984,22 +999,25 @@ public class HouseController {
|
||||
cat = "shop_sell";
|
||||
}
|
||||
}
|
||||
List<Seawater> houses = null;
|
||||
List<Seawater> houses = new ArrayList<Seawater>();
|
||||
List<Seawater> houseSelf = new ArrayList<Seawater>();
|
||||
List<Seawater> houseAround = new ArrayList<Seawater>();
|
||||
List<Seawater> houseList = new ArrayList<Seawater>();
|
||||
// if (cat.contains("_")) {
|
||||
// 商铺,写字楼有经纬度,直接查
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
// 先用名字查自身的样本
|
||||
query.setCityDisplay(city);
|
||||
query.setRegion(region);
|
||||
query.setDistrictName(districtName);
|
||||
query.setCat(cat);
|
||||
query.setRadius(model.getRadius());
|
||||
query.setStartDate(model.getStartTime());
|
||||
query.setEndDate(model.getEndTime());
|
||||
|
||||
if (model.getSize() != null && model.getSize() != 0) {
|
||||
query.setStartArea(model.getSize() * 0.9);
|
||||
query.setEndArea(model.getSize() * 1.1);
|
||||
}
|
||||
query.setCityDisplay(model.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
if (model.getPageSize() != null && model.getPageSize() > 0) {
|
||||
@@ -1007,10 +1025,38 @@ public class HouseController {
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
}
|
||||
if (model.getPrice() != null) {
|
||||
query.setStartPrice((int) (model.getPrice() * 0.9));
|
||||
query.setEndPrice((int) (model.getPrice() * 1.1));
|
||||
}
|
||||
query.setPager(pager);
|
||||
query.setSortField("p_date");
|
||||
query.setOrder(false);
|
||||
query.setTable("latest_seawater");
|
||||
houses = seawaterDao.findSeawatersByQuery(query);
|
||||
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(districtName)) {
|
||||
houseSelf = seawaterDao.findSeawatersByQuery(query);
|
||||
houses.addAll(houseSelf);
|
||||
}
|
||||
// 如果自身样本数不够,再查周边
|
||||
if (houseSelf != null && houseSelf.size() < pager.getPageSize()) {
|
||||
query.setRegion(null);
|
||||
query.setDistrictName(null);
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
query.setRadius(model.getRadius());
|
||||
houseAround = seawaterDao.findSeawatersByQuery(query);
|
||||
houses.addAll(houseAround);
|
||||
}
|
||||
if (houses != null && !houses.isEmpty()) {
|
||||
Set<String> seenIds = new HashSet<String>();
|
||||
Iterator<Seawater> iterator = houses.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Seawater s = iterator.next();
|
||||
if (!seenIds.add(s.getId())) {
|
||||
// 如果已经存在,则从列表中移除
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
for (Seawater house : houses) {
|
||||
Seawater seawater = new Seawater();
|
||||
seawater.setId(house.getId());
|
||||
@@ -1087,6 +1133,47 @@ public class HouseController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object samplesNumAction(final HouseSearchModel model){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
// city region name 为必传参数
|
||||
String city = model.getCity();
|
||||
String region = model.getRegion();
|
||||
String name = model.getName();
|
||||
if (StringUtils.isBlank(city) || StringUtils.isBlank(region) || StringUtils.isBlank(name)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("城市(city),区域(region),小区名(name)为必填参数"));
|
||||
return mav;
|
||||
}
|
||||
Integer periodCount = model.getPeriodCount();
|
||||
if (periodCount == null || periodCount < 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数(periodCount)有误"));
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
|
||||
|
||||
Calendar endCal = Calendar.getInstance(); // 当前月
|
||||
int end = Integer.parseInt(sdf.format(endCal.getTime()));
|
||||
end = end * 100 + 31;
|
||||
|
||||
Calendar startCal = (Calendar) endCal.clone();
|
||||
startCal.add(Calendar.MONTH, -periodCount - 5); // 往前推 periodCount-5 个月,用于计算移动平均
|
||||
int start = Integer.parseInt(sdf.format(startCal.getTime()));
|
||||
start = start * 100 + 1;
|
||||
|
||||
String cat = model.getCat();
|
||||
List<Map<String, Object>> maps = seawaterDao.samplesNum(city, region, name, cat,periodCount, start, end, "", true);
|
||||
if (maps != null && maps.size() > 6) {
|
||||
maps = maps.subList(6, maps.size());
|
||||
} else {
|
||||
// 如果不足5个,直接清空或者根据需求处理
|
||||
maps = new ArrayList<Map<String,Object>>();
|
||||
}
|
||||
BasicModel basicModel = new BasicModel(200, "ok");
|
||||
basicModel.setResult(maps);
|
||||
mav.setModel(basicModel);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object rentAction(final HouseSearchModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
+21
-6
@@ -43,13 +43,28 @@ public class JnBankController {
|
||||
public Object searchAction(@Valid JNBankSearchModel model){
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDISTRICT_CD());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("错误的区划编码"));
|
||||
return mav;
|
||||
String city = null;
|
||||
String region = null;
|
||||
if(StringUtils.isNotBlank(model.getDISTRICT_CD())){
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDISTRICT_CD());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("错误的区划编码"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
city = fangjiaOfficialAreaMap.getFangjiaCity();
|
||||
region = fangjiaOfficialAreaMap.getFangjiaDistrict();
|
||||
}else{
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjiaCity(model.getCITY_CD());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("错误的城市编码"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
city = fangjiaOfficialAreaMap.getFangjiaCity();
|
||||
}
|
||||
String city = fangjiaOfficialAreaMap.getFangjiaCity();
|
||||
String region = fangjiaOfficialAreaMap.getFangjiaDistrict();
|
||||
|
||||
|
||||
String cat;
|
||||
if("2".equals(model.getHOUSING_EST_TY_CD())){
|
||||
cat = "district";
|
||||
|
||||
@@ -280,7 +280,6 @@ public class OfficeController {
|
||||
districtPriceMap.put("district", evaluation.getDistrict());
|
||||
districtPriceMap.put("name", evaluation.getName());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("refOffices", evaluation.getOffice());
|
||||
districtPriceMap.put("location", evaluation.getLocation());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
@@ -523,7 +522,6 @@ public class OfficeController {
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("refOffices", evaluation.getOffice());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
try {
|
||||
|
||||
-2
@@ -288,7 +288,6 @@ public class OfficeSellController {
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("refOffices", evaluation.getOfficeSell());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
try {
|
||||
@@ -366,7 +365,6 @@ public class OfficeSellController {
|
||||
districtPriceMap.put("district", evaluation.getDistrict());
|
||||
districtPriceMap.put("name", evaluation.getName());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("refOffices", evaluation.getOffice());
|
||||
districtPriceMap.put("location", evaluation.getLocation());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
|
||||
+131
-66
@@ -7,6 +7,7 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.ParseException;
|
||||
@@ -759,6 +760,9 @@ public class PropertyController {
|
||||
//int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
|
||||
// 返回2B价格,小程序用,其他也改为2B
|
||||
int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
|
||||
if (avgPrice == 0) {
|
||||
avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7));
|
||||
}
|
||||
if (avgPrice != 0) {
|
||||
districtInfoDto.setAvgPrice(avgPrice);
|
||||
}
|
||||
@@ -1207,6 +1211,7 @@ public class PropertyController {
|
||||
evaluation.setAvgPrice(avgPrice);
|
||||
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("调整面积不同面积价格异常{}", ex.getMessage());
|
||||
@@ -1647,10 +1652,14 @@ public class PropertyController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (district == null) {
|
||||
//加上高德获取经纬度 和 根据经纬度估值
|
||||
Map<String, String> map = GeoUtils.parserByGaode(model.getCity(), model.getAddress());
|
||||
if (map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
|
||||
if(map != null && (!map.containsKey("lng") || map.containsKey("level") && !GAODE_LEVEL.contains(map.get("level")))){
|
||||
map = GeoUtils.parserByGaode(model.getCity(), model.getDistrict()+model.getName());
|
||||
}
|
||||
if (map != null && map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
|
||||
&& map.containsKey("lng") && map.containsKey("lat")) {
|
||||
String location = map.get("lng") + "," + map.get("lat");
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
@@ -1661,9 +1670,9 @@ public class PropertyController {
|
||||
try {
|
||||
json = httpRequest.getJsonContent("http://192.168.0.100:30020/avmWeb/avmAnn", param, "UTF-8");
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
HashMap<String, String> resultMap = new HashMap<String, String>();
|
||||
resultMap.put("avgPrice", json.getString("unitPrice"));
|
||||
resultMap.put("totalPrice", json.getString("totalPrice"));
|
||||
HashMap<String, Long> resultMap = new HashMap<String, Long>();
|
||||
resultMap.put("avgPrice", Long.valueOf(json.getString("unitPrice")));
|
||||
resultMap.put("totalPrice", Long.valueOf(json.getString("totalPrice")));
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultMap));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
@@ -1676,9 +1685,16 @@ public class PropertyController {
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
model.setDistrict(district.getRegion());
|
||||
model.setName(district.getName());
|
||||
return this.evaluateAction(model, request);
|
||||
if(district!=null){
|
||||
model.setDistrict(district.getRegion());
|
||||
model.setName(district.getName());
|
||||
model.setCity(district.getCity());
|
||||
return this.evaluateAction(model, request);
|
||||
}else{
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Object evaluate2Action(PropertyEvaluationModel model, HttpServletRequest request)
|
||||
@@ -2430,28 +2446,52 @@ public class PropertyController {
|
||||
} else {
|
||||
calendar.add(Calendar.MONTH, -model.getPeriodCount().intValue());
|
||||
}
|
||||
|
||||
List<DistrictStat> districtStats = districtStatService.findAllDistrictStatByNameWithPadding(district.getCity(),
|
||||
district.getRegion(), district.getName(), district.getEstateType2(), calendar.getTime(), new Date(),
|
||||
model.getPeriodType());
|
||||
if (districtStats.size() > model.getPeriodCount()) {
|
||||
districtStats = districtStats.subList(districtStats.size() - model.getPeriodCount(), districtStats.size());
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
|
||||
for (DistrictStat districtStat : districtStats) {
|
||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||
item.put("city", districtStat.getCity());
|
||||
item.put("district", districtStat.getRegion());
|
||||
item.put("name", districtStat.getDistrictName());
|
||||
item.put("avgPrice", districtStat.getAvg_price_2b());
|
||||
if ("monthly".equals(model.getPeriodType())) {
|
||||
item.put("date", DateUtil.formatByPattern(districtStat.getWeekend(), "yyyy-MM"));
|
||||
} else {
|
||||
item.put("date", DateUtil.formatByPattern(districtStat.getWeekend(), "yyyy-MM-dd"));
|
||||
|
||||
if ("weekly".equals(model.getPeriodType())) {
|
||||
List<DistrictStat> districtStats = districtStatService.findAllDistrictStatByNameWithPadding(district.getCity(),
|
||||
district.getRegion(), district.getName(), district.getEstateType2(), calendar.getTime(), new Date(),
|
||||
model.getPeriodType());
|
||||
if (districtStats.size() > model.getPeriodCount()) {
|
||||
districtStats = districtStats.subList(districtStats.size() - model.getPeriodCount(), districtStats.size());
|
||||
}
|
||||
for (DistrictStat districtStat : districtStats) {
|
||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||
item.put("city", districtStat.getCity());
|
||||
item.put("district", districtStat.getRegion());
|
||||
item.put("name", districtStat.getDistrictName());
|
||||
if (districtStat.getAvg_price_2b() != null) {
|
||||
item.put("avgPrice", districtStat.getAvg_price_2b());
|
||||
} else {
|
||||
item.put("avgPrice", districtStat.getAvgPrice());
|
||||
}
|
||||
if ("monthly".equals(model.getPeriodType())) {
|
||||
item.put("date", DateUtil.formatByPattern(districtStat.getWeekend(), "yyyy-MM"));
|
||||
} else {
|
||||
item.put("date", DateUtil.formatByPattern(districtStat.getWeekend(), "yyyy-MM-dd"));
|
||||
}
|
||||
item.put("changePercent", districtStat.getMarkup() / 100d);
|
||||
result.add(item);
|
||||
}
|
||||
} else {
|
||||
List<DistrictSellStat> monthsData = districtSellStatService.getAllWithMonths(model.getCity(),
|
||||
model.getDistrict(), model.getName(), model.getPeriodCount());
|
||||
if (monthsData != null && monthsData.size() > 0) {
|
||||
for (DistrictSellStat districtStat : monthsData) {
|
||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||
item.put("city", districtStat.getCity());
|
||||
item.put("district", districtStat.getRegion());
|
||||
item.put("name", districtStat.getDistrictName());
|
||||
item.put("avgPrice", districtStat.getAvgPrice());
|
||||
item.put("date", districtStat.getDate() / 100 + "-" + String.format("%02d", districtStat.getDate() % 100));
|
||||
item.put("changePercent", BigDecimal.valueOf(districtStat.getMom() * 100)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
item.put("changePercent", districtStat.getMarkup() / 100d);
|
||||
result.add(item);
|
||||
}
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
return mav;
|
||||
}
|
||||
@@ -4086,20 +4126,6 @@ public class PropertyController {
|
||||
}
|
||||
params.add(new QueryParam("category", "district"));
|
||||
params.add(new QueryParam("visible", 0));
|
||||
// BooleanQuery srQuery1 = new BooleanQuery();
|
||||
// BooleanQuery nameQuery = new BooleanQuery();
|
||||
// nameQuery.add(new TermQuery(new Term("district_name", model.getKeyword())),
|
||||
// BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new PrefixQuery(new Term("name",
|
||||
// QueryParser.escape(model.getKeyword()).toLowerCase())),
|
||||
// BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("alias_std", model.getKeyword())),
|
||||
// BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("address", model.getKeyword())),
|
||||
// BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("addr_alias_std", model.getKeyword())),
|
||||
// BooleanClause.Occur.SHOULD);
|
||||
|
||||
if (StringUtils.isNotBlank(model.getKeyword())) {
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
if (model.getUseOrQuery()) {
|
||||
@@ -4120,24 +4146,7 @@ public class PropertyController {
|
||||
q1.setBoost(0.99f);
|
||||
query.add(q1, BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query q2 = new TermQuery(new Term("keyword_cjk",
|
||||
* QueryParser.escape(model.getKeyword()).toLowerCase())); q2.setBoost(0.01f);
|
||||
* query.add(q2, BooleanClause.Occur.SHOULD);
|
||||
*/
|
||||
|
||||
/*
|
||||
* String districtName = tokenDistrictName(model.getKeyword());
|
||||
* if(StringUtils.isNotBlank(districtName)){ Query q3 = new TermQuery(new
|
||||
* Term("keyword_cjk", districtName)); q3.setBoost(0.99f); query.add(q3,
|
||||
* BooleanClause.Occur.SHOULD); }
|
||||
*/
|
||||
// Query query =
|
||||
// boostQueryDistrictNewPolicy.create(ServiceUtil.removeAndGetKeyword(params));
|
||||
params.add(new QueryParam("$sr", new SrQuery(query)));
|
||||
// params.add(new QueryParam("keyword",
|
||||
// QueryParser.escape(model.getKeyword()).toLowerCase()));
|
||||
|
||||
}
|
||||
List<District> districts = districtService.findAllByParams(params, 0, model.getMax(), new String[]{"city",
|
||||
@@ -4151,15 +4160,15 @@ public class PropertyController {
|
||||
item.append("district", district.getRegion());
|
||||
item.append("name", district.getName());
|
||||
item.append("address", district.getAddress());
|
||||
item.append("latBaidu", district.getLat2());
|
||||
item.append("lngBaidu", district.getLng2());
|
||||
item.append("houseHoldCount", district.getHouseholdCount());
|
||||
if (district.getAlias() != null && district.getAlias().size() > 0) {
|
||||
item.append("alias", district.getAlias());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(district.getAddrAlias())) {
|
||||
item.append("address_alias", district.getAddrAlias());
|
||||
}
|
||||
// item.append("latBaidu", district.getLat2());
|
||||
// item.append("lngBaidu", district.getLng2());
|
||||
// item.append("houseHoldCount", district.getHouseholdCount());
|
||||
// if (district.getAlias() != null && district.getAlias().size() > 0) {
|
||||
// item.append("alias", district.getAlias());
|
||||
// }
|
||||
// if (CollectionUtils.isNotEmpty(district.getAddrAlias())) {
|
||||
// item.append("address_alias", district.getAddrAlias());
|
||||
// }
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
@@ -4181,6 +4190,62 @@ public class PropertyController {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
if(result.isEmpty()){
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
if (!"全国".equals(model.getCity())) {
|
||||
params.add(new QueryParam("city", model.getCity()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getDistrict())) {
|
||||
params.add(new QueryParam("region", model.getDistrict()));
|
||||
}
|
||||
params.add(new QueryParam("category", "district"));
|
||||
params.add(new QueryParam("visible", 0));
|
||||
if (StringUtils.isNotBlank(model.getKeyword())) {
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
if (model.getUseOrQuery()) {
|
||||
params.add(new QueryParam("$fangjiawang_query_type", "or"));
|
||||
}
|
||||
// 2017-11-02新增, 指定查询字段,以:分割为多个字段查询,处理pds搜索问题,不指定默认用keyword查询
|
||||
String queryFields = model.getQueryField();
|
||||
if (StringUtils.isNotBlank(queryFields) && queryFields.contains(":")) {
|
||||
String[] fs = queryFields.split(":");
|
||||
for (String f : fs) {
|
||||
Query q1 = new TermQuery(new Term(f, QueryParser.escape(model.getKeyword()).toLowerCase()));
|
||||
q1.setBoost(0.99f);
|
||||
query.add(q1, BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
} else {
|
||||
Query q1 = new TermQuery(
|
||||
new Term(model.getQueryField(), QueryParser.escape(model.getKeyword()).toLowerCase()));
|
||||
q1.setBoost(0.99f);
|
||||
query.add(q1, BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
params.add(new QueryParam("$sr", new SrQuery(query)));
|
||||
|
||||
}
|
||||
List<District> districts = districtService.findAllByParams(params, 0, model.getMax(), new String[]{"city",
|
||||
"region", "name", "alias", "address", "addrAlias", "lat2", "lng2", "householdCount"});
|
||||
|
||||
if (districts != null) {
|
||||
for (District district : districts) {
|
||||
BasicDBObject item = new BasicDBObject();
|
||||
item.append("city", district.getCity());
|
||||
item.append("district", district.getRegion());
|
||||
item.append("name", district.getName());
|
||||
item.append("address", district.getAddress());
|
||||
// item.append("latBaidu", district.getLat2());
|
||||
// item.append("lngBaidu", district.getLng2());
|
||||
// item.append("houseHoldCount", district.getHouseholdCount());
|
||||
// if (district.getAlias() != null && district.getAlias().size() > 0) {
|
||||
// item.append("alias", district.getAlias());
|
||||
// }
|
||||
// if (CollectionUtils.isNotEmpty(district.getAddrAlias())) {
|
||||
// item.append("address_alias", district.getAddrAlias());
|
||||
// }
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,624 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.LoggerFactory;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.ShopRentStat;
|
||||
import com.fangjia.open.HttpCode;
|
||||
import com.fangjia.open.OpenHttpCodeEnum;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.open.model.ReportApplyModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.CommonUtils;
|
||||
import com.fangjia.open.util.FangJiaTongUrl;
|
||||
import com.fangjia.service.address.AddressParser;
|
||||
import com.fangjia.service.datastore.FieldFilterService;
|
||||
import com.fangjia.service.datastore.AiShopService;
|
||||
import com.fangjia.service.datastore.OpenApiLogService;
|
||||
import com.fangjia.service.datastore.dto.ShopEvaluationDto;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.fangjia.open.util.CommonUtils.convertToString;
|
||||
import static com.fangjia.open.util.EvaluationFactorUtil.*;
|
||||
|
||||
/**
|
||||
* 商铺出租服务类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2025/4/10
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public class ShopController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||
|
||||
private AiShopService aiShopService;
|
||||
|
||||
private OpenApiLogService openApiLogService;
|
||||
|
||||
private AddressParser addressParser;
|
||||
private FieldFilterService fieldFilterService;
|
||||
|
||||
/**
|
||||
* 城市出租均价
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object cityRentAction(@Param(name = "city") String city, @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopRentStat> regionStats = aiShopService.findShopRentStat(city, null, null, "city", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域出租均价
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object districtRentAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(district)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("district不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
String region = RegionData.formatRegion(city, district);
|
||||
if (!RegionData.isRegion(city, region)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopRentStat> regionStats = aiShopService.findShopRentStat(city, region, null, "district", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该区域没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼均价走势
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object shopRentAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "name") String name, @Param(name = "startDate") Integer startDate,
|
||||
@Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(district)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("district不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
String region = RegionData.formatRegion(city, district);
|
||||
if (!RegionData.isRegion(city, region)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopRentStat> regionStats = aiShopService.findShopRentStat(city, region, name, "shop", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该写字楼没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼楼租金地址估值
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public Object addressEvaluateRentAction(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getAddress()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,地址,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
|
||||
if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
ShopEvaluationDto evaluation = aiShopService.addressEvaluateRent(buildEvaluation(model, request));
|
||||
|
||||
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
|
||||
districtPriceMap.put("city", evaluation.getCity());
|
||||
districtPriceMap.put("district", evaluation.getDistrict());
|
||||
districtPriceMap.put("name", evaluation.getName());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("location", evaluation.getLocation());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
try {
|
||||
if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) {
|
||||
openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/shop/addressEvaluateRent");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return mav;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该地址写字楼的评估").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请估值报告
|
||||
*
|
||||
* @param model 申请报告请求参数
|
||||
* @return
|
||||
*/
|
||||
public Object assessPriceReportApplyAction(ReportApplyModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getClient())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:委托机构为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getSubjectMatter())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:标的物为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getCity()) || model.getCity().contains("全国")) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项且不能为全国"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getDistrict()) || model.getDistrict().contains("全国")) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:区域为必填项且不能为全国"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getSize() == null || model.getSize() <= 0 ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:面积(size)为必填项且大于0"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (model.getDistrict().endsWith("区")) {
|
||||
model.setDistrict(model.getDistrict().replaceAll("区$", ""));
|
||||
}
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("client", model.getClient());
|
||||
params.put("subjectMatter", model.getSubjectMatter());
|
||||
params.put("city", model.getCity());
|
||||
params.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : null);
|
||||
params.put("district", model.getDistrict());
|
||||
params.put("name", StringUtils.isNotBlank(model.getName()) ? model.getName() : null);
|
||||
params.put("houseNum", StringUtils.isNotBlank(model.getBuildingNumber()) ? model.getBuildingNumber() : null);
|
||||
params.put("roomNum", StringUtils.isNotBlank(model.getUnitNumber()) ? model.getUnitNumber() : null);
|
||||
params.put("size", String.valueOf(model.getSize()));
|
||||
params.put("houseFloor", model.getFloor() != null ? String.valueOf(model.getFloor()) : null);
|
||||
params.put("houseHeight", model.getMaxFloor() != null ? String.valueOf(model.getMaxFloor()) : null);
|
||||
params.put("buildType", StringUtils.isNotBlank(model.getPropertyType()) ? model.getPropertyType() : "0");
|
||||
params.put("direction", StringUtils.isNotBlank(model.getDirection()) ? model.getDirection() : "3");
|
||||
params.put("fitment", StringUtils.isNotBlank(model.getDecoration()) ? model.getDecoration() : "2");
|
||||
JSONObject jsonObject = JSONObject.fromObject(params);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN);
|
||||
headers.put("Content-Type", "application/json");
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (json != null) {
|
||||
if (json.getInt("code") == 200 && json.containsKey("data")) {
|
||||
HashMap<String, String> result = new HashMap<String, String>();
|
||||
result.put("caseId", String.valueOf(json.get("data")));
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:" + json.getString("message")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:调用申请报告接口返回为空"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取估值报告
|
||||
*
|
||||
* @param caseId 估值报告ID
|
||||
* @return
|
||||
*/
|
||||
public Object assessPriceReportFetchAction(@Param(name = "caseId") String caseId) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(caseId)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:估值报告业务编号为必填项"));
|
||||
return mav;
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("caseId", caseId);
|
||||
JSONObject jsonObject = JSONObject.fromObject(params);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN);
|
||||
headers.put("Content-Type", "application/json");
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (json != null) {
|
||||
if (json.getInt("code") == 200 && json.containsKey("data")) {
|
||||
JSONObject resultJson = json.getJSONObject("data");
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultJson));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("获取估值报告失败:" + json.getString("message")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请报告失败:调用获取估值报告接口返回为空"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
private Integer getFloor(String roomNumber) {
|
||||
if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) {
|
||||
if (roomNumber.length() == 3) {
|
||||
return Integer.valueOf(roomNumber.substring(0, 1));
|
||||
} else if (roomNumber.length() == 4) {
|
||||
return Integer.valueOf(roomNumber.substring(0, 2));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过EvaluationModel组装Evaluation实体
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
Evaluation evaluation = new Evaluation();
|
||||
evaluation.setLevel(model.getLevel());
|
||||
evaluation.setFitment(model.getFitment());
|
||||
evaluation.setType(model.getType());
|
||||
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setRegion(model.getRegion());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
evaluation.setAddress(model.getAddress());
|
||||
evaluation.setDirection(model.getDirection());
|
||||
evaluation.setNoise(NOISE.get(model.getNoise()));
|
||||
evaluation.setType(model.getType());
|
||||
evaluation.setSight(SIGHT.get(model.getView()));
|
||||
evaluation.setAtticArea(model.getAtticSize());
|
||||
evaluation.setTerraceArea(model.getOuterSize());
|
||||
evaluation.setBasementArea(model.getBasementSize());
|
||||
evaluation.setGardenArea(model.getGardenSize());
|
||||
String worryFacility = model.getNegativeFactor();
|
||||
evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility));
|
||||
evaluation.setCreationDate(new Date());
|
||||
evaluation.setModificationDate(new Date());
|
||||
evaluation.setClientNo(model.getClientNo());
|
||||
evaluation.setSampleIds(model.getSampleIds());
|
||||
if (0 != model.getAge()) {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
if (model.getRadius() != null) {
|
||||
evaluation.setRadius(model.getRadius());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTags())) {
|
||||
evaluation.setTags(model.getTags());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getEstateType())) {
|
||||
evaluation.setEstateType(model.getEstateType());
|
||||
}
|
||||
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
|
||||
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getBuildType())) {
|
||||
evaluation.setBuildType(model.getBuildType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getCarport())) {
|
||||
evaluation.setCarport(model.getCarport());
|
||||
}
|
||||
if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) {
|
||||
evaluation.setFitmentAge(model.getDecorationAge());
|
||||
}
|
||||
evaluation.setCarportPrice(model.getCarportPrice());
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
if (model.getDecorationCost() != null && model.getDecorationCost() > 0) {
|
||||
evaluation.setFitmentCharge(model.getDecorationCost());
|
||||
}
|
||||
if (0 != model.getHall()) {
|
||||
evaluation.setHall(model.getHall());
|
||||
}
|
||||
if (null != model.getFloor()) {
|
||||
evaluation.setFloor(model.getFloor());
|
||||
}
|
||||
if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) {
|
||||
evaluation.setHeight(model.getMaxFloor());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getBuildingNumber())) {
|
||||
evaluation.setHouseNum(model.getBuildingNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getHouseProperty())) {
|
||||
evaluation.setHouseProperty(model.getHouseProperty());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getInsidepos())) {
|
||||
evaluation.setInsidepos(model.getInsidepos());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLightingVentilation())) {
|
||||
evaluation.setLightingVentilation(model.getLightingVentilation());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getOtherFactor())) {
|
||||
evaluation.setOtherFactor(model.getOtherFactor());
|
||||
}
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
if (null != model.getRoom()) {
|
||||
evaluation.setRoom(model.getRoom());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getRoomNumber())) {
|
||||
evaluation.setRoomNum(model.getRoomNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSideset())) {
|
||||
evaluation.setSideset(model.getSideset());
|
||||
}
|
||||
if (0 != model.getToilet()) {
|
||||
evaluation.setToilet(model.getToilet());
|
||||
}
|
||||
if (model.getFacilities() != null) {
|
||||
String facilities = model.getFacilities();
|
||||
String[] fs = facilities.split(",");
|
||||
for (int i = 0; i < fs.length; i++) {
|
||||
fs[i] = FACILITIES.get(fs[i]);
|
||||
}
|
||||
evaluation.setFacilities(convertToString(fs));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getFacade())) {
|
||||
evaluation.setFacade(model.getFacade());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTraffice())) {
|
||||
evaluation.setTraffice(model.getTraffice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShape())) {
|
||||
evaluation.setShape(model.getShape());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getObstacle())) {
|
||||
evaluation.setObstacle(model.getObstacle());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getIndustry())) {
|
||||
evaluation.setIndustry(model.getIndustry());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSupportDevice())) {
|
||||
evaluation.setSupportDevice(model.getSupportDevice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLeftPosition())) {
|
||||
evaluation.setLeftPosition(model.getLeftPosition());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopType())) {
|
||||
evaluation.setShopType(model.getShopType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopUnique())) {
|
||||
evaluation.setShopUnique(model.getShopUnique());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLocation())) {
|
||||
evaluation.setLocation(model.getLocation());
|
||||
}
|
||||
if (model.isNewDistrict()) {
|
||||
evaluation.setNewDistrict(model.isNewDistrict());
|
||||
}
|
||||
String floorDesc = "中";
|
||||
if (evaluation.getFloor() != null && evaluation.getHeight() != null) {
|
||||
Double floorInfo = evaluation.getFloor() * 1.0 / evaluation.getHeight();
|
||||
if (floorInfo <= 0.33) {
|
||||
floorDesc = "低";
|
||||
} else if (floorInfo > 0.66) {
|
||||
floorDesc = "高";
|
||||
}
|
||||
evaluation.setFloorDesc(floorDesc);
|
||||
}
|
||||
String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest());
|
||||
evaluation.setIp(ip);
|
||||
AuthenticationBean authenticationBean = (AuthenticationBean) request
|
||||
.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
||||
if (authenticationBean != null && authenticationBean.apiUser != null) {
|
||||
evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId()));
|
||||
}
|
||||
evaluation.setSource("api_shop_evaluateRent");
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
private static final Map<String, String> FACILITIES = new HashMap<String, String>() {
|
||||
{
|
||||
put("0", "健身房");
|
||||
put("1", "游泳池");
|
||||
put("2", "会所");
|
||||
put("3", "网球场");
|
||||
put("4", "球场");
|
||||
put("5", "棋牌室");
|
||||
put("6", "停车场");
|
||||
put("7", "图书馆");
|
||||
put("8", "活动中心");
|
||||
}
|
||||
};
|
||||
|
||||
public void setOpenApiLogService(OpenApiLogService openApiLogService) {
|
||||
this.openApiLogService = openApiLogService;
|
||||
}
|
||||
|
||||
public void setFieldFilterService(FieldFilterService fieldFilterService) {
|
||||
this.fieldFilterService = fieldFilterService;
|
||||
}
|
||||
|
||||
public void setAiShopService(AiShopService aiShopService) {
|
||||
this.aiShopService = aiShopService;
|
||||
}
|
||||
}
|
||||
+623
@@ -0,0 +1,623 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.LoggerFactory;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.ShopSellStat;
|
||||
import com.fangjia.open.HttpCode;
|
||||
import com.fangjia.open.OpenHttpCodeEnum;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.open.model.ReportApplyModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.CommonUtils;
|
||||
import com.fangjia.open.util.FangJiaTongUrl;
|
||||
import com.fangjia.service.address.AddressParser;
|
||||
import com.fangjia.service.datastore.AiShopService;
|
||||
import com.fangjia.service.datastore.FieldFilterService;
|
||||
import com.fangjia.service.datastore.OpenApiLogService;
|
||||
import com.fangjia.service.datastore.dto.ShopEvaluationDto;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.fangjia.open.util.CommonUtils.convertToString;
|
||||
import static com.fangjia.open.util.EvaluationFactorUtil.*;
|
||||
|
||||
/**
|
||||
* 商铺出售服务类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2025/4/14
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public class ShopSellController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||
|
||||
private AiShopService aiShopService;
|
||||
|
||||
private OpenApiLogService openApiLogService;
|
||||
|
||||
private AddressParser addressParser;
|
||||
private FieldFilterService fieldFilterService;
|
||||
|
||||
/**
|
||||
* 城市出租均价
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object citySellAction(@Param(name = "city") String city, @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopSellStat> regionStats = aiShopService.findShopSellStat(city, null, null, "city", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域出租均价
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object districtSellAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(district)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("district不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
String region = RegionData.formatRegion(city, district);
|
||||
if (!RegionData.isRegion(city, region)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopSellStat> regionStats = aiShopService.findShopSellStat(city, region, null, "district", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该区域没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼均价走势
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object shopSellAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "name") String name, @Param(name = "startDate") Integer startDate,
|
||||
@Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(district)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("district不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
String region = RegionData.formatRegion(city, district);
|
||||
if (!RegionData.isRegion(city, region)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<ShopSellStat> regionStats = aiShopService.findShopSellStat(city, region, name, "shop", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该写字楼没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼楼租金地址估值
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public Object addressEvaluateSellAction(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getAddress()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,地址,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
|
||||
if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
ShopEvaluationDto evaluation = aiShopService.addressEvaluateSell(buildEvaluation(model, request));
|
||||
|
||||
if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
|
||||
districtPriceMap.put("city", evaluation.getCity());
|
||||
districtPriceMap.put("district", evaluation.getDistrict());
|
||||
districtPriceMap.put("name", evaluation.getName());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
districtPriceMap.put("location", evaluation.getLocation());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
try {
|
||||
if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) {
|
||||
openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/shop/addressEvaluateSell");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return mav;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该地址写字楼的评估").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请估值报告
|
||||
*
|
||||
* @param model 申请报告请求参数
|
||||
* @return
|
||||
*/
|
||||
public Object assessPriceReportApplyAction(ReportApplyModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getClient())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:委托机构为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getSubjectMatter())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:标的物为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getCity()) || model.getCity().contains("全国")) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项且不能为全国"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getDistrict()) || model.getDistrict().contains("全国")) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:区域为必填项且不能为全国"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getSize() == null || model.getSize() <= 0 ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:面积(size)为必填项且大于0"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (model.getDistrict().endsWith("区")) {
|
||||
model.setDistrict(model.getDistrict().replaceAll("区$", ""));
|
||||
}
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("client", model.getClient());
|
||||
params.put("subjectMatter", model.getSubjectMatter());
|
||||
params.put("city", model.getCity());
|
||||
params.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : null);
|
||||
params.put("district", model.getDistrict());
|
||||
params.put("name", StringUtils.isNotBlank(model.getName()) ? model.getName() : null);
|
||||
params.put("houseNum", StringUtils.isNotBlank(model.getBuildingNumber()) ? model.getBuildingNumber() : null);
|
||||
params.put("roomNum", StringUtils.isNotBlank(model.getUnitNumber()) ? model.getUnitNumber() : null);
|
||||
params.put("size", String.valueOf(model.getSize()));
|
||||
params.put("houseFloor", model.getFloor() != null ? String.valueOf(model.getFloor()) : null);
|
||||
params.put("houseHeight", model.getMaxFloor() != null ? String.valueOf(model.getMaxFloor()) : null);
|
||||
params.put("buildType", StringUtils.isNotBlank(model.getPropertyType()) ? model.getPropertyType() : "0");
|
||||
params.put("direction", StringUtils.isNotBlank(model.getDirection()) ? model.getDirection() : "3");
|
||||
params.put("fitment", StringUtils.isNotBlank(model.getDecoration()) ? model.getDecoration() : "2");
|
||||
JSONObject jsonObject = JSONObject.fromObject(params);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN);
|
||||
headers.put("Content-Type", "application/json");
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (json != null) {
|
||||
if (json.getInt("code") == 200 && json.containsKey("data")) {
|
||||
HashMap<String, String> result = new HashMap<String, String>();
|
||||
result.put("caseId", String.valueOf(json.get("data")));
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:" + json.getString("message")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:调用申请报告接口返回为空"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取估值报告
|
||||
*
|
||||
* @param caseId 估值报告ID
|
||||
* @return
|
||||
*/
|
||||
public Object assessPriceReportFetchAction(@Param(name = "caseId") String caseId) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(caseId)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:估值报告业务编号为必填项"));
|
||||
return mav;
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("caseId", caseId);
|
||||
JSONObject jsonObject = JSONObject.fromObject(params);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN);
|
||||
headers.put("Content-Type", "application/json");
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8");
|
||||
json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (json != null) {
|
||||
if (json.getInt("code") == 200 && json.containsKey("data")) {
|
||||
JSONObject resultJson = json.getJSONObject("data");
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultJson));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("获取估值报告失败:" + json.getString("message")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("申请报告失败:调用获取估值报告接口返回为空"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
private Integer getFloor(String roomNumber) {
|
||||
if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) {
|
||||
if (roomNumber.length() == 3) {
|
||||
return Integer.valueOf(roomNumber.substring(0, 1));
|
||||
} else if (roomNumber.length() == 4) {
|
||||
return Integer.valueOf(roomNumber.substring(0, 2));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过EvaluationModel组装Evaluation实体
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
Evaluation evaluation = new Evaluation();
|
||||
evaluation.setLevel(model.getLevel());
|
||||
evaluation.setFitment(model.getFitment());
|
||||
evaluation.setType(model.getType());
|
||||
evaluation.setSampleIds(model.getSampleIds());
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setRegion(model.getRegion());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
evaluation.setAddress(model.getAddress());
|
||||
evaluation.setDirection(model.getDirection());
|
||||
evaluation.setNoise(NOISE.get(model.getNoise()));
|
||||
evaluation.setType(model.getType());
|
||||
evaluation.setSight(SIGHT.get(model.getView()));
|
||||
evaluation.setAtticArea(model.getAtticSize());
|
||||
evaluation.setTerraceArea(model.getOuterSize());
|
||||
evaluation.setBasementArea(model.getBasementSize());
|
||||
evaluation.setGardenArea(model.getGardenSize());
|
||||
String worryFacility = model.getNegativeFactor();
|
||||
evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility));
|
||||
evaluation.setCreationDate(new Date());
|
||||
evaluation.setModificationDate(new Date());
|
||||
evaluation.setClientNo(model.getClientNo());
|
||||
if (0 != model.getAge()) {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
if (model.getRadius() != null) {
|
||||
evaluation.setRadius(model.getRadius());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTags())) {
|
||||
evaluation.setTags(model.getTags());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getEstateType())) {
|
||||
evaluation.setEstateType(model.getEstateType());
|
||||
}
|
||||
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
|
||||
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getBuildType())) {
|
||||
evaluation.setBuildType(model.getBuildType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getCarport())) {
|
||||
evaluation.setCarport(model.getCarport());
|
||||
}
|
||||
if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) {
|
||||
evaluation.setFitmentAge(model.getDecorationAge());
|
||||
}
|
||||
evaluation.setCarportPrice(model.getCarportPrice());
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
if (model.getDecorationCost() != null && model.getDecorationCost() > 0) {
|
||||
evaluation.setFitmentCharge(model.getDecorationCost());
|
||||
}
|
||||
if (0 != model.getHall()) {
|
||||
evaluation.setHall(model.getHall());
|
||||
}
|
||||
if (null != model.getFloor()) {
|
||||
evaluation.setFloor(model.getFloor());
|
||||
}
|
||||
if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) {
|
||||
evaluation.setHeight(model.getMaxFloor());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getBuildingNumber())) {
|
||||
evaluation.setHouseNum(model.getBuildingNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getHouseProperty())) {
|
||||
evaluation.setHouseProperty(model.getHouseProperty());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getInsidepos())) {
|
||||
evaluation.setInsidepos(model.getInsidepos());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLightingVentilation())) {
|
||||
evaluation.setLightingVentilation(model.getLightingVentilation());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getOtherFactor())) {
|
||||
evaluation.setOtherFactor(model.getOtherFactor());
|
||||
}
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
if (null != model.getRoom()) {
|
||||
evaluation.setRoom(model.getRoom());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getRoomNumber())) {
|
||||
evaluation.setRoomNum(model.getRoomNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSideset())) {
|
||||
evaluation.setSideset(model.getSideset());
|
||||
}
|
||||
if (0 != model.getToilet()) {
|
||||
evaluation.setToilet(model.getToilet());
|
||||
}
|
||||
if (model.getFacilities() != null) {
|
||||
String facilities = model.getFacilities();
|
||||
String[] fs = facilities.split(",");
|
||||
for (int i = 0; i < fs.length; i++) {
|
||||
fs[i] = FACILITIES.get(fs[i]);
|
||||
}
|
||||
evaluation.setFacilities(convertToString(fs));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getFacade())) {
|
||||
evaluation.setFacade(model.getFacade());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTraffice())) {
|
||||
evaluation.setTraffice(model.getTraffice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShape())) {
|
||||
evaluation.setShape(model.getShape());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getObstacle())) {
|
||||
evaluation.setObstacle(model.getObstacle());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getIndustry())) {
|
||||
evaluation.setIndustry(model.getIndustry());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSupportDevice())) {
|
||||
evaluation.setSupportDevice(model.getSupportDevice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLeftPosition())) {
|
||||
evaluation.setLeftPosition(model.getLeftPosition());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopType())) {
|
||||
evaluation.setShopType(model.getShopType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopUnique())) {
|
||||
evaluation.setShopUnique(model.getShopUnique());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLocation())) {
|
||||
evaluation.setLocation(model.getLocation());
|
||||
}
|
||||
if (model.isNewDistrict()) {
|
||||
evaluation.setNewDistrict(model.isNewDistrict());
|
||||
}
|
||||
String floorDesc = "中";
|
||||
if (evaluation.getFloor() != null && evaluation.getHeight() != null) {
|
||||
Double floorInfo = evaluation.getFloor() * 1.0 / evaluation.getHeight();
|
||||
if (floorInfo <= 0.33) {
|
||||
floorDesc = "低";
|
||||
} else if (floorInfo > 0.66) {
|
||||
floorDesc = "高";
|
||||
}
|
||||
evaluation.setFloorDesc(floorDesc);
|
||||
}
|
||||
String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest());
|
||||
evaluation.setIp(ip);
|
||||
AuthenticationBean authenticationBean = (AuthenticationBean) request
|
||||
.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
||||
if (authenticationBean != null && authenticationBean.apiUser != null) {
|
||||
evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId()));
|
||||
}
|
||||
evaluation.setSource("api_shop_evaluateRent");
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
private static final Map<String, String> FACILITIES = new HashMap<String, String>() {
|
||||
{
|
||||
put("0", "健身房");
|
||||
put("1", "游泳池");
|
||||
put("2", "会所");
|
||||
put("3", "网球场");
|
||||
put("4", "球场");
|
||||
put("5", "棋牌室");
|
||||
put("6", "停车场");
|
||||
put("7", "图书馆");
|
||||
put("8", "活动中心");
|
||||
}
|
||||
};
|
||||
|
||||
public void setOpenApiLogService(OpenApiLogService openApiLogService) {
|
||||
this.openApiLogService = openApiLogService;
|
||||
}
|
||||
|
||||
public void setFieldFilterService(FieldFilterService fieldFilterService) {
|
||||
this.fieldFilterService = fieldFilterService;
|
||||
}
|
||||
|
||||
public void setAiShopService(AiShopService aiShopService) {
|
||||
this.aiShopService = aiShopService;
|
||||
}
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
//package com.fangjia.open.controllers;
|
||||
//
|
||||
//import com.google.gson.Gson;
|
||||
//import com.google.gson.JsonArray;
|
||||
//import com.google.gson.JsonObject;
|
||||
//import org.apache.http.HttpEntity;
|
||||
//import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
//import org.apache.http.client.methods.HttpPost;
|
||||
//import org.apache.http.entity.ContentType;
|
||||
//import org.apache.http.entity.StringEntity;
|
||||
//import org.apache.http.impl.client.CloseableHttpClient;
|
||||
//import org.apache.http.impl.client.HttpClients;
|
||||
//import org.apache.http.util.EntityUtils;
|
||||
//import sun.misc.BASE64Encoder;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.net.Authenticator;
|
||||
//import java.net.InetSocketAddress;
|
||||
//import java.net.PasswordAuthentication;
|
||||
//import java.net.Proxy;
|
||||
//import java.nio.charset.Charset;
|
||||
//import java.nio.charset.StandardCharsets;
|
||||
//import java.util.Base64;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
////public class Test {
|
||||
//// public static void main(String[] args) throws IOException {
|
||||
//// // 目标URL
|
||||
//// String targetURL = "http://146.56.217.44:9010/uams/farmer/all/v3/sign";
|
||||
////
|
||||
//// // 设置代理
|
||||
//// String proxyHost = "tunnel2.qg.net";
|
||||
//// int proxyPort = 14186;
|
||||
////
|
||||
//// // 设置代理用户名和密码
|
||||
//// final String proxyUsername = "113BBC06";
|
||||
//// final String proxyPassword = "3B2FBD05B0AF";
|
||||
////
|
||||
//// // 设置请求的JSON数据
|
||||
//// String address = "江苏省扬州市宝应县安宜镇宝应大道88号";
|
||||
//// String type = "1";
|
||||
//// String jsonData = "{\"address\":\"" + address + "\",\"type\":\"" + type + "\"}";
|
||||
////
|
||||
//// // 设置HTTP基本认证
|
||||
//// String authKey = proxyUsername;
|
||||
//// String password = proxyPassword;
|
||||
//// String auth = authKey + ":" + password;
|
||||
//// String authHeader = "Basic " + new BASE64Encoder().encode(auth.getBytes(Charset.forName("UTF-8")));
|
||||
////
|
||||
//// // 创建HTTP客户端
|
||||
//// CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
//// HttpPost httpPost = new HttpPost(targetURL);
|
||||
////
|
||||
//// // 设置代理
|
||||
//// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
|
||||
////
|
||||
//// // 设置代理认证
|
||||
//// Authenticator.setDefault(new Authenticator() {
|
||||
//// protected PasswordAuthentication getPasswordAuthentication() {
|
||||
//// return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
|
||||
//// }
|
||||
//// });
|
||||
////
|
||||
//// // 设置请求头
|
||||
//// httpPost.setHeader("Content-Type", "application/json");
|
||||
//// httpPost.setHeader("Accept", "*/*");
|
||||
//// httpPost.setHeader("Host", "146.56.217.44:9010");
|
||||
//// httpPost.setHeader("Proxy-Authorization", authHeader);
|
||||
////
|
||||
//// // 设置请求体
|
||||
//// StringEntity stringEntity = new StringEntity(jsonData, ContentType.APPLICATION_JSON);
|
||||
//// httpPost.setEntity(stringEntity);
|
||||
////
|
||||
//// // 发送POST请求
|
||||
//// CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
|
||||
////
|
||||
//// // 获取响应
|
||||
//// HttpEntity responseEntity = httpResponse.getEntity();
|
||||
//// String responseString = EntityUtils.toString(responseEntity);
|
||||
//// System.out.println(responseString);
|
||||
////
|
||||
//// // 关闭连接
|
||||
//// httpResponse.close();
|
||||
//// httpClient.close();
|
||||
//// }
|
||||
////}
|
||||
//
|
||||
//public class Test {
|
||||
// public static void main(String[] args) throws IOException {
|
||||
// Map<String, String> map = senRequest("江苏省泰州市靖江市通江路37号", "1");
|
||||
// System.out.println(map);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private static Map<String, String> senRequest(String address, String type) throws IOException {
|
||||
// String targetURL = "http://146.56.217.44:9010/uams/farmer/all/v3/sign";
|
||||
// String proxyHost = "tunnel2.qg.net";
|
||||
// int proxyPort = 14186;
|
||||
// final String proxyUsername = "113BBC06";
|
||||
// final String proxyPassword = "3B2FBD05B0AF";
|
||||
// String jsonData = "{\"address\":\"" + address + "\",\"type\":\"" + type + "\"}";
|
||||
// String authKey = proxyUsername;
|
||||
// String password = proxyPassword;
|
||||
// String auth = authKey + ":" + password;
|
||||
// String authHeader = "Basic " + new BASE64Encoder().encode(auth.getBytes(Charset.forName("UTF-8")));
|
||||
//
|
||||
// CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// HttpPost httpPost = new HttpPost(targetURL);
|
||||
// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
|
||||
// Authenticator.setDefault(new Authenticator() {
|
||||
// protected PasswordAuthentication getPasswordAuthentication() {
|
||||
// return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
|
||||
// }
|
||||
// });
|
||||
// httpPost.setHeader("Content-Type", "application/json");
|
||||
// httpPost.setHeader("Accept", "*/*");
|
||||
// httpPost.setHeader("Host", "146.56.217.44:9010");
|
||||
// httpPost.setHeader("Proxy-Authorization", authHeader);
|
||||
// StringEntity stringEntity = new StringEntity(jsonData, ContentType.APPLICATION_JSON);
|
||||
// httpPost.setEntity(stringEntity);
|
||||
//
|
||||
// CloseableHttpResponse httpResponse = null;
|
||||
// int retryCount = 2; // 设置重试次数
|
||||
// int retryDelay = 10; // 设置重试延迟时间(毫秒)
|
||||
// boolean success = false;
|
||||
// for (int i = 0; i < retryCount; i++) {
|
||||
// try {
|
||||
// httpResponse = httpClient.execute(httpPost);
|
||||
// success = true;
|
||||
// break;
|
||||
// } catch (IOException e) {
|
||||
// System.err.println("代理请求失败,进行重试...");
|
||||
// try {
|
||||
// Thread.sleep(retryDelay);
|
||||
// } catch (InterruptedException ex) {
|
||||
// Thread.currentThread().interrupt();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (success) {
|
||||
// HttpEntity responseEntity = httpResponse.getEntity();
|
||||
// String responseString = EntityUtils.toString(responseEntity);
|
||||
//
|
||||
// // 使用 Gson 解析 JSON 字符串
|
||||
// Gson gson = new Gson();
|
||||
// JsonObject jsonObject = gson.fromJson(responseString, JsonObject.class);
|
||||
//
|
||||
//
|
||||
// // 创建 Map 存储各个值
|
||||
// Map<String, String> dataMap = new HashMap<String, String>();
|
||||
//
|
||||
// // 获取各个值并放入 Map
|
||||
// dataMap.put("code", jsonObject.get("code").getAsString());
|
||||
// dataMap.put("msg", jsonObject.get("msg").getAsString());
|
||||
// JsonObject data = jsonObject.getAsJsonObject("data");
|
||||
// dataMap.put("version", data.get("version").getAsString());
|
||||
// dataMap.put("province", data.get("province").getAsString());
|
||||
// dataMap.put("city", data.get("city").getAsString());
|
||||
// dataMap.put("district", data.get("district").getAsString());
|
||||
// dataMap.put("town", data.get("town").getAsString());
|
||||
// dataMap.put("village", data.get("village").getAsString());
|
||||
// dataMap.put("provinceCode", data.get("provinceCode").getAsString());
|
||||
// dataMap.put("cityCode", data.get("cityCode").getAsString());
|
||||
// dataMap.put("districtCode", data.get("districtCode").getAsString());
|
||||
// dataMap.put("townCode", data.get("townCode").getAsString());
|
||||
// dataMap.put("villageCode", data.get("villageCode").getAsString());
|
||||
// dataMap.put("areaCode", data.get("areaCode").getAsString());
|
||||
// dataMap.put("farmer", data.get("farmer").getAsString());
|
||||
// dataMap.put("isGovt", data.get("isGovt").getAsString());
|
||||
// dataMap.put("govtAddr", data.get("govtAddr").isJsonNull() ? null : data.get("govtAddr").getAsString()); // 对于可能为 null 的值,需要判断是否为空
|
||||
// JsonArray indusParkList = data.get("indusParkList").isJsonNull() ? null : data.get("indusParkList").getAsJsonArray();
|
||||
// if (indusParkList != null) {
|
||||
// JsonObject jsonObject1 = gson.fromJson(indusParkList.get(0), JsonObject.class);
|
||||
// dataMap.put("devName",jsonObject1.get("indusParkName").getAsString());
|
||||
// dataMap.put("devLevel",jsonObject1.get("indusParkLevel").getAsString());
|
||||
// }
|
||||
//
|
||||
// httpResponse.close();
|
||||
// return dataMap;
|
||||
// } else {
|
||||
// System.err.println("重试次数已用完,请求失败。");
|
||||
// }
|
||||
//
|
||||
// httpClient.close();
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
+13
-25
@@ -1,10 +1,12 @@
|
||||
package com.fangjia.open.controllers.weixin;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.core.util.CacheUtils;
|
||||
import com.fangjia.core.util.CacheUtils.CachePolicyEnum;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.core.util.GeocodeUtils;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SdQuery;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.model.SeaweedImages;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
@@ -12,7 +14,6 @@ import com.fangjia.dal.sql.model.FjtUsers;
|
||||
import com.fangjia.open.compatible.model.JsonModel;
|
||||
import com.fangjia.open.model.weixin.DistrictModel;
|
||||
import com.fangjia.open.model.weixin.DistrictSearchModel;
|
||||
import com.fangjia.open.util.BHBankUtils;
|
||||
import com.fangjia.service.api.AutoCompleteBo;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.fangjia.service.bo.DistrictStatRentBo;
|
||||
@@ -24,21 +25,16 @@ import com.fangjia.service.sql.FjtUsersService;
|
||||
import com.fangjia.service.sql.UserCityService;
|
||||
import com.fangjia.service.user.UsersInfoService;
|
||||
import com.fangjia.service.util.CookieUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DistrictController {
|
||||
|
||||
@@ -111,20 +107,12 @@ public class DistrictController {
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
if (StringUtils.isNotBlank(city)) {
|
||||
params.add(new QueryParam("city", city));
|
||||
}
|
||||
params.add(new QueryParam("category", cat));
|
||||
params.add(new QueryParam("visible", 0));
|
||||
|
||||
|
||||
BooleanQuery srQuery1 = new BooleanQuery();
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
// nameQuery.add(new TermQuery(new Term("district_name", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("address", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
nameQuery.add(new TermQuery(new Term("keyword", keyword)), BooleanClause.Occur.SHOULD);
|
||||
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), BooleanClause.Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
|
||||
srQuery1.add(nameQuery, BooleanClause.Occur.SHOULD);
|
||||
params.add(new QueryParam("$srByStr", String.format("keyword:%s^6.0 OR keyword_cjk:%s", keyword, keyword)));
|
||||
if (lat != null && lng != null && lat != 0 && lng != 0) {
|
||||
Map<String, Double> geo = GeocodeUtils.geoconvBaiduToGoogle(lng, lat);
|
||||
SdQuery sdQuery = new SdQuery();
|
||||
@@ -133,7 +121,7 @@ public class DistrictController {
|
||||
sdQuery.setDistance("500");
|
||||
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
||||
}
|
||||
params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
|
||||
|
||||
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[]{"region", "name", "address", "addrAlias", "id", "alias"});
|
||||
List<AutoCompleteBo> ret = new ArrayList<AutoCompleteBo>(districts.size());
|
||||
for (District district : districts) {
|
||||
|
||||
+1
@@ -780,6 +780,7 @@ public class WeiXinEvaluationController {
|
||||
dataMap.put("fjw", averageStatistics.getFangjiaPrice());
|
||||
dataMap.put("soufang", averageStatistics.getSoufangEsfPrice());
|
||||
dataMap.put("anjuke", averageStatistics.getAnjukeEsfPrice());
|
||||
dataMap.put("beike", averageStatistics.getBeikeEsfPrice());
|
||||
}
|
||||
}
|
||||
jsonMmodel.setJsonModel(dataMap);
|
||||
|
||||
+51
@@ -12,14 +12,26 @@ public class StructureAndCompleteDto {
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 省份编码
|
||||
*/
|
||||
private String provinceCode;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* city编码
|
||||
*/
|
||||
private String cityCode;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
private String districtCode;
|
||||
/**
|
||||
* 开发区
|
||||
*/
|
||||
@@ -28,6 +40,11 @@ public class StructureAndCompleteDto {
|
||||
* 乡镇街道
|
||||
*/
|
||||
private String township;
|
||||
|
||||
/**
|
||||
* 乡镇街道编码
|
||||
*/
|
||||
private String townshipCode;
|
||||
/**
|
||||
* 道路
|
||||
*/
|
||||
@@ -200,4 +217,38 @@ public class StructureAndCompleteDto {
|
||||
public void setAddrVerify(String addrVerify) {
|
||||
this.addrVerify = addrVerify;
|
||||
}
|
||||
|
||||
public String getProvinceCode() {
|
||||
return provinceCode;
|
||||
}
|
||||
|
||||
public void setProvinceCode(String provinceCode) {
|
||||
this.provinceCode = provinceCode;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getDistrictCode() {
|
||||
return districtCode;
|
||||
}
|
||||
|
||||
public void setDistrictCode(String districtCode) {
|
||||
this.districtCode = districtCode;
|
||||
}
|
||||
|
||||
public String getTownshipCode() {
|
||||
return townshipCode;
|
||||
}
|
||||
|
||||
public void setTownshipCode(String townshipCode) {
|
||||
this.townshipCode = townshipCode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
-12
@@ -1,18 +1,15 @@
|
||||
package com.fangjia.open.exceptionhander;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fangjia.core.util.DingDingMessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.ExceptionHandler;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
@@ -20,13 +17,12 @@ public class FangjiaOpenExceptionHandler implements ExceptionHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FangjiaOpenExceptionHandler.class);
|
||||
|
||||
public void onExcetion(Throwable e) throws ServletException, IOException {
|
||||
if (LOGGER.isErrorEnabled()) {
|
||||
LOGGER.error("", e);
|
||||
}
|
||||
ActionContext context = ActionContext.getContext();
|
||||
|
||||
if (LOGGER.isErrorEnabled()) {
|
||||
LOGGER.error("请求地址:{}", context.getRequest().getRequestURL().toString(), e);
|
||||
}
|
||||
String ip = getLocalHostIP();
|
||||
String token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c";
|
||||
String token = "ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4";
|
||||
try {
|
||||
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"服务器内部错误,请及时关注!");
|
||||
} catch (Exception e1) {
|
||||
|
||||
@@ -1,32 +1,7 @@
|
||||
package com.fangjia.open.filters;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fangjia.core.Constants;
|
||||
import com.mongodb.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.slf4j.Logger;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.core.util.ExecuteCounter;
|
||||
import com.fangjia.core.util.LoggerFactory;
|
||||
import com.fangjia.core.util.ThreadLocalData;
|
||||
import com.fangjia.core.util.ThreadLocalKey;
|
||||
@@ -35,6 +10,21 @@ import com.fangjia.open.util.OpenCookieContext;
|
||||
import com.fangjia.service.cnAnalyzer.CnDictionary;
|
||||
import com.fangjia.service.common.CookieName;
|
||||
import com.fangjia.service.dbip.IPSeeker;
|
||||
import com.mongodb.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.slf4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class AnalyticsFilter implements Filter {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AnalyticsFilter.class);
|
||||
@@ -57,6 +47,7 @@ public class AnalyticsFilter implements Filter {
|
||||
realDoFilter(request, response, chain);
|
||||
} finally {
|
||||
ThreadLocalData.getInstance().clear();
|
||||
MDC.remove("trace_id"); // ÇåÀí
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,11 +63,15 @@ public class AnalyticsFilter implements Filter {
|
||||
final ThreadLocalData threadLocalData = ThreadLocalData.getInstance();
|
||||
threadLocalData.put(ThreadLocalKey.RequestUrl, requestUrl + queryString);
|
||||
threadLocalData.put(ThreadLocalKey.RefererUrl, request.getHeader("referer"));
|
||||
if(StringUtils.isNotBlank(request.getHeader("X-Request-Id"))){
|
||||
MDC.put("trace_id", request.getHeader("X-Request-Id"));
|
||||
}else{
|
||||
MDC.put("trace_id", "*");
|
||||
}
|
||||
|
||||
if ("1".equals(request.getParameter("__refresh_cache"))) {
|
||||
threadLocalData.put(ThreadLocalKey.DisableCache, "1");
|
||||
}
|
||||
//createUID(request, response);
|
||||
//createSID(request, response);
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Allow-Methods", "*");
|
||||
chain.doFilter(request, response);
|
||||
|
||||
+46
-10
@@ -5,6 +5,7 @@ import com.fangjia.open.*;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.service.open.ApiVisitCountService;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.ActionInvocation;
|
||||
@@ -12,10 +13,8 @@ import org.sothis.web.mvc.ActionInvocationException;
|
||||
import org.sothis.web.mvc.Interceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* API访问计费Interceptor
|
||||
@@ -61,6 +60,7 @@ public class ApiVisitCountInterceptor implements Interceptor {
|
||||
List<String> serviceCodes = getServiceCode(request);
|
||||
if(serviceCodes.isEmpty()){
|
||||
if(isNeedCharge(authBean, result, uri)){
|
||||
ActionContext.getContext().set(APIConstant.API_COST_KEY, 1d);
|
||||
apiVisitCountService.increaseApiVisitCount(authBean.apiUser.getId(), uri, null, new Date());
|
||||
}
|
||||
}else{
|
||||
@@ -101,25 +101,29 @@ public class ApiVisitCountInterceptor implements Interceptor {
|
||||
}
|
||||
RestfulModelAndView mv = (RestfulModelAndView) result;
|
||||
Object object = mv.model();
|
||||
if (object != null && object instanceof BasicModel) {
|
||||
boolean isReturnData = Boolean.FALSE;
|
||||
if (object instanceof BasicModel) {
|
||||
BasicModel model = (BasicModel) object;
|
||||
if(HttpStatusCodeEnum.OK.getCode() != model.getCode()){
|
||||
return false;
|
||||
}
|
||||
} else if (object != null && object instanceof HttpCode) {
|
||||
isReturnData = isReturnData(model.getResult());
|
||||
} else if (object instanceof HttpCode) {
|
||||
HttpCode httpCode = (HttpCode) object;
|
||||
if(OpenHttpCodeEnum.OK.getCode() != httpCode.getCode()){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
isReturnData = isReturnData(object);
|
||||
}
|
||||
Boolean isReturnData = (Boolean)ActionContext.getContext().get(APIConstant.IS_RETURN_DATA);
|
||||
if(null != isReturnData && isReturnData){
|
||||
ActionContext.getContext().set(APIConstant.IS_RETURN_DATA, isReturnData);
|
||||
if(isReturnData){
|
||||
return true;
|
||||
}
|
||||
if(null == auth.getOpenResourseUrisMap()){
|
||||
if(null == auth.getOpenResourseUrisMap() || auth.getOpenResourseUrisMap().get(uri) == null){
|
||||
return true;
|
||||
}
|
||||
return auth.getOpenResourseUrisMap().get(uri) == null || auth.getOpenResourseUrisMap().get(uri) != PRICING_MODEL_BY_DATA_RESULT;
|
||||
return auth.getOpenResourseUrisMap().get(uri) != PRICING_MODEL_BY_DATA_RESULT;
|
||||
}
|
||||
/**
|
||||
* 判断是否是超级用户
|
||||
@@ -148,4 +152,36 @@ public class ApiVisitCountInterceptor implements Interceptor {
|
||||
this.apiVisitCountService = apiVisitCountService;
|
||||
}
|
||||
|
||||
private boolean isReturnData(Object result) {
|
||||
|
||||
Boolean isReturnData = (Boolean) ActionContext.getContext().get(APIConstant.IS_RETURN_DATA);
|
||||
if(isReturnData != null){
|
||||
return isReturnData;
|
||||
}
|
||||
if (result == null) {
|
||||
return false;
|
||||
}
|
||||
if (result instanceof Map) {
|
||||
Map map = (Map) result;
|
||||
if (map.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (result instanceof Collection) {
|
||||
Collection coll = (Collection) result;
|
||||
if (coll.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if (json.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+20
-49
@@ -24,6 +24,7 @@ import org.sothis.web.mvc.ActionInvocationException;
|
||||
import org.sothis.web.mvc.Interceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -56,12 +57,12 @@ public class AuditInterceptor implements Interceptor {
|
||||
|
||||
ActionContext context = invocation.getActionContext();
|
||||
long startMills = System.currentTimeMillis();
|
||||
int status;
|
||||
boolean isReturnData;
|
||||
String msg;
|
||||
Object result = invocation.invoke();
|
||||
HttpServletRequest request = context.getRequest();
|
||||
if (result != null && result instanceof RestfulModelAndView) {
|
||||
if (result instanceof RestfulModelAndView) {
|
||||
HttpServletRequest request = context.getRequest();
|
||||
int status;
|
||||
boolean isReturnData;
|
||||
String msg;
|
||||
AuthenticationBean instance = (AuthenticationBean) request.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
||||
ApiUser apiUser = null;
|
||||
User user = null;
|
||||
@@ -72,13 +73,12 @@ public class AuditInterceptor implements Interceptor {
|
||||
}
|
||||
RestfulModelAndView restfulModelAndView = (RestfulModelAndView) result;
|
||||
Object object = restfulModelAndView.model();
|
||||
if (object != null && object instanceof BasicModel) {
|
||||
if (object instanceof BasicModel) {
|
||||
BasicModel model = (BasicModel) object;
|
||||
status = model.getCode();
|
||||
msg = model.getMsg();
|
||||
model.setTid(request.getParameter("tid"));
|
||||
isReturnData = isReturnData(model.getResult());
|
||||
} else if (object != null && object instanceof HttpCode) {
|
||||
} else if (object instanceof HttpCode) {
|
||||
HttpCode httpCode = (HttpCode) object;
|
||||
status = httpCode.getCode();
|
||||
msg = httpCode.getMessage();
|
||||
@@ -92,51 +92,13 @@ public class AuditInterceptor implements Interceptor {
|
||||
} else {
|
||||
status = 200;
|
||||
msg = "返回成功(不规范API)";
|
||||
isReturnData = isReturnData(object);
|
||||
|
||||
}
|
||||
if (isReturnData) {
|
||||
ActionContext.getContext().set(APIConstant.IS_RETURN_DATA, Boolean.TRUE);
|
||||
} else if (isReturnData) {
|
||||
ActionContext.getContext().set(APIConstant.IS_RETURN_DATA, Boolean.FALSE);
|
||||
}
|
||||
openUriLogAction(request, apiUser, user, object, status, isReturnData, msg, startMills);
|
||||
openUriLogAction(request, apiUser, user, object, status, msg, startMills);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isReturnData(Object result) {
|
||||
|
||||
Boolean isReturnData = (Boolean) ActionContext.getContext().get(APIConstant.IS_RETURN_DATA);
|
||||
if(isReturnData != null){
|
||||
return isReturnData;
|
||||
}
|
||||
if (result == null) {
|
||||
return false;
|
||||
}
|
||||
if (result instanceof Map) {
|
||||
Map map = (Map) result;
|
||||
if (map.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (result instanceof Collection) {
|
||||
Collection coll = (Collection) result;
|
||||
if (coll.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if (json.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setOpenUriLogService(OpenUriLogService openUriLogService) {
|
||||
this.openUriLogService = openUriLogService;
|
||||
}
|
||||
@@ -159,11 +121,10 @@ public class AuditInterceptor implements Interceptor {
|
||||
* @param request
|
||||
* @param apiUser
|
||||
* @param status
|
||||
* @param isReturnData
|
||||
* @param msg
|
||||
* @param startMills
|
||||
*/
|
||||
private void openUriLogAction(HttpServletRequest request, ApiUser apiUser, User user, Object result, int status, boolean isReturnData, String msg, long startMills) {
|
||||
private void openUriLogAction(HttpServletRequest request, ApiUser apiUser, User user, Object result, int status, String msg, long startMills) {
|
||||
|
||||
|
||||
/**1:无token或者token错误的不记录日志 2:OpenApi测试账户:仅供房价网内部使用,正常访问的情况下不记录日志*/
|
||||
@@ -191,6 +152,10 @@ public class AuditInterceptor implements Interceptor {
|
||||
openUriLog.setTime(System.currentTimeMillis() - startMills);
|
||||
openUriLog.setCode(status);
|
||||
openUriLog.setMsg(msg);
|
||||
Boolean isReturnData = (Boolean) ActionContext.getContext().get(APIConstant.IS_RETURN_DATA);
|
||||
if(isReturnData == null){
|
||||
isReturnData= false;
|
||||
}
|
||||
openUriLog.setDataStatus(isReturnData?1:0);
|
||||
String tid = request.getParameter("tid");
|
||||
openUriLog.setTid(tid);
|
||||
@@ -203,6 +168,12 @@ public class AuditInterceptor implements Interceptor {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("", e);
|
||||
}
|
||||
Double cost = (Double) ActionContext.getContext().get(APIConstant.API_COST_KEY);
|
||||
if(cost != null){
|
||||
openUriLog.setCost(cost);
|
||||
}else{
|
||||
openUriLog.setCost(0d);
|
||||
}
|
||||
queue.put(openUriLog);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
+3
-2
@@ -109,12 +109,13 @@ public class AuthenticationInterceptor implements Interceptor {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String ip = getLocalHostIP();
|
||||
String token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c";
|
||||
String token = "ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4";
|
||||
try {
|
||||
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"Authentication error£¡");
|
||||
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"Authentication 错误!");
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
LOGGER.error("请求地址:{}", context.getRequest().getRequestURL().toString(), e);
|
||||
LOGGER.error("Authentication error : ", e);
|
||||
ret.setModel(BasicModel.buildServerErrorModel());
|
||||
ret.setViewParam("code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
public class CommercialModel extends FangjiaApiModel{
|
||||
|
||||
@NotBlank
|
||||
private String address;
|
||||
private Double size;
|
||||
private String location;
|
||||
|
||||
|
||||
private Integer floor;//所在楼层
|
||||
private Integer maxFloor;//总楼层
|
||||
|
||||
private Integer passengerFlow;//客流量---0:高 1:中 2:低
|
||||
private Integer LeaseStability;//租约稳定性---0:持续稳定出租 1:阶段性出租 2:偶尔出租 3:未出租
|
||||
private Integer sellType;//出售/转让---0:出售 1:转让
|
||||
private Integer decorationCost;//装修成本(单位:万元)
|
||||
private Integer decorationYear;//装修年限(单位:年)
|
||||
@NotBlank
|
||||
private Integer estateType;//商铺类型---0:临街商铺 1:住宅底商 2:购物百货中心 3:写字楼商铺 4:档口摊位 5:市场类商铺 6:交通设施商铺 7:旅游商铺
|
||||
|
||||
private Integer showSample;//是否显示样本 1:显示
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Integer getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(Integer floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public Integer getMaxFloor() {
|
||||
return maxFloor;
|
||||
}
|
||||
|
||||
public void setMaxFloor(Integer maxFloor) {
|
||||
this.maxFloor = maxFloor;
|
||||
}
|
||||
|
||||
public Integer getPassengerFlow() {
|
||||
return passengerFlow;
|
||||
}
|
||||
|
||||
public void setPassengerFlow(Integer passengerFlow) {
|
||||
this.passengerFlow = passengerFlow;
|
||||
}
|
||||
|
||||
public Integer getLeaseStability() {
|
||||
return LeaseStability;
|
||||
}
|
||||
|
||||
public void setLeaseStability(Integer leaseStability) {
|
||||
LeaseStability = leaseStability;
|
||||
}
|
||||
|
||||
public Integer getSellType() {
|
||||
return sellType;
|
||||
}
|
||||
|
||||
public void setSellType(Integer sellType) {
|
||||
this.sellType = sellType;
|
||||
}
|
||||
|
||||
public Integer getDecorationCost() {
|
||||
return decorationCost;
|
||||
}
|
||||
|
||||
public void setDecorationCost(Integer decorationCost) {
|
||||
this.decorationCost = decorationCost;
|
||||
}
|
||||
|
||||
public Integer getDecorationYear() {
|
||||
return decorationYear;
|
||||
}
|
||||
|
||||
public void setDecorationYear(Integer decorationYear) {
|
||||
this.decorationYear = decorationYear;
|
||||
}
|
||||
|
||||
public Integer getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(Integer estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
|
||||
public Integer getShowSample() {
|
||||
return showSample;
|
||||
}
|
||||
|
||||
public void setShowSample(Integer showSample) {
|
||||
this.showSample = showSample;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ public class FilesModel extends FangjiaApiModel {
|
||||
private MultipartFile file;
|
||||
private String contentType;
|
||||
private String filename;
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
public MultipartFile getFile() {
|
||||
return file;
|
||||
@@ -31,4 +35,12 @@ public class FilesModel extends FangjiaApiModel {
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ public class HouseInfomationModel extends FangjiaApiModel {
|
||||
/**
|
||||
* 面积
|
||||
*/
|
||||
private double size;
|
||||
private Double size;
|
||||
|
||||
/**
|
||||
* 所在楼层
|
||||
@@ -402,11 +402,11 @@ public class HouseInfomationModel extends FangjiaApiModel {
|
||||
this.roomNumber = roomNumber;
|
||||
}
|
||||
|
||||
public double getSize() {
|
||||
public Double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(double size) {
|
||||
public void setSize(Double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ public class HouseSearchModel extends SearchModel {
|
||||
private String cat;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private Double price;
|
||||
|
||||
// ÆÚÊý
|
||||
private Integer periodCount;
|
||||
@Override
|
||||
public QueryBean getQueryBean() {
|
||||
HouseQueryBean queryBean = new HouseQueryBean();
|
||||
@@ -209,4 +214,20 @@ public class HouseSearchModel extends SearchModel {
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Integer getPeriodCount() {
|
||||
return periodCount;
|
||||
}
|
||||
|
||||
public void setPeriodCount(Integer periodCount) {
|
||||
this.periodCount = periodCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class JNBankSearchModel extends FangjiaApiModel {
|
||||
@NotBlank
|
||||
private String CITY_CD;
|
||||
|
||||
@NotBlank
|
||||
// @NotBlank
|
||||
private String DISTRICT_CD;
|
||||
|
||||
@NotBlank
|
||||
|
||||
+20
@@ -292,6 +292,10 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
private Integer level;
|
||||
private Integer type;
|
||||
|
||||
private String tags;
|
||||
|
||||
private String sampleIds;
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
}
|
||||
@@ -942,4 +946,20 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void setSampleIds(String sampleIds) {
|
||||
this.sampleIds = sampleIds;
|
||||
}
|
||||
|
||||
public String getSampleIds() {
|
||||
return sampleIds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mongodb.gridfs.GridFS;
|
||||
import com.mongodb.gridfs.GridFSDBFile;
|
||||
import com.mongodb.gridfs.GridFSInputFile;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -70,6 +71,18 @@ public class FileDao {
|
||||
return fsInputFile;
|
||||
}
|
||||
|
||||
public GridFSInputFile saveToGridFs(InputStream inputStream, String filename, String contentType, String type){
|
||||
GridFSInputFile fsInputFile = gridFs.createFile(inputStream, filename);
|
||||
fsInputFile.put("contentType", contentType);
|
||||
if (StringUtils.isNotBlank(type)){
|
||||
fsInputFile.put("t", type);
|
||||
} else {
|
||||
fsInputFile.put("t", "default");
|
||||
}
|
||||
fsInputFile.save();
|
||||
return fsInputFile;
|
||||
}
|
||||
|
||||
public GridFSDBFile findByIdInGridFS(String id){
|
||||
return gridFs.findOne(new ObjectId(id));
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class CollateralSampleQuery {
|
||||
private String city;
|
||||
|
||||
/**区域*/
|
||||
@NotBlank
|
||||
// @NotBlank
|
||||
private String district;
|
||||
|
||||
@NotBlank
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%t] %c{3\} - %m%n" />
|
||||
<param name="ConversionPattern" value="[%X{trace_id}] [%d{MMdd HH:mm:ss SSS\} %-5p] [%t] %c{3\} - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<param name="File" value="/home/goojia/logs/open.log" />
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%t] %c{3\} - %m%n" />
|
||||
<param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%X{trace_id}] [%t] %c{3\} - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<param name="File" value="/home/goojia/logs/performance.open.log" />
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%t] %c{3\} - %m%n" />
|
||||
<param name="ConversionPattern" value="[%d{MMdd HH:mm:ss SSS\} %-5p] [%X{trace_id}] [%t] %c{3\} - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ sothis.interceptors.valid.class=com.fangjia.open.interceptors.ValidatorIntercept
|
||||
sothis.interceptors.viewConfig.class=com.fangjia.open.interceptors.JsonViewInterceptor
|
||||
sothis.interceptors.apiVisit.class=com.fangjia.open.interceptors.ApiVisitCountInterceptor
|
||||
sothis.interceptors.decrypt.class=com.fangjia.open.interceptors.DecryptInterceptor
|
||||
sothis.interceptors.stack.default=apiVisit,audit,upload,auth,decrypt,params,valid,viewConfig
|
||||
sothis.interceptors.stack.default=audit,apiVisit,upload,auth,decrypt,params,valid,viewConfig
|
||||
|
||||
sothis.views.ftl.class=org.sothis.web.mvc.views.freemarker.FreemarkerView
|
||||
sothis.views.rest.class=com.fangjia.open.views.RestView
|
||||
|
||||
@@ -66,12 +66,11 @@
|
||||
<bean id="seaweedDao" class="com.fangjia.dal.seaweed.dao.SeaweedDaoImpl">
|
||||
<property name="mongo" ref="seabirdMongo" />
|
||||
</bean>
|
||||
<bean id="seawater" class="com.fangjia.datastore.driver.DataStore">
|
||||
<constructor-arg value="${fangjia.seawater.host}" />
|
||||
<constructor-arg value="${fangjia.seawater.port}" />
|
||||
</bean>
|
||||
<!-- <bean id="seawater" class="com.fangjia.datastore.driver.DataStore">-->
|
||||
<!-- <constructor-arg value="${fangjia.seawater.host}" />-->
|
||||
<!-- <constructor-arg value="${fangjia.seawater.port}" />-->
|
||||
<!-- </bean>-->
|
||||
<bean id="abstractSeawaterDao" class="com.fangjia.dal.SeawaterDaoImpl" abstract="true">
|
||||
<property name="seawater" ref="seawater" />
|
||||
</bean>
|
||||
<bean id="seawaterDao" class="com.fangjia.dal.seawater.dao.SeawaterDaoImpl" parent="abstractSeawaterDao" />
|
||||
</beans>
|
||||
@@ -96,7 +96,7 @@ abstract class BaseBatch {
|
||||
exception = true
|
||||
e.printStackTrace()
|
||||
__jms.monitor(batchName, '', extraData, e)
|
||||
def msg = "½Å±¾·¢ÉúÒì³£ BatchName:${batchName}\t"
|
||||
def msg = "脚本发生异常错误 BatchName:${batchName}\t"
|
||||
def batchOwner = getBatchOwner(batch)
|
||||
if(batchOwner && batchOwner.size() > 0){
|
||||
def owner = null
|
||||
@@ -110,19 +110,20 @@ abstract class BaseBatch {
|
||||
if(e){
|
||||
msg += "\tException:" + e.getClass().name
|
||||
}
|
||||
def phoneNum = getBatchPhones(batch)
|
||||
if(SystemUtils.IS_OS_LINUX){
|
||||
sendDingDingMsg("2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c",msg)
|
||||
sendDingDingMsg("ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4",msg, phoneNum)
|
||||
|
||||
try {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("phone", "13764369683");
|
||||
params.put("type", "taskFail");
|
||||
params.put("msg", batchName.substring(batchName.length() - 20, batchName.length()));
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
httpRequest.get("http://didata-cloud-server.fangjia.com/sms/send", params, "utf-8");
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
// try {
|
||||
// Map<String, String> params = new HashMap<String, String>();
|
||||
// params.put("phone", "13764369683");
|
||||
// params.put("type", "taskFail");
|
||||
// params.put("msg", batchName.substring(batchName.length() - 20, batchName.length()));
|
||||
// HttpRequest httpRequest = new HttpRequest();
|
||||
// httpRequest.get("http://didata-cloud-server.fangjia.com/sms/send", params, "utf-8");
|
||||
// } catch (Exception ex) {
|
||||
//
|
||||
// }
|
||||
|
||||
task.exception = msg.toString()
|
||||
}
|
||||
@@ -174,6 +175,27 @@ abstract class BaseBatch {
|
||||
return ret
|
||||
}
|
||||
|
||||
static def getBatchPhones(BaseBatch bb) {
|
||||
def phones = []
|
||||
try {
|
||||
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
|
||||
if (annotation) {
|
||||
annotation.value().each {
|
||||
def map = it.toMap()
|
||||
if (map?.mobile) {
|
||||
phones << map.mobile
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bb.logWarn('!!!请使用' + BatchOwner.class.getName() + '注解标明本Batch的拥有者!!!')
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.logWarn('!!!解析BatchOwner失败!!!', e)
|
||||
}
|
||||
return phones[0] ? phones[0] : ""
|
||||
}
|
||||
|
||||
|
||||
static def getBatchDescribe(BaseBatch bb){
|
||||
try {
|
||||
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
|
||||
@@ -217,8 +239,8 @@ abstract class BaseBatch {
|
||||
__jms.sendDingMsg(mobile, msg)
|
||||
}
|
||||
|
||||
def static sendDingDingMsg(String token, String msg){
|
||||
DingDingMessageUtil.sendTextMessage(token, msg);
|
||||
def static sendDingDingMsg(String token, String msg, String phoneNum){
|
||||
DingDingMessageUtil.sendTextMessageAndAt(token, msg, phoneNum);
|
||||
}
|
||||
|
||||
// def static getProp(String key){
|
||||
|
||||
+28
-85
@@ -1,24 +1,20 @@
|
||||
package com.fangjia.script.averager
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.Constants
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.datastore.driver.DSCollection
|
||||
import com.fangjia.core.util.DingDingMessageUtil
|
||||
import com.fangjia.core.util.MongoUtils
|
||||
import com.fangjia.datastore.driver.DSCursor
|
||||
import com.fangjia.datastore.driver.DataStore
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.cover.EmailTemplate
|
||||
import com.fangjia.script.jms.QueueRedirectConsumer
|
||||
import com.fangjia.script.util.Jms
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.ServerAreaMap
|
||||
import com.google.common.collect.MapDifference
|
||||
import com.google.common.collect.Maps
|
||||
import com.mongodb.*
|
||||
import org.bson.Document
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
/**
|
||||
* 通知计算二手房均价
|
||||
* @author duxiaoyu
|
||||
@@ -28,13 +24,11 @@ import org.bson.types.ObjectId
|
||||
class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
|
||||
|
||||
public static final DSCollection SEAWEED_COLL = new DataStore("seaweed.db.fangjia.com", 27007).getCollection("fangjia.seaweed")
|
||||
public final static DBCollection REGION_COLL = new Mongo("mongo.db.fangjia.com", 27017).getDB('fangjia').getCollection('region_block')
|
||||
public final static DBCollection COMMAND_COLL = new Mongo("log.mongo.db.fangjia.com", 52002).getDB('fangjia_log').getCollection('calc_command')
|
||||
public final static DBCollection REGION_STAT_COLL = new Mongo("mongo.db.fangjia.com", 27017).getDB('fangjia').getCollection('region_stat')
|
||||
public final static DBCollection DISTRICT_STAT_COLL = new Mongo("mongo.db.fangjia.com", 27017).getDB('fangjia_stat').getCollection('district_stat')
|
||||
public final static DBCollection DISTRICT_STAT_206_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.206",27020)
|
||||
|
||||
public static final DBCollection SEAWEED_COLL = MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, 'fangjia', 'seaweed')
|
||||
public final static DBCollection COMMAND_COLL = MongoUtils.getDbCollection(Constants.LOG_MONGO_URI, 'fangjia_log', 'calc_command')
|
||||
public final static DBCollection REGION_STAT_COLL = MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, 'fangjia', 'region_stat')
|
||||
public final static DBCollection DISTRICT_STAT_COLL = MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, 'fangjia_stat', 'district_stat')
|
||||
public final static DBCollection REGION_COLL = MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, 'fangjia', 'region_block')
|
||||
public final static def WORKER_MACHINE_IPS = ["fangjia-priceanalysis-0", "fangjia-priceanalysis-1","fangjia-priceanalysis-2"]
|
||||
public final static def TOKEN="35587c9e7accc54ff7ddf2c6ebdc36a3ba065b4a2bdac78c0e9928596361b430"
|
||||
|
||||
@@ -63,22 +57,14 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
final Date startDate = new Date();
|
||||
|
||||
for (String city : cities) {
|
||||
List<String> idList = getAllDistrictIds(city)
|
||||
logInfo(city + ":" + idList.size())
|
||||
List<DBObject> allDistrict = getAllDistrict(city)
|
||||
logInfo(city + ":" + allDistrict.size())
|
||||
//生成计算小区队列
|
||||
|
||||
for (String id : idList) {
|
||||
DBObject fields = new BasicDBObject()
|
||||
fields.put("city", 1)
|
||||
fields.put("region", 1)
|
||||
fields.put("name", 1)
|
||||
fields.put("estate_type2", 1)
|
||||
DBObject district = SEAWEED_COLL.findOne(new BasicDBObject("_id", new ObjectId(id)), fields)
|
||||
|
||||
if (district != null && !districtHasPrice(district.get('city'), district.get('region'), weekend, district.get('name'))) {
|
||||
String region = district.get('region')
|
||||
String name = district.get('name')
|
||||
String estateType = district.get('estate_type2')
|
||||
for (DBObject district : allDistrict) {
|
||||
if (!districtHasPrice((String)district.get('city'), (String)district.get('region'), weekend, (String)district.get('name'))) {
|
||||
String region = (String)district.get('region')
|
||||
String name = (String)district.get('name')
|
||||
String estateType = (String)district.get('estate_type2')
|
||||
districtCount++
|
||||
String ip = WORKER_MACHINE_IPS[districtCount % WORKER_MACHINE_IPS.size()]
|
||||
saveDistrictCalcCommand(city, region, name, estateType, weekend, ip)
|
||||
@@ -92,8 +78,6 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
Thread.sleep(1000 * 5)
|
||||
println("${new Date().format("yyyyMMdd HH:mm:ss")} 等待均价计算完成")
|
||||
}
|
||||
|
||||
|
||||
for (String city : cities) {
|
||||
//计算该城市的城市、区域、板块均价
|
||||
List<DBObject> regions = getRegions(city)
|
||||
@@ -176,7 +160,6 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
appliesCount++;
|
||||
}
|
||||
}
|
||||
DBCollection DISTRICT_STAT_COLL = new Mongo("mongo.db.fangjia.com", 27017).getDB('fangjia_stat').getCollection('district_stat')
|
||||
def statMap = [:]
|
||||
def preStatMap = [:]
|
||||
DISTRICT_STAT_COLL.find(new BasicDBObject("weekend", weekend)).batchSize(1000).each { BasicDBObject doc->
|
||||
@@ -222,7 +205,7 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
blockCount = REGION_STAT_COLL.count(query);
|
||||
def msg = "本周小区均价计算量:" + districtCount + ";本周城市均价计算量:" + cityCount + ";本周区域均价计算量:" + regionCount + ";本周板块均价计算量:" + blockCount + ";本周小区均价涨跌幅超过4%小区数量:" + appliesCount + ";计算均价超过10%小区量:" + bigMarkupCount+ ";运行时间:" + secondToTime(time) + ".";
|
||||
//发送钉钉提示
|
||||
sendDingDingMsg(TOKEN, msg);
|
||||
DingDingMessageUtil.sendTextMessage(TOKEN, msg)
|
||||
EmailTemplate sd = new EmailTemplate("mixedZone.ftl")
|
||||
Map map = new HashMap()
|
||||
map.put('applies', applies)
|
||||
@@ -286,35 +269,6 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
boolean isCalcFinish(){
|
||||
DBObject q = new BasicDBObject("status",0)
|
||||
return COMMAND_COLL.count(q) == 0
|
||||
}
|
||||
void DisSync206To43(Date startDate){
|
||||
//Êý¾ÝÇ¨ÒÆ
|
||||
def query = new BasicDBObject()
|
||||
query.put("m_date", new BasicDBObject('$gte', startDate))
|
||||
DBCursor cursor = DISTRICT_STAT_206_COLL.find(query).addOption(Bytes.QUERYOPTION_NOTIMEOUT).batchSize(10000)
|
||||
long count = 0
|
||||
long total = cursor.count()
|
||||
List<BasicDBObject> bs = new ArrayList<BasicDBObject>()
|
||||
for (BasicDBObject log : cursor) {
|
||||
bs.add(log)
|
||||
count++
|
||||
if (bs.size() > 1000) {
|
||||
try {
|
||||
DISTRICT_STAT_COLL.insert(bs)
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
bs.clear();
|
||||
println("Êý¾ÝÇ¨ÒÆ:${DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")} ${total}/${count} ½ø¶È:${DataUtil.roundDouble((count * 100l) / total, 2)}")
|
||||
}
|
||||
}
|
||||
try {
|
||||
DISTRICT_STAT_COLL.insert(bs)
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,9 +293,9 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
* @param weekend
|
||||
* @return
|
||||
*/
|
||||
boolean districtHasPrice(String city, String region, Date weekend,String district_name){
|
||||
String ischeckDistrictHasPrice = System.getProperty("ischeckDistrictHasPrice")
|
||||
if(ischeckDistrictHasPrice!=null && ischeckDistrictHasPrice.trim().equals("true")){
|
||||
boolean districtHasPrice(String city, String region, Date weekend, String district_name){
|
||||
String isCheckDistrictHasPrice = System.getProperty("isCheckDistrictHasPrice")
|
||||
if(isCheckDistrictHasPrice!=null && isCheckDistrictHasPrice.trim().equalsIgnoreCase("true")){
|
||||
def query = new BasicDBObject()
|
||||
query.append("city", city)
|
||||
query.append("region", region)
|
||||
@@ -398,31 +352,20 @@ class InsertMonitorCalcCommandBatch extends BaseBatch {
|
||||
|
||||
}
|
||||
|
||||
private List<String> getAllDistrictIds(String city) {
|
||||
private List<DBObject> getAllDistrict(String city) {
|
||||
|
||||
DBObject q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("cat", "district")
|
||||
q.put("visible", 0)
|
||||
q.put("status", 0)
|
||||
|
||||
int trytimes = 5
|
||||
Set<String> uniqueIdList = new LinkedHashSet<String>()
|
||||
DBObject fields = new BasicDBObject()
|
||||
fields.put("city", 1)
|
||||
fields.put("region", 1)
|
||||
fields.put("name", 1)
|
||||
fields.put("estate_type2", 1)
|
||||
|
||||
for(int i=0; i<trytimes; i++) {
|
||||
DSCursor cur = SEAWEED_COLL.find(q, new BasicDBObject("_id", 1)).batchSize(2000)
|
||||
int totalCount = cur.count()
|
||||
Iterator<DBObject> iter = cur.iterator()
|
||||
while(iter.hasNext()) {
|
||||
DBObject dbo = iter.next()
|
||||
String id = dbo.get('_id')
|
||||
uniqueIdList.add(id)
|
||||
}
|
||||
|
||||
if(uniqueIdList.size() == totalCount) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<String>(uniqueIdList)
|
||||
return SEAWEED_COLL.find(q, fields).batchSize(2000).toArray()
|
||||
}
|
||||
|
||||
private List<DBObject> getRegions(String city) {
|
||||
|
||||
+3
-3
@@ -32,8 +32,8 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch {
|
||||
// public static final DSCollection SEAWEED_COLL = new DataStore("seaweed.db.fangjia.com", 27007).getCollection("fangjia.seaweed")
|
||||
public static final DBCollection SEAWEED_COLL = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com")
|
||||
public final static DBCollection COMMAND_COLL = new MongoClient("log.mongo.db.fangjia.com", 52002).getDB('fangjia_log').getCollection('calc_command')
|
||||
public final static DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com", 27017)
|
||||
public final static DBCollection REGION_COLL = MongoUtils.getCollectionByName("fangjia", "region_block", "mongo.db.fangjia.com", 27017)
|
||||
public final static DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com")
|
||||
public final static DBCollection REGION_COLL = MongoUtils.getCollectionByName("fangjia", "region_block", "mongo.db.fangjia.com")
|
||||
|
||||
public final static def WORKER_MACHINE_IPS = ["fangjia-priceanalysis-0", "fangjia-priceanalysis-1","fangjia-priceanalysis-2"]
|
||||
public final static def TOKEN="35587c9e7accc54ff7ddf2c6ebdc36a3ba065b4a2bdac78c0e9928596361b430"
|
||||
@@ -185,7 +185,6 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch {
|
||||
q.put("category", CALC_CATEGORY)
|
||||
q.put('status', new BasicDBObject('$in', [0,1,102])) // 0-初始状态 1-处理中 102-计算完成 2-完成 3-处理错误 4-处理异常
|
||||
while(true) {
|
||||
sleep(5 * 60 * 1000)
|
||||
def c = COMMAND_COLL.count(q)
|
||||
logInfo("calc command: " + c)
|
||||
if(c <= 0) {
|
||||
@@ -208,6 +207,7 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sleep(5 * 60 * 1000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
-8
@@ -25,7 +25,7 @@ import com.mongodb.DBObject
|
||||
class ApiInvokeStatistics extends BaseBatch{
|
||||
final static def mongoDomain = "mongo.db.fangjia.com"
|
||||
public static final DBCollection OPEN_URI_LOG = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
|
||||
public static final DBCollection OPEN_URI_LOG_COUNT = MongoUtils.getCollectionByName("business", "api_invoke_statistical", "mongo.db.fangjia.com", 27017)
|
||||
public static final DBCollection OPEN_URI_LOG_COUNT = MongoUtils.getCollectionByName("business", "api_invoke_statistical", "mongo.db.fangjia.com", 28017)
|
||||
static final dbFangjia = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?autoReconnect=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver");
|
||||
static main(args) {
|
||||
def s = System.currentTimeMillis()
|
||||
@@ -43,8 +43,13 @@ class ApiInvokeStatistics extends BaseBatch{
|
||||
def getYestodayLog(Date today,Date yestoday){
|
||||
//Date today = getToday();
|
||||
//Date yestoday = getNextDay(today)
|
||||
BasicDBObject query= new BasicDBObject("c_date", new BasicDBObject('$gt',yestoday).append('$lt', today))
|
||||
DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def deleteQuery = new BasicDBObject("statistical_date", yestoday)
|
||||
OPEN_URI_LOG_COUNT.remove(deleteQuery)
|
||||
println "ÒÑɾ³ý ${yestoday.format('yyyy-MM-dd')} µÄ¾Éͳ¼ÆÊý¾Ý"
|
||||
BasicDBObject query= new BasicDBObject("c_date", new BasicDBObject('$gte',yestoday).append('$lt', today))
|
||||
// DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
DBCursor dbc = OPEN_URI_LOG.find(query, new BasicDBObject("res_map", 0)).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
|
||||
def results = [:]
|
||||
int c = 0
|
||||
dbc.each {BasicDBObject log->
|
||||
@@ -103,11 +108,12 @@ class ApiInvokeStatistics extends BaseBatch{
|
||||
obj.append("total_time",total_time)
|
||||
obj.append("statistical_date",yestoday)
|
||||
obj.append("user_name",companyName)
|
||||
DBObject qu = new BasicDBObject();
|
||||
qu.append("user_id", userIDStr);
|
||||
qu.append("request_uri", uri);
|
||||
qu.append("statistical_date", yestoday)
|
||||
OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
|
||||
// DBObject qu = new BasicDBObject();
|
||||
// qu.append("user_id", userIDStr);
|
||||
// qu.append("request_uri", uri);
|
||||
// qu.append("statistical_date", yestoday)
|
||||
// OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
|
||||
OPEN_URI_LOG_COUNT.insert(obj)
|
||||
}
|
||||
|
||||
|
||||
|
||||
-2
@@ -64,8 +64,6 @@ class AutocompleteDataUpdaterBatch extends BaseBatch {
|
||||
DSCursor cur = SEAWEED_COLL.find(q, fields).batchSize(2000)
|
||||
Iterator<DBObject> iter = cur.iterator()
|
||||
int i = 0
|
||||
|
||||
Map<String, String> keywordMap = new HashMap<String, String>()
|
||||
while(iter.hasNext()) {
|
||||
i++
|
||||
if(i % 100 == 0) {
|
||||
|
||||
@@ -245,7 +245,7 @@ public class CommonUtils {
|
||||
data.put("remark", 'week')
|
||||
data.put("c_date", new Date())
|
||||
if(isTest){
|
||||
data.put("ip", "192.168.0.231")
|
||||
data.put("ip", "192.168.10.29")
|
||||
COMMAND_COLL.update(cmd, new BasicDBObject('$set', data), true, false)
|
||||
}else{
|
||||
data.put("ip", ["fangjia-priceanalysis-0", "fangjia-priceanalysis-1"][new Random().nextInt(2)])
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import com.fangjia.core.util.MongoUtils
|
||||
|
||||
/**
|
||||
* Created by dxy on 2015/9/14.
|
||||
@@ -43,7 +44,7 @@ public class ServerAreaMap {
|
||||
}
|
||||
|
||||
private static def findServerAreas(host, port, q, sq) {
|
||||
DBCollection collection = MongoUtils.getCollectionByName("fangjia", "server_area", host, port);
|
||||
DBCollection collection = MongoUtils.getDbCollection(com.fangjia.core.Constants.FANGJIA_MONGO_URI, "fangjia", "server_area");
|
||||
DBCursor cur = null;
|
||||
if(q != null) {
|
||||
cur = collection.find(q)
|
||||
|
||||
+16
-11
@@ -1,14 +1,19 @@
|
||||
package com.fangjia.script.wenyan
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
|
||||
def citys = ["北京", "唐山", "天津", "秦皇岛", "石家庄", "包头", "太原", "丹东", "呼和浩特", "锦州", "沈阳", "吉林", "大连", "牡丹江", "长春", "无锡", "哈尔滨", "扬州", "上海", "徐州", "南京", "温州", "杭州", "金华", "宁波", "蚌埠", "合肥", "安庆", "福州", "泉州", "厦门", "九江", "南昌", "赣州", "济南", "烟台", "青岛", "济宁", "郑州", "洛阳", "武汉", "平顶山", "长沙", "宜昌", "广州", "襄阳", "深圳", "岳阳", "南宁", "常德", "海口", "惠州", "重庆", "湛江", "成都", "韶关", "贵阳", "桂林", "昆明", "北海", "西安", "三亚", "兰州", "泸州", "西宁", "南充", "银川", "遵义", "乌鲁木齐", "大理", "北京", "上海", "广州", "深圳", "重庆", "郑州", "长沙", "西安", "成都", "东莞", "佛山", "杭州", "合肥", "南京", "青岛", "沈阳", "苏州", "天津", "武汉", "珠海", "中山", "长春", "扬州", "烟台", "徐州", "无锡", "温州", "太原", "台州", "石家庄", "绍兴", "厦门", "泉州", "宁波", "南通", "南宁", "南昌", "兰州", "常州", "大连", "福州", "贵阳", "哈尔滨", "海口", "惠州", "济南", "嘉兴", "金华", "昆明", "遵义", "淄博", "株洲", "镇江", "肇庆", "漳州", "湛江", "岳阳", "银川", "宜昌", "盐城", "芜湖", "乌鲁木齐", "唐山", "泰州", "汕头", "三亚", "清远", "秦皇岛", "马鞍山", "洛阳", "柳州", "连云港", "廊坊", "九江", "吉林", "淮安", "湖州", "呼和浩特", "沧州", "保定", "安庆", "张家口", "西宁", "日照", "拉萨", "锦州", "大同", "常德", "北海", "文昌", "陵水", "保亭"]
|
||||
citys.unique()
|
||||
citys.each { def city ->
|
||||
if (RegionData.isCity(city)) {
|
||||
ElasticUtils.executeSqlQuery("select count(*) as count from seawater where p_date > 20210407 and city='${city}'", {
|
||||
println("$city\t${it.count}")
|
||||
})
|
||||
}
|
||||
}
|
||||
import org.apache.commons.mail.SimpleEmail
|
||||
|
||||
import javax.mail.internet.MimeUtility
|
||||
|
||||
EMAIL_SERVER = "smtp.exmail.qq.com"
|
||||
SimpleEmail email = new SimpleEmail();
|
||||
email.setSSL(true);
|
||||
email.setHostName(EMAIL_SERVER);
|
||||
email.setSslSmtpPort("465");
|
||||
email.setCharset("GBK")
|
||||
email.setAuthentication("service@fangjia.com", "iXWzdL69CnzxksaE");
|
||||
email.addTo("wangwenyan@fangjia.com");
|
||||
email.setFrom("service@fangjia.com", MimeUtility.encodeText("房价网大数据中心"), "utf-8");//发送方
|
||||
email.setSubject("标题");
|
||||
email.setContent("你好", "text/html");
|
||||
email.send();
|
||||
@@ -1,62 +1,11 @@
|
||||
package com.fangjia.script.wenyan
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.client.MongoCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.http.NameValuePair
|
||||
import org.apache.http.client.config.CookieSpecs
|
||||
import org.apache.http.client.config.RequestConfig
|
||||
import org.apache.http.client.methods.CloseableHttpResponse
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.http.client.utils.URLEncodedUtils
|
||||
import org.apache.http.impl.client.CloseableHttpClient
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager
|
||||
import org.apache.http.message.BasicNameValuePair
|
||||
import org.apache.http.util.EntityUtils
|
||||
import org.bson.Document
|
||||
|
||||
//com.mongodb.client.MongoCollection<Document> GUIDING_PRICE = Mongo3Utils.getDbCollection("fangjia", "guiding_price")
|
||||
//
|
||||
//Mongo3Utils.getDbCollection("fangjia", "confirm_price_data").find(new BasicDBObject("isGuidancePrice", 0)).each { Document doc->
|
||||
// Document item = new Document()
|
||||
// item.put("guiding_type", 0)
|
||||
// item.put("city", doc.city)
|
||||
// item.put("region", doc.region)
|
||||
// item.put("name", doc.district_name)
|
||||
// item.put("guiding_person", doc.user_name)
|
||||
// item.put("category", "district")
|
||||
// item.put("guiding_value", doc.price)
|
||||
// item.put("guiding_date", doc.c_date)
|
||||
// item.put("house_type", 0)
|
||||
// item.put("estate_type", DbUtils.seaweed.findOne(DbUtils.buildSeaweedQuery(doc.city, doc.region, doc.district_name))?.estate_type2)
|
||||
// item.put("c_date", new Date())
|
||||
// GUIDING_PRICE.insertOne(item)
|
||||
// println(item)
|
||||
//}
|
||||
def keys = []
|
||||
ExcelUtils.read("D:\\Users\\wenyan\\Desktop\\ͶƱ½á¹ûÃ÷ϸ(1).xlsx").each {List item->
|
||||
keys << "${item['A']}_${item['B']}_${item["C"]}".toString()
|
||||
println(item)
|
||||
}
|
||||
MongoCollection<Document> FANGJIA_STAT = Mongo3Utils.getDbCollection("fangjia_stat", "district_stat")
|
||||
def creditMap = [:]
|
||||
FANGJIA_STAT.find(new Document("weekend", DateUtil.parseDate("20200322", "yyyyMMdd"))).each {Document d->
|
||||
def key ="${d.city}_${d.region}_${d.district_name}".toString()
|
||||
if(!keys.contains(key)){
|
||||
Double credit = (int)(d.credit * 10)
|
||||
creditMap[credit] = creditMap.get(credit, 0) + 1
|
||||
}
|
||||
}
|
||||
creditMap.each {def key, value->
|
||||
println("${key}\t${value}")
|
||||
ExcelUtils.read("C:\\Users\\goojia\\Downloads\\꼿제팀섬꿎桿친겼.xlsx",1).each {
|
||||
def one = DbUtils.seaweed.findOne(DbUtils.buildSeaweedQuery(it['B'], it['C'], it['D']))
|
||||
println("${one.lng/10000000000},${one.lat/10000000000}")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,49 +2,10 @@ package com.fangjia.script.wenyan
|
||||
|
||||
import com.fangjia.core.ProvinceData
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.action.get.GetRequest
|
||||
import org.elasticsearch.action.get.GetResponse
|
||||
import org.elasticsearch.client.RequestOptions
|
||||
import org.elasticsearch.client.RestHighLevelClient
|
||||
fullCityMap = CommonDatautils.queryFullNameCity()
|
||||
|
||||
////def data = []
|
||||
////data << ["ID","城市","区域","名称","地址", "财力评级"]
|
||||
//RestHighLevelClient client = ElasticUtils.getClient89("192.168.0.89")
|
||||
//district_analy_data_client = Mongo3Utils.getDbCollection("fangjia_stat", "district_analy_data")
|
||||
//level_map = ["1": "S", "2": "A", "3": "B", "4": "C", "5": "D"]
|
||||
//level_maps = new HashMap<>()
|
||||
//for(def key in level_map.keySet()){
|
||||
// level_maps.put(level_map[key], key)
|
||||
//}
|
||||
//ExcelUtils.modify("C:\\Users\\goojia\\Desktop\\财力评级-厦门.xlsx",{List item->
|
||||
//// GetResponse response = client.get(new GetRequest("community_summary", item["A"] as String), RequestOptions.DEFAULT)
|
||||
//// def query = new Document("city", item['B'].toString().replace("市", ""))
|
||||
//// query.append("region", item['C'].replace("区", ""))
|
||||
//// query.append("district_name", item["D"])
|
||||
//// def stat = district_analy_data_client.find(query).first()
|
||||
//// println(query)
|
||||
//// item["F"] = response.getSourceAsMap()?.consumption_rating
|
||||
//// item["G"] = stat?.community_rating
|
||||
// item["G"] = level_maps.get(item["G"], null)
|
||||
//// println(item)
|
||||
//})
|
||||
//System.exit(0)
|
||||
////for (def region in ["思明", "翔安", "湖里"]) {
|
||||
//// DbUtils.seaweed.find(new BasicDBObject("city", "厦门").append("region", region).append("cat", "district").append("status", 0)).each { BasicDBObject dbo ->
|
||||
//// println("${dbo._id.toString()}\t${dbo.city}市\t${dbo.region}区\t${dbo.name}\t${dbo.address}")
|
||||
//// }
|
||||
////}
|
||||
|
||||
ExcelUtils.read("C:\\Users\\goojia\\Desktop\\海南省城市均价.xlsx",1).each {List item->
|
||||
def yearMonth = DateUtil.formatByPattern(item[0], "yyyyMM").toInteger()
|
||||
|
||||
println(item)
|
||||
}
|
||||
ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\区域楼盘评级.xlsx",{List item->
|
||||
item["E"] = ProvinceData.getDisplay(item[0])
|
||||
print(item)
|
||||
})
|
||||
+22
@@ -30,6 +30,28 @@ class DingDingMessageUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static void sendTextMessageAndAt(String access_token, String msg, String atMobile) throws Exception {
|
||||
HttpRequest request = new HttpRequest();
|
||||
HttpPost httppost = new HttpPost("https://oapi.dingtalk.com/robot/send?access_token=" + access_token);
|
||||
httppost.addHeader("Content-Type", "application/json; charset=utf-8");
|
||||
|
||||
// 创建消息体,只包含一个手机号
|
||||
String textMsg = "{ " +
|
||||
"\"msgtype\": \"text\", " +
|
||||
"\"text\": {\"content\": \"" + msg + "\"}, " +
|
||||
"\"at\": {\"atMobiles\": [\"" + atMobile + "\"]}" + // 只 @ 一个手机号
|
||||
"}";
|
||||
|
||||
StringEntity se = new StringEntity(textMsg, "utf-8");
|
||||
httppost.setEntity(se);
|
||||
HttpResponse response = request.getHttpClient().execute(httppost);
|
||||
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
String result = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
System.out.println("消息发送结果:" + result);
|
||||
}
|
||||
}
|
||||
|
||||
static void sendMarkdownMessage(String access_token, String title, String msg){
|
||||
HttpRequest request = new HttpRequest()
|
||||
JSONObject requestBody = new JSONObject()
|
||||
|
||||
+6
-5
@@ -320,10 +320,8 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
Building findMatchedBuilding(Address addr,BuildingType buildingType, MetaDataType metaDataType){
|
||||
|
||||
AddressScoreResult scoreResult = findMatchedMetaData(addr, buildingType, metaDataType);
|
||||
if(scoreResult.getResult().size() > 0){
|
||||
if(!scoreResult.getResult().isEmpty()){
|
||||
AddressMatchMetaData matchedMate = scoreResult.getResult().get(0);
|
||||
|
||||
|
||||
if(matchedMate.getMetaDataType() == MetaDataType.CPDB){
|
||||
District district = districtService.findById(matchedMate.getId(), MATCH_PROPERTY_FIELDS);
|
||||
if("1".equals(addr.getPropertyType())){
|
||||
@@ -333,7 +331,6 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
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());
|
||||
@@ -342,7 +339,11 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Building(districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS), scoreResult.getScore(matchedMate));
|
||||
district = districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS);
|
||||
if(district == null){
|
||||
logger.error("未找到匹配的CPDB数据:" + addr + "ID:" + district.getId());
|
||||
}
|
||||
return new Building(district, scoreResult.getScore(matchedMate));
|
||||
}else{
|
||||
return new Building(matchedMate, scoreResult.getScore(matchedMate));
|
||||
}
|
||||
|
||||
+479
-24
@@ -1,25 +1,24 @@
|
||||
package com.fangjia.service.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONException;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.HttpRequestException;
|
||||
import com.fangjia.core.util.JsonUtils;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.mongo.open.model.WaitCrawlKeywords;
|
||||
import com.fangjia.service.address.AddressParserService;
|
||||
import com.fangjia.service.address.AddressParserUtil;
|
||||
import com.fangjia.service.address.mode.*;
|
||||
import com.fangjia.service.bo.CheckMatchDistrictCorrectParam;
|
||||
import com.fangjia.service.bo.MatchAddressScore;
|
||||
import com.fangjia.service.bo.MatchDistrictResult;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.dto.UniversalDto;
|
||||
import com.fangjia.service.mongo.bkoff.HouseLoudongService;
|
||||
import com.fangjia.service.open.WaitCrawlKeywordsService;
|
||||
import com.fangjia.service.sql.FjtEvaluationService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONException;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by wenyan on 2016/1/15.
|
||||
@@ -28,17 +27,143 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
|
||||
public static final int MIN_TIMEOUT = 1000 * 2;
|
||||
private final static String TOKEN = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB";
|
||||
private AddressParserService addressParserService;
|
||||
|
||||
public AddressMatchProxyServiceImpl(String apiHost) {
|
||||
private HouseLoudongService houseLoudongService;
|
||||
private FjtEvaluationService fjtEvaluationService;
|
||||
private EvaluationService evaluationService;
|
||||
private WaitCrawlKeywordsService waitCrawlKeywordsService;
|
||||
|
||||
public AddressMatchProxyServiceImpl(String apiHost) {
|
||||
super(apiHost);
|
||||
}
|
||||
|
||||
private String realMatch(Map<String, Object> paramsMap) {
|
||||
String address = paramsMap.get("address").toString();
|
||||
address = address.replaceAll("@@", "#");// 框架无法处理参数带有#的Buge 用@@代替
|
||||
BuildingType buildingType = null;
|
||||
if (paramsMap.containsKey("category")) {
|
||||
if ("property".equals(paramsMap.get("category"))) {
|
||||
paramsMap.put("category", "district");
|
||||
}
|
||||
try {
|
||||
buildingType = BuildingType.valueOf(((String)paramsMap.get("category")).toUpperCase());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
PreciseLevel preciseLevel = PreciseLevel.FUZZY;
|
||||
if ("strict".equals(paramsMap.get("preciseLevel"))) {
|
||||
preciseLevel = PreciseLevel.STRICT;
|
||||
}
|
||||
MatchParams params = new MatchParams();
|
||||
if (paramsMap.containsKey("city") && paramsMap.get("city") != null) {
|
||||
params.setCity(paramsMap.get("city").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("suggestDistrict") && paramsMap.get("suggestDistrict") != null) {
|
||||
params.setSuggestDistrict(paramsMap.get("suggestDistrict").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("suggestName") && paramsMap.get("suggestName") != null) {
|
||||
params.setSuggestName(paramsMap.get("suggestName").toString());
|
||||
}
|
||||
params.setAddress(address);
|
||||
params.setBuildingType(buildingType);
|
||||
params.setPreciseLevel(preciseLevel);
|
||||
if (paramsMap.containsKey("province") && paramsMap.get("province") != null) {
|
||||
params.setProvince(paramsMap.get("province").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("useMap") && paramsMap.get("useMap") != null) {
|
||||
params.setUseMap("false".equals(paramsMap.get("useMap")) ? false : true);
|
||||
}
|
||||
if (paramsMap.containsKey("debugName") && paramsMap.get("debugName") != null) {
|
||||
params.setDebugName(paramsMap.get("debugName").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("propertyType") && paramsMap.get("propertyType") != null) {
|
||||
params.setPropertyType(paramsMap.get("propertyType").toString());
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
Building building = addressParserService.parser(params);
|
||||
long end = System.currentTimeMillis();
|
||||
if (end - start > 200) {
|
||||
LOGGER.warn("匹配parser耗时:\t" + (end - start) + "ms");
|
||||
}
|
||||
if (paramsMap.containsKey("verify") && "true".equalsIgnoreCase(paramsMap.get("verify").toString())) {
|
||||
verify(building);
|
||||
}
|
||||
|
||||
JSONObject baseModel = new JSONObject();
|
||||
|
||||
Map<String, Object> result = convertBuildingToMap(building);
|
||||
if (paramsMap.containsKey("token") && !TOKEN.equals(paramsMap.get("token"))) {
|
||||
submitFetchTask(building);
|
||||
result.remove("precise");
|
||||
result.remove("searchAddress");
|
||||
result.remove("map");
|
||||
}
|
||||
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "ok");
|
||||
baseModel.put("result", result);
|
||||
|
||||
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
public String realMatchAll(Map<String, Object> paramsMap) {
|
||||
String address = paramsMap.get("address").toString();;
|
||||
address = address.replaceAll("@@", "#");// 框架无法处理参数带有#的Buge 用@@代替
|
||||
BuildingType buildingType = null;
|
||||
if (paramsMap.containsKey("category")) {
|
||||
if ("property".equals(paramsMap.get("category"))) {
|
||||
paramsMap.put("category", "district");
|
||||
}
|
||||
try {
|
||||
buildingType = BuildingType.valueOf(((String)paramsMap.get("category")).toUpperCase());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
PreciseLevel preciseLevel = PreciseLevel.FUZZY;
|
||||
if ("strict".equals(paramsMap.get("preciseLevel"))) {
|
||||
preciseLevel = PreciseLevel.STRICT;
|
||||
}
|
||||
MatchParams params = new MatchParams();
|
||||
if (paramsMap.containsKey("city")) {
|
||||
params.setCity(paramsMap.get("city").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("suggestDistrict")) {
|
||||
params.setSuggestDistrict(paramsMap.get("suggestDistrict").toString());
|
||||
}
|
||||
if (paramsMap.containsKey("suggestName")) {
|
||||
params.setSuggestName(paramsMap.get("suggestName").toString());
|
||||
}
|
||||
|
||||
params.setAddress(address);
|
||||
params.setBuildingType(buildingType);
|
||||
params.setPreciseLevel(preciseLevel);
|
||||
|
||||
if (paramsMap.containsKey("province")) {
|
||||
params.setProvince(paramsMap.get("province").toString());
|
||||
}
|
||||
AddressParseResult addressParseResult = addressParserService.parserAll(params);
|
||||
List<Building> buildings = addressParseResult.getBuildings();
|
||||
List<Map<String, Object>> buildingObjs = new ArrayList<Map<String, Object>>(buildings.size());
|
||||
for (Building building : buildings) {
|
||||
buildingObjs.add(convertBuildingToMap(building));
|
||||
}
|
||||
JSONObject baseModel = new JSONObject();
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "ok");
|
||||
baseModel.put("result", buildingObjs);
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parser(Map<String, Object> params) {
|
||||
params.put("token", TOKEN);
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
String result = this.invoke("address/realMatch", params, "UTF-8");
|
||||
String result = realMatch(params);
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("", e);
|
||||
@@ -54,7 +179,7 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
public String parserAll(Map<String, Object> params) {
|
||||
params.put("token", TOKEN);
|
||||
try {
|
||||
String result = this.invoke("address/realMatchAll", params, "UTF-8");
|
||||
String result = realMatchAll(params);
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("", e);
|
||||
@@ -62,11 +187,25 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
return null;
|
||||
}
|
||||
|
||||
public String cleanCache(final Map<String, Object> paramsMap) {
|
||||
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
addressParserService.clearCache((String) paramsMap.get("city"));
|
||||
}
|
||||
}.start();
|
||||
JSONObject baseModel = new JSONObject();
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "开始刷新缓存");
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cacheFlush(Map<String, Object> params){
|
||||
params.put("token", TOKEN);
|
||||
try {
|
||||
String result = this.invoke("address/cleanCache", params, "UTF-8");
|
||||
String result = cleanCache(params);
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("", e);
|
||||
@@ -74,11 +213,85 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
return null;
|
||||
}
|
||||
|
||||
public String realStandard(Map<String, Object> paramsMap) {
|
||||
JSONObject baseModel = new JSONObject();
|
||||
if (!paramsMap.containsKey("address") || paramsMap.get("address") == null || paramsMap.get("address").toString().trim().isEmpty()) {
|
||||
baseModel.put("code", 400);
|
||||
baseModel.put("msg", "地址不能为空");
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
MatchParams matchParams = new MatchParams();
|
||||
if (paramsMap.containsKey("city") && paramsMap.get("city") != null) {
|
||||
matchParams.setCity(paramsMap.get("city").toString());
|
||||
}
|
||||
matchParams.setAddress(paramsMap.get("address").toString());
|
||||
matchParams.setAddressParserGoal(AddressParserGoal.Match);
|
||||
matchParams.setPreciseLevel(PreciseLevel.STRICT);
|
||||
if (paramsMap.containsKey("province") && paramsMap.get("province") != null) {
|
||||
matchParams.setProvince(paramsMap.get("province").toString());
|
||||
}
|
||||
|
||||
matchParams.setUseAliyunApi(false);
|
||||
matchParams.setContainsLocation("false".equals(paramsMap.get("containsLocation")) ? false : true);
|
||||
Building building = addressParserService.standard(matchParams);
|
||||
Address address = building.getSearchAddress();
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
dto.append("province", address.getProvince());
|
||||
dto.append("city", address.getCity());
|
||||
if (address.getDistrict() != null) {
|
||||
dto.append("district", address.getDistrict());
|
||||
} else {
|
||||
dto.append("district", building.getDistrict());
|
||||
}
|
||||
dto.append("developmentZone", address.getDevelopmentZone());
|
||||
dto.append("township", address.getTownship());
|
||||
dto.append("street", address.getStreet());
|
||||
dto.append("streetNumber", address.getStreetNumber());
|
||||
if (StringUtils.isBlank(building.getSuggestName())) {
|
||||
if (StringUtils.isNotBlank(address.getParsedPropertyName())) {
|
||||
dto.append("name", address.getParsedPropertyName());
|
||||
} else if (StringUtils.isNotBlank(address.getOrgKeywords())) {
|
||||
dto.append("name", address.getOrgKeywords());
|
||||
}
|
||||
} else {
|
||||
dto.append("name", building.getSuggestName());
|
||||
}
|
||||
if (StringUtils.isBlank(address.getStreet()) && StringUtils.isNotBlank(building.getAddress())) {
|
||||
String addr = building.getAddress();
|
||||
String street = AddressParserUtil.extractStreet(addr);
|
||||
if (street != null) {
|
||||
dto.append("street", street);
|
||||
if (addr.length() != street.length()) {
|
||||
dto.append("streetNumber", AddressParserUtil.match(AddressParserUtil.STREET_NUMBER_CONNECTOR_PATTERN, addr));
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(building.getStreet())) {
|
||||
dto.append("street", building.getStreet());
|
||||
if (StringUtils.isNotBlank(building.getStreetno())) {
|
||||
dto.append("streetNumber", building.getStreetno());
|
||||
}
|
||||
}
|
||||
}
|
||||
dto.append("buildingNumber", address.getBuildingNumber());
|
||||
dto.append("floor", address.getFloor());
|
||||
dto.append("unitNumber", address.getUnitNumber());
|
||||
dto.append("roomNumber", address.getRoomNumber());
|
||||
dto.append("formattedAddress", address.getFormattedAddress());
|
||||
if (matchParams.isContainsLocation()) {
|
||||
dto.append("lat", building.getLat());
|
||||
dto.append("lng", building.getLng());
|
||||
}
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "ok");
|
||||
baseModel.put("result", dto);
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String standard(Map<String, Object> params) {
|
||||
params.put("token", TOKEN);
|
||||
try {
|
||||
String result = this.invoke("address/realStandard", params, "UTF-8");
|
||||
String result = realStandard(params);
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("", e);
|
||||
@@ -86,6 +299,48 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
return null;
|
||||
}
|
||||
|
||||
public String realCertificateAction(Map<String, Object> paramsMap) {
|
||||
JSONObject baseModel = new JSONObject();
|
||||
if (!paramsMap.containsKey("address") || paramsMap.get("address") == null || paramsMap.get("address").toString().trim().isEmpty()) {
|
||||
baseModel.put("code", 400);
|
||||
baseModel.put("msg", "地址不能为空");
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
MatchParams matchParams = new MatchParams();
|
||||
if (paramsMap.containsKey("city") && paramsMap.get("city") != null) {
|
||||
matchParams.setCity(paramsMap.get("city").toString());
|
||||
}
|
||||
matchParams.setAddress(paramsMap.get("address").toString());
|
||||
matchParams.setAddressParserGoal(AddressParserGoal.Certificate);
|
||||
matchParams.setPreciseLevel(PreciseLevel.STRICT);
|
||||
Building building = addressParserService.certificate(matchParams);
|
||||
Address address = building.getSearchAddress();
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
dto.append("province", address.getProvince());
|
||||
dto.append("city", address.getCity());
|
||||
if (address.getDistrict() != null) {
|
||||
dto.append("district", address.getDistrict());
|
||||
} else {
|
||||
dto.append("district", building.getDistrict());
|
||||
}
|
||||
dto.append("developmentZone", address.getDevelopmentZone());
|
||||
dto.append("township", address.getTownship());
|
||||
dto.append("street", address.getStreet());
|
||||
dto.append("streetNumber", address.getStreetNumber());
|
||||
dto.append("name", building.getSuggestName());
|
||||
dto.append("buildingNumber", address.getBuildingNumber());
|
||||
dto.append("unitNumber", address.getUnitNumber());
|
||||
dto.append("roomNumber", address.getRoomNumber());
|
||||
dto.append("formattedAddress", address.getFormattedAddress());
|
||||
dto.append("certified", address.getCertified());
|
||||
dto.append("floor", address.getFloor());
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "ok");
|
||||
baseModel.put("result", dto);
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String certificate(Map<String, Object> params) {
|
||||
params.put("token", TOKEN);
|
||||
@@ -98,11 +353,75 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
return null;
|
||||
}
|
||||
|
||||
public String realAuth(Map<String, Object> paramsMap) {
|
||||
JSONObject baseModel = new JSONObject();
|
||||
if (!paramsMap.containsKey("address") || paramsMap.get("address") == null || paramsMap.get("address").toString().trim().isEmpty()) {
|
||||
baseModel.put("code", 400);
|
||||
baseModel.put("msg", "地址不能为空");
|
||||
return baseModel.toString();
|
||||
}
|
||||
MatchParams matchParams = new MatchParams();
|
||||
if (paramsMap.containsKey("city") && paramsMap.get("city") != null) {
|
||||
matchParams.setCity((String) paramsMap.get("city"));
|
||||
}
|
||||
matchParams.setAddress((String) paramsMap.get("address"));
|
||||
matchParams.setAddressParserGoal(AddressParserGoal.Certificate);
|
||||
matchParams.setUseMap(true);
|
||||
Building building = addressParserService.certificate(matchParams);
|
||||
Address address = building.getSearchAddress();
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
if (StringUtils.isNotBlank(address.getProvince())) {
|
||||
dto.append("province", address.getProvince());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getCity())) {
|
||||
dto.append("city", address.getCity());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getCity())) {
|
||||
dto.append("district", address.getDistrict());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getDevelopmentZone())) {
|
||||
dto.append("developmentZone", address.getDevelopmentZone());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getTownship())) {
|
||||
dto.append("township", address.getTownship());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getStreet())) {
|
||||
dto.append("street", address.getStreet());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getStreetNumber())) {
|
||||
dto.append("streetNumber", address.getStreetNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getBuildingNumber())) {
|
||||
dto.append("buildingNumber", address.getBuildingNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getUnitNumber())) {
|
||||
dto.append("unitNumber", address.getUnitNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getRoomNumber())) {
|
||||
dto.append("roomNumber", address.getRoomNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getFormattedAddress())) {
|
||||
dto.append("formattedAddress", address.getFormattedAddress());
|
||||
}
|
||||
List<String> certified = address.getCertified();
|
||||
if (certified.contains("roomNumber")) {
|
||||
dto.append("authLevel", "A");
|
||||
} else if (certified.contains("buildingNumber")) {
|
||||
dto.append("authLevel", "B");
|
||||
} else {
|
||||
dto.append("authLevel", "C");
|
||||
}
|
||||
baseModel.put("code", 200);
|
||||
baseModel.put("msg", "ok");
|
||||
baseModel.put("result", dto);
|
||||
return baseModel.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String auth(Map<String, Object> params) {
|
||||
params.put("token", TOKEN);
|
||||
try {
|
||||
String result = this.invoke("address/realAuth", params, "UTF-8");
|
||||
String result = realAuth(params);
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("", e);
|
||||
@@ -429,5 +748,141 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> convertBuildingToMap(Building building) {
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||
if (building != null) {
|
||||
if (StringUtils.isNotBlank(building.getId())) {
|
||||
result.put("id", building.getId());
|
||||
}
|
||||
result.put("credit", building.getCredit());
|
||||
result.put("precise", building.getPrecise());
|
||||
result.put("province", building.getProvince());
|
||||
result.put("city", building.getCity());
|
||||
result.put("district", building.getDistrict());
|
||||
result.put("name", building.getName());
|
||||
if (StringUtils.isNotBlank(building.getSuggestName())) {
|
||||
result.put("suggestName", building.getSuggestName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(building.getMap())) {
|
||||
result.put("map", building.getMap());
|
||||
}
|
||||
result.put("propertyType", building.getPropertyType());
|
||||
if (StringUtils.isNotBlank(building.getTownship())) {
|
||||
result.put("township", building.getTownship());
|
||||
}
|
||||
if (StringUtils.isNotBlank(building.getSuggestAddress())) {
|
||||
result.put("suggestAddress", building.getSuggestAddress());
|
||||
}
|
||||
if ("district".equals(building.getCategory())) {
|
||||
result.put("category", "property");
|
||||
} else {
|
||||
result.put("category", building.getCategory());
|
||||
}
|
||||
if (StringUtils.isNotBlank(building.getAddress())) {
|
||||
result.put("address", building.getAddress());
|
||||
}
|
||||
if (StringUtils.isNotBlank(building.getBlock())) {
|
||||
result.put("block", building.getBlock());
|
||||
}
|
||||
if (building.getLng() != null && building.getLat() != null) {
|
||||
result.put("lng", building.getLng());
|
||||
result.put("lat", building.getLat());
|
||||
}
|
||||
if (building.getAlias() != null) {
|
||||
result.put("alias", building.getAlias());
|
||||
}
|
||||
if (building.getSearchAddress() != null) {
|
||||
result.put("searchAddress", building.getSearchAddress());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void submitFetchTask(Building building) {
|
||||
if (building.getPrecise() == -1) {
|
||||
List<String> keywords = new ArrayList<String>();
|
||||
Address address = building.getSearchAddress();
|
||||
if (StringUtils.isNotBlank(address.getKeywords()) && address.getKeywords().length() > 2) {
|
||||
keywords.add(address.getKeywords());
|
||||
} else if (address.getOrgAddress().length() > 2 && address.getOrgAddress().length() < 10) {// 一般小区名不会超过10个字
|
||||
keywords.add(address.getOrgAddress());
|
||||
}
|
||||
if (address.isStandardAddress()) {
|
||||
if (address.getStreetNumbers() != null) {
|
||||
for (String b : address.getStreetNumbers()) {
|
||||
keywords.add(address.getStreet() + b);
|
||||
}
|
||||
} else {
|
||||
keywords.add(address.getStreet());
|
||||
}
|
||||
}
|
||||
keywords = DataUtil.uniqueList(keywords);
|
||||
for (String k : keywords) {
|
||||
WaitCrawlKeywords waitCrawlKeywords = new WaitCrawlKeywords();
|
||||
waitCrawlKeywords.setCity(address.getCity());
|
||||
waitCrawlKeywords.setDateCreated(new Date());
|
||||
waitCrawlKeywords.setRead(0);
|
||||
waitCrawlKeywords.setKeywords(k);
|
||||
waitCrawlKeywordsService.save(waitCrawlKeywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void verify(Building building) {
|
||||
String city = building.getCity();
|
||||
String region = building.getDistrict();
|
||||
String name = null;
|
||||
if (building.getPrecise() > -1) {
|
||||
name = building.getName();
|
||||
} else {
|
||||
name = building.getSearchAddress().getOrgKeywords();
|
||||
}
|
||||
if (StringUtils.isNotBlank(region) && StringUtils.isNotBlank(name)) {
|
||||
String buildingNumber = AddressParserUtil
|
||||
.standardizeBuildingNumber(building.getSearchAddress().getOrgBuildingNumber());
|
||||
if (buildingNumber != null) {
|
||||
if (houseLoudongService.findHouseLoudong(city, region, name, buildingNumber, null, null) != null) {
|
||||
building.getSearchAddress().setBuildingNumberCertified(true);
|
||||
} else if (fjtEvaluationService.findFjtEvaluationByConditions(city, region, name, buildingNumber,
|
||||
null) != null) {
|
||||
building.getSearchAddress().setBuildingNumberCertified(true);
|
||||
} else if (evaluationService.findEvaluationByNum(city, region, name, buildingNumber, null) != null) {
|
||||
building.getSearchAddress().setBuildingNumberCertified(true);
|
||||
}
|
||||
}
|
||||
|
||||
String roomNumber = AddressParserUtil.standardizeRoomNumber(building.getSearchAddress().getOrgRoomNumber());
|
||||
if (roomNumber != null) {
|
||||
if (houseLoudongService.findHouseLoudong(city, region, name, null, null, roomNumber) != null) {
|
||||
building.getSearchAddress().setRoomNumberCertified(true);
|
||||
} else if (fjtEvaluationService.findFjtEvaluationByConditions(city, region, name, null,
|
||||
roomNumber) != null) {
|
||||
building.getSearchAddress().setRoomNumberCertified(true);
|
||||
} else if (evaluationService.findEvaluationByNum(city, region, name, null, roomNumber) != null) {
|
||||
building.getSearchAddress().setRoomNumberCertified(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
|
||||
this.houseLoudongService = houseLoudongService;
|
||||
}
|
||||
|
||||
public void setFjtEvaluationService(FjtEvaluationService fjtEvaluationService) {
|
||||
this.fjtEvaluationService = fjtEvaluationService;
|
||||
}
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
|
||||
public void setAddressParserService(AddressParserService addressParserService) {
|
||||
this.addressParserService = addressParserService;
|
||||
}
|
||||
|
||||
public void setWaitCrawlKeywordsService(WaitCrawlKeywordsService waitCrawlKeywordsService) {
|
||||
this.waitCrawlKeywordsService = waitCrawlKeywordsService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.fangjia.service.bo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class CitySellStatBo implements Serializable {
|
||||
private static final long serialVersionUID = -5310665233447971693L;
|
||||
private String city;
|
||||
private String region;
|
||||
private String block;
|
||||
private int avgPrice;
|
||||
private int weekendMarkup;
|
||||
// Äêͬ±ÈÕǵø
|
||||
private Integer yearMarkup;
|
||||
// Ô»·±ÈÕǵø
|
||||
private Integer monthMarkup;
|
||||
private int month;
|
||||
|
||||
private int lastTimeAvgPrice;
|
||||
private Integer startDate;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
public int getWeekendMarkup() {
|
||||
return weekendMarkup;
|
||||
}
|
||||
|
||||
public void setWeekendMarkup(int weekendMarkup) {
|
||||
this.weekendMarkup = weekendMarkup;
|
||||
}
|
||||
|
||||
public Integer getYearMarkup() {
|
||||
return yearMarkup;
|
||||
}
|
||||
|
||||
public void setYearMarkup(Integer yearMarkup) {
|
||||
this.yearMarkup = yearMarkup;
|
||||
}
|
||||
|
||||
public Integer getMonthMarkup() {
|
||||
return monthMarkup;
|
||||
}
|
||||
|
||||
public void setMonthMarkup(Integer monthMarkup) {
|
||||
this.monthMarkup = monthMarkup;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getLastTimeAvgPrice() {
|
||||
return lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public void setLastTimeAvgPrice(int lastTimeAvgPrice) {
|
||||
this.lastTimeAvgPrice = lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Integer startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.fangjia.service.bo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class RegionSellStatBo implements Serializable {
|
||||
private static final long serialVersionUID = -5310665233447971693L;
|
||||
private String city;
|
||||
private String region;
|
||||
private String block;
|
||||
private int avgPrice;
|
||||
private int weekendMarkup;
|
||||
// Äêͬ±ÈÕǵø
|
||||
private Integer yearMarkup;
|
||||
// Ô»·±ÈÕǵø
|
||||
private Integer monthMarkup;
|
||||
private int month;
|
||||
|
||||
private int lastTimeAvgPrice;
|
||||
private Integer startDate;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
public int getWeekendMarkup() {
|
||||
return weekendMarkup;
|
||||
}
|
||||
|
||||
public void setWeekendMarkup(int weekendMarkup) {
|
||||
this.weekendMarkup = weekendMarkup;
|
||||
}
|
||||
|
||||
public Integer getYearMarkup() {
|
||||
return yearMarkup;
|
||||
}
|
||||
|
||||
public void setYearMarkup(Integer yearMarkup) {
|
||||
this.yearMarkup = yearMarkup;
|
||||
}
|
||||
|
||||
public Integer getMonthMarkup() {
|
||||
return monthMarkup;
|
||||
}
|
||||
|
||||
public void setMonthMarkup(Integer monthMarkup) {
|
||||
this.monthMarkup = monthMarkup;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getLastTimeAvgPrice() {
|
||||
return lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public void setLastTimeAvgPrice(int lastTimeAvgPrice) {
|
||||
this.lastTimeAvgPrice = lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Integer startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.ShopRentStat;
|
||||
import com.fangjia.dal.mongo.model.ShopSellStat;
|
||||
import com.fangjia.service.datastore.dto.ShopEvaluationDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AiShopService {
|
||||
|
||||
/**
|
||||
* 租金均价
|
||||
*
|
||||
* @param city
|
||||
* @param region
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
List<ShopRentStat> findShopRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate);
|
||||
|
||||
/**
|
||||
* 租金地址维度评估
|
||||
*
|
||||
* @param evaluation
|
||||
* @return
|
||||
*/
|
||||
ShopEvaluationDto addressEvaluateRent(Evaluation evaluation);
|
||||
|
||||
/**
|
||||
* 城市写字楼出售均价
|
||||
*
|
||||
* @param city
|
||||
* @param region
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
List<ShopSellStat> findShopSellStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate);
|
||||
|
||||
/**
|
||||
* 售价地址维度评估
|
||||
*
|
||||
* @param evaluation
|
||||
* @return
|
||||
*/
|
||||
ShopEvaluationDto addressEvaluateSell(Evaluation evaluation);
|
||||
}
|
||||
+561
@@ -0,0 +1,561 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.CacheUtils;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SeawaterQuery;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.mongo.dao.shop.ShopRentStatDao;
|
||||
import com.fangjia.dal.mongo.dao.shop.ShopSellStatDao;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.ShopRentStat;
|
||||
import com.fangjia.dal.mongo.model.ShopSellStat;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.dal.seawater.model.SeawaterDto;
|
||||
import com.fangjia.service.datastore.dto.ShopEvaluationDto;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import com.fangjia.service.util.GeoUtils;
|
||||
import com.fangjia.service.util.dto.GaodeDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.sothis.core.util.Closure;
|
||||
import org.sothis.core.util.Pager;
|
||||
import weiboclient4j.utils.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AiShopServiceImpl implements AiShopService {
|
||||
|
||||
private ShopRentStatDao shopRentStatDao;
|
||||
private SeawaterService seawaterService;
|
||||
private ShopSellStatDao shopSellStatDao;
|
||||
|
||||
|
||||
// 所在楼层
|
||||
// 总楼层
|
||||
private static final Map<String, String> FITMENT_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
put("1", "毛坯");
|
||||
put("2", "简装");
|
||||
put("3", "精装");
|
||||
put("4", "豪装");
|
||||
}
|
||||
};
|
||||
|
||||
private static final Map<String, String> DIRECTION_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
put("1", "西南");
|
||||
put("2", "东南");
|
||||
put("3", "南");
|
||||
put("4", "西北");
|
||||
put("5", "东北");
|
||||
put("6", "东");
|
||||
put("7", "西");
|
||||
put("8", "北");
|
||||
put("9", "东西");
|
||||
put("10", "南北");
|
||||
}
|
||||
};
|
||||
private static final Map<String, Double> FITMENT_FACTOR = new HashMap<String, Double>() {
|
||||
{
|
||||
put("毛坯", 0.9983);
|
||||
put("简装", 1.0);
|
||||
put("精装", 1.0153);
|
||||
put("豪装", 1.0199);
|
||||
}
|
||||
};
|
||||
private static final Map<String, Double> DIRECTION_FACTOR = new HashMap<String, Double>() {
|
||||
{
|
||||
put("东", 1.0040);
|
||||
put("东北", 1.0048);
|
||||
put("东南", 1.0121);
|
||||
put("东西", 1.0003);
|
||||
put("北", 0.9999);
|
||||
put("南", 1.0000);
|
||||
put("南北", 1.0080);
|
||||
put("西", 1.0060);
|
||||
put("西北", 1.0099);
|
||||
put("西南", 1.0103);
|
||||
}
|
||||
};
|
||||
|
||||
public ShopEvaluationDto calcRent(Evaluation evaluation) {
|
||||
// 第一步:按写字楼同楼层、装修、朝向选取3个,计算平均值作为结果
|
||||
// 第二步:基准价*楼层系数*装修系数*朝向系数
|
||||
// 第三步:周边(三公里内最近的10个写字楼)同等级、同类型写字楼的均值*楼层系数*装修系数*朝向系数
|
||||
String floorDesc = evaluation.getFloorDesc();
|
||||
List<Seawater> selectedSeawaters = new ArrayList<Seawater>();
|
||||
// 第一步:按写字楼同楼层、装修、朝向选取3个,计算平均值作为结果
|
||||
List<Seawater> seawaters;
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setRegion(evaluation.getRegion());
|
||||
query.setDistrictName(evaluation.getDistrictName());
|
||||
query.setFitment(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
query.setDirection(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
query.setCat("shop_rent");
|
||||
query.setRadius(3000);
|
||||
|
||||
Integer endDate = Integer.valueOf(DateUtil.formatByPattern(new Date(), "yyyyMMdd"));
|
||||
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
query.setStartDate(startDate);
|
||||
query.setEndDate(endDate);
|
||||
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(100);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
seawaters = seawaterService.findSeawatersByQuery(query);
|
||||
if (StringUtils.isNotBlank(query.getFitment()) && StringUtils.isNotBlank(query.getDirection())) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
boolean sameFloorDesc = false;
|
||||
|
||||
if (seawater.getFloorInfo() != null && floorDesc != null) {
|
||||
if (seawater.getFloorInfo().contains(floorDesc)) {
|
||||
sameFloorDesc = true;
|
||||
} else {
|
||||
try {
|
||||
Integer floor = Integer.parseInt(seawater.getFloorInfo());
|
||||
if (floor <= 6 && "低".equals(floorDesc)) {
|
||||
sameFloorDesc = true;
|
||||
} else if (floor > 6 && floor <= 15 && "中".equals(floorDesc)) {
|
||||
sameFloorDesc = true;
|
||||
} else if (floor > 15 && "高".equals(floorDesc)) {
|
||||
sameFloorDesc = true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sameFloorDesc) {
|
||||
selectedSeawaters.add(seawater);
|
||||
}
|
||||
if (selectedSeawaters.size() == 3) {
|
||||
return getShopEvaluationDto(selectedSeawaters, evaluation, "shop_rent");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查找基准价
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("cat", "shop"));
|
||||
params.add(new QueryParam("city", evaluation.getCity()));
|
||||
params.add(new QueryParam("district", evaluation.getRegion()));
|
||||
params.add(new QueryParam("name", evaluation.getDistrictName()));
|
||||
// 获取上个月yyyyMM日期
|
||||
String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -2), "yyyyMM");
|
||||
params.add(new QueryParam("date", Integer.parseInt(date)));
|
||||
|
||||
// 按日期降序排序,取最新的数据,可能上月还未更新,则取上上个月的数据
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("date", false));
|
||||
|
||||
// 第二步:基准价*楼层系数*装修系数*朝向系数
|
||||
ShopRentStat shopRentStat = shopRentStatDao.findFirstByParams(params);
|
||||
Double avgPrice = shopRentStat.getAvgPrice();
|
||||
if (avgPrice != null) {
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
}
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
avgPrice = avgPrice * factor;
|
||||
return getShopEvaluationDtoWithAvgPrice(avgPrice, evaluation, "shop_rent");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据均价查询样本
|
||||
*
|
||||
* @param avgPrice
|
||||
* @param evaluation
|
||||
* @return
|
||||
*/
|
||||
private ShopEvaluationDto getShopEvaluationDtoWithAvgPrice(Double avgPrice, Evaluation evaluation, String cat) {
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setRegion(evaluation.getRegion());
|
||||
if ("shop_rent".equals(cat)) {
|
||||
query.setStartPrice((int) (avgPrice * 30 * 0.9));
|
||||
query.setEndPrice((int) (avgPrice * 30 * 1.1));
|
||||
} else {
|
||||
query.setStartPrice((int) (avgPrice * 0.9));
|
||||
query.setEndPrice((int) (avgPrice * 1.1));
|
||||
}
|
||||
query.setCat(cat);
|
||||
query.setRadius(3000);
|
||||
|
||||
Integer endDate = Integer.valueOf(DateUtil.formatByPattern(new Date(), "yyyyMMdd"));
|
||||
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
query.setStartDate(startDate);
|
||||
query.setEndDate(endDate);
|
||||
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(5);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
List<Seawater> seawaters = seawaterService.findSeawatersByQuery(query);
|
||||
return getShopEvaluationDto(seawaters, evaluation, cat);
|
||||
}
|
||||
|
||||
private static SeawaterDto getSeawaterDto(Seawater seawater, String cat) {
|
||||
SeawaterDto seawaterDto = new SeawaterDto();
|
||||
seawaterDto.setCity(seawater.getCity());
|
||||
seawaterDto.setId(seawater.getId());
|
||||
seawaterDto.setDistrict(seawater.getRegion());
|
||||
seawaterDto.setName(seawater.getName());
|
||||
seawaterDto.setArea(seawater.getArea());
|
||||
seawaterDto.setFitment(seawater.getFitment());
|
||||
if (cat != null && cat.contains("rent")) {
|
||||
seawaterDto.setUnitPrice(seawater.getDayUnitPrice());
|
||||
} else {
|
||||
seawaterDto.setUnitPrice(seawater.getAvgPrice().doubleValue());
|
||||
}
|
||||
seawaterDto.setEstateType(seawater.getEstateType());
|
||||
seawaterDto.setBedKind(seawater.getLevel());
|
||||
seawaterDto.setPublishDate(String.valueOf(seawater.getpDate()));
|
||||
seawaterDto.setFloorInfo(seawater.getFloorInfo());
|
||||
seawaterDto.setAddress(seawater.getAddress());
|
||||
seawaterDto.setDistrictName(seawater.getDistrictName());
|
||||
seawaterDto.setTags(seawater.getTags());
|
||||
seawaterDto.setImageUrls(seawater.getImageUrls());
|
||||
seawaterDto.setLocation(seawater.getLocation());
|
||||
return seawaterDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 纯样本查询结果估值
|
||||
*
|
||||
* @param seawaters
|
||||
* @param evaluation
|
||||
* @return
|
||||
*/
|
||||
private static ShopEvaluationDto getShopEvaluationDto(List<Seawater> seawaters, Evaluation evaluation, String cat) {
|
||||
Integer sum = 0;
|
||||
Double size = 0.0;
|
||||
|
||||
ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto();
|
||||
|
||||
List<SeawaterDto> seawaterList = new ArrayList<SeawaterDto>();
|
||||
if ("shop_rent".equals(cat)) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) {
|
||||
sum += seawater.getTotalPrice();
|
||||
size += seawater.getArea();
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, cat);
|
||||
seawaterList.add(seawaterDto);
|
||||
}
|
||||
if (size > 0) {
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size / 30, 2);
|
||||
shopEvaluationDto.setUnitPrice(unitPrice);
|
||||
shopEvaluationDto.setSeawater(seawaterList);
|
||||
shopEvaluationDto.setCity(evaluation.getCity());
|
||||
shopEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
shopEvaluationDto.setName(evaluation.getDistrictName());
|
||||
}
|
||||
} else {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() > 0) {
|
||||
sum += seawater.getTotalPrice();
|
||||
size += seawater.getArea();
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, cat);
|
||||
seawaterList.add(seawaterDto);
|
||||
}
|
||||
if (size > 0) {
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size, 2);
|
||||
shopEvaluationDto.setUnitPrice(unitPrice);
|
||||
shopEvaluationDto.setSeawater(seawaterList);
|
||||
shopEvaluationDto.setCity(evaluation.getCity());
|
||||
shopEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
shopEvaluationDto.setName(evaluation.getDistrictName());
|
||||
}
|
||||
}
|
||||
|
||||
return shopEvaluationDto;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ShopEvaluationDto addressEvaluateRent(Evaluation evaluation) {
|
||||
if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) {
|
||||
evaluation.setFloor(null);
|
||||
evaluation.setHeight(null);
|
||||
}
|
||||
// 评估逻辑
|
||||
// String location = getLocation(evaluation.getCity(), evaluation.getAddress());
|
||||
GaodeDto gaodeDto = getGaodeGeo(evaluation.getCity(), evaluation.getAddress());
|
||||
if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) {
|
||||
evaluation.setLocation(gaodeDto.getLng() + "," + gaodeDto.getLat());
|
||||
} else {
|
||||
evaluation.setLocation("");
|
||||
}
|
||||
evaluation.setRegion(RegionData.formatRegion(evaluation.getCity(), gaodeDto.getDistrict()));
|
||||
return rentEvaluateByLocation(evaluation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopSellStat> findShopSellStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) {
|
||||
return CacheUtils.getValue(this.getClass(), "findShopSellStat", city + region + name + startDate + endDate,
|
||||
CacheUtils.CachePolicyEnum.MIDDLE, new Closure<List<ShopSellStat>, String>() {
|
||||
public List<ShopSellStat> execute(String input) {
|
||||
return doFindShopSellStat(city, region, name, cat, startDate, endDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ShopEvaluationDto rentEvaluateByLocation(Evaluation evaluation) {
|
||||
ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto();
|
||||
if (StringUtils.isNotBlank(evaluation.getLocation())) {
|
||||
shopEvaluationDto.setLocation(evaluation.getLocation());
|
||||
Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]);
|
||||
Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]);
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
query.setCat("shop_rent");
|
||||
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
|
||||
query.setRadius(evaluation.getRadius());
|
||||
} else {
|
||||
query.setRadius(1000);
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
|
||||
query.setEstateType(evaluation.getEstateType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getTags())) {
|
||||
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(evaluation.getSampleIds())){
|
||||
query.setIds(Arrays.asList(evaluation.getSampleIds().split(",")));
|
||||
}
|
||||
// 查询近一年样本
|
||||
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
|
||||
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(10);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||
List<SeawaterDto> seawaterDtoList = new ArrayList<SeawaterDto>();
|
||||
if (CollectionUtils.isNotEmpty(shops)) {
|
||||
// 求均值
|
||||
Double totalPrice = 0D;
|
||||
int count = 0;
|
||||
for (Seawater seawater : shops) {
|
||||
if (seawater.getAvgPrice() != null) {
|
||||
totalPrice += seawater.getDayUnitPrice();
|
||||
count += 1;
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, "shop_rent");
|
||||
seawaterDtoList.add(seawaterDto);
|
||||
}
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
}
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2);
|
||||
shopEvaluationDto.setUnitPrice(avgPrice);
|
||||
shopEvaluationDto.setSeawater(seawaterDtoList);
|
||||
shopEvaluationDto.setCity(evaluation.getCity());
|
||||
shopEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
shopEvaluationDto.setName(evaluation.getDistrictName());
|
||||
return shopEvaluationDto;
|
||||
}
|
||||
}
|
||||
return shopEvaluationDto;
|
||||
}
|
||||
|
||||
private ShopEvaluationDto sellEvaluateByLocation(Evaluation evaluation) {
|
||||
ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto();
|
||||
if (StringUtils.isNotBlank(evaluation.getLocation())) {
|
||||
shopEvaluationDto.setLocation(evaluation.getLocation());
|
||||
Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]);
|
||||
Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]);
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
query.setCat("shop_sell");
|
||||
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
|
||||
query.setRadius(evaluation.getRadius());
|
||||
} else {
|
||||
query.setRadius(1000);
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
|
||||
query.setEstateType(evaluation.getEstateType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getTags())) {
|
||||
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(evaluation.getSampleIds())){
|
||||
query.setIds(Arrays.asList(evaluation.getSampleIds().split(",")));
|
||||
}
|
||||
// 查询近一年样本
|
||||
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
|
||||
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(10);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||
|
||||
List<SeawaterDto> seawaterDtoList = new ArrayList<SeawaterDto>();
|
||||
if (CollectionUtils.isNotEmpty(shops)) {
|
||||
// 求均值
|
||||
Double totalPrice = 0D;
|
||||
int count = 0;
|
||||
for (Seawater seawater : shops) {
|
||||
if (seawater.getAvgPrice() != null) {
|
||||
totalPrice += seawater.getAvgPrice();
|
||||
count += 1;
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, "shop_sell");
|
||||
seawaterDtoList.add(seawaterDto);
|
||||
}
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
}
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
int avgPrice = (int) (totalPrice / count * factor);
|
||||
shopEvaluationDto.setUnitPrice((double) avgPrice);
|
||||
shopEvaluationDto.setSeawater(seawaterDtoList);
|
||||
shopEvaluationDto.setCity(evaluation.getCity());
|
||||
shopEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
shopEvaluationDto.setName(evaluation.getDistrictName());
|
||||
return shopEvaluationDto;
|
||||
}
|
||||
}
|
||||
return shopEvaluationDto;
|
||||
}
|
||||
|
||||
private String getLocation(String city, String address) {
|
||||
GaodeDto gaodeDto = GeoUtils.geo(city, address);
|
||||
if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) {
|
||||
return gaodeDto.getLng() + "," + gaodeDto.getLat();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private GaodeDto getGaodeGeo(String city, String address) {
|
||||
GaodeDto gaodeDto = GeoUtils.geo(city, address);
|
||||
return gaodeDto;
|
||||
}
|
||||
|
||||
public List<ShopRentStat> findShopRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) {
|
||||
return CacheUtils.getValue(this.getClass(), "findShopRentStat", city + region + name + startDate + endDate,
|
||||
CacheUtils.CachePolicyEnum.MIDDLE, new Closure<List<ShopRentStat>, String>() {
|
||||
public List<ShopRentStat> execute(String input) {
|
||||
return doFindShopRentStat(city, region, name, cat, startDate, endDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<ShopRentStat> doFindShopRentStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) {
|
||||
if (startDate == null) {
|
||||
throw new IllegalArgumentException("开始日期不能为空");
|
||||
}
|
||||
if (endDate == null) {
|
||||
throw new IllegalArgumentException("结束日期不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(cat)) {
|
||||
throw new IllegalArgumentException("cat不能为空");
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("district", region));
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
params.add(new QueryParam("name", name));
|
||||
}
|
||||
params.add(new QueryParam("cat", cat));
|
||||
|
||||
if (startDate != null) {
|
||||
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if (endDate != null) {
|
||||
params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("date", true));
|
||||
List<ShopRentStat> regionStats = shopRentStatDao.findAllByParams(params, sortParams);
|
||||
return regionStats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopEvaluationDto addressEvaluateSell(Evaluation evaluation) {
|
||||
if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) {
|
||||
evaluation.setFloor(null);
|
||||
evaluation.setHeight(null);
|
||||
}
|
||||
// 评估逻辑
|
||||
// String location = getLocation(evaluation.getCity(), evaluation.getAddress());
|
||||
GaodeDto gaodeDto = getGaodeGeo(evaluation.getCity(), evaluation.getAddress());
|
||||
if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) {
|
||||
evaluation.setLocation(gaodeDto.getLng() + "," + gaodeDto.getLat());
|
||||
} else {
|
||||
evaluation.setLocation("");
|
||||
}
|
||||
evaluation.setRegion(RegionData.formatRegion(evaluation.getCity(), gaodeDto.getDistrict()));
|
||||
return sellEvaluateByLocation(evaluation);
|
||||
}
|
||||
|
||||
public List<ShopSellStat> doFindShopSellStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) {
|
||||
if (startDate == null) {
|
||||
throw new IllegalArgumentException("开始日期不能为空");
|
||||
}
|
||||
if (endDate == null) {
|
||||
throw new IllegalArgumentException("结束日期不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(cat)) {
|
||||
throw new IllegalArgumentException("cat不能为空");
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("district", region));
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
params.add(new QueryParam("name", name));
|
||||
}
|
||||
params.add(new QueryParam("cat", cat));
|
||||
|
||||
if (startDate != null) {
|
||||
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if (endDate != null) {
|
||||
params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("date", true));
|
||||
List<ShopSellStat> sellStatList = shopSellStatDao.findAllByParams(params, sortParams);
|
||||
return sellStatList;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setShopRentStatDao(ShopRentStatDao shopRentStatDao) {
|
||||
this.shopRentStatDao = shopRentStatDao;
|
||||
}
|
||||
|
||||
public void setShopSellStatDao(ShopSellStatDao shopSellStatDao) {
|
||||
this.shopSellStatDao = shopSellStatDao;
|
||||
}
|
||||
}
|
||||
+26
@@ -2,7 +2,9 @@ package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,6 +21,16 @@ public interface CitySellStatService {
|
||||
*/
|
||||
List<CitySellStat> getAllWithMonths(String city, int monthCount);
|
||||
|
||||
/**
|
||||
* 获取过去 monCount 个月的数据(包含本月数据)
|
||||
* @param city
|
||||
* @param region
|
||||
* @param name
|
||||
* @param monthCount
|
||||
* @return
|
||||
*/
|
||||
List<CitySellStat> getAllWithCurrMonths(String city, int monthCount);
|
||||
|
||||
/**
|
||||
* 查找城市均价排名前Top条数据
|
||||
* @param top 取的名次数
|
||||
@@ -32,4 +44,18 @@ public interface CitySellStatService {
|
||||
* @return
|
||||
*/
|
||||
CitySellStat findCitySellStatByCity(String city);
|
||||
|
||||
List<CitySellStat> findNearCityStat(String city, Integer startDate, int count);
|
||||
|
||||
/**
|
||||
* 查询均价开始的最早时间
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
CitySellStat findStartStat(String city);
|
||||
|
||||
List<CitySellStat> findCityOrderByAvgPrice(final String city, final Integer startDate, final int count) ;
|
||||
|
||||
List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate);
|
||||
|
||||
}
|
||||
|
||||
+74
-7
@@ -1,12 +1,6 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import com.fangjia.core.util.CacheUtils;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
@@ -16,9 +10,12 @@ import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.dao.CitySellStatDao;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.dal.mongo.model.StatFlag;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Closure;
|
||||
|
||||
/**
|
||||
@@ -61,6 +58,26 @@ public class CitySellStatServiceImpl implements CitySellStatService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> getAllWithCurrMonths(final String city, final int monthCount) {
|
||||
Date now = new Date();
|
||||
Date nowMonth = DateUtil.getBeforeDate(now, 0);
|
||||
Date lastMonth = DateUtil.getBeforeDate(now, -1 * monthCount);
|
||||
|
||||
int nowMonthNum = DateUtil.getYear(nowMonth) * 100 + DateUtil.getMonth(now);
|
||||
int lastMonthNum = DateUtil.getYear(lastMonth) * 100 + DateUtil.getMonth(lastMonth);
|
||||
|
||||
List<QueryParam> queryParams = ImmutableList.of(
|
||||
new QueryParam("city", city),
|
||||
new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, nowMonthNum),
|
||||
new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, lastMonthNum)
|
||||
);
|
||||
List<SortParam> sortParams = ImmutableList.of(
|
||||
new SortParam("date", false)
|
||||
);
|
||||
return citySellStatDao.findAllByParams(queryParams, sortParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findTopCitySellStat(final int top, final int type) {
|
||||
String key = top + "_" + type;
|
||||
@@ -108,4 +125,54 @@ public class CitySellStatServiceImpl implements CitySellStatService {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findNearCityStat(final String city, final Integer startDate, final int count) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||
q.add(new QueryParam("city", city));
|
||||
q.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
|
||||
List<SortParam> s = new ArrayList<SortParam>();
|
||||
s.add(new SortParam("date", false));
|
||||
return citySellStatDao.findAllByParams(q, s, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CitySellStat findStartStat(final String city) {
|
||||
return CacheUtils.getValue(this.getClass(), "findStartStat",city, CachePolicyEnum.LONG,
|
||||
new Closure<CitySellStat, String>() {
|
||||
@Override
|
||||
public CitySellStat execute(String input) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||
q.add(new QueryParam("city", city));
|
||||
|
||||
List<SortParam> s = new ArrayList<SortParam>();
|
||||
s.add(new SortParam("date", true));
|
||||
return citySellStatDao.findFirstByParams(q, s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findCityOrderByAvgPrice(final String city, final Integer startDate, final int count) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>();
|
||||
if (StringUtils.isNotBlank(city)) {
|
||||
q.add(new QueryParam("city", city));
|
||||
}
|
||||
q.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
|
||||
List<SortParam> s = new ArrayList<SortParam>();
|
||||
s.add(new SortParam("avgPrice", false));
|
||||
return citySellStatDao.findAllByParams(q, s, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findCitySellStat(final String city, final Integer startDate, final Integer endDate) {
|
||||
return CacheUtils.getValue(this.getClass(), city, String.valueOf(endDate + startDate),
|
||||
CachePolicyEnum.MIDDLE, new Closure<List<CitySellStat>, String>() {
|
||||
public List<CitySellStat> execute(String input) {
|
||||
return citySellStatDao.findCitySellStat(city, startDate, endDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.CommunityRate;
|
||||
|
||||
public interface CommunityRateService {
|
||||
CommunityRate findById(String id);
|
||||
|
||||
CommunityRate findBySeeweadId(String id);
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.dao.CommunityRateDao;
|
||||
import com.fangjia.dal.mongo.model.CommunityRate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommunityRateServiceImpl implements CommunityRateService {
|
||||
private CommunityRateDao communityRateDao;
|
||||
|
||||
@Override
|
||||
public CommunityRate findById(String id) {
|
||||
return communityRateDao.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommunityRate findBySeeweadId(String id) {
|
||||
ArrayList<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("commId", id));
|
||||
List<CommunityRate> communityRateList = communityRateDao.findAllByParams(params);
|
||||
if (communityRateList != null && !communityRateList.isEmpty()) {
|
||||
return communityRateList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCommunityRateDao(CommunityRateDao communityRateDao) {
|
||||
this.communityRateDao = communityRateDao;
|
||||
}
|
||||
}
|
||||
+79
-47
@@ -1,9 +1,8 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
import com.fangjia.dal.*;
|
||||
import com.fangjia.dal.seawater.dao.SeawaterDao;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.datastore.dao.HouseDao;
|
||||
import com.fangjia.dal.datastore.model.House;
|
||||
@@ -14,6 +13,7 @@ import com.fangjia.dal.mongo.model.DistrictStat;
|
||||
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DealPrice;
|
||||
import com.fangjia.dal.mongo.model.bkoff.Loudong;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.service.address.mode.ProvinceData;
|
||||
import com.fangjia.service.bo.Collateral;
|
||||
@@ -24,12 +24,15 @@ import com.fangjia.service.datastore.bean.CollateralSampleQueryBean;
|
||||
import com.fangjia.service.datastore.bean.ShopCollateralSampleQueryBean;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.open.FangjiaOfficialAreaService;
|
||||
import com.fangjia.service.util.CommonUtil;
|
||||
import com.fangjia.service.util.CommonUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.solr.client.solrj.util.ClientUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@@ -59,6 +62,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
private DistrictSellStatService districtSellStatService;
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
private LoudongDao loudongDao;
|
||||
private SeawaterDao seawaterDao;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -183,7 +187,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
int c = 0;
|
||||
for (String n : names) {
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
if (StringUtils.isNotBlank(n)) {
|
||||
if (name.indexOf("(") > -1 || name.indexOf(")") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1
|
||||
| name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1
|
||||
|| name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1) {
|
||||
@@ -196,9 +200,11 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
BooleanQuery srQuery = new BooleanQuery();
|
||||
srQuery.add(nameQuery, BooleanClause.Occur.MUST);
|
||||
houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery)));
|
||||
if (!nameQuery.clauses().isEmpty()) {
|
||||
BooleanQuery srQuery = new BooleanQuery();
|
||||
srQuery.add(nameQuery, BooleanClause.Occur.MUST);
|
||||
houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery)));
|
||||
}
|
||||
List<SortParam> houseSortParams = new ArrayList<SortParam>();
|
||||
houseSortParams.add(new SortParam("publishDate", false));
|
||||
houseQuery.add(new QueryParam("category", "shop_sell"));
|
||||
@@ -225,41 +231,36 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), DateUtil.add(new Date(), -7));
|
||||
}
|
||||
List<SampleWrapper> querySamples = new ArrayList<SampleWrapper>();
|
||||
District hasHouseDist = districtService.findDistrictHasHouseFlag(district);//查询是否是有房源的小区
|
||||
List<String> keys = new ArrayList<String>();
|
||||
String key = district.getName() + "_" + district.getRegion() + "_" + district.getCity();
|
||||
// 修改
|
||||
keys.add(key);
|
||||
|
||||
if(hasHouseDist != null){
|
||||
List<String> keys = new ArrayList<String>();
|
||||
String key = district.getName() + "_" + district.getRegion() + "_" + district.getCity();
|
||||
// 修改
|
||||
keys.add(key);
|
||||
List<String> names = new ArrayList<String>();
|
||||
names.add(ClientUtils.escapeQueryChars(district.getName()));
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
names.add(ClientUtils.escapeQueryChars(district.getName()));
|
||||
if (district.getAlias() != null) {
|
||||
for (String alia : district.getAlias()) {
|
||||
|
||||
if (district.getAlias() != null) {
|
||||
for (String alia : district.getAlias()) {
|
||||
if (StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)) {
|
||||
names.add(ClientUtils.escapeQueryChars(alia));
|
||||
|
||||
if (StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)) {
|
||||
names.add(ClientUtils.escapeQueryChars(alia));
|
||||
|
||||
key = alia + "_" + district.getRegion() + "_" + district.getCity();
|
||||
if (!keys.contains(key)) {
|
||||
keys.add(key);
|
||||
}
|
||||
key = alia + "_" + district.getRegion() + "_" + district.getCity();
|
||||
if (!keys.contains(key)) {
|
||||
keys.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<SampleWrapper> samples = findJnbankSampleByDistrict(district, keys, names, queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea());
|
||||
|
||||
// scoreForSample(samples, target);
|
||||
sortForSample(samples, target);
|
||||
for (SampleWrapper sample : samples) {
|
||||
sample.setProperty(queryBean.getProperty());
|
||||
}
|
||||
querySamples.addAll(samples);
|
||||
}
|
||||
|
||||
List<SampleWrapper> samples = findJnbankSampleByDistrict(district, keys, names, queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea());
|
||||
|
||||
// scoreForSample(samples, target);
|
||||
sortForSample(samples, target);
|
||||
for (SampleWrapper sample : samples) {
|
||||
sample.setProperty(queryBean.getProperty());
|
||||
}
|
||||
querySamples.addAll(samples);
|
||||
if (querySamples.size() < max) {
|
||||
district = districtService.findOneByKey(new DistrictKey(district.getCity(), district.getRegion(), district.getName()), "district");
|
||||
// List<District> districts = districtService.findNearestDistrict(district, 1000, 5);
|
||||
@@ -269,7 +270,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
List<String> arroundKeys = new ArrayList<String>();
|
||||
for (District d : districts) {
|
||||
d = districtService.findById(d.getId());
|
||||
if(district.getName().equals(d.getName())){
|
||||
if (district.getName().equals(d.getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -531,8 +532,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
if (!map.containsKey(districtName)) {
|
||||
List<SampleWrapper> sampleWrappers = new ArrayList<SampleWrapper>();
|
||||
sampleWrappers.add(sample);
|
||||
map.put(districtName,sampleWrappers);
|
||||
}else {
|
||||
map.put(districtName, sampleWrappers);
|
||||
} else {
|
||||
map.get(districtName).add(sample);
|
||||
}
|
||||
}
|
||||
@@ -540,9 +541,9 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
for (Map.Entry<String, List<SampleWrapper>> entry : map.entrySet()) {
|
||||
//每个小区取5个样本
|
||||
|
||||
if (entry.getValue().size()>=5){
|
||||
querySamples.addAll(entry.getValue().subList(0,5));
|
||||
}else {
|
||||
if (entry.getValue().size() >= 5) {
|
||||
querySamples.addAll(entry.getValue().subList(0, 5));
|
||||
} else {
|
||||
// 不超过五个,全部放入
|
||||
querySamples.addAll(entry.getValue());
|
||||
}
|
||||
@@ -659,7 +660,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
|
||||
querySamples.addAll(samples);
|
||||
if (querySamples.size() < max + 10) {
|
||||
// 查询成交补充 TODO
|
||||
// 查询成交补充 TODO
|
||||
List<QueryParam> dealPriceQuery = new ArrayList<QueryParam>();
|
||||
dealPriceQuery.add(new QueryParam("city", district.getCity()));
|
||||
dealPriceQuery.add(new QueryParam("region", district.getRegion()));
|
||||
@@ -1126,18 +1127,22 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
/**
|
||||
* 江南行查找小区样本(优先使用贝壳链家)
|
||||
*
|
||||
* @param estateType 用户查询物业类型
|
||||
* @param estateType 用户查询物业类型
|
||||
* @param startDate
|
||||
* @return
|
||||
*/
|
||||
private List<SampleWrapper> findJnbankSampleByDistrict(District district, List<String> keys, List<String> names, String estateType, Date startDate, DistrictStat districtStat,double area) {
|
||||
|
||||
private List<SampleWrapper> findJnbankSampleByDistrict(District district, List<String> keys, List<String> names, String estateType, Date startDate, DistrictStat districtStat, double area) {
|
||||
|
||||
//改为从ES 查房源
|
||||
ArrayList<String> districtNames = new ArrayList<String>();
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
int c = 0;
|
||||
for (String namekey : keys) {
|
||||
if (StringUtils.isNotBlank(namekey)) {
|
||||
namekey = ClientUtils.escapeQueryChars(namekey);
|
||||
if (namekey.contains("_")) {
|
||||
districtNames.add(namekey.split("_")[0]);
|
||||
}
|
||||
c++;
|
||||
nameQuery.add(new TermQuery(new Term("districtname_key", namekey)), BooleanClause.Occur.SHOULD);
|
||||
}
|
||||
@@ -1149,15 +1154,19 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
List<QueryParam> houseQuery = new ArrayList<QueryParam>();
|
||||
houseQuery.add(new QueryParam("city", district.getCity()));
|
||||
houseQuery.add(new QueryParam("region", district.getRegion()));
|
||||
SeawaterQuery seawaterQuery = new SeawaterQuery();
|
||||
if (districtStat != null && districtStat.getAvgPrice() > 0) {
|
||||
int avgPrice = districtStat.getAvgPrice();
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int) (avgPrice * 0.5)));//0.85
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int) (avgPrice * 1.5)));//1.15
|
||||
// 价格范围调整为上下浮动30%
|
||||
seawaterQuery.setStartPrice((int) (avgPrice * 0.7));
|
||||
seawaterQuery.setEndPrice((int) (avgPrice * 1.3));
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int) (avgPrice * 0.7)));
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int) (avgPrice * 1.3)));
|
||||
}
|
||||
houseQuery.add(new QueryParam("area", QueryParam.LESS_THAN_EQUAL_OPERATOR, area + 30));
|
||||
houseQuery.add(new QueryParam("area", QueryParam.GREATER_THAN_EQUAL_OPERATOR, area - 30));
|
||||
|
||||
if (nameQuery.clauses().isEmpty()){
|
||||
if (nameQuery.clauses().isEmpty()) {
|
||||
return samples;
|
||||
}
|
||||
BooleanQuery srQuery = new BooleanQuery();
|
||||
@@ -1169,7 +1178,26 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
|
||||
List<SortParam> houseSortParams = new ArrayList<SortParam>();
|
||||
houseSortParams.add(new SortParam("publishDate", false));
|
||||
List<House> houses = houseDao.findAllByParams(houseQuery, houseSortParams, 0, 200, HOUSE_FIELDS);
|
||||
|
||||
seawaterQuery.setCityDisplay(district.getCity());
|
||||
seawaterQuery.setDistrictAlias(names);
|
||||
seawaterQuery.setRegion(district.getRegion());
|
||||
seawaterQuery.setDistrictName(district.getName());
|
||||
if(!"02".equals(estateType)){
|
||||
seawaterQuery.setStartArea(area - 30);
|
||||
seawaterQuery.setEndArea(area + 30);
|
||||
}
|
||||
seawaterQuery.setSortField("p_date");
|
||||
seawaterQuery.setOrder(false);
|
||||
Pager pager = new Pager(0, 200);
|
||||
pager.setPageSize(200);
|
||||
seawaterQuery.setTable("latest_seawater");
|
||||
seawaterQuery.setPager(pager);
|
||||
seawaterQuery.setCat("sell");
|
||||
List<Seawater> seawaters = seawaterDao.findSeawatersByQuery(seawaterQuery);
|
||||
List<House> houses = CommonUtils.transformListV(House.class, seawaters);
|
||||
|
||||
// List<House> houses1 = houseDao.findAllByParams(houseQuery, houseSortParams, 0, 200, HOUSE_FIELDS);
|
||||
int height = 0;
|
||||
int maxFloor = 0;
|
||||
boolean allSampleHasHeight = true;
|
||||
@@ -1730,4 +1758,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
||||
public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) {
|
||||
this.fangjiaOfficialAreaService = fangjiaOfficialAreaService;
|
||||
}
|
||||
|
||||
public void setSeawaterDao(SeawaterDao seawaterDao) {
|
||||
this.seawaterDao = seawaterDao;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class DistrictSellStatServiceImpl implements DistrictSellStatService {
|
||||
new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, monthInLastYearNum)
|
||||
);
|
||||
List<SortParam> sortParams = ImmutableList.of(
|
||||
new SortParam("date", false)
|
||||
new SortParam("date", true)
|
||||
);
|
||||
return districtSellStatDao.findAllByParams(queryParams, sortParams);
|
||||
}
|
||||
|
||||
+4
-4
@@ -2457,8 +2457,8 @@ public class DistrictServiceImpl implements DistrictService {
|
||||
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
||||
List<District> list = districtDao.findAllByParams(params, null, 0, limit * 2,
|
||||
new String[] { "city", "region", "name", "estateType2", "id" });
|
||||
if (list.size() == 0) {
|
||||
return Collections.EMPTY_LIST;
|
||||
if (list.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<District> ret = new ArrayList<District>();
|
||||
@@ -2467,8 +2467,8 @@ public class DistrictServiceImpl implements DistrictService {
|
||||
&& district.getCity().equals(d.getCity())) {
|
||||
continue;
|
||||
}
|
||||
if (d.getEstateType2() != null) {
|
||||
if (d.getEstateType2().indexOf(district.getEstateType2()) > -1) {
|
||||
if (d.getEstateType2() != null && district.getEstateType2() != null) {
|
||||
if (d.getEstateType2().contains(district.getEstateType2())) {
|
||||
ret.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
+70
-20
@@ -13,6 +13,7 @@ import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.OfficeRentStat;
|
||||
import com.fangjia.dal.mongo.model.OfficeSellStat;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.dal.seawater.model.SeawaterDto;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.service.datastore.dto.OfficeEvaluationDto;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
@@ -299,20 +300,22 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
|
||||
// 第二步:基准价*楼层系数*装修系数*朝向系数
|
||||
OfficeSellStat officeSellStat = officeSellStatDao.findFirstByParams(params);
|
||||
Double avgPrice = Double.valueOf(officeSellStat.getAvgPrice());
|
||||
if (avgPrice != null) {
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
if (officeSellStat != null) {
|
||||
Double avgPrice = Double.valueOf(officeSellStat.getAvgPrice());
|
||||
if (avgPrice != null) {
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment()));
|
||||
}
|
||||
if (floorDesc != null) {
|
||||
factor *= FLOOR_FACTOR.get(floorDesc);
|
||||
}
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
avgPrice = avgPrice * factor;
|
||||
return getOfficeEvaluationDtoWithAvgPrice(avgPrice, evaluation, "office_sell");
|
||||
}
|
||||
if (floorDesc != null) {
|
||||
factor *= FLOOR_FACTOR.get(floorDesc);
|
||||
}
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
avgPrice = avgPrice * factor;
|
||||
return getOfficeEvaluationDtoWithAvgPrice(avgPrice, evaluation, "office_sell");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -366,6 +369,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
|
||||
String fitment = FITMENT_MAP.get(evaluation.getFitment());
|
||||
String direction = DIRECTION_MAP.get(evaluation.getDirection());
|
||||
List<SeawaterDto> seawaterDtoList = new ArrayList<SeawaterDto>();
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) {
|
||||
Double price = Double.valueOf(seawater.getTotalPrice());
|
||||
@@ -403,12 +407,14 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
sum += price;
|
||||
size += seawater.getArea();
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, null);
|
||||
seawaterDtoList.add(seawaterDto);
|
||||
}
|
||||
OfficeEvaluationDto officeEvaluationDto = new OfficeEvaluationDto();
|
||||
if (size > 0) {
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size / 30, 2);
|
||||
officeEvaluationDto.setUnitPrice(unitPrice);
|
||||
officeEvaluationDto.setSeawater(seawaters);
|
||||
officeEvaluationDto.setSeawater(seawaterDtoList);
|
||||
officeEvaluationDto.setCity(evaluation.getCity());
|
||||
officeEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
officeEvaluationDto.setName(evaluation.getDistrictName());
|
||||
@@ -429,17 +435,20 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
|
||||
OfficeEvaluationDto officeEvaluationDto = new OfficeEvaluationDto();
|
||||
|
||||
List<SeawaterDto> seawaterList = new ArrayList<SeawaterDto>();
|
||||
if ("office_rent".equals(cat)) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) {
|
||||
sum += seawater.getTotalPrice();
|
||||
size += seawater.getArea();
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, cat);
|
||||
seawaterList.add(seawaterDto);
|
||||
}
|
||||
if (size > 0) {
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size / 30, 2);
|
||||
officeEvaluationDto.setUnitPrice(unitPrice);
|
||||
officeEvaluationDto.setSeawater(seawaters);
|
||||
officeEvaluationDto.setSeawater(seawaterList);
|
||||
officeEvaluationDto.setCity(evaluation.getCity());
|
||||
officeEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
officeEvaluationDto.setName(evaluation.getDistrictName());
|
||||
@@ -450,11 +459,13 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
sum += seawater.getTotalPrice();
|
||||
size += seawater.getArea();
|
||||
}
|
||||
SeawaterDto seawaterDto = getSeawaterDto(seawater, cat);
|
||||
seawaterList.add(seawaterDto);
|
||||
}
|
||||
if (size > 0) {
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size, 2);
|
||||
Double unitPrice = DataUtil.roundDouble(sum / size, 0);
|
||||
officeEvaluationDto.setUnitPrice(unitPrice);
|
||||
officeEvaluationDto.setSeawater(seawaters);
|
||||
officeEvaluationDto.setSeawater(seawaterList);
|
||||
officeEvaluationDto.setCity(evaluation.getCity());
|
||||
officeEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
officeEvaluationDto.setName(evaluation.getDistrictName());
|
||||
@@ -464,6 +475,25 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
return officeEvaluationDto;
|
||||
}
|
||||
|
||||
private static SeawaterDto getSeawaterDto(Seawater seawater, String cat) {
|
||||
SeawaterDto seawaterDto = new SeawaterDto();
|
||||
seawaterDto.setCity(seawater.getCity());
|
||||
seawaterDto.setDistrict(seawater.getRegion());
|
||||
seawaterDto.setName(seawater.getDistrictName());
|
||||
seawaterDto.setArea(seawater.getArea());
|
||||
seawaterDto.setFitment(seawater.getFitment());
|
||||
if (cat != null && cat.contains("rent")) {
|
||||
seawaterDto.setUnitPrice(seawater.getDayUnitPrice());
|
||||
} else {
|
||||
seawaterDto.setUnitPrice(seawater.getAvgPrice().doubleValue());
|
||||
}
|
||||
seawaterDto.setEstateType(seawater.getEstateType());
|
||||
seawaterDto.setBedKind(seawater.getLevel());
|
||||
seawaterDto.setPublishDate(String.valueOf(seawater.getpDate()));
|
||||
seawaterDto.setFloorInfo(seawater.getFloorInfo());
|
||||
return seawaterDto;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OfficeEvaluationDto addressEvaluateRent(Evaluation evaluation) {
|
||||
@@ -514,6 +544,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
sortParams.add(new SortParam("date", false));
|
||||
|
||||
List<OfficeRentStat> infos = officeRentStatDao.findAllByParams(params, sortParams, 5);
|
||||
List<SeawaterDto> seawaterDtoList = new ArrayList<SeawaterDto>();
|
||||
if (CollectionUtils.isEmpty(infos)) {
|
||||
// 去掉类型,重新查找
|
||||
params = new ArrayList<QueryParam>(5);
|
||||
@@ -531,6 +562,15 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
totalPrice += officeRentStat.getAvgPrice();
|
||||
count += 1;
|
||||
}
|
||||
SeawaterDto seawaterDto = new SeawaterDto();
|
||||
seawaterDto.setCity(officeRentStat.getCity());
|
||||
seawaterDto.setDistrict(officeRentStat.getDistrict());
|
||||
seawaterDto.setName(officeRentStat.getName());
|
||||
seawaterDto.setUnitPrice(officeRentStat.getAvgPrice());
|
||||
seawaterDto.setPublishDate(String.valueOf(officeRentStat.getDate()));
|
||||
seawaterDto.setEstateType(officeRentStat.getEstateType2());
|
||||
seawaterDto.setBedKind(officeRentStat.getBedKind());
|
||||
seawaterDtoList.add(seawaterDto);
|
||||
}
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
@@ -544,7 +584,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
}
|
||||
Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2);
|
||||
officeEvaluationDto.setUnitPrice(avgPrice);
|
||||
officeEvaluationDto.setOffice(infos);
|
||||
officeEvaluationDto.setSeawater(seawaterDtoList);
|
||||
officeEvaluationDto.setCity(evaluation.getCity());
|
||||
officeEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
officeEvaluationDto.setName(evaluation.getDistrictName());
|
||||
@@ -593,6 +633,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
params.add(new QueryParam("date", Integer.parseInt(date)));
|
||||
infos = officeSellStatDao.findAllByParams(params, sortParams);
|
||||
}
|
||||
List<SeawaterDto> seawaterDtoList = new ArrayList<SeawaterDto>();
|
||||
if (CollectionUtils.isNotEmpty(infos)) {
|
||||
// 求均值
|
||||
Double totalPrice = 0D;
|
||||
@@ -602,6 +643,15 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
totalPrice += officeSellStat.getAvgPrice();
|
||||
count += 1;
|
||||
}
|
||||
SeawaterDto seawaterDto = new SeawaterDto();
|
||||
seawaterDto.setCity(officeSellStat.getCity());
|
||||
seawaterDto.setDistrict(officeSellStat.getDistrict());
|
||||
seawaterDto.setName(officeSellStat.getName());
|
||||
seawaterDto.setUnitPrice(officeSellStat.getAvgPrice().doubleValue());
|
||||
seawaterDto.setPublishDate(String.valueOf(officeSellStat.getDate()));
|
||||
seawaterDto.setEstateType(officeSellStat.getEstateType2());
|
||||
seawaterDto.setBedKind(officeSellStat.getBedKind());
|
||||
seawaterDtoList.add(seawaterDto);
|
||||
}
|
||||
Double factor = 1.0;
|
||||
if (evaluation.getFitment() != null) {
|
||||
@@ -613,9 +663,9 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
if (evaluation.getDirection() != null) {
|
||||
factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection()));
|
||||
}
|
||||
Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2);
|
||||
Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 0);
|
||||
officeEvaluationDto.setUnitPrice(avgPrice);
|
||||
officeEvaluationDto.setOfficeSell(infos);
|
||||
officeEvaluationDto.setSeawater(seawaterDtoList);
|
||||
officeEvaluationDto.setCity(evaluation.getCity());
|
||||
officeEvaluationDto.setDistrict(evaluation.getRegion());
|
||||
officeEvaluationDto.setName(evaluation.getDistrictName());
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.service.bo.AvgUpdateBo;
|
||||
import com.fangjia.service.bo.RegionStatBo;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface RegionSellService {
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user