Merge remote-tracking branch 'origin/script_gj' into script_gj
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import com.hankcs.hanlp.HanLP;
|
||||
import com.hankcs.hanlp.dictionary.py.Pinyin;
|
||||
import com.sun.javafx.scene.transform.TransformUtils;
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONNull;
|
||||
@@ -1824,11 +1825,26 @@ public class DataUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getFirstChar("文裕花园"));
|
||||
System.out.println(getFirstChar("文怡花园"));
|
||||
public static boolean isChineseChar(String c) {
|
||||
if (StringUtils.isNotBlank(c)) {
|
||||
String temp = String.valueOf(c);
|
||||
Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5\\w]+");
|
||||
Matcher matcher = pattern.matcher(temp);
|
||||
return matcher.matches();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.println(FourUpSixInto("258.393", 2));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(isChineseChar("6文怡a花园"));
|
||||
// System.out.println(getFirstChar("文怡花园"));
|
||||
//
|
||||
// System.out.println(FourUpSixInto("258.393", 2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.fangjia.core.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SeaweedUtils {
|
||||
public static void main(String[] args){
|
||||
System.out.println(formatVirescencePercent("1"));
|
||||
}
|
||||
/**
|
||||
* 标准化输出绿化率
|
||||
*/
|
||||
public static String formatVirescencePercent(String virescence_percent) {
|
||||
// 绿化率
|
||||
if (StringUtils.isNotBlank(virescence_percent) && checkValue(virescence_percent)!=null) {
|
||||
double val = Double.valueOf(virescence_percent);
|
||||
if (val < 1) {
|
||||
return String.valueOf(val * 100);
|
||||
}
|
||||
if (val == 1) {
|
||||
return String.valueOf(val * 10);
|
||||
}
|
||||
if (val >= 70) {
|
||||
return "65";
|
||||
}
|
||||
return String.valueOf(val);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化容积率输出
|
||||
*/
|
||||
public static String formatCubagePercent(String cubage_percent) {
|
||||
if (StringUtils.isNotBlank(cubage_percent) && checkValue(cubage_percent)!=null) {
|
||||
double val = Double.valueOf(cubage_percent);
|
||||
if (val >= 7 && val < 8) {
|
||||
return "6.2";
|
||||
}
|
||||
if (val >= 8 && val < 9) {
|
||||
return "6.3";
|
||||
}
|
||||
if (val >= 9 && val < 10) {
|
||||
return "6.5";
|
||||
}
|
||||
if (val >= 10) {
|
||||
return "6.7";
|
||||
}
|
||||
return String.valueOf(val);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化车位输出
|
||||
*/
|
||||
public static String formatCarSiteCount(String car_site_count) {
|
||||
if (StringUtils.isNotBlank(car_site_count) && checkValue(car_site_count)!=null) {
|
||||
long val = Long.valueOf(car_site_count);
|
||||
if (val > 2500 || val < 100) {
|
||||
return "";
|
||||
}
|
||||
return String.valueOf(val);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化户数输出
|
||||
*/
|
||||
public static String formatHouseholdCount(String household_count) {
|
||||
if (StringUtils.isNotBlank(household_count) && checkValue(household_count)!=null ) {
|
||||
if (Integer.valueOf(household_count) < 50) {
|
||||
return null; // 户数
|
||||
}
|
||||
return household_count;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化总占地面积输出
|
||||
*/
|
||||
public static String formatAllArea(String all_area) {
|
||||
if (StringUtils.isNotBlank(all_area)) {
|
||||
Double formattedVal = 0.0;
|
||||
if (all_area.toString().indexOf("公顷") != -1) {
|
||||
String val = all_area.toString();
|
||||
formattedVal = (Double.valueOf(val.substring(0, val.indexOf("公顷"))) * 10000);
|
||||
} else if(checkValue(all_area)!=null) {
|
||||
formattedVal = Double.valueOf(all_area);
|
||||
}
|
||||
if (formattedVal > 100000 || formattedVal == 0.0) {
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(formattedVal);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取浮点数与整数
|
||||
*/
|
||||
static String getNumber(String input) {
|
||||
Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?");
|
||||
Matcher matcher = pattern.matcher(input);
|
||||
List<String> list = new ArrayList();
|
||||
while (matcher.find()) {
|
||||
list.add(matcher.group());
|
||||
}
|
||||
if(list.size()>0){
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static Float checkValue(String value){
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
value = getNumber(value);
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
value = subZeroAndDot(value);
|
||||
if(isNumber(value)){
|
||||
Float v = Float.parseFloat(value);
|
||||
if(v>0){
|
||||
return v;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}else if(isFloat(value)){
|
||||
Float v = Float.parseFloat(value);
|
||||
if(v>0){
|
||||
return v;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
} else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static boolean isNumber(String str){
|
||||
try {
|
||||
Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean isFloat(String str){
|
||||
try {
|
||||
Float.parseFloat(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 正则表达式去掉多余的.与0
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
static String subZeroAndDot(String v){
|
||||
|
||||
if(StringUtils.isNotBlank(v)){
|
||||
if(v.indexOf(".")!=-1){
|
||||
Double myNum2 = Double.valueOf(v);
|
||||
BigDecimal b = new java.math.BigDecimal(myNum2);
|
||||
Double myNum3 = b.setScale(2, java.math.BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
v = myNum3.toString();
|
||||
}
|
||||
|
||||
if(v.indexOf(".")>-1){
|
||||
while(true)
|
||||
{
|
||||
if(v.endsWith("0")){
|
||||
v = v.substring(0,v.length()-1);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(v.endsWith(".")){
|
||||
v=v.substring(0,v.length()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
+32
-1
@@ -1,5 +1,9 @@
|
||||
package com.fangjia.coresite.controllers;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -7,6 +11,7 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.fangjia.coresite.model.JsonModel;
|
||||
@@ -37,7 +42,7 @@ public class SaleLeadsController {
|
||||
}
|
||||
|
||||
public Object doAddAction(SaleLeadsModel model, HttpServletRequest req,
|
||||
HttpServletResponse res) {
|
||||
HttpServletResponse res) throws UnsupportedEncodingException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
|
||||
model.setViewType("redirect");
|
||||
String refUrl = model.getBackUrl();
|
||||
@@ -122,6 +127,8 @@ public class SaleLeadsController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
saleLeads = converValue(saleLeads);
|
||||
saleLeadsService.save(saleLeads);
|
||||
|
||||
if(StringUtils.isNotBlank(saleLeads.getBusiness()) && saleLeads.getBusiness().contains("_")){
|
||||
@@ -162,6 +169,30 @@ public class SaleLeadsController {
|
||||
model.setViewParam("location", url);
|
||||
return model;
|
||||
}
|
||||
|
||||
private SaleLeads converValue(SaleLeads saleLeads) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, UnsupportedEncodingException {
|
||||
//
|
||||
Field[] fields = saleLeads.getClass().getDeclaredFields();
|
||||
for(Field s : fields){
|
||||
String name = s.getName();
|
||||
String type = s.getGenericType().toString();
|
||||
if(type.contains("java.lang.String")){
|
||||
String fildName = name.substring(0,1).toUpperCase()+name.substring(1);
|
||||
Method m = saleLeads.getClass().getMethod("get"+fildName);
|
||||
String value = (String)m.invoke(saleLeads);
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
String s1 = value.replaceAll("\\pP|\\pS", "");
|
||||
if(!DataUtil.isChineseChar(s1)){
|
||||
String newValue = new String(value.getBytes("ISO8859-1"), "UTF-8");
|
||||
m = saleLeads.getClass().getMethod("set"+fildName,String.class);
|
||||
m.invoke(saleLeads, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return saleLeads;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Object addDownInfoAction(SaleLeadsModel model, HttpServletRequest req,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
|
||||
public interface BsEvaluationDao extends MongoDao<BsEvaluation> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
|
||||
public class BsEvaluationDaoImpl extends MongoDaoImpl<BsEvaluation> implements
|
||||
BsEvaluationDao {
|
||||
}
|
||||
@@ -99,6 +99,9 @@ public class PaiMai implements MongoEntity {
|
||||
private Integer marketAvgPrice;
|
||||
/**物业类型*/
|
||||
private String matchEstateType;
|
||||
private String houseNum;
|
||||
private String unitNum;
|
||||
private String roomNum;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@@ -488,4 +491,28 @@ public class PaiMai implements MongoEntity {
|
||||
public void setMatchEstateType(String matchEstateType) {
|
||||
this.matchEstateType = matchEstateType;
|
||||
}
|
||||
|
||||
public String getHouseNum() {
|
||||
return houseNum;
|
||||
}
|
||||
|
||||
public void setHouseNum(String houseNum) {
|
||||
this.houseNum = houseNum;
|
||||
}
|
||||
|
||||
public String getUnitNum() {
|
||||
return unitNum;
|
||||
}
|
||||
|
||||
public void setUnitNum(String unitNum) {
|
||||
this.unitNum = unitNum;
|
||||
}
|
||||
|
||||
public String getRoomNum() {
|
||||
return roomNum;
|
||||
}
|
||||
|
||||
public void setRoomNum(String roomNum) {
|
||||
this.roomNum = roomNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name = "business.evaluation")
|
||||
public class BsEvaluation implements MongoEntity {
|
||||
private String id;
|
||||
private String fullAddress;
|
||||
private String commid;
|
||||
private String cityName;
|
||||
private String distName;
|
||||
private String commName;
|
||||
private String address;
|
||||
private Double buildArea;
|
||||
private Integer floor;
|
||||
private Integer floorcnt;
|
||||
private Integer roomcnt;
|
||||
private Integer livingroomcnt;
|
||||
private String houseaspect;//ÄÏ
|
||||
private String fitment;
|
||||
private Date cDate;
|
||||
private Integer unitPrice;
|
||||
private Integer totalPrice;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "full_address")
|
||||
public String getFullAddress() {
|
||||
return fullAddress;
|
||||
}
|
||||
|
||||
public void setFullAddress(String fullAddress) {
|
||||
this.fullAddress = fullAddress;
|
||||
}
|
||||
|
||||
@Column(name = "commid")
|
||||
public String getCommid() {
|
||||
return commid;
|
||||
}
|
||||
|
||||
public void setCommid(String commid) {
|
||||
this.commid = commid;
|
||||
}
|
||||
|
||||
@Column(name = "cityname")
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
@Column(name = "distname")
|
||||
public String getDistName() {
|
||||
return distName;
|
||||
}
|
||||
|
||||
public void setDistName(String distName) {
|
||||
this.distName = distName;
|
||||
}
|
||||
|
||||
@Column(name = "commname")
|
||||
public String getCommName() {
|
||||
return commName;
|
||||
}
|
||||
|
||||
public void setCommName(String commName) {
|
||||
this.commName = commName;
|
||||
}
|
||||
|
||||
@Column(name = "address")
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Column(name = "buildarea")
|
||||
public Double getBuildArea() {
|
||||
return buildArea;
|
||||
}
|
||||
|
||||
public void setBuildArea(Double buildArea) {
|
||||
this.buildArea = buildArea;
|
||||
}
|
||||
|
||||
@Column(name = "floor")
|
||||
public Integer getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(Integer floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
@Column(name = "floorcnt")
|
||||
public Integer getFloorcnt() {
|
||||
return floorcnt;
|
||||
}
|
||||
|
||||
public void setFloorcnt(Integer floorcnt) {
|
||||
this.floorcnt = floorcnt;
|
||||
}
|
||||
|
||||
@Column(name = "roomcnt")
|
||||
public Integer getRoomcnt() {
|
||||
return roomcnt;
|
||||
}
|
||||
|
||||
public void setRoomcnt(Integer roomcnt) {
|
||||
this.roomcnt = roomcnt;
|
||||
}
|
||||
|
||||
@Column(name = "livingroomcnt")
|
||||
public Integer getLivingroomcnt() {
|
||||
return livingroomcnt;
|
||||
}
|
||||
|
||||
public void setLivingroomcnt(Integer livingroomcnt) {
|
||||
this.livingroomcnt = livingroomcnt;
|
||||
}
|
||||
|
||||
@Column(name = "houseaspect")
|
||||
public String getHouseaspect() {
|
||||
return houseaspect;
|
||||
}
|
||||
|
||||
public void setHouseaspect(String houseaspect) {
|
||||
this.houseaspect = houseaspect;
|
||||
}
|
||||
|
||||
@Column(name = "fitment")
|
||||
public String getFitment() {
|
||||
return fitment;
|
||||
}
|
||||
|
||||
public void setFitment(String fitment) {
|
||||
this.fitment = fitment;
|
||||
}
|
||||
|
||||
@Column(name = "c_date")
|
||||
public Date getcDate() {
|
||||
return cDate;
|
||||
}
|
||||
|
||||
public void setcDate(Date cDate) {
|
||||
this.cDate = cDate;
|
||||
}
|
||||
|
||||
@Column(name = "unitprice")
|
||||
public Integer getUnitPrice() {
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(Integer unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
@Column(name = "totalprice")
|
||||
public Integer getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(Integer totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,7 @@ public class DistrictFacilitys implements MongoEntity {
|
||||
private String imgUrl3D;
|
||||
|
||||
private List<String> school;
|
||||
private List<String> keySchool;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@@ -380,4 +381,12 @@ public class DistrictFacilitys implements MongoEntity {
|
||||
this.school = school;
|
||||
}
|
||||
|
||||
@Column(name = "key_school")
|
||||
public List<String> getKeySchool() {
|
||||
return keySchool;
|
||||
}
|
||||
|
||||
public void setKeySchool(List<String> keySchool) {
|
||||
this.keySchool = keySchool;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@ public class DealPrice implements MongoEntity {
|
||||
private Integer floor;//当前楼层
|
||||
private Long score;
|
||||
|
||||
private String matchId;
|
||||
private String matchCity;
|
||||
private String matchRegion;
|
||||
private String matchName;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
@@ -296,4 +301,40 @@ public class DealPrice implements MongoEntity {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Column(name = "match_id")
|
||||
public String getMatchId() {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
public void setMatchId(String matchId) {
|
||||
this.matchId = matchId;
|
||||
}
|
||||
|
||||
@Column(name = "match_city")
|
||||
public String getMatchCity() {
|
||||
return matchCity;
|
||||
}
|
||||
|
||||
public void setMatchCity(String matchCity) {
|
||||
this.matchCity = matchCity;
|
||||
}
|
||||
|
||||
@Column(name = "match_region")
|
||||
public String getMatchRegion() {
|
||||
return matchRegion;
|
||||
}
|
||||
|
||||
public void setMatchRegion(String matchRegion) {
|
||||
this.matchRegion = matchRegion;
|
||||
}
|
||||
|
||||
@Column(name = "match_name")
|
||||
public String getMatchName() {
|
||||
return matchName;
|
||||
}
|
||||
|
||||
public void setMatchName(String matchName) {
|
||||
this.matchName = matchName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,6 +448,7 @@ public class HouseLoudong extends com.fangjia.dal.mongo.model.HouseLoudong{
|
||||
this.openTotalPrice = openTotalPrice;
|
||||
}
|
||||
|
||||
@Column(name = "district_id")
|
||||
public String getDistrictId() {
|
||||
return districtId;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,11 @@ public class Loudong implements MongoEntity {
|
||||
* seaweed中的小区名
|
||||
*/
|
||||
private String nameInSeaweed;
|
||||
|
||||
/**
|
||||
* seaweed中的小区id
|
||||
*/
|
||||
private String idInSeaweed;
|
||||
|
||||
@Column(name = "remark")
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
@@ -402,4 +406,13 @@ public class Loudong implements MongoEntity {
|
||||
public void setNameInSeaweed(String nameInSeaweed) {
|
||||
this.nameInSeaweed = nameInSeaweed;
|
||||
}
|
||||
|
||||
@Column(name = "id_in_seaweed")
|
||||
public String getIdInSeaweed() {
|
||||
return idInSeaweed;
|
||||
}
|
||||
|
||||
public void setIdInSeaweed(String idInSeaweed) {
|
||||
this.idInSeaweed = idInSeaweed;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.open.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
|
||||
public interface CommunityBasePriceDao extends MongoDao<CommunityBasePrice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.open.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.CountDistrictStatBycity;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
|
||||
public interface CommunityPoiDao extends MongoDao<CommunityPoi> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.fangjia.dal.mongo.open.dao.impl;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityBasePriceDao;
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
|
||||
public class CommunityBasePriceDaoImpl extends MongoDaoImpl<CommunityBasePrice> implements CommunityBasePriceDao {
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.fangjia.dal.mongo.open.dao.impl;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.open.dao.ApiVisitCountDao;
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
import com.fangjia.dal.mongo.tool.model.ApiVisitCount;
|
||||
|
||||
public class CommunityPoiDaoImpl extends MongoDaoImpl<CommunityPoi> implements CommunityPoiDao {
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.fangjia.dal.mongo.open.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Ð¡Çø½¨ÐÐÖÃÐŶÈÐÅÏ¢
|
||||
*
|
||||
* @author shenjian@fangjia.com
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "business.community_base_price_gj")
|
||||
public class CommunityBasePrice implements MongoEntity {
|
||||
|
||||
private static final long serialVersionUID = -8010010773207622878L;
|
||||
|
||||
private String id;
|
||||
private String city;
|
||||
private String region;
|
||||
private String name;
|
||||
private Double credit;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@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 = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "credit")
|
||||
public Double getCredit() {
|
||||
return credit;
|
||||
}
|
||||
|
||||
public void setCredit(Double credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.fangjia.dal.mongo.open.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 小区周边配套统计信息
|
||||
*
|
||||
* @author shenjian@fangjia.com
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "fangjia_stat.community_poi_gj")
|
||||
public class CommunityPoi implements MongoEntity {
|
||||
|
||||
private static final long serialVersionUID = -7663644539542318409L;
|
||||
|
||||
private String id;
|
||||
private String city;
|
||||
private String region;
|
||||
private String name;
|
||||
private Integer subway;
|
||||
private Integer traffic;
|
||||
private Integer bank;
|
||||
private Integer primary;
|
||||
private Integer junior;
|
||||
private Integer hospital;
|
||||
/**
|
||||
* 不利设施,丧葬
|
||||
*/
|
||||
private Integer funeral;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@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 = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "subway")
|
||||
public Integer getSubway() {
|
||||
return subway;
|
||||
}
|
||||
|
||||
public void setSubway(Integer subway) {
|
||||
this.subway = subway;
|
||||
}
|
||||
|
||||
@Column(name = "traffic")
|
||||
public Integer getTraffic() {
|
||||
return traffic;
|
||||
}
|
||||
|
||||
public void setTraffic(Integer traffic) {
|
||||
this.traffic = traffic;
|
||||
}
|
||||
|
||||
@Column(name = "bank")
|
||||
public Integer getBank() {
|
||||
return bank;
|
||||
}
|
||||
|
||||
public void setBank(Integer bank) {
|
||||
this.bank = bank;
|
||||
}
|
||||
|
||||
@Column(name = "primary")
|
||||
public Integer getPrimary() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
public void setPrimary(Integer primary) {
|
||||
this.primary = primary;
|
||||
}
|
||||
|
||||
@Column(name = "junior")
|
||||
public Integer getJunior() {
|
||||
return junior;
|
||||
}
|
||||
|
||||
public void setJunior(Integer junior) {
|
||||
this.junior = junior;
|
||||
}
|
||||
|
||||
@Column(name = "hospital")
|
||||
public Integer getHospital() {
|
||||
return hospital;
|
||||
}
|
||||
|
||||
public void setHospital(Integer hospital) {
|
||||
this.hospital = hospital;
|
||||
}
|
||||
|
||||
@Column(name = "funeral")
|
||||
public Integer getFuneral() {
|
||||
return funeral;
|
||||
}
|
||||
|
||||
public void setFuneral(Integer funeral) {
|
||||
this.funeral = funeral;
|
||||
}
|
||||
}
|
||||
+30
-5
@@ -67,6 +67,8 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
must.add(addTerms("district_name", alias));
|
||||
must.add(addMatch("cat", "sell"));
|
||||
must.add(addRange("avg_price", minPrice, maxPrice));
|
||||
must.add(addRangeGte("p_date", 20210501));
|
||||
|
||||
bool.put("must", must);
|
||||
query.put("bool", bool);
|
||||
reqBody.put("query", query);
|
||||
@@ -161,6 +163,16 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
return term;
|
||||
}
|
||||
|
||||
private JSONObject addRangeGte(String name, Number min){
|
||||
JSONObject term = new JSONObject();
|
||||
JSONObject range = new JSONObject();
|
||||
JSONObject rangeValue = new JSONObject();
|
||||
rangeValue.put("gte", min);
|
||||
range.put(name, rangeValue);
|
||||
term.put("range", range);
|
||||
return term;
|
||||
}
|
||||
|
||||
|
||||
private List<Seawater> wrapSeawater(List<JSONObject> jsonList){
|
||||
List<Seawater> seawaterList= new ArrayList<Seawater>();
|
||||
@@ -203,6 +215,11 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
seawater.setFloor(source.getInt("floor"));
|
||||
}catch(Exception e){
|
||||
seawater.setFloor(0);
|
||||
}
|
||||
try{
|
||||
seawater.setFloorInfo(source.getString("floor_info"));
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
if(source.containsKey("fitment")){
|
||||
seawater.setFitment(source.getString("fitment"));
|
||||
@@ -231,6 +248,14 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if(source.containsKey("root")){
|
||||
seawater.setRoot(source.getString("root"));
|
||||
}
|
||||
|
||||
if(source.containsKey("estate_type")){
|
||||
seawater.setEstateType(source.getString("estate_type"));
|
||||
}
|
||||
|
||||
if(source.containsKey("build_type")){
|
||||
seawater.setBuildType(source.getString("build_type"));
|
||||
}
|
||||
seawaterList.add(seawater);
|
||||
}
|
||||
return seawaterList;
|
||||
@@ -379,11 +404,11 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
|
||||
// ²»Õ¹Ê¾É¾³ý
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("status", 0);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put("status", 0);
|
||||
// JSONObject temp = new JSONObject();
|
||||
// temp.put("term", param);
|
||||
// jsonList.add(temp);
|
||||
|
||||
query.put("must", jsonList);
|
||||
q.put("bool", query);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class Seawater implements SeawaterEntity {
|
||||
private Double area;
|
||||
private Integer height;
|
||||
private Integer floor;
|
||||
private String floorInfo;
|
||||
private String fitment;
|
||||
private Integer room;
|
||||
private Integer hall;
|
||||
@@ -58,6 +59,9 @@ public class Seawater implements SeawaterEntity {
|
||||
private String url;
|
||||
private String root;
|
||||
private Integer avgPrice;
|
||||
private String purpose;
|
||||
private String estateType;
|
||||
private String buildType;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
@@ -195,6 +199,15 @@ public class Seawater implements SeawaterEntity {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
@Column(name = "floorInfo")
|
||||
public String getFloorInfo() {
|
||||
return floorInfo;
|
||||
}
|
||||
|
||||
public void setFloorInfo(String floorInfo) {
|
||||
this.floorInfo = floorInfo;
|
||||
}
|
||||
|
||||
@Column(name = "fitment")
|
||||
public String getFitment() {
|
||||
return fitment;
|
||||
@@ -285,4 +298,31 @@ public class Seawater implements SeawaterEntity {
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
@Column(name = "purpose")
|
||||
public String getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
|
||||
public void setPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
@Column(name = "estate_type")
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
|
||||
@Column(name = "build_type")
|
||||
public String getBuildType() {
|
||||
return buildType;
|
||||
}
|
||||
|
||||
public void setBuildType(String buildType) {
|
||||
this.buildType = buildType;
|
||||
}
|
||||
}
|
||||
|
||||
+48
-3
@@ -1797,6 +1797,51 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 五级行政区划V2地址标准化接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object fiveDivisionStructure2Action(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() : CONFIG.getDefaultCity());
|
||||
params.put("address", model.getAddress());
|
||||
// 地址验证无效也输出标准化结果
|
||||
params.put("flag", "true");
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
|
||||
} catch(Exception ex){
|
||||
ex.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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细地址标准化接口
|
||||
*
|
||||
@@ -1847,7 +1892,7 @@ public class AddressController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object structureForTestAction(AddesssMatchModel model) {
|
||||
public Object structureAndCompleteAction(AddesssMatchModel model) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress())) {
|
||||
@@ -1863,10 +1908,10 @@ public class AddressController {
|
||||
// 地址验证无效也输出标准化结果
|
||||
params.put("flag", "true");
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureForTest", params, "UTF-8");
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureForTest", params, "UTF-8");
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
|
||||
} catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
+78
-2
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
@@ -14,6 +15,7 @@ import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.service.fsh.DistrictNewPriceService;
|
||||
import com.fangjia.service.open.PaiMaiService;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
@@ -23,13 +25,14 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* ·¨ÅÄÊý¾ÝÌṩ½Ó¿Ú
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
//@Authority(role = Role.USER)
|
||||
public class AuctionController {
|
||||
|
||||
|
||||
private PaiMaiService paiMaiService;
|
||||
private DistrictNewPriceService districtNewPriceService;
|
||||
private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType"};
|
||||
private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url",
|
||||
"matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice"};
|
||||
|
||||
public Object housesAction(AuctionModel model){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -187,6 +190,79 @@ public class AuctionController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object searchPaimaisAction(AuctionModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
params.add(new QueryParam("matchCity", model.getCity()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(model.getDistrict())){
|
||||
params.add(new QueryParam("matchRegion", model.getDistrict()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(model.getName())){
|
||||
params.add(new QueryParam("matchName", model.getName()));
|
||||
}
|
||||
|
||||
Date startDate = null;
|
||||
if(StringUtils.isNotBlank(model.getStartDate())){
|
||||
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
|
||||
if(startDate != null){
|
||||
params.add(new QueryParam("startDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
}
|
||||
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("startDate", false));
|
||||
List<PaiMai> paimais = paiMaiService.findAll(params, sortParams, model.getLimit(), SEARCH_FIELDS);
|
||||
if(paimais!=null && paimais.size()>0){
|
||||
for(PaiMai paiMai : paimais){
|
||||
Map<String, Object> map = standard(paiMai.getCity(), paiMai.getAddress());
|
||||
if(map!=null){
|
||||
if (map.containsKey("buildingNumber")) {
|
||||
paiMai.setHouseNum((String) map.get("buildingNumber"));
|
||||
}
|
||||
if (map.containsKey("unitNumber")) {
|
||||
paiMai.setUnitNum((String) map.get("unitNumber"));
|
||||
}
|
||||
if (map.containsKey("roomNumber")) {
|
||||
paiMai.setRoomNum((String) map.get("roomNumber"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(paimais));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
private Map standard(String city, String address){
|
||||
HttpRequest request = new HttpRequest();
|
||||
JSONObject json = null;
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", city);
|
||||
params.put("address", address);
|
||||
try{
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
|
||||
} catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
int code = json.getInt("status");
|
||||
String msg = json.getString("msg");
|
||||
if(json.containsKey("result")){
|
||||
return (Map)json.get("result");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPaiMaiService(PaiMaiService paiMaiService) {
|
||||
this.paiMaiService = paiMaiService;
|
||||
}
|
||||
|
||||
+38
@@ -15,8 +15,10 @@ import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.model.Metro;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
@@ -211,6 +213,42 @@ public class DealPriceController {
|
||||
mv.setModel(resMap);
|
||||
return mv;
|
||||
}
|
||||
|
||||
public Object searchListAction(final DealPriceModel model) {
|
||||
RestfulModelAndView mv = new RestfulModelAndView();
|
||||
mv.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getId())) {
|
||||
mv.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "楼盘编号不能为空"));
|
||||
return mv;
|
||||
}
|
||||
District district = districtService.findDistrictById(model.getId());
|
||||
DistrictKey districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
|
||||
|
||||
if(district == null){
|
||||
mv.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mv;
|
||||
}
|
||||
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
|
||||
Integer minPrice = null;
|
||||
Integer maxPrice = null;
|
||||
if(bo.getDistrictStat()!=null){
|
||||
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8);
|
||||
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2);
|
||||
}
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
if(StringUtils.isNotBlank(model.getStartDate())){
|
||||
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
|
||||
}
|
||||
if(StringUtils.isNotBlank(model.getEndDate())){
|
||||
endDate = DateUtil.parseDate(model.getEndDate(),"yyyyMMdd");
|
||||
}
|
||||
|
||||
List<DealPrice> dealPrices = dealPriceService.getNearlySameDealPrice(model.getId(), minPrice, maxPrice, startDate, endDate, model.getLimit());
|
||||
mv.setModel(BasicModel.buildOKModel().setResult(dealPrices));
|
||||
return mv;
|
||||
}
|
||||
|
||||
private List<DealPrice> findDealPricesByName(String city,String region ,String name){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
+37
-16
@@ -7,11 +7,11 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStatRent;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.open.model.AvgPriceQueryModel;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
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;
|
||||
@@ -38,8 +38,6 @@ import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.DistrictHouse;
|
||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
||||
import com.fangjia.dal.mongo.model.bkoff.ExtractDistrict;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.dal.sql.model.ApiUser;
|
||||
@@ -93,6 +91,7 @@ public class DistrictController {
|
||||
private RegionBlockService regionBlockService;
|
||||
private RegionStatService regionStatService;
|
||||
private RegionStatRentService regionStatRentService;
|
||||
private DistrictFacilitysService districtFacilitysService;
|
||||
|
||||
|
||||
public static final String[] COLUMNS = { "id", "name", "estateType", "buildType", "licence", "buildArea", "allArea",
|
||||
@@ -444,19 +443,19 @@ public class DistrictController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object showAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
|
||||
@Param(name = "name") String name, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
|
||||
return mav;
|
||||
} else {
|
||||
DistrictBo districtBo = districtService.findByFullMode(new DistrictKey(city, region, name));
|
||||
if (null == districtBo) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在,请检查查询条件"));
|
||||
public Object showAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
|
||||
@Param(name = "name") String name, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
|
||||
return mav;
|
||||
}
|
||||
} else {
|
||||
DistrictBo districtBo = districtService.findByFullMode(new DistrictKey(city, region, name));
|
||||
if (null == districtBo) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在,请检查查询条件"));
|
||||
return mav;
|
||||
}
|
||||
districtBo.setStat(this.districtStatService.findDistrictStat(districtBo.getDistrictKey()));
|
||||
// È¥³ýÐ¡ÇøÃèÊöÖеÄhtml±êÇ©
|
||||
districtBo.setDescription(DataUtil.removeSpecialString(districtBo.getDescription()));
|
||||
@@ -1146,6 +1145,25 @@ public class DistrictController {
|
||||
ret.put("RESULT", 200);
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object facilitysAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
|
||||
@Param(name = "name") String name, HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
|
||||
return mav;
|
||||
} else {
|
||||
District districtBo = districtService.findDistrict(new DistrictKey(city, region, name), "district");
|
||||
if (null == districtBo) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(districtBo);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(facilitys));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1230,4 +1248,7 @@ public class DistrictController {
|
||||
this.regionStatRentService = regionStatRentService;
|
||||
}
|
||||
|
||||
public void setDistrictFacilitysService(DistrictFacilitysService districtFacilitysService) {
|
||||
this.districtFacilitysService = districtFacilitysService;
|
||||
}
|
||||
}
|
||||
|
||||
+57
-5
@@ -10,9 +10,14 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DealPrice;
|
||||
import com.fangjia.service.bo.AddrEvaResult;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.fangjia.service.bo.EvaluationBo;
|
||||
import com.fangjia.service.bo.HouseScorer;
|
||||
import com.fangjia.service.datastore.*;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -54,11 +59,6 @@ import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.service.api.AutoCompleteService;
|
||||
import com.fangjia.service.api.KnowbaseService;
|
||||
import com.fangjia.service.common.SellSimilar;
|
||||
import com.fangjia.service.datastore.BusinessEstateService;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.EvaluationReportService;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.sql.ApiUserService;
|
||||
import com.fangjia.service.sql.UserService;
|
||||
import com.fangjia.service.web.AddressService;
|
||||
@@ -94,6 +94,8 @@ public class EvaluationController {
|
||||
private ApiUserService apiUserService;
|
||||
private UserService userService;
|
||||
private AddressService addressService;
|
||||
private DistrictStatService districtStatService;
|
||||
private BsEvaluationService bsEvaluationService;
|
||||
|
||||
private final static String AK = OpenConfig.getConfig().getBaiduAk();
|
||||
public Object lngLatEvaluateAction(EvaluationModel model) {
|
||||
@@ -1005,6 +1007,44 @@ public class EvaluationController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object bsListAction(EvaluationModel model) {
|
||||
RestfulModelAndView mv = new RestfulModelAndView();
|
||||
mv.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getId())) {
|
||||
mv.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "楼盘编号不能为空"));
|
||||
return mv;
|
||||
}
|
||||
District district = districtService.findDistrictById(model.getId());
|
||||
DistrictKey districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
|
||||
|
||||
if(district == null){
|
||||
mv.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mv;
|
||||
}
|
||||
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
|
||||
Integer minPrice = null;
|
||||
Integer maxPrice = null;
|
||||
if(bo.getDistrictStat()!=null){
|
||||
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8);
|
||||
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2);
|
||||
}
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
if(StringUtils.isNotBlank(model.getStartDate())){
|
||||
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
|
||||
}
|
||||
if(StringUtils.isNotBlank(model.getEndDate())){
|
||||
endDate = DateUtil.parseDate(model.getEndDate(),"yyyyMMdd");
|
||||
}
|
||||
|
||||
List<BsEvaluation> dealPrices = bsEvaluationService.getNearlySameEvaluation(model.getId(), minPrice, maxPrice, startDate, endDate, model.getLimit());
|
||||
mv.setModel(BasicModel.buildOKModel().setResult(dealPrices));
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
@@ -1017,6 +1057,18 @@ public class EvaluationController {
|
||||
this.knowbaseService = knowbaseService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDistrictStatService(DistrictStatService districtStatService) {
|
||||
this.districtStatService = districtStatService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setBsEvaluationService(BsEvaluationService bsEvaluationService) {
|
||||
this.bsEvaluationService = bsEvaluationService;
|
||||
}
|
||||
|
||||
public void setAutoCompleteService(AutoCompleteService autoCompleteService) {
|
||||
this.autoCompleteService = autoCompleteService;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.fangjia.dal.mongo.model.DistrictFacilitys;
|
||||
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
|
||||
import com.fangjia.dal.mongo.model.Metro;
|
||||
import com.fangjia.dal.mongo.model.StatsIndex;
|
||||
import com.fangjia.dal.seawater.dao.SeawaterDao;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.dal.sql.model.ApiUser;
|
||||
import com.fangjia.datastore.driver.FacetResult;
|
||||
@@ -29,6 +31,7 @@ import com.fangjia.open.ws.query.CollateralSampleQuery;
|
||||
import com.fangjia.open.ws.query.ShopCollateralSampleQuery;
|
||||
import com.fangjia.service.address.AddressParser;
|
||||
import com.fangjia.service.bo.Collateral;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.fangjia.service.bo.Sample;
|
||||
import com.fangjia.service.bo.ShopSample;
|
||||
import com.fangjia.service.datastore.CzbankSampleService;
|
||||
@@ -39,11 +42,13 @@ import com.fangjia.service.datastore.bean.CollateralSampleQueryBean;
|
||||
import com.fangjia.service.datastore.bean.ShopCollateralSampleQueryBean;
|
||||
import com.fangjia.service.district.DistrictFacilitysService;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.district.SqmetreRentService;
|
||||
import com.fangjia.service.menu.Item;
|
||||
import com.fangjia.service.menu.MenuCategoryEnum;
|
||||
import com.fangjia.service.menu.Value;
|
||||
import com.fangjia.service.mongo.fangjia.DealPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.MetroService;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import com.fangjia.service.mongo.fangjia.StatsIndexService;
|
||||
import com.fangjia.service.open.FangjiaOfficialAreaService;
|
||||
import com.fangjia.service.open.HousePojo;
|
||||
@@ -86,6 +91,9 @@ public class HouseController {
|
||||
private CzbankSampleService czbankSampleService;
|
||||
private DistrictService districtService;
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
|
||||
private SeawaterService seawaterService;
|
||||
private SeawaterDao seawaterDao;
|
||||
private List<String> PROPERTY_TYPE_CODE_LIST = Arrays.asList("01", "02");
|
||||
|
||||
|
||||
@@ -399,6 +407,51 @@ public class HouseController {
|
||||
}
|
||||
}
|
||||
|
||||
public Object listAction(final HouseSearchModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getId()) && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getRegion()) || StringUtils.isBlank(model.getName()))) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("楼盘编号或城市,区域,名称为必填项"));
|
||||
return mav;
|
||||
}
|
||||
District district = null;
|
||||
DistrictKey districtKey = null;
|
||||
if(StringUtils.isNotBlank(model.getName())){
|
||||
districtKey = new DistrictKey(model.getCity(), model.getRegion(), model.getName());
|
||||
district = districtService.findDistrict(districtKey, "district");
|
||||
}else{
|
||||
district = districtService.findDistrictById(model.getId());
|
||||
if(district!=null){
|
||||
districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if(district == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
|
||||
Integer minPrice = null;
|
||||
Integer maxPrice = null;
|
||||
if(bo.getDistrictStat()!=null){
|
||||
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8);
|
||||
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2);
|
||||
}
|
||||
List<String> names = new ArrayList<String>();
|
||||
names.add(district.getName());
|
||||
if(district.getAlias() != null){
|
||||
for(String alia : district.getAlias()){
|
||||
if(StringUtils.isNotBlank(alia) && !names.contains(alia)){
|
||||
names.add(alia);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Seawater> houses = seawaterDao.findSeawatersFromEs("sell", district.getCity(), district.getRegion(), district.getName(), district.getAlias(), null, model.getStartTime(), model.getEndTime(),null,null,minPrice, maxPrice,null,null,"p_date", false,0, model.getPageSize(),"latest_seawater");
|
||||
//List<Seawater> houses1 = seawaterDao.findHouses(district.getCity(), district.getRegion(), names, minPrice, maxPrice, model.getPageSize());
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(houses));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String getPicUrl(String url, List<String> urls) {
|
||||
if (!urls.contains(url)) {
|
||||
urls.add(url);
|
||||
@@ -832,6 +885,13 @@ public class HouseController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setSeawaterDao(SeawaterDao seawaterDao) {
|
||||
this.seawaterDao = seawaterDao;
|
||||
}
|
||||
|
||||
private boolean checkExists(FacetQueryResult<HousePojo> houseBoList, HousePojo house) {
|
||||
for (HousePojo bo : houseBoList) {
|
||||
|
||||
+220
-53
@@ -31,12 +31,15 @@ import javax.validation.Valid;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
import com.fangjia.dal.seawater.dao.SeawaterDao;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.open.dto.*;
|
||||
import com.fangjia.service.district.*;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
import com.fangjia.service.open.*;
|
||||
import com.fangjia.service.open.impl.CommunityPoiServiceImpl;
|
||||
import com.fangjia.service.util.DistrictScoreUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -175,6 +178,9 @@ public class PropertyController {
|
||||
private SeawaterDao seawaterDao;
|
||||
private SeawaterService seawaterService;
|
||||
private SqmetreRentService sqmetreRentService;
|
||||
private CommunityPoiService communityPoiService;
|
||||
private CommunityBasePriceService communityBasePriceService;
|
||||
private EvaluateFactorService evaluateFactorService;
|
||||
|
||||
private FileDao fileDao = FileDao.getInstance();
|
||||
private static final int DEFAULT_PAGE_SIZE = 20;
|
||||
@@ -390,10 +396,31 @@ public class PropertyController {
|
||||
put("5000", "five");// 五线
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 第三方均价映射
|
||||
*/
|
||||
private static final Map<String, String> OTHER_PRICE_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
put("zhuge_price", "诸葛找房");
|
||||
put("anjuke_price", "安居客");
|
||||
put("fang_price", "房天下");
|
||||
put("lianjia_price", "链家");
|
||||
put("cityhouse_price", "禧泰数据");
|
||||
put("maitian_price", "麦田");
|
||||
put("ke_price", "贝壳");
|
||||
put("taofang_price", "淘房365");
|
||||
put("zhongyuan_price", "中原");
|
||||
put("tbs_price", "兔博士");
|
||||
put("qfang_price", "Q房");
|
||||
put("fangtan_price", "房探");
|
||||
put("fangduoduo_price", "房多多");
|
||||
put("wiwj_price", "我爱我家");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 利用百度API把GPS转换成Google经纬度
|
||||
*
|
||||
*
|
||||
* @param lng
|
||||
* @param lat
|
||||
* @return
|
||||
@@ -415,7 +442,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 利用算法模板把GPS转换成Google经纬度
|
||||
*
|
||||
*
|
||||
* @param lng
|
||||
* @param lat
|
||||
* @return
|
||||
@@ -607,7 +634,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 判断小区是否有经纬度
|
||||
*
|
||||
*
|
||||
* @param district
|
||||
* @return
|
||||
*/
|
||||
@@ -618,7 +645,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 调用匹配接口匹配小区
|
||||
*
|
||||
*
|
||||
* @param city
|
||||
* @param address
|
||||
* @param region
|
||||
@@ -666,17 +693,6 @@ public class PropertyController {
|
||||
}
|
||||
String userId = FangjiaApiUtil.parseUserId(model.getToken());
|
||||
|
||||
/**超级用户和上海交大账户不控制权限*/
|
||||
if (!"1007497".equals(userId) && !"1007632".equals(userId) && !"1007548".equals(userId)
|
||||
&& !"1007486".equals(userId) && !"1007533".equals(userId) && !"1007630".equals(userId)
|
||||
&& !"1007705".equals(userId) && !"1007739".equals(userId) && !"1007736".equals(userId)
|
||||
&& !"1007741".equals(userId) && !"1007742".equals(userId) && !"1007743".equals(userId)
|
||||
&& !"1007747".equals(userId) && !"1007757".equals(userId)
|
||||
&& model.getDetailLevel() != null && model.getDetailLevel() != 0) {// 临时权限控制
|
||||
mav.setModel(BasicModel.buildUnAuthorizedModel());
|
||||
return mav;
|
||||
}
|
||||
|
||||
District district = null;
|
||||
if (StringUtils.isNotBlank(model.getId())){
|
||||
if(ObjectId.isValid(model.getId())){
|
||||
@@ -740,18 +756,18 @@ public class PropertyController {
|
||||
} else {
|
||||
districtInfoDto.setBuildingType("");
|
||||
}
|
||||
districtInfoDto.setAlias(district.getAlias());
|
||||
districtInfoDto.setAlias(district.getMappingAlias());
|
||||
districtInfoDto.setAddressAlias(district.getAddrAlias());
|
||||
districtInfoDto.setCommunity(district.getStreetCommunity());
|
||||
districtInfoDto.setCommercialArea(district.getBusinessQuarter());
|
||||
if (district.getHouseholdCount() != null) {
|
||||
districtInfoDto.setTotalUnitCount(district.getHouseholdCount().toString());
|
||||
districtInfoDto.setTotalUnitCount(SeaweedUtils.formatHouseholdCount(district.getHouseholdCount().toString()));
|
||||
} else {
|
||||
districtInfoDto.setTotalUnitCount("");
|
||||
}
|
||||
districtInfoDto.setManagementFee(district.getEstateCharge());
|
||||
if (district.getCarSiteCount() != null) {
|
||||
districtInfoDto.setParking(district.getCarSiteCount().toString());
|
||||
districtInfoDto.setParking(SeaweedUtils.formatCarSiteCount(district.getCarSiteCount().toString()));
|
||||
} else {
|
||||
districtInfoDto.setParking("");
|
||||
}
|
||||
@@ -772,10 +788,10 @@ public class PropertyController {
|
||||
|
||||
districtInfoDto.setFinishBuildTime(district.getFinishBuildingDate());
|
||||
districtInfoDto.setMoveinTime(district.getLiveDate());
|
||||
districtInfoDto.setFloorSpace(district.getAllArea());
|
||||
districtInfoDto.setFloorSpace(SeaweedUtils.formatAllArea(district.getAllArea()));
|
||||
districtInfoDto.setConstructionSpace(district.getBuildArea());
|
||||
districtInfoDto.setPlotRatio(district.getCubagePercent());
|
||||
districtInfoDto.setGreenPercentage(district.getVirescencePercent());
|
||||
districtInfoDto.setPlotRatio(SeaweedUtils.formatCubagePercent(district.getCubagePercent()));
|
||||
districtInfoDto.setGreenPercentage(SeaweedUtils.formatVirescencePercent(district.getVirescencePercent()));
|
||||
districtInfoDto.setPreSalePermit(district.getLicence());
|
||||
districtInfoDto.setDeveloper(district.getDeveloper());
|
||||
districtInfoDto.setDiscount(district.getDiscount());
|
||||
@@ -792,6 +808,7 @@ public class PropertyController {
|
||||
districtInfoDto.setDescription(district.getDescription());
|
||||
districtInfoDto.setSalesOfficeAdd(district.getSellAddress());
|
||||
districtInfoDto.setSalesPhoneNumber(district.getMobile());
|
||||
districtInfoDto.setTownship(district.getTownship());
|
||||
if (district.getLoudongCount() != null && district.getLoudongCount() > 0) {
|
||||
districtInfoDto.setBuildingCount(district.getLoudongCount());
|
||||
}
|
||||
@@ -960,6 +977,12 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
if(model.getMaxFloor() == null && model.getFloor() != null &&StringUtils.isNotBlank(model.getBuildingNumber())){
|
||||
Loudong loudong = loudongService.findForEvaluate(district.getId(), model.getBuildingNumber(), model.getUnitNumber());
|
||||
if(loudong != null && loudong.getFloors() >= model.getFloor()){
|
||||
model.setMaxFloor(loudong.getFloors());
|
||||
}
|
||||
}
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
@@ -996,6 +1019,32 @@ public class PropertyController {
|
||||
}
|
||||
}
|
||||
|
||||
// 调整面积不同面积价格
|
||||
try {
|
||||
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
|
||||
int orgAvgPrice = 0;
|
||||
if (districtStatBo != null) {
|
||||
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
|
||||
} else if (districtStatBo.getDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
|
||||
}
|
||||
}
|
||||
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
|
||||
int factorPrice = evaluation.getAvgPrice();
|
||||
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
|
||||
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
|
||||
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
|
||||
// 偏离度超过5%不进行调整
|
||||
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
|
||||
evaluation.setAvgPrice(avgPrice);
|
||||
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0
|
||||
&& (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
@@ -1116,7 +1165,7 @@ public class PropertyController {
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = matchDistrict(model.getCity(), model.getAddress(), model.getDistrict(), model.getName());
|
||||
District district = districtService.findDistrict(new DistrictKey(model.getCity(), model.getDistrict(), model.getName()), "district");//matchDistrict(model.getCity(), model.getAddress(), model.getDistrict(), model.getName());
|
||||
if(district == null){
|
||||
//防止地址模糊,名称详细的情况
|
||||
district = matchDistrict(model.getCity(), model.getName(), model.getDistrict(), model.getAddress());
|
||||
@@ -1166,19 +1215,52 @@ public class PropertyController {
|
||||
evaluationService.remove(evaluation.getId());
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
|
||||
return mav;
|
||||
}
|
||||
// 调整面积不同面积价格
|
||||
try {
|
||||
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
|
||||
int orgAvgPrice = 0;
|
||||
if (districtStatBo != null) {
|
||||
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
|
||||
} else if (districtStatBo.getDistrictStat() != null) {
|
||||
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
|
||||
}
|
||||
}
|
||||
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
|
||||
int factorPrice = evaluation.getAvgPrice();
|
||||
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
|
||||
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
|
||||
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
|
||||
// 偏离度超过5%不进行调整
|
||||
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
|
||||
evaluation.setAvgPrice(avgPrice);
|
||||
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
Map<String, Object> districtPriceMap = new LinkedHashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
long totalPrice = evaluation.getBigTotalPrice();
|
||||
if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
|
||||
totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
|
||||
evaluation.setBigTotalPrice(totalPrice);
|
||||
evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
|
||||
}
|
||||
// 取消系数下调
|
||||
// if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
|
||||
// totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
|
||||
// evaluation.setBigTotalPrice(totalPrice);
|
||||
// evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
|
||||
// }
|
||||
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
|
||||
districtPriceMap.put("unitPrice", evaluation.getAvgPrice());
|
||||
// 新增置信度
|
||||
CommunityBasePrice communityBasePrice = communityBasePriceService.getById(district.getId());
|
||||
if (communityBasePrice != null) {
|
||||
districtPriceMap.put("credit", communityBasePrice.getCredit());
|
||||
} else {
|
||||
districtPriceMap.put("credit", evaluation.getCredit());
|
||||
}
|
||||
List<String> names = new ArrayList<String>();
|
||||
names.add(district.getName());
|
||||
if(district.getAlias() != null){
|
||||
@@ -1190,6 +1272,31 @@ public class PropertyController {
|
||||
}
|
||||
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.8);
|
||||
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.2);
|
||||
Integer min10Price = (int)(evaluation.getAvgPrice() * 0.9);
|
||||
Integer max10Price = (int)(evaluation.getAvgPrice() * 1.1);
|
||||
// 新增第三方均价
|
||||
try {
|
||||
double dCredit = 0.61;
|
||||
Map<String, Object> rMap = getLastEvaluationPrice(district, evaluation, dCredit);
|
||||
if (null != rMap) {
|
||||
if (rMap.containsKey("other_price")) {
|
||||
Map<String, Integer> otherPriceMap = (Map<String, Integer>) rMap.get("other_price");
|
||||
Map<String, Integer> priceResultMap = new HashMap<String, Integer>();
|
||||
for (String key : otherPriceMap.keySet()) {
|
||||
Integer price = otherPriceMap.get(key);
|
||||
// 剔除偏差大于10的
|
||||
if (min10Price <= price && max10Price >= price) {
|
||||
if (OTHER_PRICE_MAP.containsKey(key)) {
|
||||
priceResultMap.put(OTHER_PRICE_MAP.get(key), price);
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("otherPrice", priceResultMap);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
List<Seawater> houses = seawaterDao.findHouses(district.getCity(), district.getRegion(), names,minPrice, maxPrice, 20);
|
||||
if(houses.size() > 3){
|
||||
districtPriceMap.put("calcType", 1);
|
||||
@@ -1218,7 +1325,7 @@ public class PropertyController {
|
||||
}else if(district.getLng() != null && district.getLng() > 0){
|
||||
double lng = DataUtil.roundDouble(district.getLng() / 10000000000.0,6);
|
||||
double lat = DataUtil.roundDouble(district.getLat() / 10000000000.0, 6);
|
||||
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 4, null);
|
||||
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 6, null);
|
||||
if(districts.size() < 2){
|
||||
evaluationService.remove(evaluation.getId());
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
|
||||
@@ -1256,9 +1363,15 @@ public class PropertyController {
|
||||
districtDto.append("buildYear", String.valueOf(buildYear));
|
||||
}
|
||||
districtAnalyData = districtAnalyDataService.findByDistrictKey(new DistrictKey(d));
|
||||
if(districtAnalyData != null && districtAnalyData.getHalfYearMarkup() != null){
|
||||
districtDto.append("halfYearMarkup",DataUtil.roundDouble( districtAnalyData.getHalfYearMarkup() * 100 ,2));
|
||||
if(districtAnalyData != null){
|
||||
if (districtAnalyData.getHalfYearMarkup() != null) {
|
||||
districtDto.append("halfYearMarkup", DataUtil.roundDouble(districtAnalyData.getHalfYearMarkup() * 100, 2));
|
||||
}
|
||||
if (districtAnalyData.getAvgPrice() != null && minPrice <= districtAnalyData.getAvgPrice() && maxPrice >= districtAnalyData.getAvgPrice()) {
|
||||
districtDto.append("avgPrice", districtAnalyData.getAvgPrice());
|
||||
}
|
||||
}
|
||||
|
||||
nearCommunityDtos.add(districtDto);
|
||||
}
|
||||
Integer buildYear = districtService.getBuildYear(district);
|
||||
@@ -1266,6 +1379,18 @@ public class PropertyController {
|
||||
modelFeaturesFto.put("buildYear", String.valueOf(buildYear));
|
||||
}
|
||||
modelFeaturesFto.append("nearCommunity", nearCommunityDtos);
|
||||
|
||||
// 模型特征新增周边数量
|
||||
CommunityPoi communityPoi = communityPoiService.getById(district.getId());
|
||||
if (communityPoi != null) {
|
||||
modelFeaturesFto.put("subway", communityPoi.getSubway());
|
||||
modelFeaturesFto.put("traffic", communityPoi.getTraffic());
|
||||
modelFeaturesFto.put("bank", communityPoi.getBank());
|
||||
modelFeaturesFto.put("primary", communityPoi.getPrimary());
|
||||
modelFeaturesFto.put("hospital", communityPoi.getHospital());
|
||||
modelFeaturesFto.put("junior", communityPoi.getJunior());
|
||||
modelFeaturesFto.put("funeral", communityPoi.getFuneral());
|
||||
}
|
||||
districtPriceMap.put("modelFeatures", modelFeaturesFto);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
@@ -1473,7 +1598,7 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 四川锦程 定制接口 多建筑年代
|
||||
* @param model
|
||||
@@ -1585,7 +1710,7 @@ public class PropertyController {
|
||||
districtPriceMap.put("buildYear", matcher3.group());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 根据城市等 级设置D级可信度
|
||||
ApiUserAuthority apiUserAuthority = apiUserAuthorityService
|
||||
@@ -2098,7 +2223,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 小区租金查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -2577,7 +2702,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 批量获取小区的均价,均价走势数据
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -2719,7 +2844,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 批量获取小区的配套数据,最多12个小区
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -2864,7 +2989,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 获取JSON参数中的num参数值
|
||||
*
|
||||
*
|
||||
* @param jo
|
||||
* @return
|
||||
*/
|
||||
@@ -2889,7 +3014,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 获取JSON参数中的radius值
|
||||
*
|
||||
*
|
||||
* @param jo
|
||||
* @return
|
||||
*/
|
||||
@@ -3697,7 +3822,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 解析出关键字中的小区名
|
||||
*
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@@ -3814,7 +3939,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 小区统计分析接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -3899,7 +4024,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 小区交通接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -3957,7 +4082,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 小区周边接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4016,7 +4141,7 @@ public class PropertyController {
|
||||
/**
|
||||
* 相同小区相似户型房源挂牌量接口<br>
|
||||
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
||||
*
|
||||
*
|
||||
* @author yinjihuan
|
||||
* @date 2016年9月1日
|
||||
* @param city
|
||||
@@ -4056,7 +4181,7 @@ public class PropertyController {
|
||||
/**
|
||||
* 周边小区相似户型挂牌量接口<br>
|
||||
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
||||
*
|
||||
*
|
||||
* @author yinjihuan
|
||||
* @date 2016年9月1日
|
||||
* @param city
|
||||
@@ -4107,7 +4232,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 小区周边一公里均价
|
||||
*
|
||||
*
|
||||
* @author wenyan
|
||||
* @param model
|
||||
* @return
|
||||
@@ -4130,7 +4255,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 相同小区相似户型租金范围查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4173,7 +4298,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 周边小区相似户型租金范围查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4236,7 +4361,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 室号查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4272,7 +4397,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 楼栋楼层信息查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4297,7 +4422,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 楼栋查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4342,7 +4467,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 楼栋查询接口
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4795,7 +4920,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 房产交易记录查询
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4855,7 +4980,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 房产拍卖记录
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -4916,7 +5041,7 @@ public class PropertyController {
|
||||
|
||||
/**
|
||||
* 房产近期评估次数
|
||||
*
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@@ -5412,6 +5537,36 @@ public class PropertyController {
|
||||
}
|
||||
}
|
||||
|
||||
public Object searchHouseLoudongAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getId()) || StringUtils.isBlank(model.getHouseNumber()) || StringUtils.isBlank(model.getRoomNumber())){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:楼盘编号,楼栋号,室为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<HouseLoudong> houseLoudongs = houseLoudongService.findAll(model.getId(), model.getHouseNumber(), model.getUnitNumber(), model.getRoomNumber());
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(houseLoudongs));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public Object searchLoudongAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(model.getId()) || StringUtils.isBlank(model.getHouseNumber())){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:楼盘编号,楼栋号为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
List<Loudong> loudongs = loudongService.findAll(model.getId(), model.getHouseNumber(), model.getUnitNumber());
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(loudongs));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
|
||||
this.houseLoudongService = houseLoudongService;
|
||||
@@ -5601,4 +5756,16 @@ public class PropertyController {
|
||||
public void setRentDealPriceService(RentDealPriceService rentDealPriceService) {
|
||||
this.rentDealPriceService = rentDealPriceService;
|
||||
}
|
||||
|
||||
public void setCommunityPoiService(CommunityPoiService communityPoiService) {
|
||||
this.communityPoiService = communityPoiService;
|
||||
}
|
||||
|
||||
public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) {
|
||||
this.evaluateFactorService = evaluateFactorService;
|
||||
}
|
||||
|
||||
public void setCommunityBasePriceService(CommunityBasePriceService communityBasePriceService) {
|
||||
this.communityBasePriceService = communityBasePriceService;
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class requestController {
|
||||
|
||||
/**
|
||||
* »ñÈ¡ÇëÇóµÄrequestºÍIPÐÅÏ¢
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public Object requestAction(HttpServletRequest request) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
String ip = AnalyticsUtil.getIpAddress(request);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Enumeration headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = (String) headerNames.nextElement();
|
||||
String value = request.getHeader(key);
|
||||
map.put(key, value);
|
||||
}
|
||||
map.put("ip", ip);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(map));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ public class DistrictInfoDto {
|
||||
private String salesPhoneNumber;
|
||||
private Integer buildingCount;
|
||||
private Integer finishYear;
|
||||
private String township;
|
||||
|
||||
|
||||
public String getDistrict() {
|
||||
@@ -818,4 +819,12 @@ public class DistrictInfoDto {
|
||||
public void setFinishYear(Integer finishYear) {
|
||||
this.finishYear = finishYear;
|
||||
}
|
||||
|
||||
public String getTownship() {
|
||||
return township;
|
||||
}
|
||||
|
||||
public void setTownship(String township) {
|
||||
this.township = township;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ public class AnalyticsFilter implements Filter {
|
||||
if ("1".equals(request.getParameter("__refresh_cache"))) {
|
||||
threadLocalData.put(ThreadLocalKey.DisableCache, "1");
|
||||
}
|
||||
createUID(request, response);
|
||||
createSID(request, response);
|
||||
//createUID(request, response);
|
||||
//createSID(request, response);
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Allow-Methods", "*");
|
||||
chain.doFilter(request, response);
|
||||
|
||||
@@ -8,6 +8,7 @@ public class AuctionModel extends FangjiaApiModel{
|
||||
private String city;
|
||||
private String district;
|
||||
private String address;
|
||||
private String name;
|
||||
private Date minStartTime;
|
||||
private Date maxStartTime;
|
||||
private Integer minStartPrice;
|
||||
@@ -17,6 +18,7 @@ public class AuctionModel extends FangjiaApiModel{
|
||||
private Integer propertyType;
|
||||
private Integer status;
|
||||
private Integer limit = 10;
|
||||
private String startDate;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@@ -121,4 +123,20 @@ public class AuctionModel extends FangjiaApiModel{
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class DealPriceModel extends FangjiaApiModel{
|
||||
private String id;
|
||||
|
||||
private String city;
|
||||
|
||||
@@ -34,9 +37,13 @@ public class DealPriceModel extends FangjiaApiModel{
|
||||
private Double size;
|
||||
|
||||
private Integer max;
|
||||
private Integer limit = 10;
|
||||
private String decoration;
|
||||
|
||||
private boolean convert;
|
||||
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
|
||||
|
||||
public String getCity() {
|
||||
@@ -198,4 +205,36 @@ public class DealPriceModel extends FangjiaApiModel{
|
||||
public void setConvert(boolean convert) {
|
||||
this.convert = convert;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +246,42 @@ public class EvaluationModel extends FangjiaApiModel {
|
||||
private Date buildDate;
|
||||
private String sid;//微信小程序中的sid
|
||||
private String code;//微信小程序中的code
|
||||
private String id;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private Integer limit = 10;
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fangjia.service.datastore.bean.HouseQueryBean;
|
||||
import com.fangjia.service.query.QueryBean;
|
||||
|
||||
public class HouseSearchModel extends SearchModel {
|
||||
private String id;
|
||||
private String kind;
|
||||
private String estateType;
|
||||
private String buildingType;
|
||||
@@ -116,7 +117,12 @@ public class HouseSearchModel extends SearchModel {
|
||||
public void setShowDetail(Boolean showDetail) {
|
||||
this.showDetail = showDetail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -46,7 +46,12 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
* Â¥ºÅ
|
||||
*/
|
||||
private String unitNumber;
|
||||
/**
|
||||
* ÐÂÂ¥ºÅ
|
||||
*/
|
||||
private String houseNumber;
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* ÊÒºÅ
|
||||
*/
|
||||
@@ -905,4 +910,20 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
public String getHouseNumber() {
|
||||
return houseNumber;
|
||||
}
|
||||
|
||||
public void setHouseNumber(String houseNumber) {
|
||||
this.houseNumber = houseNumber;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public abstract class SearchModel extends FangjiaApiModel {
|
||||
protected Integer totalPriceEnd;
|
||||
protected Integer avgPriceStart;
|
||||
protected Integer avgPriceEnd;
|
||||
protected Integer startTime;
|
||||
protected Integer endTime;
|
||||
protected Integer areaStart;
|
||||
protected Integer areaEnd;
|
||||
protected Integer room;
|
||||
@@ -358,4 +360,20 @@ public abstract class SearchModel extends FangjiaApiModel {
|
||||
public void setTotalPrice(Integer totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public Integer getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Integer startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Integer getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Integer endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,10 @@
|
||||
<ladder>/address/standard</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
<rule controller="address" action="fiveDivisionStructure2" channel="v2">
|
||||
<ladders>
|
||||
<ladder>/address/fiveDivisionStructure</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
</rules>
|
||||
</urlrewrite>
|
||||
+9
-2
@@ -97,7 +97,7 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
totalCount.addAndGet(1)
|
||||
def commId = rMap.get("_id").toString()
|
||||
|
||||
def ret = findHouses(city, rMap.region, "sell", startDate,endDate, rMap.name, rMap.alias)
|
||||
def ret = findHouses(city, rMap.region, "sell", startDate,endDate, rMap.name, rMap.alias, rMap.estate_type2)
|
||||
//def ret = findHousesByDistId(city, commId, "sell", startDate,endDate)
|
||||
// if(ret && ret.size()<100){//导历史房源需要,以后不需要
|
||||
// ret = findHouses(city, rMap.region, "sell", 20190701, endDate, rMap.name, rMap.alias)
|
||||
@@ -408,7 +408,7 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
}
|
||||
|
||||
|
||||
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias){
|
||||
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias, def estate_type2){
|
||||
|
||||
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(false).includeUpper(false);
|
||||
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
|
||||
@@ -449,6 +449,13 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
def map = houses[k];
|
||||
DBObject seawater = new BasicDBObject(map)
|
||||
|
||||
if(estate_type2 && estate_type2=="ÆÕͨסլ"){
|
||||
if(seawater.estate_type&& seawater.estate_type.contains("ÉÌס")){
|
||||
println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!seawater.total_price){
|
||||
continue;
|
||||
}
|
||||
|
||||
+6
@@ -57,6 +57,12 @@ class CcbFtpUtils {
|
||||
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
||||
}
|
||||
|
||||
static def listFileNames(month){
|
||||
//上传到ftp
|
||||
sftpChannel = reConnect();
|
||||
Vector files = sftp.listFiles(ftpPath+ month+"/", sftpChannel);
|
||||
return files
|
||||
}
|
||||
|
||||
static main(args) {
|
||||
|
||||
|
||||
+6
-5
@@ -15,8 +15,8 @@ class DealPriceDataProcess {
|
||||
|
||||
|
||||
|
||||
def sqlInstance2 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.94:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
// def sqlInstance2 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.94:1521:orcl",
|
||||
// "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
def sqlInstance236 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
@@ -373,16 +373,17 @@ class DealPriceDataProcess {
|
||||
def citys = CcbCommonUtils.citys
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def publishTime = '2021-10-01'
|
||||
def month = 202203
|
||||
def month = 202204
|
||||
def rows = []
|
||||
for(def city : citys) {
|
||||
def rets = findPeGteThirdParty(city, 202204)
|
||||
def rets = findPeGteThirdParty(city, 202205)
|
||||
def total = 0
|
||||
println city +" "+rets.size()
|
||||
for(def m : rets){
|
||||
def sql = "delete from BIGDATA_THIRD_PARTY_PRICE_GJ where commid='${m.commid}' and price_date=${month} and community_price=${m.price}"
|
||||
sqlInstance236.executeUpdate(sql)
|
||||
}
|
||||
println city +" "+rets.size()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -3,8 +3,10 @@ package com.fangjia.script.ccbevaluation
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.jcraft.jsch.ChannelSftp
|
||||
import groovy.sql.Sql
|
||||
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
class ExportOracleEvaluationData {
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
@@ -33,6 +35,8 @@ class ExportOracleEvaluationData {
|
||||
exportCommCaseDetailGj(curMonth)
|
||||
|
||||
def curDate = curMonth.toString()+"28"
|
||||
// 生成MD5文件
|
||||
exportMd5()
|
||||
SSHHelper jschCommand = new SSHHelper();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
|
||||
// okÎļþ
|
||||
@@ -413,4 +417,23 @@ class ExportOracleEvaluationData {
|
||||
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
|
||||
}
|
||||
|
||||
def exportMd5(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
Vector files = CcbFtpUtils.listFileNames(curDate)
|
||||
Iterator fileVec = files.iterator()
|
||||
def fileRows = []
|
||||
while(fileVec.hasNext()){
|
||||
ChannelSftp.LsEntry file = fileVec.next()
|
||||
if(org.apache.commons.lang.StringUtils.isNotBlank(file.getFilename()) && file.getFilename().endsWith(".dat")){
|
||||
fileRows << file.getFilename() +":"+ DigestUtils.md5Hex(file.getFilename())
|
||||
}
|
||||
}
|
||||
def fileName = "/ccb/md5.txt"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\房价网\\md5.txt"
|
||||
}
|
||||
FileUtils.createTxtFile(fileRows, fileName, "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "md5.txt 上传Ftp完成......"
|
||||
}
|
||||
}
|
||||
|
||||
+51
-1
@@ -1,21 +1,29 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
|
||||
import groovy.sql.Sql
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
class LoadGuide {
|
||||
public static final DBCollection DISTRICT_GUIDE_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "district_guide_price", "mongo.db.fangjia.com", 28017)
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
def task = new LoadGuide()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
addPersonGuided("D:\\数据\\建行\\人工指导价更新.xlsx")
|
||||
// match("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
|
||||
|
||||
// saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞指导价218.xlsx")
|
||||
@@ -26,9 +34,51 @@ class LoadGuide {
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\无锡100 广州96 二手住房成交参考价格表.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\深圳指导价 - 210909 -.xlsx")
|
||||
savePrice("D:\\数据\\建行\\房产估值\\指导价\\三亚指导价30.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\三亚指导价30.xlsx")
|
||||
|
||||
}
|
||||
|
||||
def addPersonGuided(filename){
|
||||
ExcelUtils.modify(filename, { d ->
|
||||
def city = d['B']
|
||||
if(city){
|
||||
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
||||
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
createSql( d, cityCodeDatas, distCodeMap)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
def createSql(d, cityCodeDatas, distCodeMap){
|
||||
def id = new ObjectId()
|
||||
def commid = d['A']
|
||||
def cityId = cityCodeDatas.get(d['B'])
|
||||
def sampleRegion = d['C'].replace("街道","").replace("镇","")
|
||||
def distRegion = distCodeMap.get(sampleRegion)
|
||||
def cityName = d['B']
|
||||
def distName = d['C']
|
||||
def commName = d['D']
|
||||
def price = d['E'].toDouble().toInteger()
|
||||
|
||||
def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district")
|
||||
if(dist){
|
||||
def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd")
|
||||
|
||||
|
||||
def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " +
|
||||
"('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'房价网','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')"
|
||||
println sql
|
||||
sqlInstance.executeUpdate(sql)
|
||||
}else{
|
||||
println " 没查到 "+commName
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
def match(def filename){
|
||||
def city = "西安"
|
||||
ExcelUtils.modify(filename,{d->
|
||||
|
||||
+68
-60
@@ -7,6 +7,7 @@ import com.fangjia.core.util.GeoUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.OpenApiUtils
|
||||
import com.fangjia.script.gj.district.NameProcess
|
||||
import com.fangjia.script.linxsh.util.AddressUtil
|
||||
import com.fangjia.script.util.ABuYunUtil
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
@@ -26,9 +27,9 @@ class CcbDistrictToDB {
|
||||
// task.run()
|
||||
// task.run1()
|
||||
// task.meituanRun()
|
||||
// task.meituanSqrentRun()
|
||||
task.meituanSqrentRun()
|
||||
// task.updateDistrict()
|
||||
task.updateDongguangRegion()
|
||||
// task.updateDongguangRegion()
|
||||
}
|
||||
|
||||
def updateDongguangRegion(){
|
||||
@@ -80,13 +81,17 @@ class CcbDistrictToDB {
|
||||
}
|
||||
|
||||
def meituanSqrentRun(){
|
||||
ExcelUtils.modify("D:\\数据\\美团\\美团需入库小区合并后.xlsx", { d ->
|
||||
def index = 0
|
||||
ExcelUtils.modify("D:\\数据\\美团\\美团待入库.xlsx", { d ->
|
||||
index++
|
||||
println index+" "+d['H']
|
||||
def city = d['F']
|
||||
def region = d['G']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion) {
|
||||
def name = d['H']
|
||||
def name = NameProcess.nameStandard(city, newRegion, d['H'])
|
||||
name = nameFileter(name)
|
||||
|
||||
if(name){
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
@@ -103,7 +108,6 @@ class CcbDistrictToDB {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1));
|
||||
CommonUtils.recalculationSqRent(city, region, name, estateType2, lastMonthDay,false,0)
|
||||
}
|
||||
@@ -115,97 +119,100 @@ class CcbDistrictToDB {
|
||||
def index = 0//美团需入库小区合并后.xlsx
|
||||
def keys = new CopyOnWriteArrayList()
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\美团\\美团需入库小区合并后.xlsx", { d ->
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\美团\\美团待入库.xlsx", { d ->
|
||||
index++
|
||||
println index+" "+d['H']
|
||||
def city = d['F']
|
||||
def region = d['G']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def name = d['H']
|
||||
if(newRegion) {
|
||||
def name = NameProcess.nameStandard(city, newRegion, d['H'])
|
||||
name = nameFileter(name)
|
||||
|
||||
if (name) {
|
||||
def formatAddress = null
|
||||
if(d['E']){
|
||||
formatAddress = AddressUtil.formatAddress(city, d['E'])
|
||||
if (d['I']) {
|
||||
formatAddress = AddressUtil.formatAddress(city, d['I'])
|
||||
}
|
||||
|
||||
if(!formatAddress || (formatAddress && !formatAddress.contains("号") && !formatAddress.contains("交叉"))){
|
||||
def rets = OpenApiUtils.getGaoDeSearchLocation(city, region, name)
|
||||
def map = findStandardObject2(city,region, name, d['E'], rets);
|
||||
if(map && map.address){
|
||||
formatAddress = AddressUtil.formatAddress(city, map.address)
|
||||
if(!formatAddress){
|
||||
if(map.address.contains("交叉口")){
|
||||
formatAddress = map.address.substring(0, map.address.toString().indexOf("交叉口")+3)
|
||||
}else if(map.address.contains("交叉")){
|
||||
formatAddress = map.address.substring(0, map.address.toString().indexOf("交叉")+2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(!formatAddress || (formatAddress && !formatAddress.contains("号") && !formatAddress.contains("交叉"))){
|
||||
// def rets = OpenApiUtils.getGaoDeSearchLocation(city, region, name)
|
||||
// def map = findStandardObject2(city,region, name, d['E'], rets);
|
||||
// if(map && map.address){
|
||||
// formatAddress = AddressUtil.formatAddress(city, map.address)
|
||||
// if(!formatAddress){
|
||||
// if(map.address.contains("交叉口")){
|
||||
// formatAddress = map.address.substring(0, map.address.toString().indexOf("交叉口")+3)
|
||||
// }else if(map.address.contains("交叉")){
|
||||
// formatAddress = map.address.substring(0, map.address.toString().indexOf("交叉")+2)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
Long glat = null
|
||||
Long glng = null
|
||||
Long blat = null
|
||||
Long blng = null
|
||||
if(d['K']){
|
||||
glat = d['L'].toString().toDouble() * 10000000000L
|
||||
glng = d['K'].toString().toDouble() * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(d['K'].toString().toDouble(), d['L'].toString().toDouble(), 3)
|
||||
if (d['L']) {
|
||||
glat = d['M'].toString().toDouble() * 10000000000L
|
||||
glng = d['L'].toString().toDouble() * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(d['L'].toString().toDouble(), d['M'].toString().toDouble(), 3)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
if (name.contains("别墅")) {
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
} else if (name.contains("商住")) {
|
||||
estateType2 = "商住"
|
||||
}else{
|
||||
def type = d['I']
|
||||
if(type){
|
||||
if(type.contains("别墅")){
|
||||
} else {
|
||||
def type = d['J']
|
||||
if (type) {
|
||||
if (type.contains("别墅")) {
|
||||
estateType2 = "别墅"
|
||||
}else if(type.contains("商住")){
|
||||
} else if (type.contains("商住")) {
|
||||
estateType2 = "商住"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def key = city+"##"+newRegion+"##"+name
|
||||
if(name && !keys.contains(key)){
|
||||
def key = city + "##" + newRegion + "##" + name
|
||||
if (name && !keys.contains(key)) {
|
||||
def dist = CommonDatautils.findDistrict(city, newRegion, name, "district")
|
||||
if(!dist){
|
||||
if (!dist) {
|
||||
keys << key
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
data.put("status",0)
|
||||
data.put("cat","district")
|
||||
data.put("name_cat", 12)
|
||||
data.put("status", 0)
|
||||
data.put("cat", "district")
|
||||
data.put("c_date", new Date())
|
||||
data.put("m_date", new Date())
|
||||
data.put("city", city)
|
||||
data.put("region",newRegion)
|
||||
data.put("region", newRegion)
|
||||
data.put("name", name)
|
||||
data.put("estate_type2",estateType2)
|
||||
data.put("estate_type2", estateType2)
|
||||
data.put("address", formatAddress)
|
||||
if(glat){
|
||||
data.put("lat",glat)
|
||||
data.put("lng",glng)
|
||||
data.put("lat2",blat)
|
||||
data.put("lng2",blng)
|
||||
if (glat) {
|
||||
data.put("lat", glat)
|
||||
data.put("lng", glng)
|
||||
data.put("lat2", blat)
|
||||
data.put("lng2", blng)
|
||||
}
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
data.put("mark_map", markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
|
||||
|
||||
println index+" "+data
|
||||
println index + " " + data
|
||||
|
||||
def stop = false
|
||||
while (!stop){
|
||||
if(data._id.toString()){
|
||||
while (!stop) {
|
||||
if (data._id.toString()) {
|
||||
addPrice(data)
|
||||
stop = true;
|
||||
}
|
||||
@@ -213,19 +220,17 @@ class CcbDistrictToDB {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
println city +" "+region +" 区域无法标准化"
|
||||
}
|
||||
},0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
def addPrice(dist){
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2022-03-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-04-25")
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2022-05-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-05-24")
|
||||
def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate)
|
||||
|
||||
for(def weekend : weekends){
|
||||
@@ -435,9 +440,12 @@ class CcbDistrictToDB {
|
||||
}
|
||||
|
||||
def nameFileter(def name){
|
||||
name = name.replace("·","").replace(".","").replace("|","")
|
||||
name = name.replace("1期","一期").replace("2期","二期").replace("3期","三期").replace("4期","四期").replace("5期","五期").replace("6期","6期")
|
||||
name = name.replace("1区","一区").replace("2区","二区").replace("3区","三区").replace("4区","四区").replace("5区","五区").replace("6区","六区")
|
||||
if(name){
|
||||
name = name.replace("·","").replace(".","").replace("|","")
|
||||
name = name.replace("1期","一期").replace("2期","二期").replace("3期","三期").replace("4期","四期").replace("5期","五期").replace("6期","6期")
|
||||
name = name.replace("1区","一区").replace("2区","二区").replace("3区","三区").replace("4区","四区").replace("5区","五区").replace("6区","六区")
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
+78
-1
@@ -1,10 +1,12 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.linxsh.util.AddressUtil
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.poi.ss.util.RegionUtil
|
||||
import org.bson.types.ObjectId
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
@@ -13,7 +15,82 @@ class DistrictMarge {
|
||||
static main(args) {
|
||||
def task = new DistrictMarge()
|
||||
//task.run()
|
||||
task.repeatAddress()
|
||||
// task.repeatAddress()
|
||||
// task.removeDist()
|
||||
task.updateAddress()
|
||||
// task.addMappingAlias()
|
||||
}
|
||||
def updateAddress(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\更新小区地址.xlsx", { d ->
|
||||
if (d['A']) {
|
||||
def region = d['B'].trim()
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
if (dist) {
|
||||
DBObject udata = new BasicDBObject()
|
||||
udata.put("address", d['D'])
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject('_id', dist._id),new BasicDBObject('$set', udata))
|
||||
}
|
||||
}else{
|
||||
println d['A'] + " 格式化失败 "+d['B']
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def removeDist(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\删除小区.xlsx", { d ->
|
||||
if (d['A']) {
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
if (dist) {
|
||||
DBObject udata = new BasicDBObject()
|
||||
udata.put("status", 1)
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject('_id', dist._id),new BasicDBObject('$set', udata))
|
||||
}
|
||||
}else{
|
||||
println d['A'] + " 格式化失败 "+d['B']
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def addMappingAlias(){
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\新增映射别名.xlsx", { d ->
|
||||
index ++
|
||||
if (d['A']) {
|
||||
def region = d['B'].trim()
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
if (dist) {
|
||||
def mapping_alias = dist.mapping_alias
|
||||
if(!dist.mapping_alias){
|
||||
mapping_alias = []
|
||||
}
|
||||
def alias = d['D']
|
||||
def arrs = alias.split("、")
|
||||
for(def s : arrs){
|
||||
if(!mapping_alias.contains(s)){
|
||||
mapping_alias << s
|
||||
}
|
||||
}
|
||||
DBObject udata = new BasicDBObject()
|
||||
udata.put("mapping_alias", mapping_alias)
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject('_id', dist._id),new BasicDBObject('$set', udata))
|
||||
}
|
||||
}else{
|
||||
println d['A'] + " 格式化失败 "+d['B']
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def repeatAddress(){
|
||||
|
||||
+28
-1
@@ -36,10 +36,37 @@ class MatchMapData {
|
||||
// task.run3()
|
||||
// task.exportHouse()
|
||||
// task.addDistrictLevel()
|
||||
task.run4()
|
||||
// task.run4()
|
||||
task.run5()
|
||||
|
||||
}
|
||||
|
||||
def run5(){
|
||||
ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\½¨ÐÐ\\Êý¾ÝºËʵ.xlsx", { d ->
|
||||
if (d['A']) {
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
if(dist){
|
||||
if(dist.mapping_alias){
|
||||
d['D'] = dist.mapping_alias.join(",")
|
||||
}
|
||||
d['E'] = dist.address
|
||||
}
|
||||
|
||||
def dist1 = CommonDatautils.findDistrict(d['A'], newRegion, d['G'], "district")
|
||||
if(dist1){
|
||||
if(dist1.mapping_alias){
|
||||
d['H'] = dist1.mapping_alias.join(",")
|
||||
}
|
||||
d['I'] = dist1.address
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def run4() {
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\核实小区是否存在.xlsx", { d ->
|
||||
def regionCode = null
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import groovy.sql.Sql
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
class OracleHouse {
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
connectionProperties.put("user", "developer")
|
||||
connectionProperties.put("password", "5e8edd851d2fdfbd7415232c67367cc3")
|
||||
dataSource.setProperties(connectionProperties)
|
||||
}
|
||||
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
|
||||
|
||||
static main(args) {
|
||||
def task = new OracleHouse()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def rets = findAllHouse("2022-04-19")
|
||||
def totalCount = new AtomicLong()
|
||||
println rets.size()
|
||||
final CountDownLatch latch = new CountDownLatch(rets.size())
|
||||
for(def i=0;i<rets.size();i++){
|
||||
def arrs = rets[i]
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try {
|
||||
totalCount.addAndGet(1)
|
||||
def flag = findHouseFlag(arrs[0])
|
||||
println totalCount.get()+" "+ arrs[0] +" "+flag
|
||||
if(flag){
|
||||
def dist = CommonDatautils.findDistrictById(arrs[1])
|
||||
if(dist && dist.estate_type2=="ÆÕͨסլ"){
|
||||
removeHouse(arrs[0])
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
latch.await()
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findHouseFlag(def id){
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("_id", id))
|
||||
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "district_comp_potential", queryBuilder);
|
||||
def delFlag = false
|
||||
for(def h : houses){
|
||||
if(h.estate_type && (h.estate_type.contains("ÉÌ") || h.estate_type.contains("°ì"))){
|
||||
println id+" "+h.estate_type
|
||||
delFlag = true
|
||||
}
|
||||
}
|
||||
return delFlag
|
||||
}
|
||||
|
||||
def findAllHouse(def publishDate) {
|
||||
def sql = "select FORSALEID,COMMID from bigdata_forsale_gj where publishtime>=to_date('${publishDate}','yyyy-MM-dd')";
|
||||
def allRows = []
|
||||
def index = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
index = index + 1
|
||||
println index
|
||||
def data = []
|
||||
data << r.FORSALEID
|
||||
data << r.COMMID
|
||||
allRows << data
|
||||
});
|
||||
return allRows
|
||||
}
|
||||
|
||||
def removeHouse(houseid){
|
||||
def sql = "delete from bigdata_forsale_gj where FORSALEID='${houseid}' ";
|
||||
sqlInstance.executeUpdate(sql)
|
||||
}
|
||||
}
|
||||
+378
-21
@@ -2,28 +2,43 @@ package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.httpclient.UserAgents
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.OpenApiUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.gj.paimai.DataUtil
|
||||
import com.fangjia.script.linxsh.util.AddressUtil
|
||||
import com.fangjia.script.util.ABuYunUtil
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.GeoHelper
|
||||
import com.fangjia.script.util.JacksonUtil
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
import com.google.gson.JsonObject
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.zip.GZIPInputStream
|
||||
|
||||
class MatchEvaluateRegionTest {
|
||||
static def targetUrl = "http://192.168.0.12:9200/district_comp_potential/"
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
def path = "D:\\数据\\重庆农商行\\2022-05-06\\估值限时测试-重庆农商行1.0.xlsx"
|
||||
def path = "D:\\数据\\美团\\10城小区明细-V10.xlsx"
|
||||
def total = 1500
|
||||
|
||||
static main(args) {
|
||||
@@ -31,14 +46,26 @@ class MatchEvaluateRegionTest {
|
||||
// task.run()//小区匹配
|
||||
// task.run1()//地图匹配
|
||||
// task.addDistrict();//新增人工处理小区,原文件匹配不上的去除
|
||||
task.addPrice()
|
||||
// task.addPrice()
|
||||
// task.addArroundPrice()
|
||||
// task.addArroundPriceByLat()
|
||||
// task.addRentRate()
|
||||
// task.addAuthor()
|
||||
// task.addLevel()
|
||||
// task.addSorce()
|
||||
// task.addArroundScore()
|
||||
|
||||
task.pkPrice()
|
||||
|
||||
}
|
||||
def run(){
|
||||
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
index ++
|
||||
if(!row['F']){
|
||||
def jsonObject = OpenApiClient.addressMatch("重庆", row['C'], "property", false,null,null,)
|
||||
println index+" "+row['E']
|
||||
def jsonObject = OpenApiClient.addressMatch(row['A'], row['C'], "property", false,row['B'],null)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['F'] = jsonObject.get("id")
|
||||
row['G'] = jsonObject.get("city")
|
||||
@@ -47,8 +74,8 @@ class MatchEvaluateRegionTest {
|
||||
row['J'] = jsonObject.get("address")
|
||||
row['K'] = jsonObject.get("propertyType")
|
||||
row['L'] = jsonObject.get("map")
|
||||
// row['K'] = jsonObject.get("lng")
|
||||
// row['L'] = jsonObject.get("lat")
|
||||
row['M'] = jsonObject.get("lng")
|
||||
row['N'] = jsonObject.get("lat")
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -56,8 +83,8 @@ class MatchEvaluateRegionTest {
|
||||
|
||||
def run1(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['F']){
|
||||
def jsonObject = OpenApiClient.addressMatch("重庆", row['C'], null, true, null, null)
|
||||
if(!row['F'] && row['A']){
|
||||
def jsonObject = OpenApiClient.addressMatch(row['A'], row['E'], null, true, row['B'],row['C'].toString())
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['F'] = jsonObject.get("id")
|
||||
row['G'] = jsonObject.get("city")
|
||||
@@ -66,42 +93,81 @@ class MatchEvaluateRegionTest {
|
||||
row['J'] = jsonObject.get("address")
|
||||
row['K'] = jsonObject.get("propertyType")
|
||||
row['L'] = jsonObject.get("map")
|
||||
// row['K'] = jsonObject.get("lng")
|
||||
// row['L'] = jsonObject.get("lat")
|
||||
row['M'] = jsonObject.get("lng")
|
||||
row['N'] = jsonObject.get("lat")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def pkPrice(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(row['R'] && row['R'].toString().toDouble().toInteger()==1){
|
||||
def obj = CommonDatautils.queryDistrictPrice(row['G'], row['H'], row['I'], DateUtils.parseFromTightByPattern("2022-05-22","yyyy-MM-dd"))
|
||||
if(!obj){
|
||||
row['R'] = ''
|
||||
row['S'] = "无最新价"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
def addPrice(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['L']){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(row['G'], row['H'], row['I'])
|
||||
if(priceObj){
|
||||
row['M'] = priceObj.avg_price
|
||||
row['N']= (int)(priceObj.avg_price * row['E'])
|
||||
row['O'] = priceObj.avg_price
|
||||
// row['N']= (int)(priceObj.avg_price * row['E'])
|
||||
}
|
||||
|
||||
def avg_price = findAvgPrice(row['F'])
|
||||
if(row['M'] && avg_price){
|
||||
def weekendPrice = row['M'].toString().toDouble()
|
||||
def ppe15 = Math.abs((weekendPrice - avg_price) * 100 / avg_price)
|
||||
row['O'] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, ppe15)
|
||||
def sqmetreRentPrice = CommonDatautils.findNewSqmetreRent(row['G'], row['H'], row['I'])
|
||||
if(sqmetreRentPrice){
|
||||
row['P'] = sqmetreRentPrice
|
||||
}
|
||||
|
||||
// def avg_price = findAvgPrice(row['F'])
|
||||
// if(row['M'] && avg_price){
|
||||
// def weekendPrice = row['M'].toString().toDouble()
|
||||
// def ppe15 = Math.abs((weekendPrice - avg_price) * 100 / avg_price)
|
||||
// row['O'] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, ppe15)
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
def addRentRate(){
|
||||
def citys = ["昆明","南宁","郑州","长沙","贵阳","乌鲁木齐","中山","湛江","南昌","海口"]
|
||||
def radioMap = [:]
|
||||
for(def city : citys) {
|
||||
def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1));
|
||||
def avg_radio = CommonDatautils.findCityAvgRentRadio(city, lastMonthDay)
|
||||
radioMap.put(city, avg_radio)
|
||||
}
|
||||
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
def city = row['G']
|
||||
if (row['F'] && row['O'] && !row['P']) {
|
||||
def avg_rent_radio = radioMap.get(city)
|
||||
if(avg_rent_radio){
|
||||
row['P'] = (int)(row['O']/avg_rent_radio)
|
||||
row['S'] = "租金推算1"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def addArroundPrice(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['M']) {
|
||||
def arroundObj = FangjiaClientUtils.arroundPrice(row['B'], row['D'])
|
||||
if(!row['O']) {
|
||||
def arroundObj = FangjiaClientUtils.arroundPrice(row['A'], row['E'])
|
||||
if (arroundObj && arroundObj.msgCode == 200 && arroundObj.result) {
|
||||
def priceObj = arroundObj.result
|
||||
row['M'] = priceObj.unitPrice
|
||||
row['N'] = (int) (priceObj.unitPrice * row['E'])
|
||||
row['Q'] = "周边价格"
|
||||
row['O'] = priceObj.unitPrice
|
||||
// row['N'] = (int) (priceObj.unitPrice * row['E'])
|
||||
row['S'] = "周边价格"
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -252,4 +318,295 @@ class MatchEvaluateRegionTest {
|
||||
});
|
||||
return avg_price
|
||||
}
|
||||
|
||||
def addSorce(){
|
||||
ExcelUtils.multiThreadingModify(path, { d ->
|
||||
if(d['F']){
|
||||
def score = findDistrictScore(d['F'])
|
||||
if(score){
|
||||
d['R'] = score
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def addArroundScore(){
|
||||
ExcelUtils.multiThreadingModify(path, { d ->
|
||||
if(!d['R'] && d['F']){
|
||||
def dist = null
|
||||
if(d['F'].toString().size()>16){
|
||||
dist = CommonDatautils.findDistrictById(d['F'])
|
||||
}
|
||||
|
||||
if(!dist){
|
||||
dist = new BasicDBObject()
|
||||
dist.city = d['G']
|
||||
dist.lng = d['M'].toString().toDouble()*10000000000L
|
||||
dist.lat = d['N'].toString().toDouble()*10000000000L
|
||||
}
|
||||
if(dist.lat){
|
||||
List<DBObject> list = DbUtils.findAroundDistrict(dist)
|
||||
if (list) {
|
||||
list = sortByDistance(dist, list);
|
||||
if(list && list.size()>10){
|
||||
list = list[0..9]
|
||||
}
|
||||
if(list){
|
||||
def scores = []
|
||||
for(def s : list){
|
||||
def score = findDistrictScore(s._id.toString())
|
||||
if(score){
|
||||
scores << score
|
||||
}
|
||||
}
|
||||
def arround_score =(int)(scores.sum()/scores.size())
|
||||
d['R'] = arround_score
|
||||
d['T'] = "周边小区评分2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def addArroundPriceByLat(){
|
||||
ExcelUtils.multiThreadingModify(path, { d ->
|
||||
if(!d['O'] && d['F'] && (d['K'].contains("住宅") || d['K'].contains("商住") ||d['K'].contains("别墅"))){
|
||||
def dist = null
|
||||
if(d['F'].toString().size()>16){
|
||||
dist = CommonDatautils.findDistrictById(d['F'])
|
||||
}
|
||||
|
||||
if(!dist){
|
||||
dist = new BasicDBObject()
|
||||
dist.city = d['G']
|
||||
dist.lng = d['M'].toString().toDouble()*10000000000L
|
||||
dist.lat = d['N'].toString().toDouble()*10000000000L
|
||||
}
|
||||
if(dist.lat){
|
||||
List<DBObject> list = DbUtils.findAroundDistrict(dist)
|
||||
if (list) {
|
||||
list = sortByDistance(dist, list);
|
||||
if(list && list.size()>10){
|
||||
list = list[0..9]
|
||||
}
|
||||
if(list){
|
||||
def prices = []
|
||||
for(def s : list){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(s.city, s.region, s.name)
|
||||
if(priceObj){
|
||||
prices << priceObj.avg_price
|
||||
}
|
||||
}
|
||||
if(prices){
|
||||
def arround_price =(int)(prices.sum()/prices.size())
|
||||
d['O'] = arround_price
|
||||
d['S'] = "周边均价3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
def sortByDistance(d, list){
|
||||
def newList = []
|
||||
for(def nb : list){
|
||||
def distance = GeoHelper.GetDistance(d.lat/10000000000.0, d.lng/10000000000.0, nb.lat/10000000000.0, nb.lng/10000000000.0)
|
||||
nb.distance = distance
|
||||
newList << nb
|
||||
}
|
||||
//排序
|
||||
Collections.sort(newList, new Comparator() {
|
||||
@Override
|
||||
int compare(Object o1, Object o2) {
|
||||
if(o1.distance > o2.distance)
|
||||
return 1;//第二个元素(o1)比第一个元素(o2)大,返回-1
|
||||
if(o1.distance == o2.distance)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
})
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findDistrictScore(id){
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("_id", id))
|
||||
def indexObj = ElasticUtils.executeSimpleQuery("192.168.0.12", "district_comp_potential", queryBuilder);
|
||||
def score = 0
|
||||
for(def h : indexObj){
|
||||
score = h.total_price_rate
|
||||
if(score){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return score
|
||||
}
|
||||
|
||||
|
||||
def addLevel() {
|
||||
def citys = ["昆明","南宁","郑州","长沙","贵阳","乌鲁木齐","中山","湛江","南昌","海口"]//
|
||||
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
||||
def cityLevelMap = [:]
|
||||
for(def city : citys){
|
||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city", "region","name"])
|
||||
def priceMap = CommonDatautils.queryDistrictPrice(city, weekend)
|
||||
def datas = addPriceData(dists, priceMap);
|
||||
datas = calcuteLevel(datas);
|
||||
cityLevelMap.put(city, ["price":priceMap, "level":datas])
|
||||
println city +" 楼盘评级同步完成"
|
||||
}
|
||||
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
|
||||
def address = row['E']
|
||||
def city = RegionData.formatCity(row['A'])
|
||||
|
||||
if(row['K'] && !row['K'].contains("住宅") && !row['K'].contains("商住") && !row['K'].contains("别墅")){
|
||||
if(city){
|
||||
def map = cityLevelMap.get(city)
|
||||
def rMap = null
|
||||
if(map){
|
||||
rMap = getArroundDistrictPriceByAddress(city, address, map.level)
|
||||
}
|
||||
|
||||
if(rMap){
|
||||
if(rMap.rank){
|
||||
row['Q'] = rMap.rank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def addPriceData(dists, priceMap){
|
||||
def newLists = []
|
||||
for(def d : dists){
|
||||
def price = priceMap.get(d.city+"##"+d.region+"##"+d.name);
|
||||
if(price){
|
||||
d.avg_price = price;
|
||||
newLists << d;
|
||||
}
|
||||
}
|
||||
if(newLists){
|
||||
newLists.sort {a,b->
|
||||
def v1 = a.avg_price
|
||||
def v2 = b.avg_price
|
||||
return v1.compareTo(v2)
|
||||
}
|
||||
}
|
||||
return newLists;
|
||||
}
|
||||
|
||||
def calcuteLevel(def datas){
|
||||
def total = datas.size()
|
||||
def v = (int)(total/10)
|
||||
def start = 0;
|
||||
def end = 0;
|
||||
def map = [:]
|
||||
for(int i=1;i<=10;i++){
|
||||
end = end + v;
|
||||
if(i == 10){
|
||||
map.put(i, [start, total])
|
||||
}else{
|
||||
map.put(i, [start, end])
|
||||
}
|
||||
start = end;
|
||||
}
|
||||
for(def d=0;d<datas.size();d++){
|
||||
def dist = datas[d]
|
||||
|
||||
for (def o in map) {
|
||||
def ranges = o.value
|
||||
def m = ranges[0]
|
||||
def n = ranges[1]
|
||||
if(d==0){
|
||||
if(d<=n){
|
||||
dist.level = 10 - o.key + 1
|
||||
break
|
||||
}
|
||||
}else{
|
||||
if(d>m && d<=n){
|
||||
dist.level = 10 - o.key + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
||||
def getArroundDistrictPriceByAddress(def city, def address, def levels){
|
||||
def json = GaoDeApiUtils.geo(city, address)
|
||||
def location = null
|
||||
def detail = new BasicDBObject()
|
||||
def level = null
|
||||
def rank = null
|
||||
if(json && json.count>=1){
|
||||
def m = json.geocodes[0]
|
||||
if(m){
|
||||
location = m.location
|
||||
level = m.level
|
||||
}
|
||||
}
|
||||
if(location){
|
||||
def arrs = location.split(",")
|
||||
detail.lng = arrs[0].toString().toDouble()*10000000000L
|
||||
detail.lat = arrs[1].toString().toDouble()*10000000000L
|
||||
}
|
||||
if(detail.lng){
|
||||
detail.city = city
|
||||
|
||||
List<DBObject> list = DbUtils.findAroundDistrictByRadius(detail, 3000)
|
||||
if(list && list.size()>10){
|
||||
list = sortByDistance(detail, list);
|
||||
try{
|
||||
list = list[0..9]
|
||||
}catch(Exception e){
|
||||
println list.size()
|
||||
}
|
||||
|
||||
}
|
||||
def arroundAvgPrice = getArroundAvgPrice(list)
|
||||
if(arroundAvgPrice){
|
||||
|
||||
def mod = Integer.MAX_VALUE;
|
||||
for(def d : levels){
|
||||
def newMod = java.lang.Math.abs( d.avg_price - arroundAvgPrice)
|
||||
if(newMod<mod){
|
||||
mod = newMod
|
||||
rank = d.level
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
def m = [:]
|
||||
m.level = level
|
||||
m.rank = rank
|
||||
return m
|
||||
}
|
||||
|
||||
def getArroundAvgPrice(def list){
|
||||
def prices = []
|
||||
for(def l : list){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(l.city, l.region, l.name)
|
||||
if(priceObj){
|
||||
prices << priceObj.avg_price
|
||||
}
|
||||
}
|
||||
if(prices){
|
||||
def avg_price = (prices.sum()/prices.size()).toInteger()
|
||||
return avg_price;
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+478
-20
@@ -3,8 +3,13 @@ package com.fangjia.script.chongqing
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.temp.shenjian.util.SeaweedUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.QueryOperators
|
||||
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
@@ -13,17 +18,470 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
class PocStat {
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1)
|
||||
|
||||
public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
|
||||
public static final DBCollection HOUSE_LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", lineUrl)
|
||||
public static final DBCollection LOUDONG_LINE_COLL = MongoUtils.getCollectionByName2("fangjia_base", "loudong", lineUrl)
|
||||
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10)
|
||||
|
||||
static main(args) {
|
||||
def task = new PocStat();
|
||||
task.regionDistStat();
|
||||
// task.regionDistStat();
|
||||
// task.sampleStat()
|
||||
// task.tradeStat()
|
||||
// task.paimaiStat()
|
||||
// task.evalStat()
|
||||
//
|
||||
// task.fileldStat()
|
||||
|
||||
// task.removeDelete()
|
||||
|
||||
// task.loudongStat()
|
||||
// task.houseLoudongStat()
|
||||
|
||||
task.houseLoudongStat2()
|
||||
|
||||
// task.updteHoledCount()
|
||||
}
|
||||
|
||||
def loudongStat(){
|
||||
def retMaps = getAllLouDong()
|
||||
def total_count = retMaps.keySet().size()
|
||||
|
||||
def all_floorsCount = 0;
|
||||
def all_buildYearCount = 0
|
||||
def all_householdsCount = 0
|
||||
def all_elevatorNumberCount = 0
|
||||
def all_roomCount = 0
|
||||
|
||||
def f_all_floorsCount = 0;
|
||||
def f_all_buildYearCount = 0
|
||||
def f_all_householdsCount = 0
|
||||
def f_all_elevatorNumberCount = 0
|
||||
def f_all_roomCount = 0
|
||||
|
||||
|
||||
def zRegions = ["渝中","大渡口","江北","沙坪坝","九龙坡","南岸","北碚","渝北","巴南"]
|
||||
|
||||
def z_count = 0
|
||||
def f_count = 0
|
||||
|
||||
retMaps.each{key,lists->
|
||||
def floorsCount = 0;
|
||||
def buildYearCount = 0
|
||||
def householdsCount = 0
|
||||
def elevatorNumberCount = 0
|
||||
def roomCount = 0
|
||||
|
||||
def f_floorsCount = 0;
|
||||
def f_buildYearCount = 0
|
||||
def f_householdsCount = 0
|
||||
def f_elevatorNumberCount = 0
|
||||
def f_roomCount = 0
|
||||
|
||||
def dist = CommonDatautils.findDistrictById(key)
|
||||
|
||||
if(zRegions.contains(dist.region)){
|
||||
z_count++
|
||||
}else{
|
||||
f_count++
|
||||
}
|
||||
|
||||
for(def row : lists){
|
||||
|
||||
if(zRegions.contains(dist.region)){
|
||||
|
||||
if(row.floors){
|
||||
floorsCount++
|
||||
}
|
||||
if(dist.finish_building_date){
|
||||
buildYearCount++
|
||||
}
|
||||
if(row.households){
|
||||
householdsCount++
|
||||
}else{
|
||||
if(row.room_count && row.floors){
|
||||
householdsCount++
|
||||
}
|
||||
}
|
||||
if(row.elevatorNumber && row.elevatorNumber>0){
|
||||
elevatorNumberCount++
|
||||
}
|
||||
|
||||
if(row.room_count>0){
|
||||
roomCount++
|
||||
}
|
||||
|
||||
}else{
|
||||
if(row.floors){
|
||||
f_floorsCount++
|
||||
}
|
||||
if(dist.finish_building_date){
|
||||
f_buildYearCount++
|
||||
}
|
||||
if(row.households){
|
||||
f_householdsCount++
|
||||
}else{
|
||||
if(row.room_count && row.floors){
|
||||
f_householdsCount++
|
||||
}
|
||||
}
|
||||
if(row.elevatorNumber && row.elevatorNumber>0){
|
||||
f_elevatorNumberCount++
|
||||
}
|
||||
|
||||
if(row.room_count>0){
|
||||
f_roomCount++
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def dist_total_count = lists.size()*0.6
|
||||
if(floorsCount >= dist_total_count){
|
||||
all_floorsCount ++
|
||||
}
|
||||
|
||||
if(buildYearCount >= dist_total_count){
|
||||
all_buildYearCount ++
|
||||
}
|
||||
|
||||
if(householdsCount >= dist_total_count){
|
||||
all_householdsCount ++
|
||||
}
|
||||
|
||||
if(elevatorNumberCount >= dist_total_count){
|
||||
all_elevatorNumberCount ++
|
||||
}
|
||||
|
||||
if(roomCount >= dist_total_count){
|
||||
all_roomCount ++
|
||||
}
|
||||
|
||||
|
||||
if(f_floorsCount >= dist_total_count){
|
||||
f_all_floorsCount ++
|
||||
}
|
||||
|
||||
if(f_buildYearCount >= dist_total_count){
|
||||
f_all_buildYearCount ++
|
||||
}
|
||||
|
||||
if(f_householdsCount >= dist_total_count){
|
||||
f_all_householdsCount ++
|
||||
}
|
||||
|
||||
if(f_elevatorNumberCount >= dist_total_count){
|
||||
f_all_elevatorNumberCount ++
|
||||
}
|
||||
if(f_roomCount >= dist_total_count){
|
||||
f_all_roomCount ++
|
||||
}
|
||||
}
|
||||
def floor_prec = DataHandleUtils.getDoubleRound(2, all_floorsCount*100/z_count)
|
||||
def year_prec = DataHandleUtils.getDoubleRound(2, all_buildYearCount*100/z_count)
|
||||
def households_prec = DataHandleUtils.getDoubleRound(2, all_householdsCount*100/z_count)
|
||||
def elevatorNum_prec = DataHandleUtils.getDoubleRound(2, all_elevatorNumberCount*100/z_count)
|
||||
def roomcount_prec = DataHandleUtils.getDoubleRound(2, all_roomCount*100/z_count)
|
||||
|
||||
|
||||
def f_floor_prec = DataHandleUtils.getDoubleRound(2, f_all_floorsCount*100/f_count)
|
||||
def f_year_prec = DataHandleUtils.getDoubleRound(2, f_all_buildYearCount*100/f_count)
|
||||
def f_households_prec = DataHandleUtils.getDoubleRound(2, f_all_householdsCount*100/f_count)
|
||||
def f_elevatorNum_prec = DataHandleUtils.getDoubleRound(2, f_all_elevatorNumberCount*100/f_count)
|
||||
def f_roomcount_prec = DataHandleUtils.getDoubleRound(2, f_all_roomCount*100/f_count)
|
||||
|
||||
println "floor "+ floor_prec
|
||||
println "year "+ year_prec
|
||||
println "households "+ households_prec
|
||||
println "elevator "+ elevatorNum_prec
|
||||
|
||||
def rets = []
|
||||
rets << ["城区","楼栋号","楼栋ID","物业类型","主朝向","地上层数","地下层数","竣工日期","梯","户","总户数","景观"]
|
||||
rets << ["主城区",100,100,100,0,floor_prec,0,year_prec,elevatorNum_prec,roomcount_prec,households_prec,0]
|
||||
rets << ["非主城区",100,100,100,0,f_floor_prec,0,f_year_prec,f_elevatorNum_prec,f_roomcount_prec,f_households_prec,0]
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\poc\\底层数据统计.xlsx",rets, "楼栋")
|
||||
}
|
||||
|
||||
|
||||
def houseLoudongStat2(){
|
||||
def zRegions = ["渝中","大渡口","江北","沙坪坝","九龙坡","南岸","北碚","渝北","巴南"]
|
||||
def dists = CommonDatautils.findAllDistrictByCity("重庆","district", ["city","region","name"])
|
||||
def z_count = 0
|
||||
def f_count = 0
|
||||
|
||||
def z_directionCount = 0
|
||||
def f_directionCount = 0
|
||||
|
||||
def f_sightCount = 0
|
||||
def z_sightCount = 0
|
||||
def index = 0
|
||||
for(def dist : dists){
|
||||
index ++
|
||||
def rets = getAllHouseLoudong2(dist._id.toString())
|
||||
println index +" "+rets.size()
|
||||
if(rets){
|
||||
def directionCount = 0
|
||||
def sightCount = 0
|
||||
for(def d : rets){
|
||||
if(d.direction){
|
||||
directionCount ++
|
||||
}
|
||||
if(d.sight){
|
||||
sightCount ++
|
||||
}
|
||||
}
|
||||
|
||||
def total = rets.size()*0.6
|
||||
if(zRegions.contains(dist.region)){
|
||||
z_count++
|
||||
|
||||
if(directionCount>=total){
|
||||
z_directionCount++
|
||||
}
|
||||
if(sightCount >=total){
|
||||
z_sightCount++
|
||||
}
|
||||
}else{
|
||||
f_count++
|
||||
|
||||
if(directionCount>=total){
|
||||
f_directionCount++
|
||||
}
|
||||
if(sightCount >=total){
|
||||
f_sightCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def z_direct_prec = DataHandleUtils.getDoubleRound(2, z_directionCount*100/z_count)
|
||||
def z_sight_prec = DataHandleUtils.getDoubleRound(2, z_sightCount*100/z_count)
|
||||
|
||||
def f_direct_prec = DataHandleUtils.getDoubleRound(2, f_directionCount*100/f_count)
|
||||
def f_sight_prec = DataHandleUtils.getDoubleRound(2, f_sightCount*100/f_count)
|
||||
def rets = []
|
||||
rets << ["城区","户号","户ID","主朝向","景观","户型结构"]
|
||||
rets << ["主城区",100,100,z_direct_prec, z_sight_prec, 100]
|
||||
rets << ["非主城区",100,100, f_direct_prec, f_sight_prec, 100]
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\poc\\底层数据统计.xlsx",rets, "户1")
|
||||
}
|
||||
|
||||
def houseLoudongStat(){
|
||||
def map = getAllHouseLoudong()
|
||||
def zRegions = ["渝中","大渡口","江北","沙坪坝","九龙坡","南岸","北碚","渝北","巴南"]
|
||||
|
||||
def z_count = 0
|
||||
def f_count = 0
|
||||
|
||||
def z_directionCount = 0
|
||||
def f_directionCount = 0
|
||||
|
||||
def f_sightCount = 0
|
||||
def z_sightCount = 0
|
||||
map.each{key,list->
|
||||
def dist = CommonDatautils.findDistrictById(key)
|
||||
def directionCount = 0
|
||||
def sightCount = 0
|
||||
for(def d : list){
|
||||
if(d.direction){
|
||||
directionCount ++
|
||||
}
|
||||
if(d.sight){
|
||||
sightCount ++
|
||||
}
|
||||
}
|
||||
|
||||
def total = list.size()*0.6
|
||||
if(zRegions.contains(dist.region)){
|
||||
z_count++
|
||||
|
||||
if(directionCount>=total){
|
||||
z_directionCount++
|
||||
}
|
||||
if(sightCount >=total){
|
||||
z_sightCount++
|
||||
}
|
||||
}else{
|
||||
f_count++
|
||||
|
||||
if(directionCount>=total){
|
||||
f_directionCount++
|
||||
}
|
||||
if(sightCount >=total){
|
||||
f_sightCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def z_direct_prec = DataHandleUtils.getDoubleRound(2, z_directionCount*100/z_count)
|
||||
def z_sight_prec = DataHandleUtils.getDoubleRound(2, z_sightCount*100/z_count)
|
||||
|
||||
def f_direct_prec = DataHandleUtils.getDoubleRound(2, f_directionCount*100/f_count)
|
||||
def f_sight_prec = DataHandleUtils.getDoubleRound(2, f_sightCount*100/f_count)
|
||||
def rets = []
|
||||
rets << ["城区","户号","户ID","主朝向","景观","户型结构"]
|
||||
rets << ["主城区",100,100,z_direct_prec, z_sight_prec, 100]
|
||||
rets << ["非主城区",100,100, f_direct_prec, f_sight_prec, 100]
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\poc\\底层数据统计.xlsx",rets, "户")
|
||||
}
|
||||
|
||||
def getAllHouseLoudong(){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city","重庆")
|
||||
q.put("district_id", new BasicDBObject(QueryOperators.EXISTS, true))
|
||||
|
||||
def keys = new BasicDBObject()
|
||||
keys.put("district_id",1)
|
||||
keys.put("direction",1)
|
||||
keys.put("sight",1)
|
||||
def dbcursor = HOUSE_LOUDONG_COLL.find(q).batchSize(5000)
|
||||
def retMap = [:]
|
||||
for(def d : dbcursor){
|
||||
def districtId = d.district_id
|
||||
if(districtId){
|
||||
def lists = retMap.get(districtId)
|
||||
if(!lists){
|
||||
lists = []
|
||||
retMap.put(districtId, lists)
|
||||
}
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
return retMap;
|
||||
}
|
||||
|
||||
|
||||
def getAllHouseLoudong2(districtId){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city","重庆")
|
||||
q.put("district_id", districtId)
|
||||
|
||||
def keys = new BasicDBObject()
|
||||
keys.put("district_id",1)
|
||||
keys.put("direction",1)
|
||||
keys.put("sight",1)
|
||||
def dbcursor = HOUSE_LOUDONG_COLL.find(q).batchSize(5000)
|
||||
def lists = []
|
||||
for(def d : dbcursor){
|
||||
lists << d
|
||||
}
|
||||
return lists;
|
||||
}
|
||||
|
||||
def getAllLouDong(){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city","重庆")
|
||||
q.put("id_in_seaweed", new BasicDBObject(QueryOperators.EXISTS, true))
|
||||
def dbcursor = LOUDONG_LINE_COLL.find(q).batchSize(5000)
|
||||
def retMap = [:]
|
||||
for(def d : dbcursor){
|
||||
def districtId = d.id_in_seaweed
|
||||
if(districtId){
|
||||
def lists = retMap.get(districtId)
|
||||
if(!lists){
|
||||
lists = []
|
||||
retMap.put(districtId, lists)
|
||||
}
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
return retMap;
|
||||
}
|
||||
|
||||
def updteHoledCount(){
|
||||
def datas = findAllLouDong()
|
||||
def totalCount = new AtomicLong()
|
||||
println datas.size()
|
||||
final CountDownLatch latch = new CountDownLatch(datas.size())
|
||||
for(def i=0;i<datas.size();i++){
|
||||
def arrs = datas[i].split("##")
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try {
|
||||
totalCount.addAndGet(1)
|
||||
def max_room = findHouseLouDongRoom(arrs)
|
||||
println totalCount.get() +" "+ max_room
|
||||
if(max_room){
|
||||
def q = new BasicDBObject()
|
||||
q.put("id_in_seaweed", arrs[0])
|
||||
q.put("house_num", arrs[1])
|
||||
if(arrs.size()>2){
|
||||
q.put("unit_num", arrs[2])
|
||||
}
|
||||
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("room_count", max_room)
|
||||
LOUDONG_LINE_COLL.update(q, new BasicDBObject('$set', udata), false, true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
latch.await()
|
||||
}
|
||||
|
||||
def findAllLouDong(){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city","重庆")
|
||||
q.put("id_in_seaweed", new BasicDBObject(QueryOperators.EXISTS, true))
|
||||
def dbcursor = LOUDONG_LINE_COLL.find(q)
|
||||
def keys = new HashSet()
|
||||
for(def d : dbcursor){
|
||||
def districtId = d.id_in_seaweed
|
||||
def key = districtId +"##"+d.house_num
|
||||
if(d.unit_num && d.unit_num!="0"){
|
||||
key = key + "##"+d.unit_num
|
||||
}
|
||||
if(!keys.contains(key)){
|
||||
keys << key
|
||||
}
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
def findHouseLouDongRoom(def arrs){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city","重庆")
|
||||
q.put("district_id", arrs[0])
|
||||
q.put("house_num", arrs[1])
|
||||
if(arrs.size()>2){
|
||||
q.put("unit_num", arrs[2])
|
||||
}
|
||||
def dbcursor = HOUSE_LOUDONG_COLL.find(q)
|
||||
def max_room = 0
|
||||
for(def d : dbcursor){
|
||||
def room = null
|
||||
if(d.room_num && d.room_num.contains("-")){
|
||||
room = d.room_num.substring(d.room_num.indexOf("-")+1, d.room_num.length())
|
||||
}else if(d.room_num && d.room_num.contains("0")){
|
||||
room = d.room_num.substring(d.room_num.toString().lastIndexOf("0")+1, d.room_num.length())
|
||||
}
|
||||
if(room && room.isNumber()){
|
||||
if(room.toInteger()>max_room){
|
||||
max_room = room.toInteger()
|
||||
}
|
||||
}
|
||||
}
|
||||
return max_room;
|
||||
}
|
||||
def removeDelete(){
|
||||
def dists = CommonDatautils.findAllDistrictByCity("重庆","district", ["city","region","name", "name_cat"])
|
||||
for(def obj : dists){
|
||||
def name_cat = obj.name_cat;
|
||||
if(name_cat==12){
|
||||
def count = CommonDatautils.findDistrictCount(obj.city, obj.region, obj.name, "district")
|
||||
if(count>1){
|
||||
println obj.name +" "+count
|
||||
DbUtils.seaweed.remove(new BasicDBObject("_id", obj._id))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def regionDistStat(){
|
||||
@@ -36,25 +494,25 @@ class PocStat {
|
||||
for(def region : set){
|
||||
def count = CommonDatautils.findDistrictCountByRegionBlock(city, region, null, "district")
|
||||
|
||||
def regionCount = 0
|
||||
def regionHouseLDCount = 0
|
||||
for(def d : dists){
|
||||
if(d.region == region){
|
||||
def loudongCount = CommonDatautils.findLoudong(d._id.toString())
|
||||
if(loudongCount && loudongCount>0){
|
||||
regionCount = regionCount+ loudongCount
|
||||
}
|
||||
|
||||
def houseLouDongCount = CommonDatautils.findHouseLoudong(d._id.toString())
|
||||
if(houseLouDongCount && houseLouDongCount>0){
|
||||
regionHouseLDCount = regionHouseLDCount + houseLouDongCount
|
||||
}
|
||||
}
|
||||
}
|
||||
rows << [region, count, regionCount, regionHouseLDCount]
|
||||
// def regionCount = 0
|
||||
// def regionHouseLDCount = 0
|
||||
// for(def d : dists){
|
||||
// if(d.region == region){
|
||||
// def loudongCount = CommonDatautils.findLoudong(d._id.toString())
|
||||
// if(loudongCount && loudongCount>0){
|
||||
// regionCount = regionCount+ loudongCount
|
||||
// }
|
||||
//
|
||||
// def houseLouDongCount = CommonDatautils.findHouseLoudong(d._id.toString())
|
||||
// if(houseLouDongCount && houseLouDongCount>0){
|
||||
// regionHouseLDCount = regionHouseLDCount + houseLouDongCount
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
rows << [region, count]
|
||||
println region +" Íê³É"
|
||||
}
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\poc\\底层数据统计.xlsx",rows, "各区楼盘量统计")
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\poc\\底层数据统计.xlsx",rows, "各区楼盘量统计1")
|
||||
}
|
||||
|
||||
def sampleStat(){
|
||||
|
||||
+87
-14
@@ -6,12 +6,17 @@ import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.temp.shenjian.util.SeaweedUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import groovy.sql.Sql
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class PocTest {
|
||||
|
||||
def total = 3259
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
def task = new PocTest();
|
||||
task.run();
|
||||
@@ -27,17 +32,21 @@ class PocTest {
|
||||
* @return
|
||||
*/
|
||||
def run(){
|
||||
def inputfile = "D:\\数据\\重庆农商行\\poc\\重庆农商行.xlsx"
|
||||
match(inputfile)
|
||||
addPrice(inputfile)
|
||||
addArroundPrice(inputfile)
|
||||
def inputfile = "D:\\数据\\重庆农商行\\poc\\test.xls"
|
||||
// match(inputfile)
|
||||
// addPrice(inputfile)
|
||||
// addArroundPrice(inputfile)
|
||||
// standard(inputfile)
|
||||
// addLoudongNum(inputfile)
|
||||
|
||||
|
||||
// addAuthor(inputfile)
|
||||
|
||||
// pkPrice(inputfile)
|
||||
|
||||
// addPpeValue(inputfile)
|
||||
|
||||
// matchMap(inputfile)
|
||||
|
||||
standard(inputfile)
|
||||
addLoudongNum(inputfile)
|
||||
|
||||
|
||||
|
||||
// addDetail(inputfile, "D:\\数据\\重庆农商行\\poc\\楼盘详情.xlsx")
|
||||
//
|
||||
// createLoudong(inputfile,"D:\\数据\\重庆农商行\\poc\\底层数据-楼栋-户.xlsx")
|
||||
@@ -47,6 +56,36 @@ class PocTest {
|
||||
// createEvaluation(inputfile,"D:\\数据\\重庆农商行\\poc\\挂牌成交评估案例.xlsx")
|
||||
}
|
||||
|
||||
def addPpeValue(inputfile){
|
||||
ExcelUtils.multiThreadingModify(inputfile, { row ->
|
||||
if(row['F'] && row['R']){
|
||||
def avg_price = findAvgPrice(row['R'])
|
||||
if(avg_price){
|
||||
def ppe15 = Math.abs((row['F'] - avg_price) * 100 / avg_price)
|
||||
row['Z'] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, ppe15)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def pkPrice(path){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
def commid = row['R']
|
||||
if(commid){
|
||||
def dist = CommonDatautils.findDistrictById(commid.trim())
|
||||
if(dist){
|
||||
def jsonObject = OpenApiClient.webankEvaluate(dist.city, dist.region, dist.name, row['E'].toString())
|
||||
if(jsonObject != null && jsonObject.code==200) {
|
||||
def result = jsonObject.result
|
||||
if(result){
|
||||
row['Y'] = result.get("unitPrice")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def match(path){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
@@ -54,7 +93,7 @@ class PocTest {
|
||||
def city = row['B']
|
||||
def address = row['D']
|
||||
def region = row['C']
|
||||
println "city:"+city+" region:"+region+" address:"+address
|
||||
println "[match] city:"+city+" region:"+region+" address:"+address
|
||||
def jsonObject = OpenApiClient.addressMatch(city, address, "property", false, region, null)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['Q'] = jsonObject.get("name")
|
||||
@@ -95,8 +134,9 @@ class PocTest {
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
def commid = row['R']
|
||||
if(commid){
|
||||
def dist = CommonDatautils.findDistrictById(commid)
|
||||
def dist = CommonDatautils.findDistrictById(commid.trim())
|
||||
if(dist){
|
||||
row['Q'] = dist.name
|
||||
def priceObj = CommonDatautils.findDistrictPrice(dist.city, dist.region, dist.name)
|
||||
if(priceObj){
|
||||
row['F'] = priceObj.avg_price
|
||||
@@ -106,6 +146,8 @@ class PocTest {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
def addArroundPrice(path){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['F']) {
|
||||
@@ -156,8 +198,8 @@ class PocTest {
|
||||
if (jsonObject && jsonObject.result) {
|
||||
if(jsonObject.result.size()>=1){
|
||||
def obj = jsonObject.result[0]
|
||||
row['T'] = obj.id
|
||||
row['S'] = obj.houseNumber
|
||||
row['T'] = obj.id
|
||||
row['S'] = obj.houseNumber
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +214,7 @@ class PocTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -590,4 +633,34 @@ class PocTest {
|
||||
}
|
||||
ExcelUtils.write(output, rows, "成交案例")
|
||||
}
|
||||
|
||||
def addAuthor(def path){
|
||||
def authors = ["丁世菁","王文艳","董彦均","曹玉彦","姚静梦","付贵生","赵灵芝","沈健","许镕杰","徐鹤","穆良书","沈燕芳"]
|
||||
def personTotal = authors.size()
|
||||
def avg = Math.ceil(total/personTotal)
|
||||
|
||||
def index = 0
|
||||
def count = 0;
|
||||
ExcelUtils.modify(path, { row ->
|
||||
if(row['B']){
|
||||
if(index < avg){
|
||||
row['X'] = authors[count]
|
||||
}
|
||||
index++
|
||||
if(index >= avg){
|
||||
count++
|
||||
index = 0
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def findAvgPrice(def commid){
|
||||
def sql = "select year_month,target_avg_price from (select year_month,target_avg_price from avm_evaluation_item_gj where commid='${commid}' order by year_month desc) where rownum<2";
|
||||
def avg_price = null
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
avg_price = r.target_avg_price
|
||||
});
|
||||
return avg_price
|
||||
}
|
||||
}
|
||||
|
||||
+14
-6
@@ -3079,18 +3079,26 @@ class CommonDatautils {
|
||||
queryCondition.put("region", region);
|
||||
queryCondition.put("district_name", name);
|
||||
queryCondition.put('weekend', new BasicDBObject('$gte', startDate).append('$lte', endDate));
|
||||
DBCursor cur = DIST_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1)).limit(1)
|
||||
DBCursor cur = DIST_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1))
|
||||
cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
DBObject dbo;
|
||||
def prices = []
|
||||
def index = 0
|
||||
while(cur.hasNext()) {
|
||||
dbo = cur.next()
|
||||
def price = dbo.get("avg_price");
|
||||
if(price){
|
||||
break;
|
||||
def obj = cur.next()
|
||||
if(index == 0){
|
||||
dbo = obj
|
||||
}
|
||||
prices << obj.get("avg_price");
|
||||
index++
|
||||
}
|
||||
|
||||
return dbo;
|
||||
if(prices){
|
||||
def avg_price = (int)(prices.sum()/prices.size())
|
||||
dbo.avg_price = avg_price
|
||||
return dbo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+86
-5
@@ -6,10 +6,16 @@ import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.jusfoun.JusfounCommon
|
||||
import com.fangjia.script.util.DateUtil
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import java.text.DecimalFormat
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
@@ -19,8 +25,11 @@ import java.util.concurrent.TimeUnit
|
||||
class DistrictPriceExportBatch extends BaseBatch{
|
||||
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
def lastMonthDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"));
|
||||
def charset = "GBK"
|
||||
|
||||
public static final DBCollection FZ_DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("business", "fz_district_stat", "mongo.db.fangjia.com")
|
||||
|
||||
static main(args) {
|
||||
runBatch(new DistrictPriceExportBatch(), args)
|
||||
}
|
||||
@@ -32,6 +41,9 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
|
||||
def ret = createDatas("¸£ÖÝ")
|
||||
|
||||
saveToDB(ret)
|
||||
|
||||
|
||||
def fileName = "/fzbank/output/FJW_DISTRICT_STAT_"+curDate+".csv"
|
||||
def dataCodeFileName = "/fzbank/output/FJW_DISTRICT_STAT_"+curDate+".sha512"
|
||||
if(CommonDatautils.isWindow()){
|
||||
@@ -76,10 +88,10 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
|
||||
def createDatas(def city){
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", null);
|
||||
|
||||
def lastDate = new Date()
|
||||
def startDate = DateUtils.getFirstDayOfMonth(lastDate, -1)
|
||||
|
||||
def endDateStr = DateUtils.formatDateByPattern(new Date(), "yyyy-MM")+"-10"
|
||||
def dataStr = DateUtils.add(endDateStr, -30)
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD(dataStr)
|
||||
def lastDate = DateUtils.parseFromTightByPattern(endDateStr, "yyyy-MM-dd")
|
||||
// List<String> list2 = FileUtils.readLines(new File("D:\\Êý¾Ý\\¸£ÖÝ\\FJW_DISTRICT_STAT_202111.csv"))
|
||||
// def map2 = [:]
|
||||
// for(def s : list2) {
|
||||
@@ -88,17 +100,34 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
// map2.put(key, row[5])
|
||||
// }
|
||||
|
||||
def lastMonthPriceMap = findFzDistrictStat("¸£ÖÝ",lastMonthDate)
|
||||
def result = []
|
||||
for(def rMap : districts){
|
||||
|
||||
def dbo = CommonDatautils.queryDistrictPriceByDate3(city, rMap.region, rMap.name, startDate, lastDate)
|
||||
if(dbo){
|
||||
def lastMonthPrice = lastMonthPriceMap.get(rMap.get("_id").toString())
|
||||
def curPrice = dbo.get("avg_price")
|
||||
if(lastMonthPrice && curPrice){
|
||||
def markup = (curPrice - lastMonthPrice)*100/lastMonthPrice
|
||||
if(Math.abs(markup)>3){
|
||||
def randMarkup = nextDouble(0, 3)
|
||||
if(markup < 0){
|
||||
markup = randMarkup*(-1)
|
||||
}else{
|
||||
markup = randMarkup
|
||||
}
|
||||
curPrice = (int)(lastMonthPrice*markup/100 + lastMonthPrice)
|
||||
}
|
||||
}
|
||||
|
||||
def m = []
|
||||
m << dbo.get("_id").toString()//¾ù¼ÛID
|
||||
m << rMap.get("_id").toString()//Â¥ÅÌID
|
||||
m << rMap.city
|
||||
m << rMap.region
|
||||
m << rMap.name
|
||||
m << dbo.get("avg_price")
|
||||
m << curPrice
|
||||
// def lastMonthPrice = map2.get(rMap.city + "##" + rMap.region+"##"+rMap.name)
|
||||
// if(lastMonthPrice && dbo.get("avg_price")){
|
||||
// lastMonthPrice = lastMonthPrice.toInteger()
|
||||
@@ -125,6 +154,19 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
def findFzDistrictStat(city,lastMonthDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("month", lastMonthDate)
|
||||
def dbcursor = FZ_DISTRICT_STAT_COLL.find(q)
|
||||
def priceMap = [:]
|
||||
for(def d : dbcursor){
|
||||
priceMap.put(d.comm_id, d.avg_price)
|
||||
}
|
||||
return priceMap
|
||||
}
|
||||
|
||||
def export(def fileName, def datas){
|
||||
def headers = ["id","comm_id","city","district","name","avg_price","year_month"]
|
||||
writeCSV(headers, fileName, datas);
|
||||
@@ -152,5 +194,44 @@ class DistrictPriceExportBatch extends BaseBatch{
|
||||
file.append(System.getProperty("line.separator"));
|
||||
}
|
||||
}
|
||||
|
||||
//Ëæ»ú¸¡µãÊý
|
||||
public static double nextDouble(final double min, final double max) throws Exception {
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
if (max < min) {
|
||||
throw new Exception("min < max");
|
||||
}
|
||||
if (min == max) {
|
||||
return min;
|
||||
}
|
||||
return Double.parseDouble(df.format(min + ((max - min) * new Random().nextDouble())));
|
||||
}
|
||||
|
||||
def saveToDB(rets){
|
||||
for(def r : rets){
|
||||
def q = new BasicDBObject()
|
||||
q.put("month", curDate.toInteger())
|
||||
q.put("comm_id", r[1])
|
||||
def obj = FZ_DISTRICT_STAT_COLL.findOne(q)
|
||||
if(obj){
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("m_date", new Date())
|
||||
udata.put("avg_price", r[5])
|
||||
FZ_DISTRICT_STAT_COLL.update(q, new BasicDBObject('$set', udata))
|
||||
}else{
|
||||
def udata = new BasicDBObject()
|
||||
def o = new BasicDBObject()
|
||||
o.put("_id", new ObjectId(r[0]))
|
||||
o.put("comm_id", r[1])
|
||||
o.put("city", r[2])
|
||||
o.put("region", r[3])
|
||||
o.put("name", r[4])
|
||||
o.put("avg_price", r[5].toInteger())
|
||||
o.put("month", r[6].toInteger())
|
||||
FZ_DISTRICT_STAT_COLL.save(o)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+73
-7
@@ -8,7 +8,9 @@ import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import com.rabbitmq.client.impl.AMQImpl
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
/**
|
||||
* 福州数据结果统计
|
||||
@@ -17,16 +19,42 @@ class FzDataResultStat {
|
||||
|
||||
public static final DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName("fangjia", "region_stat", "mongo.db.fangjia.com")
|
||||
|
||||
public static final DBCollection FZ_DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("business", "fz_district_stat", "mongo.db.fangjia.com")
|
||||
|
||||
static main(args) {
|
||||
def task = new FzDataResultStat()
|
||||
task.priceMarkupRun();
|
||||
task.regionPriceTrendRun()
|
||||
//// task.margeExcel()
|
||||
// task.saveCsvData()
|
||||
}
|
||||
|
||||
def margeExcel(){
|
||||
|
||||
def list2= ExcelUtils.read("D:\\数据\\福州\\价格比对_202204_新2.xlsx", 0 ,1)
|
||||
|
||||
def map2 = [:]
|
||||
for(def s : list2){
|
||||
def key = s["A"]+"##"+s["B"]+"##"+s["C"]
|
||||
map2.put(key, s["D"])
|
||||
}
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\福州\\价格比对_202204_新3.xlsx",{row->
|
||||
if(row["A"]){
|
||||
def key = row["A"]+"##"+row["B"]+"##"+row["C"]
|
||||
def price = map2.get(key)
|
||||
if(price){
|
||||
row['L'] = price
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
def priceMarkupRun(){
|
||||
def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"));
|
||||
|
||||
List<String> list1= FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${curMonth}.csv"))
|
||||
|
||||
def map1 = [:]
|
||||
for(def s : list1){
|
||||
def row = s.split("@\\|@")
|
||||
@@ -137,16 +165,13 @@ class FzDataResultStat {
|
||||
queryCondition.put('weekend', new BasicDBObject('$gte', startDate).append('$lte',endDate));
|
||||
DBCursor cur = REGION_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1))
|
||||
cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def price = 0;
|
||||
def prices = [];
|
||||
while(cur.hasNext()) {
|
||||
DBObject dbo = cur.next()
|
||||
price = dbo.get("avg_price");
|
||||
if(price){
|
||||
break;
|
||||
}
|
||||
prices << dbo.get("avg_price");
|
||||
}
|
||||
|
||||
return price;
|
||||
def avg_price = (int)(prices.sum()/prices.size())
|
||||
return avg_price;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,4 +190,45 @@ class FzDataResultStat {
|
||||
weekends = weekends.reverse();
|
||||
return weekends;
|
||||
}
|
||||
|
||||
|
||||
def saveCsvData(){
|
||||
def files = getAllFiles("C:\\Users\\gaojuan\\福州数据(1)")
|
||||
if(files){
|
||||
for(def filepath : files){
|
||||
List<String> list1= FileUtils.readLines(filepath)
|
||||
println filepath
|
||||
for(def s : list1){
|
||||
def row = s.split("@\\|@")
|
||||
def o = new BasicDBObject()
|
||||
o.put("_id", new ObjectId(row[0]))
|
||||
o.put("comm_id", row[1])
|
||||
o.put("city", row[2])
|
||||
o.put("region", row[3])
|
||||
o.put("name", row[4])
|
||||
o.put("avg_price", row[5].toInteger())
|
||||
o.put("month", row[6].toInteger())
|
||||
FZ_DISTRICT_STAT_COLL.save(o)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def static getAllFiles(def path) {
|
||||
|
||||
File file = new File(path);
|
||||
File[] tempList = file.listFiles();
|
||||
|
||||
def files = [];
|
||||
for (int i = 0; i < tempList.length; i++) {
|
||||
if (tempList[i].isFile()) {
|
||||
files << tempList[i];
|
||||
}
|
||||
if (tempList[i].isDirectory()) {
|
||||
System.out.println("文件夹:" + tempList[i]);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.mongodb.DBCollection
|
||||
//福州第三方均价统计,发送钉钉消息
|
||||
//def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1)
|
||||
//def datas = CsvUtils.read("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv");
|
||||
def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202203.csv")
|
||||
def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202204.csv")
|
||||
def count0 = 0
|
||||
def count1 = 0
|
||||
def count2 = 0
|
||||
@@ -137,7 +137,7 @@ ExcelUtils.write("d:\\
|
||||
def s = "第三方均价总量:${total}\n6区总量:${regionCount}\ncount1: "+ count1+"( "+pre1+"% )\ncount2: "+ count2+"( "+pre2+"% )\ncount3: "+count3+"( "+pre3+"% )\ncount4: "+count4+"( "+pre4+"% )\ncount5: "+count5+"( "+pre5+"% )\ncount6: "+count6+"( "+pre6+"% )\ncount7: "+count7+"( "+pre7+"%)\ncount8: "+count8+"( "+pre8+"% )\ncount9: "+count9+" ("+pre9+"% )"
|
||||
println s
|
||||
def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60"
|
||||
DingDingMessageUtil.sendTextMessage(access_token, s)
|
||||
//DingDingMessageUtil.sendTextMessage(access_token, s)
|
||||
|
||||
|
||||
////def districts = CommonDatautils.findAllDistricts("福州", "district", ["city", "region", "name"]);
|
||||
|
||||
+17
-11
@@ -112,22 +112,28 @@ class TradeExportBatch extends BaseBatch{
|
||||
// q.put("trade_date", new BasicDBObject(QueryOperators.LT, endDate))
|
||||
def cursor = DEAL_PRICE.find(q).addOption(Bytes.QUERYOPTION_NOTIMEOUT).batchSize(1000);
|
||||
def rets = []
|
||||
def keys = []
|
||||
if (cursor != null) {
|
||||
while (cursor.hasNext()) {
|
||||
DBObject dbo = cursor.next();
|
||||
def district = districtMap.get(dbo.city + "_" + dbo.region + "_" + dbo.district_name);
|
||||
if(district){
|
||||
def ret = [];
|
||||
ret << dbo._id.toString()
|
||||
ret << district._id.toString()
|
||||
ret << dbo.city
|
||||
ret << dbo.region
|
||||
ret << dbo.district_name
|
||||
ret << dbo.avg_price
|
||||
ret << dbo.area
|
||||
ret << DateUtils.formatDateByPattern(dbo.trade_date, "yyyy-MM-dd")
|
||||
ret << dbo.total_price
|
||||
rets << ret;
|
||||
def tradeDateStr = DateUtils.formatDateByPattern(dbo.trade_date, "yyyy-MM-dd")
|
||||
def key = district._id.toString() +"##" + dbo.avg_price +"##"+dbo.area+"##"+tradeDateStr
|
||||
if(!keys.contains(key)){
|
||||
keys << key
|
||||
def ret = [];
|
||||
ret << dbo._id.toString()
|
||||
ret << district._id.toString()
|
||||
ret << dbo.city
|
||||
ret << dbo.region
|
||||
ret << dbo.district_name
|
||||
ret << dbo.avg_price
|
||||
ret << dbo.area
|
||||
ret << tradeDateStr
|
||||
ret << dbo.total_price
|
||||
rets << ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
println "³É½»×ܼƣº"+rets.size()
|
||||
|
||||
+6
-6
@@ -199,18 +199,18 @@ class CcbCodeUtils {
|
||||
static def getBuildStructureCode(def buildStructure){
|
||||
if(buildStructure){
|
||||
if(buildStructure.contains("钢结构")){
|
||||
return "001";
|
||||
return "3";
|
||||
}else if(buildStructure.contains("钢、钢筋混凝土结构")){
|
||||
return "002";
|
||||
return "1";
|
||||
}else if(buildStructure.contains("钢筋混凝土结构")){
|
||||
return "003";
|
||||
return "1";
|
||||
}else if(buildStructure.contains("砖木结构")){
|
||||
return "004";
|
||||
return "10";
|
||||
}else if(buildStructure.contains("混合结构")){
|
||||
return "005";
|
||||
return "2";
|
||||
}
|
||||
}
|
||||
return "006";
|
||||
return "11";
|
||||
}
|
||||
|
||||
static def getDistHouseTypeCode(def estateType){
|
||||
|
||||
@@ -50,4 +50,32 @@ class FileUtils {
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
static def createTxtFile(ret, fileName, charset, isAppend){
|
||||
File file = new File(fileName);
|
||||
if (!file.getParentFile().exists()) {
|
||||
boolean result = file.getParentFile().mkdirs();
|
||||
if (!result) {
|
||||
System.out.println("´´½¨Ä¿Â¼Ê§°Ü");
|
||||
}
|
||||
}
|
||||
|
||||
OutputStream out = new FileOutputStream(fileName, isAppend);
|
||||
def sb = new StringBuffer();
|
||||
out.write(sb.toString().getBytes(charset));
|
||||
sb.setLength(0)
|
||||
def index = 0
|
||||
for(def row : ret){
|
||||
if(row){
|
||||
index++
|
||||
sb.append(row)
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
if(sb.length()>0){
|
||||
out.write(sb.toString().getBytes(charset));
|
||||
sb.setLength(0)
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
+69
-10
@@ -1,10 +1,13 @@
|
||||
package com.fangjia.script.gj.crawl
|
||||
|
||||
import com.fangjia.script.crawl.JQueryUtils
|
||||
import com.fangjia.script.thirdPriceCrawl.CrawalDBUtil
|
||||
import com.fangjia.script.thirdPriceCrawl.Utils
|
||||
import com.fangjia.script.util.ABuYunUtil
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.rabbitmq.client.impl.AMQImpl
|
||||
import net.sf.json.JSONObject
|
||||
import org.jsoup.Jsoup
|
||||
import org.openqa.selenium.WebDriver
|
||||
@@ -12,16 +15,21 @@ import org.openqa.selenium.chrome.ChromeDriver
|
||||
|
||||
class AnjukeAppCrawl {
|
||||
|
||||
public static final SHORT_DATE = Utils.getLastMonth();
|
||||
def static final DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol();
|
||||
public static def SOURCE = "安居客";
|
||||
DBCollection detail = MongoUtils.getCollectionByAuth20190102("fangjia_craw", "app_anjuke_detail")
|
||||
|
||||
static main(args) {
|
||||
def task = new AnjukeAppCrawl();
|
||||
task.run();
|
||||
// task.run();
|
||||
// task.run2()
|
||||
|
||||
task.addThirdPrice()
|
||||
}
|
||||
|
||||
def run2(){
|
||||
def url = "https://m.anjuke.com/fz/community/"
|
||||
def url = "https://m.anjuke.com/sh/community/"
|
||||
System.setProperty("webdriver.chrome.driver", "C:\\Users\\gaojuan\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");
|
||||
System.setProperty("http.nonProxyHosts", "localhost");
|
||||
WebDriver driver = new ChromeDriver()
|
||||
@@ -95,17 +103,28 @@ class AnjukeAppCrawl {
|
||||
|
||||
|
||||
def run(){
|
||||
//上海:11,北京:14
|
||||
//"仓山":4071,
|
||||
def map = ["쐈갛":4070,"뮬짜":4068,"츙븜":4073,"憩쉭":4069,"르헌":16378,"낀있":15880,"쯩棺":4072,"젯쉭":16380,"틱繭":16387,"쭈都":16382,"湛揭":16392,"츙헌":16384]
|
||||
map.each{region, area_id->
|
||||
// def map = ["晋安":4070,"鼓楼":4068,"闽侯":4073,"台江":4069,"福清":16378,"长乐":15880,"马尾":4072,"连江":16380,"平潭":16387,"罗源":16382,"永泰":16392,"闽清":16384]
|
||||
// def regionMap = ["浦东":7,"闵行":11, "松江":15,"宝山":13,"嘉定":14,"徐汇":5,"青浦":19,"静安":2,"普陀":10,"杨浦":9,"奉贤":17,"黄浦":4,"虹口":8,"长宁":6,"金山":18,"崇明":20]
|
||||
def regionMap = [ "朝阳":642,"海淀":601,"昌平":843,"丰台":753,"大兴":865,"通州":818,"房山":802,"顺义":837,"西城":704,"东城":690,"密云":856,"石景山":787,"怀柔":858,"门头沟":815,"延庆":860,"平谷":863,"北京周边":2678]
|
||||
def cityMap = ["北京":regionMap]
|
||||
def cityId = 14
|
||||
regionMap.each{region, area_id->
|
||||
for(def i=1;i<40;i++){
|
||||
def stop = false;
|
||||
def all_stop = false
|
||||
def error_count=0
|
||||
while(!stop){//渝北:2359 南岸:2368 沙坪坝:2380
|
||||
//城口
|
||||
def flagMap = getInfo(stop, i, area_id)
|
||||
def flagMap = getInfo(stop, i, area_id, cityId, "上海")
|
||||
stop = flagMap.stop
|
||||
all_stop = flagMap.all_stop
|
||||
error_count++
|
||||
if(error_count>=20){
|
||||
stop = true
|
||||
all_stop = true
|
||||
}
|
||||
}
|
||||
if(all_stop){
|
||||
break;
|
||||
@@ -114,17 +133,17 @@ class AnjukeAppCrawl {
|
||||
}
|
||||
}
|
||||
|
||||
def getInfo(def stop, def i, def area_id){
|
||||
def getInfo(def stop, def i, def area_id, def cityId, def city){
|
||||
|
||||
def map = [:]
|
||||
def url = "https://m.anjuke.com/esf-ajax/community/list?city_id=35&page_size=100&page=${i}&area_id=${area_id}&is_tw=1"
|
||||
def url = "https://m.anjuke.com/esf-ajax/community/list?city_id=${cityId}&page_size=100&page=${i}&area_id=${area_id}&is_tw=1"
|
||||
|
||||
def header = [:]
|
||||
def header = [:]
|
||||
header.put("accept","application/json, text/plain, */*")
|
||||
header.put("accept-encoding","gzip, deflate, br")
|
||||
header.put("accept-language","zh-CN,zh;q=0.9")
|
||||
header.put("cookie","aQQ_ajkguid=E9796514-38C0-44D2-8CA3-1C58C3928B29; sessid=765EEB9D-E7A2-4B2C-8151-CA9CD939AB02; id58=CpQB22J8sqMA9stuJfeAAg==; twe=2; 58tj_uuid=bf6eaff8-851c-471a-a914-853242878ddc; als=0; seo_source_type=1; _ga=GA1.2.215255179.1652344695; isp=true; ajk-appVersion=; obtain_by=2; fzq_js_anjuke_ershoufang_m=c2c12b2d1b221734fa20ef752cd6bdc0_1652509223606_27; fzq_h=ef0186eeaba082ecd2a47ede7c7e3e64_1652533612190_a34c026e9c1842a3b35bdd37f3d2aa0b_2015773878; init_refer=https%253A%252F%252Fm.anjuke.com%252Fcq%252Fcommunity%252F; new_uv=8; wmda_uuid=b59ce2efbba070ecfa8fe93d79f30dd4; wmda_new_uuid=1; wmda_session_id_6145577459763=1652535525740-dae51249-3379-d4e7; wmda_visited_projects=%3B6145577459763; new_session=0; xxzl_cid=4601bb59d47e4b42beb192b17946d1dd; xxzl_deviceid=q9XQbdA9hhkHJTj+RgVpwc7jrBzVJp9J1uTlp4hDtRiXtA615K4HS4R0pJ1dgrBa; ctid=20; xxzl_cid=4601bb59d47e4b42beb192b17946d1dd; fzq_js_anjuke_xiaoqu_m=c80eeca4a3301dbf27b3c79b9f18fa3b_1652536277223_27; xzuid=81992155-5990-4a2f-8842-32bcbfbb1117")
|
||||
header.put("referer","https://m.anjuke.com/fz/community/")
|
||||
header.put("referer","https://m.anjuke.com/sh/community/")
|
||||
header.put("sec-fetch-dest","empty")
|
||||
header.put("sec-fetch-mode","cors")
|
||||
header.put("sec-fetch-site","same-origin")
|
||||
@@ -134,6 +153,7 @@ class AnjukeAppCrawl {
|
||||
|
||||
def ret = ABuYunUtil.doGet(url, null, null, "utf-8")
|
||||
def all_stop = false;
|
||||
def error_count = 0
|
||||
if (ret) {
|
||||
JSONObject jsonObj = JSONObject.fromObject(ret);
|
||||
if(jsonObj && jsonObj.status=="ok" ){
|
||||
@@ -143,7 +163,7 @@ class AnjukeAppCrawl {
|
||||
|
||||
println "【${i}】 "+communities.size() +" "+url
|
||||
if(communities.size()>0){
|
||||
save("르鹵", communities)
|
||||
save(city, communities)
|
||||
Thread.sleep(10000)
|
||||
stop = true;
|
||||
}else{
|
||||
@@ -154,6 +174,7 @@ class AnjukeAppCrawl {
|
||||
|
||||
}else{
|
||||
stop = false;
|
||||
error_count ++
|
||||
println url +" 无数据"
|
||||
}
|
||||
|
||||
@@ -195,4 +216,42 @@ class AnjukeAppCrawl {
|
||||
q.put("jumpAction",url)
|
||||
return detail.findOne(q);
|
||||
}
|
||||
|
||||
def addThirdPrice(){
|
||||
def q = new BasicDBObject()
|
||||
def dbcursor = detail.find(q)
|
||||
def index = 0
|
||||
for(def d : dbcursor){
|
||||
index++
|
||||
def city = d.base.cityName
|
||||
def region = d.base.areaName
|
||||
def name = d.base.name
|
||||
def obj = findByParams(city, region, name);
|
||||
if(!obj){
|
||||
def data = new BasicDBObject()
|
||||
data.put("district_id",d.base.id)
|
||||
data.put("city", city)
|
||||
data.put("region", region )
|
||||
data.put("name", name)
|
||||
data.put("address",d.base.address)
|
||||
data.put("avg_price", d.priceInfo.price)
|
||||
data.put("source", SOURCE)
|
||||
data.put("s_date", SHORT_DATE)
|
||||
data.put("c_date", d.c_date)
|
||||
thirdPartyColl.save(data)
|
||||
println index +" "+data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def findByParams(city, region, name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("region", region)
|
||||
q.put("name", name)
|
||||
q.put("source", SOURCE)
|
||||
q.put("s_date", SHORT_DATE)
|
||||
return thirdPartyColl.findOne(q);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-10
@@ -22,9 +22,9 @@ class AnjukeToDB {
|
||||
|
||||
static main(args) {
|
||||
def task = new AnjukeToDB();
|
||||
// task.run();
|
||||
task.run();
|
||||
// task.addNoMatch()
|
||||
task.updateEstateType()
|
||||
// task.updateEstateType()
|
||||
// task.gaodeRangeData()
|
||||
}
|
||||
|
||||
@@ -315,16 +315,16 @@ class AnjukeToDB {
|
||||
}
|
||||
}
|
||||
def run(){
|
||||
def datas = ExcelUtils.read("D:\\数据\\重庆农商行\\安居客\\安居客重庆小区-芝芝.xlsx",0,1)
|
||||
def datas = ExcelUtils.read("D:\\数据\\重庆农商行\\安居客\\非人工处理.xlsx",0,1)
|
||||
for(def data : datas){
|
||||
if(data['K']=="芝芝"){
|
||||
// if(data['K']=="镕杰"){
|
||||
def flag = data['M']
|
||||
if(flag && flag=="ÐÂÔö"){
|
||||
add(data)
|
||||
// add(data)
|
||||
}else{
|
||||
update(data)
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,8 +445,6 @@ class AnjukeToDB {
|
||||
}
|
||||
if(!addr_alias.contains(obj.base.address) && obj.base.address.contains("ºÅ")){
|
||||
addr_alias << obj.base.address
|
||||
}
|
||||
if(addr_alias!=dist.addr_alias && addr_alias.size()>0){
|
||||
udata.put("addr_alias", addr_alias)
|
||||
}
|
||||
}
|
||||
@@ -555,8 +553,13 @@ class AnjukeToDB {
|
||||
|
||||
def findAnjukeDistrictDetail(anjukeId){
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id",new ObjectId(anjukeId))
|
||||
return detail.findOne(q)
|
||||
try{
|
||||
q.put("_id",new ObjectId(anjukeId))
|
||||
return detail.findOne(q)
|
||||
}catch(Exception e){
|
||||
print "[查询出错]anjukeId:"+anjukeId
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
def nameFileter(def region, def name){
|
||||
|
||||
+2
-1
@@ -172,7 +172,8 @@ class NameProcess {
|
||||
if((name.endsWith("村") || name.endsWith("街"))&& name.size()<=3){
|
||||
return null
|
||||
}
|
||||
if(name.endsWith("电梯")||name.endsWith("大道")||name.endsWith("厂") || name.endsWith("组") || (name.endsWith("阁") && name.length()<=3) || name.endsWith("条")){
|
||||
//|| name.endsWith("组")
|
||||
if(name.endsWith("电梯")||name.endsWith("大道")||name.endsWith("厂") || name.endsWith("条")){
|
||||
return null
|
||||
}
|
||||
if(name.contains("、")||name.contains("|")||name.contains(".")){
|
||||
|
||||
+3
-2
@@ -71,7 +71,8 @@ class DistrictIndexBatch extends BaseBatch{
|
||||
|
||||
def run(){
|
||||
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
||||
def citys = CommonDatautils.findAllCity();
|
||||
def citys = ["昆明","南宁","郑州","长沙","贵阳","乌鲁木齐","中山","湛江","南昌","海口"]
|
||||
//def citys = CommonDatautils.findAllCity();
|
||||
for(def city : citys){
|
||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2","household_count"])
|
||||
def code = cityCodeDatas.get(city)
|
||||
@@ -86,7 +87,7 @@ class DistrictIndexBatch extends BaseBatch{
|
||||
city_avg_total_price = 531.2615913
|
||||
}
|
||||
if(city_avg_total_price){
|
||||
// calcute(city, dists, code, city_avg_total_price)
|
||||
calcute(city, dists, code, city_avg_total_price)
|
||||
calcuteIndex(city, dists, code, city_avg_total_price)
|
||||
|
||||
}
|
||||
|
||||
+49
-1
@@ -21,10 +21,58 @@ class MatchTest {
|
||||
def task = new MatchTest()
|
||||
// task.run()
|
||||
// task.addNum()
|
||||
task.dongguang()
|
||||
// task.dongguang()
|
||||
// task.meituanDel()
|
||||
|
||||
task.addLevel()
|
||||
}
|
||||
|
||||
|
||||
|
||||
def addLevel() {
|
||||
def citys = ["昆明","南宁","郑州","长沙","贵阳","乌鲁木齐","中山","湛江","南昌","海口"]//
|
||||
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
||||
def cityLevelMap = [:]
|
||||
for(def city : citys){
|
||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city", "region","name"])
|
||||
def priceMap = CommonDatautils.queryDistrictPrice(city, weekend)
|
||||
def datas = addPriceData(dists, priceMap);
|
||||
datas = calcuteLevel(datas);
|
||||
cityLevelMap.put(city, ["price":priceMap, "level":datas])
|
||||
println city +" 楼盘评级同步完成"
|
||||
}
|
||||
|
||||
|
||||
def path = "D:\\数据\\美团\\10城小区明细-结果.xlsx"//美团金融小区测试list-所有数据-评级.xlsx
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
|
||||
def name = row['D']
|
||||
def address = row['E']
|
||||
def city = RegionData.formatCity(row['A'])
|
||||
|
||||
if(name && !row['O']){
|
||||
if(city){
|
||||
def map = cityLevelMap.get(city)
|
||||
def rMap = null
|
||||
if(map){
|
||||
rMap = getArroundDistrictPriceByAddress(city, address, map.level)
|
||||
}
|
||||
|
||||
if(rMap){
|
||||
if(rMap.rank){
|
||||
row['Q'] = rMap.rank
|
||||
}
|
||||
// if(rMap.level){
|
||||
// row['Q'] = rMap.level
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def meituanDel(){
|
||||
def path = "D:\\数据\\美团\\美团需入库小区合并后.xlsx"
|
||||
def index = 0
|
||||
|
||||
+12
-10
@@ -193,7 +193,7 @@ public class BeiKeCrawlByChrome {
|
||||
detail.room = roomStr.substring(0, roomStr.indexOf("室")).toInteger()
|
||||
}
|
||||
if (roomStr.indexOf("厅") > 0 && roomStr.indexOf("室") > 0) {
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü"))
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,8 @@ public class BeiKeCrawlByChrome {
|
||||
detail.trade_date = DateUtils.parseFromTightByPattern(tradeStr, "yyyy.MM.dd")
|
||||
}
|
||||
detail.source = "贝壳找房"
|
||||
def dbo = findTrade(detail)
|
||||
def detailUrl = e.select(".title a").attr("href")
|
||||
def dbo = findTrade(detailUrl)
|
||||
if (!dbo) {
|
||||
def houseInfo = e.select(".houseInfo").text()
|
||||
def houseInfos = houseInfo.split("\\|")
|
||||
@@ -228,7 +229,7 @@ public class BeiKeCrawlByChrome {
|
||||
detail.height = floorStr.toInteger()
|
||||
}
|
||||
}
|
||||
detail.url = e.select(".title a").attr("href")
|
||||
detail.url = detailUrl
|
||||
detail.create_date = new Date()
|
||||
detail.m_date = new Date()
|
||||
println detail
|
||||
@@ -313,8 +314,8 @@ public class BeiKeCrawlByChrome {
|
||||
def roomStr = JQueryUtils.selectText("li:contains(房屋户型)", doc).replace("房屋户型", "")
|
||||
if (roomStr) {
|
||||
detail.room = roomStr.substring(0, roomStr.indexOf("室")).toInteger()
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü"))
|
||||
detail.toilet = roomStr.substring(roomStr.indexOf("ÎÀ") - 1, roomStr.indexOf("ÎÀ"))
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger()
|
||||
detail.toilet = roomStr.substring(roomStr.indexOf("ÎÀ") - 1, roomStr.indexOf("ÎÀ")).toInteger()
|
||||
}
|
||||
detail.direction = JQueryUtils.selectText("li:contains(房屋朝向)", doc).replace("房屋朝向", "")
|
||||
detail.fitment = JQueryUtils.selectText("li:contains(装修情况)", doc).replace("装修情况", "")
|
||||
@@ -336,13 +337,14 @@ public class BeiKeCrawlByChrome {
|
||||
}
|
||||
|
||||
|
||||
def findTrade(def detail){
|
||||
def findTrade(def detailUrl){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", detail.city)
|
||||
q.put("region", detail.region)
|
||||
q.put("district_name", detail.district_name)
|
||||
q.put("area", detail.area)
|
||||
q.put("total_price", detail.total_price)
|
||||
// q.put("region", detail.region)
|
||||
// q.put("district_name", detail.district_name)
|
||||
// q.put("area", detail.area)
|
||||
// q.put("total_price", detail.total_price)
|
||||
q.put("url", detailUrl)
|
||||
q.put("trade_date", detail.trade_date)
|
||||
q.put("source", detail.source)
|
||||
def dbo = DEAL_PRICE_COLL.findOne(q)
|
||||
|
||||
+7
-7
@@ -34,11 +34,11 @@ public class LianjiaCrawlByChrome {
|
||||
|
||||
static main(args) {
|
||||
def task = new LianjiaCrawlByChrome();
|
||||
// task.run()
|
||||
task.run()
|
||||
// task.run1()
|
||||
// task.addDealRegion();
|
||||
// task.standardRegion()
|
||||
task.updadteDealPriceField()
|
||||
task.addDealRegion();
|
||||
task.standardRegion()
|
||||
// task.updadteDealPriceField()
|
||||
}
|
||||
|
||||
def updadteDealPriceField(){
|
||||
@@ -278,7 +278,7 @@ public class LianjiaCrawlByChrome {
|
||||
detail.room = roomStr.substring(0, roomStr.indexOf("室")).toInteger()
|
||||
}
|
||||
if (roomStr.indexOf("厅") > 0 && roomStr.indexOf("室") > 0) {
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü"))
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,8 +398,8 @@ public class LianjiaCrawlByChrome {
|
||||
def roomStr = JQueryUtils.selectText("li:contains(房屋户型)", doc).replace("房屋户型", "")
|
||||
if (roomStr) {
|
||||
detail.room = roomStr.substring(0, roomStr.indexOf("室")).toInteger()
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü"))
|
||||
detail.toilet = roomStr.substring(roomStr.indexOf("ÎÀ") - 1, roomStr.indexOf("ÎÀ"))
|
||||
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger()
|
||||
detail.toilet = roomStr.substring(roomStr.indexOf("ÎÀ") - 1, roomStr.indexOf("ÎÀ")).toInteger()
|
||||
}
|
||||
detail.direction = JQueryUtils.selectText("li:contains(房屋朝向)", doc).replace("房屋朝向", "")
|
||||
detail.fitment = JQueryUtils.selectText("li:contains(装修情况)", doc).replace("装修情况", "")
|
||||
|
||||
+36
-12
@@ -16,9 +16,11 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import java.text.DecimalFormat
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@@ -34,6 +36,9 @@ class CZDataBatch extends BaseBatch{
|
||||
DBCollection DIST_COLL = MongoUtils.getCollectionByName("business", "jn_bank_district", "mongo.db.fangjia.com")
|
||||
//final def czIdMap = readCZDistrict("d:\\常州数据结果\\原始数据\\常州江南银行住宅编号.xls");
|
||||
//final def czShopMap = readCZShop("d:\\常州数据结果\\原始数据\\常州江南银行商铺--更新ing(8).xls");
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(40)
|
||||
|
||||
static main(args) {
|
||||
runBatch(new CZDataBatch(), args);
|
||||
}
|
||||
@@ -113,25 +118,44 @@ class CZDataBatch extends BaseBatch{
|
||||
}
|
||||
|
||||
def districtRun(def districts){
|
||||
|
||||
def total = districts.size();
|
||||
def index = 0;
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(20)
|
||||
|
||||
def totalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(total)
|
||||
for(def i=0;i<total;i++){
|
||||
|
||||
final def district = districts[i]
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
index ++;
|
||||
println index+"/"+total +" ["+district.city+"-"+district.region+"-"+district.name+"]";
|
||||
converDistrict(district);
|
||||
try{
|
||||
totalCount.addAndGet(1)
|
||||
converDistrict(district);
|
||||
println totalCount.get()+"/"+total +" ["+district.city+"-"+district.region+"-"+district.name+"]";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
executorService.shutdown()
|
||||
executorService.awaitTermination(30, TimeUnit.MINUTES)
|
||||
latch.await()
|
||||
|
||||
|
||||
// def index = 0;
|
||||
// ExecutorService executorService = Executors.newFixedThreadPool(20)
|
||||
// for(def i=0;i<total;i++){
|
||||
//
|
||||
// final def district = districts[i]
|
||||
// executorService.submit(new Runnable() {
|
||||
// @Override
|
||||
// void run() {
|
||||
// index ++;
|
||||
// println index+"/"+total +" ["+district.city+"-"+district.region+"-"+district.name+"]";
|
||||
// converDistrict(district);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// executorService.shutdown()
|
||||
// executorService.awaitTermination(30, TimeUnit.MINUTES)
|
||||
}
|
||||
|
||||
def converDistrict(def dist){
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
import java.util.regex.Patter
|
||||
|
||||
/**
|
||||
* 第三方数据标准化处理
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class DataStat {
|
||||
|
||||
|
||||
def run(){
|
||||
def source = "±´¿ÇÕÒ·¿"//
|
||||
def source = "58ͬ³Ç"//
|
||||
def citys = findCrawlCity(source, 202202);
|
||||
for(def city : citys){
|
||||
def count1 = findCount(source, city, 202203);
|
||||
|
||||
+27
-27
@@ -192,38 +192,38 @@ class Esf58Crawl extends BaseBatch{
|
||||
void process(Object args) {
|
||||
//addContent("¸£ÖÝ","https://fz.58.com/xiaoqu/", 70);
|
||||
|
||||
def citys = ["上海","北京","广州","天津","武汉","南京","青岛","合肥","西安","沈阳","宁波","佛山","潍坊","济南","大连","兰州","石家庄","长春","温州","乌鲁木齐","太原","惠州","嘉兴","南通","南昌","烟台","临沂","呼和浩特","厦门","海口","常州","中山","绍兴","淄博","洛阳","珠海","金华","威海","德阳","唐山","泰安","襄阳","台州","镇江","银川","江门","荆州","衡阳","滨州","张家口","赣州","商丘","安庆","湖州","枣庄","聊城","阜阳","芜湖","吉林","遂宁","鞍山","东营","安阳","咸阳","蚌埠","九江","临汾","大同","六安","淮南","宿州","三亚","玉溪","六盘水","揭阳","汕尾","恩施","盘锦","伊犁","玉林","随州","抚州","景德镇","四平","丽水","安顺","毕节","天水","阜新","通化","攀枝花","吕梁","阿克苏","新余","松原","楚雄","鹤壁","忻州","本溪","拉萨","三门峡","黔东南","兴安盟","雅安","仙桃","乌海","贵港","安康","白城","平凉","庆阳","延安","潮州","白银","黔西南","丽江","吴忠","防城港","喀什","哈尔滨","钦州","鸡西","石嘴山","哈密","萍乡","鹰潭","武威","保山","铜仁","普洱","酒泉","宜昌","河池","朔州","百色","鹤岗","张家界","湘西","张掖","定西","昭通","济源","中卫","黑河","克拉玛依","铜川","辽源","云浮","博尔塔拉","固原","白山","广元","贺州","潜江","天门","伊春","石河子","临沧","榆林","临夏","来宾","成都","双鸭山","梧州","嘉峪关","海东","昌吉"]
|
||||
|
||||
// for(def city : citys){
|
||||
// def str = cityList.get(city)
|
||||
// for(def i=0;i<1;i++){
|
||||
// def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name"]);
|
||||
// if(districts){
|
||||
// def arrs = str.split("\\|")
|
||||
// def url = "https://"+arrs[0]+".58.com/xiaoqu/"
|
||||
// distMap.put(city, districts)
|
||||
// addCrawlKeys(city);
|
||||
// addDetailContent(city, "https://"+arrs[0]+".58.com", arrs[1]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
cityList.each{city, str->
|
||||
// "퀼꺼","뤘�","켓繫","緊憩","줄路","빌뵨뵈景","베왯","밤鹵",
|
||||
def citys = ["鉗�","揭갛","躬捺","憩鹵","麗쉭","陵뇽","쉭쳔","쐽鹵","굇쑴","뷜捺","켓쑴","깝鹵","蠟소왯","�헴","머鹵","빤鹵","갛헤","좔냘","讀鏤","막捺","鮫갛","交빤","섈주","件퀼","같�","땜檀","갛捺","驅捺"]
|
||||
for(def city : citys){
|
||||
def str = cityList.get(city)
|
||||
for(def i=0;i<1;i++){
|
||||
if(citys.contains(city)){
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name"]);
|
||||
if(districts){
|
||||
def arrs = str.split("\\|")
|
||||
def url = "https://"+arrs[0]+".58.com/xiaoqu/"
|
||||
distMap.put(city, districts)
|
||||
|
||||
addCrawlKeys(city);
|
||||
addDetailContent(city, "https://"+arrs[0]+".58.com", arrs[1]);
|
||||
}
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name"]);
|
||||
if(districts){
|
||||
def arrs = str.split("\\|")
|
||||
def url = "https://"+arrs[0]+".58.com/xiaoqu/"
|
||||
distMap.put(city, districts)
|
||||
addCrawlKeys(city);
|
||||
addDetailContent(city, "https://"+arrs[0]+".58.com", arrs[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cityList.each{city, str->
|
||||
// for(def i=0;i<1;i++){
|
||||
// if(citys.contains(city)){
|
||||
// def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name"]);
|
||||
// if(districts){
|
||||
// def arrs = str.split("\\|")
|
||||
// def url = "https://"+arrs[0]+".58.com/xiaoqu/"
|
||||
// distMap.put(city, districts)
|
||||
//
|
||||
// addCrawlKeys(city);
|
||||
// addDetailContent(city, "https://"+arrs[0]+".58.com", arrs[1]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,11 +92,6 @@ public class DbUtils{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void executeQueryOnSeawater(BasicDBObject query,Closure c, BasicDBObject fields = null){
|
||||
seawater.find(query,fields).batchSize(10000).each(c)
|
||||
}
|
||||
|
||||
public static void executeQueryOnSeaweed(BasicDBObject query,Closure c, BasicDBObject fields = null){
|
||||
SEAWEED_SLAVE.find(query,fields).batchSize(1000).each(c)
|
||||
}
|
||||
@@ -171,10 +166,6 @@ public class DbUtils{
|
||||
return SEAWEED_SLAVE.findOne(query,fields);
|
||||
}
|
||||
|
||||
public static int executeCountOnSeawater(BasicDBObject query){
|
||||
return seawater.count(query);
|
||||
}
|
||||
|
||||
public static BasicDBObject buildSeaweedQuery(def city = null, def region = null, def name = null, def cat = "district", def visible = 0){
|
||||
BasicDBObject query = new BasicDBObject()
|
||||
if(city){
|
||||
@@ -387,31 +378,6 @@ public class DbUtils{
|
||||
return district.lat && district.lng && district.lng > 0 && district.lat > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录修改小区库的操作日志
|
||||
* @param city
|
||||
* @param region
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
def static saveDeleteLog(String city, String region,String name,String category,int status){
|
||||
if(status!=1){
|
||||
return
|
||||
}
|
||||
DBObject obj = new BasicDBObject()
|
||||
obj.put("city", city);
|
||||
obj.put("region", region);
|
||||
obj.put("district_name", name);
|
||||
obj.put("category" , category)
|
||||
obj.put("origin" , "脚本")
|
||||
if(status==1){
|
||||
obj.put("type" , "remove")
|
||||
}
|
||||
obj.put("c_date" , new Date())
|
||||
obj.put("m_date" , new Date())
|
||||
OPERATION_LOG.save(obj)
|
||||
}
|
||||
|
||||
public static DBCollection getCollection(String host, int port, String dbName ,String collName){
|
||||
def collection = COLL_CACHE["${host}#${port}#${dbName}#${collName}"]
|
||||
if(!collection){
|
||||
|
||||
+34
-2
@@ -266,7 +266,7 @@ public class OpenApiClient {
|
||||
params.put("unitNumber", unitNum);
|
||||
params.put("roomNumber", roomNum);
|
||||
params.put("token", TOKEN);
|
||||
String content = new HttpRequest().get("http://open.fangjia.com/property/searchHouseLoudong", params, "utf-8")
|
||||
String content = new HttpRequest().get("http://localhost:8080/fangjia-open/property/searchHouseLoudong", params, "utf-8")
|
||||
JSONObject result = JSONObject.fromObject(content);
|
||||
while (result == null) {
|
||||
result = HttpRequestUtil.getJsonContent("http://open.fangjia.com/property/searchHouseLoudong", params, "utf-8")
|
||||
@@ -288,6 +288,38 @@ public class OpenApiClient {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject webankEvaluate(String city, String region, String address, String area){
|
||||
try{
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("city", city);
|
||||
params.put("district", region);
|
||||
params.put("address", address);
|
||||
params.put("area", area.toString());
|
||||
params.put("token", TOKEN);
|
||||
String content = new HttpRequest().get("http://open.fangjia.com/webank/evaluate", params, "utf-8")
|
||||
JSONObject result = JSONObject.fromObject(content);
|
||||
while (result == null) {
|
||||
result = HttpRequestUtil.getJsonContent("http://open.fangjia.com/webank/evaluate", params, "utf-8")
|
||||
println("${city} ${address} 程序调用异常")
|
||||
Thread.sleep(6000)
|
||||
}
|
||||
if(result){
|
||||
if (result.getInt("code") == 200) {
|
||||
return result;
|
||||
} else if (result.getInt("code") !=0) {
|
||||
println("${city} ${address} 程序调用异常")
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
println("${city} ${address} ${e.getMessage()}")
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject standard2Action(String city, String address) {
|
||||
try {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
@@ -706,7 +738,7 @@ public class OpenApiClient {
|
||||
params.put("startDate", startDate)
|
||||
params.put("limit", "100")
|
||||
try {
|
||||
String content = new HttpRequest().get("http://localhost:8080/fangjia-open/auction/searchPaimais", params, "utf-8")
|
||||
String content = new HttpRequest().get("http://open.fangjia.com/auction/searchPaimais", params, "utf-8")
|
||||
JSONObject result = JSONObject.fromObject(content);
|
||||
return result
|
||||
} catch (Exception e) {
|
||||
|
||||
+25
-18
@@ -1,12 +1,12 @@
|
||||
package com.fangjia.service.address;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
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.AmapPoi;
|
||||
import com.fangjia.dal.mongo.model.bkoff.HouseLoudong;
|
||||
import com.fangjia.dal.mongo.model.bkoff.Loudong;
|
||||
import com.fangjia.dal.seaweed.dao.SeaweedDao;
|
||||
@@ -16,17 +16,15 @@ import com.fangjia.service.address.processor.AddressDistrictProcessors;
|
||||
import com.fangjia.service.address.processor.AddressProcessors;
|
||||
import com.fangjia.service.api.AliyunService;
|
||||
import com.fangjia.service.bo.AliyunBo;
|
||||
import com.fangjia.service.bo.MatchAddressScore;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.mongo.addrepo.AddressRepoService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseLoudongService;
|
||||
import com.fangjia.service.mongo.bkoff.LoudongService;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -759,6 +757,13 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
double simScore;
|
||||
boolean onSameRoad = false;
|
||||
boolean sameDistrict = isSameDistrict(address, metaData);
|
||||
if(PreciseLevel.STRICT == address.getPreciseLevel() && !sameDistrict){
|
||||
return 0;
|
||||
}
|
||||
// //当地图解析出来的区域和用户地址中的区域一致时,只匹配指定区域下面的小区
|
||||
// if(address.getGeoRegion() != null && address.getGeoRegion().equals(address.getDistrict()) && !sameDistrict){
|
||||
// return 0;
|
||||
// }
|
||||
Iterator<Map.Entry<String, MatchText>> addrEntrySet = metaData.getAddrePinYinMap().entrySet().iterator();
|
||||
Map.Entry<String, MatchText> addrEntry;
|
||||
while(addrEntrySet.hasNext()){
|
||||
@@ -808,7 +813,6 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String keywordPinYin = address.getKeywordsPinYin();
|
||||
String keywords = address.getKeywords();
|
||||
String fuzzyKeywordsPinYin = address.getFuzzyKeywordsPinYin();
|
||||
@@ -892,7 +896,7 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
if(name.length() == 2 && (name.equals(address.getOrgAddress()) || name.equals(address.getEffectiveAddress()))){
|
||||
keywordScore = Math.max(keywordScore, namePriority);
|
||||
}else if(name.length() > 3 && (address.getOrgAddrePinYin().contains(namePinYin) || enhanceContains(address.getOrgAddress(), name))){
|
||||
double similar = AddressParserUtil.getSimilarityRatio(name, address.getEffectiveAddress());
|
||||
double similar = AddressParserUtil.getSimilarityRatio(name, address.getOrgAddress());
|
||||
if(similar == 1){
|
||||
keywordScore = Math.max(similar, keywordScore) * namePriority * 1.0001;
|
||||
}else if(similar > 0.1){
|
||||
@@ -907,20 +911,27 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
if (standardAddressScore > 0 && keywordScore > 0) {
|
||||
matchLevelScore = 0.9;
|
||||
similarityScore = Math.max(standardAddressScore, keywordScore) * SIMILARITY_RATE;
|
||||
} else if(keywordScore > 0 && streetScore > 0){
|
||||
matchLevelScore = 0.8;
|
||||
similarityScore = Math.max(streetScore, keywordScore * 0.8) * SIMILARITY_RATE;
|
||||
} else if (standardAddressScore > 0) {
|
||||
matchLevelScore = 0.7;
|
||||
matchLevelScore = 0.8;
|
||||
similarityScore = standardAddressScore * SIMILARITY_RATE;
|
||||
} else if(keywordScore > 0 && streetScore > 0){
|
||||
matchLevelScore = 0.7;
|
||||
similarityScore = Math.max(streetScore, keywordScore * 0.8) * SIMILARITY_RATE;
|
||||
} else if (keywordScore > 0) {
|
||||
matchLevelScore = 0.6;
|
||||
similarityScore = keywordScore * SIMILARITY_RATE;
|
||||
} else if (fuzzyKeywordsScore > 0) {
|
||||
matchLevelScore = 0.5;
|
||||
if(address.hasCoordinate() && metaData.getLng() != null && GeoUtils.calculateDistance(address.getLng(), address.getLat(),
|
||||
metaData.getLng(), metaData.getLat()) < 100){
|
||||
matchLevelScore = 0.7;
|
||||
}else{
|
||||
matchLevelScore = 0.4;
|
||||
}
|
||||
similarityScore = fuzzyKeywordsScore * SIMILARITY_RATE;
|
||||
}else if(metaData.getId().equals(address.getPolygonSeaweedId())){
|
||||
matchLevelScore = 0.4;
|
||||
similarityScore = 0.05;
|
||||
}
|
||||
|
||||
if (similarityScore > 0) {
|
||||
if(metaData.getBuildingType() != null){
|
||||
if ("shop".equals(metaData.getBuildingType().toString())) {
|
||||
@@ -942,10 +953,6 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
* similarityScore = ÏàËÆ¶È²¿·Ö(0.07) + ÀàÐͲ¿·Ö(0.01) < 0.1
|
||||
* */
|
||||
double score = matchLevelScore + similarityScore;
|
||||
if(address.hasCoordinate() && metaData.hasCoordinate()
|
||||
&& GeoUtils.calculateDistance(address.getLng(), address.getLat(), metaData.getLng(), metaData.getLat()) > 3 * 1000){
|
||||
score = 0d;
|
||||
}
|
||||
return score;
|
||||
|
||||
}
|
||||
@@ -980,7 +987,7 @@ public class AddressParserServiceImpl implements AddressParserService {
|
||||
return false;
|
||||
}
|
||||
if(StringUtils.isBlank(address.getDistrict()) && StringUtils.isBlank(address.getSuggestDistrict())){
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
String district = metaData.getDistrict();
|
||||
return district.equals(address.getDistrict()) || district.equals(address.getSuggestDistrict());
|
||||
|
||||
@@ -61,6 +61,8 @@ public class Address {
|
||||
private String suggestDistrict;
|
||||
private String suggestName;
|
||||
private String suggestNamePinYin;
|
||||
private String polygonSeaweedId;
|
||||
private String geoRegion;
|
||||
private List<String> buildingNumbers;
|
||||
private PreciseLevel preciseLevel;
|
||||
private boolean pinYin;
|
||||
@@ -397,6 +399,7 @@ public class Address {
|
||||
}
|
||||
|
||||
public void setOrgAddress(String orgAddress) {
|
||||
orgAddress = orgAddress.toUpperCase();
|
||||
setAddress(orgAddress);
|
||||
if(this.orgAddress != null){
|
||||
throw new UnsupportedOperationException("ÔʼµØÖ·²»Äܱ»ÐÞ¸Ä");
|
||||
@@ -749,6 +752,14 @@ public class Address {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getGeoRegion() {
|
||||
return geoRegion;
|
||||
}
|
||||
|
||||
public void setGeoRegion(String geoRegion) {
|
||||
this.geoRegion = geoRegion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Address{" +
|
||||
@@ -808,6 +819,14 @@ public class Address {
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getPolygonSeaweedId() {
|
||||
return polygonSeaweedId;
|
||||
}
|
||||
|
||||
public void setPolygonSeaweedId(String polygonSeaweedId) {
|
||||
this.polygonSeaweedId = polygonSeaweedId;
|
||||
}
|
||||
|
||||
public String toMd5Hex(){
|
||||
String keyProperties = "Address{" +
|
||||
"city='" + city + '\'' +
|
||||
|
||||
+1
-3
@@ -20,11 +20,9 @@ public class AddressProcessors{
|
||||
|
||||
static {
|
||||
//Đ޸ÄËłĐňĐčŇŞľ÷Őűprocess i ľÄÖľ
|
||||
addressProcessors.add(new TokenProcessor());
|
||||
addressProcessors.add(new ProximalCharactersProcessor());
|
||||
addressProcessors.add(new PreNoiseProcessor());
|
||||
addressProcessors.add(new AddressFormatProcessor());
|
||||
addressProcessors.add(new TokenProcessor());
|
||||
addressProcessors.add(new FloorProcessor());
|
||||
addressProcessors.add(new TooltipProcessor());
|
||||
addressProcessors.add(new ProvinceProcessor());
|
||||
@@ -44,7 +42,7 @@ public class AddressProcessors{
|
||||
addressProcessors.add(new NumericProcessor());
|
||||
addressProcessors.add(new ProvinceAdjustProcessor());
|
||||
addressProcessors.add(new FormatProcessor());
|
||||
// addressProcessors.add(new GeoProcessor());
|
||||
addressProcessors.add(new GeoProcessor());
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-18
@@ -52,8 +52,9 @@ public class CityProcessor extends AbstractAddressProcessor {
|
||||
}
|
||||
if(StringUtils.isNotBlank(city) && CityStatus.SURE != address.getCityStatus() ){
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
String possibleCity = AddressParserGoal.Match.equals(address.getAddressParserGoal()) ? parseCityFromAddress(orgAddress, address) : null;
|
||||
String confirmCity = AddressParserGoal.Match.equals(address.getAddressParserGoal()) ? null : formatCity;
|
||||
address.setCity(formatCity);
|
||||
String possibleCity = AddressParserGoal.Match.equals(address.getAddressParserGoal()) || address.getAddressParserGoal() == null ? parseCityFromAddress(orgAddress, address) : null;
|
||||
String confirmCity = AddressParserGoal.Match.equals(address.getAddressParserGoal()) || address.getAddressParserGoal() == null? null : formatCity;
|
||||
/**如果省份和城市信息相互矛盾 则用区域推断城市*/
|
||||
if(StringUtils.isNotBlank(address.getProvince()) && !ProvinceData.belongTo(formatCity, address.getProvince())){
|
||||
List<String> possibleCities = speculateCityNameByRegion(address, city);
|
||||
@@ -191,15 +192,12 @@ public class CityProcessor extends AbstractAddressProcessor {
|
||||
}else{
|
||||
weight.score += 2;
|
||||
}
|
||||
|
||||
}else if(address.contains(city)){
|
||||
index = address.indexOf(city);
|
||||
weight.index = index;
|
||||
index += city.length();
|
||||
if(province != null && (orgAddress.contains(province + city) || orgAddress.contains(ProvinceData.getDisplay(province) + city))){
|
||||
weight.score += 2;
|
||||
}else{
|
||||
weight.score += 1;
|
||||
}
|
||||
}
|
||||
Map<String, List<String>> regionMap = RegionData.getAllRegions(city);
|
||||
@@ -208,9 +206,11 @@ public class CityProcessor extends AbstractAddressProcessor {
|
||||
if(matchResult !=null){
|
||||
address = address.replace(matchResult.matchContent, "");
|
||||
}
|
||||
if(address.indexOf(region, index) > -1){
|
||||
if(address.indexOf(region + "Çø", index) > -1 || address.indexOf(region + "ÏØ", index) > -1){
|
||||
if(province != null && (orgAddress.contains(province + region) || orgAddress.contains(ProvinceData.getDisplay(province) + region))){
|
||||
weight.score += 2;
|
||||
}else if(city.equals(addr.getCity())){
|
||||
weight.score += 10;
|
||||
}else{
|
||||
weight.score += 1;
|
||||
}
|
||||
@@ -221,9 +221,13 @@ public class CityProcessor extends AbstractAddressProcessor {
|
||||
List<String> alias = regionMap.get(region);
|
||||
if(alias != null){
|
||||
for(String alia : alias){
|
||||
if(StringUtils.isNotBlank(alia) && !alia.equals(region) && address.indexOf(alia, index) > -1
|
||||
if(StringUtils.isNotBlank(alia) && !alia.equals(region) && alia.length() > 2 && address.indexOf(alia, index) > -1
|
||||
&& (alia.endsWith("市")|(alia.endsWith("县")))){
|
||||
weight.score += 1;
|
||||
if(city.equals(addr.getCity())){
|
||||
weight.score += 10;
|
||||
}else{
|
||||
weight.score += 1;
|
||||
}
|
||||
weight.index = address.indexOf(alia, index);
|
||||
break;
|
||||
}
|
||||
@@ -237,16 +241,6 @@ public class CityProcessor extends AbstractAddressProcessor {
|
||||
}
|
||||
List<FragmentWeight> weights = new ArrayList<FragmentWeight>(weightMap.values());
|
||||
if(weights.size() > 0){
|
||||
/*String street = getStreet(address);
|
||||
if(street != null){
|
||||
Iterator<FragmentWeight> iterator = weights.iterator();
|
||||
while(iterator.hasNext()){
|
||||
FragmentWeight fragmentWeight = iterator.next();
|
||||
if(match(street, ".*" + fragmentWeight.text + "[东南西北中一二三四五六七八九十百千\\d]?(路|街|大道|支路|村)")){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
Collections.sort(weights);
|
||||
}
|
||||
if(weights.size() > 0){
|
||||
|
||||
+3
@@ -167,6 +167,9 @@ public class DistrictProcessor extends AbstractAddressProcessor {
|
||||
address.setDevelopmentZone(dz);
|
||||
}
|
||||
}
|
||||
if(address.getSuggestDistrict() != null && address.getDistrict() == null){
|
||||
address.setDistrict(address.getSuggestDistrict());
|
||||
}
|
||||
address.setAddress(orgAddress);
|
||||
address.setEffectiveAddress(address.getAddress());
|
||||
return RepeatStatus.NEXT;
|
||||
|
||||
+46
-51
@@ -5,8 +5,12 @@ import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.service.address.mode.Address;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import java.util.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* µØÖ·¾Î³¶È´¦ÀíÆ÷
|
||||
@@ -16,78 +20,69 @@ import java.util.*;
|
||||
public class GeoProcessor extends AbstractAddressProcessor {
|
||||
|
||||
private static final String KEY = "4ccfe3c898a9489884bd2bcb1ef6dcde";
|
||||
|
||||
List<String> POI_LEVELS = Arrays.asList("村庄", "热点商圈", "兴趣点", "门牌号", "单元号", "道路交叉路口");
|
||||
List<String> DISTRICT_LEVEL = Arrays.asList("区县", "开发区", "乡镇", "村庄", "热点商圈", "兴趣点", "门牌号", "单元号", "道路交叉路口");
|
||||
private static final Logger logger = Logger.getLogger(GeoProcessor.class);
|
||||
List<String> POI_LEVELS = Arrays.asList("村庄", "热点商圈", "兴趣点", "门牌号", "单元号", "道路交叉路口", "门牌号");
|
||||
|
||||
@Override
|
||||
public RepeatStatus process(Address address) {
|
||||
|
||||
if (address.hasCoordinate()) {
|
||||
return RepeatStatus.NEXT;
|
||||
}
|
||||
List<String> queryTypes = new ArrayList<String>();
|
||||
List<String> addressList = new ArrayList<String>();
|
||||
if (address.isStandardAddress()) {
|
||||
addressList.add(address.getStandardAddress());
|
||||
queryTypes.add("StandardAddress");
|
||||
}
|
||||
if (StringUtils.isNotBlank(address.getOrgKeywords())) {
|
||||
addressList.add(address.getOrgKeywords());
|
||||
queryTypes.add("Keywords");
|
||||
String addr = address.getEffectiveAddress();
|
||||
if(addr == null || addr.length() < 3){
|
||||
addr = address.getOrgAddress();
|
||||
}
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("address", StringUtils.join(addressList, "|"));
|
||||
params.put("address", addr);
|
||||
params.put("key", KEY);
|
||||
params.put("city", address.getCity());
|
||||
params.put("batch", "true");
|
||||
params.put("output", "json");
|
||||
try {
|
||||
JSONObject response = request.getJsonContent("https://restapi.amap.com/v3/geocode/geo", params, "UTF-8");
|
||||
logger.info("高德API:" + response.toString());
|
||||
if (response.getInt("status") == 1) {
|
||||
JSONArray geocodes = response.getJSONArray("geocodes");
|
||||
if(queryTypes.contains("StandardAddress")){
|
||||
JSONObject geocode = geocodes.getJSONObject(queryTypes.indexOf("StandardAddress"));
|
||||
String level = geocode.getString("level");
|
||||
if(DISTRICT_LEVEL.contains(level)){
|
||||
if(StringUtils.isBlank(address.getDistrict())){
|
||||
address.setDistrict(RegionData.formatRegion(address.getCity(), geocode.getString("district")));
|
||||
if(geocodes.size() > 0){
|
||||
JSONObject json = geocodes.getJSONObject(0);
|
||||
if(json.get("district") instanceof String){
|
||||
String city = address.getCity();
|
||||
if(city == null){
|
||||
city = RegionData.formatCity(json.getString("city"));
|
||||
}
|
||||
String region = RegionData.formatRegion(city, json.getString("district"));
|
||||
address.setGeoRegion(region);
|
||||
}
|
||||
if(geocode.containsKey("street") && geocode.containsKey("number")){
|
||||
String geocodeAddress = geocode.getString("street") + geocode.getString("number");
|
||||
if(address.getStandardAddress().contains(geocodeAddress)){
|
||||
String location = geocode.getString("location");
|
||||
address.setLng(Double.parseDouble(location.split(",")[0]));
|
||||
address.setLat(Double.parseDouble(location.split(",")[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(queryTypes.contains("Keywords")){
|
||||
JSONObject geocode = geocodes.getJSONObject(queryTypes.indexOf("Keywords"));
|
||||
String level = geocode.getString("level");
|
||||
if(DISTRICT_LEVEL.contains(level)){
|
||||
if(StringUtils.isBlank(address.getDistrict())){
|
||||
address.setDistrict(RegionData.formatRegion(address.getCity(), geocode.getString("district")));
|
||||
}
|
||||
}
|
||||
if(POI_LEVELS.contains(level)){
|
||||
String formattedAddress = geocode.getString("formatted_address");
|
||||
formattedAddress = formattedAddress
|
||||
.replaceFirst(geocode.getString("province"), "")
|
||||
.replaceFirst(geocode.getString("city"), "")
|
||||
.replaceFirst(geocode.getString("district"), "");
|
||||
if(formattedAddress.equals(address.getOrgKeywords())){
|
||||
String location = geocode.getString("location");
|
||||
address.setLng(Double.parseDouble(location.split(",")[0]));
|
||||
address.setLat(Double.parseDouble(location.split(",")[1]));
|
||||
if(POI_LEVELS.contains(json.getString("level"))){
|
||||
//对于门牌号级别的POI,formatted_address中包含|代表是推测出来的路号,重庆市巴南区凤林路|808号,|号楼
|
||||
if("门牌号".equals(json.getString("level"))){
|
||||
if(!(json.get("number") instanceof JSONArray) && json.getString("formatted_address").contains("|" + json.getString("number"))){
|
||||
return RepeatStatus.NEXT;
|
||||
}
|
||||
}
|
||||
String location = json.getString("location");
|
||||
address.setLng(Double.valueOf(location.split(",")[0]));
|
||||
address.setLat(Double.valueOf(location.split(",")[1]));
|
||||
String tmp = "{ \"_source\": [\"seaweed_id\"], \"query\": {\"geo_shape\": {\"shape\": {\"shape\": {\"type\": \"Point\",\"coordinates\":[location]},\"relation\": \"CONTAINS\"}}}}";
|
||||
tmp = tmp.replace("location", location);
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization","Basic ZGV2ZWxvcGVyOjVlOGVkZDg1MWQyZmRmYmQ3NDE1MjMyYzY3MzY3Y2Mz");
|
||||
JSONObject resp = JSONObject.fromObject(request.postWithBody("http://192.168.0.206:9200/seaweed_polygon/_search", JSONObject.fromObject(tmp),headers,"UTF-8"));
|
||||
if(resp.containsKey("hits") && resp.getJSONObject("hits").containsKey("hits")){
|
||||
JSONArray hits = resp.getJSONObject("hits").getJSONArray("hits");
|
||||
if(hits.size() > 0){
|
||||
String seaweedId = hits.getJSONObject(0).getJSONObject("_source").getString("seaweed_id");
|
||||
address.setPolygonSeaweedId(seaweedId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RepeatStatus.NEXT;
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class KeywordProcessor extends AbstractAddressProcessor {
|
||||
static final List<Pattern> KEYWORDS_PATTERNS = Arrays.asList(Pattern.compile(".*[^一二三四五六七八九十\\d]{3,}号"));
|
||||
static final List<String> KEYWORDS = Arrays.asList("居委会", "辖区", "街道办", "街道", "办事处", "村委", "管理区");
|
||||
static final List<Pattern> NOISE_PATTERNS = Arrays.asList(Pattern.compile("^.*\\d+队"), Pattern.compile("^\\d+号院$"));
|
||||
static final List<Pattern> INVALID_KEYWORD_PATTERN = Arrays.asList(Pattern.compile("^[一二三四五六七八九十甲乙丙丁戊己庚辛A-Z\\d]+[区期]$"), Pattern.compile("碧桂园"), Pattern.compile("住宅楼"), Pattern.compile("家属院"));
|
||||
static final List<Pattern> INVALID_KEYWORD_PATTERN = Arrays.asList(Pattern.compile("^[一二三四五六七八九十甲乙丙丁戊己庚辛A-Z\\d]+[区期]$"), Pattern.compile("碧桂园"), Pattern.compile("住宅楼"), Pattern.compile("家属[区院]"), Pattern.compile("宿舍"), Pattern.compile("生活区"), Pattern.compile("公寓"));
|
||||
static final Pattern INVALID_PATTERN = Pattern.compile("^([-\\\\、])+$");
|
||||
|
||||
|
||||
|
||||
+8
-2
@@ -23,11 +23,17 @@ public class StageAndPartitionProcessor extends AbstractAddressProcessor {
|
||||
addr = addr.replaceAll(matchResult.matchContent, formatStage);
|
||||
address.setAddress(addr);
|
||||
}
|
||||
address.setStage(matchResult.matchContent);
|
||||
address.setStage(formatStage);
|
||||
}
|
||||
matchResult = matchFirst(AddressParserPatterns.PARTITION_PATTERN, orgAddr);
|
||||
if (matchResult != null) {
|
||||
address.setPartition(matchResult.matchContent);
|
||||
String formatPartition = CNNMFilter.convertArabicToCnNumeric(matchResult.matchContent);
|
||||
if(!formatPartition.equals(matchResult.matchContent)){
|
||||
String addr = address.getAddress();
|
||||
addr = addr.replaceAll(matchResult.matchContent, formatPartition);
|
||||
address.setAddress(addr);
|
||||
}
|
||||
address.setStage(formatPartition);
|
||||
}
|
||||
return RepeatStatus.NEXT;
|
||||
}
|
||||
|
||||
+2
-4
@@ -42,12 +42,10 @@ public class TooltipProcessor extends AbstractAddressProcessor {
|
||||
if(matchFirst(AddressParserPatterns.STREET, tooltip) != null){
|
||||
address.setTooltip(tooltip);
|
||||
address.setStreet(getStreet(tooltip));
|
||||
} else if(containsDistrictName(tooltip)){
|
||||
address.setTooltip(tooltip);
|
||||
} else if(RegionData.isRegion(address.getCity(), tooltip)){
|
||||
}else if(RegionData.isRegion(address.getCity(), tooltip)){
|
||||
address.setSuggestDistrict(tooltip);
|
||||
}else{
|
||||
address.addNosie(tooltip);
|
||||
address.setTooltip(tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-9
@@ -15,15 +15,6 @@ public class VillageNameProcessor extends AbstractAddressProcessor {
|
||||
@Override
|
||||
public AbstractAddressProcessor.RepeatStatus process(Address address) {
|
||||
String orgAddress = address.getAddress();
|
||||
if(address.getTokens()!=null){
|
||||
for(Token token:address.getTokens()){
|
||||
if("district".equals(token.getKeywordTypes())){
|
||||
address.setKeywords(token.getName());
|
||||
address.setAddress(orgAddress.replace(token.getName(),""));
|
||||
return RepeatStatus.NEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> names = tokenDistrictNames(orgAddress);
|
||||
List<String> kws = new ArrayList<String>();
|
||||
for(String name : names){
|
||||
|
||||
+8
-16
@@ -1,24 +1,16 @@
|
||||
package com.fangjia.service.cnAnalyzer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.solr.client.solrj.util.ClientUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.goojia.solr.ganalytics.IKSegmentation;
|
||||
import com.goojia.solr.ganalytics.Lexeme;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 房价网分词器
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface BsEvaluationService {
|
||||
|
||||
List<BsEvaluation> getNearlySameEvaluation(String id, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, Integer limit);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.mongo.dao.BsEvaluationDao;
|
||||
import com.fangjia.dal.mongo.dao.EvaluationDao;
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DealPrice;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BsEvaluationServiceImpl implements BsEvaluationService {
|
||||
|
||||
private BsEvaluationDao bsEvaluationDao;
|
||||
|
||||
public void setBsEvaluationDao(BsEvaluationDao bsEvaluationDao) {
|
||||
this.bsEvaluationDao = bsEvaluationDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BsEvaluation> getNearlySameEvaluation(String id, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, Integer limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("commid", id));
|
||||
if(startDate!=null){
|
||||
params.add(new QueryParam("cDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if(endDate!=null){
|
||||
params.add(new QueryParam("cDate", QueryParam.LESS_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
if (minPrice > 0) {
|
||||
params.add(new QueryParam("unitPrice", QueryParam.GREATER_THAN_OPERATOR, minPrice));
|
||||
}
|
||||
if (maxPrice > 0) {
|
||||
params.add(new QueryParam("unitPrice", QueryParam.LESS_THAN_OPERATOR, maxPrice));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("cDate", false));
|
||||
List<BsEvaluation> bsEvaluations = bsEvaluationDao.findAllByParams(params, sortParams, limit);
|
||||
return bsEvaluations;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -240,7 +240,7 @@ public class AddressRepoServiceImpl implements AddressRepoService {
|
||||
}
|
||||
|
||||
private boolean isAvailablePoi(AddressMatchMetaData data){
|
||||
if(data.getType() != null && data.getType().contains("·")){
|
||||
if(data.getType() != null && (data.getType().contains("·") || data.getType().contains("½ÖµÀ"))){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+2
@@ -94,4 +94,6 @@ public interface HouseLoudongService {
|
||||
public List<HouseLoudong> findAll(List<QueryParam> queryParams, Pager pager);
|
||||
|
||||
List<String> findAllSources();
|
||||
|
||||
public List<HouseLoudong> findAll(String id, String houseNum, String unitNum, String roomNum);
|
||||
}
|
||||
|
||||
+16
@@ -297,6 +297,22 @@ public class HouseLoudongServiceImpl implements HouseLoudongService {
|
||||
return froms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HouseLoudong> findAll(String id, String houseNum, String unitNum, String roomNum) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("districtId", id));
|
||||
if (StringUtils.isNotBlank(houseNum)) {
|
||||
params.add(new QueryParam("houseNum", houseNum));
|
||||
}
|
||||
if (StringUtils.isNotBlank(unitNum)) {
|
||||
params.add(new QueryParam("houseNumUnit", unitNum));
|
||||
}
|
||||
if (StringUtils.isNotBlank(roomNum)) {
|
||||
params.add(new QueryParam("roomNum", roomNum));
|
||||
}
|
||||
return houseLoudongBkoffDao.findAllByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HouseLoudong> queryHouseLoudongList(String city, String districtName, String roomNum, Pager pager) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
|
||||
+4
@@ -23,6 +23,8 @@ public interface LoudongService {
|
||||
|
||||
List<Loudong> findAll(String city, String region, String name, String houseNumber, String unitNumber, int limit);
|
||||
|
||||
List<Loudong> findAll(String id, String houseNumber, String unitNumber);
|
||||
|
||||
Map<String, XSSFWorkbook> findAll(List<QueryParam> query, String city);
|
||||
|
||||
Loudong findById(String id);
|
||||
@@ -41,4 +43,6 @@ public interface LoudongService {
|
||||
void save(Map<String, Object> data);
|
||||
|
||||
List<String> findAllSources();
|
||||
|
||||
Loudong findForEvaluate(String idInSeaweed, String houseNumber, String unitNumber);
|
||||
}
|
||||
|
||||
+36
@@ -148,6 +148,23 @@ public class LoudongServiceImpl implements LoudongService {
|
||||
return loudongDao.findAllByParams(params,null, 0 , limit, ADDRESS_VERIFY_FIELDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Loudong> findAll(String id, String houseNumber, String unitNumber) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
if(StringUtils.isNotBlank(id)) {
|
||||
params.add(new QueryParam("idInSeaweed", id));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(houseNumber)) {
|
||||
params.add(new QueryParam("houseNumber", houseNumber));
|
||||
}
|
||||
if(StringUtils.isNotBlank(unitNumber)) {
|
||||
params.add(new QueryParam("unitNumber", unitNumber));
|
||||
}
|
||||
|
||||
return loudongDao.findAllByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loudong findById(String id) {
|
||||
return loudongDao.findById(id);
|
||||
@@ -318,4 +335,23 @@ public class LoudongServiceImpl implements LoudongService {
|
||||
}
|
||||
return froms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loudong findForEvaluate(String idInSeaweed, String houseNumber, String unitNumber){
|
||||
if(StringUtils.isBlank(idInSeaweed) || StringUtils.isBlank(houseNumber)){
|
||||
return null;
|
||||
}
|
||||
List<QueryParam> params = Lists.newArrayList();
|
||||
params.add(new QueryParam("idInSeaweed", idInSeaweed));
|
||||
params.add(new QueryParam("houseNumber", houseNumber));
|
||||
if(StringUtils.isNotBlank(unitNumber)) {
|
||||
params.add(new QueryParam("unitNumber", unitNumber));
|
||||
}
|
||||
params.add(new QueryParam("floors", QueryParam.GREATER_THAN_OPERATOR, 0));
|
||||
params.add(new QueryParam("floors", QueryParam.LESS_THAN_OPERATOR, 60));
|
||||
params.add(new QueryParam("status", QueryParam.NOT_EQUAL_OPERATOR, 0));
|
||||
|
||||
List<SortParam> sortParams = ImmutableList.of(new SortParam("floors", false));
|
||||
return loudongDao.findFirstByParams(params, sortParams);
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -82,6 +82,8 @@ public interface DealPriceService {
|
||||
|
||||
public List<DealPrice> getNearlySameDealPrice(DistrictKey key, int minPrice, int maxPrice, int radius, int limit);
|
||||
|
||||
public List<DealPrice> getNearlySameDealPrice(String districtId, Integer minPrice, Integer maxPrice,Date startDate, Date endDate, int limit);
|
||||
|
||||
public List<DealPrice> getDisSameDealPrice(DistrictKey key, int minPrice, int maxPrice, int limit);
|
||||
|
||||
/**
|
||||
|
||||
+23
@@ -354,6 +354,29 @@ public class DealPriceServiceImpl implements DealPriceService {
|
||||
return houses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DealPrice> getNearlySameDealPrice(String districtId, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, int limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("matchId", districtId));
|
||||
if(startDate!=null){
|
||||
params.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if(endDate!=null){
|
||||
params.add(new QueryParam("tradeDate", QueryParam.LESS_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
if (minPrice > 0) {
|
||||
params.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_OPERATOR, minPrice));
|
||||
}
|
||||
if (maxPrice > 0) {
|
||||
params.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_OPERATOR, maxPrice));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("tradeDate", false));
|
||||
List<DealPrice> dealPrices = dealPriceDao.findAllByParams(params, sortParams, limit);
|
||||
return dealPrices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DealPrice> getDisSameDealPrice(DistrictKey key, int minPrice, int maxPrice, int limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.service.open;
|
||||
|
||||
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
|
||||
public interface CommunityBasePriceService {
|
||||
|
||||
CommunityBasePrice getById(String id);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.service.open;
|
||||
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
|
||||
public interface CommunityPoiService {
|
||||
|
||||
CommunityPoi getById(String id);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.fangjia.service.open.impl;
|
||||
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityBasePriceDao;
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
import com.fangjia.service.open.CommunityBasePriceService;
|
||||
import com.fangjia.service.open.CommunityPoiService;
|
||||
|
||||
public class CommunityBasePriceServiceImpl implements CommunityBasePriceService {
|
||||
|
||||
private CommunityBasePriceDao communityBasePriceDao;
|
||||
|
||||
@Override
|
||||
public CommunityBasePrice getById(String id) {
|
||||
return communityBasePriceDao.findById(id);
|
||||
}
|
||||
|
||||
public void setCommunityBasePriceDao(CommunityBasePriceDao communityBasePriceDao) {
|
||||
this.communityBasePriceDao = communityBasePriceDao;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.fangjia.service.open.impl;
|
||||
|
||||
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
|
||||
import com.fangjia.dal.mongo.open.model.CommunityPoi;
|
||||
import com.fangjia.service.open.CommunityPoiService;
|
||||
|
||||
public class CommunityPoiServiceImpl implements CommunityPoiService {
|
||||
|
||||
private CommunityPoiDao communityPoiDao;
|
||||
|
||||
@Override
|
||||
public CommunityPoi getById(String id) {
|
||||
return communityPoiDao.findById(id);
|
||||
}
|
||||
|
||||
public void setCommunityPoiDao(CommunityPoiDao communityPoiDao) {
|
||||
this.communityPoiDao = communityPoiDao;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user