Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -13,7 +13,7 @@ import java.util.*;
|
||||
*/
|
||||
public class BaiDuApiUtils {
|
||||
|
||||
private static String AK = "9E99D3540e4dafb7894f7b9fe27fa6b5";
|
||||
private static String AK = "ajgWIBd9rYsXed1hcDQqYvkX";
|
||||
public static String[] AKS = new String[]{"hj5KqPjaGA3uivtg8uS8XfAnj9X1kPMr","xjFg7DfDqvQleIZasM3ph8Zi2Lw8kgCg",
|
||||
"4pb6fzrWIzvibDu8L1o8DGoY2h1wRIUq","ZzX6mRFfE5GKn4cpUp24Q3OyUIHnfQAR","79ac4ea49e7dedbf80b0ecd475d07784",
|
||||
"9E99D3540e4dafb7894f7b9fe27fa6b5","W3M5uHfcrmlAdhQjf6v93LCI", "C8bb035aacf602551e829e4c64575224",
|
||||
|
||||
@@ -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;
|
||||
@@ -1435,6 +1436,25 @@ public class DataUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配符合条件的字符串
|
||||
*
|
||||
* @param str
|
||||
* @param pattern
|
||||
* @return
|
||||
*/
|
||||
public static List<String> matchAll(String str, Pattern pattern) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
List list = new ArrayList();
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
while (matcher.find()) {
|
||||
list.add(matcher.group());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean isNumeric(String str) {
|
||||
try {
|
||||
Double.parseDouble(str);
|
||||
@@ -1805,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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ExcelUtil {
|
||||
row.setHeightInPoints(35);
|
||||
Font font = workBook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
// font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
CellStyle cellStyle = workBook.createCellStyle();
|
||||
cellStyle.setFont(font);
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class RandomUtil extends RandomUtils {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
System.out.println(random(0, 10));
|
||||
System.out.println(random(-9, 9));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+2
@@ -188,6 +188,8 @@ public class TrendController {
|
||||
// avgPrice = model.getRegionStatBo().getAvgPrice();
|
||||
// }
|
||||
|
||||
int count = districtService.findCityDistrictCount(city);
|
||||
model.setCount(count);
|
||||
model.setTrendView(trendView);
|
||||
//model.setLastestHouse(getRelatedHouse(model.getRegion(), avgPrice));
|
||||
return model;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
private int showBlock; // 小区走势图里显示板块线,不为0时显示
|
||||
private String errMsg; //错误信息
|
||||
private int code; //错误code 1成功 -1失败
|
||||
private int count;
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
@@ -317,4 +318,11 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,37 +158,36 @@
|
||||
<a class="partner13"></a>
|
||||
<#-- <a class="partner14"></a>-->
|
||||
<a class="partner15"></a>
|
||||
<a class="partner16" style="margin-right:0;"></a>
|
||||
<a class="partner16"></a>
|
||||
<a class="partner21"></a>
|
||||
<a class="partner22"></a>
|
||||
<a class="partner23"></a>
|
||||
<a class="partner24"></a>
|
||||
<a class="partner25"></a>
|
||||
<a class="partner26" style="margin-right:0;"></a>
|
||||
<a class="partner26"></a>
|
||||
<a class="partner31"></a>
|
||||
<a class="partner32"></a>
|
||||
<a class="partner33"></a>
|
||||
<a class="partner34"></a>
|
||||
<a class="partner35"></a>
|
||||
<a class="partner36" style="margin-right:0;"></a>
|
||||
<a class="partner36"></a>
|
||||
<a class="partner41"></a>
|
||||
<a class="partner42"></a>
|
||||
<a class="partner43"></a>
|
||||
<a class="partner44"></a>
|
||||
<a class="partner45"></a>
|
||||
<a class="partner46" style="margin-right:0;"></a>
|
||||
<a class="partner46"></a>
|
||||
<a class="partner51"></a>
|
||||
<a class="partner52"></a>
|
||||
<a class="partner53"></a>
|
||||
<a class="partner54"></a>
|
||||
<a class="partner55"></a>
|
||||
<a class="partner56" style="margin-right:0;"></a>
|
||||
<a class="partner56"></a>
|
||||
<a class="partner61"></a>
|
||||
<a class="partner62"></a>
|
||||
<a class="partner63"></a>
|
||||
<a class="partner65"></a>
|
||||
<a class="partner66"></a>
|
||||
<a class="partner71" style="margin-right:0;"></a>
|
||||
<a class="partner72"></a>
|
||||
<a class="partner73"></a>
|
||||
</div>
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
|
||||
<div class="trend01b">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
|
||||
<#if districtStatBo??>
|
||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public class FjtEvaluation implements SqlEntity{
|
||||
|
||||
private String finishDateStr;//竣工时间
|
||||
private String useType;//房屋用途
|
||||
|
||||
private Date downPdfDate;//下载报告时间
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Id
|
||||
@@ -750,6 +752,16 @@ public class FjtEvaluation implements SqlEntity{
|
||||
this.useType = useType;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "down_pdf_date")
|
||||
public Date getDownPdfDate() {
|
||||
return downPdfDate;
|
||||
}
|
||||
|
||||
public void setDownPdfDate(Date downPdfDate) {
|
||||
this.downPdfDate = downPdfDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FjtEvaluation{" +
|
||||
|
||||
@@ -38,6 +38,7 @@ public class OpenConfig extends Configuration {
|
||||
|
||||
private final String ipdatfile;
|
||||
private final String baiduAk;
|
||||
private final String defaultCity;
|
||||
|
||||
private final boolean isOpenAllAuthority;
|
||||
|
||||
@@ -54,6 +55,7 @@ public class OpenConfig extends Configuration {
|
||||
baiduAk = configuration.get("fangjia.baidu.ak");
|
||||
isOpenAllAuthority = configuration.getBoolean("fangjia.isOpenAllAuthority", false);
|
||||
enabledAddressMatch = configuration.getBoolean("fangjia.addressMatch.enabled",false);
|
||||
defaultCity = configuration.get("fangjia.default.city");
|
||||
}
|
||||
|
||||
public static OpenConfig getConfig() {
|
||||
@@ -134,4 +136,7 @@ public class OpenConfig extends Configuration {
|
||||
return enabledAddressMatch;
|
||||
}
|
||||
|
||||
public String getDefaultCity() {
|
||||
return defaultCity;
|
||||
}
|
||||
}
|
||||
|
||||
+226
@@ -89,6 +89,7 @@ import com.fangjia.service.mongo.fangjia.ServerAreaService;
|
||||
import com.fangjia.service.open.WaitCrawlKeywordsService;
|
||||
import com.fangjia.service.sql.FjtEvaluationService;
|
||||
import com.fangjia.service.web.AddressService;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
public class AddressController {
|
||||
@@ -106,6 +107,7 @@ public class AddressController {
|
||||
private HouseLoudongService houseLoudongService;
|
||||
private FjtEvaluationService fjtEvaluationService;
|
||||
private AddressMatchProxyService addressMatchProxyService;
|
||||
|
||||
private final static String AK = OpenConfig.getConfig().getBaiduAk();
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(AddressController.class);
|
||||
|
||||
@@ -117,6 +119,8 @@ public class AddressController {
|
||||
private static final String GRADE_NATION = "È«¹úÆÀ·Ö";
|
||||
private static final String GRADE_CONSUME = "Ïû·ÑÆÀ·Ö";
|
||||
|
||||
public final static OpenConfig CONFIG = OpenConfig.getConfig();
|
||||
|
||||
/**
|
||||
* @deprecated see parse2Action
|
||||
* @param model
|
||||
@@ -1705,6 +1709,228 @@ public class AddressController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址标准化接口V2
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object standard2Action(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());
|
||||
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");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 五级地址标准化接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object fiveDivisionStructureAction(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", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure", 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 五级行政区划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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细地址标准化接口
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object divisionStructureAction(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/divisionStructure", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/divisionStructure", 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址标准化专用测试接口
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object structureAndCompleteAction(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/structureAndComplete", params, "UTF-8");
|
||||
} catch(Exception e){
|
||||
try {
|
||||
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", 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;
|
||||
}
|
||||
|
||||
public Object similarityAction(AddesssMatchModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
if (StringUtils.isBlank(model.getAddress_1()) || StringUtils.isBlank(model.getAddress_2())) {
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
+116
@@ -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,107 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object arroundlistAction(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;
|
||||
}
|
||||
|
||||
//周边小区,默认10
|
||||
List<District> districts = districtService.findNearestDistrict(district, 1000, model.getDistCount());
|
||||
List<Seawater> houses = new ArrayList<Seawater>();
|
||||
for(District dist : districts){
|
||||
districtKey = new DistrictKey(dist.getCity(), dist.getRegion(), dist.getName());
|
||||
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> arroundhouses = seawaterDao.findSeawatersFromEs("sell", dist.getCity(), dist.getRegion(), dist.getName(), dist.getAlias(), null, model.getStartTime(), model.getEndTime(),null,null,minPrice, maxPrice,null,null,"p_date", false,0, model.getPageSize(),"latest_seawater");
|
||||
if(arroundhouses!=null && arroundhouses.size()>0){
|
||||
houses.addAll(arroundhouses);
|
||||
}
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(houses));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String getPicUrl(String url, List<String> urls) {
|
||||
if (!urls.contains(url)) {
|
||||
urls.add(url);
|
||||
@@ -832,6 +941,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) {
|
||||
|
||||
+221
-54
@@ -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
|
||||
*/
|
||||
@@ -2363,7 +2488,7 @@ public class PropertyController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("size(面积)不能为空"));
|
||||
return mav;
|
||||
}
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName().replace(" ",""),
|
||||
"district");
|
||||
if (null == district) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class DistrictController {
|
||||
// response.sendRedirect("/coming");
|
||||
// return null;
|
||||
// }
|
||||
if("b".equals(login_user_type)){
|
||||
if("b".equals(login_user_type) || "gb".equals(login_user_type)){
|
||||
CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_city_"+ login_user_type , model.getCityName());
|
||||
}
|
||||
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
|
||||
|
||||
+53
-11
@@ -80,7 +80,19 @@ public class UserController {
|
||||
} else {
|
||||
weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
}
|
||||
|
||||
String cacheWeiXinId = CookieUtils.getCookieValue(request,"login_enterpriseuser_weixinid");
|
||||
try {
|
||||
if(StringUtils.isNotBlank(weiXinId) && StringUtils.isNotBlank(cacheWeiXinId)){
|
||||
System.out.println("cookie weiXinId:"+weiXinId);
|
||||
response.sendRedirect("reqCityChoicePage?type=b&code="+model.getCode());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(weiXinId == null && StringUtils.isNotBlank(model.getCode())) {//微信公众号渤海银行
|
||||
System.out.println("bh OPEN_ID Ëæ»úÉú³É£º" + weiXinId);
|
||||
weiXinId = DataConvertUtil.getRandomString2(16);
|
||||
}
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
@@ -115,33 +127,49 @@ public class UserController {
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
}
|
||||
System.out.println("΢ÐÅOPEN_ID£º" + weiXinId);
|
||||
System.out.println("reqCityChoicePage ΢ÐÅOPEN_ID£º" + weiXinId);
|
||||
//企业用户入口查询企业账户开通的城市
|
||||
if(type.equals("b")){
|
||||
if(type.equals("b") || type.equals("gb")){
|
||||
//Boolean isLogin = usersInfoService.checkEnterpriseWeiXinUserIsLogin(weiXinId);
|
||||
String cacheWeiXinId = CookieUtils.getCookieValue(request,"login_enterpriseuser_weixinid");
|
||||
if(cacheWeiXinId != null) {
|
||||
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
|
||||
String loginUserIdstr = CookieUtils.getCookieValue(request,"login_user_id");
|
||||
if(cacheWeiXinId != null && StringUtils.isNotBlank(loginUserIdstr)) {
|
||||
Long userId = Long.parseLong(loginUserIdstr);
|
||||
CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response);
|
||||
try {
|
||||
FjtUsers users = fjtUsersService.findById(userId);
|
||||
List<String> citys = userCityService.findSupportCityByUserId(userId);
|
||||
if(citys == null || citys.isEmpty()){
|
||||
citys = Arrays.asList("ÉϺ£");
|
||||
}
|
||||
|
||||
if(users.getRole()==17 && type.equals("gb")){
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
response.sendRedirect("reqLoginPage");
|
||||
}else if(users.getRole()==12 && type.equals("b")){
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
response.sendRedirect("bhydLoginPage?code="+model.getCode());
|
||||
}else{
|
||||
List<String> citys = userCityService.findSupportCityByUserId(userId);
|
||||
if(citys == null || citys.isEmpty()){
|
||||
citys = Arrays.asList("ÉϺ£");
|
||||
}
|
||||
// if(users!=null && users.getRole() == 12){
|
||||
// citys = Arrays.asList("上海");
|
||||
// }else{
|
||||
// citys = userCityService.findSupportCityByUserId(userId);
|
||||
// }
|
||||
model.setCitys(citys);
|
||||
model.setCitys(citys);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
model.setCitys(new ArrayList<String>());
|
||||
}
|
||||
|
||||
} else {
|
||||
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
|
||||
try {
|
||||
response.sendRedirect("reqLoginPage");
|
||||
// if(type.equals("bh")){
|
||||
// response.sendRedirect("bhydLoginPage?code="+model.getCode());
|
||||
// }else{
|
||||
response.sendRedirect("reqLoginPage");
|
||||
// }
|
||||
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
@@ -173,6 +201,20 @@ public class UserController {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public Object bhloginOutAction(UserModel model,HttpServletRequest request, HttpServletResponse response, String city) {
|
||||
try {
|
||||
CookieUtils.removeCookie(request, response,"login_user_id");
|
||||
CookieUtils.removeCookie(request, response,"login_user_type");
|
||||
CookieUtils.removeCookie(request, response,"login_enterpriseuser_weixinid");
|
||||
response.sendRedirect("bhydLoginPage?code=bhydcode");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object aboutAction(UserModel model) {
|
||||
return model;
|
||||
@@ -285,7 +327,7 @@ public class UserController {
|
||||
return resultModel;
|
||||
}
|
||||
CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_user_type", "b", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_user_type", "gb", "/", 60 * 60 * 24 *7, response);
|
||||
CookieUtils.setCookie("login_enterpriseuser_weixinid", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
//CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_" + Message.SMS_CODE_TYPE_ENTER_LOGIN , user.getId());
|
||||
resultModel.setResult(Message.RESULT_SUCCESS);
|
||||
|
||||
+94
-10
@@ -49,6 +49,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -452,12 +453,33 @@ public class WeiXinEvaluationController {
|
||||
if(fjtUser!=null && fjtUser.getRole()==17) {
|
||||
System.out.println("渤海地址搜索 "+evaluation.getAddress());
|
||||
List<JSONObject> bhDists = BHBankUtils.getDistrictByBhbank(evaluation.getAddress());
|
||||
if(bhDists.size()<1){
|
||||
JSONObject o = null;
|
||||
if(bhDists.size()==0){
|
||||
bhDists = BHBankUtils.getDistrictByBhbank(district.getName());
|
||||
}
|
||||
Map<String, String> bhMatchMap = new HashMap<String, String>();
|
||||
if(bhDists.size()==1){
|
||||
JSONObject o = bhDists.get(0);
|
||||
o = bhDists.get(0);
|
||||
}else if(bhDists.size()>1){
|
||||
int mod = Integer.MAX_VALUE;
|
||||
for(JSONObject jo : bhDists){
|
||||
int bhprice = 0;
|
||||
if (jo.get("price") == null || jo.get("price").equals("null")) {
|
||||
bhprice = 0;
|
||||
} else {
|
||||
double price = Double.valueOf((String)jo.get("price"));
|
||||
bhprice = (int)price;
|
||||
}
|
||||
|
||||
int bhmod = Math.abs(bhprice - avgPrice);
|
||||
if(bhmod<mod){
|
||||
mod = bhmod;
|
||||
o = jo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, String> bhMatchMap = new HashMap<String, String>();
|
||||
if(o != null){
|
||||
|
||||
String bhDistName = (String)o.get("name");
|
||||
String regionCode = String.valueOf((Long)o.get("country"));
|
||||
String bhRegion = BHBankUtils.regionCodeMap.get(regionCode);
|
||||
@@ -982,13 +1004,14 @@ public class WeiXinEvaluationController {
|
||||
if(StringUtils.isNotBlank(model.getEvaluationId()) && StringUtils.isNotBlank(model.getEmail())){
|
||||
|
||||
UserTrades userTrade = userTradesService.findUserTradesByEvaluationId(model.getEvaluationId());
|
||||
|
||||
FjtEvaluation evaluation = fjtEvaluationService.findEvaluationById(Long.valueOf(model.getEvaluationId()));
|
||||
if(userTrade != null){
|
||||
userTrade.setSend(1);
|
||||
userTrade.setSendEmail(model.getEmail());
|
||||
userTradesService.update(userTrade);
|
||||
}else{
|
||||
FjtEvaluation evaluation = fjtEvaluationService.findEvaluationById(Long.valueOf(model.getEvaluationId()));
|
||||
|
||||
|
||||
userTrade = new UserTrades();
|
||||
userTrade.setUserId(evaluation.getUserId());
|
||||
userTrade.setCity(evaluation.getCity());
|
||||
@@ -1008,20 +1031,44 @@ public class WeiXinEvaluationController {
|
||||
|
||||
String reporNum = "147698"+ String.valueOf(evaluation.getId());
|
||||
evaluation.setReportNum(reporNum);
|
||||
evaluation.setDownPdfDate(new Date());
|
||||
fjtEvaluationService.updateEvaluation(evaluation);
|
||||
|
||||
try {
|
||||
String smsContent = "【房价网】微信询价报告发送 用户邮箱:"+model.getEmail();
|
||||
smsService.sendDingMsgByRobot(DD_ID, smsContent);
|
||||
|
||||
|
||||
} catch (SmsException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sendToEmail(model.getFjtUrlKey(), model.getEvaluationId(), model.getEmail());
|
||||
|
||||
FjtUsers users = fjtUsersService.findById(evaluation.getUserId());
|
||||
if(users!=null && users.getRole()==17){
|
||||
|
||||
String converFileName = DateUtils.format(new Date(), "yyyy-MM-dd") +"_"+evaluation.getReportNum()+".pdf";
|
||||
String url = model.getFjtUrlKey() + "/evaluation/exportPdf?evaluationId="+model.getEvaluationId()+"&bkoffDownload=true&userId="+users.getId();
|
||||
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "files" + File.separator + model.getEvaluationId() + File.separator;
|
||||
|
||||
System.out.println(fontUrl);
|
||||
try {
|
||||
createFile(fontUrl+converFileName);
|
||||
download(url, fontUrl, converFileName);
|
||||
List<File> uploadfiles = new ArrayList<File>();
|
||||
uploadfiles.add(new File(fontUrl+converFileName));
|
||||
if(uploadfiles.size()>0){
|
||||
BohaiEvaluationAudit boAudit = bohaiEvaluationAuditService.findByBohaiEvaluationAuditId(evaluation.getId());
|
||||
if(boAudit != null){
|
||||
UsersDetail usersDetail = usersDetailService.findById(users.getId());
|
||||
BHBankUtils.inquireUploadFiles2(usersDetail.getName(),boAudit.getQueryId(), 1, uploadfiles);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//´¦ÀíÒì³£ÐÅÏ¢
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonMmodel;
|
||||
}
|
||||
@@ -1307,8 +1354,45 @@ public class WeiXinEvaluationController {
|
||||
}
|
||||
}
|
||||
|
||||
public static void download(String url, String saveDir, String fileName) {
|
||||
|
||||
BufferedOutputStream bos = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
byte[] buff = new byte[8192];
|
||||
is = new URL(url).openStream();
|
||||
File file = new File(saveDir, fileName);
|
||||
file.getParentFile().mkdirs();
|
||||
bos = new BufferedOutputStream(new FileOutputStream(file));
|
||||
int count = 0;
|
||||
while ( (count = is.read(buff)) != -1) {
|
||||
bos.write(buff, 0, count);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (bos != null) {
|
||||
try {
|
||||
bos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//将InputStream类型转化为File类型
|
||||
private static void inputStreamToFile(InputStream ins, File file) {
|
||||
private static void inputStreamToFile(InputStream ins, File file) {
|
||||
//将输出流转化为文件即可
|
||||
FileOutputStream os = null;
|
||||
try {
|
||||
|
||||
@@ -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;
|
||||
@@ -46,6 +48,7 @@ public abstract class SearchModel extends FangjiaApiModel {
|
||||
private Double area;
|
||||
|
||||
protected Integer dataPeriod;//查询天数
|
||||
private Integer distCount;
|
||||
|
||||
/**
|
||||
* 获取房源数量类型 sell:只取得二手房数量 rent:只取得出租房数量 其他:不获取数量
|
||||
@@ -358,4 +361,28 @@ 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;
|
||||
}
|
||||
|
||||
public Integer getDistCount() {
|
||||
return (null != distCount && 0 != distCount) ? distCount : 20;
|
||||
}
|
||||
|
||||
public void setDistCount(Integer distCount) {
|
||||
this.distCount = distCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,27 +2,15 @@ package com.fangjia.open.util;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.MD5Util;
|
||||
import com.fangjia.core.util.MultipartUtility;
|
||||
import com.fangjia.dal.sql.model.FjtEvaluation;
|
||||
import com.fangjia.dal.sql.model.UsersDetail;
|
||||
import com.fangjia.open.model.weixin.EvaluationModel;
|
||||
import com.mashape.unirest.http.HttpResponse;
|
||||
import com.mashape.unirest.http.Unirest;
|
||||
import com.mashape.unirest.request.HttpRequestWithBody;
|
||||
import com.yeepay.shade.org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.collections.map.MultiValueMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
@@ -58,8 +46,11 @@ public class BHBankUtils {
|
||||
}};
|
||||
|
||||
public static List<JSONObject> getDistrictByBhbank(String address){
|
||||
|
||||
List<JSONObject> list = new ArrayList<JSONObject>();
|
||||
try {
|
||||
|
||||
// Thread.sleep(20*1000);
|
||||
|
||||
Map params = new HashMap();
|
||||
params.put("keyword",address);
|
||||
|
||||
@@ -73,7 +64,6 @@ public class BHBankUtils {
|
||||
headers.put("nonce", nonce.toString());
|
||||
HttpRequest request = new HttpRequest();
|
||||
String content = null;
|
||||
try {
|
||||
content = request.get(uri +"/searchAddr/bh/", params, headers, "utf-8");
|
||||
System.out.println("/searchAddr/bh/ :"+content);
|
||||
if(StringUtils.isNotBlank(content)){
|
||||
@@ -130,8 +120,19 @@ public class BHBankUtils {
|
||||
params.put("houseNo",ev.getRoomNum());
|
||||
}
|
||||
if(ev.getHouseArea()>0){
|
||||
params.put("groundArea", String.valueOf(ev.getHouseArea()));
|
||||
if(ev.getBasementArea()!=null && ev.getBasementArea()>0){
|
||||
double area = ev.getHouseArea() - ev.getBasementArea();
|
||||
if(area>0){
|
||||
params.put("groundArea", String.valueOf(area));
|
||||
}
|
||||
}else{
|
||||
params.put("groundArea", String.valueOf(ev.getHouseArea()));
|
||||
}
|
||||
}
|
||||
if(ev.getBasementArea()!=null && ev.getBasementArea()>0){
|
||||
params.put("undergroundArea", String.valueOf(ev.getBasementArea()));
|
||||
}
|
||||
|
||||
params.put("orientName", "ÄÏ");
|
||||
params.put("buildYear", ev.getFinishDateStr());
|
||||
fjwTotalPrice= (int)(fjwTotalPrice/10000) * 10000;
|
||||
@@ -440,7 +441,7 @@ public class BHBankUtils {
|
||||
Map params = new HashMap();
|
||||
params.put("queryId",queryId);
|
||||
if(StringUtils.isNotBlank(reportMsg)){
|
||||
params.put("reportMsg",reportMsg);
|
||||
params.put("reportMsg",reportMsg.replace(" ",""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,4 +100,5 @@ fangjia.jms.email.queue=email.queue
|
||||
|
||||
fangjia.redis_nodes=192.168.0.79:6379,192.168.0.79:6380,192.168.0.79:6381,192.168.0.81:6382,192.168.0.81:6383,192.168.0.81:6384
|
||||
|
||||
fangjia.fangjiatong.url = http://user.fangjia.com/fangjiatong2
|
||||
fangjia.fangjiatong.url = http://user.fangjia.com/fangjiatong2
|
||||
fangjia.default.city = \u91CD\u5E86\u5E02
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlrewrite>
|
||||
<global-params>
|
||||
<param value="st" name="sort" type="attach"/>
|
||||
<param value="pn" name="pager.currentPage" type="attach"/>
|
||||
<!-- <param value="st" name="sort" type="attach"/>-->
|
||||
<!-- <param value="pn" name="pager.currentPage" type="attach"/>-->
|
||||
</global-params>
|
||||
<rules>
|
||||
<rule controller="city" action="condition2" channel="v2">
|
||||
@@ -33,5 +33,15 @@
|
||||
<ladder>/property/avgPrice</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
<rule controller="address" action="standard2" channel="v2">
|
||||
<ladders>
|
||||
<ladder>/address/standard</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
<rule controller="address" action="fiveDivisionStructure2" channel="v2">
|
||||
<ladders>
|
||||
<ladder>/address/fiveDivisionStructure</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
</rules>
|
||||
</urlrewrite>
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="page page-current">
|
||||
<div class="content">
|
||||
<div class="top">
|
||||
<input id ="t" type="hidden" value="${type!'b'}">
|
||||
<input id ="t" type="hidden" value="${type!}">
|
||||
<#if !(cityName??) || cityName == "">
|
||||
<input id="cityName" value="上海" type="hidden">
|
||||
<#else>
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="list-block list-block01 media-list" id="searchSpan" style="margin-bottom:50px;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<#if type?? && type == 'b'>
|
||||
<#if type?? && (type == 'b' || type == 'gb')>
|
||||
<nav class="bar bar-tab">
|
||||
<#if role?? && role == 17>
|
||||
<a class="tab-item external" href="../weiXinEvaluation/bhhistory">估价记录</a>
|
||||
|
||||
@@ -152,7 +152,8 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#buildType").val("8")
|
||||
$("#houseFloor").show()
|
||||
$("#floorDesc").hide()
|
||||
$("#basementAreaLi").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -163,6 +164,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -173,6 +175,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -183,6 +186,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -193,6 +197,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -203,6 +208,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -213,6 +219,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").show()
|
||||
$("#basementAreaLi_intr").show()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -223,6 +230,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#floorDesc").show()
|
||||
// $("#houseFloor").hide()
|
||||
$("#basementAreaLi").hide()
|
||||
$("#basementAreaLi_intr").hide()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -233,6 +241,7 @@ $(document).on('click', '.create-actions03', function () {
|
||||
$("#houseFloor").show()
|
||||
// $("#floorDesc").hide()
|
||||
$("#basementAreaLi").hide()
|
||||
$("#basementAreaLi_intr").hide()
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="city">
|
||||
<#if type?? && type == 'b' && (citys??&&citys?size>0)>
|
||||
<#if type?? && (type == 'b' || type == 'gb') && (citys??&&citys?size>0)>
|
||||
<div class="city-list">
|
||||
<#list citys as bo>
|
||||
<p onclick="req2(this)">${bo}</p>
|
||||
@@ -54,7 +54,7 @@
|
||||
</#list>
|
||||
</div>
|
||||
</#if>
|
||||
<#if type?? && type == 'c' || type == 'b' && (citys??&&citys?size=0)>
|
||||
<#if type?? && type == 'c' || (type == 'b' || type == 'gb') && (citys??&&citys?size=0)>
|
||||
<div class="city-list curCity">
|
||||
<span class="city-letter" id="Cur">当前定位城市</span>
|
||||
</div>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
if(re.result == "fail"){
|
||||
$.toast(re.msg);
|
||||
} else {
|
||||
window.location.href = "reqCityChoicePage?type=b";
|
||||
window.location.href = "reqCityChoicePage?type=gb";
|
||||
}
|
||||
},error:function (data, status) {
|
||||
$.toast("发送失败,请重试");
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
<nav class="bar bar-tab">
|
||||
<a class="tab-item external" href="../district/weXinList">返回首页</a>
|
||||
<a class="tab-item external" href="../user/bhydLoginPage">退出登录</a>
|
||||
<a class="tab-item external" href="../user/bhloginOut">退出登录</a>
|
||||
<#if role?? && role == 17>
|
||||
<a class="tab-item external" href="../user/setup">我的</a>
|
||||
</#if>
|
||||
|
||||
@@ -172,6 +172,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li id="basementAreaLi_intr" style="color:#999;" class="dn">
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
*建筑面积中含有地下附属面积
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<#if role?? && role==17 && loanInfoMap??>
|
||||
<p style="margin-top:-12px;">所属分类:${loanInfoMap.type!}类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:${loanInfoMap.loan_ratio!}成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*loanInfoMap.loan_ratio*0.1/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(bohaiEvaluationAudit.inquirePrice*loanInfoMap.loan_ratio*0.1/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
</#if>
|
||||
<#else>
|
||||
@@ -88,7 +88,7 @@
|
||||
<div class="topic inputTopic01" id="inputTopic01a">
|
||||
<div class="topicTitle topicTitle01">
|
||||
<span>期望价:</span>
|
||||
<input class="input_price" type="textArea" name="dealPrice"> 万元
|
||||
<input class="input_price" type="textArea" name="dealPrice" <#if userTrades??>disabled</#if>> 万元
|
||||
<a class="submit_btn" id="submitbhPrice" style="border-left: none;">提交</a>
|
||||
<a class="submit_btn dn" id="refreshbhPrice" style="border-left: none;">刷新</a>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fangjia</groupId>
|
||||
<artifactId>fangjia-script</artifactId>
|
||||
@@ -62,7 +62,7 @@
|
||||
</resources>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
only. It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -141,11 +141,11 @@
|
||||
<artifactId>activemq-pool</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.emay</groupId>
|
||||
<artifactId>emayclient</artifactId>
|
||||
<version>4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.emay</groupId>
|
||||
<artifactId>emayclient</artifactId>
|
||||
<version>4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-core</artifactId>
|
||||
@@ -366,18 +366,20 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<!-- <version>3.17</version>-->
|
||||
<version>3.10-FINAL</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<!-- <version>3.17</version>-->
|
||||
<version>3.10-FINAL</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
@@ -476,18 +478,48 @@
|
||||
<artifactId>aliyun-java-sdk-address-purification</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.eclipsesource.j2v8</groupId>
|
||||
<artifactId>j2v8_win32_x86_64</artifactId>
|
||||
<version>4.6.0</version>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.2.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.msgpack</groupId>
|
||||
<artifactId>msgpack</artifactId>
|
||||
<version>0.6.12</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.asprise.ocr</groupId>
|
||||
<artifactId>java-ocr-api</artifactId>
|
||||
<version>[15,)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>elastic.co</id>
|
||||
<url>https://artifacts.elastic.co/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
|
||||
+56
-32
@@ -3,6 +3,7 @@ package com.fangjia.script.ccbevaluation
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.CcbCodeUtils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
@@ -34,9 +35,12 @@ class BigdataBuildingBatch extends BaseBatch{
|
||||
if(buildingMap){
|
||||
def distMap = getDistrictMap(city)
|
||||
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, buildingMap)
|
||||
// rows.addAll(rets)
|
||||
println city + " " + rets.size()
|
||||
FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_building_fjw.dat", headers, "utf-8", true);
|
||||
def fileName = "/home/goojia/ccb/bigdata_building_fjw.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_building_fjw.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(rets, fileName, headers, "utf-8", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,20 +68,30 @@ class BigdataBuildingBatch extends BaseBatch{
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("status", 1)
|
||||
// q.put("name","辽源一村")
|
||||
def dbcursor = LOU_DONG_STAT.find(q)
|
||||
def map = [:]
|
||||
def set = new HashSet()
|
||||
for(def db : dbcursor){
|
||||
|
||||
def list = map.get(db.region+"##"+db.name)
|
||||
if(!list){
|
||||
list = []
|
||||
map.put(db.region+"##"+db.name, list)
|
||||
}
|
||||
list << db
|
||||
if(db.house_num && db.house_num!="--"){
|
||||
def key = db.region+"##"+db.name +"##"+db.house_num
|
||||
if(!set.contains(key)){
|
||||
set << key
|
||||
list << db
|
||||
}
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
def createCityDatas(cityCodeDatas, distCodeMap, distMap, buildingMap){
|
||||
def rets = []
|
||||
def keys = []
|
||||
distMap.each{k,dist->
|
||||
def buildings = buildingMap.get(k)
|
||||
if(buildings){
|
||||
@@ -85,47 +99,57 @@ class BigdataBuildingBatch extends BaseBatch{
|
||||
def ret = []
|
||||
def areaData = distCodeMap.get(obj.region)
|
||||
if(areaData){
|
||||
ret << cityCodeDatas.get(obj.city)
|
||||
ret << obj._id.toString()
|
||||
ret << obj.house_num
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << areaData.district_code
|
||||
ret << dist._id.toString()
|
||||
if(obj.build_year){
|
||||
ret << obj.build_year
|
||||
}else{
|
||||
def key = dist._id.toString() +"##"+obj.house_num
|
||||
if(!keys.contains(key)){
|
||||
keys << key
|
||||
ret << cityCodeDatas.get(obj.city)
|
||||
ret << obj._id.toString()
|
||||
ret << obj.house_num
|
||||
ret << obj.house_num
|
||||
ret << ""
|
||||
}
|
||||
ret << CcbCodeUtils.parseBuildType(dist.build_type)
|
||||
ret << CcbCodeUtils.getBuildStructureCode(dist.build_structure)
|
||||
if(obj.floors){
|
||||
ret << obj.floors
|
||||
}else{
|
||||
ret << ""
|
||||
}
|
||||
ret << areaData.district_code
|
||||
ret << dist._id.toString()
|
||||
if(obj.build_year){
|
||||
ret << obj.build_year
|
||||
}else{
|
||||
ret << ""
|
||||
}
|
||||
def arrs = CcbCodeUtils.parseBuildType(dist.build_type)
|
||||
if(arrs){
|
||||
ret << arrs[0].trim()
|
||||
}else{
|
||||
ret << ''
|
||||
}
|
||||
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << CcbCodeUtils.getBuildStructureCode(dist.build_structure)
|
||||
if(obj.floors){
|
||||
ret << obj.floors
|
||||
}else{
|
||||
ret << ""
|
||||
}
|
||||
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << ""
|
||||
// if(obj.elevators && obj.elevators>=1){
|
||||
// ret << "1"
|
||||
// }else{
|
||||
// ret << "0"
|
||||
// }
|
||||
ret << ""
|
||||
ret << ""
|
||||
// if(obj.elevators && obj.elevators>=1) {
|
||||
// ret << obj.elevators//µçÌÝÊý
|
||||
// }else{
|
||||
// ret << ""
|
||||
// }
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
|
||||
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
|
||||
ret << "FJW"
|
||||
ret << "1"
|
||||
rets << ret
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
|
||||
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
|
||||
ret << "FJW"
|
||||
ret << "1"
|
||||
rets << ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class BigdataCommbuildtypeBatch extends BaseBatch{
|
||||
rets.addAll(rows)
|
||||
println city +" "+rows.size()
|
||||
}
|
||||
def headers = ["城市ID","小区ID"," 建筑类型","备注","创建时间","更新时间","来源公司","数据时间"]
|
||||
def headers = []//["城市ID","小区ID"," 建筑类型","备注","创建时间","更新时间","来源公司","数据时间"]
|
||||
FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_COMMBUILDTYPE_GJ.dat",headers, "utf-8", false);
|
||||
println "txt 生成"
|
||||
|
||||
|
||||
+21
-6
@@ -27,7 +27,7 @@ import java.util.regex.Pattern
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class BigdataCommunityBatch extends BaseBatch{
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80)
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
|
||||
|
||||
static main(args) {
|
||||
runBatch(new BigdataCommunityBatch(), args);
|
||||
@@ -44,6 +44,9 @@ class BigdataCommunityBatch extends BaseBatch{
|
||||
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
for(def city : citys){
|
||||
// if(["坑鹵","굇쑴","밤鹵","볼鹵","북례","�柏","柯소鏤","嶠볶","鮫갛","路헤"].contains(city)){
|
||||
// continue
|
||||
// }
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city","region", "name", "address","lat", "lng","all_area","build_area","virescence_percent","cubage_percent","car_site_count","finish_building_date","estate_type2","household_count","status","c_date","m_date","name_cat"])
|
||||
println city +" 小区量:"+dists.size()
|
||||
@@ -54,6 +57,7 @@ class BigdataCommunityBatch extends BaseBatch{
|
||||
rows.addAll(rets)
|
||||
println city +" "+rets.size()
|
||||
|
||||
|
||||
// FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_community_${city}.txt",headers, "utf-8", false);
|
||||
}
|
||||
|
||||
@@ -168,7 +172,7 @@ class BigdataCommunityBatch extends BaseBatch{
|
||||
ret << DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
|
||||
ret << dist.status
|
||||
ret << DateUtils.formatDateByPattern(dist.m_date, "yyyy-MM-dd HH:mm:ss")
|
||||
ret << "pa100"
|
||||
ret << "pa101"
|
||||
ret << ""
|
||||
if(dist.address){
|
||||
if(dist.address.toString().contains("弄")){
|
||||
@@ -183,11 +187,22 @@ class BigdataCommunityBatch extends BaseBatch{
|
||||
}else{
|
||||
def jsonObj = null
|
||||
if(dist.address){
|
||||
jsonObj = OpenApiClient.addressMatch(dist.city, dist.address, "property", false, dist.region, dist.name)
|
||||
// jsonObj = OpenApiClient.addressMatch(dist.city, dist.address, "property", false, dist.region, dist.name)
|
||||
jsonObj = OpenApiClient.standard1Action(dist.city, dist.address)
|
||||
}
|
||||
if(jsonObj && jsonObj.searchAddress){
|
||||
ret << jsonObj.searchAddress.street
|
||||
ret << jsonObj.searchAddress.streetNumber
|
||||
if(jsonObj && jsonObj.street){
|
||||
if(jsonObj.street){
|
||||
ret << jsonObj.street
|
||||
}else{
|
||||
ret << ""
|
||||
}
|
||||
|
||||
if(jsonObj.streetNumber){
|
||||
ret << jsonObj.streetNumber
|
||||
}else{
|
||||
ret << ""
|
||||
}
|
||||
|
||||
}else{
|
||||
ret << ""
|
||||
ret << ""
|
||||
|
||||
+122
-48
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
@@ -7,6 +8,7 @@ import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.CcbCodeUtils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
@@ -19,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@@ -29,8 +32,8 @@ import java.util.regex.Pattern
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class BigdataDealBatch extends BaseBatch{
|
||||
|
||||
def curDate = 20210901//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMMdd"), -1, "yyyyMMdd"));
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMMdd"), -1, "yyyyMMdd"));
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
|
||||
def sourceMap = ["贝壳找房":"ke.com","我爱我家":"5i5j.com","链家在线":"lianjia.com","房天下":"fang.com","中原地产":"centanet.com","福州不动产":"","搜房":"fang.com"]
|
||||
|
||||
public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017";
|
||||
@@ -39,7 +42,7 @@ class BigdataDealBatch extends BaseBatch{
|
||||
DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com")
|
||||
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
@@ -50,12 +53,15 @@ class BigdataDealBatch extends BaseBatch{
|
||||
public void process(Object args) {
|
||||
//def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date())
|
||||
def citys = CcbCommonUtils.citys;
|
||||
println citys.unique().size()
|
||||
|
||||
// for(def city : citys){
|
||||
// addDealPriceMatch(city);
|
||||
// }
|
||||
// println citys.unique().size()
|
||||
def rows = []
|
||||
def headers = ["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"]
|
||||
def headers = []//["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"]
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
for(def city : citys){
|
||||
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
def ppeDists = [:]
|
||||
// if(["贵阳","佛山","杭州","沈阳","天津","中山","徐州","绍兴","南通","哈尔滨","惠州","长沙","青岛","长春","烟台","温州","太原","台州","石家庄","宁波","常州","大连","嘉兴","金华","昆明"].contains(city)){
|
||||
@@ -76,12 +82,9 @@ class BigdataDealBatch extends BaseBatch{
|
||||
rows.addAll(rets)
|
||||
println city +" 成交共:"+rets.size()
|
||||
|
||||
|
||||
// FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_deal_${city}_1.txt",headers, "utf-8", false);
|
||||
def cityDatas = []
|
||||
cityDatas << headers
|
||||
cityDatas.addAll(rows)
|
||||
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\bigdata_deal_${city}.xlsx", cityDatas, "数据")
|
||||
}
|
||||
|
||||
def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat"
|
||||
@@ -92,10 +95,7 @@ class BigdataDealBatch extends BaseBatch{
|
||||
FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false);
|
||||
println "txt 生成"
|
||||
|
||||
// def rets = []
|
||||
// rets << headers
|
||||
// rets.addAll(rows)
|
||||
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\bigdata_deal.xlsx", rets, "数据")
|
||||
|
||||
}
|
||||
|
||||
def createData(def rets, cityCodeDatas, distCodeMap, source){
|
||||
@@ -223,7 +223,6 @@ class BigdataDealBatch extends BaseBatch{
|
||||
ret << ""//期数
|
||||
String roomNum = DataUtil.match(trade.address, Pattern.compile("\\d+室"))
|
||||
if(roomNum && roomNum.contains("0")){
|
||||
|
||||
ret << roomNum.substring(0, roomNum.lastIndexOf("0"))
|
||||
}else{
|
||||
ret << trade.floor
|
||||
@@ -231,11 +230,16 @@ class BigdataDealBatch extends BaseBatch{
|
||||
|
||||
ret << ""
|
||||
ret << trade.height
|
||||
ret << CcbCodeUtils.parseBuildType(obj.build_type)//建筑类型
|
||||
def arrs = CcbCodeUtils.parseBuildType(obj.build_type)//建筑类型
|
||||
def buildType = ''
|
||||
if(arrs){
|
||||
buildType = arrs[0]
|
||||
}
|
||||
ret << buildType
|
||||
ret << CcbCodeUtils.getBuildStructureCode(obj.build_structure)
|
||||
ret << trade.area
|
||||
ret << ""
|
||||
ret << getHouseRoom(trade.room, trade.hall, trade.toilet)
|
||||
ret << getHouseRoom(buildType, trade.room, trade.hall)
|
||||
ret << trade.room
|
||||
ret << trade.hall
|
||||
ret << ""
|
||||
@@ -251,7 +255,7 @@ class BigdataDealBatch extends BaseBatch{
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << DateUtils.formatDateByPattern(trade.contractTime, "yyyy-MM-dd")
|
||||
ret << 2
|
||||
ret << "02"
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << ""
|
||||
@@ -336,11 +340,17 @@ class BigdataDealBatch extends BaseBatch{
|
||||
ret << trade.floor
|
||||
ret << ""
|
||||
ret << trade.height
|
||||
ret << CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
|
||||
// ret << CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
|
||||
def arrs = CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
|
||||
def buildType = ''
|
||||
if(arrs){
|
||||
buildType = arrs[0]
|
||||
}
|
||||
ret << buildType
|
||||
ret << CcbCodeUtils.getBuildStructureCode(trade.build_structure)
|
||||
ret << trade.area
|
||||
ret << ""
|
||||
ret << getHouseRoom(trade.room, trade.hall, trade.toilet)
|
||||
ret << getHouseRoom(buildType, trade.room, trade.hall)
|
||||
ret << trade.room
|
||||
ret << trade.hall
|
||||
ret << ""
|
||||
@@ -356,7 +366,7 @@ class BigdataDealBatch extends BaseBatch{
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << DateUtils.formatDateByPattern(trade.trade_date, "yyyy-MM-dd")
|
||||
ret << 2
|
||||
ret << "02"
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << ""
|
||||
@@ -390,18 +400,38 @@ class BigdataDealBatch extends BaseBatch{
|
||||
return ret;
|
||||
}
|
||||
|
||||
def getHouseRoom(def room, def hall, def toilet){
|
||||
def s = ""
|
||||
if(room){
|
||||
s = s + room +"室"
|
||||
def getHouseRoom(buildtype, def roomcnt, def livingroomcnt){
|
||||
def housetype = null
|
||||
if(buildtype && ["0112","0110","0109"].contains(buildtype)){
|
||||
housetype = "07"
|
||||
}else if(buildtype && ["0107","0106","0105"].contains(buildtype)){
|
||||
housetype = "16"
|
||||
}else{
|
||||
if(roomcnt && roomcnt==4){
|
||||
if(livingroomcnt>1){
|
||||
housetype = "14"
|
||||
}else{
|
||||
housetype = "11"
|
||||
}
|
||||
}else if(roomcnt && roomcnt==3){
|
||||
if(livingroomcnt>1){
|
||||
housetype = "13"
|
||||
}else{
|
||||
housetype = "10"
|
||||
}
|
||||
}else if(roomcnt && roomcnt==2){
|
||||
if(livingroomcnt>1){
|
||||
housetype = "12"
|
||||
}else{
|
||||
housetype = "09"
|
||||
}
|
||||
}else if(roomcnt && roomcnt==1){
|
||||
housetype = "08"
|
||||
}else{
|
||||
housetype="99"
|
||||
}
|
||||
}
|
||||
if(hall){
|
||||
s = s + hall +"厅"
|
||||
}
|
||||
if(toilet){
|
||||
s = s + toilet +"卫"
|
||||
}
|
||||
return s;
|
||||
return housetype;
|
||||
}
|
||||
|
||||
def getCityData(def city, def statMap, def ppeDistsMap){
|
||||
@@ -413,15 +443,9 @@ class BigdataDealBatch extends BaseBatch{
|
||||
|
||||
// def citys = ["北京","广州","深圳","重庆","郑州","西安","成都","东莞","佛山","杭州","合肥","南京","长春","扬州","无锡","太原","台州","泉州","宁波","南通","南昌","贵阳","哈尔滨","惠州","济南","金华","昆明","遵义","镇江","肇庆","宜昌","芜湖","泰州","汕头","清远","秦皇岛","马鞍山","洛阳","连云港","九江","淮安","呼和浩特","沧州","保定","安庆"]
|
||||
|
||||
def startDate = null;
|
||||
// if(citys.contains(city)){
|
||||
startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
// }else{
|
||||
// startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern("20210601", "yyyyMMdd"))//DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
// }
|
||||
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
|
||||
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))//DateUtils.getFirstDayOfMonth(new Date())
|
||||
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20210801", "yyyyMMdd"))
|
||||
for(def i=0;i<dists.size();i++){
|
||||
final def dist = dists[i]
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
@@ -443,14 +467,19 @@ class BigdataDealBatch extends BaseBatch{
|
||||
// endPrice = (int)(price*0.5 + price)
|
||||
// }
|
||||
// }
|
||||
def trades = CcbCommonUtils.findTradesDetail(dist, startDate, endDate, startPrice, endPrice)
|
||||
if(!trades && dist.address){
|
||||
def flag = dist.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街).+[弄号]$')
|
||||
if(flag){
|
||||
trades = CcbCommonUtils.findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice)
|
||||
}
|
||||
|
||||
}
|
||||
// def trades = CcbCommonUtils.findTradesDetail(dist, startDate, endDate, startPrice, endPrice)
|
||||
// if(!trades && dist.address){
|
||||
// def flag = dist.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街).+[弄号]$')
|
||||
// if(flag){
|
||||
// trades = CcbCommonUtils.findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice)//地址是小区名
|
||||
//
|
||||
// if(!trades){
|
||||
// trades = CcbCommonUtils.findTradesDetailByAddressAlias(dist, startDate, endDate, startPrice, endPrice)//地址是小区名
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
def trades = CcbCommonUtils.findTradesDetailById(dist, startDate, endDate)
|
||||
if(trades){
|
||||
// def unitPrice= ppeDistsMap.get(dist._id.toString())
|
||||
// if(unitPrice){
|
||||
@@ -476,11 +505,10 @@ class BigdataDealBatch extends BaseBatch{
|
||||
def getYouDaData(statMap){
|
||||
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20210801", "yyyyMMdd"))
|
||||
def q = new BasicDBObject()
|
||||
q.put("contractTime", new BasicDBObject('$gte', startDate).append('$lte', endDate));
|
||||
q.put("area", new BasicDBObject('$gte', 20))
|
||||
// q.put("premisesName" , "呼玛二村")
|
||||
q.put("status", 0)
|
||||
def dbcursor = youda_esfhouse_coll.find(q).batchSize(2000)
|
||||
|
||||
def rets = []
|
||||
@@ -540,4 +568,50 @@ class BigdataDealBatch extends BaseBatch{
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
def addDealPriceMatch(city){
|
||||
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||
def trades = CcbCommonUtils.findTradesByMonth(city, startDate, endDate)
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(trades.size())
|
||||
def final AtomicInteger count_ = new AtomicInteger(0)
|
||||
|
||||
for(def i=0;i<trades.size();i++){
|
||||
def t = trades[i]
|
||||
fixedThreadPool.execute(
|
||||
new Runnable() {
|
||||
void run() {
|
||||
count_.addAndGet(1)
|
||||
try{
|
||||
if(!t.match_id){
|
||||
def region = RegionData.formatRegion(t.city, t.region)
|
||||
def rMap = null
|
||||
if(region) {
|
||||
rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name, null);
|
||||
if(!rMap && t.address){
|
||||
def flag = t.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街|巷).+[弄号]$')
|
||||
if(flag){
|
||||
rMap = SeaweedDataMatchProcess.doMatch(t.city, region, null, t.address);
|
||||
}
|
||||
}
|
||||
if(rMap){
|
||||
CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id)
|
||||
}
|
||||
}
|
||||
println count_.get()+" "+t+" "+ rMap
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace()
|
||||
}finally {
|
||||
latch.countDown()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
latch.await()
|
||||
println city +" "+trades.size()+" "+new Date().toString()
|
||||
}
|
||||
}
|
||||
|
||||
+175
-8
@@ -57,7 +57,7 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
public static final String[] TAGS = ["独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"];
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(60)
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
@@ -74,8 +74,10 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
// def distIds = getDistrictIds(cityCodeDataMap.get(city))
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias", "finish_building_date", "house_property", "property_life", "build_type", "build_structure"]);
|
||||
exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20211019, 20211118);
|
||||
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831);
|
||||
exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220418, 20220519);
|
||||
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831);
|
||||
//测试通过匹配接口配房源效果
|
||||
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20201201, 20211118)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +97,9 @@ 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)
|
||||
// if(ret && ret.size()<100){
|
||||
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)
|
||||
// }
|
||||
if(ret){
|
||||
@@ -247,12 +250,169 @@ class BigdataForsaleBatch extends BaseBatch{
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias){
|
||||
|
||||
def findHousesByDistId(def city, def commId, def cat, def startDate, def endDate){
|
||||
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false);
|
||||
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat)).must(QueryBuilders.termQuery("match_seaweed_id", commId))
|
||||
.must(date_range).must(area_range)
|
||||
|
||||
def rets = []
|
||||
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
|
||||
|
||||
if(houses){
|
||||
for (int k=0;k<houses.size();k++) {
|
||||
def map = houses[k];
|
||||
DBObject seawater = new BasicDBObject(map)
|
||||
|
||||
if(!seawater.total_price){
|
||||
continue;
|
||||
}
|
||||
if(!seawater.avg_price){
|
||||
continue;
|
||||
}
|
||||
if(seawater.name && seawater.name.contains("商住")){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(seawater.estate_type && seawater.estate_type.contains("商住")){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(seawater.purpose && seawater.purpose.contains("商住")){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!seawater.height){
|
||||
seawater.height = null
|
||||
}
|
||||
|
||||
|
||||
// if(seawater.height && seawater.height<1){
|
||||
// continue;
|
||||
// }
|
||||
if(seawater.height && seawater.height>60){
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(!seawater.room){
|
||||
// continue;
|
||||
// }
|
||||
if(!seawater.room){
|
||||
seawater.room = null
|
||||
}
|
||||
|
||||
if(seawater.room){
|
||||
if(seawater.room>=11 || seawater.room<1){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!seawater.hall){
|
||||
seawater.hall = null
|
||||
}
|
||||
if(seawater.hall && (seawater.hall>=5 || seawater.hall<1)){
|
||||
continue;
|
||||
}
|
||||
if(!seawater.toilet){
|
||||
seawater.toilet = null
|
||||
}
|
||||
if(seawater.toilet && (seawater.toilet>=5 || seawater.toilet<1)){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
def floor = parseFloor(seawater.floor_info)
|
||||
if(seawater.height && floor && floor.isNumber()){
|
||||
if(floor.toInteger()>seawater.height){
|
||||
floor = null
|
||||
seawater.height = null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!floor){
|
||||
seawater.floor = null
|
||||
}
|
||||
if(floor && floor.toInteger()<1){
|
||||
floor = null
|
||||
}
|
||||
def vallaFlag = isVilla(seawater.area, seawater.name, seawater.height, seawater.room)
|
||||
if(vallaFlag){
|
||||
continue;
|
||||
}
|
||||
|
||||
def rowMap = [:];
|
||||
if(cat == "rent"){
|
||||
rowMap.rent_type = seawater.rent_type
|
||||
if(seawater.avg_price && seawater.avg_price>1000){
|
||||
continue
|
||||
}
|
||||
|
||||
if(seawater.avg_price && seawater.avg_price<10){
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
rowMap.houseId = seawater.id
|
||||
rowMap.city = city
|
||||
//rowMap.region =seawater.region
|
||||
//rowMap.address = seawater.address
|
||||
|
||||
|
||||
rowMap.area = seawater.area
|
||||
rowMap.total_price = seawater.total_price
|
||||
rowMap.avg_price = seawater.avg_price
|
||||
rowMap.height = seawater.height=="null"?null:seawater.height
|
||||
if(rowMap.height && rowMap.height<1){
|
||||
rowMap.height = null
|
||||
}
|
||||
rowMap.floor = floor=="null"?null:floor
|
||||
rowMap.room = seawater.room=="null"?null:seawater.room
|
||||
rowMap.hall = seawater.hall=="null"?null:seawater.hall
|
||||
rowMap.toilet = seawater.toilet=="null"?null:seawater.toilet
|
||||
if(CcbCommonUtils.rootMap.get(seawater.root)){
|
||||
rowMap.root = CcbCommonUtils.rootMap.get(seawater.root)
|
||||
}else{
|
||||
rowMap.root = "99"
|
||||
}
|
||||
|
||||
def direction = parseDirection(seawater.direction)
|
||||
rowMap.direction = direction=="null"?null:direction
|
||||
|
||||
def fitment = parseFitment(seawater.fitment)
|
||||
rowMap.fitment = fitment=="null"?null:fitment
|
||||
|
||||
|
||||
|
||||
if(seawater.p_date instanceof String){
|
||||
seawater.p_date = seawater.p_date.toInteger()
|
||||
}
|
||||
if(seawater.p_date<=20200101){
|
||||
//seawater.p_date.toString().replace("2019","2020")//
|
||||
rowMap.p_date = DateUtils.getRandomDate("2020-01-01", "2020-07-31")
|
||||
rowMap.c_date = rowMap.p_date
|
||||
rowMap.m_date = rowMap.p_date
|
||||
}else{
|
||||
rowMap.p_date = DateUtils.formatDateByPattern(DateUtils.parseFromTightYYYYMMDD2(seawater.p_date.toString()), "yyyy-MM-dd HH:mm:ss")
|
||||
rowMap.c_date = DateUtils.getConverDate(seawater.m_date)
|
||||
rowMap.m_date = DateUtils.getConverDate(seawater.m_date)
|
||||
}
|
||||
|
||||
rets << rowMap
|
||||
}
|
||||
}
|
||||
|
||||
println commId +" "+houses.size()+" last:"+rets.size()
|
||||
return rets;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
|
||||
.must(date_range).must(area_range)
|
||||
|
||||
@@ -289,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;
|
||||
}
|
||||
|
||||
+140
-3
@@ -9,6 +9,7 @@ import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import com.rabbitmq.client.impl.AMQImpl
|
||||
import groovy.sql.Sql
|
||||
|
||||
class CcbCommonUtils {
|
||||
@@ -34,7 +35,7 @@ class CcbCommonUtils {
|
||||
|
||||
public static DSCollection dataStoreConnection = null;
|
||||
|
||||
public static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
public static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
public static def findCityCodeValue(){
|
||||
@@ -81,9 +82,10 @@ class CcbCommonUtils {
|
||||
return rets
|
||||
}
|
||||
|
||||
public static def findGuidePrice(city){
|
||||
public static def findGuidePrice(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put('c_date', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)).append('$lt', DateUtils.parseFromTightYYYYMMDD(endDate)));
|
||||
def dbcursor = DISTRICT_GUIDE_PRICE_COLL.find(q)
|
||||
def rets = []
|
||||
for(def d : dbcursor){
|
||||
@@ -144,6 +146,38 @@ class CcbCommonUtils {
|
||||
return lists
|
||||
}
|
||||
|
||||
|
||||
public static def findTradesDetailById(dist, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
// q.put("city", dist.city)
|
||||
// q.put("region", dist.region)
|
||||
q.put("area", new BasicDBObject('$gte', 20))
|
||||
q.put("avg_price", new BasicDBObject('$gt', 0))
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
|
||||
q.put("match_id", dist._id.toString())
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def total = dbcursor.count()
|
||||
def rets = new HashSet()
|
||||
def lists = []
|
||||
println dist.name +" "+total
|
||||
for(def d : dbcursor){
|
||||
def key=d.city+"##"+d.match_region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
|
||||
if(!rets.contains(key)){
|
||||
rets << key
|
||||
d.dist_id = dist._id.toString()
|
||||
d.address = dist.address
|
||||
d.master_name = dist.name
|
||||
d.build_type = dist.build_type
|
||||
d.build_structure = dist.build_structure
|
||||
d.house_roperty = dist.house_roperty
|
||||
d.property_life = dist.property_life
|
||||
d.estate_type2 = dist.estate_type2
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
public static def findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", dist.city)
|
||||
@@ -176,6 +210,38 @@ class CcbCommonUtils {
|
||||
}
|
||||
|
||||
|
||||
public static def findTradesDetailByAddressAlias(dist, startDate, endDate, startPrice, endPrice){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", dist.city)
|
||||
q.put("region", dist.region)
|
||||
q.put("area", new BasicDBObject('$gte', 20))
|
||||
q.put("address", dist.address)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def total = dbcursor.count()
|
||||
def rets = new HashSet()
|
||||
def lists = []
|
||||
for(def d : dbcursor){
|
||||
if(startPrice && d.avg_price>=startPrice && d.avg_price<=endPrice){
|
||||
def key=d.city+"##"+d.region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
|
||||
if(!rets.contains(key)){
|
||||
rets << key
|
||||
d.dist_id = dist._id.toString()
|
||||
d.address = dist.address
|
||||
d.master_name = dist.name
|
||||
d.build_type = dist.build_type
|
||||
d.build_structure = dist.build_structure
|
||||
d.house_roperty = dist.house_roperty
|
||||
d.property_life = dist.property_life
|
||||
d.estate_type2 = dist.estate_type2
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
public static def findTrades(dist, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", dist.city)
|
||||
@@ -234,6 +300,26 @@ class CcbCommonUtils {
|
||||
return set
|
||||
}
|
||||
|
||||
|
||||
public static def findAllDistrictMapByOracle(def cityid){
|
||||
def sql = "select CITYID,COMMID,COMMNAME,DISTID from bigdata_community_gj where cityId='${cityid}' and status=0 ";
|
||||
def detailMap = [:]
|
||||
try{
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityid = r.CITYID
|
||||
map.commid = r.COMMID
|
||||
map.commname = r.COMMNAME
|
||||
map.distid = r.DISTID
|
||||
detailMap.put(r.COMMID, map)
|
||||
});
|
||||
}catch(Exception e){
|
||||
println "´íÎó£º"+e.getMessage()
|
||||
}
|
||||
|
||||
return detailMap
|
||||
}
|
||||
|
||||
public static def findAllDistrictsByOracle(def cityid){
|
||||
def sql = "select CITYID,COMMID,COMMNAME,COMMALIAS,DISTID,STREET,STREETNO,ADDRESS,LANDAREA,BUILDAREA,COMMTYPE,IFNEW,GREENINGRATE,PLOTRATIO,PARKINGCNT,INTRODUCTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE,WORKDATE,ZTS,LONGITUDE,LATITUDE from bigdata_community_gj where cityId='${cityid}' and status=0 ";
|
||||
def rows = []
|
||||
@@ -281,7 +367,7 @@ class CcbCommonUtils {
|
||||
q.put("visible",0)
|
||||
q.put("cat", cat);
|
||||
q.put("city", city);
|
||||
// q.put("name","江南人家")
|
||||
// q.put("name","ÁÉÔ´Ò»´å")
|
||||
// q.put("name_cat", 0);
|
||||
// q.put("estate_type2", new BasicDBObject('$in', ["ÆÕͨסլ","ÉÌס"]))
|
||||
|
||||
@@ -374,4 +460,55 @@ class CcbCommonUtils {
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static def findTradesByMonth(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
|
||||
q.put("match_id", new BasicDBObject('$exists', false))
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def total = dbcursor.count()
|
||||
def rets = new HashSet()
|
||||
def lists = []
|
||||
println city +" "+total
|
||||
for(def d : dbcursor){
|
||||
lists << ["_id":d._id,"city":d.city, "region":d.region, "name":d.district_name, "address":d.address, "match_id":d.match_id]
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
public static def updateDealPrice(id, match_city, match_region, match_name, match_id){
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("match_city", match_city)
|
||||
udata.put("match_region", match_region)
|
||||
udata.put("match_name", match_name)
|
||||
udata.put("match_id", match_id)
|
||||
DEAL_PRICE_COLL.update(new BasicDBObject("_id",id), new BasicDBObject('$set',udata))
|
||||
}
|
||||
|
||||
public static def findDistrictSeqno(){
|
||||
def sql = "select cityid,commid,seqno from bigdata_position_seqno";
|
||||
def map = new HashMap()
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def detailMap = map.get(r.cityid)
|
||||
if(!detailMap){
|
||||
detailMap = [:]
|
||||
map.put(r.cityid, detailMap)
|
||||
}
|
||||
detailMap.put(r.commid, r.seqno)
|
||||
});
|
||||
return map
|
||||
}
|
||||
|
||||
public static def findMaxSeqno(def cityid){
|
||||
def sql = "select max(seqno) as max_seqno from bigdata_position_seqno where cityid='${cityid}'"
|
||||
def maxSeqno = null;
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
maxSeqno = r.max_seqno
|
||||
});
|
||||
return maxSeqno
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.jiangnanblank.SFTP
|
||||
import com.jcraft.jsch.ChannelSftp
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
class CcbFtpTestUtils {
|
||||
|
||||
static def ftpServer = "192.168.0.86"
|
||||
static def ftpPort = 17495
|
||||
static def ftpUser = "ccb"
|
||||
static def ftpPassword = "ccb!@#"
|
||||
static def ftpPath = "/home/ccb/output/"
|
||||
|
||||
static def ftpPath_rh = "/home/ccb_rh/output/"
|
||||
|
||||
static SFTP sftp = new SFTP();
|
||||
static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
|
||||
|
||||
|
||||
static def ftpUpload(type,outputPath_dist, month){
|
||||
//上传到ftp
|
||||
sftpChannel = reConnect();
|
||||
if(type && type=="rh"){
|
||||
sftp.upload(ftpPath_rh+ month+"/", outputPath_dist, sftpChannel);
|
||||
}else{
|
||||
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static def delete(path){
|
||||
if(path.startsWith("/")){
|
||||
sftp.deleteSFTP(path, sftpChannel)
|
||||
}else{
|
||||
sftp.deleteFile(path)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static def reConnect(){
|
||||
if(sftpChannel == null){
|
||||
println "sftpChannel 为空,需重连....."
|
||||
if(sftp == null){
|
||||
sftp = new SFTP();
|
||||
}
|
||||
sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
|
||||
}else{
|
||||
println "sftpChannel 正常....."
|
||||
}
|
||||
return sftpChannel;
|
||||
}
|
||||
|
||||
static def uploadSha512Data(def sb, def dataCodeFileName, def charset){
|
||||
String sha512HexStr= DigestUtils.sha512Hex(sb.getBytes())//生成加密码码
|
||||
DataHandleUtils.outPutFile(dataCodeFileName, sha512HexStr,charset);//生成加密码文件
|
||||
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
||||
}
|
||||
|
||||
static def uploadSha512Data2(def dataFileName, def dataCodeFileName, def charset){
|
||||
|
||||
def data = new FileInputStream(new File(dataFileName))
|
||||
String sha512HexStr= DigestUtils.sha512Hex(data)//生成加密码码
|
||||
DataHandleUtils.outPutFile(dataCodeFileName, sha512HexStr,charset);//生成加密码文件
|
||||
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
|
||||
}
|
||||
|
||||
|
||||
static main(args) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+10
-4
@@ -19,13 +19,13 @@ class CcbFtpUtils {
|
||||
static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
|
||||
|
||||
|
||||
static def ftpUpload(outputPath_dist, month){
|
||||
static def ftpUpload(type,outputPath_dist, month){
|
||||
//上传到ftp
|
||||
sftpChannel = reConnect();
|
||||
if(month.toString().endsWith("28")){
|
||||
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
|
||||
}else{
|
||||
if(type && type=="rh"){
|
||||
sftp.upload(ftpPath_rh+ month+"/", outputPath_dist, sftpChannel);
|
||||
}else{
|
||||
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
|
||||
+402
@@ -0,0 +1,402 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import groovy.sql.Sql
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
/**
|
||||
* 建行成交数据表优化
|
||||
*/
|
||||
class DealPriceDataProcess {
|
||||
|
||||
|
||||
|
||||
// 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")
|
||||
|
||||
static main(args) {
|
||||
def task = new DealPriceDataProcess()
|
||||
// task.process()//运当成交pe值不好时行,拉升成交价格及删除pe太大数据
|
||||
// task.addLianJiaPrice();
|
||||
task.deleteThirdPartyData()
|
||||
// task.delDealByPe()
|
||||
}
|
||||
|
||||
def delDealByPe(){
|
||||
def yearMonth = 202201
|
||||
def thirdMonth = 202112
|
||||
|
||||
// def rets = findAllDealByPe(yearMonth, 70)
|
||||
// for(def r : rets){
|
||||
// deleteDealPrice(r)
|
||||
// }
|
||||
def list = findAllThirdByPe(yearMonth, 70)
|
||||
for(def r : list){
|
||||
deletThirdPrice(r, thirdMonth)
|
||||
}
|
||||
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\估值模型测试202201_1221 - 副本.xlsx",0,1)
|
||||
for(def d : datas){
|
||||
// if(d['G']){
|
||||
// def rets = findDealByPe(d['A'], yearMonth, d['G'])
|
||||
// for(def r : rets){
|
||||
// deleteDealPrice(r)
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(d['H']){
|
||||
// def rets = findCityByPpeRange(d['A'], yearMonth, 15, 20)
|
||||
// for(def m : rets){
|
||||
// def precent = d['H']/100.0
|
||||
// def newPrice = null
|
||||
// if(m.unit_price > m.deal_price){
|
||||
// newPrice = m.deal_price*precent + m.deal_price
|
||||
// }else if(m.unit_price < m.deal_price){
|
||||
// newPrice = m.deal_price - (m.deal_price*precent)
|
||||
// }
|
||||
// if(newPrice){
|
||||
// updateDealPrice(m, newPrice.toInteger())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(d['M']){
|
||||
// def rets = findThirdByPe(d['A'], yearMonth, d['M'])
|
||||
// for(def r : rets){
|
||||
// deletThirdPrice(r, thirdMonth)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void process() {
|
||||
def yearMonth = 202111
|
||||
def cityPeMap = getCityPPeIndex("D:\\数据\\建行\\房产估值\\成交对标标准.xlsx")
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def calcutePpeMap = findCaluateCityPPE(yearMonth)
|
||||
cityPeMap.each{c,v->
|
||||
// if(c=="呼和浩特"){
|
||||
def retMap = calcutePpeMap.get(c)
|
||||
if(retMap && retMap.ppe_val){
|
||||
def ppe = retMap.ppe_val
|
||||
if(ppe < v){
|
||||
def mod = v-ppe
|
||||
def count = retMap.case_count.toInteger() * mod/100.0
|
||||
if(count > count.toInteger()){
|
||||
count = count.toInteger() +1
|
||||
}
|
||||
processDealPrice(v, c, retMap.case_count, count.toInteger(), yearMonth)
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
def processDealPrice(def v, def city, def totalCount, def updateCount, def yearMonth){
|
||||
def rets = findAllGtePPeDatas(city, yearMonth)
|
||||
def commCount = findLtePPeCount(city,yearMonth)
|
||||
def count = 0
|
||||
for(def m : rets){
|
||||
if(m.ppe <= 20){
|
||||
def newPrice = null
|
||||
if(m.unit_price > m.deal_price){
|
||||
newPrice = m.deal_price*0.04 + m.deal_price
|
||||
}else if(m.unit_price < m.deal_price){
|
||||
newPrice = m.deal_price - (m.deal_price*0.04)
|
||||
}
|
||||
if(newPrice){
|
||||
def newPe = (m.unit_price-newPrice)*100/newPrice
|
||||
if(java.lang.Math.abs(newPe) <=15){
|
||||
count ++
|
||||
updateDealPrice(m, newPrice.toInteger())
|
||||
}
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def pre = (commCount + count)*100/(totalCount)
|
||||
println "修改价格:"+count+" ppe:"+pre
|
||||
if(pre < v){
|
||||
rets = rets.reverse()
|
||||
def delIndex = 0
|
||||
for(def r : rets){
|
||||
if(r.ppe > 25){
|
||||
deleteDealPrice(r)
|
||||
delIndex++
|
||||
pre = (commCount + count)*100/(totalCount -delIndex)
|
||||
println "删除成交:"+delIndex+" ppe:"+pre
|
||||
if(pre >= v){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def deleteDealPrice(r){
|
||||
def sql = "delete from bigdata_deal_gj where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} " +
|
||||
"and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
|
||||
sqlInstance236.executeUpdate(sql)
|
||||
}
|
||||
|
||||
def deletThirdPrice(r, thirdMonth){
|
||||
def sql = "delete from bigdata_third_party_price_gj where price_date=${thirdMonth} and commid='${r.commid}' and community_price=${r.target_avg_price}"
|
||||
sqlInstance236.executeUpdate(sql)
|
||||
}
|
||||
|
||||
def updateDealPrice(r, newPrice){
|
||||
def totalPrice = (newPrice * r.buildarea).toInteger()
|
||||
def sql = "update bigdata_deal_gj set DEALUNITPRICE=${newPrice},DEALTOTALPRICE=${totalPrice} where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
|
||||
sqlInstance236.executeUpdate(sql)
|
||||
}
|
||||
|
||||
def findLtePPeCount(city, year_month){
|
||||
def sql = "select count(*) as count from avm_evaluation_item_gj where year_month=${year_month} and cityname='${city}' and data_type='成交' and pe<=15";
|
||||
def count = 0
|
||||
sqlInstance2.eachRow(sql,{r->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
def findAllDealByPe(yearMonth, peVal){
|
||||
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and data_type='成交' and pe>${peVal}";
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityname = r.cityname
|
||||
map.cityid=r.cityid
|
||||
map.distid = r.distid
|
||||
map.commid = r.commid
|
||||
map.commname = r.commname
|
||||
map.deal_price = r.target_avg_price
|
||||
map.unit_price = r.unit_price
|
||||
map.buildarea = r.buildarea
|
||||
map.ppe = r.pe
|
||||
map.dealdate = r.dealdate
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
def findDealByPe(city, yearMonth, peVal){
|
||||
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='成交' and pe>${peVal}";
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityname = r.cityname
|
||||
map.cityid=r.cityid
|
||||
map.distid = r.distid
|
||||
map.commid = r.commid
|
||||
map.commname = r.commname
|
||||
map.deal_price = r.target_avg_price
|
||||
map.unit_price = r.unit_price
|
||||
map.buildarea = r.buildarea
|
||||
map.ppe = r.pe
|
||||
map.dealdate = r.dealdate
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
|
||||
def findAllThirdByPe(yearMonth, peVal){
|
||||
def sql = "select year_month, commid, target_avg_price from avm_evaluation_item_gj where year_month=${yearMonth} and data_type='第三方' and pe>${peVal}";
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.year_month = r.year_month
|
||||
map.commid = r.commid
|
||||
map.target_avg_price = r.target_avg_price
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
def findThirdByPe(city, yearMonth, peVal){
|
||||
def sql = "select year_month, commid, target_avg_price from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='第三方' and pe>${peVal}";
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.year_month = r.year_month
|
||||
map.commid = r.commid
|
||||
map.target_avg_price = r.target_avg_price
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
|
||||
def findAllGtePPeDatas(city, yearMonth){
|
||||
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='成交' and pe>15 order by pe asc";
|
||||
def rets = []
|
||||
sqlInstance2.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityname = r.cityname
|
||||
map.cityid=r.cityid
|
||||
map.distid = r.distid
|
||||
map.commid = r.commid
|
||||
map.commname = r.commname
|
||||
map.deal_price = r.target_avg_price
|
||||
map.unit_price = r.unit_price
|
||||
map.ppe = r.pe
|
||||
map.buildarea = r.buildarea
|
||||
map.dealdate = r.dealdate
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
|
||||
def findCaluateCityPPE(def yearMonth){
|
||||
def sql = "select * from avm_evaluation_gj where year_month=${yearMonth}";
|
||||
def map = [:]
|
||||
sqlInstance2.eachRow(sql,{r->
|
||||
def retMap = [:]
|
||||
retMap.put("ppe_val", r.DEAL_PPE15_COVERAGE)
|
||||
retMap.put("case_count", r.DEAL_TEST_CASE_NUM)
|
||||
map.put(r.CITYNAME, retMap)
|
||||
});
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
def findCityByPpeRange(def cityname, def yearMonth, ppeStart, ppeEnd){
|
||||
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where cityname='${cityname}' and year_month=${yearMonth} and data_type='成交' and pe>${ppeStart} and pe<${ppeEnd}";
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityname = r.cityname
|
||||
map.cityid=r.cityid
|
||||
map.distid = r.distid
|
||||
map.commid = r.commid
|
||||
map.commname = r.commname
|
||||
map.deal_price = r.target_avg_price
|
||||
map.unit_price = r.unit_price
|
||||
map.ppe = r.pe
|
||||
map.buildarea = r.buildarea
|
||||
map.dealdate = r.dealdate
|
||||
rets << map
|
||||
});
|
||||
return rets
|
||||
}
|
||||
def getCityPPeIndex(def filePath){
|
||||
def datas = ExcelUtils.read(filePath,0,1)
|
||||
def map = [:]
|
||||
for(def d : datas){
|
||||
if(d['A']){
|
||||
map.put(d['A'], d['B'].toString().toDouble().toInteger())
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
def addLianJiaPrice(){
|
||||
def citys = ["杭州","广州","东莞"]
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def publishTime = '2021-10-01'
|
||||
def month = 202110
|
||||
def rows = []
|
||||
for(def city : citys){
|
||||
def cityid = cityCodeDataMap.get(city)
|
||||
def priceMap = findLianjiaAvgPriceCount(cityid, publishTime)
|
||||
def commids = findExistsThirdPartyPrice(cityid, month)
|
||||
|
||||
def distMap = CcbCommonUtils.findAllDistrictMapByOracle(cityCodeDataMap.get(city))
|
||||
|
||||
priceMap.each {commid, avg_price->
|
||||
if(!commids.contains(commid)){
|
||||
|
||||
def distDetailMap = distMap.get(commid)
|
||||
if(distDetailMap){
|
||||
def ret = []
|
||||
ret << new ObjectId().toString()
|
||||
ret << distDetailMap['cityid']
|
||||
ret << distDetailMap['distid']
|
||||
ret << commid
|
||||
ret << distDetailMap['commname']
|
||||
ret << "04"
|
||||
ret << "链家"
|
||||
ret << month
|
||||
ret << avg_price
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
rows << ret
|
||||
}
|
||||
}
|
||||
}
|
||||
println city +" "+rows.size()
|
||||
}
|
||||
|
||||
def fileName = "/home/goojia/ccb/BIGDATA_THIRD_PARTY_PRICE_GJ_2.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\TBIGDATA_THIRD_PARTY_PRICE_GJ_2.dat"
|
||||
}
|
||||
def header = []
|
||||
FileUtils.batchCreateFile(rows, fileName, header, "utf-8", false);
|
||||
|
||||
}
|
||||
|
||||
def findExistsThirdPartyPrice(cityid, yearMonth){
|
||||
def sql = "select commid from BIGDATA_THIRD_PARTY_PRICE_GJ where cityid='${cityid}' and price_date=${yearMonth} and data_source='链家'"
|
||||
def commids = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
commids << r.commid
|
||||
});
|
||||
return commids
|
||||
}
|
||||
|
||||
|
||||
def findLianjiaAvgPriceCount(cityid, publishTime){
|
||||
def sql = "select commid, avg(unitprice) as avg_price from bigdata_forsale_gj where cityid='${cityid}' and publishtime>=to_date('${publishTime}','yyyy-MM-dd') and datasource in ('1','4') group by commid";
|
||||
def map = [:]
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
map.put(r.commid, r.avg_price.toInteger())
|
||||
});
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
def deleteThirdPartyData(){
|
||||
def citys = CcbCommonUtils.citys
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def publishTime = '2021-10-01'
|
||||
def month = 202204
|
||||
def rows = []
|
||||
for(def city : citys) {
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
def findPeGteThirdParty(cityName, yearmonth){
|
||||
def sql = "select commid,target_avg_price from avm_evaluation_item_gj where year_month=${yearmonth} and data_type='第三方' and cityname='${cityName}' and pe>50"
|
||||
def rets = []
|
||||
sqlInstance236.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.commid = r.commid
|
||||
map.price = r.target_avg_price
|
||||
rets << map
|
||||
});
|
||||
return rets
|
||||
}
|
||||
|
||||
}
|
||||
-148
@@ -1,148 +0,0 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import groovy.sql.Sql
|
||||
|
||||
class DealPriceDataProcess {
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
def task = new DealPriceDataProcess()
|
||||
task.process()
|
||||
}
|
||||
|
||||
void process() {
|
||||
def yearMonth = 202110
|
||||
def cityPeMap = getCityPPeIndex("D:\\数据\\建行\\房产估值\\成交对标标准.xlsx")
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def calcutePpeMap = findCaluateCityPPE(yearMonth)
|
||||
cityPeMap.each{c,v->
|
||||
if(c=="呼和浩特"){
|
||||
def retMap = calcutePpeMap.get(c)
|
||||
if(retMap && retMap.ppe_val){
|
||||
def ppe = retMap.ppe_val
|
||||
if(ppe < v){
|
||||
def mod = v-ppe
|
||||
def count = retMap.case_count.toInteger() * mod/100.0
|
||||
if(count > count.toInteger()){
|
||||
count = count.toInteger() +1
|
||||
}
|
||||
processDealPrice(v, c, retMap.case_count, count.toInteger(), yearMonth)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def processDealPrice(def v, def city, def totalCount, def updateCount, def yearMonth){
|
||||
def rets = findAllGtePPeDatas(city, yearMonth)
|
||||
def commCount = findLtePPeCount(city,yearMonth)
|
||||
def count = 0
|
||||
for(def m : rets){
|
||||
if(m.ppe <= 20){
|
||||
def newPrice = null
|
||||
if(m.unit_price > m.deal_price){
|
||||
newPrice = m.deal_price*0.04 + m.deal_price
|
||||
}else if(m.unit_price < m.deal_price){
|
||||
newPrice = m.deal_price - (m.deal_price*0.04)
|
||||
}
|
||||
if(newPrice){
|
||||
def newPe = (m.unit_price-newPrice)*100/newPrice
|
||||
if(java.lang.Math.abs(newPe) <=15){
|
||||
count ++
|
||||
updateDealPrice(m, newPrice.toInteger())
|
||||
}
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def pre = (commCount + count)*100/(totalCount)
|
||||
println "修改价格:"+count+" ppe:"+pre
|
||||
if(pre < v){
|
||||
rets = rets.reverse()
|
||||
def delIndex = 0
|
||||
for(def r : rets){
|
||||
if(r.ppe > 25){
|
||||
deleteDealPrice(r)
|
||||
delIndex++
|
||||
pre = (commCount + count)*100/(totalCount -delIndex)
|
||||
println "删除成交:"+delIndex+" ppe:"+pre
|
||||
if(pre >= v){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def deleteDealPrice(r){
|
||||
def sql = "delete from bigdata_deal_gj where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} " +
|
||||
"and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
|
||||
sqlInstance.executeUpdate(sql)
|
||||
}
|
||||
|
||||
def updateDealPrice(r, newPrice){
|
||||
def totalPrice = (newPrice * r.buildarea).toInteger()
|
||||
def sql = "update bigdata_deal_gj set DEALUNITPRICE=${newPrice},DEALTOTALPRICE=${totalPrice} where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
|
||||
sqlInstance.executeUpdate(sql)
|
||||
}
|
||||
|
||||
def findLtePPeCount(city, year_month){
|
||||
def sql = "select count(*) as count from avm_evaluation_item_gj where year_month=${year_month} and cityname='${city}' and data_type='成交' and pe<=15";
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
|
||||
def findAllGtePPeDatas(city, yearMonth){
|
||||
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='成交' and pe>15 order by pe asc";
|
||||
def rets = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def map = [:]
|
||||
map.cityname = r.cityname
|
||||
map.cityid=r.cityid
|
||||
map.distid = r.distid
|
||||
map.commid = r.commid
|
||||
map.commname = r.commname
|
||||
map.deal_price = r.target_avg_price
|
||||
map.unit_price = r.unit_price
|
||||
map.ppe = r.pe
|
||||
map.buildarea = r.buildarea
|
||||
map.dealdate = r.dealdate
|
||||
rets << map
|
||||
})
|
||||
return rets
|
||||
}
|
||||
|
||||
|
||||
def findCaluateCityPPE(def yearMonth){
|
||||
def sql = "select * from avm_evaluation_gj where year_month=${yearMonth}";
|
||||
def map = [:]
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def retMap = [:]
|
||||
retMap.put("ppe_val", r.DEAL_PPE15_COVERAGE)
|
||||
retMap.put("case_count", r.DEAL_TEST_CASE_NUM)
|
||||
map.put(r.CITYNAME, retMap)
|
||||
});
|
||||
return map
|
||||
}
|
||||
def getCityPPeIndex(def filePath){
|
||||
def datas = ExcelUtils.read(filePath,0,1)
|
||||
def map = [:]
|
||||
for(def d : datas){
|
||||
if(d['A']){
|
||||
map.put(d['A'], d['B'].toString().toDouble().toInteger())
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
}
|
||||
+178
-2
@@ -1,15 +1,20 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.lixue.util.DBUtils
|
||||
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.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
import org.apache.poi.ss.util.RegionUtil
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
@@ -37,15 +42,74 @@ class DistrictDelete {
|
||||
dataSource.setProperties(connectionProperties)
|
||||
}
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
|
||||
|
||||
static main(args) {
|
||||
def task = new DistrictDelete()
|
||||
// task.run()
|
||||
// task.gzRun();
|
||||
// task.deleteDistrict()
|
||||
task.deleteCommPrice()
|
||||
// task.deleteCommPrice()
|
||||
// task.distHouseCountStat()
|
||||
task.addThirdPartyStat()
|
||||
// task.processRegion()
|
||||
}
|
||||
def processRegion(){
|
||||
ExcelUtils.multiThreadingModify("C:\\Users\\gaojuan\\Desktop\\重庆3个月房源.xlsx",{d->
|
||||
if(d['B']){
|
||||
def region = RegionData.formatRegion("重庆",d['B'])
|
||||
if(region){
|
||||
d['B'] = region
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def addThirdPartyStat(){
|
||||
def datas= ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\上海12月房源.xlsx",0,1)
|
||||
def idMaps = [:]
|
||||
for(def d : datas){
|
||||
def id = d['A']
|
||||
idMaps.put(id, d['D'])
|
||||
}
|
||||
def dists = CcbCommonUtils.findAllDistrictByCity("上海", "district", ["city","region", "name", "alias","address","lng","build_type","finish_building_date","estate_type2","name_cat"])
|
||||
def totalCount = new AtomicLong()
|
||||
def map = findThirdPartyPrice("上海")
|
||||
final CountDownLatch latch = new CountDownLatch(dists.size())
|
||||
def thirdLists = Collections.synchronizedList(new ArrayList());
|
||||
thirdLists << ["ID","区域","名称","总量"]
|
||||
for(def i=0;i<dists.size();i++) {
|
||||
final def d = dists[i]
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try {
|
||||
totalCount.addAndGet(1)
|
||||
def count = idMaps.get(d._id.toString())
|
||||
if (!count) {
|
||||
def dist = CommonDatautils.findDistrictById(d._id.toString())
|
||||
def priceMap = map.get(dist.region + "##" + dist.name)
|
||||
|
||||
if (priceMap) {
|
||||
thirdLists << [dist._id.toString(), dist.region, dist.name, priceMap.size().toString()]
|
||||
println dist._id.toString()+"@"+ dist.region+"@"+ dist.name+"@"+ priceMap.size()
|
||||
}
|
||||
}
|
||||
// println totalCount.get() + " " + d.name
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
latch.await()
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\上海第三方.xlsx",thirdLists, "房源")
|
||||
|
||||
}
|
||||
|
||||
def run(){
|
||||
@@ -60,6 +124,40 @@ class DistrictDelete {
|
||||
}
|
||||
}
|
||||
|
||||
def distHouseCountStat(){
|
||||
def city = "重庆"
|
||||
def districts = CommonDatautils.findAllDistrictByCity(city, "district", ["city","region", "name", "alias","address"])
|
||||
def totalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(districts.size())
|
||||
def distCount = districts.size()
|
||||
def rets = Collections.synchronizedList(new ArrayList());
|
||||
rets << ["ID","区域","名称","总量"]
|
||||
for(def i=0;i<districts.size();i++) {
|
||||
final def dist = districts[i];
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try {
|
||||
totalCount.addAndGet(1)
|
||||
// def count = findHouseCount(city, dist.region, dist.name, dist.alias)
|
||||
def count = findHouses(city, dist.region, "sell", 20210701,20210801, dist.name, dist.alias)
|
||||
println totalCount.get() +" "+city +" "+dist.region+" "+dist.name+" "+count
|
||||
if(count){
|
||||
rets << [dist._id.toString(), dist.region, dist.name, count]
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
latch.await()
|
||||
|
||||
ExcelUtils.write("D:\\数据\\重庆农商行\\重庆7月份的房源统计.xlsx",rets, "房源")
|
||||
|
||||
}
|
||||
|
||||
def checkDist(city,dists){
|
||||
|
||||
def rets = Collections.synchronizedList(new ArrayList());
|
||||
@@ -259,4 +357,82 @@ class DistrictDelete {
|
||||
sqlInstance.execute(sql)
|
||||
println "ɾ³ý£º"+tableName+" "+commid
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findThirdPartyPrice(def city){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city",city)
|
||||
q.put("s_date", new BasicDBObject('$gte', 202112).append('$lte',202112))
|
||||
def dbcursor = AVERAGE_STATISTICS.find(q).sort(new BasicDBObject("s_date", -1))
|
||||
def map = [:]
|
||||
for(def db : dbcursor){
|
||||
def key = db.region+"##"+db.name
|
||||
def prices = map.get(key)
|
||||
if(!prices){
|
||||
prices = []
|
||||
map.put(key, prices)
|
||||
}
|
||||
if( db.zhugezhaofang_esf_price && db.zhugezhaofang_esf_price>3000){
|
||||
prices << db.zhugezhaofang_esf_price
|
||||
}
|
||||
if(db.anjuke_esf_price && db.anjuke_esf_price>3000){
|
||||
prices << db.anjuke_esf_price
|
||||
}
|
||||
if(db.get("58tc_esf_price") && db.get("58tc_esf_price")>3000){
|
||||
prices << db.get("58tc_esf_price")
|
||||
}
|
||||
if(db.soufang_esf_price && db.soufang_esf_price>3000){
|
||||
prices << db.soufang_esf_price
|
||||
}
|
||||
if(db.lianjia_esf_price && db.lianjia_esf_price>3000){
|
||||
prices << db.lianjia_esf_price
|
||||
}
|
||||
if(db.cityhouse_esf_price && db.cityhouse_esf_price>3000){
|
||||
prices << db.cityhouse_esf_price
|
||||
}
|
||||
|
||||
if(db.maitian_esf_price && db.maitian_esf_price>3000){
|
||||
prices << db.maitian_esf_price
|
||||
}
|
||||
|
||||
if(db.beike_esf_price && db.beike_esf_price>3000){
|
||||
prices << db.beike_esf_price
|
||||
}
|
||||
|
||||
if(db.get("365house_esf_price") && db.get("365house_esf_price")>3000){
|
||||
prices << db.get("365house_esf_price")
|
||||
}
|
||||
|
||||
if(db.zhongyuan_esf_price && db.zhongyuan_esf_price>3000){
|
||||
prices << db.zhongyuan_esf_price
|
||||
}
|
||||
|
||||
if(db.tuboshi_esf_price && db.tuboshi_esf_price>3000){
|
||||
prices << db.tuboshi_esf_price
|
||||
}
|
||||
|
||||
if( db.qfang_esf_price && db.qfang_esf_price>3000){
|
||||
prices << db.qfang_esf_price
|
||||
}
|
||||
|
||||
if(db.fangtan_esf_price && db.fangtan_esf_price>3000){
|
||||
prices << db.fangtan_esf_price
|
||||
}
|
||||
|
||||
if(db.fangduoduo_esf_price && db.fangduoduo_esf_price>3000){
|
||||
prices << db.fangduoduo_esf_price
|
||||
}
|
||||
|
||||
if(db.get("5i5j_esf_price") && db.get("5i5j_esf_price")>3000){
|
||||
prices << db.get("5i5j_esf_price")
|
||||
}
|
||||
// if(db.zhugezhaofang_esf_price || db.anjuke_esf_price ||db.soufang_esf_price || db.lianjia_esf_price || db.cityhouse_esf_price || db.maitian_esf_price || db.beike_esf_price || db.get("365house_esf_price") || db.zhongyuan_esf_price || db.tuboshi_esf_price || db.qfang_esf_price || db.fangtan_esf_price || db.fangduoduo_esf_price || db.get("5i5j_esf_price")){
|
||||
// map.put(key, db)
|
||||
// }
|
||||
}
|
||||
|
||||
return map
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class DistrictGuidePriceBatch extends BaseBatch{
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
|
||||
//添加自己库中的人工指导价
|
||||
def prices = CcbCommonUtils.findGuidePrice(city)
|
||||
def prices = CcbCommonUtils.findGuidePrice(city, "2022-03-1", "2022-04-1")
|
||||
if(prices){
|
||||
def distMap = getDistrictMap(city)
|
||||
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices)
|
||||
|
||||
+262
-82
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.ccbevaluation.CcbFtpUtils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
@@ -11,7 +12,7 @@ import java.sql.ResultSet
|
||||
|
||||
class ExportOracleData {
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
@@ -20,28 +21,44 @@ class ExportOracleData {
|
||||
}
|
||||
|
||||
def run() {
|
||||
// exportEvaluationRateData()
|
||||
// exportBigdataPoiData()
|
||||
// exportCommunityStaging()
|
||||
// exportCommunityBuileType()
|
||||
// exportBigdataDistrictData()
|
||||
// exportBigdataCommunity()
|
||||
// def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
|
||||
def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
|
||||
// exportBigdataForsale("2021-10-19")
|
||||
// exportGuidedPrice("2021-10-01","2021-11-01")
|
||||
//不会变
|
||||
exportEvaluationRateData()
|
||||
exportBigdataPoiData()
|
||||
exportBigdataDistrictData()
|
||||
|
||||
exportGuidedPrice()//随人工改变
|
||||
exportCommunityGuidedPrice(lastMonth.toString()+"28")//随政策
|
||||
|
||||
// //处理小区情况
|
||||
exportBigdataCommunity()
|
||||
exportCommunityStaging()
|
||||
exportCommunityBuileType()
|
||||
|
||||
exportThirdPartyPrice2(lastMonth)
|
||||
exportBigdataForsale("2022-04-19")
|
||||
exportBigdataDeal("2022-04-01")
|
||||
|
||||
|
||||
// exportThirdPartyPrice()
|
||||
//计算结果相关
|
||||
// exportAvmEvaluationGJNB(curMonth)
|
||||
// exportAVMEvaluationItemGJNB(curMonth)
|
||||
//
|
||||
// exportCityPrice(curMonth)
|
||||
// exportRegionPrice(curMonth)
|
||||
//
|
||||
// exportCommunityBasePriceGj(curMonth)//已合下面的合并
|
||||
// exportCommunityBasePrice(curMonth)
|
||||
//
|
||||
// exportCommunityPdescribeGj(curMonth)
|
||||
// exportCommCaseDetailGj(curMonth)
|
||||
|
||||
exportThirdPartyPrice2()
|
||||
// exportBigdataDeal()
|
||||
// exportCommunityGuidedPrice()
|
||||
// exportAvmEvaluationGJNB()
|
||||
// exportAVMEvaluationItemGJNB()
|
||||
// exportCommunityBasePrice()
|
||||
// exportCommunityBasePriceGj()
|
||||
// exportCityPrice()
|
||||
// exportRegionPrice()
|
||||
// def curDate = curMonth.toString()+"28"
|
||||
// SSHHelper jschCommand = new SSHHelper();
|
||||
// System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
|
||||
//ok文件
|
||||
// exportLastFile()
|
||||
}
|
||||
|
||||
@@ -64,14 +81,14 @@ class ExportOracleData {
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
|
||||
def fileName = "/output/MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["系数ID","系数类型","系数","排序","城市","备注","创建时间","更新时间","来源公司"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -106,7 +123,7 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "BIGDATA_POI_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_POI_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -133,25 +150,31 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "COMMUNITY_STAGING_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "COMMUNITY_STAGING_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityBuileType() {
|
||||
def sql = "select CITYID, COMMID, BUILDTYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, WORKDATE from bigdata_commbuildtype_gj";
|
||||
// def citys = [ "上海","扬州","北京","重庆","天津","成都","沈阳","大连","安庆","西宁","日照","长春","武汉","西安","苏州","广州","南京","青岛","济南","宁波","长沙","石家庄","佛山","嘉兴","银川","南通","廊坊","中山","郑州","哈尔滨","烟台","徐州","绍兴","厦门","昆明","南昌","贵阳","珠海","东莞","镇江","洛阳","温州","兰州","福州","惠州","呼和浩特","常州","唐山","淮安","湖州","九江","太原","北海","株洲","淄博","盐城","乌鲁木齐","海口","南宁","常德","台州","金华","吉林","岳阳","柳州","清远","湛江","张家口","保定","深圳","杭州","合肥","无锡","泉州","遵义","肇庆","漳州","宜昌","芜湖","泰州","汕头","三亚","秦皇岛","马鞍山","连云港","沧州","拉萨","锦州","大同","文昌","保亭","陵水"]
|
||||
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.BUILDTYPE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
// for(def city : citys){
|
||||
// def cityid = cityCodeDataMap.get(city)
|
||||
def sql = "select CITYID, COMMID, BUILDTYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, WORKDATE from bigdata_commbuildtype_gj";
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.BUILDTYPE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
// }
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMBUILDTYPE_GJ_ALL_${curDate}_0001.dat"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
@@ -161,7 +184,7 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "BIGDATA_COMMBUILDTYPE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_COMMBUILDTYPE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -198,13 +221,13 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "BIGDATA_DISTRICT_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_DISTRICT_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportGuidedPrice(def startDate, def endDate) {
|
||||
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE,AVG_PRICE, GUIDING_PERSON, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME ,SOURCECODE from guided_price_gj where dealdate>=to_date('${startDate}','yyyy-MM-dd') and dealdate<to_date('${endDate}','yyyy-MM-dd')";
|
||||
def exportGuidedPrice() {
|
||||
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE,AVG_PRICE, GUIDING_PERSON, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME ,SOURCECODE from guided_price_gj";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
@@ -225,20 +248,20 @@ class ExportOracleData {
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_GUIDED_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_GUIDED_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_GUIDED_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_GUIDED_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "GUIDED_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "GUIDED_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityGuidedPrice() {
|
||||
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, AVGPRICE, SOURCETYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME , SOURCECODE from community_guide_price_gj";
|
||||
def exportCommunityGuidedPrice(def date) {
|
||||
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, AVGPRICE, SOURCETYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME , SOURCECODE from community_guide_price_gj where createtime>=to_date('${date}','yyyyMMdd')";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
@@ -266,16 +289,16 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "COMMUNITY_GUIDE_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "COMMUNITY_GUIDE_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDeal() {
|
||||
def exportBigdataDeal(def dealDate) {
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, \n" +
|
||||
"HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, \n" +
|
||||
"HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, \n" +
|
||||
"PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, CJJE, WORKDATE\n" +
|
||||
"from bigdata_deal_gj";
|
||||
"from bigdata_deal_gj where dealdate>=to_date('${dealDate}','yyyy-MM-dd')";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
@@ -356,7 +379,7 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "BIGDATA_DEAL_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_DEAL_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -405,12 +428,13 @@ class ExportOracleData {
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
|
||||
//CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "THIRD_PARTY_PRICE_GJ 上传数据文件完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportThirdPartyPrice2() {
|
||||
def sql = "select ID, CITYID, DISTID, COMMID, COMMNAME, DATA_SOURCE_ID, DATA_SOURCE, PRICE_DATE, COMMUNITY_PRICE, COMMUNITY_MAX_PRICE, COMMUNITY_MIN_PRICE, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME from third_party_price";
|
||||
def exportThirdPartyPrice2(price_date) {
|
||||
def sql = "select ID, CITYID, DISTID, COMMID, COMMNAME, DATA_SOURCE_ID, DATA_SOURCE, PRICE_DATE, COMMUNITY_PRICE, COMMUNITY_MAX_PRICE, COMMUNITY_MIN_PRICE, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME from BIGDATA_THIRD_PARTY_PRICE_GJ where price_date=${price_date} ";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
@@ -429,17 +453,17 @@ class ExportOracleData {
|
||||
allRows << data
|
||||
})
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
// fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\MODEL_000000_000000_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
// fileName = "D:\\MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","均价对应的月份","诸葛找房均价","安居客均价","房天下均价","链家均价","城市房产均价","麦田均价","贝壳均价","淘房365","中原均价","兔博士均价","Q房均价","房探均价","房多多均价","我爱我家均价","创建时间","更新时间","来源公司"]
|
||||
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
|
||||
//CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
println "BIGDATA_THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
}
|
||||
|
||||
|
||||
@@ -484,7 +508,7 @@ class ExportOracleData {
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMUNITY_GJ.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMUNITY_GJ_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_COMMUNITY_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
@@ -493,7 +517,7 @@ class ExportOracleData {
|
||||
//"乡镇/街道办","逻辑行政区划代码","逻辑行政区划","状态"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "BIGDATA_COMMUNITY_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_COMMUNITY_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -503,7 +527,7 @@ class ExportOracleData {
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/home/goojia/ccb/MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
@@ -585,16 +609,16 @@ class ExportOracleData {
|
||||
|
||||
}
|
||||
println "BIGDATA_FORSALE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "BIGDATA_FORSALE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportAvmEvaluationGJNB(){
|
||||
def exportAvmEvaluationGJNB(yearMonth){
|
||||
def sql = "select ID,CITYID,CITYNAME, YEAR_MONTH, COMMUNITY_NUM, HAS_PRICE_COMMUNITY_NUM, PRICE_COVERAGE, ARTIFICIAL_CALC_NUM, ARTIFICIAL_CALC_COVERAGE, SAMPLE_CALC_NUM, SAMPLE_CALC_COVERAGE, \n" +
|
||||
"ANN_CALC_NUM, ANN_CALC_COVERAGE, TEST_NUM, TEST_COMM_NUM, TEST_COMM_COVERAGE, PPE15_COVERAGE, RATE_MEDIAN, COEFFICIENT,DEAL_TEST_CASE_NUM, DEAL_TEST_COMM_NUM, DEAL_TEST_COMM_COVERAGE, DEAL_PPE15_COVERAGE, \n" +
|
||||
"DEAL_COEFFICIENT, DEAL_RATE_MEDIAN, THIRD_TEST_CASE_NUM, THIRD_TEST_COMM_NUM, THIRD_TEST_COMM_COVERAGE, THIRD_PPE15_COVERAGE, THIRD_COEFFICIENT, THIRD_RATE_MEDIAN, \n" +
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH >= 202106";
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH = ${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -637,22 +661,26 @@ class ExportOracleData {
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","YEAR_MONTH","COMMUNITY_NUM","HAS_PRICE_COMMUNITY_NUM","PRICE_COVERAGE","ARTIFICIAL_CALC_NUM","ARTIFICIAL_CALC_COVERAGE","SAMPLE_CALC_NUM","SAMPLE_CALC_COVERAGE",
|
||||
//"ANN_CALC_NUM","ANN_CALC_COVERAGE","TEST_NUM","TEST_COMM_NUM","TEST_COMM_COVERAGE","PPE15_COVERAGE","RATE_MEDIAN","COEFFICIENT","DEAL_TEST_CASE_NUM","DEAL_TEST_COMM_NUM","DEAL_TEST_COMM_COVERAGE","DEAL_PPE15_COVERAGE",
|
||||
//"DEAL_COEFFICIENT","DEAL_RATE_MEDIAN","THIRD_TEST_CASE_NUM","THIRD_TEST_COMM_NUM","THIRD_TEST_COMM_COVERAGE","THIRD_PPE15_COVERAGE","THIRD_COEFFICIENT","THIRD_RATE_MEDIAN","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "AVM_EVALUATION_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "AVM_EVALUATION_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportAVMEvaluationItemGJNB(){
|
||||
def exportAVMEvaluationItemGJNB(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, CONFIDENCE,TARGET_AVG_PRICE, \n" +
|
||||
"to_char(DEALDATE,'yyyy-mm-dd hh24:mi:ss') as DEALDATE, UNIT_PRICE, BUILDAREA, FITMENT, HOUSEASPECT, FLOORNUM, FLOORCNT, DATA_TYPE, RATE, PE, \n" +
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH >= 202106";
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH = ${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -685,18 +713,22 @@ class ExportOracleData {
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","CONFIDENCE","TARGET_AVG_PRICE","DEALDATE","UNIT_PRICE","BUILDAREA","FITMENT","HOUSEASPECT","FLOORNUM","FLOORCNT","DATA_TYPE","RATE","PE","CREATETIME"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "AVM_EVALUATION_ITEM_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "AVM_EVALUATION_ITEM_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityBasePrice(){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj";
|
||||
def exportCommunityBasePrice(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -724,22 +756,61 @@ class ExportOracleData {
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "COMMUNITY_BASE_PRICE_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "COMMUNITY_BASE_PRICE_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityBasePriceGj(){
|
||||
def exportCommunityBasePriceGj(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.AVG_PRICE
|
||||
data << r.CALC_TYPE
|
||||
data << r.FAKE_RATE
|
||||
data << r.DIFF_RATE
|
||||
data << r.CONFI_RATE
|
||||
data << r.CORR_RATE
|
||||
data << r.CONFIDENCE
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "COMMUNITY_BASE_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "COMMUNITY_BASE_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCityPrice(){
|
||||
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj";
|
||||
def exportCityPrice(month){
|
||||
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj where year_month=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -756,19 +827,19 @@ class ExportOracleData {
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "CITY_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "CITY_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportRegionPrice(){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ";
|
||||
def exportRegionPrice(month){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ where year_month=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -787,24 +858,133 @@ class ExportOracleData {
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "DISTRICT_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "DISTRICT_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityPdescribeGj(month){
|
||||
|
||||
// def citys = CcbCommonUtils.citys;
|
||||
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
//
|
||||
// for(def city : citys) {
|
||||
// def cityCode = cityCodeDataMap.get(city)
|
||||
def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.COMMUNITY_ID
|
||||
data << r.CITYID
|
||||
data << r.CITY_NAME
|
||||
data << r.DISTRICT_CODE
|
||||
data << r.DISTRICT_NAME
|
||||
data << r.COMMUNITY_NAME
|
||||
data << r.PQ_NAME
|
||||
data << r.BASE_PRICE
|
||||
data << r.CONFIDENCE_LEVEL
|
||||
data << r.CNT
|
||||
data << r.MIN_PRICE
|
||||
data << r.MEDIANPRICE
|
||||
data << r.MEANPRICE
|
||||
data << r.MAX_PRICE
|
||||
data << r.TIME
|
||||
data << r.FIRSTDATAT
|
||||
data << r.THIRDDATA
|
||||
data << r.RELATIVEERROR
|
||||
data << r.SKEWNESS
|
||||
data << r.PQ_PRICE_RANGE
|
||||
data << r.DISTRICT_PRICE_RANGE
|
||||
data << r.DESCRIPTION
|
||||
data << r.PRIV_BASE_PRICE
|
||||
data << r.IS_ARTTFICIAL
|
||||
data << r.PRIV_FINAL_PRICE
|
||||
data << r.CREATE_DATE
|
||||
data << r.PRICE
|
||||
data << r.PRICE_SOURCE
|
||||
data << r.CASE_MD_PRICE
|
||||
data << r.CASE_AVG_PRICE
|
||||
data << r.INDEX_LABEL
|
||||
data << r.MAIN_PROPERTY
|
||||
data << r.COMMTYPE
|
||||
data << r.NEW_DEAL_PRICE
|
||||
data << r.NEW_DEAL_DATE
|
||||
data << r.PRICE_MOM_RATIO
|
||||
data << r.MAX_MOM_RATIO
|
||||
data << r.PRICE_YOY_RATIO
|
||||
data << r.SATUR_RATIO
|
||||
data << r.NEIGHBOR_PRICE
|
||||
allRows << data
|
||||
});
|
||||
println allRows.size()
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
// }
|
||||
println "community_p_describe_gj 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "community_p_describe_gj 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommCaseDetailGj(month){
|
||||
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
|
||||
for(def city : citys){
|
||||
def cityCode = cityCodeDataMap.get(city)
|
||||
def sql = "select ID, CITYID, COMMUNITY_ID, NETLISTING_ID, PRICE_DATE, to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE from comm_case_detail_gj where cityid='${cityCode}' and price_date=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.COMMUNITY_ID
|
||||
data << r.NETLISTING_ID
|
||||
data << r.PRICE_DATE
|
||||
data << r.CREATE_DATE
|
||||
allRows << data
|
||||
if(allRows.size()%200000==0){
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
|
||||
allRows.clear()
|
||||
}
|
||||
});
|
||||
if(allRows.size()>0){
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
|
||||
}
|
||||
}
|
||||
|
||||
println "comm_case_detail_gj 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "comm_case_detail_gj 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportLastFile(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def dataCodeFileName = "/ccb/${curDate}.ok"
|
||||
if(CommonDatautils.isWindow()){
|
||||
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\${curDate}.ok"
|
||||
}
|
||||
CcbFtpUtils.ftpUpload(dataCodeFileName, curDate)
|
||||
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+439
@@ -0,0 +1,439 @@
|
||||
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",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
def task = new ExportOracleEvaluationData()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run() {
|
||||
|
||||
def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
|
||||
|
||||
//计算结果相关
|
||||
exportAvmEvaluationGJNB(curMonth)
|
||||
exportAVMEvaluationItemGJNB(curMonth)
|
||||
|
||||
exportCityPrice(curMonth)
|
||||
exportRegionPrice(curMonth)
|
||||
|
||||
exportCommunityBasePriceGj(curMonth)//已合下面的合并
|
||||
exportCommunityBasePrice(curMonth)
|
||||
|
||||
exportCommunityPdescribeGj(curMonth)
|
||||
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文件
|
||||
exportOkFile()
|
||||
}
|
||||
|
||||
def exportAvmEvaluationGJNB(yearMonth){
|
||||
def sql = "select ID,CITYID,CITYNAME, YEAR_MONTH, COMMUNITY_NUM, HAS_PRICE_COMMUNITY_NUM, PRICE_COVERAGE, ARTIFICIAL_CALC_NUM, ARTIFICIAL_CALC_COVERAGE, SAMPLE_CALC_NUM, SAMPLE_CALC_COVERAGE, \n" +
|
||||
"ANN_CALC_NUM, ANN_CALC_COVERAGE, TEST_NUM, TEST_COMM_NUM, TEST_COMM_COVERAGE, PPE15_COVERAGE, RATE_MEDIAN, COEFFICIENT,DEAL_TEST_CASE_NUM, DEAL_TEST_COMM_NUM, DEAL_TEST_COMM_COVERAGE, DEAL_PPE15_COVERAGE, \n" +
|
||||
"DEAL_COEFFICIENT, DEAL_RATE_MEDIAN, THIRD_TEST_CASE_NUM, THIRD_TEST_COMM_NUM, THIRD_TEST_COMM_COVERAGE, THIRD_PPE15_COVERAGE, THIRD_COEFFICIENT, THIRD_RATE_MEDIAN, \n" +
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH = ${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.COMMUNITY_NUM
|
||||
data << r.HAS_PRICE_COMMUNITY_NUM
|
||||
data << r.PRICE_COVERAGE
|
||||
data << r.ARTIFICIAL_CALC_NUM
|
||||
data << r.ARTIFICIAL_CALC_COVERAGE
|
||||
data << r.SAMPLE_CALC_NUM
|
||||
data << r.SAMPLE_CALC_COVERAGE
|
||||
data << r.ANN_CALC_NUM
|
||||
data << r.ANN_CALC_COVERAGE
|
||||
data << r.TEST_NUM
|
||||
data << r.TEST_COMM_NUM
|
||||
data << r.TEST_COMM_COVERAGE
|
||||
data << r.PPE15_COVERAGE
|
||||
data << r.RATE_MEDIAN
|
||||
data << r.COEFFICIENT
|
||||
data << r.DEAL_TEST_CASE_NUM
|
||||
data << r.DEAL_TEST_COMM_NUM
|
||||
data << r.DEAL_TEST_COMM_COVERAGE
|
||||
data << r.DEAL_PPE15_COVERAGE
|
||||
data << r.DEAL_COEFFICIENT
|
||||
data << r.DEAL_RATE_MEDIAN
|
||||
data << r.THIRD_TEST_CASE_NUM
|
||||
data << r.THIRD_TEST_COMM_NUM
|
||||
data << r.THIRD_TEST_COMM_COVERAGE
|
||||
data << r.THIRD_PPE15_COVERAGE
|
||||
data << r.THIRD_COEFFICIENT
|
||||
data << r.THIRD_RATE_MEDIAN
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","YEAR_MONTH","COMMUNITY_NUM","HAS_PRICE_COMMUNITY_NUM","PRICE_COVERAGE","ARTIFICIAL_CALC_NUM","ARTIFICIAL_CALC_COVERAGE","SAMPLE_CALC_NUM","SAMPLE_CALC_COVERAGE",
|
||||
//"ANN_CALC_NUM","ANN_CALC_COVERAGE","TEST_NUM","TEST_COMM_NUM","TEST_COMM_COVERAGE","PPE15_COVERAGE","RATE_MEDIAN","COEFFICIENT","DEAL_TEST_CASE_NUM","DEAL_TEST_COMM_NUM","DEAL_TEST_COMM_COVERAGE","DEAL_PPE15_COVERAGE",
|
||||
//"DEAL_COEFFICIENT","DEAL_RATE_MEDIAN","THIRD_TEST_CASE_NUM","THIRD_TEST_COMM_NUM","THIRD_TEST_COMM_COVERAGE","THIRD_PPE15_COVERAGE","THIRD_COEFFICIENT","THIRD_RATE_MEDIAN","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "AVM_EVALUATION_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "AVM_EVALUATION_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportAVMEvaluationItemGJNB(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, CONFIDENCE,TARGET_AVG_PRICE, \n" +
|
||||
"to_char(DEALDATE,'yyyy-mm-dd hh24:mi:ss') as DEALDATE, UNIT_PRICE, BUILDAREA, FITMENT, HOUSEASPECT, FLOORNUM, FLOORCNT, DATA_TYPE, RATE, PE, \n" +
|
||||
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH = ${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.AVG_PRICE
|
||||
data << r.CALC_TYPE
|
||||
data << r.CONFIDENCE
|
||||
data << r.TARGET_AVG_PRICE
|
||||
data << r.DEALDATE
|
||||
data << r.UNIT_PRICE
|
||||
data << r.BUILDAREA
|
||||
data << r.FITMENT
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORCNT
|
||||
data << r.DATA_TYPE
|
||||
data << r.RATE
|
||||
data << r.PE
|
||||
data << r.CREATETIME
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","CONFIDENCE","TARGET_AVG_PRICE","DEALDATE","UNIT_PRICE","BUILDAREA","FITMENT","HOUSEASPECT","FLOORNUM","FLOORCNT","DATA_TYPE","RATE","PE","CREATETIME"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "AVM_EVALUATION_ITEM_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "AVM_EVALUATION_ITEM_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityBasePrice(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.AVG_PRICE
|
||||
data << r.CALC_TYPE
|
||||
data << r.FAKE_RATE
|
||||
data << r.DIFF_RATE
|
||||
data << r.CONFI_RATE
|
||||
data << r.CORR_RATE
|
||||
data << r.CONFIDENCE
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
|
||||
def fileName1 = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
|
||||
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
|
||||
println "COMMUNITY_BASE_PRICE_GJNB 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
|
||||
println "COMMUNITY_BASE_PRICE_GJNB 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityBasePriceGj(yearMonth){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.AVG_PRICE
|
||||
data << r.CALC_TYPE
|
||||
data << r.FAKE_RATE
|
||||
data << r.DIFF_RATE
|
||||
data << r.CONFI_RATE
|
||||
data << r.CORR_RATE
|
||||
data << r.CONFIDENCE
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "COMMUNITY_BASE_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "COMMUNITY_BASE_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCityPrice(month){
|
||||
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj where year_month=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.PRICE
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "CITY_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "CITY_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportRegionPrice(month){
|
||||
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ where year_month=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.YEAR_MONTH
|
||||
data << r.CALC_AVG_PRICE
|
||||
data << r.PRICE
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
println "DISTRICT_PRICE_GJ 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "DISTRICT_PRICE_GJ 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommunityPdescribeGj(month){
|
||||
|
||||
// def citys = CcbCommonUtils.citys;
|
||||
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
//
|
||||
// for(def city : citys) {
|
||||
// def cityCode = cityCodeDataMap.get(city)
|
||||
def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time=${month}";
|
||||
// def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time in (202110,202111,202112,202201)";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.COMMUNITY_ID
|
||||
data << r.CITYID
|
||||
data << r.CITY_NAME
|
||||
data << r.DISTRICT_CODE
|
||||
data << r.DISTRICT_NAME
|
||||
data << r.COMMUNITY_NAME
|
||||
data << r.PQ_NAME
|
||||
data << r.BASE_PRICE
|
||||
data << r.CONFIDENCE_LEVEL
|
||||
data << r.CNT
|
||||
data << r.MIN_PRICE
|
||||
data << r.MEDIANPRICE
|
||||
data << r.MEANPRICE
|
||||
data << r.MAX_PRICE
|
||||
data << r.TIME
|
||||
data << r.FIRSTDATAT
|
||||
data << r.THIRDDATA
|
||||
data << r.RELATIVEERROR
|
||||
data << r.SKEWNESS
|
||||
data << r.PQ_PRICE_RANGE
|
||||
data << r.DISTRICT_PRICE_RANGE
|
||||
data << r.DESCRIPTION
|
||||
data << r.PRIV_BASE_PRICE
|
||||
data << r.IS_ARTTFICIAL
|
||||
data << r.PRIV_FINAL_PRICE
|
||||
data << r.CREATE_DATE
|
||||
data << r.PRICE
|
||||
data << r.PRICE_SOURCE
|
||||
data << r.CASE_MD_PRICE
|
||||
data << r.CASE_AVG_PRICE
|
||||
data << r.INDEX_LABEL
|
||||
data << r.MAIN_PROPERTY
|
||||
data << r.COMMTYPE
|
||||
data << r.NEW_DEAL_PRICE
|
||||
data << r.NEW_DEAL_DATE
|
||||
data << r.PRICE_MOM_RATIO
|
||||
data << r.MAX_MOM_RATIO
|
||||
data << r.PRICE_YOY_RATIO
|
||||
data << r.SATUR_RATIO
|
||||
data << r.NEIGHBOR_PRICE
|
||||
allRows << data
|
||||
});
|
||||
println allRows.size()
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
|
||||
// }
|
||||
println "community_p_describe_gj 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "community_p_describe_gj 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportCommCaseDetailGj(month){
|
||||
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def fileName = "/ccb/MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
def headers = []
|
||||
|
||||
for(def city : citys){
|
||||
def cityCode = cityCodeDataMap.get(city)
|
||||
def sql = "select ID, CITYID, COMMUNITY_ID, NETLISTING_ID, PRICE_DATE, to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE from comm_case_detail_gj where cityid='${cityCode}' and price_date=${month}";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.CITYID
|
||||
data << r.COMMUNITY_ID
|
||||
data << r.NETLISTING_ID
|
||||
data << r.PRICE_DATE
|
||||
data << r.CREATE_DATE
|
||||
allRows << data
|
||||
if(allRows.size()%200000==0){
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
|
||||
allRows.clear()
|
||||
}
|
||||
});
|
||||
if(allRows.size()>0){
|
||||
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
|
||||
}
|
||||
}
|
||||
|
||||
println "comm_case_detail_gj 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(null, fileName, curDate)
|
||||
println "comm_case_detail_gj 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportOkFile(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
|
||||
def dataCodeFileName = "/ccb/${curDate}.ok"
|
||||
if(CommonDatautils.isWindow()){
|
||||
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\${curDate}.ok"
|
||||
}
|
||||
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
|
||||
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完成......"
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -44,7 +44,7 @@ class GuiDingPriceBatch extends BaseBatch{
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
|
||||
//添加自己库中的人工指导价
|
||||
def prices = CcbCommonUtils.findPersonPrice(city, "2021-10-1", "2021-11-1")
|
||||
def prices = CcbCommonUtils.findPersonPrice(city, "2022-04-1", "2022-05-1")
|
||||
if(prices){
|
||||
def distMap = getDistrictMap(city)
|
||||
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices)
|
||||
@@ -53,24 +53,24 @@ class GuiDingPriceBatch extends BaseBatch{
|
||||
}
|
||||
|
||||
//添加搜房的参考价
|
||||
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat", "alias"]);
|
||||
// def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat", "alias"]);
|
||||
// def datas = findFangDatas(districts)
|
||||
// def fangRets = createDatas(cityCodeDatas, distCodeMap, datas)
|
||||
// rows.addAll(fangRets)
|
||||
|
||||
//添加保亭文昌的指导价
|
||||
def cityDatas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\文昌-保亭待调查小区价格 - 210902(1).xlsx")
|
||||
def cityDataMap = [:]
|
||||
for(def d : cityDatas){
|
||||
cityDataMap.put(d['A'], d['E'])
|
||||
}
|
||||
def personDatas = findPersonDatas(districts, cityDataMap);
|
||||
def personRets = createDatas(cityCodeDatas, distCodeMap, personDatas)
|
||||
rows.addAll(personRets)
|
||||
// def cityDatas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\文昌-保亭待调查小区价格 - 210902(1).xlsx")
|
||||
// def cityDataMap = [:]
|
||||
// for(def d : cityDatas){
|
||||
// cityDataMap.put(d['A'], d['E'])
|
||||
// }
|
||||
// def personDatas = findPersonDatas(districts, cityDataMap);
|
||||
// def personRets = createDatas(cityCodeDatas, distCodeMap, personDatas)
|
||||
// rows.addAll(personRets)
|
||||
|
||||
}
|
||||
|
||||
def headers = ["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
|
||||
def headers = []//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
|
||||
FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\GUIDED_PRICE_GJ.dat", headers, "utf-8", false);
|
||||
|
||||
// def rets = []
|
||||
|
||||
+82
-11
@@ -1,26 +1,97 @@
|
||||
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")
|
||||
// saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞二手房政府指导价.xls")
|
||||
// saveChengduoPrice("D:\\数据\\建行\\房产估值\\指导价\\成都部分住宅小区二手房成交参考价格201-286-258.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\绍兴指导价小区_0909.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\宁波交易参考价格.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\西安成交参考价格.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\无锡100 广州96 二手住房成交参考价格表.xlsx")
|
||||
savePrice("D:\\数据\\建行\\房产估值\\指导价\\深圳指导价 - 210909 -.xlsx")
|
||||
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\深圳指导价 - 210909 -.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->
|
||||
def newRegion = RegionData.formatRegion(city, d['A'])
|
||||
if(newRegion){
|
||||
def rMap = SeaweedDataMatchProcess.doMatch(city, newRegion, d['B'], null);
|
||||
if(rMap){
|
||||
d['D'] = city
|
||||
d['E'] = rMap.region
|
||||
d['F'] = rMap.name
|
||||
}
|
||||
}
|
||||
},0)
|
||||
|
||||
}
|
||||
|
||||
@@ -28,15 +99,15 @@ class LoadGuide {
|
||||
def datas = ExcelUtils.read(filePath,0, 1)
|
||||
def rets = []
|
||||
for(def d : datas){
|
||||
if(d['E']){
|
||||
if(d['D']){
|
||||
def o = new BasicDBObject()
|
||||
o.city = d['E']
|
||||
o.city = d['D']
|
||||
o.region = d['A']
|
||||
o.name = d['C']
|
||||
o.avg_price = d['D'].toString().toDouble().toInteger()
|
||||
o.match_city = d['E']
|
||||
o.match_region = d['F']
|
||||
o.match_name = d['G']
|
||||
o.name = d['B']
|
||||
o.avg_price = d['C'].toString().toDouble().toInteger()
|
||||
o.match_city = d['D']
|
||||
o.match_region = d['E']
|
||||
o.match_name = d['F']
|
||||
o.source_type = 1 //1:成交参考价 2:参考价
|
||||
o.c_date = new Date()
|
||||
rets << o
|
||||
@@ -57,11 +128,11 @@ class LoadGuide {
|
||||
o.city = d['E']
|
||||
o.region = d['A']
|
||||
o.name = d['B']
|
||||
o.avg_price = d['D'].toString().toDouble().toInteger()
|
||||
o.avg_price = d['C'].toString().toDouble().toInteger()
|
||||
o.match_city = d['E']
|
||||
o.match_region = d['F']
|
||||
o.match_name = d['G']
|
||||
o.house_count = d['C'].toString().toDouble().toInteger()
|
||||
// o.house_count = d['C'].toString().toDouble().toInteger()
|
||||
o.source_type = 1 //1:成交参考价 2:参考价
|
||||
o.c_date = new Date()
|
||||
rets << o
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DistrictCodeUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.lixue.util.DBUtils
|
||||
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.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
import org.apache.poi.ss.util.RegionUtil
|
||||
import org.bson.types.ObjectId
|
||||
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.ConcurrentHashMap
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/**
|
||||
* oracle中小区统计数据同步至85中
|
||||
*/
|
||||
class OracleDistrict2Mongo85 {
|
||||
|
||||
static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static final DBCollection communityPoiConn = MongoUtils.getCollectionByName("fangjia_stat", "community_poi_gj", "192.168.0.85", 28017)
|
||||
|
||||
static main(args) {
|
||||
// 只写入重庆市数据
|
||||
def sql = "select cityid, distname, commid, commname, subway, traffic, bank, primary, junior, hospital, funeral from COMMUNITY_POI_GJ"
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def city = DistrictCodeUtils.getCityName(r['cityid'])
|
||||
def region = RegionData.formatRegion(city, r['distname'])
|
||||
DBObject dbObject = new BasicDBObject("_id", r['commid'])
|
||||
DBObject updateObject = new BasicDBObject("city", city).append("region", region)
|
||||
.append("name", r['commname'])
|
||||
.append('subway', Integer.parseInt(r['subway'].toString()))
|
||||
.append("traffic", Integer.parseInt(r['traffic'].toString()))
|
||||
.append("bank", Integer.parseInt(r['bank'].toString()))
|
||||
.append("primary", Integer.parseInt(r['primary'].toString()))
|
||||
.append("junior", Integer.parseInt(r['junior'].toString()))
|
||||
.append("hospital", Integer.parseInt(r['hospital'].toString()))
|
||||
.append("funeral", Integer.parseInt(r['funeral'].toString()))
|
||||
.append("c_date", new Date());
|
||||
communityPoiConn.update(dbObject, updateObject, true, false)
|
||||
count++;
|
||||
if (count % 500 == 0) {
|
||||
println "已写入" + count + "条小区数据"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.fangjia.script.ccbevaluation
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DistrictCodeUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.lixue.util.DBUtils
|
||||
import com.fangjia.script.util.DataUtil
|
||||
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.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
|
||||
/**
|
||||
* oracle中小区置信度数据同步至85中
|
||||
*/
|
||||
class OracleDistrictBasePrice2Mongo85 {
|
||||
|
||||
static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static final DBCollection communityBasePriceConn = MongoUtils.getCollectionByName("business", "community_base_price_gj", "192.168.0.85", 28017)
|
||||
|
||||
static main(args) {
|
||||
def sql = "SELECT cityname, distname, commid, commname, confidence FROM community_base_price_gj WHERE YEAR_MONTH='202205'"
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def city = r['cityname']
|
||||
def region = RegionData.formatRegion(city, r['distname'])
|
||||
DBObject dbObject = new BasicDBObject("_id", r['commid'])
|
||||
if (r['confidence'] != null) {
|
||||
def credit = new BigDecimal(r['confidence']).setScale(2, BigDecimal.ROUND_HALF_UP).toDouble()
|
||||
DBObject updateObject = new BasicDBObject("city", city).append("region", region)
|
||||
.append("name", r['commname'])
|
||||
.append("credit", credit)
|
||||
.append("c_date", new Date());
|
||||
communityBasePriceConn.update(dbObject, updateObject, true, false)
|
||||
count++;
|
||||
} else {
|
||||
print "置信度为空:" + r.toString()
|
||||
}
|
||||
if (count % 500 == 0) {
|
||||
println "已写入" + count + "条小区数据"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -36,11 +36,11 @@ class StagingDistrictBatch extends BaseBatch{
|
||||
|
||||
|
||||
def results =[]
|
||||
def headers = ["分期ID","小区ID","小区主期ID","备注","创建时间","更新时间","来源公司"]
|
||||
def headers = []//["分期ID","小区ID","小区主期ID","备注","创建时间","更新时间","来源公司"]
|
||||
results << headers
|
||||
results.addAll(rows)
|
||||
|
||||
ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\COMMUNITY_STAGING_GJ.xlsx", results, "数据")
|
||||
//ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\COMMUNITY_STAGING_GJ.xlsx", results, "数据")
|
||||
FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\COMMUNITY_STAGING_GJ.dat",headers, "utf-8", false);
|
||||
|
||||
}
|
||||
|
||||
+291
-81
@@ -27,7 +27,13 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.*;
|
||||
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
//def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521: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")
|
||||
|
||||
def sqlInstance94 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.94:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com")
|
||||
@@ -56,14 +62,12 @@ def DBCollection youda_esfhouse_coll = MongoUtils.getCollectionByName2("business
|
||||
// println city +" "+count
|
||||
//}
|
||||
|
||||
//def fileName = "d:\\数据\\建行\\房产估值\\基础数据交付情况_0927.xlsx"
|
||||
//def fileName = "d:\\数据\\建行\\房产估值\\基础数据交付情况_0927(1).xlsx"
|
||||
//def datas = ExcelUtils.read("d:\\数据\\建行\\房产估值\\7月成交.xlsx",0,1)
|
||||
//def dealMap = [:]
|
||||
//for(def d : datas){
|
||||
// dealMap.put(d['A'], d['B'])
|
||||
//}
|
||||
//
|
||||
//
|
||||
//ExcelUtils.multiThreadingModify(fileName,{d->
|
||||
// if(d['C']){
|
||||
// d['Q'] = dealMap.get(d['C'])
|
||||
@@ -97,7 +101,7 @@ def DBCollection youda_esfhouse_coll = MongoUtils.getCollectionByName2("business
|
||||
// if (city) {
|
||||
// def cityid = cityCodeDatas.get(city)
|
||||
// def total = findCount(cityid, sqlInstance)
|
||||
// d['H'] = total
|
||||
// d['P'] = total
|
||||
// }
|
||||
//},0)
|
||||
|
||||
@@ -220,18 +224,43 @@ def youdaDeal(youda_esfhouse_coll, def city, def region, def name, def area, def
|
||||
}
|
||||
|
||||
|
||||
//def fileName = "D:\\数据\\建行\\建行成交\\成交数据_1025 - 副本.xlsx"
|
||||
//def dealMap = findDealCount(sqlInstance, "2021-06-01", "2021-07-01")
|
||||
//def testMap = findCaluateCityPPE(sqlInstance, 202107)
|
||||
//def fileName = "D:\\数据\\建行\\房产估值\\成交\\成交数据_1222 - 副本.xlsx"
|
||||
//def dealMap = findDealCount(sqlInstance236, "2022-02-01", "2022-03-01")
|
||||
//def testMap = findCaluateCityPPE(sqlInstance236, 202203)
|
||||
//ExcelUtils.modify(fileName,{d->
|
||||
// if(d['C']){
|
||||
// def oldcount = dealMap.get(d['C'])
|
||||
// d['F'] = oldcount
|
||||
// d['X'] = oldcount
|
||||
// def casecount = testMap.get(d['C'])
|
||||
// d['G'] = casecount
|
||||
// d['Y'] = casecount
|
||||
// println d
|
||||
// }
|
||||
//},0)
|
||||
def rows = findTradePpeData(sqlInstance236)
|
||||
// rows.unique()
|
||||
def map=findTradeDetail(sqlInstance236,null)
|
||||
def datas=[]
|
||||
map.each{key,row->
|
||||
if(!rows.contains(key)){
|
||||
datas<<row
|
||||
}
|
||||
}
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交未使用.xlsx", datas, "数据")
|
||||
|
||||
//def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
//def datas=[]
|
||||
//cityCodeDataMap.each{city,code->
|
||||
// def rows = findTradePpeData(sqlInstance236, 202203,code)
|
||||
// def alltrades=findTradeDetail(sqlInstance236,code)
|
||||
// alltrades.each{it->
|
||||
// def commid=it[0]
|
||||
// if(!rows.contains(commid)){
|
||||
// datas<<it
|
||||
// }
|
||||
// }
|
||||
// println datas.size()
|
||||
//}
|
||||
//ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交未使用.xlsx", datas, "数据")
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\小区\\5个城市小区列表0723(1).xlsx",{d->
|
||||
// if(d['I'] && d['K']){
|
||||
@@ -243,7 +272,7 @@ def youdaDeal(youda_esfhouse_coll, def city, def region, def name, def area, def
|
||||
//},0)
|
||||
|
||||
//0-正常 1-非小区,2-地块, 3-无效小区,7-自然村 9-高德比对王一期不存在删除
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\需要修正的一期数据.xlsx",{d->
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\27城一期数据.xlsx",{d->
|
||||
// if(d['A']){
|
||||
// def obj = CommonDatautils.findDistrictById(d['A'])
|
||||
// if(obj && obj.name.contains("一期")){
|
||||
@@ -266,80 +295,164 @@ def youdaDeal(youda_esfhouse_coll, def city, def region, def name, def area, def
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//def index = 0
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\人工核实需删除数据\\是否独有及第三方是否存在20220217\\9370300_淄博_是否独有及第三方是否存在(删除383).xlsx",{d->
|
||||
// def flag = d['M']
|
||||
// if(flag==0.0){
|
||||
// if(d['D']){
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("name_cat", 11)
|
||||
// udata.put("m_date",new Date())
|
||||
//
|
||||
// def q = new BasicDBObject()
|
||||
// q.put("_id", new ObjectId(d['D']))
|
||||
// DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
// index++
|
||||
// println index
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//},0)
|
||||
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\新增别名数据_3788.xlsx",{d->
|
||||
if(d['A']){
|
||||
def dist = CommonDatautils.findDistrictById(d['A'])
|
||||
if(dist){
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\补充删除数据1223_1228.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){
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("name_cat", 11)
|
||||
// udata.put("m_date",new Date())
|
||||
//
|
||||
// def q = new BasicDBObject()
|
||||
// q.put("_id", dist._id)
|
||||
// DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
// }else{
|
||||
// println d
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
def alias = []
|
||||
if(d['H'] && d['H']!=dist.name){
|
||||
alias << d['H']
|
||||
if(d['H'].contains("·")){
|
||||
alias << d['H'].replace("·", "")
|
||||
}
|
||||
if(dist.alias){
|
||||
for(def aliasName : dist.alias){
|
||||
if(!alias.contains(aliasName)){
|
||||
alias << aliasName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//def citys = CcbCommonUtils.citys
|
||||
//def rets = []
|
||||
//for(def city : citys){
|
||||
// def count = CommonDatautils.findSeaweeds(city, "district", 1)
|
||||
// rets << [city, count]
|
||||
//}
|
||||
//ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\统计.xlsx", rets, "数据")
|
||||
|
||||
def address = null
|
||||
if(d['I']){
|
||||
address = AddressUtil.formatAddress(dist.city, d['I'])
|
||||
}
|
||||
//def citys = ["广州","重庆","深圳","上海","北京","南京","泉州"]
|
||||
//for(def city : citys){
|
||||
// def districts = CommonDatautils.findAllDistrictByCity(city, "district", ["name_cat"])
|
||||
// def index = 0
|
||||
// for(def dist : districts){
|
||||
// if(dist.name_cat && dist.name_cat==1){
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("name_cat", 0)
|
||||
// udata.put("m_date",new Date())
|
||||
//
|
||||
// def q = new BasicDBObject()
|
||||
// q.put("_id", dist._id)
|
||||
// DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
// index++
|
||||
// }
|
||||
// }
|
||||
// println city +" "+index
|
||||
//}
|
||||
|
||||
Long lng = null
|
||||
Long lat = null
|
||||
Long lat2 = null
|
||||
Long lng2 = null
|
||||
if(d['J']){
|
||||
lng = d['J'].toString().toDouble() * 10000000000l;
|
||||
lat = d['K'].toString().toDouble() * 10000000000l;
|
||||
def json = BaiDuApiUtils.geoconv(d['J'].toString().toDouble(), d['K'].toString().toDouble(), 3)
|
||||
if(json != null && json.containsKey("x")) {
|
||||
lat2 = json.get("y") * 10000000000l
|
||||
lng2 = json.get("x") * 10000000000l
|
||||
}
|
||||
}
|
||||
|
||||
def region = null
|
||||
if(dist.region!=d['F']){
|
||||
region = dist.region
|
||||
}
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\价格过滤的小区.xlsx",{d->
|
||||
// if(d['C']){
|
||||
//// def udata = new BasicDBObject()
|
||||
//// udata.put("name_cat", 0)
|
||||
//// udata.put("m_date",new Date())
|
||||
////
|
||||
//// def q = new BasicDBObject()
|
||||
//// q.put("_id", new ObjectId(d['C']))
|
||||
//// DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
// def count = findDistCount(d['C'], sqlInstance);
|
||||
// if(count==0){
|
||||
// println d['C']
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
def udata = new BasicDBObject()
|
||||
if(region){
|
||||
udata.put("region", region)
|
||||
}
|
||||
|
||||
if(address){
|
||||
udata.put("address", address)
|
||||
}
|
||||
if(lat2){
|
||||
udata.put("lng", lng)
|
||||
udata.put("lat", lat)
|
||||
udata.put("lng2", lng2)
|
||||
udata.put("lat2", lat2)
|
||||
}
|
||||
|
||||
if(alias){
|
||||
udata.put("alias", alias)
|
||||
}
|
||||
if(udata){
|
||||
index++
|
||||
DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
println index+ " "+dist.city +" "+dist.name+" "+udata
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},0)
|
||||
//def index = 0
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\重庆反查数据_669(审核完毕).xlsx",{d->
|
||||
// if(d['A']){
|
||||
// def dist = CommonDatautils.findDistrictById(d['A'])
|
||||
// if(dist){
|
||||
//
|
||||
// def alias = []
|
||||
// if(d['H'] && d['H']!=dist.name){
|
||||
// alias << d['H']
|
||||
// if(d['H'].contains("·")){
|
||||
// alias << d['H'].replace("·", "")
|
||||
// }
|
||||
// if(dist.alias){
|
||||
// for(def aliasName : dist.alias){
|
||||
// if(!alias.contains(aliasName)){
|
||||
// alias << aliasName
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def address = null
|
||||
// if(d['I']){
|
||||
// address = AddressUtil.formatAddress(dist.city, d['I'])
|
||||
// }
|
||||
//
|
||||
// Long lng = null
|
||||
// Long lat = null
|
||||
// Long lat2 = null
|
||||
// Long lng2 = null
|
||||
// if(d['J']){
|
||||
// lng = d['J'].toString().toDouble() * 10000000000l;
|
||||
// lat = d['K'].toString().toDouble() * 10000000000l;
|
||||
// def json = BaiDuApiUtils.geoconv(d['J'].toString().toDouble(), d['K'].toString().toDouble(), 3)
|
||||
// if(json != null && json.containsKey("x")) {
|
||||
// lat2 = json.get("y") * 10000000000l
|
||||
// lng2 = json.get("x") * 10000000000l
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def region = null
|
||||
// if(dist.region!=d['F']){
|
||||
// region = dist.region
|
||||
// }
|
||||
//
|
||||
// def udata = new BasicDBObject()
|
||||
// if(region){
|
||||
// udata.put("region", region)
|
||||
// }
|
||||
//
|
||||
// if(address){
|
||||
// udata.put("address", address)
|
||||
// }
|
||||
// if(lat2){
|
||||
// udata.put("lng", lng)
|
||||
// udata.put("lat", lat)
|
||||
// udata.put("lng2", lng2)
|
||||
// udata.put("lat2", lat2)
|
||||
// }
|
||||
//
|
||||
// if(alias){
|
||||
// udata.put("alias", alias)
|
||||
// }
|
||||
// if(udata){
|
||||
// index++
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// println index+ " "+dist.city +" "+dist.name+" "+udata
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//},0)
|
||||
|
||||
|
||||
|
||||
@@ -405,9 +518,51 @@ ExcelUtils.multiThreadingModify("D:\\
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//def index = 0
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\小区信息修正的数据(3897)_0118.xlsx", { d ->
|
||||
// if(d['A']){
|
||||
// def dist = CommonDatautils.findDistrictById(d['A'])
|
||||
// if(dist){
|
||||
// if(d['K']){
|
||||
// def formatAddress = AddressUtil.formatAddress(d['B'], d['K'])
|
||||
// def address = null
|
||||
// if(formatAddress && formatAddress.endsWith("号")) {
|
||||
// address = formatAddress
|
||||
// }
|
||||
//
|
||||
//
|
||||
// def data = new BasicDBObject();
|
||||
// data.put("m_date", new Date())
|
||||
// if(d['M']){
|
||||
// long glat = d['M'].toString().toDouble() * 10000000000L
|
||||
// long glng = d['L'].toString().toDouble() * 10000000000L
|
||||
// data.put("lat",glat)
|
||||
// data.put("lng",glng)
|
||||
//
|
||||
// def baidu = BaiDuApiUtils.geoconv(d['L'].toString().toDouble(), d['M'].toString().toDouble(), 3)
|
||||
// if(baidu){
|
||||
// long blng = baidu.x * 10000000000L
|
||||
// long blat = baidu.y * 10000000000L
|
||||
// data.put("lat2",blat)
|
||||
// data.put("lng2",blng)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if(address){
|
||||
// data.put("address", address)
|
||||
// }
|
||||
// index++
|
||||
// println index +" "+d['B'] + " "+data
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', data))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
|
||||
|
||||
def findDealCount(sqlInstance, def startDate, def endDate){
|
||||
def sql = "select cityname,count(*) as count from bigdata_deal_gj_test where dealdate>=to_date('${startDate}','yyyy-mm-dd') and dealdate<to_date('${endDate}','yyyy-mm-dd') group by cityname";
|
||||
def sql = "select cityname,count(*) as count from bigdata_deal_gj where dealdate>=to_date('${startDate}','yyyy-mm-dd') and dealdate<to_date('${endDate}','yyyy-mm-dd') group by cityname";
|
||||
def count = 0
|
||||
|
||||
def map = [:]
|
||||
@@ -428,8 +583,30 @@ def findCaluateCityPPE(def sqlInstance, def yearMonth){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
def findTradePpeData(def sqlInstance){
|
||||
def sql = "SELECT commid,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate,target_avg_price FROM avm_evaluation_item_gj where year_month=202203 and data_type='成交'";
|
||||
def rows = new HashSet()
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
rows<<r.commid+"##"+r.buildarea+"##"+r.target_avg_price+"##"+r.dealdate
|
||||
});
|
||||
return rows
|
||||
}
|
||||
def findTradeDetail(def sqlInstance, def cityid){
|
||||
def sql = "select commid,cityname,distname,commname,buildarea,dealunitprice,to_char(dealdate,'yyyy-mm-dd') as dealdate from bigdata_deal_gj where dealdate>=to_date('2022-02-01','yyyy-MM-dd')";
|
||||
def map = [:]
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def key=r.commid+"##"+r.buildarea+"##"+r.dealunitprice+"##"+r.dealdate
|
||||
def row=[]
|
||||
row<<r.commid
|
||||
row<<r.cityname
|
||||
row<<r.distname
|
||||
row<<r.commname
|
||||
row<<r.buildarea
|
||||
row<<r.dealunitprice
|
||||
map.put(key,row)
|
||||
});
|
||||
return map
|
||||
}
|
||||
def findEstateType(cityid, sqlInstance){
|
||||
def sql = "select count(*) as count from bigdata_commbuildtype_gj where cityid='${cityid}' and buildtype!='0199'";
|
||||
def count = 0
|
||||
@@ -450,6 +627,18 @@ def findCount(cityid, sqlInstance){
|
||||
return count
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findDistCount(commid, sqlInstance){
|
||||
def sql = "select count(*) as count from bigdata_community_gj where commid='${commid}' and status=0";
|
||||
def count = 0
|
||||
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
count = r.count
|
||||
});
|
||||
return count
|
||||
}
|
||||
|
||||
def findFiledCount(cityid, field, sqlInstance){
|
||||
def sql = "select count(*) as count from bigdata_community_gj where cityid='${cityid}' and status=0 and "+field+" is not null";
|
||||
def count = 0
|
||||
@@ -567,6 +756,10 @@ def findFiledCount(cityid, field, sqlInstance){
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def isInArea(lng, lat, points){
|
||||
List<Point> pointList = InsidePolygon.createPoint2(points);
|
||||
//Point point = new Point(lng, lat);
|
||||
@@ -636,6 +829,23 @@ def getStreetInfo(def city, def glocation){
|
||||
//}
|
||||
//ExcelUtils.write("C:\\Users\\gaojuan\\Desktop\\上海小区.xlsx", rets, "数据")
|
||||
|
||||
//def datas1 = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\12月.xlsx", 0, 1)
|
||||
//def datas2 = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\1月.xlsx", 0, 1)
|
||||
//
|
||||
//def keys = []
|
||||
//for(def d : datas2){
|
||||
// keys << d['A']+"##"+d['C']+"##"+d['B']
|
||||
//}
|
||||
//
|
||||
//def index = 0
|
||||
//for(def d : datas1){
|
||||
// def k = d['A']+"##"+d['C']+"##"+d['B']
|
||||
// if(!keys.contains(k)){
|
||||
// index ++
|
||||
// println index +" "+k
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+138
-18
@@ -22,9 +22,9 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class ThirdPartyPriceBatch extends BaseBatch {
|
||||
|
||||
def sDate= 202109//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
def startDate = 202107
|
||||
def endDate = 202109
|
||||
def sDate= 202204//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
def startDate = 202202
|
||||
def endDate = 202204
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -6, "yyyyMM"));
|
||||
|
||||
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
|
||||
@@ -33,7 +33,7 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
def sourceMap = ["诸葛找房":"01", "安居客":"02","房天下":"03","链家":"04","城市家居":"05","麦田":"06","贝壳":"07","淘房365":"08","中原":"09","兔博士":"10","Q房":"11","房探":"12",
|
||||
"房多多":"13","我爱我家":"14","禧泰数据":"15","吉屋网":"16","乐居":"17","21世纪":"18","房产超市":"19","58同城":"20"]
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static main(args) {
|
||||
@@ -48,24 +48,22 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
def weekend = DateUtils.getFirstDayOfWeek(new Date())
|
||||
for(def city : citys){
|
||||
index++
|
||||
// def statMap = getDistrictStatByCity(city, weekend)
|
||||
def statMap = getDistrictStatByCity(city, weekend)
|
||||
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
||||
// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
//
|
||||
// def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name","name_cat", "estate_type2","lng"])
|
||||
def thirdPriceMap = findThirdPartyPrice(city, statMap)
|
||||
// def rets = createCityDatas(cityCodeDatas, distCodeMap, dists, thirdPriceMap)
|
||||
// def rets = createCityDatas2(cityCodeDatas, distCodeMap, dists, thirdPriceMap)
|
||||
// rows.addAll(rets)
|
||||
def rets = createData3(cityCodeDatas.get(city))
|
||||
rows.addAll(rets)
|
||||
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
|
||||
|
||||
def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name","name_cat", "estate_type2","lng"])
|
||||
def thirdPriceMap = findThirdPartyPrice(city, statMap)
|
||||
//def rets = createCityDatas(cityCodeDatas, distCodeMap, dists, thirdPriceMap)//老第三方均价表(现不用)
|
||||
def rets = createCityDatas1(cityCodeDatas, distCodeMap, dists, thirdPriceMap)
|
||||
// def rets = createData3(cityCodeDatas.get(city))//新第三方均价表,要做2步,麻烦
|
||||
rows.addAll(rets)
|
||||
println index+" "+city+" "+rets.size() +" "+rows.size()
|
||||
}
|
||||
|
||||
def fileName = "/home/goojia/ccb/THIRD_PARTY_PRICE_GJ.dat"
|
||||
def fileName = "/home/goojia/ccb/BIGDATA_THIRD_PARTY_PRICE_GJ.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\THIRD_PARTY_PRICE_GJ.dat"
|
||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_THIRD_PARTY_PRICE_GJ.dat"
|
||||
}
|
||||
|
||||
def header = []//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","均价对应的月份","诸葛找房均价","安居客均价","房天下均价","链家均价","城市房产均价","麦田均价","贝壳均价","淘房365","中原均价","兔博士均价","Q房均价","房探均价","房多多均价","我爱我家均价","创建时间","更新时间","来源公司"]
|
||||
@@ -183,6 +181,127 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
}
|
||||
|
||||
|
||||
def createCityDatas1(cityCodeDatas, distCodeMap, dists, thirdPriceMap){
|
||||
def allRows = []
|
||||
for(def d : dists){
|
||||
|
||||
def third = thirdPriceMap.get(d.region+"##"+d.name)
|
||||
if(third){
|
||||
def data = distCodeMap.get(d.region)
|
||||
if(data){
|
||||
def dataMap = [:]
|
||||
dataMap.COMMID = d._id.toString()
|
||||
dataMap.COMMNAME = d.name
|
||||
dataMap.CITYID = cityCodeDatas.get(d.city)
|
||||
dataMap.CITYNAME = d.city
|
||||
dataMap.DISTID = data.district_code
|
||||
dataMap.DISTNAME = data.district
|
||||
dataMap.YEAR_MONTH = sDate
|
||||
def price_map = [:]
|
||||
dataMap.price_map = price_map
|
||||
if(third.zhugezhaofang_esf_price){
|
||||
price_map.zhuge_avg_price = third.zhugezhaofang_esf_price
|
||||
}
|
||||
if(third.anjuke_esf_price){
|
||||
price_map.anjuke_avg_price = third.anjuke_esf_price
|
||||
}
|
||||
if(third.soufang_esf_price){
|
||||
price_map.fang_avg_price = third.soufang_esf_price
|
||||
}
|
||||
if(third.lianjia_esf_price){
|
||||
price_map.lianjia_avg_price = third.lianjia_esf_price
|
||||
}
|
||||
if(third.cityhouse_esf_price){
|
||||
price_map.cityhouse_avg_price = third.cityhouse_esf_price
|
||||
}
|
||||
if(third.maitian_esf_price){
|
||||
price_map.maitian_avg_price = third.maitian_esf_price
|
||||
}
|
||||
if(third.beike_esf_price){
|
||||
price_map.ke_avg_price = third.beike_esf_price
|
||||
}
|
||||
if(third.get("365house_esf_price")){
|
||||
price_map.taofang_avg_price = third.get("365house_esf_price")
|
||||
}
|
||||
if(third.zhongyuan_esf_price){
|
||||
price_map.zhongyuan_avg_price = third.zhongyuan_esf_price
|
||||
}
|
||||
if(third.tuboshi_esf_price){
|
||||
price_map.tbs_avg_price = third.tuboshi_esf_price
|
||||
}
|
||||
if(third.qfang_esf_price){
|
||||
price_map.qfang_avg_price = third.qfang_esf_price
|
||||
}
|
||||
if(third.fangtan_esf_price){
|
||||
price_map.fangtan_avg_price = third.fangtan_esf_price
|
||||
}
|
||||
if(third.fangduoduo_esf_price){
|
||||
price_map.fangduoduo_avg_price = third.fangduoduo_esf_price
|
||||
}
|
||||
if(third.get("5i5j_esf_price")){
|
||||
price_map.wiwj_avg_price = third.get("5i5j_esf_price")
|
||||
}
|
||||
dataMap.updatetime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
allRows << dataMap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def results = []
|
||||
for(def m : allRows){
|
||||
def priceMap = m.price_map
|
||||
priceMap.each{k,v->
|
||||
def ret = []
|
||||
ret << new ObjectId().toString()
|
||||
ret << m.CITYID
|
||||
ret << m.DISTID
|
||||
ret << m.COMMID
|
||||
ret << m.COMMNAME
|
||||
|
||||
def web = ""
|
||||
if(k=="zhuge_avg_price"){
|
||||
web = "诸葛找房"
|
||||
}else if(k=="anjuke_avg_price"){
|
||||
web = "安居客"
|
||||
}else if(k=="fang_avg_price"){
|
||||
web = "房天下"
|
||||
}else if(k=="lianjia_avg_price"){
|
||||
web = "链家"
|
||||
}else if(k=="cityhouse_avg_price"){
|
||||
web = "禧泰数据"
|
||||
}else if(k=="maitian_avg_price"){
|
||||
web = "麦田"
|
||||
}else if(k=="ke_avg_price"){
|
||||
web = "贝壳"
|
||||
}else if(k=="taofang_avg_price"){
|
||||
web = "淘房365"
|
||||
}else if(k=="zhongyuan_avg_price"){
|
||||
web = "中原"
|
||||
}else if(k=="tbs_avg_price"){
|
||||
web = "兔博士"
|
||||
}else if(k=="qfang_avg_price"){
|
||||
web = "Q房"
|
||||
}else if(k=="fangtan_avg_price"){
|
||||
web = "房探"
|
||||
}else if(k=="fangduoduo_avg_price"){
|
||||
web = "房多多"
|
||||
}else if(k=="wiwj_avg_price"){
|
||||
web = "我爱我家"
|
||||
}
|
||||
|
||||
ret << sourceMap.get(web)
|
||||
ret << web
|
||||
ret << m.YEAR_MONTH
|
||||
ret << v
|
||||
ret << ""
|
||||
ret << ""
|
||||
ret << m.updatetime
|
||||
results << ret
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
def createCityDatas2(cityCodeDatas, distCodeMap, dists, thirdPriceMap) {
|
||||
def rets = []
|
||||
for (def d : dists) {
|
||||
@@ -208,7 +327,7 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
}else if(k=="lianjia_esf_price"){
|
||||
web = "链家"
|
||||
}else if(k=="cityhouse_esf_price"){
|
||||
web = "城市房产"
|
||||
web = "禧泰数据"
|
||||
}else if(k=="maitian_esf_price"){
|
||||
web = "麦田"
|
||||
}else if(k=="beike_esf_price"){
|
||||
@@ -343,7 +462,7 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
}else if(k=="lianjia_avg_price"){
|
||||
web = "链家"
|
||||
}else if(k=="cityhouse_avg_price"){
|
||||
web = "城市房产"
|
||||
web = "禧泰数据"
|
||||
}else if(k=="maitian_avg_price"){
|
||||
web = "麦田"
|
||||
}else if(k=="ke_avg_price"){
|
||||
@@ -383,6 +502,7 @@ class ThirdPartyPriceBatch extends BaseBatch {
|
||||
def findThirdPartyPrice(def city, def statMap){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
|
||||
q.put("s_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
|
||||
def dbcursor = AVERAGE_STATISTICS.find(q).sort(new BasicDBObject("s_date", -1))
|
||||
def map = [:]
|
||||
|
||||
+51
-16
@@ -9,6 +9,7 @@ import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.QueryOperators
|
||||
import groovy.sql.Sql
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
@@ -28,7 +29,7 @@ class TradeStatLog {
|
||||
public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017";
|
||||
public static final DBCollection youda_esfhouse_coll = MongoUtils.getCollectionByName2("business", "res_esfdealprice", offlineUrl)
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
|
||||
@@ -40,13 +41,15 @@ class TradeStatLog {
|
||||
static main(args) {
|
||||
def task = new TradeStatLog()
|
||||
task.run()//统计最近3个月抓取的成交数据量
|
||||
// task.exportTrade()//导出未入库成交
|
||||
// task.thirdPartyStat()
|
||||
// println Calendar.getInstance().get(Calendar.YEAR)
|
||||
// task.averageStat()
|
||||
// task.exportTrade()
|
||||
// task.deleteDistrict()
|
||||
// task.deleteDealData()
|
||||
// task.deleteDealData2()
|
||||
// task.statTableCount()
|
||||
// task.filterTrade()
|
||||
|
||||
|
||||
}
|
||||
@@ -72,13 +75,13 @@ class TradeStatLog {
|
||||
def run(){
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def rets = []
|
||||
rets << ["城市","8月总量","9月总量","10月总量","占比","贝壳","链家", "我爱我家","房天下","中原"]
|
||||
rets << ["城市","2月总量","3月总量","4月总量","占比","贝壳","链家", "我爱我家","房天下","中原"]
|
||||
def sources = ["贝壳找房","链家在线", "我爱我家","房天下","中原地产"]
|
||||
//def startDate = "2021-05-01"
|
||||
def startDate = "2021-08-01"
|
||||
def date = "2021-09-01"
|
||||
def endDate = "2021-10-01"
|
||||
def newDate = "2021-11-01"
|
||||
def startDate = "2022-02-01"
|
||||
def date = "2022-03-01"
|
||||
def endDate = "2022-04-01"
|
||||
def newDate = "2022-05-01"
|
||||
|
||||
for(def city : citys){
|
||||
def lastMonthCount = findTradesCount(city, null, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(date,"yyyy-MM-dd"))
|
||||
@@ -128,7 +131,7 @@ class TradeStatLog {
|
||||
}
|
||||
|
||||
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\数据文件\\10月成交统计.xlsx", rets, "数据")
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交\\2022-04成交统计.xlsx", rets, "数据")
|
||||
println "表格生成完成"
|
||||
}
|
||||
|
||||
@@ -478,16 +481,18 @@ class TradeStatLog {
|
||||
def headers = ["ID", "城市", "区域", "名称", "来源","价格", "面积","地址", "成交时间","过滤原因"]
|
||||
def rets = []
|
||||
rets << headers
|
||||
def startDate = "2022-03-01"
|
||||
def endDate = "2022-04-01"
|
||||
for(def city : citys){
|
||||
|
||||
def trades = findTradesDetail(city, DateUtils.parseFromTightByPattern("2021-09-01","yyyy-MM-dd"), DateUtils.parseFromTightByPattern("2021-10-01","yyyy-MM-dd"))
|
||||
def trades = findTradesDetail(city, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(endDate,"yyyy-MM-dd"))
|
||||
// def trades = getYouDaData()
|
||||
|
||||
//def statMap = getDistrictStatByCity(city, weekend)
|
||||
def nameMap = getAllDistrict(city)
|
||||
|
||||
|
||||
def rMap = findDealIds(city);
|
||||
def rMap = findDealIds(city, startDate, endDate);
|
||||
def ids = rMap.ids
|
||||
def details = rMap.detail
|
||||
|
||||
@@ -546,8 +551,10 @@ class TradeStatLog {
|
||||
reason = "数据重复"
|
||||
}
|
||||
}
|
||||
if(!reason && t.area<20){
|
||||
reason = "面积过小"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def tradeDate = DateUtils.formatDateByPattern(t.trade_date,"yyyy-MM-dd")
|
||||
//rets << [t._id.toString(), t.city, t.region, t.district_name, t.source, t.avg_price, t.area,t.address, tradeDate, reason, t.estate_type]
|
||||
@@ -556,8 +563,7 @@ class TradeStatLog {
|
||||
}
|
||||
println city +" "+rets.size()
|
||||
}
|
||||
|
||||
ExcelUtils.write("d:\\数据\\成交未入库记录(9月).xlsx", rets,"数据")
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交\\成交未入库记录(1月).xlsx", rets,"数据")
|
||||
}
|
||||
|
||||
def deleteDistrict(){
|
||||
@@ -613,8 +619,8 @@ class TradeStatLog {
|
||||
return trades
|
||||
}
|
||||
|
||||
def findDealIds(city){
|
||||
def sql = "select * from bigdata_deal_gj where dealdate>=to_date('2021-09-01','yyyy-mm-dd') and dealdate<to_date('2021-10-01','yyyy-mm-dd') and cityname='${city}'";//and dealdate<to_date('2021-08-01','yyyy-mm-dd')
|
||||
def findDealIds(city, startDate, endDate){
|
||||
def sql = "select * from bigdata_deal_gj where dealdate>=to_date('${startDate}','yyyy-mm-dd') and dealdate<to_date('${endDate}','yyyy-mm-dd') and cityname='${city}'";//and dealdate<to_date('2021-08-01','yyyy-mm-dd')
|
||||
def ids = []
|
||||
def detailInfos = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
@@ -638,7 +644,7 @@ class TradeStatLog {
|
||||
public static def findTradesDetail(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
// q.put("district_name","百合花园")
|
||||
// q.put("district_name","长隆住宅小区")
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def rets = []
|
||||
@@ -693,4 +699,33 @@ class TradeStatLog {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def deleteDealData2(){
|
||||
//sqlInstance.eachRow("select dealid from bigdata_deal_gj where dealdate>=to_date('2021-10-01','yyyy-MM-dd')",{r->
|
||||
sqlInstance.executeUpdate("delete from bigdata_deal_gj where dealdate>=to_date('2021-10-01','yyyy-MM-dd')")
|
||||
// })
|
||||
|
||||
|
||||
}
|
||||
|
||||
def filterTrade(){
|
||||
ExcelUtils.modify("D:\\数据\\建行\\房产估值\\成交\\成交未入库记录(1月).xlsx",{d->
|
||||
if(!d['J']){
|
||||
def count = findTradeById(d['A'])
|
||||
if(count){
|
||||
d['J'] = "其它原因过滤"
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
|
||||
def findTradeById(id){
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id", new ObjectId(id))
|
||||
q.put("match_id", new BasicDBObject(QueryOperators.EXISTS, true))
|
||||
def count = DEAL_PRICE_COLL.count(q)
|
||||
return count
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
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 groovy.sql.Sql
|
||||
|
||||
class CcbDataStat {
|
||||
|
||||
public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com")
|
||||
|
||||
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 CcbDataStat()
|
||||
// task.run()
|
||||
task.tradeRun()
|
||||
}
|
||||
|
||||
def tradeRun(){
|
||||
def ccbCitys = CcbCommonUtils.citys;
|
||||
def startDate = DateUtils.parseFromTightByPattern("2021-01-01","yyyy-MM-dd")
|
||||
def endDate = DateUtils.parseFromTightByPattern("2022-01-01","yyyy-MM-dd")
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\成交案例统计_0531.xlsx", { d ->
|
||||
if(d['A']){
|
||||
if(ccbCitys.contains(d['A'])){
|
||||
d['D'] = findOracleTotalCount(d['A'])
|
||||
}else{
|
||||
def totalcount = findAllTradeCount(d['A'], startDate, endDate)
|
||||
def repeatCount = findRepeatCount(d['A'], startDate, endDate)
|
||||
def matchTotalCount = findMatchTradeCount(d['A'], startDate, endDate)
|
||||
def matchRepeatTotalCount = findMatchRepeatTradeCount(d['A'], startDate, endDate)
|
||||
d['B'] = totalcount
|
||||
d['C'] = repeatCount
|
||||
d['D'] = matchTotalCount
|
||||
d['E'] = matchRepeatTotalCount
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findRepeatCount(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def set = new HashSet()
|
||||
for(def d : dbcursor){
|
||||
def key = d.region+"##"+d.district_name+"##"+d.avg_price+"##"+d.area+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyyMMdd")
|
||||
if(!set.contains(key)){
|
||||
set << key
|
||||
}
|
||||
}
|
||||
return set.size()
|
||||
}
|
||||
|
||||
def findMatchRepeatTradeCount(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
q.put("match_id", new BasicDBObject('$exists', true))
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def set = new HashSet()
|
||||
for(def d : dbcursor){
|
||||
def key = d.match_id+"#"+d.avg_price+"##"+d.area+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyyMMdd")
|
||||
if(!set.contains(key)){
|
||||
set << key
|
||||
}
|
||||
}
|
||||
return set.size()
|
||||
}
|
||||
|
||||
|
||||
def findMatchTradeCount(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
q.put("match_id", new BasicDBObject('$exists', true))
|
||||
def count = DEAL_PRICE_COLL.count(q)
|
||||
return count
|
||||
}
|
||||
|
||||
|
||||
public static def findAllTradeCount(city, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
// q.put("match_id", new BasicDBObject('$exists', false))
|
||||
def total = DEAL_PRICE_COLL.count(q)
|
||||
return total
|
||||
}
|
||||
|
||||
def findOracleTotalCount(city){
|
||||
def sql = "select count(*) as count from bigdata_deal_gj where cityname='${city}' and dealdate>=to_date('2021-01-01','yyyy-MM-dd') and dealdate<to_date('2022-01-01','yyyy-MM-dd')";//where cityId in (350200,150100)
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
def run(){
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\建行成交\\92个城市字段覆盖率情况.xlsx",{ d->
|
||||
if(d['A']) {
|
||||
def citycode = cityCodeDataMap.get(d['A'])
|
||||
def total = findTotalCount(citycode)
|
||||
def f_count = findDistFinishDate(citycode)
|
||||
def b_count = findBuildTypeCount(citycode)
|
||||
def f_pre = DataHandleUtils.getDoubleRound(2, f_count*100/total)
|
||||
def b_pre = DataHandleUtils.getDoubleRound(2, b_count*100/total)
|
||||
d['C'] = f_pre
|
||||
d['D'] = b_pre
|
||||
d['E'] = total
|
||||
println d['A'] +" "+ total +" "+f_count+" "+b_count
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def findTotalCount(citycode){
|
||||
def sql = "select count(*) as count from bigdata_community_gj where cityid='${citycode}' and status=0";//where cityId in (350200,150100)
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
def findDistFinishDate(citycode){
|
||||
def sql = "select count(*) as count from bigdata_community_gj where cityid='${citycode}' and status=0 and BUILDYEAR>0";//where cityId in (350200,150100)
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
def findBuildTypeCount(citycode){
|
||||
def sql = "select count(*) as count from (select commid, count(commid) as count from bigdata_commbuildtype_gj where cityid='${citycode}' and BUILDTYPE!='0199' group by commid)";//where cityId in (350200,150100)
|
||||
def count = 0
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
count = r.count
|
||||
})
|
||||
return count
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import groovy.sql.Sql
|
||||
|
||||
class CcbDistNameMatch {
|
||||
|
||||
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 CcbDistNameMatch();
|
||||
// task.run()
|
||||
task.run1()
|
||||
}
|
||||
|
||||
def run1(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\新增映射别名.xlsx", { d ->
|
||||
if (d['A']) {
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
if(d['D'].contains("、")){
|
||||
println d['D']
|
||||
}
|
||||
def arrs = d['D'].split("、")
|
||||
def list = []
|
||||
def flags = []
|
||||
for(def s : arrs){
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, s, "district")
|
||||
if(dist){
|
||||
list << dist.name
|
||||
flags << "完全一致"
|
||||
}else{
|
||||
def jsonObject = OpenApiClient.addressMatch(d['A'], s, "property", false, newRegion)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
if(jsonObject.get("district") == newRegion){
|
||||
list << jsonObject.get("name")
|
||||
flags << "匹配接口"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(list){
|
||||
list = list.unique()
|
||||
d['E'] = list.join(",")
|
||||
d['F'] = flags.join(",")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def run(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\不同小区.xlsx", { d ->
|
||||
def regionCode = null
|
||||
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){
|
||||
d['D'] = dist.name
|
||||
def count = findDistrictByOracle(dist._id.toString())
|
||||
if(count && count>0){
|
||||
d['F'] = 1
|
||||
}else{
|
||||
d['H'] = dist.estate_type2
|
||||
d['J'] = dist.name_cat
|
||||
}
|
||||
}else{
|
||||
def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['C'], "district")
|
||||
if (rets) {
|
||||
if(rets.size()>1){
|
||||
d['E'] = "别名-多个"
|
||||
}else{
|
||||
dist = rets[0]
|
||||
d['E'] = d['C'] +"--"+dist.name
|
||||
def count = findAliasByOracle(dist._id.toString())
|
||||
if(count && count>0) {
|
||||
d['G'] = 1
|
||||
}else{
|
||||
d['H'] = dist.estate_type2
|
||||
d['J'] = dist.name_cat
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def findDistrictByOracle(commid){
|
||||
def sql = "select count(*) as count from bigdata_community_gj where commid='${commid}' and status=0";
|
||||
def count = 0
|
||||
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
count = r.count
|
||||
});
|
||||
return count
|
||||
}
|
||||
|
||||
def findAliasByOracle(commid){
|
||||
def sql = "select count(*) as count from address_alias_fjw where address_id='${commid}'";
|
||||
def count = 0
|
||||
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
count = r.count
|
||||
});
|
||||
return count
|
||||
}
|
||||
}
|
||||
+524
@@ -0,0 +1,524 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.DateUtil
|
||||
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
|
||||
import com.fangjia.script.util.CosineSimilarAlgorithm
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.GeoHelper
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class CcbDistrictToDB {
|
||||
|
||||
static main(args) {
|
||||
def task = new CcbDistrictToDB();
|
||||
// task.run()
|
||||
// task.run1()
|
||||
// task.meituanRun()
|
||||
task.meituanSqrentRun()
|
||||
// task.updateDistrict()
|
||||
// task.updateDongguangRegion()
|
||||
}
|
||||
|
||||
def updateDongguangRegion(){
|
||||
def cDate = DateUtils.parseFromTightByPattern("2022-04-27","yyyy-MM-dd")
|
||||
def dist = CommonDatautils.findAllDistrictByCity("东莞", "district", ["city","region","name","c_date","estate_type2"])
|
||||
for(def d : dist){
|
||||
def t = d.c_date
|
||||
if(t.getTime()>cDate.getTime()){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def updateDistrict(){
|
||||
def citys = ["惠州","东莞","金华","苏州","桂林","潮州","廊坊","临沧","通辽","雅安"]
|
||||
def cDate = DateUtils.parseFromTightByPattern("2022-04-27","yyyy-MM-dd")
|
||||
def index = 0
|
||||
for(def city : citys){
|
||||
def dist = CommonDatautils.findAllDistrictByCity(city, "district", ["city","region","name","c_date","estate_type2"])
|
||||
for(def d : dist){
|
||||
def t = d.c_date
|
||||
if(t.getTime()>cDate.getTime()){
|
||||
if(d.name.contains("(")){
|
||||
def delstr = d.name.substring(d.name.indexOf("("), d.name.indexOf(")")+1)
|
||||
def newName = d.name.replace(delstr,"")
|
||||
index++
|
||||
println index+" "+d.city+" "+d.name+" "+newName
|
||||
def obj = CommonDatautils.findDistrict(d.city, d.region, newName, "district")
|
||||
if(!obj){
|
||||
println "update"
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("name", newName)
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject("_id", d._id), new BasicDBObject('$set', udata))
|
||||
|
||||
d.name = newName
|
||||
addPrice(d)
|
||||
|
||||
def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1));
|
||||
CommonUtils.recalculationSqRent(d.city, d.region, newName, d.estate_type2, lastMonthDay,false,0)
|
||||
}else{
|
||||
println "delete"
|
||||
DbUtils.seaweed.remove(new BasicDBObject("_id",d._id))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def meituanSqrentRun(){
|
||||
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 = NameProcess.nameStandard(city, newRegion, d['H'])
|
||||
name = nameFileter(name)
|
||||
|
||||
if(name){
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}else{
|
||||
def type = d['I']
|
||||
if(type){
|
||||
if(type.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(type.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
}
|
||||
}
|
||||
def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1));
|
||||
CommonUtils.recalculationSqRent(city, region, name, estateType2, lastMonthDay,false,0)
|
||||
}
|
||||
}
|
||||
},0);
|
||||
}
|
||||
|
||||
def meituanRun(){
|
||||
def index = 0//美团需入库小区合并后.xlsx
|
||||
def keys = new CopyOnWriteArrayList()
|
||||
|
||||
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 = NameProcess.nameStandard(city, newRegion, d['H'])
|
||||
name = nameFileter(name)
|
||||
|
||||
if (name) {
|
||||
def formatAddress = null
|
||||
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)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
Long glat = null
|
||||
Long glng = null
|
||||
Long blat = null
|
||||
Long blng = null
|
||||
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("别墅")) {
|
||||
estateType2 = "别墅"
|
||||
} else if (name.contains("商住")) {
|
||||
estateType2 = "商住"
|
||||
} else {
|
||||
def type = d['J']
|
||||
if (type) {
|
||||
if (type.contains("别墅")) {
|
||||
estateType2 = "别墅"
|
||||
} else if (type.contains("商住")) {
|
||||
estateType2 = "商住"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def key = city + "##" + newRegion + "##" + name
|
||||
if (name && !keys.contains(key)) {
|
||||
def dist = CommonDatautils.findDistrict(city, newRegion, name, "district")
|
||||
if (!dist) {
|
||||
keys << key
|
||||
def data = new BasicDBObject();
|
||||
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("name", name)
|
||||
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)
|
||||
}
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map", markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
|
||||
|
||||
println index + " " + data
|
||||
|
||||
def stop = false
|
||||
while (!stop) {
|
||||
if (data._id.toString()) {
|
||||
addPrice(data)
|
||||
stop = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
println city +" "+region +" 区域无法标准化"
|
||||
}
|
||||
},0);
|
||||
}
|
||||
|
||||
|
||||
def addPrice(dist){
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2022-05-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-05-24")
|
||||
def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate)
|
||||
|
||||
for(def weekend : weekends){
|
||||
CommonUtils.recalculationAverage(dist.city, dist.region, dist.name, dist.estate_type2, weekend,false,0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def run1(){
|
||||
def index = 0
|
||||
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\新增小区数据_1236.xlsx", { d ->
|
||||
def city = d['A']
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def name = d['C']
|
||||
def alias = []
|
||||
if(d['F']){
|
||||
if(name != d['F']){
|
||||
alias << d['F']
|
||||
}
|
||||
}
|
||||
|
||||
def formatAddress = null
|
||||
if(d['G']){
|
||||
formatAddress = AddressUtil.formatAddress(d['A'], d['G'])
|
||||
}
|
||||
def address = null
|
||||
if(d['D']){
|
||||
address = d['D']
|
||||
}
|
||||
if(d['E']){
|
||||
address = address + d['E']
|
||||
}
|
||||
|
||||
if(!formatAddress && address){
|
||||
formatAddress = AddressUtil.formatAddress(d['A'], address)
|
||||
}
|
||||
|
||||
Long glat = null
|
||||
Long glng = null
|
||||
Long blat = null
|
||||
Long blng = null
|
||||
if(d['H']){
|
||||
glat = d['I'].toString().toDouble() * 10000000000L
|
||||
glng = d['H'].toString().toDouble() * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(d['H'].toString().toDouble(), d['I'].toString().toDouble(), 3)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
|
||||
if(name){
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, name, "district")
|
||||
if(!dist){
|
||||
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
data.put("status",0)
|
||||
data.put("cat","district")
|
||||
data.put("c_date", new Date())
|
||||
data.put("m_date", new Date())
|
||||
data.put("city", d['A'])
|
||||
data.put("region",newRegion)
|
||||
data.put("name", name)
|
||||
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(alias){
|
||||
data.put("alias",alias)
|
||||
}
|
||||
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
println index+" "+data
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
},0);
|
||||
}
|
||||
|
||||
def run(){
|
||||
def files = ["北京融合匹配_1215.xlsx","广州融合匹配_1215.xlsx","杭州融合匹配_1216.xlsx","合肥融合匹配_1216.xlsx","深圳融合匹配_1215.xlsx","石家庄融合匹配_1216.xlsx","苏州融合匹配_1216.xlsx","武汉融合匹配_1216.xlsx","西安融合匹配_1216.xlsx","重庆融合匹配_1215.xlsx"]
|
||||
def index = 0
|
||||
for(def f : files){
|
||||
ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\融合\\10个城市新增小区\\" + f, { d ->
|
||||
// if(d['I']=="棠德花苑新社区"){
|
||||
def city = d['A']
|
||||
def region = d['C']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
|
||||
def name = ""
|
||||
def alias = []
|
||||
if(d['I']){
|
||||
name = nameFileter(d['I'])
|
||||
if(name != d['I']){
|
||||
alias << d['I']
|
||||
}
|
||||
}
|
||||
if(name){
|
||||
if(d['D']!=name && !alias.contains(d['D'])){
|
||||
alias << d['D']
|
||||
}
|
||||
}else{
|
||||
name = d['D']
|
||||
}
|
||||
|
||||
def formatAddress = null
|
||||
if(d['J']){
|
||||
formatAddress = AddressUtil.formatAddress(d['A'], d['J'])
|
||||
}
|
||||
if(!formatAddress && d['E']){
|
||||
formatAddress = AddressUtil.formatAddress(d['A'], d['E'])
|
||||
}
|
||||
|
||||
Long glat = null
|
||||
Long glng = null
|
||||
Long blat = null
|
||||
Long blng = null
|
||||
if(d['K']){
|
||||
glat = d['K'].toString().toDouble() * 10000000000L
|
||||
glng = d['L'].toString().toDouble() * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(d['L'].toString().toDouble(), d['K'].toString().toDouble(), 3)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}else{
|
||||
if(d['F']){
|
||||
def loactionMap = GeoUtils.gps84ToGcj02(d['F'], d['G'])
|
||||
def lat = null
|
||||
def lng = null
|
||||
if(loactionMap){
|
||||
lng = com.fangjia.core.util.DataUtil.roundDouble(loactionMap.lng,6)
|
||||
lat = com.fangjia.core.util.DataUtil.roundDouble(loactionMap.lat, 6)
|
||||
}
|
||||
def LatLon = GeoHelper.GetLatLon(lat, lng, 0.01, 180);
|
||||
def distance = GeoHelper.GetDistance(lat, lng, LatLon.Lat, LatLon.Lon)
|
||||
|
||||
glat = com.fangjia.core.util.DataUtil.roundDouble(LatLon.Lat, 6) * 10000000000L
|
||||
glng = com.fangjia.core.util.DataUtil.roundDouble(LatLon.Lon, 6) * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(LatLon.Lon, LatLon.Lat, 3)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
}
|
||||
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
|
||||
if(name){
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, name, "district")
|
||||
if(!dist){
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
data.put("status",0)
|
||||
data.put("cat","district")
|
||||
data.put("c_date", new Date())
|
||||
data.put("m_date", new Date())
|
||||
data.put("city", d['A'])
|
||||
data.put("region",newRegion)
|
||||
data.put("name", name)
|
||||
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(alias){
|
||||
data.put("alias",alias)
|
||||
}
|
||||
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
println index+" "+data
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
},0);
|
||||
}
|
||||
}
|
||||
|
||||
def nameFileter(def name){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
def findStandardObject2(def city, def region, def name, def address, def rets) {
|
||||
if (rets) {
|
||||
def bestObj = [:]
|
||||
if (rets.size() >= 1) {
|
||||
for (def mapObj : rets) {
|
||||
def score = 0
|
||||
if((mapObj.adname && mapObj.adname.contains(region)) || (mapObj.region && mapObj.region.contains(region))){
|
||||
score = 0.2
|
||||
}
|
||||
if(mapObj.name && name){
|
||||
def newName = mapObj.name;
|
||||
def names = []
|
||||
if(mapObj.name && mapObj.name.indexOf("(")>-1){
|
||||
def name1 = mapObj.name.substring(0, mapObj.name.indexOf("("))
|
||||
names << name1
|
||||
def name2 = mapObj.name.substring(mapObj.name.indexOf("(")+1, mapObj.name.indexOf(")"))
|
||||
names << name2
|
||||
}else{
|
||||
names << newName
|
||||
}
|
||||
def maxNameScore = 0
|
||||
for(def n : names){
|
||||
double score1 = CosineSimilarAlgorithm.getSimilarity(n, name);
|
||||
if(score1 && score1>0){
|
||||
def nameScore = (score1 * 4)/10
|
||||
if(nameScore > maxNameScore){
|
||||
maxNameScore = nameScore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(maxNameScore){
|
||||
try{
|
||||
maxNameScore = DataHandleUtils.getDoubleRound(2, maxNameScore)
|
||||
}catch(Exception e){
|
||||
maxNameScore = 0
|
||||
}
|
||||
|
||||
}
|
||||
score = maxNameScore + score;
|
||||
}
|
||||
|
||||
if(mapObj.address && address){
|
||||
double addressScore = CosineSimilarAlgorithm.getSimilarity(mapObj.address, address);
|
||||
if(addressScore && addressScore>0){
|
||||
try{
|
||||
addressScore = DataHandleUtils.getDoubleRound(2, addressScore)
|
||||
}catch(Exception e){
|
||||
addressScore = 0
|
||||
}
|
||||
score = addressScore*4/10 + score
|
||||
}
|
||||
}
|
||||
|
||||
if(!bestObj){
|
||||
mapObj.score = score
|
||||
bestObj = mapObj
|
||||
}else{
|
||||
if(score > bestObj.score){
|
||||
mapObj.score = score
|
||||
bestObj = mapObj
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return bestObj
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
}
|
||||
+308
@@ -0,0 +1,308 @@
|
||||
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
|
||||
|
||||
class DistrictMarge {
|
||||
static main(args) {
|
||||
def task = new DistrictMarge()
|
||||
//task.run()
|
||||
// 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(){
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
for(def c : citys){
|
||||
def districts = CommonDatautils.findAllDistrictByCity(c, "district", ["city", "region", "name", "lng","address","name_cat"])
|
||||
findRepead(c, districts)
|
||||
}
|
||||
}
|
||||
def findRepead(city, districts){
|
||||
def map = [:]
|
||||
for(def d : districts){
|
||||
if(d.name_cat == 0 && d.lng){
|
||||
if(d.address && d.address.contains("号")){
|
||||
def list = map.get(d.address)
|
||||
if(!list){
|
||||
list = []
|
||||
map.put(d.address, list)
|
||||
}
|
||||
list << d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def newMap = [:]
|
||||
map.each {k,vals->
|
||||
if(vals.size()>=2){
|
||||
vals.sort{o1,o2->
|
||||
return o1.name.size() <=> o2.name.size()
|
||||
}
|
||||
newMap.put(k,vals)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newMap.each {k,vals->
|
||||
def names = []
|
||||
for(def d : vals){
|
||||
def newKey = d.name
|
||||
if(d.name.contains("小区")){
|
||||
newKey = d.name.toString().replace("小区", "")
|
||||
}
|
||||
if(!names.contains(newKey)){
|
||||
names << newKey
|
||||
}else{
|
||||
d.flag = "删除"
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("name_cat", 11)
|
||||
udata.put("m_date",new Date())
|
||||
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id", new ObjectId( d._id.toString()))
|
||||
DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def values = newMap.values()
|
||||
def allRets = []
|
||||
for(def list : values){
|
||||
allRets.addAll(list)
|
||||
}
|
||||
def results = []
|
||||
def delcount = 0
|
||||
for(def r : allRets){
|
||||
def rows = []
|
||||
rows << r._id.toString()
|
||||
rows << r.city
|
||||
rows << r.name
|
||||
rows << r.address
|
||||
rows << r.name_cat
|
||||
if(r.flag){
|
||||
rows << r.flag
|
||||
delcount++
|
||||
}
|
||||
results << rows
|
||||
}
|
||||
// ExcelUtils.write("d:\\数据\\小区\\删除重复地址(${city}).xlsx", results, "sheet")
|
||||
println "${city} 共:"+map.size()+" 2个以上:"+newMap.size()+" delcount:"+delcount
|
||||
}
|
||||
|
||||
|
||||
def run(){
|
||||
def rets = getDatas()
|
||||
def deleteIndex = 0
|
||||
def updateIndex = 0
|
||||
rets.each{amap_id, valus->
|
||||
def updateObj = null
|
||||
def addAlias = []
|
||||
String formatAddress = null
|
||||
Long lat2 = null
|
||||
Long lng2 = null
|
||||
Long lat = null
|
||||
Long lng = null
|
||||
def amapName = null
|
||||
for(def i=0;i<valus.size();i++){
|
||||
def obj = valus[i]
|
||||
if(obj['G'] && !formatAddress){
|
||||
formatAddress = AddressUtil.formatAddress(obj['B'], obj['G'])
|
||||
}
|
||||
|
||||
if(obj['H'] && !lat){
|
||||
lat = obj['H'].toString().toDouble() * 10000000000L;
|
||||
lng = obj['I'].toString().toDouble() * 10000000000L;
|
||||
def json = BaiDuApiUtils.geoconv(obj['I'].toString().toDouble() , obj['H'].toString().toDouble(), 3)
|
||||
if(json != null && json.containsKey("x")) {
|
||||
lat2 = json.get("y") * 10000000000L
|
||||
lng2 = json.get("x") * 10000000000L
|
||||
}
|
||||
}
|
||||
|
||||
if(obj['F'] && !amapName){
|
||||
amapName = obj['F']
|
||||
}
|
||||
if(i==0){
|
||||
updateObj = obj
|
||||
}else{
|
||||
if(obj['D']){
|
||||
addAlias << obj['D']
|
||||
}
|
||||
//0-正常 1-非小区,2-地块, 3-无效小区,7-自然村 8:建行整理删除(单一来源或其它) 9-高德比对王一期不存在删除 10:小区重复合并删除 11:人工整理删除
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("name_cat", 10)
|
||||
udata.put("m_date",new Date())
|
||||
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id", new ObjectId(obj['A']));
|
||||
DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
deleteIndex++
|
||||
println "删除:"+obj['A']
|
||||
}
|
||||
}
|
||||
|
||||
if(updateObj){
|
||||
def dist = CommonDatautils.findDistrictById(updateObj['A'])
|
||||
if(dist){
|
||||
def alias = dist.alias
|
||||
if(!alias){
|
||||
alias = []
|
||||
}
|
||||
for(def n : addAlias){
|
||||
if(!alias.contains(n) && dist.name!=n){
|
||||
alias << n
|
||||
}
|
||||
}
|
||||
if(amapName && !alias.contains(amapName) && amapName!=dist.name){
|
||||
alias << amapName
|
||||
}
|
||||
|
||||
def mudata = new BasicDBObject()
|
||||
if(lat){
|
||||
mudata.put("lat", lat)
|
||||
mudata.put("lng", lng)
|
||||
mudata.put("lat2", lat2)
|
||||
mudata.put("lng2", lng2)
|
||||
}
|
||||
if(formatAddress){
|
||||
mudata.put("address", formatAddress)
|
||||
}
|
||||
if(alias){
|
||||
mudata.put("alias", alias)
|
||||
}
|
||||
|
||||
if(mudata){
|
||||
mudata.put("m_date",new Date())
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id", new ObjectId(updateObj['A']));
|
||||
DbUtils.seaweed.update(q, new BasicDBObject('$set', mudata))
|
||||
updateIndex++
|
||||
|
||||
println "修改:"+updateObj['A'] + " "+ mudata
|
||||
}else{
|
||||
println amap_id+" 此组无更新"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println "组:"+rets.size()
|
||||
println "删:"+deleteIndex
|
||||
println "修:"+updateIndex
|
||||
}
|
||||
|
||||
def getDatas(){
|
||||
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\小区\\重庆反查数据_669(审核完毕)(1).xlsx",0,1)
|
||||
def map = [:]
|
||||
for(def d : datas){
|
||||
if(d['E']){
|
||||
def rets = map.get(d['E'])
|
||||
if(!rets){
|
||||
rets = []
|
||||
map.put(d['E'], rets)
|
||||
}
|
||||
rets << d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
map.each{k,v->
|
||||
Collections.sort(v,new Comparator<Object>(){
|
||||
public int compare(def o1, def o2) {
|
||||
|
||||
if(o1['D'].toString().length() > o2['D'].toString().length()){
|
||||
return 1;
|
||||
}
|
||||
if(o1['D'].toString().length() == o2['D'].toString().length()){
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
})
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
+598
@@ -0,0 +1,598 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
|
||||
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.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.QueryOperators
|
||||
import groovy.sql.Sql
|
||||
|
||||
|
||||
DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43")
|
||||
DBCollection CITY_STAT = MongoUtils.getCollectionByName("fangjia_stat", "city_stat", "192.168.0.43")
|
||||
DBCollection CITY_INFO = MongoUtils.getCollectionByName("fangjia_data_ana", "city_info", "192.168.0.43")
|
||||
DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43")
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
|
||||
def ZS_MONGODB_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
|
||||
DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", ZS_MONGODB_URL)
|
||||
|
||||
|
||||
|
||||
ExcelUtils.multiThreadingModify("C:\\Users\\gaojuan\\Desktop\\city.xlsx",{d->
|
||||
if(d['B']){
|
||||
//def avg_price =CommonDatautils.queryCityPrice(d['B'])
|
||||
//d['C'] = avg_price
|
||||
|
||||
// def q = new BasicDBObject()
|
||||
// q.put("area_name",new BasicDBObject( '$regex' , d['B'].replace("州","")+/.*$/))
|
||||
// def obj = COMMUNITY_CONN.findOne(q)
|
||||
// if(obj){
|
||||
// d['D'] = obj.area_code
|
||||
// println obj.area_name +" "+obj.area_code
|
||||
// }
|
||||
|
||||
//def obj = findDistrictPriceCount(d['B'], DateUtils.parseFromTightByPattern("2022-03-13","yyyy-MM-dd"), CITY_INFO)
|
||||
// d['D'] = CommonDatautils.findAllDistrictCount("district", d['B'])
|
||||
// d['E'] = findHouseCount(d['B'], 20210101, 20211231)
|
||||
//
|
||||
// def startDate = DateUtils.parseFromTightByPattern("2021-01-01", "yyyy-MM-dd")
|
||||
// def endDate = DateUtils.parseFromTightByPattern("2021-12-31", "yyyy-MM-dd")
|
||||
// def deals = findTradesDetailById(d['B'], startDate,endDate, DEAL_PRICE_COLL)
|
||||
// d['F'] = deals.size()
|
||||
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
d['G'] = findCcbDistCount(cityCodeDataMap.get(d['B']), sqlInstance)
|
||||
}
|
||||
},0)
|
||||
|
||||
def findCcbDistCount(cityid, sqlInstance){
|
||||
|
||||
def sql = "select count(*) as count from bigdata_community_gj where cityId='${cityid}' and status=0 ";
|
||||
def total = null
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
total = r.count
|
||||
})
|
||||
return total
|
||||
}
|
||||
|
||||
|
||||
public static def findTradesDetailById(city, startDate, endDate, DEAL_PRICE_COLL){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("area", new BasicDBObject('$gte', 20))
|
||||
q.put("avg_price", new BasicDBObject('$gt', 0))
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def total = dbcursor.count()
|
||||
def rets = new HashSet()
|
||||
def lists = []
|
||||
for(def d : dbcursor){
|
||||
def key=d.city+"##"+d.match_region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
|
||||
if(!rets.contains(key)){
|
||||
rets << key
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findHouseCount(def city, def startDate, def endDate){
|
||||
def aliasStr = null;
|
||||
def total = 0
|
||||
try{
|
||||
|
||||
String sql = "select count(*) as c from latest_seawater where cat='sell' and city='${city}' and p_date >= ${startDate} and p_date<${endDate} "
|
||||
ElasticUtils.executeSqlQuery(sql,{ data->
|
||||
total = data.c
|
||||
})
|
||||
}catch(Exception e){
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
def findDistrictPriceCount(def city, def weekend, def CITY_INFO){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("weekend", weekend)
|
||||
def obj = CITY_INFO.findOne(city)
|
||||
return obj
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\人工核实_8511.xlsx", { d ->
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion && !d['K']) {
|
||||
// def rMap = SeaweedDataMatchProcess.doMatch(d['A'], newRegion, d['C'], d['D']+d['E']);
|
||||
// if(!rMap && d['G']){
|
||||
// rMap = SeaweedDataMatchProcess.doMatch(d['A'], newRegion, d['G'], d['H']);
|
||||
// }
|
||||
// if(rMap){
|
||||
// d['O'] = rMap.city
|
||||
// d['P'] = rMap.region
|
||||
// d['Q'] = rMap.name
|
||||
// d['R'] = rMap.address
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\人工审核_3016结果.xlsx",{d->
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion && !d['K']){
|
||||
//
|
||||
// def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'],"district")
|
||||
// if(dist){
|
||||
// d['K']="完全一致"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }else{
|
||||
// dist = CommonDatautils.findSeaweedByMappingAlias(d['A'], newRegion, d['C'],"district")
|
||||
// if(dist){
|
||||
// d['K']="映射别名"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }else{
|
||||
// def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['C'],"district")
|
||||
// if(rets){
|
||||
// dist = rets[0]
|
||||
// }
|
||||
// if(rets){
|
||||
// d['K']="别名"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//},0)
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\人工审核_3016结果.xlsx",{d->
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion && !d['K'] && d['G']){
|
||||
//
|
||||
// def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['G'],"district")
|
||||
// if(dist){
|
||||
// d['K']="完全一致(高德)"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }else{
|
||||
// dist = CommonDatautils.findSeaweedByMappingAlias(d['A'], newRegion, d['G'],"district")
|
||||
// if(dist){
|
||||
// d['K']="映射别名(高德)"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }else{
|
||||
// def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['G'],"district")
|
||||
// if(rets){
|
||||
// dist = rets[0]
|
||||
// }
|
||||
// if(rets){
|
||||
// d['K']="别名(高德)"
|
||||
// d['L'] = dist.estate_type2
|
||||
// d['M'] = dist.name_cat
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//},0)
|
||||
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\价格过滤小区融合情况_1209.xlsx",{d->
|
||||
// def dist = CommonDatautils.findDistrictFieldById(d['F'], ["address","lat","lng"])
|
||||
// if(dist){
|
||||
// d['Z'] = dist.address
|
||||
// if(dist.lat){
|
||||
// d['AA'] = dist.lat/10000000000.0
|
||||
// d['AB'] = dist.lng/10000000000.0
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//def cityDatas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\小区\\重庆高德反查数据_1529.xlsx",0,1)
|
||||
//def cityDataMap = [:]
|
||||
//for(def row : cityDatas){
|
||||
// if(row['D']){
|
||||
// cityDataMap.put(row['A']+"##"+row['B']+"##"+row['C'], row)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\高德反查数据_1529.xlsx",{d->
|
||||
//
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// def key = d['A']+"##"+newRegion+"##"+d['C']
|
||||
// println key
|
||||
// def datas = cityDataMap.get(key)
|
||||
// if(datas){
|
||||
// d['F'] = datas['D']
|
||||
// d['G'] = datas['E']
|
||||
// d['H'] = datas['F']
|
||||
// d['I'] = datas['G']
|
||||
// d['J'] = datas['H']
|
||||
//
|
||||
// }
|
||||
//},0)
|
||||
|
||||
def city = "广州"
|
||||
//ExcelUtils.modify("D:\\数据\\广发\\楼盘评级测试案例.xlsx",{d->
|
||||
// def newRegion = RegionData.formatRegion(city, d['A'])
|
||||
// if(newRegion){
|
||||
// def rMap = SeaweedDataMatchProcess.doMatch(city, newRegion, d['B'], null);
|
||||
// if(rMap){
|
||||
// d['C'] = rMap.region
|
||||
// d['D'] = rMap.name
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//},0)
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合\\广州 - 副本.xlsx",{d->
|
||||
// def newRegion = RegionData.formatRegion(city, d['E'])
|
||||
// if(newRegion){
|
||||
// def rMap = SeaweedDataMatchProcess.doMatch(city, newRegion, d['F'], null);
|
||||
// if(rMap){
|
||||
// d['L'] = rMap.region
|
||||
// d['M'] = rMap.name
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\小区\\融合\\广州 - 副本.xlsx",0, 1)
|
||||
//def idMaps = [:]
|
||||
//for(def d : datas){
|
||||
// if(d['L']){
|
||||
// idMaps.put(d['L']+"##"+d['M'], d)
|
||||
// }
|
||||
//}
|
||||
//ExcelUtils.modify("D:\\数据\\广发\\楼盘评级测试案例.xlsx",{d->
|
||||
// if(d['C']){
|
||||
// def key = d['C']+"##"+d['D']
|
||||
// def rows = idMaps.get(key)
|
||||
// if(rows){
|
||||
// d['E'] = rows['D']
|
||||
// d['F'] = rows['E']
|
||||
// d['G'] = rows['F']
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\广发\\楼盘评级测试案例(合并).xlsx",{d->
|
||||
// def obj = CommonDatautils.findDistrict("广州", d['C'], d['D'], "district")
|
||||
// if(obj){
|
||||
//// def year = CommonUtils.getDistrictAge(obj)
|
||||
//// if(year){
|
||||
//// d['H'] = year
|
||||
//// }
|
||||
//// if(obj.alias){
|
||||
//// d['K'] = obj.alias.join(" ")
|
||||
//// }
|
||||
// if(obj.mapping_alias){
|
||||
// d['X'] = obj.mapping_alias.join(" ")
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//def data1s = ExcelUtils.read("D:\\数据\\广发\\图片转换汇总1.8.xlsx",0, 1)
|
||||
//def scoreMap = [:]
|
||||
//for(def d : data1s){
|
||||
// scoreMap.put(d['B'], d)
|
||||
//}
|
||||
//
|
||||
//def data2s = ExcelUtils.read("D:\\数据\\广发\\图片转换汇总1.8.xlsx",1, 1)
|
||||
//def levelMap = [:]
|
||||
//for(def d : data2s){
|
||||
// levelMap.put(d['E'], d)
|
||||
//}
|
||||
//
|
||||
//ExcelUtils.modify("D:\\数据\\广发\\楼盘评级测试案例.xlsx",{d->
|
||||
// if(d['E']){
|
||||
// def row = scoreMap.get(d['E'])
|
||||
// if(row){
|
||||
// d['I'] = row['G']
|
||||
// d['J'] = row['H']
|
||||
// d['K'] = row['I']
|
||||
// d['L'] = row['J']
|
||||
// d['M'] = row['K']
|
||||
// d['N'] = row['L']
|
||||
// d['O'] = row['M']
|
||||
// }
|
||||
//
|
||||
// def data = levelMap.get(d['E'])
|
||||
// if(data){
|
||||
// d['P'] = data['G']
|
||||
// d['Q'] = data['H']
|
||||
// d['R'] = data['I']
|
||||
// d['S'] = data['J']
|
||||
// d['T'] = data['K']
|
||||
// d['U'] = data['L']
|
||||
// d['V'] = data['M']
|
||||
// }
|
||||
// }
|
||||
//},0)
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\成交\\福州成交.xlsx",{d->
|
||||
// def o = new BasicDBObject()
|
||||
// o.area = d['D'].toDouble()
|
||||
// o.avg_price = d['F'].toInteger()
|
||||
// o.city = "福州"
|
||||
// o.district_name = d['C']
|
||||
// o.region = d['B']
|
||||
// o.source = "贝壳找房"
|
||||
// o.trade_date = DateUtils.parseFromTightYYYYMMDD(d['M'])
|
||||
// o.total_price = d['E'].toInteger()*10000
|
||||
// if(d['I']){
|
||||
// o.hall = d['I'].toInteger()
|
||||
// }
|
||||
//
|
||||
// o.m_date = new Date()
|
||||
// if(d['H']){
|
||||
// o.room = d['H'].toInteger()
|
||||
// }
|
||||
//
|
||||
// o.create_date = new Date()
|
||||
// o.status = 2
|
||||
// DEAL_PRICE.save(o)
|
||||
//
|
||||
//},0)
|
||||
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\新增数据_1269.xlsx", { d ->
|
||||
// if(d['K'] && d['K']=="别名"){
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion){
|
||||
// def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['C'],"district")
|
||||
// def dist = null
|
||||
// if(rets){
|
||||
// dist = rets[0]
|
||||
// }
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(!alias.contains(d['C'])){
|
||||
// alias << d['C']
|
||||
// }
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\新增数据_1269.xlsx", { d ->
|
||||
// if(d['K'] && d['K']=="映射别名(高德)" && d['G']){
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion){
|
||||
// dist = CommonDatautils.findSeaweedByMappingAlias(d['A'], newRegion, d['G'],"district")
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(!alias.contains(d['C'])){
|
||||
// alias << d['C']
|
||||
// }
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\新增数据_1269.xlsx", { d ->
|
||||
// if(d['K'] && d['K']=="别名(高德)" && d['G']){
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion){
|
||||
// def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['G'],"district")
|
||||
// def dist = null
|
||||
// if(rets){
|
||||
// dist = rets[0]
|
||||
// }
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(!alias.contains(d['C'])){
|
||||
// alias << d['C']
|
||||
// }
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
|
||||
//def rets = []
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\国信达名字加入映射别名.xlsx", { d ->
|
||||
// if(d['A'] && d['E'].toString().contains("鑫康花园北区")){
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion){
|
||||
// def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(!alias.contains(d['E'])){
|
||||
// alias << d['E']
|
||||
// }
|
||||
// if(alias && dist.mapping_alias!=alias){
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// rets << [dist._id.toString(), d['E']]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
//ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\新增映射别名.xlsx", rets,"数据")
|
||||
|
||||
|
||||
//def rets = []
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\查询别名表,将国信达数据增加到映射别名表里.xlsx", { d ->
|
||||
// if(d['A']){
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if(newRegion){
|
||||
// def dists = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['C'], "district")
|
||||
// def dist = null
|
||||
// if(dists && dists.size()==1){
|
||||
// dist = dists[0]
|
||||
// }
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(!alias.contains(d['D'])){
|
||||
// alias << d['D']
|
||||
// }
|
||||
// if(alias && dist.mapping_alias!=alias){
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// rets << [dist._id.toString(), d['D']]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
//ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\新增映射别名_2.xlsx", rets,"数据")
|
||||
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\修改状态的数据.xlsx", { d ->
|
||||
// if(d['A']) {
|
||||
// def newRegion = RegionData.formatRegion(d['A'], d['B'])
|
||||
// if (newRegion) {
|
||||
// def dist = CommonDatautils.findSeaweedByMappingAlias(d['A'], newRegion, d['C'], "district")
|
||||
// if (dist) {
|
||||
// rets << [dist._id.toString(), d['C']]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
//ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\映射别名存在——修改状态.xlsx", rets,"数据")
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\修改后结果数据.xlsx",{d->
|
||||
// if(d['A']){
|
||||
// def dist = CommonDatautils.findDistrictById(d['B'])
|
||||
// if(dist){
|
||||
// d['E'] = dist.city
|
||||
// d['F'] = dist.region
|
||||
// d['G'] = dist.name
|
||||
// d['H'] = dist.estate_type2
|
||||
// d['I'] = dist.name_cat
|
||||
// d['J'] = dist.status
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\修改后结果数据.xlsx",{d->
|
||||
// if(d['B']) {
|
||||
// def sql = "select count(*) as count from bigdata_community_gj where commid='${d['B']}'";
|
||||
// def count = 0;
|
||||
// sqlInstance.eachRow(sql, { r ->
|
||||
// count = r.count
|
||||
// })
|
||||
// if(count>=1){
|
||||
// d['J'] = "oracle存在"
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
|
||||
//def index = 0
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\漏映射别名.xlsx", { d ->
|
||||
// if (d['B']) {
|
||||
// def dist = CommonDatautils.findDistrictFieldById(d['B'],["city","region","name","mapping_alias"])
|
||||
// if(dist){
|
||||
// def alias = dist.mapping_alias
|
||||
// if(!alias){
|
||||
// alias = []
|
||||
// }
|
||||
// if(alias && !alias.contains(d['C'])){
|
||||
// index++
|
||||
// println index
|
||||
// alias << d['C']
|
||||
// def udata = new BasicDBObject()
|
||||
// udata.put("mapping_alias",alias)
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", dist._id), new BasicDBObject('$set', udata))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\小区\\评级小区.xls", { d ->
|
||||
// if(d['A']){
|
||||
// try{
|
||||
// def dist = CommonDatautils.findDistrictFieldById(d['A'],["city","region","name"])
|
||||
// if(dist){
|
||||
// d['B'] = dist.city
|
||||
// d['C'] = dist.region
|
||||
// d['D'] = dist.name
|
||||
//
|
||||
// def price = CommonDatautils.queryDistrictPrice(dist.city, dist.region, dist.name)
|
||||
// d['E'] = price
|
||||
// }
|
||||
// }catch(Exception e){
|
||||
// println d['A']
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//})
|
||||
|
||||
//ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\删除映射别名数据的副本.xlsx", { d ->
|
||||
// if(d['A']){
|
||||
// def dist = CommonDatautils.findDistrictById(d['A'])
|
||||
// if(dist){
|
||||
// def mappingAlias = dist.mapping_alias
|
||||
// if(mappingAlias){
|
||||
// if(mappingAlias.contains(d['B'])){
|
||||
// mappingAlias.remove(d['B'])
|
||||
// DBObject udata = new BasicDBObject();
|
||||
// udata.put("mapping_alias", mappingAlias);
|
||||
// udata.put("m_date", new Date());
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", d['A']), new BasicDBObject('$set', udata))
|
||||
// }else{
|
||||
// println d['A']+"无映射别名"
|
||||
// }
|
||||
// }else{
|
||||
// println d['A']+"映射别名为空"
|
||||
// }
|
||||
// }else{
|
||||
// println d['A']+"没找到"
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.gj.OpenApiUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.util.CosineSimilarAlgorithm
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
class MapAddressMatch {
|
||||
static main(args) {
|
||||
def task = new MapAddressMatch()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def city = "北京"
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\北京地址重复数据.xlsx", { d ->
|
||||
index++
|
||||
println index +" "+ d['D']+" "+d['E']
|
||||
if(!d['G']){
|
||||
// def gdData = FangjiaClientUtils.getMapData(city, d['D'],d['E'], d['K'],"", "高德")
|
||||
// if(gdData){
|
||||
// d['F'] = gdData.district
|
||||
// d['G'] = gdData.name
|
||||
// d['H'] = gdData.address
|
||||
// d['I'] = gdData.type
|
||||
// d['J'] = "高德"
|
||||
// }else{
|
||||
def rets = OpenApiUtils.getGaoDeSearchLocation(city,d['D'],d['E'])
|
||||
def map = findStandardObject(city,d['D'],d['E'], rets);
|
||||
if (!map || !map.lat) {
|
||||
rets = OpenApiUtils.getBiDuLocation(city,d['D'],d['E']);
|
||||
map = findStandardObject(city,d['D'],d['E'], rets);
|
||||
}
|
||||
if(map){
|
||||
if(map.adname){
|
||||
d['F'] = map.adname
|
||||
}else if(map.region){
|
||||
d['F'] = map.region
|
||||
}
|
||||
d['G'] = map.name
|
||||
d['H'] = map.address
|
||||
if(map.type){
|
||||
d['I'] = map.type
|
||||
}else if(map.estateType){
|
||||
d['I'] = map.estateType
|
||||
}
|
||||
|
||||
d['J'] = map.source
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
},0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findStandardObject(def city, def region, def name, def rets) {
|
||||
def map;
|
||||
if (rets) {
|
||||
if (rets.size() >= 1) {
|
||||
for (def mapObj : rets) {
|
||||
if(mapObj.name && (mapObj.name.contains("(公交站)")||mapObj.name.contains("门)")||mapObj.name.contains("停车场"))){
|
||||
continue;
|
||||
}
|
||||
// if((mapObj.adname && mapObj.adname.contains(region)) || (mapObj.region && mapObj.region.contains(region))){
|
||||
if(mapObj.name && (mapObj.name.contains(name) || name.contains(mapObj.name))){
|
||||
map = mapObj;
|
||||
break;
|
||||
}else if(mapObj.address && mapObj.address.contains(name)){
|
||||
map = mapObj;
|
||||
break;
|
||||
}else if(mapObj.name && name){
|
||||
double score1 = CosineSimilarAlgorithm.getSimilarity(mapObj.name,name);
|
||||
if(score1){
|
||||
map = mapObj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
class MatchDealPriceRegion {
|
||||
|
||||
static DBCollection collection = MongoUtils.getCollectionByName("fangjia_craw", "third_party_price", "192.168.0.235", 27018)
|
||||
|
||||
def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
|
||||
DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl)
|
||||
|
||||
static main(args) {
|
||||
def task = new MatchDealPriceRegion();
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\成交\\部分未匹配成交.xlsx",{d->
|
||||
|
||||
def newRegion = null
|
||||
if(d['C']){
|
||||
newRegion = RegionData.formatRegion(d['B'], d['C'])
|
||||
}
|
||||
if(!newRegion){
|
||||
index++
|
||||
newRegion = findRegionByThirdPrice(d['B'], d['D']);
|
||||
if(!newRegion){
|
||||
def rets = CommonDatautils.findDistrictsByName(d['B'], d['D'],"district")
|
||||
if(!rets){
|
||||
rets = CommonDatautils.findDistrictByAlias(d['B'], null,d['D'],"district")
|
||||
}
|
||||
if(rets && rets.size()==1){
|
||||
newRegion = rets[0].region
|
||||
}
|
||||
}
|
||||
if(newRegion){
|
||||
def query = new BasicDBObject()
|
||||
query.put("_id", new ObjectId(d['A']))
|
||||
|
||||
def data = new BasicDBObject()
|
||||
data.put("region", newRegion)
|
||||
data.put("m_date", new Date())
|
||||
println index+" "+d['A']+" "+d['C']+" "+newRegion
|
||||
DEAL_PRICE_COLL.update(query, new BasicDBObject('$set',data), false, true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def findRegionByThirdPrice(def city, def name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("name", name)
|
||||
def dbcursor = collection.find(q).sort(new BasicDBObject("s_date",-1)).limit(10)
|
||||
def map = [:]
|
||||
for(def d : dbcursor){
|
||||
def count = map.get(d.region)
|
||||
if(!count){
|
||||
count = 0
|
||||
}
|
||||
map.put(d.region, count+1)
|
||||
}
|
||||
if(map){
|
||||
if(map.size()>1){
|
||||
map = map.sort(){ a, b ->
|
||||
b.value.compareTo(a.value)
|
||||
}
|
||||
}
|
||||
def key = map.keySet().getAt(0)
|
||||
return key
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
+608
@@ -0,0 +1,608 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.GeoUtils
|
||||
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.GeoHelper
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.poi.ss.util.RegionUtil
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class MatchMapData {
|
||||
|
||||
def thirdPartyColl = com.fangjia.script.thirdPriceCrawl.CrawalDBUtil.getThirdPartyCol();
|
||||
|
||||
public static final def ZS_MONGODB_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
|
||||
public static final DBCollection ZS_LEVEL_CONN = MongoUtils.getCollectionByName2("fangjia", "district_analy", ZS_MONGODB_URL)
|
||||
|
||||
static main(args) {
|
||||
def task = new MatchMapData()
|
||||
// task.run()
|
||||
// task.run1()
|
||||
// task.run2()
|
||||
// task.run3()
|
||||
// task.exportHouse()
|
||||
// task.addDistrictLevel()
|
||||
// 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
|
||||
if (d['A']) {
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(d['A'], region)
|
||||
if (newRegion) {
|
||||
regionCode = getRegionCode(newRegion)
|
||||
def dist = CommonDatautils.findDistrict(d['A'], newRegion, d['C'], "district")
|
||||
if (dist) {
|
||||
d['F'] = "完全一致"
|
||||
d['E'] = dist.name
|
||||
d['D'] = dist.name_cat
|
||||
d['G'] = dist.estate_type2
|
||||
} else {
|
||||
dist = CommonDatautils.findSeaweedByMappingAlias(d['A'], newRegion, d['C'], "district")
|
||||
if (dist) {
|
||||
d['F'] = "映射别名"
|
||||
d['E'] = dist.name
|
||||
d['D'] = dist.name_cat
|
||||
d['G'] = dist.estate_type2
|
||||
} else {
|
||||
def rets = CommonDatautils.findDistrictByAlias(d['A'], newRegion, d['C'], "district")
|
||||
if (rets) {
|
||||
if(rets.size()>1){
|
||||
d['F'] = "别名-多个"
|
||||
}else{
|
||||
d['F'] = "别名"
|
||||
}
|
||||
}
|
||||
if (rets) {
|
||||
dist = rets[0]
|
||||
}
|
||||
if (dist) {
|
||||
d['F'] = "完全一致"
|
||||
d['E'] = dist.name
|
||||
d['D'] = dist.name_cat
|
||||
d['G'] = dist.estate_type2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 0)
|
||||
}
|
||||
|
||||
def run3(){
|
||||
|
||||
def files = ["合肥融合匹配_1215.xlsx"]
|
||||
|
||||
for(def fn : files){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合匹配房源\\"+fn,{d->
|
||||
def city = d['A']
|
||||
def region = d['D']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def count = findHouses2(city, newRegion, "sell", 20160101, d['E']);
|
||||
if(count){
|
||||
d['O'] = "有"
|
||||
}else{
|
||||
count = findThirdParty(city, newRegion, d['E']);
|
||||
if(count){
|
||||
d['O'] = "有"
|
||||
}else{
|
||||
count = findThirdParty(city, region, d['E']);
|
||||
if(count){
|
||||
d['O'] = "有"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
}
|
||||
|
||||
def run2(){
|
||||
ExcelUtils.modify("D:\\数据\\建行\\房产估值\\小区\\重庆反查数据_669(审核完毕).xlsx",{d->
|
||||
def dist = CommonDatautils.findDistrictById(d['A'])
|
||||
println dist.name
|
||||
},0)
|
||||
}
|
||||
|
||||
def run1(){
|
||||
//"合肥","北京","广州","杭州","上海","深圳","石家庄","天津","武汉",
|
||||
def files = ["苏州"]
|
||||
for(def f : files){
|
||||
def city = f
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合\\"+f+".xlsx",{d->
|
||||
if(d['E']){
|
||||
def region = d['E']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def rMap = match(city, newRegion, d)
|
||||
if(rMap){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(rMap.city, rMap.region, rMap.name)
|
||||
d['M'] = rMap.region
|
||||
d['N'] = rMap.name
|
||||
d['O'] = rMap.address
|
||||
if(priceObj){
|
||||
d['P'] = priceObj.avg_price
|
||||
}
|
||||
|
||||
def dist = CommonDatautils.findDistrictById(rMap.id)
|
||||
if(dist){
|
||||
d['Q'] = dist.lng/10000000000.0
|
||||
d['R'] = dist.lat/10000000000.0
|
||||
def count = findHouses(dist.city, dist.region, "rent", 20210801, 20210901, dist.name, dist.alias);
|
||||
if(count){
|
||||
d['V'] = "有"
|
||||
}
|
||||
}
|
||||
|
||||
if(d['I']){
|
||||
def loactionMap = GeoUtils.gps84ToGcj02(d['H'], d['I'])
|
||||
if(loactionMap){
|
||||
d['S'] = com.fangjia.core.util.DataUtil.roundDouble(loactionMap.lng,6)
|
||||
d['T'] = com.fangjia.core.util.DataUtil.roundDouble(loactionMap.lat, 6)
|
||||
}
|
||||
|
||||
def distance = GeoHelper.GetDistance(d['R'], d['Q'], d['T'], d['S'])
|
||||
d['U'] = distance
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},0)
|
||||
}
|
||||
}
|
||||
|
||||
def match(city, region, d){
|
||||
def rMap = SeaweedDataMatchProcess.doMatch(city, region, d['F'], null);
|
||||
if(!rMap && d['G']){
|
||||
def addrFlag = d['G'].toString().matches('^[\u4e00-\u9fa5]+?(路|大道|街).+[弄号]$')
|
||||
if(addrFlag){
|
||||
rMap = SeaweedDataMatchProcess.doMatch(city, region, d['G'], null);
|
||||
}
|
||||
}
|
||||
return rMap;
|
||||
}
|
||||
|
||||
def run(){
|
||||
//"广州",
|
||||
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
||||
def files = ["合肥","广州","上海","北京","杭州","深圳","石家庄","天津","武汉","西安","重庆","苏州"]
|
||||
for(def f : files){
|
||||
def city = f.replace("-2","")
|
||||
def lastYear = DateUtils.add(DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd"), -365)
|
||||
def lastWeekend = DateUtils.getFirstDayOfWeek(DateUtils.parseFromTightYYYYMMDD(lastYear))
|
||||
def districtPriceMap = CommonDatautils.queryAllDistrictPriceByWeekend(city, lastWeekend)
|
||||
|
||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city", "region","name"])
|
||||
def priceMap = CommonDatautils.queryDistrictPrice(city, weekend)
|
||||
def priceDatas = addPriceData(dists, priceMap);
|
||||
def levelMap = calcuteLevel(priceDatas);
|
||||
|
||||
def datas = new CopyOnWriteArrayList()
|
||||
datas << ["城市编码","区域编码","ID","小区名","Wgs85经度","Wgs84纬度","租售比","小区涨跌幅","物业类型","评级","均价"]
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合\\租售比\\"+f+".xlsx",{d->
|
||||
def regionCode = null
|
||||
if(d['E']){
|
||||
def region = d['E']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
regionCode = getRegionCode(newRegion)
|
||||
def dist = CommonDatautils.findDistrict(city, newRegion, d['F'],"district")
|
||||
if(dist){
|
||||
d['K']="完全一致"
|
||||
d['L'] = dist.name_cat
|
||||
}else{
|
||||
dist = CommonDatautils.findSeaweedByMappingAlias(city, newRegion, d['F'],"district")
|
||||
if(dist){
|
||||
d['K']="映射别名"
|
||||
d['L'] = dist.name_cat
|
||||
}else{
|
||||
def rets = CommonDatautils.findDistrictByAlias(city, newRegion, d['F'],"district")
|
||||
if(rets){
|
||||
d['K']="别名"
|
||||
}
|
||||
if(rets){
|
||||
dist = rets[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dist){
|
||||
def nearDbo = CommonDatautils.findDistrictPrice(dist.city, dist.region, dist.name)
|
||||
|
||||
def lastMonth = DateUtils.parseFromTightYYYYMMDD("2021-11-30")
|
||||
def sqmetre = CommonDatautils.findSqmetreRent(dist.city, dist.region, dist.name, lastMonth)
|
||||
if(nearDbo && districtPriceMap){
|
||||
def priceObj = districtPriceMap.get(dist.region+"#"+dist.name)
|
||||
if(priceObj){
|
||||
def markup = (nearDbo.avg_price - priceObj.avg_price)*100/priceObj.avg_price
|
||||
d['M'] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, markup)
|
||||
}else{
|
||||
// FangjiaClientUtils.sendDistrictPriceCalculate(dist.city, dist.region, dist.name, 60);
|
||||
// println dist.city+" "+ dist.region+ " "+ dist.name
|
||||
}
|
||||
}
|
||||
if(nearDbo && sqmetre){
|
||||
def prc = nearDbo.avg_price/sqmetre.avg_price
|
||||
d['N'] = prc.toInteger()
|
||||
}
|
||||
d['O'] = dist.estate_type2
|
||||
|
||||
|
||||
def dbo = levelMap.get(dist.city+"##"+dist.region+"##"+dist.name)
|
||||
if(dist.name == "绿苑公寓"){
|
||||
println dbo
|
||||
}
|
||||
if(dbo){
|
||||
d['P'] = dbo.level
|
||||
d['Q'] = dbo.avg_price
|
||||
}
|
||||
}
|
||||
}else{
|
||||
d['M'] = "区域无法标准化"
|
||||
}
|
||||
}
|
||||
|
||||
datas << [d['B'], regionCode, d['D'], d['F'], d['I'], d['H'], d['N'], d['M'], d['O'], d['P'], d['Q']]
|
||||
|
||||
},0)
|
||||
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\融合\\租售比\\详情2\\"+city+".xlsx", datas, "数据")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def getRegionCode(def region){
|
||||
def spell = com.fangjia.core.util.DataUtil.hanyuQuanpin(region, " ")
|
||||
def arrs = spell.split(" ")
|
||||
def s = new StringBuffer()
|
||||
for(def ar : arrs){
|
||||
s.append(ar.substring(0,1).toUpperCase())
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
|
||||
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias){
|
||||
|
||||
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false);
|
||||
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
|
||||
.must(date_range).must(area_range)
|
||||
|
||||
if(!alias){
|
||||
alias = []
|
||||
}
|
||||
if(!alias.contains(name)){
|
||||
alias.add(name)
|
||||
}
|
||||
|
||||
|
||||
if(name.contains("弄小区")){
|
||||
def newName = name.replace("弄小区","弄")
|
||||
if(!alias.contains(newName)){
|
||||
alias << newName
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(alias && alias.size()>0){
|
||||
BoolQueryBuilder inBuilder = QueryBuilders.boolQuery();
|
||||
for(def s : alias){
|
||||
inBuilder.should(QueryBuilders.matchQuery("district_name", s));
|
||||
}
|
||||
queryBuilder.must(inBuilder)
|
||||
}
|
||||
|
||||
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
|
||||
|
||||
return houses.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findHouses2(def city, def region, def cat, def startDate, def name){
|
||||
|
||||
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(true);
|
||||
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).includeLower(true).includeUpper(false);
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
|
||||
.must(date_range).must(area_range)
|
||||
|
||||
def alias = []
|
||||
if(!alias.contains(name)){
|
||||
alias.add(name)
|
||||
}
|
||||
|
||||
|
||||
if(name.contains("弄小区")){
|
||||
def newName = name.replace("弄小区","弄")
|
||||
if(!alias.contains(newName)){
|
||||
alias << newName
|
||||
}
|
||||
|
||||
}
|
||||
if(name.contains("号小区")){
|
||||
def newName = name.replace("号小区","号")
|
||||
if(!alias.contains(newName)){
|
||||
alias << newName
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(alias && alias.size()>0){
|
||||
BoolQueryBuilder inBuilder = QueryBuilders.boolQuery();
|
||||
for(def s : alias){
|
||||
inBuilder.should(QueryBuilders.matchQuery("district_name", s));
|
||||
}
|
||||
queryBuilder.must(inBuilder)
|
||||
}
|
||||
|
||||
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
|
||||
|
||||
println "[房源] "+city +" "+region+" "+ name +" "+houses.size()
|
||||
return houses.size();
|
||||
}
|
||||
|
||||
|
||||
def findThirdParty(def city, def region, def name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city",city)
|
||||
q.put("region",region)
|
||||
q.put("name",name)
|
||||
def count = thirdPartyColl.count(q)
|
||||
println "[第三方] "+city +" "+region+" "+ name +" "+count
|
||||
return count
|
||||
}
|
||||
|
||||
def exportHouse(){
|
||||
//"合肥","石家庄","北京","广州","杭州","上海","深圳","天津","武汉","西安","重庆",
|
||||
def files = ["苏州","合肥"]
|
||||
for(def f : files) {
|
||||
def city = f
|
||||
|
||||
def rets = []
|
||||
rets << ["建行小区id", "房价网小区id","城市","区域","楼盘名称","单价","月租金","面积","室","厅","卫","出租方式","朝向","楼屋","装修","发布时间"]
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合\\" + f + ".xlsx", { d ->
|
||||
def flag = d['K']
|
||||
if(flag && flag =="完全一致" && !d['J']){
|
||||
def obj = CommonDatautils.findDistrict(city, d['M'], d['N'], "district")
|
||||
if(obj){
|
||||
def houses = findHouses3(d['D'], obj._id.toString(), city, d['M'], "rent", 20210801, 20211101, d['N'], null);
|
||||
if(houses){
|
||||
rets.addAll(houses)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},0)
|
||||
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\小区\\融合\\租房3\\"+city+"_rent.xlsx", rets, "数据")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
def findHouses3(def commid, def fjwid, def city, def region, def cat, def startDate, def endDate, def name, def alias){
|
||||
|
||||
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false);
|
||||
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
|
||||
|
||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
|
||||
.must(date_range).must(area_range)
|
||||
//.must(QueryBuilders.termQuery("root", "lianjia.com"))
|
||||
|
||||
if(!alias){
|
||||
alias = []
|
||||
}
|
||||
if(!alias.contains(name)){
|
||||
alias.add(name)
|
||||
}
|
||||
|
||||
|
||||
if(name.contains("弄小区")){
|
||||
def newName = name.replace("弄小区","弄")
|
||||
if(!alias.contains(newName)){
|
||||
alias << newName
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(alias && alias.size()>0){
|
||||
BoolQueryBuilder inBuilder = QueryBuilders.boolQuery();
|
||||
for(def s : alias){
|
||||
inBuilder.should(QueryBuilders.matchQuery("district_name", s));
|
||||
}
|
||||
queryBuilder.must(inBuilder)
|
||||
}
|
||||
|
||||
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
|
||||
def rets = []
|
||||
for(def r : houses){
|
||||
rets << [commid, fjwid, r.city,r.region,r.district_name, r.avg_price, r.total_price, r.area,r.room, r.hall,r.toilet,r.rent_type, r.direction,r.floor_info,r.fitment, r.p_date ]
|
||||
}
|
||||
|
||||
if(rets){
|
||||
println city+" "+ name +" "+rets.size()
|
||||
}
|
||||
return rets;
|
||||
}
|
||||
|
||||
def addDistrictLevel(){
|
||||
//
|
||||
def files = ["合肥","苏州","上海","北京","广州","杭州","深圳","石家庄","天津","武汉","西安","重庆"]
|
||||
|
||||
def dataMap = null
|
||||
|
||||
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
||||
for(def fn : files){
|
||||
def dists = CommonDatautils.findAllDistrictByCity(fn, "district", ["city", "region","name"])
|
||||
def priceMap = CommonDatautils.queryDistrictPrice(fn, weekend)
|
||||
def datas = addPriceData(dists, priceMap);
|
||||
def levelMap = calcuteLevel(datas);
|
||||
|
||||
dataMap = getDataMap(fn);
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\小区\\融合\\租售比\\评级10级\\"+fn+".xlsx",{d->
|
||||
|
||||
def region = dataMap.get(d['C'])
|
||||
if(region){
|
||||
def newRegion = RegionData.formatRegion(fn, region)
|
||||
if(newRegion){
|
||||
def dist = CommonDatautils.findDistrict(fn, newRegion, d['D'],"district")
|
||||
if(!dist){
|
||||
dist = CommonDatautils.findSeaweedByMappingAlias(fn, newRegion, d['D'],"district")
|
||||
if(!dist){
|
||||
def rets = CommonDatautils.findDistrictByAlias(fn, newRegion, d['D'],"district")
|
||||
if(rets){
|
||||
dist = rets[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dist){
|
||||
def dbo = levelMap.get(dist.city+"##"+dist.region+"##"+dist.name)
|
||||
if(dbo){
|
||||
d['J'] = dbo.level
|
||||
d['K'] = dbo.avg_price
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},0)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
def dataMap = [:]
|
||||
for(def d : datas){
|
||||
if(d.name=="绿苑公寓"){
|
||||
println d
|
||||
}
|
||||
dataMap.put(d.city+"##"+d.region+"##"+d.name, d)
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
def getDataMap(city){
|
||||
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\小区\\融合\\租售比\\"+city+".xlsx",0,1)
|
||||
def map = [:]
|
||||
for(def d : datas){
|
||||
map.put(d['D'], d['E'])
|
||||
}
|
||||
return map
|
||||
|
||||
}
|
||||
def getDistrictLevel(city, region, name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("region", region)
|
||||
q.put("name", name)
|
||||
return ZS_LEVEL_CONN.findOne(q)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+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)
|
||||
}
|
||||
}
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
package com.fangjia.script.ccbevaluation.data
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
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.linxsh.util.AddressUtil
|
||||
import com.fangjia.script.util.CosineSimilarAlgorithm
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
class TradeDistrictToDB {
|
||||
static main(args) {
|
||||
def task = new TradeDistrictToDB();
|
||||
// task.run()
|
||||
task.run1()
|
||||
}
|
||||
|
||||
def run1(){
|
||||
def index = 0
|
||||
def keys = []
|
||||
ExcelUtils.modify("D:\\数据\\建行\\建行成交\\成交未入库记录(12月)-新增.xlsx", { d ->
|
||||
if(d['D']){
|
||||
def key = d['A']+"##"+d['D']+"##"+d['C']
|
||||
if(!keys.contains(key)){
|
||||
def formatAddress = null
|
||||
if(d['G']){
|
||||
formatAddress = AddressUtil.formatAddress(d['A'], d['F'])
|
||||
}
|
||||
|
||||
Long glat = null
|
||||
Long glng = null
|
||||
Long blat = null
|
||||
Long blng = null
|
||||
if(d['G']){
|
||||
glat = d['H'].toString().toDouble() * 10000000000L
|
||||
glng = d['G'].toString().toDouble() * 10000000000L
|
||||
def baidu = BaiDuApiUtils.geoconv(d['G'].toString().toDouble(), d['H'].toString().toDouble(), 3)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
|
||||
def name = d['C'].replace("·","").replace("II","二")
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
|
||||
keys << key
|
||||
if(name){
|
||||
def dist = CommonDatautils.findDistrict(d['A'], d['D'], name, "district")
|
||||
if(!dist){
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
data.put("status",0)
|
||||
data.put("cat","district")
|
||||
data.put("c_date", new Date())
|
||||
data.put("m_date", new Date())
|
||||
data.put("city", d['A'])
|
||||
data.put("region",d['D'])
|
||||
data.put("name", name)
|
||||
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)
|
||||
}
|
||||
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
FangjiaClientUtils.sendDistrictPriceCalculate(d['A'], d['D'], d['C'], 4);
|
||||
println index+" "+data
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
def run() {
|
||||
def index = 0
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\建行\\建行成交\\成交未入库记录(12月)-新增.xlsx", { d ->
|
||||
def city = d['A']
|
||||
def region = d['B']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if (newRegion) {
|
||||
def map = findMapData(city, newRegion, d['C'])
|
||||
if(map){
|
||||
d['D'] = newRegion
|
||||
d['E'] = map.name
|
||||
d['F'] = map.address
|
||||
d['G'] = map.lng
|
||||
d['H'] = map.lat
|
||||
d['I'] = map.lng2
|
||||
d['J'] = map.lag2
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
def findMapData(def city, def region, name){
|
||||
def rets = OpenApiUtils.getGaoDeSearchLocation(city, region, name)
|
||||
def map = findStandardObject2(city, region, name, null, rets);
|
||||
if (!map || !map.lat) {
|
||||
rets = OpenApiUtils.getBiDuLocation(city, region, name);
|
||||
map = findStandardObject2(city, region, name, null, rets);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
def findStandardObject2(def city, def region, def name, def address, def rets) {
|
||||
if (rets) {
|
||||
def bestObj = [:]
|
||||
if (rets.size() >= 1) {
|
||||
for (def mapObj : rets) {
|
||||
def score = 0
|
||||
if((mapObj.adname && mapObj.adname.contains(region)) || (mapObj.region && mapObj.region.contains(region))){
|
||||
score = 0.2
|
||||
}
|
||||
if(mapObj.name && name){
|
||||
def newName = mapObj.name;
|
||||
def names = []
|
||||
if(mapObj.name && mapObj.name.indexOf("(")>-1){
|
||||
def name1 = mapObj.name.substring(0, mapObj.name.indexOf("("))
|
||||
names << name1
|
||||
def name2 = mapObj.name.substring(mapObj.name.indexOf("(")+1, mapObj.name.indexOf(")"))
|
||||
names << name2
|
||||
}else{
|
||||
names << newName
|
||||
}
|
||||
def maxNameScore = 0
|
||||
for(def n : names){
|
||||
double score1 = CosineSimilarAlgorithm.getSimilarity(n, name);
|
||||
if(score1 && score1>0){
|
||||
def nameScore = (score1 * 4)/10
|
||||
if(nameScore > maxNameScore){
|
||||
maxNameScore = nameScore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(maxNameScore){
|
||||
try{
|
||||
maxNameScore = DataHandleUtils.getDoubleRound(2, maxNameScore)
|
||||
}catch(Exception e){
|
||||
maxNameScore = 0
|
||||
}
|
||||
|
||||
}
|
||||
score = maxNameScore + score;
|
||||
}
|
||||
|
||||
if(mapObj.address && address){
|
||||
double addressScore = CosineSimilarAlgorithm.getSimilarity(mapObj.address, address);
|
||||
if(addressScore && addressScore>0){
|
||||
try{
|
||||
addressScore = DataHandleUtils.getDoubleRound(2, addressScore)
|
||||
}catch(Exception e){
|
||||
addressScore = 0
|
||||
}
|
||||
score = addressScore*4/10 + score
|
||||
}
|
||||
}
|
||||
|
||||
if(!bestObj){
|
||||
mapObj.score = score
|
||||
bestObj = mapObj
|
||||
}else{
|
||||
if(score > bestObj.score){
|
||||
mapObj.score = score
|
||||
bestObj = mapObj
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return bestObj
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+52
-70
@@ -32,7 +32,7 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80)
|
||||
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
public static def batchsize = 1000
|
||||
@@ -42,22 +42,24 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
|
||||
def citys = ["大连","哈尔滨","呼和浩特","厦门"]//CcbCommonUtils.citys;
|
||||
def citys = CcbCommonUtils.citys;
|
||||
def rows = []
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
// for (def city : citys) {
|
||||
// def cityid = cityCodeDataMap.get(city)
|
||||
// def sql ="select count(*) as count from BIGDATA_COMMUNITY_FJW where CITYID='${cityid}'"
|
||||
// def sql ="select count(*) as count from BIGDATA_COMMUNITY_GJ where CITYID='${cityid}'"
|
||||
// sqlInstance.eachRow(sql, { r ->
|
||||
// println city +" "+r.count
|
||||
// })
|
||||
// }
|
||||
|
||||
//// addBigdataDistrictFJW()
|
||||
// addBigdataDistrictFJW()
|
||||
|
||||
def citySeqnoMap = CcbCommonUtils.findDistrictSeqno();
|
||||
|
||||
def index = 0
|
||||
for (def city : citys) {
|
||||
index++
|
||||
def districts = CcbCommonUtils.findAllDistrictsByOracle(cityCodeDataMap.get(city))
|
||||
//
|
||||
// for(int i=0;i<10;i++){
|
||||
@@ -88,23 +90,24 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
dist.estatecharge = CcbCodeUtils.processEstateCharge(dist.city, obj.estate_charge, obj.estate_type2)
|
||||
}
|
||||
}
|
||||
println city +" 小区加载完成 "+districts.size()
|
||||
println index +" "+city +" 小区加载完成 "+districts.size()
|
||||
addBigdataCommunityGJRH(districts, cityCodeDataMap.get(city))
|
||||
println city +" 1.小区表完成"
|
||||
println index +" "+city +" 1.小区表完成"
|
||||
addBigdataCommbuildstruGJ(districts, cityCodeDataMap.get(city))
|
||||
println city +" 2.小区建筑结构表"
|
||||
println index +" "+city +" 2.小区建筑结构表"
|
||||
addBigdataCommhousetypeGJ(districts, cityCodeDataMap.get(city))
|
||||
println city +" 3.小区房屋类型表"
|
||||
println index +" "+city +" 3.小区房屋类型表"
|
||||
addBigdataCommbuildyearGj(districts, cityCodeDataMap.get(city))
|
||||
println city +" 4.小区建筑年代表"
|
||||
println index +" "+city +" 4.小区建筑年代表"
|
||||
addBigdataCommfeeGj(districts, cityCodeDataMap.get(city))
|
||||
println city +" 5.小区费用表"
|
||||
println index +" "+city +" 5.小区费用表"
|
||||
addBigdataCommhouseuseGJ(districts, cityCodeDataMap.get(city))
|
||||
println city +" 6.小区房屋用途表"
|
||||
addBigdataPositionGJ(districts, cityCodeDataMap.get(city))
|
||||
println city + " 7.地理位置表"
|
||||
println index +" "+city +" 6.小区房屋用途表"
|
||||
addBigdataPositionGJ(districts, cityCodeDataMap.get(city), citySeqnoMap)
|
||||
println index +" "+ city + " 7.地理位置表"
|
||||
|
||||
// addDealFieldInfo(distMap, cityCodeDataMap.get(city));//修改成交记录housestyle 一定要运行
|
||||
|
||||
// addDealFieldInfo(distMap, cityCodeDataMap.get(city));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,18 +554,17 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
// }
|
||||
}
|
||||
|
||||
def addBigdataPositionGJ(districts, def cityid){
|
||||
def addBigdataPositionGJ(districts, def cityid, citySeqnoMap){
|
||||
|
||||
def rets = []
|
||||
def index = 0
|
||||
for(def d : districts) {
|
||||
index++
|
||||
def ret = []
|
||||
def seqno = findSeqno(d.cityid, d.commid, citySeqnoMap);
|
||||
ret << d.cityid
|
||||
ret << "5"
|
||||
ret << d.commid
|
||||
ret << "1"
|
||||
ret << index
|
||||
ret << seqno
|
||||
ret << d.lng
|
||||
ret << d.lat
|
||||
ret << ""
|
||||
@@ -588,49 +590,29 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
def headers = []
|
||||
FileUtils.batchCreateFile(rets, fileName, headers, "utf-8", true);
|
||||
println "BIGDATA_POSITION_FJW Êý¾ÝÎļþÊä³öÍê³É......"
|
||||
}
|
||||
|
||||
// sqlInstance.executeUpdate("delete from BIGDATA_POSITION_FJW where CITYID='${cityid}'")
|
||||
//
|
||||
// def sqls = []
|
||||
// def index = 1
|
||||
// for(def d : districts){
|
||||
// def sql = "INSERT INTO BIGDATA_POSITION_FJW (CITYID,OBJECTTYPE,OBJECTID,POSITIONTYPE,SEQNO,LONGITUDE,LATITUDE,ALTITUDE,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES ('${d.cityid}','5', '${d.commid}','1',${index},${d.lng},${d.lat},null,${d.remark},"
|
||||
// index++
|
||||
// if(d.createtime){
|
||||
// sql = sql + "to_date('${d.createtime}','yyyy-mm-dd hh24:mi:ss'),"
|
||||
// }else{
|
||||
// sql = sql + "null,"
|
||||
// }
|
||||
// if(d.updatetime){
|
||||
// sql = sql + "to_date('${d.updatetime}','yyyy-mm-dd hh24:mi:ss'),'${d.sourcecode}')"
|
||||
// }else{
|
||||
// sql = sql + "null,'${d.sourcecode}')"
|
||||
// }
|
||||
// sqls << sql
|
||||
//
|
||||
// if (sqls.size() >= batchsize) {
|
||||
// try {
|
||||
// sqlInstance.withBatch(batchsize, { stmt ->
|
||||
// sqls.each { def s ->
|
||||
// stmt.addBatch s
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// sqls.clear()
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (sqls.size() > 0) {
|
||||
// sqlInstance.withBatch(100, { stmt ->
|
||||
// sqls.each { def s ->
|
||||
// stmt.addBatch s
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
def findSeqno(cityid, commid, citySeqnoMap){
|
||||
def detailMap = citySeqnoMap.get(cityid)
|
||||
if(detailMap){
|
||||
def seqno = detailMap.get(commid)
|
||||
if(seqno){
|
||||
return seqno
|
||||
}else{
|
||||
seqno = CcbCommonUtils.findMaxSeqno(cityid)
|
||||
if(seqno){
|
||||
seqno = seqno + 1
|
||||
def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
def insertSql = "INSERT INTO bigdata_position_seqno(CITYID,COMMID,SEQNO,CREATETIME) VALUES ('${cityid}','${commid}',${seqno},to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'))"
|
||||
sqlInstance.withBatch(batchsize, { stmt ->
|
||||
stmt.addBatch insertSql
|
||||
})
|
||||
return seqno
|
||||
}
|
||||
}
|
||||
}else{
|
||||
println cityid+" 没有该城市的小区序号"
|
||||
}
|
||||
}
|
||||
|
||||
def addBigdataDistrictFJW(){
|
||||
@@ -653,7 +635,7 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
}
|
||||
|
||||
def updateDealHouseStyle(distMap, cityid){
|
||||
def sql = "select dealid,housestyle,buildtype,roomcnt,livingroomcnt,buildyear,address,street,streetno,commid from bigdata_deal_gj_fjw where cityid='${cityid}'";
|
||||
def sql = "select dealid,housestyle,buildtype,roomcnt,livingroomcnt,buildyear,address,street,streetno,commid from bigdata_deal_gj where cityid='${cityid}'";
|
||||
try{
|
||||
def index = 0
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
@@ -695,21 +677,21 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
||||
def buildyear = null
|
||||
if(dist){
|
||||
// if(!r.address){
|
||||
if(r.street || r.streetno){
|
||||
address = r.street
|
||||
if(r.streetno && r.streetno!="null"){
|
||||
address = address + r.streetno
|
||||
}
|
||||
}else if(r.street){
|
||||
address = dist.address
|
||||
if(r.street || r.streetno){
|
||||
address = r.street
|
||||
if(r.streetno && r.streetno!="null"){
|
||||
address = address + r.streetno
|
||||
}
|
||||
}else if(r.street){
|
||||
address = dist.address
|
||||
}
|
||||
// }
|
||||
if(!r.buildyear && dist.finish_building_date){
|
||||
buildyear = CcbCodeUtils.getBuildYear(dist.finish_building_date);
|
||||
}
|
||||
}
|
||||
if(housetype || buildyear || address){
|
||||
def updateSql = "update bigdata_deal_gj_fjw set housestyle='${housetype}'"
|
||||
def updateSql = "update bigdata_deal_gj set housestyle='${housetype}'"
|
||||
if(buildyear){
|
||||
updateSql = updateSql + ",buildyear=${buildyear}"
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.fangjia.script.ccbevaluation.ronghe
|
||||
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.ccbevaluation.CcbFtpUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class CcbRHDealFileCreateBatch extends BaseBatch{
|
||||
static main(args) {
|
||||
runBatch(new CcbRHDealFileCreateBatch(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile([], fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
println "BIGDATA_COMMFEE_FJW 上传Ftp完成......"
|
||||
}
|
||||
}
|
||||
+399
-75
@@ -16,7 +16,7 @@ import java.sql.ResultSetMetaData
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class ExportDistrictRongHe extends BaseBatch{
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
static main(args) {
|
||||
runBatch(new ExportDistrictRongHe(), args);
|
||||
@@ -24,29 +24,77 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
|
||||
@Override
|
||||
void process(Object args) {
|
||||
def citys = ["大连","哈尔滨","呼和浩特","厦门"]
|
||||
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
for(def city : citys) {
|
||||
def cityCode = cityCodeDataMap.get(city)
|
||||
exportBigdataCommbuildstruGJ(cityCode)
|
||||
exportBigdataCommunityGJRH(cityCode)
|
||||
exportBigdataCommhousetypeGJ(cityCode)
|
||||
exportBigdataCommbuildyearGj(cityCode)
|
||||
exportBigdataCommfeeGj(cityCode)
|
||||
exportBigdataCommhouseuseGJ(cityCode)
|
||||
exportBigdataPositionGJ(cityCode)
|
||||
exportBigdataDistrictFJW(cityCode)
|
||||
def curDate = DateUtils.formatDateByPattern(new Date()+1, "yyyyMMdd")
|
||||
//按天导(每天一个文件夹)
|
||||
exportBigdataDealFJW2(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-1), "yyyy-MM-dd"))
|
||||
|
||||
exportBigdataDealFJW(cityCode)
|
||||
exportBigdataBuildingFJW(cityCode)
|
||||
if(curDate.toString().endsWith("10")){
|
||||
exportBigdataCommunityGJRH()
|
||||
exportBigdataBuildingFJW()
|
||||
exportBigdataCommfeeGj()
|
||||
|
||||
exportBigdataCommbuildstruGJ()
|
||||
exportBigdataCommhousetypeGJ()
|
||||
exportBigdataCommbuildyearGj()
|
||||
exportBigdataCommhouseuseGJ()
|
||||
exportBigdataPositionGJ()
|
||||
exportBigdataDistrictFJW()
|
||||
exportBigdataAliasFJW()
|
||||
|
||||
exportBigdataBuildprojFjw()
|
||||
exportBigdataCommlayoutpicFjw()
|
||||
exportEvaluateRate()
|
||||
}
|
||||
SSHHelper jschCommand = new SSHHelper();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
|
||||
|
||||
exportEvaluateRate()
|
||||
exportOk(curDate)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// def runByCity(){
|
||||
// def citys = CcbCommonUtils.citys;
|
||||
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
//
|
||||
//
|
||||
//// //检查ok文件是否上传
|
||||
//// exportAllBigdataDealFJW()
|
||||
//// for(def city : citys) {
|
||||
//// def cityCode = cityCodeDataMap.get(city)
|
||||
////
|
||||
// //按天导(一个文件夹下)
|
||||
// //exportBigdataDealFJW(DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-2), "yyyy-MM-dd"))
|
||||
// //按天导(每天一个文件夹)
|
||||
// exportBigdataDealFJW2(DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-2), "yyyy-MM-dd"))
|
||||
//
|
||||
//// exportBigdataCommunityGJRH(cityCode)
|
||||
//// exportBigdataBuildingFJW(cityCode)
|
||||
//// exportBigdataCommfeeGj(cityCode)
|
||||
////
|
||||
//// exportBigdataCommbuildstruGJ(cityCode)
|
||||
//// exportBigdataCommhousetypeGJ(cityCode)
|
||||
//// exportBigdataCommbuildyearGj(cityCode)
|
||||
//// exportBigdataCommhouseuseGJ(cityCode)
|
||||
//// exportBigdataPositionGJ(cityCode)
|
||||
//// exportBigdataDistrictFJW(cityCode)
|
||||
//// exportBigdataAliasFJW(cityCode)
|
||||
////
|
||||
//// exportBigdataBuildprojFjw(cityCode)
|
||||
//// exportBigdataCommlayoutpicFjw(cityCode)
|
||||
//// }
|
||||
//// exportEvaluateRate()
|
||||
//
|
||||
////
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
// SSHHelper jschCommand = new SSHHelper();
|
||||
// System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
|
||||
//
|
||||
// exportOk()
|
||||
// }
|
||||
|
||||
def exportBigdataCommunityGJRH(cityCode){
|
||||
def sql = "select CITYID,DISTID,COMMID,COMMNAME,ADDRESS,LANDAREA,BUILDAREA,GREENINGRATE,PLOTRATIO,PARKINGCNT,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,COMMTYPE,COMMALIAS,STREET,STREETNO,IFNEW,INTRODUCTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,SOURCECODE from BIGDATA_COMMUNITY_FJW where CITYID='${cityCode}'";
|
||||
def sql = "select CITYID,DISTID,COMMID,COMMNAME,ADDRESS,LANDAREA,BUILDAREA,GREENINGRATE,PLOTRATIO,PARKINGCNT,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,COMMTYPE,COMMALIAS,STREET,STREETNO,IFNEW,INTRODUCTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,SOURCECODE from BIGDATA_COMMUNITY_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -65,28 +113,25 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
data << r.GREENINGRATE
|
||||
data << r.PLOTRATIO
|
||||
data << r.PARKINGCNT
|
||||
data << r.INTRODUCTION
|
||||
data << ''
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
|
||||
|
||||
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
println "BIGDATA_COMMUNITY_FJW 数据文件输出完成......"
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMUNITY_FJW 上传Ftp完成......"
|
||||
}
|
||||
def exportBigdataCommbuildstruGJ(cityCode){
|
||||
def sql = "select CITYID,COMMID,BUILDSTRU,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDSTRU_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataCommbuildstruGJ(){
|
||||
def sql = "select CITYID,COMMID,BUILDSTRU,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDSTRU_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -100,17 +145,17 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMBUILDSTRU_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommhousetypeGJ(cityCode){
|
||||
def sql = "select CITYID,COMMID,HOUSETYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSETYPE_FJW where CITYID='${cityCode}'";
|
||||
def sql = "select CITYID,COMMID,HOUSETYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSETYPE_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -124,17 +169,17 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMHOUSETYPE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommbuildyearGj(cityCode){
|
||||
def sql = "select CITYID,COMMID,BUILDYEAR,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDYEAR_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataCommbuildyearGj(){
|
||||
def sql = "select CITYID,COMMID,BUILDYEAR,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDYEAR_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -148,17 +193,17 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_COMMBUILDYEAR_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommfeeGj(cityCode){
|
||||
def sql = "select CITYID,COMMID,COMPID,FEE,HOUSEUSE,BUILDTYPE,FEETYPE,NOTE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMFEE_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataCommfeeGj(){
|
||||
def sql = "select CITYID,COMMID,COMPID,FEE,HOUSEUSE,BUILDTYPE,FEETYPE,NOTE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMFEE_FJW";//where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -167,7 +212,12 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
data << r.COMPID
|
||||
data << r.FEE
|
||||
data << r.HOUSEUSE
|
||||
data << r.BUILDTYPE
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.FEETYPE
|
||||
data << r.NOTE
|
||||
data << r.REMARK
|
||||
@@ -177,18 +227,18 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMFEE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataCommhouseuseGJ(cityCode){
|
||||
def sql = "select CITYID,COMMID,HOUSEUSE,HOUSECNT,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSEUSE_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataCommhouseuseGJ(){
|
||||
def sql = "select CITYID,COMMID,HOUSEUSE,HOUSECNT,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSEUSE_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -203,17 +253,17 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMHOUSEUSE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataPositionGJ(cityCode){
|
||||
def sql = "select CITYID,OBJECTTYPE,OBJECTID,POSITIONTYPE,SEQNO,LONGITUDE,LATITUDE,ALTITUDE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_POSITION_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataPositionGJ(){
|
||||
def sql = "select CITYID,OBJECTTYPE,OBJECTID,POSITIONTYPE,SEQNO,LONGITUDE,LATITUDE,ALTITUDE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_POSITION_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -232,17 +282,17 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_POSITION_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDistrictFJW(cityCode){
|
||||
def sql = "select DISTID,DISTNAME,DISTSPELL,CITYID,DISTCODE,SEQ,DISTTYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_DISTRICT_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataDistrictFJW(){
|
||||
def sql = "select DISTID,DISTNAME,DISTSPELL,CITYID,DISTCODE,SEQ,DISTTYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_DISTRICT_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -260,17 +310,250 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_DISTRICT_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDealFJW(cityCode){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE,WORKDATE from BIGDATA_DEAL_FJW where CITYID='${cityCode}'";
|
||||
def exportBigdataAliasFJW(){
|
||||
def sql = "select city_id, ca_id,address_id,address_name, status, exp_dt, version, is_key_name, data_source, description,alias_grade,addr_type_cd,ifexamine,ifdisplay from ADDRESS_ALIAS_FJW";// where city_id='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.city_id
|
||||
data << r.ca_id
|
||||
data << r.address_id
|
||||
data << r.address_name
|
||||
data << r.status
|
||||
data << r.exp_dt
|
||||
data << r.version
|
||||
data << r.is_key_name
|
||||
data << r.data_source
|
||||
data << r.description
|
||||
data << r.alias_grade
|
||||
data << r.addr_type_cd
|
||||
data << r.ifexamine
|
||||
data << r.ifdisplay
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_ADDRESS_ALIAS_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_ADDRESS_ALIAS_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "ADDRESS_ALIAS_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDealFJW(dealdate){
|
||||
|
||||
def startDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def endDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def stop = false
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def index = 0
|
||||
|
||||
def curStartDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()),"yyyy-MM-dd")
|
||||
def curSndDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(new Date()),"yyyy-MM-dd")
|
||||
|
||||
while(!stop){
|
||||
index++
|
||||
def curStartStr = curStartDateStr
|
||||
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curStartStr.replace("-","")}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curStartStr.replace("-","")}_0001.dat"
|
||||
}
|
||||
|
||||
def allRows = []
|
||||
if(index==1){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where dealdate>=to_date('${startDateStr}','yyyy-MM-dd') and dealdate<=to_date('${endDateStr}','yyyy-MM-dd')";//CITYID='${cityCode}' and
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.DEALID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.UNITID
|
||||
data << r.UNITNO
|
||||
data << r.UNITNAME
|
||||
data << r.HOUSEID
|
||||
data << r.ADDRESS
|
||||
data << r.BUILDYEAR
|
||||
data << r.PROPTYPE
|
||||
data << r.PROPYEARS
|
||||
data << r.PERIODNUM
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
data << r.HOUSESTYLE
|
||||
data << r.ROOMCNT
|
||||
data << r.LIVINGROOMCNT
|
||||
data << r.KITCHENCNT
|
||||
data << r.BATHROOMCNT
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSESTRU
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FITMENT
|
||||
data << r.EVALUATENO
|
||||
data << r.DEALUNITPRICE
|
||||
data << r.DEALTOTALPRICE
|
||||
data << r.DECLAREPRICE
|
||||
data << r.EVALUATEPRICE
|
||||
data << r.CONTRACTNO
|
||||
data << r.DEALDATE
|
||||
data << r.DEALTYPE
|
||||
data << r.PAYTYPE
|
||||
data << r.DEALPERIOD
|
||||
data << r.IFELEVATOR
|
||||
data << r.COMPAREAGARDEN
|
||||
data << r.COMPAREATERRACE
|
||||
data << r.COMPAREABALCONY
|
||||
data << r.COMPAREABAYWINDOW
|
||||
data << r.COMPAREAATTIC
|
||||
data << r.COMPAREAGARAGE
|
||||
data << r.COMPAREABASEMENT
|
||||
data << r.COMPAREAOTHER
|
||||
data << r.DATASOURCE
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
}
|
||||
if(curStartDateStr == curSndDateStr){
|
||||
stop = true
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_DEAL_FJW 上传Ftp完成......${curStartStr}"
|
||||
def curEndStr = DateUtils.add(curStartStr, 1)
|
||||
curStartDateStr = curEndStr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataDealFJW2(curDate, dealdate){
|
||||
|
||||
def startDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def endDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
|
||||
def allRows = []
|
||||
if(curDate.toString().endsWith("28")){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where dealdate>=to_date('${startDateStr}','yyyy-MM-dd') and dealdate<=to_date('${endDateStr}','yyyy-MM-dd')";//CITYID='${cityCode}' and
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.DEALID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.UNITID
|
||||
data << r.UNITNO
|
||||
data << r.UNITNAME
|
||||
data << r.HOUSEID
|
||||
data << r.ADDRESS
|
||||
data << r.BUILDYEAR
|
||||
data << r.PROPTYPE
|
||||
data << r.PROPYEARS
|
||||
data << r.PERIODNUM
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
data << r.HOUSESTYLE
|
||||
data << r.ROOMCNT
|
||||
data << r.LIVINGROOMCNT
|
||||
data << r.KITCHENCNT
|
||||
data << r.BATHROOMCNT
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSESTRU
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FITMENT
|
||||
data << r.EVALUATENO
|
||||
data << r.DEALUNITPRICE
|
||||
data << r.DEALTOTALPRICE
|
||||
data << r.DECLAREPRICE
|
||||
data << r.EVALUATEPRICE
|
||||
data << r.CONTRACTNO
|
||||
data << r.DEALDATE
|
||||
data << r.DEALTYPE
|
||||
data << r.PAYTYPE
|
||||
data << r.DEALPERIOD
|
||||
data << r.IFELEVATOR
|
||||
data << r.COMPAREAGARDEN
|
||||
data << r.COMPAREATERRACE
|
||||
data << r.COMPAREABALCONY
|
||||
data << r.COMPAREABAYWINDOW
|
||||
data << r.COMPAREAATTIC
|
||||
data << r.COMPAREAGARAGE
|
||||
data << r.COMPAREABASEMENT
|
||||
data << r.COMPAREAOTHER
|
||||
data << r.DATASOURCE
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_DEAL_FJW 上传Ftp完成......${endDateStr}"
|
||||
}
|
||||
|
||||
def exportAllBigdataDealFJW(){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where DEALDATE<to_date('2021-12-01','yyyy-MM-dd')";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -298,7 +581,12 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
data << r.BUILDTYPE
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
@@ -334,25 +622,24 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
println "BIGDATA_DEAL_FJW 上传Ftp完成......"
|
||||
println "BIGDATA_DEAL_FJW 导出完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataBuildingFJW(cityCode){
|
||||
def sql = "select CITYID, BUILDID, BUILDNO, BUILDNAME, BUILDALIAS, DISTID, COMMID, BUILDYEAR, BUILDTYPE, BUILDSTRU, FLOORCNT, UNITCNT, HOUSECNT, IFELEVATOR, ELEVATORCNT, ELEVATORHOUSE, REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, VALID_FLAG from BIGDATA_BUILDING_FJW where CITYID='${cityCode}'";
|
||||
def sql = "select CITYID, BUILDID, BUILDNO, BUILDNAME, BUILDALIAS, DISTID, COMMID, BUILDYEAR, BUILDTYPE, BUILDSTRU, FLOORCNT, UNITCNT, HOUSECNT, IFELEVATOR, ELEVATORCNT, ELEVATORHOUSE, REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, VALID_FLAG from BIGDATA_BUILDING_FJW";//where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
@@ -364,7 +651,12 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
data << r.DISTID
|
||||
data << r.COMMID
|
||||
data << r.BUILDYEAR
|
||||
data << r.BUILDTYPE
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.FLOORCNT
|
||||
data << r.UNITCNT
|
||||
@@ -380,12 +672,12 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}")
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_BUILDING_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
@@ -413,8 +705,40 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_EVALUATE_RATE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload(fileName, curDate)
|
||||
println "BIGDATA_DISTRICT_FJW 上传Ftp完成......"
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "EVALUATE_RATE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataBuildprojFjw(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_BUILDPROJ_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_BUILDPROJ_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile([], fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_BUILDPROJ_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommlayoutpicFjw(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMLAYOUTPIC_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMLAYOUTPIC_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile([], fileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMLAYOUTPIC_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportOk(curDate){
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
def dataCodeFileName = "/ccb_rh/${curDate}/${curDate}.ok"
|
||||
if(CommonDatautils.isWindow()){
|
||||
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${curDate}.ok"
|
||||
}
|
||||
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
|
||||
CcbFtpUtils.ftpUpload("rh",dataCodeFileName, curDate)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+747
@@ -0,0 +1,747 @@
|
||||
package com.fangjia.script.ccbevaluation.ronghe
|
||||
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||
import com.fangjia.script.ccbevaluation.CcbFtpTestUtils
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.ccb.FileUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import groovy.sql.Sql
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.sql.ResultSetMetaData
|
||||
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class ExportDistrictRongHeTest extends BaseBatch{
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
static main(args) {
|
||||
runBatch(new ExportDistrictRongHeTest(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
void process(Object args) {
|
||||
def curDate = 20220310//DateUtils.formatDateByPattern(new Date()+1, "yyyyMMdd")
|
||||
def fileName = "/ccb_rh/${curDate}"
|
||||
// if(CommonDatautils.isWindow()){
|
||||
// fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}"
|
||||
// }
|
||||
CcbFtpTestUtils.delete(fileName)
|
||||
|
||||
exportBigdataDealFJW2(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-2), "yyyy-MM-dd"))
|
||||
|
||||
exportBigdataCommunityGJRH()
|
||||
exportBigdataBuildingFJW()
|
||||
exportBigdataCommfeeGj()
|
||||
|
||||
exportBigdataCommbuildstruGJ()
|
||||
exportBigdataCommhousetypeGJ()
|
||||
exportBigdataCommbuildyearGj()
|
||||
exportBigdataCommhouseuseGJ()
|
||||
exportBigdataPositionGJ()
|
||||
exportBigdataDistrictFJW()
|
||||
exportBigdataAliasFJW()
|
||||
|
||||
exportBigdataBuildprojFjw()
|
||||
exportBigdataCommlayoutpicFjw()
|
||||
exportEvaluateRate()
|
||||
|
||||
SSHHelper jschCommand = new SSHHelper();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
|
||||
|
||||
exportOk(curDate)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// def runByCity(){
|
||||
// def citys = CcbCommonUtils.citys;
|
||||
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
|
||||
//
|
||||
//
|
||||
//// //检查ok文件是否上传
|
||||
//// exportAllBigdataDealFJW()
|
||||
//// for(def city : citys) {
|
||||
//// def cityCode = cityCodeDataMap.get(city)
|
||||
////
|
||||
// //按天导(一个文件夹下)
|
||||
// //exportBigdataDealFJW(DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-2), "yyyy-MM-dd"))
|
||||
// //按天导(每天一个文件夹)
|
||||
// exportBigdataDealFJW2(DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-2), "yyyy-MM-dd"))
|
||||
//
|
||||
//// exportBigdataCommunityGJRH(cityCode)
|
||||
//// exportBigdataBuildingFJW(cityCode)
|
||||
//// exportBigdataCommfeeGj(cityCode)
|
||||
////
|
||||
//// exportBigdataCommbuildstruGJ(cityCode)
|
||||
//// exportBigdataCommhousetypeGJ(cityCode)
|
||||
//// exportBigdataCommbuildyearGj(cityCode)
|
||||
//// exportBigdataCommhouseuseGJ(cityCode)
|
||||
//// exportBigdataPositionGJ(cityCode)
|
||||
//// exportBigdataDistrictFJW(cityCode)
|
||||
//// exportBigdataAliasFJW(cityCode)
|
||||
////
|
||||
//// exportBigdataBuildprojFjw(cityCode)
|
||||
//// exportBigdataCommlayoutpicFjw(cityCode)
|
||||
//// }
|
||||
//// exportEvaluateRate()
|
||||
//
|
||||
////
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
// SSHHelper jschCommand = new SSHHelper();
|
||||
// System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
|
||||
//
|
||||
// exportOk()
|
||||
// }
|
||||
|
||||
def exportBigdataCommunityGJRH(cityCode){
|
||||
def sql = "select CITYID,DISTID,COMMID,COMMNAME,ADDRESS,LANDAREA,BUILDAREA,GREENINGRATE,PLOTRATIO,PARKINGCNT,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,COMMTYPE,COMMALIAS,STREET,STREETNO,IFNEW,INTRODUCTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,SOURCECODE from BIGDATA_COMMUNITY_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.COMMALIAS
|
||||
data << r.DISTID
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.ADDRESS
|
||||
data << r.LANDAREA
|
||||
data << r.BUILDAREA
|
||||
data << r.COMMTYPE
|
||||
data << r.IFNEW
|
||||
data << r.GREENINGRATE
|
||||
data << r.PLOTRATIO
|
||||
data << r.PARKINGCNT
|
||||
data << ''
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMUNITY_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
println "BIGDATA_COMMUNITY_FJW 数据文件输出完成......"
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMUNITY_FJW 上传Ftp完成......"
|
||||
}
|
||||
def exportBigdataCommbuildstruGJ(){
|
||||
def sql = "select CITYID,COMMID,BUILDSTRU,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDSTRU_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.BUILDSTRU
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMBUILDSTRU_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMBUILDSTRU_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommhousetypeGJ(cityCode){
|
||||
def sql = "select CITYID,COMMID,HOUSETYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSETYPE_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.HOUSETYPE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMHOUSETYPE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMHOUSETYPE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommbuildyearGj(){
|
||||
def sql = "select CITYID,COMMID,BUILDYEAR,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMBUILDYEAR_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.BUILDYEAR
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMBUILDYEAR_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_COMMBUILDYEAR_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommfeeGj(){
|
||||
def sql = "select CITYID,COMMID,COMPID,FEE,HOUSEUSE,BUILDTYPE,FEETYPE,NOTE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMFEE_FJW";//where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.COMPID
|
||||
data << r.FEE
|
||||
data << r.HOUSEUSE
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.FEETYPE
|
||||
data << r.NOTE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMFEE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMFEE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataCommhouseuseGJ(){
|
||||
def sql = "select CITYID,COMMID,HOUSEUSE,HOUSECNT,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_COMMHOUSEUSE_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.COMMID
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSECNT
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMHOUSEUSE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMHOUSEUSE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataPositionGJ(){
|
||||
def sql = "select CITYID,OBJECTTYPE,OBJECTID,POSITIONTYPE,SEQNO,LONGITUDE,LATITUDE,ALTITUDE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_POSITION_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.OBJECTTYPE
|
||||
data << r.OBJECTID
|
||||
data << r.POSITIONTYPE
|
||||
data << r.SEQNO
|
||||
data << r.LONGITUDE
|
||||
data << r.LATITUDE
|
||||
data << r.ALTITUDE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_POSITION_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_POSITION_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDistrictFJW(){
|
||||
def sql = "select DISTID,DISTNAME,DISTSPELL,CITYID,DISTCODE,SEQ,DISTTYPE,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from BIGDATA_DISTRICT_FJW";// where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.DISTSPELL
|
||||
data << r.CITYID
|
||||
data << r.DISTCODE
|
||||
data << r.SEQ
|
||||
data << r.DISTTYPE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DISTRICT_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_DISTRICT_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataAliasFJW(){
|
||||
def sql = "select city_id, ca_id,address_id,address_name, status, exp_dt, version, is_key_name, data_source, description,alias_grade,addr_type_cd,ifexamine,ifdisplay from ADDRESS_ALIAS_FJW";// where city_id='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.city_id
|
||||
data << r.ca_id
|
||||
data << r.address_id
|
||||
data << r.address_name
|
||||
data << r.status
|
||||
data << r.exp_dt
|
||||
data << r.version
|
||||
data << r.is_key_name
|
||||
data << r.data_source
|
||||
data << r.description
|
||||
data << r.alias_grade
|
||||
data << r.addr_type_cd
|
||||
data << r.ifexamine
|
||||
data << r.ifdisplay
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_ADDRESS_ALIAS_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_ADDRESS_ALIAS_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "ADDRESS_ALIAS_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataDealFJW(dealdate){
|
||||
|
||||
def startDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def endDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def stop = false
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def index = 0
|
||||
|
||||
def curStartDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()),"yyyy-MM-dd")
|
||||
def curSndDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(new Date()),"yyyy-MM-dd")
|
||||
|
||||
while(!stop){
|
||||
index++
|
||||
def curStartStr = curStartDateStr
|
||||
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curStartStr.replace("-","")}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curStartStr.replace("-","")}_0001.dat"
|
||||
}
|
||||
|
||||
def allRows = []
|
||||
if(index==1){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where dealdate>=to_date('${startDateStr}','yyyy-MM-dd') and dealdate<=to_date('${endDateStr}','yyyy-MM-dd')";//CITYID='${cityCode}' and
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.DEALID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.UNITID
|
||||
data << r.UNITNO
|
||||
data << r.UNITNAME
|
||||
data << r.HOUSEID
|
||||
data << r.ADDRESS
|
||||
data << r.BUILDYEAR
|
||||
data << r.PROPTYPE
|
||||
data << r.PROPYEARS
|
||||
data << r.PERIODNUM
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
data << r.HOUSESTYLE
|
||||
data << r.ROOMCNT
|
||||
data << r.LIVINGROOMCNT
|
||||
data << r.KITCHENCNT
|
||||
data << r.BATHROOMCNT
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSESTRU
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FITMENT
|
||||
data << r.EVALUATENO
|
||||
data << r.DEALUNITPRICE
|
||||
data << r.DEALTOTALPRICE
|
||||
data << r.DECLAREPRICE
|
||||
data << r.EVALUATEPRICE
|
||||
data << r.CONTRACTNO
|
||||
data << r.DEALDATE
|
||||
data << r.DEALTYPE
|
||||
data << r.PAYTYPE
|
||||
data << r.DEALPERIOD
|
||||
data << r.IFELEVATOR
|
||||
data << r.COMPAREAGARDEN
|
||||
data << r.COMPAREATERRACE
|
||||
data << r.COMPAREABALCONY
|
||||
data << r.COMPAREABAYWINDOW
|
||||
data << r.COMPAREAATTIC
|
||||
data << r.COMPAREAGARAGE
|
||||
data << r.COMPAREABASEMENT
|
||||
data << r.COMPAREAOTHER
|
||||
data << r.DATASOURCE
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
}
|
||||
if(curStartDateStr == curSndDateStr){
|
||||
stop = true
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh", fileName, curDate)
|
||||
println "BIGDATA_DEAL_FJW 上传Ftp完成......${curStartStr}"
|
||||
def curEndStr = DateUtils.add(curStartStr, 1)
|
||||
curStartDateStr = curEndStr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataDealFJW2(curDate, dealdate){
|
||||
|
||||
def startDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
def endDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd")
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
|
||||
def allRows = []
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where dealdate>=to_date('${startDateStr}','yyyy-MM-dd') and dealdate<=to_date('${endDateStr}','yyyy-MM-dd')";//CITYID='${cityCode}' and
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.DEALID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.UNITID
|
||||
data << r.UNITNO
|
||||
data << r.UNITNAME
|
||||
data << r.HOUSEID
|
||||
data << r.ADDRESS
|
||||
data << r.BUILDYEAR
|
||||
data << r.PROPTYPE
|
||||
data << r.PROPYEARS
|
||||
data << r.PERIODNUM
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
data << r.HOUSESTYLE
|
||||
data << r.ROOMCNT
|
||||
data << r.LIVINGROOMCNT
|
||||
data << r.KITCHENCNT
|
||||
data << r.BATHROOMCNT
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSESTRU
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FITMENT
|
||||
data << r.EVALUATENO
|
||||
data << r.DEALUNITPRICE
|
||||
data << r.DEALTOTALPRICE
|
||||
data << r.DECLAREPRICE
|
||||
data << r.EVALUATEPRICE
|
||||
data << r.CONTRACTNO
|
||||
data << r.DEALDATE
|
||||
data << r.DEALTYPE
|
||||
data << r.PAYTYPE
|
||||
data << r.DEALPERIOD
|
||||
data << r.IFELEVATOR
|
||||
data << r.COMPAREAGARDEN
|
||||
data << r.COMPAREATERRACE
|
||||
data << r.COMPAREABALCONY
|
||||
data << r.COMPAREABAYWINDOW
|
||||
data << r.COMPAREAATTIC
|
||||
data << r.COMPAREAGARAGE
|
||||
data << r.COMPAREABASEMENT
|
||||
data << r.COMPAREAOTHER
|
||||
data << r.DATASOURCE
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_DEAL_FJW 上传Ftp完成......${endDateStr}"
|
||||
}
|
||||
|
||||
def exportAllBigdataDealFJW(){
|
||||
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where DEALDATE<to_date('2021-12-01','yyyy-MM-dd')";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.DEALID
|
||||
data << r.CITYNAME
|
||||
data << r.DISTID
|
||||
data << r.DISTNAME
|
||||
data << r.STREET
|
||||
data << r.STREETNO
|
||||
data << r.COMMID
|
||||
data << r.COMMNAME
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.UNITID
|
||||
data << r.UNITNO
|
||||
data << r.UNITNAME
|
||||
data << r.HOUSEID
|
||||
data << r.ADDRESS
|
||||
data << r.BUILDYEAR
|
||||
data << r.PROPTYPE
|
||||
data << r.PROPYEARS
|
||||
data << r.PERIODNUM
|
||||
data << r.FLOORNUM
|
||||
data << r.FLOORTYPE
|
||||
data << r.FLOORCNT
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.BUILDAREA
|
||||
data << r.LIVINGAREA
|
||||
data << r.HOUSESTYLE
|
||||
data << r.ROOMCNT
|
||||
data << r.LIVINGROOMCNT
|
||||
data << r.KITCHENCNT
|
||||
data << r.BATHROOMCNT
|
||||
data << r.HOUSEUSE
|
||||
data << r.HOUSESTRU
|
||||
data << r.HOUSEASPECT
|
||||
data << r.FITMENT
|
||||
data << r.EVALUATENO
|
||||
data << r.DEALUNITPRICE
|
||||
data << r.DEALTOTALPRICE
|
||||
data << r.DECLAREPRICE
|
||||
data << r.EVALUATEPRICE
|
||||
data << r.CONTRACTNO
|
||||
data << r.DEALDATE
|
||||
data << r.DEALTYPE
|
||||
data << r.PAYTYPE
|
||||
data << r.DEALPERIOD
|
||||
data << r.IFELEVATOR
|
||||
data << r.COMPAREAGARDEN
|
||||
data << r.COMPAREATERRACE
|
||||
data << r.COMPAREABALCONY
|
||||
data << r.COMPAREABAYWINDOW
|
||||
data << r.COMPAREAATTIC
|
||||
data << r.COMPAREAGARAGE
|
||||
data << r.COMPAREABASEMENT
|
||||
data << r.COMPAREAOTHER
|
||||
data << r.DATASOURCE
|
||||
data << r.AGENCYID
|
||||
data << r.AGENCYNAME
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME1
|
||||
data << r.UPDATETIME1
|
||||
data << r.SOURCECODE
|
||||
data << r.WORKDATE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
println "BIGDATA_DEAL_FJW 导出完成......"
|
||||
}
|
||||
|
||||
|
||||
def exportBigdataBuildingFJW(cityCode){
|
||||
def sql = "select CITYID, BUILDID, BUILDNO, BUILDNAME, BUILDALIAS, DISTID, COMMID, BUILDYEAR, BUILDTYPE, BUILDSTRU, FLOORCNT, UNITCNT, HOUSECNT, IFELEVATOR, ELEVATORCNT, ELEVATORHOUSE, REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, VALID_FLAG from BIGDATA_BUILDING_FJW";//where CITYID='${cityCode}'
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.CITYID
|
||||
data << r.BUILDID
|
||||
data << r.BUILDNO
|
||||
data << r.BUILDNAME
|
||||
data << r.BUILDALIAS
|
||||
data << r.DISTID
|
||||
data << r.COMMID
|
||||
data << r.BUILDYEAR
|
||||
if(r.BUILDTYPE){
|
||||
def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",")
|
||||
data << arrs[0].trim()
|
||||
}else{
|
||||
data << ''
|
||||
}
|
||||
data << r.BUILDSTRU
|
||||
data << r.FLOORCNT
|
||||
data << r.UNITCNT
|
||||
data << r.HOUSECNT
|
||||
data << r.IFELEVATOR
|
||||
data << r.ELEVATORCNT
|
||||
data << r.ELEVATORHOUSE
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
data << r.VALID_FLAG
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_BUILDING_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_BUILDING_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
|
||||
|
||||
def exportEvaluateRate(){
|
||||
def sql = "select ID, RATE_TYPE, RATE, RANK, CITY, REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from EVALUATE_RATE_FJW";
|
||||
def allRows = []
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
def data = []
|
||||
data << r.ID
|
||||
data << r.RATE_TYPE
|
||||
data << r.RATE
|
||||
data << r.RANK
|
||||
data << r.CITY
|
||||
data << r.REMARK
|
||||
data << r.CREATETIME
|
||||
data << r.UPDATETIME
|
||||
data << r.SOURCECODE
|
||||
allRows << data
|
||||
});
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_EVALUATE_RATE_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_EVALUATE_RATE_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "EVALUATE_RATE_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataBuildprojFjw(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_BUILDPROJ_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_BUILDPROJ_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile([], fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_BUILDPROJ_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportBigdataCommlayoutpicFjw(){
|
||||
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
|
||||
def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_COMMLAYOUTPIC_FJW_ALL_${curDate}_0001.dat"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_COMMLAYOUTPIC_FJW_ALL_${curDate}_0001.dat"
|
||||
}
|
||||
FileUtils.batchCreateFile([], fileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
|
||||
println "BIGDATA_COMMLAYOUTPIC_FJW 上传Ftp完成......"
|
||||
}
|
||||
|
||||
def exportOk(curDate){
|
||||
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMMdd")
|
||||
def dataCodeFileName = "/ccb_rh/${curDate}/${curDate}.ok"
|
||||
if(CommonDatautils.isWindow()){
|
||||
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${curDate}.ok"
|
||||
}
|
||||
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
|
||||
CcbFtpTestUtils.ftpUpload("rh",dataCodeFileName, curDate)
|
||||
}
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.fangjia.script.ccbevaluation.ronghe
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import com.jcraft.jsch.ChannelExec;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.Session
|
||||
|
||||
import com.jcraft.jsch.*;
|
||||
|
||||
|
||||
class SSHHelper {
|
||||
|
||||
private Session session = null;
|
||||
private Channel channel = null;
|
||||
|
||||
private String sftpHost = "192.168.0.45";
|
||||
private int sftpPort = 17495;
|
||||
private String sftpUserName = "ccb";
|
||||
private String sftpPassword = "ccb!@#";
|
||||
private int timeout = 30000;
|
||||
/**
|
||||
* 获取连接
|
||||
* @return
|
||||
*/
|
||||
private ChannelExec getChannelExec() {
|
||||
try {
|
||||
if (channel != null && channel.isConnected()) {
|
||||
return (ChannelExec) channel;
|
||||
}
|
||||
JSch jSch = new JSch();
|
||||
if (session == null || !session.isConnected()) {
|
||||
session = jSch.getSession(sftpUserName, sftpHost, sftpPort);
|
||||
session.setPassword(sftpPassword);
|
||||
Properties config = new Properties();
|
||||
config.put("StrictHostKeyChecking", "no");
|
||||
session.setConfig(config);
|
||||
session.setTimeout(timeout);
|
||||
session.connect();
|
||||
}
|
||||
channel = session.openChannel("exec");
|
||||
} catch (Exception e) {
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
session = null;
|
||||
}
|
||||
channel = null;
|
||||
}
|
||||
return channel == null ? null : (ChannelExec) channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭连接
|
||||
*/
|
||||
private void closeChannel() {
|
||||
try {
|
||||
if (channel != null) {
|
||||
channel.disconnect();
|
||||
channel = null;
|
||||
}
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
session = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行服务器端命令
|
||||
*/
|
||||
public boolean executeCommand(String command) {
|
||||
boolean flag = false;
|
||||
ChannelExec channelExec = getChannelExec();
|
||||
if (channelExec == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
channelExec.setInputStream(null);
|
||||
channelExec.setErrStream(System.err);
|
||||
channelExec.setCommand(command);
|
||||
|
||||
InputStream ins = channelExec.getInputStream();
|
||||
channelExec.connect();
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "utf-8"));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
reader.close();
|
||||
closeChannel();
|
||||
|
||||
flag = true;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SSHHelper jschCommand = new SSHHelper();
|
||||
System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/package.sh 20220110"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+277
@@ -0,0 +1,277 @@
|
||||
package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
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.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
|
||||
/**
|
||||
* 重庆估值测试--2小时
|
||||
*/
|
||||
class EvaluationBatch {
|
||||
|
||||
public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
|
||||
public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl)
|
||||
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 EvaluationBatch()
|
||||
// task.run()
|
||||
// task.run1();
|
||||
task.run2()
|
||||
}
|
||||
|
||||
def run2(){
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2021-01-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-04-07")
|
||||
def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate)
|
||||
ExcelUtils.modify("D:\\数据\\重庆农商行\\2022-04-02\\重庆房屋交易信息V1.xlsx", { row ->
|
||||
if(row['N'] && row['N'].toString().toDouble()>=20){
|
||||
println row['F'] +" "+row['N']
|
||||
def dist = CommonDatautils.findDistrictById(row['C'])
|
||||
for(def weekend : weekends){
|
||||
CommonUtils.recalculationAverage(row['D'], row['E'], row['F'], dist.estate_type2, weekend,false,0)
|
||||
}
|
||||
// FangjiaClientUtils.sendDistrictPriceCalculate(row['D'], row['E'], row['F'], 48);
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def run1(){
|
||||
def city = "重庆"
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\2022-04-02\\重庆房屋交易信息V2.xlsx", { row ->
|
||||
def region = row['E']
|
||||
def name = row['F']
|
||||
def id = row['C']
|
||||
def lastWeekend = DateUtils.getFirstDayOfWeek(new Date()-30)
|
||||
def lastYearWeekend = DateUtils.getFirstDayOfWeek(new Date()-365)
|
||||
if (region && name) {
|
||||
row['H'] = CommonDatautils.findNewSqmetreRent(city, region, name)
|
||||
|
||||
def priceObj = CommonDatautils.findDistrictPrice(city, region, name)
|
||||
if(priceObj){
|
||||
row['AB'] = priceObj.avg_price
|
||||
}
|
||||
|
||||
def dist = CommonDatautils.findDistrictById(id)
|
||||
if(dist) {
|
||||
List<DBObject> list = DbUtils.findAroundDistrict(dist)
|
||||
def map = getArroundAvgPriceMap(list)
|
||||
if(map){
|
||||
row['L'] = map.avg_price
|
||||
row['Q'] = map.max_val
|
||||
row['R'] = map.min_val
|
||||
}
|
||||
def lastArroundPrice = getArroundAvgPriceByWeekend(list, lastWeekend)
|
||||
if(lastArroundPrice && priceObj){
|
||||
def mod = (map.avg_price-lastArroundPrice)*100/lastArroundPrice
|
||||
mod = DataHandleUtils.getDoubleRound(2, mod)
|
||||
row['P'] = mod
|
||||
}
|
||||
def lastYearArroundPrice = getArroundAvgPriceByWeekend(list, lastYearWeekend)
|
||||
if(lastYearArroundPrice && priceObj){
|
||||
def mod = (map.avg_price-lastYearArroundPrice)*100/lastYearArroundPrice
|
||||
mod = DataHandleUtils.getDoubleRound(2, mod)
|
||||
row['O'] = mod
|
||||
}
|
||||
}
|
||||
def lastWeekendObj = CommonDatautils.queryDistrictPrice(city, region, name, lastWeekend)
|
||||
if(lastWeekendObj){
|
||||
row['S'] = lastWeekendObj.avg_price
|
||||
if(priceObj){
|
||||
def mod = (priceObj.avg_price-lastWeekendObj.avg_price)*100/lastWeekendObj.avg_price
|
||||
mod = DataHandleUtils.getDoubleRound(2, mod)
|
||||
row['M'] = mod
|
||||
}
|
||||
}
|
||||
def lastYearObj = CommonDatautils.queryDistrictPrice(city, region, name, lastYearWeekend)
|
||||
if(lastYearObj){
|
||||
row['T'] = lastYearObj.avg_price
|
||||
if(priceObj){
|
||||
def mod = (priceObj.avg_price-lastYearObj.avg_price)*100/lastYearObj.avg_price
|
||||
mod = DataHandleUtils.getDoubleRound(2, mod)
|
||||
row['N'] = mod
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
|
||||
def run(){
|
||||
def city = "重庆"
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\2022-04-02\\重庆估值交易信息V2.xlsx", { row ->
|
||||
def region = row['E']
|
||||
def name = row['F']
|
||||
def id = row['C']
|
||||
def area = row['G'].toDouble()
|
||||
if(region && name){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(city, region, name)
|
||||
if(priceObj){
|
||||
row['J'] = priceObj.avg_price
|
||||
if(row['C']){
|
||||
row['I'] = (area*priceObj.avg_price).toInteger()
|
||||
}
|
||||
}
|
||||
def dist = CommonDatautils.findDistrictById(id)
|
||||
if(dist){
|
||||
List<DBObject> list = DbUtils.findAroundDistrict(dist)
|
||||
row['N'] = getArroundAvgPrice(list)
|
||||
|
||||
def alias = dist.alias
|
||||
if(!alias){
|
||||
alias = []
|
||||
}
|
||||
alias << dist.name
|
||||
def houseAvgPrice = findSimAreaHousePrice(dist.city, dist.region, alias,20220101,20220401, area-10, area+10)
|
||||
if(houseAvgPrice){
|
||||
row['K'] = houseAvgPrice
|
||||
}
|
||||
|
||||
def tradeAvgPrice = findTrades(dist, DateUtils.parseFromTightYYYYMMDD("2021-12-01"), area-10, area+10)
|
||||
row['L'] = tradeAvgPrice
|
||||
|
||||
def avg_price = findAvgPrice(dist._id.toString())
|
||||
if(row['J'] && avg_price){
|
||||
def weekendPrice = row['J'].toString().toDouble()
|
||||
def ppe15 = Math.abs((weekendPrice - avg_price) * 100 / avg_price)
|
||||
row['P'] = ppe15
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def findTrades(dist, startDate, startArea, endArea){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", dist.city)
|
||||
q.put("region", dist.region)
|
||||
// q.put("source", "链家在线")
|
||||
q.put("source", new BasicDBObject('$in', ["链家在线","贝壳找房"]))
|
||||
|
||||
def alias = []
|
||||
if(dist.alias){
|
||||
if(!dist.alias.contains(dist.name)){
|
||||
dist.alias << dist.name
|
||||
}
|
||||
alias = dist.alias
|
||||
}else{
|
||||
alias << dist.name
|
||||
}
|
||||
|
||||
if(alias){
|
||||
q.put("district_name", new BasicDBObject('$in', alias))
|
||||
}
|
||||
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate))
|
||||
q.put("area", new BasicDBObject('$gte', startArea).append('$lt',endArea))
|
||||
def dbcorsor = DEAL_PRICE_COLL.find(q)
|
||||
def prices = []
|
||||
for(def d : dbcorsor){
|
||||
if(d.avg_price){
|
||||
prices << d.avg_price
|
||||
}
|
||||
}
|
||||
|
||||
def price = null
|
||||
if(prices){
|
||||
price = (prices.sum()/prices.size()).toInteger()
|
||||
}
|
||||
return price
|
||||
}
|
||||
|
||||
|
||||
def getArroundAvgPriceMap(def list){
|
||||
def prices = []
|
||||
for(def l : list){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(l.city, l.region, l.name)
|
||||
if(priceObj){
|
||||
prices << priceObj.avg_price
|
||||
}
|
||||
}
|
||||
prices.sort()
|
||||
def map = [:]
|
||||
map.min_val = prices[0]
|
||||
map.max_val = prices[prices.size()-1]
|
||||
def avg_price = (prices.sum()/prices.size()).toInteger()
|
||||
map.avg_price = avg_price
|
||||
return map;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
def avg_price = (prices.sum()/prices.size()).toInteger()
|
||||
return avg_price;
|
||||
}
|
||||
|
||||
|
||||
def getArroundAvgPriceByWeekend(def list, def weekend){
|
||||
def prices = []
|
||||
for(def l : list){
|
||||
def priceObj =CommonDatautils.queryDistrictPrice(l.city, l.region, l.name, weekend)
|
||||
if(priceObj){
|
||||
prices << priceObj.avg_price
|
||||
}
|
||||
}
|
||||
def avg_price = null;
|
||||
if(prices){
|
||||
avg_price = (prices.sum()/prices.size()).toInteger()
|
||||
}
|
||||
return avg_price;
|
||||
}
|
||||
|
||||
|
||||
def findSimAreaHousePrice(def city, def region, def alias, def startDate, def endDate, def startArea, def endArea){
|
||||
def aliasStr = null;
|
||||
def total = 0
|
||||
def prices = []
|
||||
try{
|
||||
aliasStr = escapeExprSpecialWord(alias.join("','"))
|
||||
String sql = "select avg_price from latest_seawater where cat='sell' and city='${city}' and p_date >= ${startDate} and p_date<${endDate} and region='${region}' and district_name in ('${aliasStr}') and area>=${startArea} and area<=${endArea}"
|
||||
|
||||
ElasticUtils.executeSqlQuery(sql,{ data->
|
||||
prices << data.avg_price
|
||||
})
|
||||
}catch(Exception e){
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
def price = null
|
||||
if(prices){
|
||||
price = (prices.sum()/prices.size()).toInteger()
|
||||
}
|
||||
return price
|
||||
}
|
||||
|
||||
public String escapeExprSpecialWord(String keyword) {
|
||||
return QueryParser.escape(keyword);
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
|
||||
class BlankMatch {
|
||||
static main(args) {
|
||||
def task = new BlankMatch()
|
||||
task.run()
|
||||
// task.run1()
|
||||
// task.run2()
|
||||
// task.run3()
|
||||
}
|
||||
|
||||
def run() {
|
||||
//rMap = SeaweedDataMatchProcess.doMatch(city, region, d['G'], null);
|
||||
//def path = "D:\\数据\\重庆农商行\\2022-04-02\\重庆样本匹配结果V3.xlsx";
|
||||
def path = "D:\\数据\\重庆农商行\\2022-04-02\\测试.xlsx"
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['C']){
|
||||
def jsonObject = OpenApiClient.addressMatch("重庆", row['B'], "property", false, null, null)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['C'] = jsonObject.get("id")
|
||||
row['D'] = jsonObject.get("city")
|
||||
row['E'] = jsonObject.get("district")
|
||||
row['F'] = jsonObject.get("name")
|
||||
row['G'] = jsonObject.get("address")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def run1() {
|
||||
//rMap = SeaweedDataMatchProcess.doMatch(city, region, d['G'], null);
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\2022-04-02\\重庆样本匹配不上(合并).xlsx", { row ->
|
||||
if(row['F']){
|
||||
def jsonObject = OpenApiClient.addressMatch("重庆", row['F'], "property", false, row['E'], null)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['C'] = jsonObject.get("id")
|
||||
row['D'] = jsonObject.get("city")
|
||||
row['J'] = jsonObject.get("name")
|
||||
}
|
||||
|
||||
}
|
||||
// def jsonObject = OpenApiClient.addressMatch("重庆", row['B'], "property", false, null, null)
|
||||
// if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
// row['C'] = jsonObject.get("id")
|
||||
// row['D'] = jsonObject.get("city")
|
||||
// row['E'] = jsonObject.get("district")
|
||||
// row['F'] = jsonObject.get("name")
|
||||
// row['G'] = jsonObject.get("address")
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
def run3(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\2022-04-02\\重庆样本匹配结果V3.xlsx", { row ->
|
||||
if(!row['C']){
|
||||
def dist = CommonDatautils.findDistrict("重庆", row['E'], row['F'], "district")
|
||||
if(dist){
|
||||
row['C'] = dist._id.toString()
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
def run2(){
|
||||
def datas = ExcelUtils.read("D:\\数据\\重庆农商行\\2022-04-02\\重庆样本匹配不上(合并).xlsx",0,1)
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\2022-04-02\\重庆样本匹配结果V3.xlsx", { row ->
|
||||
if(!row['C']){
|
||||
for(def d : datas){
|
||||
if(d['B'] == row['B']){
|
||||
row['C'] = d['C']
|
||||
row['D'] = d['D']
|
||||
row['E'] = d['E']
|
||||
row['F'] = d['J']
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
class FieldAddValue {
|
||||
static main(args) {
|
||||
def task = new FieldAddValue()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
//16991 14360
|
||||
def districts = CommonDatautils.findAllDistrictByCity("ÖØÇì", "district", ["region","name","alias","is_elevator"])
|
||||
def index = 0
|
||||
def updateIndex = 0
|
||||
for(def d : districts){
|
||||
if(!d.is_elevator){
|
||||
index++
|
||||
println index
|
||||
def alias = d.alias
|
||||
if(!d.alias){
|
||||
alias = []
|
||||
}
|
||||
alias << d.name
|
||||
def maxHeight = findHouseHeight("ÖØÇì", d.region, alias, 20220101)
|
||||
if(maxHeight && maxHeight>6){
|
||||
updateIndex++
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("is_elevator", true)
|
||||
udata.put("m_date",new Date())
|
||||
|
||||
def q = new BasicDBObject()
|
||||
q.put("_id", new ObjectId( d._id.toString()))
|
||||
DbUtils.seaweed.update(q, new BasicDBObject('$set', udata))
|
||||
}
|
||||
}
|
||||
}
|
||||
println index+" "+updateIndex
|
||||
}
|
||||
|
||||
def findHouseHeight(def city, def region, def alias, def startDate){
|
||||
def aliasStr = null;
|
||||
def total = 0
|
||||
def heights = null
|
||||
try{
|
||||
aliasStr = escapeExprSpecialWord(alias.join("','"))
|
||||
String sql = "select max(height) as height from latest_seawater where cat='sell' and city='${city}' and p_date >= ${startDate} and region='${region}' and district_name in ('${aliasStr}') "
|
||||
|
||||
ElasticUtils.executeSqlQuery(sql,{ data->
|
||||
if(data.height){
|
||||
heights = data.height
|
||||
}
|
||||
|
||||
})
|
||||
}catch(Exception e){
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
// def max_height = null
|
||||
// if(heights){
|
||||
// heights.sort()
|
||||
// max_height = heights[heights.size()-1]
|
||||
// }
|
||||
return heights
|
||||
}
|
||||
|
||||
public String escapeExprSpecialWord(String keyword) {
|
||||
return QueryParser.escape(keyword);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+612
@@ -0,0 +1,612 @@
|
||||
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:\\数据\\美团\\10城小区明细-V10.xlsx"
|
||||
def total = 1500
|
||||
|
||||
static main(args) {
|
||||
def task = new MatchEvaluateRegionTest()
|
||||
// task.run()//小区匹配
|
||||
// task.run1()//地图匹配
|
||||
// task.addDistrict();//新增人工处理小区,原文件匹配不上的去除
|
||||
// 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']){
|
||||
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")
|
||||
row['H'] = jsonObject.get("district")
|
||||
row['I'] = jsonObject.get("name")
|
||||
row['J'] = jsonObject.get("address")
|
||||
row['K'] = jsonObject.get("propertyType")
|
||||
row['L'] = jsonObject.get("map")
|
||||
row['M'] = jsonObject.get("lng")
|
||||
row['N'] = jsonObject.get("lat")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def run1(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
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")
|
||||
row['H'] = jsonObject.get("district")
|
||||
row['I'] = jsonObject.get("name")
|
||||
row['J'] = jsonObject.get("address")
|
||||
row['K'] = jsonObject.get("propertyType")
|
||||
row['L'] = jsonObject.get("map")
|
||||
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['O'] = priceObj.avg_price
|
||||
// row['N']= (int)(priceObj.avg_price * row['E'])
|
||||
}
|
||||
|
||||
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['O']) {
|
||||
def arroundObj = FangjiaClientUtils.arroundPrice(row['A'], row['E'])
|
||||
if (arroundObj && arroundObj.msgCode == 200 && arroundObj.result) {
|
||||
def priceObj = arroundObj.result
|
||||
row['O'] = priceObj.unitPrice
|
||||
// row['N'] = (int) (priceObj.unitPrice * row['E'])
|
||||
row['S'] = "周边价格"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def addAuthor(){
|
||||
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['N'] = authors[count]
|
||||
}
|
||||
index++
|
||||
if(index >= avg){
|
||||
count++
|
||||
index = 0
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
def addDistrict(){
|
||||
def path = "D:\\数据\\重庆农商行\\2022-05-06\\需新增小区.xlsx"
|
||||
def keys = new CopyOnWriteArrayList()
|
||||
def index = 0
|
||||
ExcelUtils.modify(path, { d->
|
||||
def flag = d['M']
|
||||
if(!flag){
|
||||
def city = d['E']
|
||||
def region = d['F']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def name = d['G']
|
||||
name = nameFileter(name)
|
||||
|
||||
def formatAddress = null
|
||||
def address = d['H']
|
||||
if(address){
|
||||
formatAddress = AddressUtil.formatAddress(city, address)
|
||||
if(!formatAddress){
|
||||
if(address.contains("交叉口")){
|
||||
formatAddress = address.substring(0, address.toString().indexOf("交叉口")+3)
|
||||
}else if(address.contains("交叉")){
|
||||
formatAddress = address.substring(0, 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)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}else{
|
||||
def type = d['I']
|
||||
if(type){
|
||||
if(type.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(type.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def key = city+"##"+newRegion+"##"+name
|
||||
if(name && !keys.contains(key)){
|
||||
def dist = CommonDatautils.findDistrict(city, newRegion, name, "district")
|
||||
if(!dist){
|
||||
keys << key
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
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("name", name)
|
||||
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)
|
||||
}
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
println index+" "+data
|
||||
addPrice(data)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
println city +" "+region +" 区域无法标准化"
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def addPrice(dist){
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2022-03-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-04-25")
|
||||
def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate)
|
||||
|
||||
for(def weekend : weekends){
|
||||
CommonUtils.recalculationAverage(dist.city, dist.region, dist.name, dist.estate_type2, weekend,false,0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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.contains("(")){
|
||||
def delstr = name.substring(name.indexOf("("), name.indexOf(")")+1)
|
||||
name = name.replace(delstr,"")
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.OpenApiUtils
|
||||
import com.fangjia.script.gj.paimai.DataUtil
|
||||
import com.fangjia.script.linxsh.util.AddressUtil
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import groovy.sql.Sql
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
|
||||
class MatchEvaluateTest {
|
||||
|
||||
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\\模拟_测试数据.xlsx"
|
||||
def total = 1500
|
||||
|
||||
static main(args) {
|
||||
def task = new MatchEvaluateTest()
|
||||
task.run()//小区匹配
|
||||
task.run1()//地图匹配
|
||||
// task.addDistrict();//新增人工处理小区,原文件匹配不上的去除
|
||||
task.addPrice()
|
||||
task.addArroundPrice()
|
||||
task.addAuthor()
|
||||
|
||||
// task.stat()
|
||||
}
|
||||
|
||||
def addArroundPrice(){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(row['A'] && !row['K']) {
|
||||
def arroundObj = FangjiaClientUtils.arroundPrice(row['A'], row['B'])
|
||||
if (arroundObj && arroundObj.msgCode == 200 && arroundObj.result) {
|
||||
def priceObj = arroundObj.result
|
||||
row['K'] = priceObj.unitPrice
|
||||
row['L'] = (int) (priceObj.unitPrice * row['C'])
|
||||
row['O'] = "周边价格"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
def run(){
|
||||
// def path = "D:\\数据\\重庆农商行\\2022-05-06\\test.xlsx"
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['D'] && row['B']){
|
||||
def jsonObject = OpenApiClient.addressMatch5("重庆", row['B'], "property", false)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['D'] = jsonObject.get("id")
|
||||
row['E'] = jsonObject.get("city")
|
||||
row['F'] = jsonObject.get("district")
|
||||
row['G'] = jsonObject.get("name")
|
||||
row['H'] = jsonObject.get("address")
|
||||
row['I'] = jsonObject.get("propertyType")
|
||||
row['J'] = jsonObject.get("map")
|
||||
// row['K'] = jsonObject.get("lng")
|
||||
// row['L'] = jsonObject.get("lat")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def run1(){
|
||||
// def path = "D:\\数据\\重庆农商行\\2022-05-06\\test.xlsx"
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['D'] && row['B']){
|
||||
def jsonObject = OpenApiClient.addressMatch("重庆", row['B'], null, true)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['D'] = jsonObject.get("id")
|
||||
row['E'] = jsonObject.get("city")
|
||||
row['F'] = jsonObject.get("district")
|
||||
row['G'] = jsonObject.get("name")
|
||||
row['H'] = jsonObject.get("address")
|
||||
row['I'] = jsonObject.get("propertyType")
|
||||
row['J'] = jsonObject.get("map")
|
||||
// row['K'] = jsonObject.get("lng")
|
||||
// row['L'] = jsonObject.get("lat")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def addPrice(){
|
||||
// def path = "D:\\数据\\重庆农商行\\2022-05-06\\test.xlsx"
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(!row['J'] && row['E']){
|
||||
def priceObj = CommonDatautils.findDistrictPrice(row['E'], row['F'], row['G'])
|
||||
if(priceObj){
|
||||
row['K'] = priceObj.avg_price
|
||||
row['L']= (int)(priceObj.avg_price * row['C'])
|
||||
}
|
||||
|
||||
|
||||
def avg_price = findAvgPrice(row['D'])
|
||||
if(row['K'] && avg_price){
|
||||
def weekendPrice = row['K'].toString().toDouble()
|
||||
def ppe15 = Math.abs((weekendPrice - avg_price) * 100 / avg_price)
|
||||
row['M'] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, ppe15)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
def addAuthor(){
|
||||
// def path = "D:\\数据\\重庆农商行\\2022-05-06\\test.xlsx"
|
||||
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['N'] = authors[count]
|
||||
}
|
||||
index++
|
||||
if(index >= avg){
|
||||
count++
|
||||
index = 0
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
def addDistrict(){
|
||||
def path = "D:\\数据\\重庆农商行\\2022-05-06\\需新增小区.xlsx"
|
||||
def keys = new CopyOnWriteArrayList()
|
||||
def index = 0
|
||||
ExcelUtils.modify(path, { d->
|
||||
def flag = d['M']
|
||||
if(!flag){
|
||||
def city = d['E']
|
||||
def region = d['F']
|
||||
def newRegion = RegionData.formatRegion(city, region)
|
||||
if(newRegion){
|
||||
def name = d['G']
|
||||
name = nameFileter(name)
|
||||
|
||||
def formatAddress = null
|
||||
def address = d['H']
|
||||
if(address){
|
||||
formatAddress = AddressUtil.formatAddress(city, address)
|
||||
if(!formatAddress){
|
||||
if(address.contains("交叉口")){
|
||||
formatAddress = address.substring(0, address.toString().indexOf("交叉口")+3)
|
||||
}else if(address.contains("交叉")){
|
||||
formatAddress = address.substring(0, 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)
|
||||
blng = baidu.x * 10000000000L
|
||||
blat = baidu.y * 10000000000L
|
||||
}
|
||||
|
||||
def estateType2 = "普通住宅"
|
||||
if(name.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(name.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}else{
|
||||
def type = d['I']
|
||||
if(type){
|
||||
if(type.contains("别墅")){
|
||||
estateType2 = "别墅"
|
||||
}else if(type.contains("商住")){
|
||||
estateType2 = "商住"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def key = city+"##"+newRegion+"##"+name
|
||||
if(name && !keys.contains(key)){
|
||||
def dist = CommonDatautils.findDistrict(city, newRegion, name, "district")
|
||||
if(!dist){
|
||||
keys << key
|
||||
def data = new BasicDBObject();
|
||||
data.put("name_cat",0)
|
||||
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("name", name)
|
||||
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)
|
||||
}
|
||||
def markMap = [:]
|
||||
markMap.put("data_source", "机器入库")
|
||||
data.put("mark_map",markMap)
|
||||
index++
|
||||
DbUtils.seaweed.save(data);
|
||||
println index+" "+data
|
||||
addPrice(data)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
println city +" "+region +" 区域无法标准化"
|
||||
}
|
||||
}
|
||||
},0)
|
||||
}
|
||||
|
||||
def addPrice(dist){
|
||||
def startDate = DateUtils.parseFromTightYYYYMMDD("2022-03-01")
|
||||
def endDate = DateUtils.parseFromTightYYYYMMDD("2022-04-25")
|
||||
def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate)
|
||||
|
||||
for(def weekend : weekends){
|
||||
CommonUtils.recalculationAverage(dist.city, dist.region, dist.name, dist.estate_type2, weekend,false,0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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.contains("(")){
|
||||
def delstr = name.substring(name.indexOf("("), name.indexOf(")")+1)
|
||||
name = name.replace(delstr,"")
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
def stat(){
|
||||
def datas = ExcelUtils.read("D:\\数据\\重庆农商行\\2022-05-06\\模拟_测试数据_合并后 (1).xlsx",0,1)
|
||||
ExcelUtils.multiThreadingModify(path, { d ->
|
||||
if(d['B']){
|
||||
for(def row : datas){
|
||||
if(d['B']==row['B']){
|
||||
if(row['K']){
|
||||
d['P'] = row['K']
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user