Merge remote-tracking branch 'origin/master'
# Conflicts: # projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java
This commit is contained in:
+28
-17
@@ -576,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")))) {
|
||||
@@ -632,7 +640,7 @@ public class AddrSvcController {
|
||||
basicModel.setResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
@@ -856,9 +864,9 @@ public class AddrSvcController {
|
||||
if (result.containsKey("town")) {
|
||||
map.put("town", result.getString("town"));
|
||||
}
|
||||
if (result.containsKey("committee")) {
|
||||
map.put("committee", result.getString("committee"));
|
||||
}
|
||||
// if (result.containsKey("committee")) {
|
||||
// map.put("committee", result.getString("committee"));
|
||||
// }
|
||||
if (result.containsKey("provinceCode")) {
|
||||
map.put("provinceCode", result.getString("provinceCode"));
|
||||
}
|
||||
@@ -871,15 +879,15 @@ public class AddrSvcController {
|
||||
if (result.containsKey("townCode")) {
|
||||
map.put("townCode", result.getString("townCode"));
|
||||
}
|
||||
if (result.containsKey("committeeCode")) {
|
||||
map.put("committeeCode", result.getString("committeeCode"));
|
||||
}
|
||||
if (result.containsKey("typeCode")) {
|
||||
map.put("typeCode", result.getString("typeCode"));
|
||||
}
|
||||
if (result.containsKey("typeName")) {
|
||||
map.put("typeName", result.getString("typeName"));
|
||||
}
|
||||
// if (result.containsKey("committeeCode")) {
|
||||
// map.put("committeeCode", result.getString("committeeCode"));
|
||||
// }
|
||||
// if (result.containsKey("typeCode")) {
|
||||
// map.put("typeCode", result.getString("typeCode"));
|
||||
// }
|
||||
// if (result.containsKey("typeName")) {
|
||||
// map.put("typeName", result.getString("typeName"));
|
||||
// }
|
||||
if (result.containsKey("verifyFlag")) {
|
||||
map.put("verifyFlag", result.getString("verifyFlag"));
|
||||
} else {
|
||||
@@ -913,6 +921,9 @@ public class AddrSvcController {
|
||||
if (result.containsKey("countyGovTown")) {
|
||||
map.put("countyGovTown", result.getString("countyGovTown"));
|
||||
}
|
||||
if (result.containsKey("remark")) {
|
||||
map.put("remark", result.getString("remark"));
|
||||
}
|
||||
basicModel.setResult(map);
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
|
||||
+9
-1
@@ -80,6 +80,11 @@ public class CommercialController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商铺出租
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object shopRentEvaluateAction(CommercialModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -93,7 +98,7 @@ public class CommercialController {
|
||||
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("avgPrice", Double.valueOf(json.getString("unitPrice")));
|
||||
resultMap.put("totalPrice", Long.valueOf(json.getString("totalPrice")));
|
||||
|
||||
if (model.getShowSample()!=null && model.getShowSample()==1 && json.containsKey("case")) {
|
||||
@@ -198,6 +203,9 @@ public class CommercialController {
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
if(StringUtils.isNotBlank(model.getCityName())){
|
||||
params.put("city", model.getCityName());
|
||||
}
|
||||
if(StringUtils.isNotBlank(model.getAddress())){
|
||||
params.put("address", model.getAddress());
|
||||
}
|
||||
|
||||
+43
-39
@@ -57,6 +57,7 @@ import com.fangjia.service.sql.ApiUserService;
|
||||
import com.fangjia.service.sql.UserService;
|
||||
import com.fangjia.service.web.MenuService;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.sothis.core.util.Closure;
|
||||
@@ -975,6 +976,22 @@ public class HouseController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<Seawater> houses = new ArrayList<Seawater>();
|
||||
List<Seawater> houseSelf = new ArrayList<Seawater>();
|
||||
List<Seawater> houseAround = new ArrayList<Seawater>();
|
||||
List<Seawater> houseList = new ArrayList<Seawater>();
|
||||
String[] categories = {"rent", "shop_rent", "office_rent"};
|
||||
// if (cat.contains("_")) {
|
||||
// 商铺,写字楼有经纬度,直接查
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
// 先用名字查自身的样本
|
||||
query.setCityDisplay(city);
|
||||
query.setRegion(region);
|
||||
query.setDistrictName(districtName);
|
||||
query.setStartDate(model.getStartTime());
|
||||
query.setEndDate(model.getEndTime());
|
||||
|
||||
String category = "district";
|
||||
if ("1".equals(model.getPropertyType())) {
|
||||
category = "office";
|
||||
@@ -991,6 +1008,11 @@ public class HouseController {
|
||||
} else {
|
||||
cat = "rent";
|
||||
}
|
||||
if (model.getPrice() != null) {
|
||||
query.setStartPrice((int) (model.getPrice() * 0.5 * 30));
|
||||
query.setEndPrice((int) (model.getPrice() * 1.5 * 30));
|
||||
}
|
||||
|
||||
} else {
|
||||
if ("1".equals(model.getPropertyType())) {
|
||||
cat = "office_sell";
|
||||
@@ -998,21 +1020,13 @@ public class HouseController {
|
||||
if ("2".equals(model.getPropertyType())) {
|
||||
cat = "shop_sell";
|
||||
}
|
||||
if (model.getPrice() != null) {
|
||||
query.setStartPrice((int) (model.getPrice() * 0.5));
|
||||
query.setEndPrice((int) (model.getPrice() * 1.5));
|
||||
}
|
||||
|
||||
}
|
||||
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.setCityDisplay(city);
|
||||
query.setRegion(region);
|
||||
query.setDistrictName(districtName);
|
||||
query.setCat(cat);
|
||||
query.setStartDate(model.getStartTime());
|
||||
query.setEndDate(model.getEndTime());
|
||||
|
||||
if (model.getSize() != null && model.getSize() != 0) {
|
||||
query.setStartArea(model.getSize() * 0.9);
|
||||
@@ -1025,36 +1039,15 @@ public class HouseController {
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
}
|
||||
if ("1".equals(model.getHouseType())) {
|
||||
if ("1".equals(model.getPropertyType())) {
|
||||
cat = "office_rent";
|
||||
} else if ("2".equals(model.getPropertyType())) {
|
||||
cat = "shop_rent";
|
||||
} else {
|
||||
cat = "rent";
|
||||
}
|
||||
if (model.getPrice() != null) {
|
||||
query.setStartPrice((int) (model.getPrice() * 0.5 * 30));
|
||||
query.setEndPrice((int) (model.getPrice() * 1.5 * 30));
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(model.getPropertyType())) {
|
||||
cat = "office_sell";
|
||||
}
|
||||
if ("2".equals(model.getPropertyType())) {
|
||||
cat = "shop_sell";
|
||||
}
|
||||
if (model.getPrice() != null) {
|
||||
query.setStartPrice((int) (model.getPrice() * 0.5));
|
||||
query.setEndPrice((int) (model.getPrice() * 1.5));
|
||||
}
|
||||
}
|
||||
query.setPager(pager);
|
||||
query.setSortField("p_date");
|
||||
query.setOrder(false);
|
||||
query.setTable("latest_seawater");
|
||||
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(districtName)) {
|
||||
houseSelf = seawaterDao.findSeawatersByQuery(query);
|
||||
for(Seawater house : houseSelf){
|
||||
house.setDistance(0);
|
||||
}
|
||||
houses.addAll(houseSelf);
|
||||
}
|
||||
// 如果自身样本数不够,再查周边
|
||||
@@ -1100,12 +1093,23 @@ public class HouseController {
|
||||
}
|
||||
}
|
||||
seawater.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea());
|
||||
seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
|
||||
if(ArrayUtils.contains(categories, cat)){
|
||||
if(house.getAvgPrice() != null){
|
||||
double dayRentPrice = (double)(house.getAvgPrice()/30.0);
|
||||
seawater.setUnitPrice(DataUtil.getDoubleRound(2,dayRentPrice));
|
||||
}
|
||||
}else{
|
||||
seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
|
||||
}
|
||||
|
||||
seawater.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice());
|
||||
seawater.setDirection(house.getDirection());
|
||||
seawater.setFloor(house.getFloor() == null || house.getFloor() == 0 ? null : house.getFloor());
|
||||
seawater.setMaxFloor(house.getHeight() == null || house.getHeight() == 0 ? null : house.getHeight());
|
||||
seawater.setDayUnitPrice(house.getDayUnitPrice() == null || house.getDayUnitPrice() == 0 ? null : house.getDayUnitPrice());
|
||||
// seawater.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom());
|
||||
// seawater.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall());
|
||||
// seawater.setToilet(house.getToilet() == null || house.getToilet() == 0 ? null : house.getToilet());
|
||||
// seawater.setDayUnitPrice(house.getDayUnitPrice() == null || house.getDayUnitPrice() == 0 ? null : house.getDayUnitPrice());
|
||||
seawater.setRentType(house.getRentType());
|
||||
seawater.setPayType(house.getPayType());
|
||||
seawater.setBusinessStatus(house.getBusinessStatus());
|
||||
|
||||
+49
-25
@@ -222,32 +222,50 @@ public class OfficeSellController {
|
||||
public Object evaluateSellAction(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0 || model.getCity().contains("全国")
|
||||
|| model.getDistrict().contains("全国")) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,写字楼名,面积(size)为必填项"));
|
||||
|
||||
if (StringUtils.isBlank(model.getCity()) || model.getSize()<=0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,面积为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
|
||||
if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
/* 先到CPDB库中查找写字楼 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), "office");
|
||||
District district = null;
|
||||
|
||||
if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())) {
|
||||
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), "office");
|
||||
}
|
||||
if (district == null) {
|
||||
if (model.getDistrict().contains("市辖区") || model.getDistrict().contains(model.getCity())) {
|
||||
if (StringUtils.isNotBlank(model.getDistrict()) && (model.getDistrict().contains("市辖区") || model.getDistrict().contains(model.getCity()))) {
|
||||
district = districtService.findByNameAndAlias(model.getCity(), null, model.getName(), "office");
|
||||
}
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该写字楼不存在"));
|
||||
return mav;
|
||||
|
||||
}
|
||||
|
||||
if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) {
|
||||
JSONObject resultObject = null;
|
||||
if(StringUtils.isNotBlank(model.getAddress())){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "office", false);
|
||||
}else if(StringUtils.isNotBlank(model.getName())){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "office", false);
|
||||
}
|
||||
if(resultObject != null){
|
||||
String id = (String) resultObject.get("id");
|
||||
district = districtService.findById(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该写字楼不存在"));
|
||||
return mav;
|
||||
}
|
||||
model.setName(district.getName());
|
||||
|
||||
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;
|
||||
@@ -287,16 +305,19 @@ public class OfficeSellController {
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
try {
|
||||
if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) {
|
||||
openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/officeSell/evaluateSell");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Long totalPrice = (long) (evaluation.getUnitPrice() * model.getSize());
|
||||
districtPriceMap.put("totalPrice", totalPrice);
|
||||
if(model.getShow()!=null && model.getShow()==1){
|
||||
districtPriceMap.put("samples", evaluation.getSeawater());
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
// try {
|
||||
// if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) {
|
||||
// openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/officeSell/evaluateSell");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
return mav;
|
||||
} else {
|
||||
@@ -473,7 +494,10 @@ public class OfficeSellController {
|
||||
if (StringUtils.isNotBlank(model.getOtherFactor())) {
|
||||
evaluation.setOtherFactor(model.getOtherFactor());
|
||||
}
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
if(StringUtils.isNotBlank(model.getDistrict())){
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
}
|
||||
|
||||
if (null != model.getRoom()) {
|
||||
evaluation.setRoom(model.getRoom());
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class PoiController {
|
||||
double lng = Double.parseDouble(lngStr);
|
||||
double lat = Double.parseDouble(latStr);
|
||||
Map<String, List<String>> result = new HashMap<String, List<String>>();
|
||||
List<String> bankSmallType = Arrays.asList("银行", "中国人民银行", "国家开发银行", "中国进出口银行",
|
||||
List<String> bankSmallType = Arrays.asList("中国人民银行", "国家开发银行", "中国进出口银行",
|
||||
"中国银行", "中国工商银行", "中国建设银行", "中国农业银行", "交通银行", "招商银行", "华夏银行",
|
||||
"中信银行", "中国民生银行", "中国光大银行", "上海银行", "上海浦东发展银行", "平安银行", "兴业银行",
|
||||
"北京银行", "广发银行", "农村商业银行", "香港恒生银行", "东亚银行", "花旗银行", "渣打银行", "汇丰银行",
|
||||
@@ -372,7 +372,7 @@ public class PoiController {
|
||||
|
||||
for (Map<String, Object> hit : hits) {
|
||||
Map<String, Object> source = (Map<String, Object>) hit.get("_source");
|
||||
if (source.containsKey("name")) {
|
||||
if (source.containsKey("name") && !source.get("name").toString().contains("公司")) {
|
||||
poiNames.add(source.get("name").toString());
|
||||
}
|
||||
}
|
||||
|
||||
+550
-13
@@ -51,6 +51,7 @@ import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.solr.client.solrj.util.ClientUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.slf4j.Logger;
|
||||
import org.sothis.core.util.CollectionUtils;
|
||||
@@ -759,12 +760,14 @@ public class PropertyController {
|
||||
districtInfoDto.setAddress(district.getAddress());
|
||||
//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);
|
||||
// int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
|
||||
// if (avgPrice == 0) {
|
||||
// avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7));
|
||||
// }
|
||||
|
||||
DistrictSellStat sellStat = districtSellStatService.findFirstByParams(district.getCity(), district.getRegion(), district.getName());
|
||||
if (sellStat != null) {
|
||||
districtInfoDto.setAvgPrice(sellStat.getAvgPrice());
|
||||
}
|
||||
districtInfoDto.setPropertyType(district.getEstateType2());
|
||||
if (district.getLat2() != null && district.getLat2() != 0 && district.getLng2() != null
|
||||
@@ -1196,9 +1199,18 @@ public class PropertyController {
|
||||
int orgAvgPrice = 0;
|
||||
if (districtStatBo != null) {
|
||||
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
|
||||
if(districtStatBo.getVillaDistrictStat().getAvg_price_2b() != null && districtStatBo.getVillaDistrictStat().getAvg_price_2b() > 0){
|
||||
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvg_price_2b();
|
||||
}else{
|
||||
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
|
||||
}
|
||||
|
||||
} else if (districtStatBo.getDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
|
||||
if(districtStatBo.getDistrictStat().getAvg_price_2b() != null && districtStatBo.getDistrictStat().getAvg_price_2b() > 0){
|
||||
orgAvgPrice = districtStatBo.getDistrictStat().getAvg_price_2b();
|
||||
}else{
|
||||
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
|
||||
@@ -1651,7 +1663,16 @@ public class PropertyController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (district == null) {
|
||||
//使用新匹配再配一遍,不加类型,有结果,类型为district则走小区估值,其它类型也走经纬度估值
|
||||
JSONObject resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), null, false);
|
||||
if (resultObject != null && resultObject.containsKey("category") && resultObject.get("category")!=null) {
|
||||
if(resultObject.containsKey("id") && resultObject.get("category").equals("district")){
|
||||
String id = (String) resultObject.get("id");
|
||||
district = districtService.findById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (district == null) {
|
||||
//加上高德获取经纬度 和 根据经纬度估值
|
||||
@@ -2484,9 +2505,19 @@ public class PropertyController {
|
||||
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());
|
||||
if(null == districtStat.getMom()){
|
||||
if(result.size()>0){
|
||||
Integer avgPrice = (Integer) result.get(result.size() - 1).get("avgPrice");
|
||||
double mom = (districtStat.getAvgPrice() - avgPrice)*100.0/avgPrice;
|
||||
item.put("changePercent", DataUtil.getRound(2, mom));
|
||||
}else{
|
||||
item.put("changePercent", 0);
|
||||
}
|
||||
}else{
|
||||
item.put("changePercent", BigDecimal.valueOf(districtStat.getMom() * 100)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
}
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
@@ -2608,7 +2639,7 @@ public class PropertyController {
|
||||
item.put("city", sqmetreRent.getCity());
|
||||
item.put("district", sqmetreRent.getRegion());
|
||||
item.put("name", sqmetreRent.getDistrictName());
|
||||
item.put("rent", sqmetreRent.getAvgPrice().intValue());
|
||||
item.put("rent", DataUtil.roundDouble(sqmetreRent.getAvgPrice().doubleValue()/30.0, 2));
|
||||
item.put("date", DateUtil.formatByPattern(sqmetreRent.getWeekend(), "yyyy-MM"));
|
||||
result.add(item);
|
||||
}
|
||||
@@ -6004,6 +6035,512 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object sellCaseAction(PropertyEvaluationModel model, HttpServletRequest request){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getCity())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String estateType = null;
|
||||
if(StringUtils.isNotBlank(model.getPropertyType())){
|
||||
if(model.getPropertyType().equals("0")){
|
||||
estateType = "普通住宅";
|
||||
}else if(model.getPropertyType().equals("1")){
|
||||
estateType = "别墅";
|
||||
}else if(model.getPropertyType().equals("2")){
|
||||
estateType = "商住";
|
||||
}
|
||||
}
|
||||
|
||||
District district = null;
|
||||
|
||||
if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())){
|
||||
if(StringUtils.isNotBlank(model.getEstateType()) && model.getEstateType().equals("别墅") && !model.getName().contains("别墅")){
|
||||
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName()+"别墅","district");
|
||||
}else{
|
||||
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
|
||||
}
|
||||
}
|
||||
|
||||
if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) {
|
||||
JSONObject resultObject = null;
|
||||
if(StringUtils.isNotBlank(model.getAddress())){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "property", false);
|
||||
}else if(StringUtils.isNotBlank(model.getName())){
|
||||
if(estateType !=null && estateType.equals("别墅") && !model.getName().contains("别墅")){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName()+"别墅", "property", false);
|
||||
}else{
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "property", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(resultObject != null){
|
||||
String id = (String) resultObject.get("id");
|
||||
district = districtService.findById(id);
|
||||
}
|
||||
}
|
||||
if(district == null && StringUtils.isBlank(model.getLocation())){
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
String startDate = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -3),"yyyyMMdd");
|
||||
String endDate = DateUtil.formatByPattern(new Date(), "yyyyMMdd");
|
||||
|
||||
List<HouseCaseDto> caseDtos = new ArrayList<HouseCaseDto>();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
if (model.getPageSize() != null) {
|
||||
pager.setPageSize(model.getPageSize());
|
||||
// if(model.getPageSize() <=50){
|
||||
// pager.setPageSize(model.getPageSize());
|
||||
// }else{
|
||||
// pager.setPageSize(50);
|
||||
// }
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
}
|
||||
|
||||
// 默认1公里内
|
||||
if (model.getRadius() == null) {
|
||||
model.setRadius(1000);
|
||||
}
|
||||
|
||||
|
||||
if(district != null){
|
||||
if(model.getMinPrice() == null){
|
||||
DistrictSellStat districtSellStat = districtSellStatService.findFirstByParams(district.getCity(), district.getRegion(), district.getName());
|
||||
if(districtSellStat != null) {
|
||||
int minPrice = (int) (districtSellStat.getAvgPrice() - districtSellStat.getAvgPrice() * 0.1);
|
||||
model.setMinPrice(minPrice);
|
||||
|
||||
int maxPrice = (int) (districtSellStat.getAvgPrice() + districtSellStat.getAvgPrice() * 0.1);
|
||||
model.setMaxPrice(maxPrice);
|
||||
}
|
||||
}else{
|
||||
if(model.getMinPrice() != null && model.getMinPrice()>0){
|
||||
model.setMinPrice(model.getMinPrice());
|
||||
}
|
||||
if(model.getMaxPrice() != null && model.getMaxPrice()>0){
|
||||
model.setMaxPrice(model.getMaxPrice());
|
||||
}
|
||||
}
|
||||
//先查成交案例
|
||||
Date startTime = DateUtil.parseDate(startDate,"yyyyMMdd");
|
||||
Date endTime = DateUtil.parseDate(endDate,"yyyyMMdd");
|
||||
List<DealPrice> dealPrices = dealPriceService.findDealPrices(district.getId(), pager.getPageSize(), model.getMinPrice(), model.getMaxPrice(), startTime, endTime);
|
||||
|
||||
if(dealPrices!=null && dealPrices.size()>0){
|
||||
caseDtos = createDealHouseCase(caseDtos, dealPrices, 0, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
if(caseDtos.size() < pager.getPageSize()){
|
||||
//查自身样本
|
||||
List<Seawater> houseSelf = houseService.findSelfHouseByParams(district, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
if(caseDtos.size() < pager.getPageSize() && StringUtils.isNotBlank(estateType) && district.getName().contains("别墅")){
|
||||
District newDist = new District();
|
||||
newDist.setCity(district.getCity());
|
||||
newDist.setRegion(district.getRegion());
|
||||
newDist.setName(district.getName().replace("别墅",""));
|
||||
newDist.setEstateType2(estateType);
|
||||
houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
}
|
||||
//有物业类型且自身样本数据不足,忽略物业类型查
|
||||
if(caseDtos.size() ==0 && StringUtils.isNotBlank(estateType)){
|
||||
District newDist = new District();
|
||||
newDist.setCity(district.getCity());
|
||||
newDist.setRegion(district.getRegion());
|
||||
newDist.setName(district.getName().replace("别墅",""));
|
||||
newDist.setEstateType2(estateType);
|
||||
houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), null, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//自身样本不足,查周边成交
|
||||
List<District> districts = districtService.findNearestDistrict(district, 1000, 20);
|
||||
if(districts!=null && districts.size()>0){
|
||||
for(District d : districts){
|
||||
if(!district.getId().equals(d.getId())){
|
||||
dealPrices = dealPriceService.findDealPrices(d.getId(), pager.getPageSize(), model.getMinPrice(), model.getMaxPrice(), DateUtil.parseDate(startDate,"yyyyMMdd"), DateUtil.parseDate(endDate,"yyyyMMdd"));
|
||||
if(dealPrices!=null && dealPrices.size()>0 && d.getLng()!=null && d.getLng()>0){
|
||||
double distance = GeoUtils.calculateDistance(district.getLng()/10000000000.0, district.getLat()/10000000000.0, d.getLng()/10000000000.0, d.getLat()/10000000000.0);
|
||||
caseDtos = createDealHouseCase(caseDtos, dealPrices, (int)distance, model.getShowSource());
|
||||
if(caseDtos.size()>pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//自身成交,自身样本,周边成交不足,查周边挂牌
|
||||
List<Seawater> houseAround = null;
|
||||
if (caseDtos.size() < pager.getPageSize() ) {
|
||||
Double lng = null;
|
||||
Double lat = null;
|
||||
if(district!=null && district.getLat()!=null && district.getLat()>0){
|
||||
lng = district.getLng()/10000000000.0;
|
||||
lat = district.getLat()/10000000000.0;
|
||||
if(estateType == null ){
|
||||
estateType = district.getEstateType2();
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(model.getLocation())){
|
||||
String[] locationStr = model.getLocation().split(",");
|
||||
String numberPattern = "-?\\d+(\\.\\d+)?"; // 匹配整数或浮点数
|
||||
for (String loc : locationStr) {
|
||||
if (!loc.trim().matches(numberPattern)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("location(经纬度)格式错误"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
lng = Double.valueOf(locationStr[0]);
|
||||
lat = Double.valueOf(locationStr[1]);
|
||||
if (lng < 70 || lng > 140 || lat < 0 || lat > 55) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
if(lat !=null && lat>0){
|
||||
houseAround = houseService.findArroundHouseByParams("sell", lng, lat, Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager, model.getRadius());
|
||||
}
|
||||
if(houseAround != null && houseAround.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseAround, model.getShowSource());
|
||||
}
|
||||
}
|
||||
if(caseDtos.size()>pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object rentCaseAction(PropertyEvaluationModel model, HttpServletRequest request){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getCity())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
District district = null;
|
||||
String estateType = null;
|
||||
if(StringUtils.isNotBlank(model.getPropertyType())){
|
||||
if(model.getPropertyType().equals("0")){
|
||||
estateType = "普通住宅";
|
||||
}else if(model.getPropertyType().equals("1")){
|
||||
estateType = "别墅";
|
||||
}else if(model.getPropertyType().equals("2")){
|
||||
estateType = "商住";
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())){
|
||||
district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
|
||||
}
|
||||
|
||||
if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) {
|
||||
JSONObject resultObject = null;
|
||||
if(StringUtils.isNotBlank(model.getAddress())){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "property", false);
|
||||
}else if(StringUtils.isNotBlank(model.getName())){
|
||||
if(estateType !=null && estateType.equals("别墅") && !model.getName().contains("别墅")){
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName()+"别墅", "property", false);
|
||||
}else{
|
||||
resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "property", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(resultObject != null){
|
||||
String id = (String) resultObject.get("id");
|
||||
district = districtService.findById(id);
|
||||
}
|
||||
}
|
||||
if(district == null && StringUtils.isBlank(model.getLocation())){
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String startDate = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -6),"yyyyMMdd");
|
||||
String endDate = DateUtil.formatByPattern(new Date(), "yyyyMMdd");
|
||||
|
||||
List<HouseCaseDto> caseDtos = new ArrayList<HouseCaseDto>();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
if (model.getPageSize() != null) {
|
||||
// pager.setPageSize(model.getPageSize());
|
||||
if(model.getPageSize() <=50){
|
||||
pager.setPageSize(model.getPageSize());
|
||||
}else{
|
||||
pager.setPageSize(50);
|
||||
}
|
||||
} else {
|
||||
pager.setPageSize(5);
|
||||
}
|
||||
|
||||
// 默认1公里内
|
||||
if (model.getRadius() == null) {
|
||||
model.setRadius(1000);
|
||||
}
|
||||
|
||||
|
||||
if(district != null){
|
||||
if(model.getMinPrice() == null){
|
||||
SqmetreRent rent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), "district");
|
||||
|
||||
if(rent != null) {
|
||||
int minPrice = (int) (rent.getAvgPrice().intValue() - rent.getAvgPrice().intValue() * 0.1);
|
||||
model.setMinPrice(minPrice);
|
||||
|
||||
int maxPrice = (int) (rent.getAvgPrice().intValue() + rent.getAvgPrice().intValue() * 0.1);
|
||||
model.setMaxPrice(maxPrice);
|
||||
}
|
||||
}else{
|
||||
if(model.getMinPrice() != null && model.getMinPrice()>0){
|
||||
model.setMinPrice(model.getMinPrice());
|
||||
}
|
||||
if(model.getMaxPrice() != null && model.getMaxPrice()>0){
|
||||
model.setMaxPrice(model.getMaxPrice());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(caseDtos.size() < pager.getPageSize()){
|
||||
//查自身样本
|
||||
List<Seawater> houseSelf = houseService.findSelfHouseByParams(district, "rent", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
if(caseDtos.size() < pager.getPageSize() && StringUtils.isNotBlank(estateType) && district.getName().contains("别墅")){
|
||||
District newDist = new District();
|
||||
newDist.setCity(district.getCity());
|
||||
newDist.setRegion(district.getRegion());
|
||||
newDist.setName(district.getName().replace("别墅",""));
|
||||
newDist.setEstateType2(estateType);
|
||||
houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//有物业类型且自身样本数据不足,忽略物业类型查
|
||||
if(caseDtos.size() ==0 && StringUtils.isNotBlank(estateType)){
|
||||
District newDist = new District();
|
||||
newDist.setCity(district.getCity());
|
||||
newDist.setRegion(district.getRegion());
|
||||
newDist.setName(district.getName().replace("别墅",""));
|
||||
newDist.setEstateType2(estateType);
|
||||
houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), null, pager);
|
||||
if(houseSelf!=null && houseSelf.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource());
|
||||
if(caseDtos.size() == pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//自身样本不足,查周边挂牌
|
||||
List<Seawater> houseAround = null;
|
||||
if (caseDtos.size() < pager.getPageSize() ) {
|
||||
Double lng = null;
|
||||
Double lat = null;
|
||||
if(district!=null && district.getLat()!=null && district.getLat()>0){
|
||||
lng = district.getLng()/10000000000.0;
|
||||
lat = district.getLat()/10000000000.0;
|
||||
if(estateType == null ){
|
||||
estateType = district.getEstateType2();
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(model.getLocation())){
|
||||
String[] locationStr = model.getLocation().split(",");
|
||||
String numberPattern = "-?\\d+(\\.\\d+)?"; // 匹配整数或浮点数
|
||||
for (String loc : locationStr) {
|
||||
if (!loc.trim().matches(numberPattern)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("location(经纬度)格式错误"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
lng = Double.valueOf(locationStr[0]);
|
||||
lat = Double.valueOf(locationStr[1]);
|
||||
if (lng < 70 || lng > 140 || lat < 0 || lat > 55) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
if(lat !=null && lat>0){
|
||||
houseAround = houseService.findArroundHouseByParams("rent", lng, lat, Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager, model.getRadius());
|
||||
}
|
||||
if(houseAround != null && houseAround.size()>0){
|
||||
caseDtos = createHouseCase(caseDtos, houseAround, model.getShowSource());
|
||||
}
|
||||
}
|
||||
if(caseDtos.size()>pager.getPageSize()){
|
||||
caseDtos = caseDtos.subList(0, caseDtos.size()-1);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(caseDtos));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<HouseCaseDto> createDealHouseCase(List<HouseCaseDto> caseDtos, List<DealPrice> dealPrices,int distance, Integer showSource){
|
||||
if(dealPrices!=null && dealPrices.size()>0){
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for(HouseCaseDto dto : caseDtos){
|
||||
ids.add(dto.getId());
|
||||
}
|
||||
for(DealPrice dp : dealPrices){
|
||||
if(!ids.contains(dp.getId())){
|
||||
HouseCaseDto dto = new HouseCaseDto();
|
||||
dto.setId(dp.getId());
|
||||
dto.setCity(dp.getCity());
|
||||
dto.setDistrict(dp.getRegion());
|
||||
dto.setName(dp.getDistrictName());
|
||||
dto.setSize(dp.getArea());
|
||||
dto.setDistance(distance);
|
||||
dto.setUnitPrice(dp.getAvgPrice());
|
||||
dto.setTotalPrice(dp.getTotalPrice());
|
||||
dto.setDecoration(dp.getFitment());
|
||||
dto.setDirection(dp.getDirection());
|
||||
dto.setFloor(dp.getFloor());
|
||||
dto.setMaxFloor(dp.getHeight());
|
||||
dto.setRoom(String.valueOf(dp.getRoom()));
|
||||
dto.setHall(String.valueOf(dp.getHall()));
|
||||
dto.setCaseDate(DateUtil.formatByPattern(dp.getTradeDate(), "yyyy-MM-dd"));
|
||||
if(showSource!=null && showSource==1){
|
||||
dto.setSource("成交");
|
||||
}
|
||||
caseDtos.add(dto);
|
||||
}
|
||||
}
|
||||
return caseDtos;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private List<HouseCaseDto> createHouseCase(List<HouseCaseDto> caseDtos, List<Seawater> houses, Integer showSource){
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for(HouseCaseDto dto : caseDtos){
|
||||
ids.add(dto.getId());
|
||||
}
|
||||
for (Seawater house : houses) {
|
||||
if(!ids.contains(house.getId())){
|
||||
HouseCaseDto caseDto = new HouseCaseDto();
|
||||
caseDto.setId(house.getId());
|
||||
caseDto.setCity(house.getCity());
|
||||
caseDto.setDistrict(house.getRegion());
|
||||
caseDto.setName(house.getDistrictName());
|
||||
caseDto.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea());
|
||||
caseDto.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
|
||||
caseDto.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice());
|
||||
caseDto.setDirection(house.getDirection());
|
||||
caseDto.setDecoration(house.getFitment());
|
||||
caseDto.setFloor(house.getFloor() == null || house.getFloor() == 0 ? null : house.getFloor());
|
||||
caseDto.setMaxFloor(house.getHeight() == null || house.getHeight() == 0 ? null : house.getHeight());
|
||||
caseDto.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom().toString());
|
||||
caseDto.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall().toString());
|
||||
|
||||
if (house.getpDate() != null && house.getpDate() > 10000000) {
|
||||
String numberStr = String.valueOf(house.getpDate());
|
||||
// 拆分字符串并格式化
|
||||
String year = numberStr.substring(0, 4); // 前四位是年份
|
||||
String month = numberStr.substring(4, 6); // 中间两位是月份
|
||||
String day = numberStr.substring(6, 8); // 最后两位是日期
|
||||
String formattedDate = year + "-" + month + "-" + day;
|
||||
caseDto.setCaseDate(formattedDate);
|
||||
}
|
||||
caseDto.setDistance(house.getDistance());
|
||||
if(showSource!=null && showSource==1){
|
||||
caseDto.setSource("挂牌");
|
||||
}
|
||||
caseDtos.add(caseDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return caseDtos;
|
||||
}
|
||||
|
||||
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
|
||||
this.houseLoudongService = houseLoudongService;
|
||||
|
||||
+6
-4
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.mongo.model.SqmetreRent;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
@@ -92,7 +93,7 @@ public class SqmetreRentController {
|
||||
|
||||
// 设置返回结果,防止 subList 越界
|
||||
if (result.size() > 1) {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size())));
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||
}
|
||||
@@ -166,7 +167,7 @@ public class SqmetreRentController {
|
||||
|
||||
// 设置返回结果,防止 subList 越界
|
||||
if (result.size() > 1) {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size())));
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||
}
|
||||
@@ -232,7 +233,8 @@ public class SqmetreRentController {
|
||||
item.put("district", sqmetreRent.getRegion());
|
||||
item.put("name", sqmetreRent.getDistrictName());
|
||||
Integer currentRent = (sqmetreRent.getAvgPrice() != null) ? sqmetreRent.getAvgPrice().intValue() : 0;
|
||||
item.put("rent", currentRent);
|
||||
Double dayRentPrice = currentRent/30.0;
|
||||
item.put("rent", DataUtil.getRound(2, dayRentPrice));
|
||||
item.put("date", sqmetreRent.getWeekend() != null ? DateUtil.formatByPattern(sqmetreRent.getWeekend(), "yyyy-MM") : "未知日期");
|
||||
|
||||
// 计算月涨幅
|
||||
@@ -249,7 +251,7 @@ public class SqmetreRentController {
|
||||
}
|
||||
|
||||
// 设置返回结果,防止 subList 越界
|
||||
if (result.size() > 1) {
|
||||
if (result.size() > 0) {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size())));
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(null));
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.fangjia.open.dto;
|
||||
|
||||
public class HouseCaseDto {
|
||||
|
||||
private String id;//房源id
|
||||
private String city;//城市
|
||||
private String district;//区域
|
||||
private String name;//楼盘名称
|
||||
private Integer distance;//距离(单位:米)
|
||||
private Double size;//面积(单位:平米)
|
||||
private Integer unitPrice;//单价(单位:元/平米)
|
||||
private Integer totalPrice;//总价(单位:元)
|
||||
private String decoration;//装修(如:精装)
|
||||
private String direction;//朝向(如:南)
|
||||
private Integer floor;//所在楼层
|
||||
private Integer maxFloor;//总楼层
|
||||
private String room;//室
|
||||
private String hall;//厅
|
||||
private String caseDate;//案例时间(如: 2013-07-12)
|
||||
private String source;//来源
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 Integer getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(Integer distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public Double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getUnitPrice() {
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(Integer unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
public Integer getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(Integer totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public String getDecoration() {
|
||||
return decoration;
|
||||
}
|
||||
|
||||
public void setDecoration(String decoration) {
|
||||
this.decoration = decoration;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
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 String getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(String room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public String getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(String hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public String getCaseDate() {
|
||||
return caseDate;
|
||||
}
|
||||
|
||||
public void setCaseDate(String caseDate) {
|
||||
this.caseDate = caseDate;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.open.interceptors;
|
||||
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.JsonUtils;
|
||||
import com.fangjia.dal.mongo.open.model.OpenResource;
|
||||
import com.fangjia.dal.mongo.tool.model.OpenUriLog;
|
||||
import com.fangjia.dal.sql.model.ApiUser;
|
||||
@@ -12,6 +13,8 @@ import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.service.open.OpenResourceService;
|
||||
import com.fangjia.service.open.OpenUriLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import net.sf.json.JSONNull;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
import net.sf.json.processors.JsonValueProcessor;
|
||||
@@ -22,17 +25,13 @@ import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.ActionInvocation;
|
||||
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;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
|
||||
/**
|
||||
* API审计日志监控器
|
||||
*
|
||||
@@ -116,7 +115,6 @@ public class AuditInterceptor implements Interceptor {
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* @param apiUser
|
||||
@@ -163,7 +161,7 @@ public class AuditInterceptor implements Interceptor {
|
||||
if(isSaveResult(request)){
|
||||
JSONObject json = JSONObject.fromObject(result, DEFAULT_JSON_CONFIG);
|
||||
json.remove("tid");
|
||||
openUriLog.setResMap(json);
|
||||
openUriLog.setResMap((Map<String, Object>)JsonUtils.convertJsonToJavaObj(json, Map.class));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("", e);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CommercialModel extends FangjiaApiModel{
|
||||
private Integer maxFloor;//总楼层
|
||||
|
||||
private Integer passengerFlow;//客流量---0:高 1:中 2:低
|
||||
private Integer LeaseStability;//租约稳定性---0:持续稳定出租 1:阶段性出租 2:偶尔出租 3:未出租
|
||||
private Integer leaseStability;//租约稳定性---0:持续稳定出租 1:阶段性出租 2:偶尔出租 3:未出租
|
||||
private Integer sellType;//出售/转让---0:出售 1:转让
|
||||
private Integer decorationCost;//装修成本(单位:万元)
|
||||
private Integer decorationYear;//装修年限(单位:年)
|
||||
@@ -72,11 +72,11 @@ public class CommercialModel extends FangjiaApiModel{
|
||||
}
|
||||
|
||||
public Integer getLeaseStability() {
|
||||
return LeaseStability;
|
||||
return leaseStability;
|
||||
}
|
||||
|
||||
public void setLeaseStability(Integer leaseStability) {
|
||||
LeaseStability = leaseStability;
|
||||
leaseStability = leaseStability;
|
||||
}
|
||||
|
||||
public Integer getSellType() {
|
||||
|
||||
+65
@@ -296,6 +296,39 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
|
||||
private String sampleIds;
|
||||
|
||||
private Integer max;
|
||||
|
||||
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 显示来源
|
||||
*/
|
||||
private Integer showSource;
|
||||
|
||||
/**
|
||||
* 显示房源 1:显示 0:默认 不显示
|
||||
*/
|
||||
private Integer show;
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Integer getShowSource() {
|
||||
return showSource;
|
||||
}
|
||||
|
||||
public void setShowSource(Integer showSource) {
|
||||
this.showSource = showSource;
|
||||
}
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
}
|
||||
@@ -962,4 +995,36 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
public String getSampleIds() {
|
||||
return sampleIds;
|
||||
}
|
||||
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Integer getShow() {
|
||||
return show;
|
||||
}
|
||||
|
||||
public void setShow(Integer show) {
|
||||
this.show = show;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,5 +49,11 @@
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
<rule controller="officeSell" action="evaluateSell" channel="office">
|
||||
<ladders>
|
||||
<ladder>/evaluateSell</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
</rules>
|
||||
</urlrewrite>
|
||||
Reference in New Issue
Block a user