Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?8ba756136bc3cbd77b5e2770bb4b84cc";
|
||||
hm.src = "https://hm.baidu.com/hm.js?9502ac47aba7a0ac50d34c3b4423bc6f";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
|
||||
+2
-2
@@ -31,9 +31,9 @@ class FumingTest {
|
||||
def path = "D:\\数据\\富民\\富民测试500-v7.xlsx"
|
||||
// match(path)
|
||||
// addPrice(path)
|
||||
// addThirdPrice(path)
|
||||
addThirdPrice(path)
|
||||
// addLastPrice(path)
|
||||
addFacLevel(path)
|
||||
// addFacLevel(path)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-7
@@ -46,13 +46,13 @@ class HailanTest {
|
||||
}
|
||||
|
||||
def run(){
|
||||
def inputfile = "D:\\数据\\海南\\统计.xlsx"
|
||||
// match(inputfile)
|
||||
def inputfile = "D:\\数据\\微元素\\排查表.xlsx"
|
||||
match(inputfile)
|
||||
// addPrice(inputfile)
|
||||
// addCommId("D:\\数据\\海南\\匹配上的合并数据.xlsx")
|
||||
// addHouse(inputfile)
|
||||
// stat(inputfile)
|
||||
hailanStat(inputfile)
|
||||
// hailanStat(inputfile)
|
||||
}
|
||||
|
||||
def addHouse(inputfile){
|
||||
@@ -533,13 +533,13 @@ class HailanTest {
|
||||
|
||||
def match(path){
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
if(row['C']){
|
||||
String city = row['H']//RegionData.formatCity(row['B'])
|
||||
if(row['A']){
|
||||
String city = "福州"//RegionData.formatCity(row['B'])
|
||||
if(city){
|
||||
def address = row['C']
|
||||
def address = row['A']
|
||||
// def region = row['C']
|
||||
println "[match] city:"+city+" address:"+address
|
||||
def jsonObject = OpenApiClient.addressMatch(city, address, "property", false, null, row['E'])
|
||||
def jsonObject = OpenApiClient.addressMatch(city, address, "property", false, null, null)
|
||||
if(jsonObject != null && jsonObject.precise!=-1) {
|
||||
row['I'] = jsonObject.get("district")
|
||||
row['J'] = jsonObject.get("name")
|
||||
@@ -554,6 +554,8 @@ class HailanTest {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
def stat(path){
|
||||
ExcelUtils.modify(path, { row ->
|
||||
if(row['L'] && !row['H']){
|
||||
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
package com.fangjia.script.chongqing
|
||||
|
||||
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||
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.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import groovy.sql.Sql
|
||||
|
||||
class RuiFenPocTest {
|
||||
|
||||
def startDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -3, "yyyyMM")) //202302
|
||||
def endDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); //202304
|
||||
|
||||
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
|
||||
def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse",
|
||||
"postgres", "postgres", "org.postgresql.Driver")
|
||||
|
||||
static main(args) {
|
||||
def task = new RuiFenPocTest();
|
||||
task.run();
|
||||
}
|
||||
|
||||
def run(){
|
||||
def inputfile = "D:\\数据\\瑞丰\\房产信息-地址V3-1.xlsx"
|
||||
// match(inputfile)
|
||||
// addValue(inputfile)
|
||||
|
||||
// addThirdPrice(inputfile)
|
||||
lastPrice(inputfile)
|
||||
}
|
||||
|
||||
|
||||
def lastPrice(inputfile){
|
||||
ExcelUtils.multiThreadingModify(inputfile, { row ->
|
||||
if(!row['X'] && row['S']){
|
||||
def mod = java.lang.Math.abs((row['S'].toString().toDouble()-row['H'].toString().toDouble())*100/row['H'].toString().toDouble())
|
||||
if(mod <= 10){
|
||||
row['U'] = row['H']
|
||||
}else{
|
||||
row['U'] = row['S']
|
||||
}
|
||||
}else{
|
||||
if(row['K']){
|
||||
row['U'] = row['K']
|
||||
}else{
|
||||
row['U'] = row['H']
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def addThirdPrice(path){
|
||||
def cityCodeMap = CcbCommonUtils.findCityCodeValue()
|
||||
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
def cityMap = findThirdPartyPrice(row['D'], row['E'], row['F'])
|
||||
def priceMap = cityMap.get(row['D']+"##"+row['E']+"##"+row['F'])
|
||||
if(priceMap){
|
||||
if(priceMap.containsKey("lianjia_esf_price")){
|
||||
row['L'] = priceMap.get("lianjia_esf_price")
|
||||
}
|
||||
|
||||
if(priceMap.containsKey("beike_esf_price")){
|
||||
row['M'] = priceMap.get("beike_esf_price")
|
||||
}
|
||||
|
||||
if(priceMap.containsKey("anjuke_esf_price")){
|
||||
row['N'] = priceMap.get("anjuke_esf_price")
|
||||
}
|
||||
}
|
||||
def map = findAvgPrice(row['I'], cityCodeMap.get(row['D']))
|
||||
if(map){
|
||||
row['O'] = map.avg_price
|
||||
row['P'] = map.credit_value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
def addValue(inputfile){
|
||||
ExcelUtils.multiThreadingModify(inputfile, { row ->
|
||||
def dist = CommonDatautils.findDistrictById(row['I'])
|
||||
if(dist){
|
||||
row["D"] = dist.city
|
||||
row["E"] = dist.region
|
||||
row["F"] = dist.name
|
||||
row["G"] = dist.address
|
||||
def priceObj = CommonDatautils.findDistrictPrice(dist.city, dist.region, dist.name)
|
||||
if(priceObj){
|
||||
row['H'] = priceObj.avg_price
|
||||
row['K'] = priceObj.avg_price_2b
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def match(path) {
|
||||
ExcelUtils.multiThreadingModify(path, { row ->
|
||||
def city = "绍兴"
|
||||
if (row['B'] && !row["D"]) {
|
||||
def address = row['B']
|
||||
println "[match] city:" + city + " address:" + address
|
||||
def jsonObject = OpenApiClient.addressMatch(city, address, "property", false, null, null)
|
||||
|
||||
if(!row["D"]){
|
||||
if (jsonObject != null && jsonObject.precise != -1) {
|
||||
row["D"] = jsonObject.city
|
||||
row["E"] = jsonObject.district
|
||||
row["F"] = jsonObject.name
|
||||
row["G"] = jsonObject.address
|
||||
row["I"] = jsonObject.id
|
||||
def priceObj = CommonDatautils.findDistrictPrice(jsonObject.city, jsonObject.district, jsonObject.name)
|
||||
if(priceObj){
|
||||
row['H'] = priceObj.avg_price
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (jsonObject != null && jsonObject.precise != -1) {
|
||||
if(row['J']){
|
||||
def str = jsonObject.city + " " + jsonObject.district + " " + jsonObject.name + " " + jsonObject.address + " " + jsonObject.id
|
||||
row['K'] = str
|
||||
}else{
|
||||
def str = jsonObject.city + " " + jsonObject.district + " " + jsonObject.name + " " + jsonObject.address + " " + jsonObject.id
|
||||
row['J'] = str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def findThirdPartyPrice(def city, def region, def name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("region", region)
|
||||
q.put("name", name)
|
||||
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 = [:]
|
||||
for(def db : dbcursor){
|
||||
def key = db.city+"##"+db.region+"##"+db.name
|
||||
def dataMap = map.get(key)
|
||||
if(!dataMap){
|
||||
dataMap = [:]
|
||||
map.put(key, dataMap)
|
||||
}
|
||||
|
||||
if(!dataMap.containsKey("anjuke_esf_price") && db.anjuke_esf_price && db.anjuke_esf_price>3000){
|
||||
dataMap.put("anjuke_esf_price", db.anjuke_esf_price)
|
||||
}
|
||||
if(!dataMap.containsKey("anjuke_esf_price") && db.get("58tc_esf_price") && db.get("58tc_esf_price")>3000){
|
||||
dataMap.put("anjuke_esf_price", db.get("58tc_esf_price"))
|
||||
}
|
||||
|
||||
if(!dataMap.containsKey("lianjia_esf_price") && db.lianjia_esf_price && db.lianjia_esf_price>3000){
|
||||
dataMap.put("lianjia_esf_price", db.lianjia_esf_price)
|
||||
}
|
||||
if(!dataMap.containsKey("cityhouse_esf_price") && db.cityhouse_esf_price && db.cityhouse_esf_price>3000){
|
||||
dataMap.put("cityhouse_esf_price", db.cityhouse_esf_price)
|
||||
}
|
||||
|
||||
if(!dataMap.containsKey("beike_esf_price") && db.beike_esf_price && db.beike_esf_price>3000){
|
||||
dataMap.put("beike_esf_price", db.beike_esf_price)
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
def findAvgPrice(def commid, def cityid){
|
||||
def sql = "SELECT gujia_bds_clc_avprc,gujia_bds_clmtd,gujiabds_clc_yrmo_val,gujia_bds_cfdc_dgr from t_app_p9pha_plda.avm_community_base_price_gj_h where urbn_id='${cityid}' and gujia_bds_id='${commid}' order by gujiabds_clc_yrmo_val desc limit 1"
|
||||
def map = [:]
|
||||
pgsqlInstance.eachRow(sql, { r ->
|
||||
map.avg_price = r.gujia_bds_clc_avprc
|
||||
map.type = r.gujia_bds_clmtd
|
||||
map.month = r.gujiabds_clc_yrmo_val
|
||||
map.credit_value = r.gujia_bds_cfdc_dgr
|
||||
if(r.gujia_bds_clmtd == 1){
|
||||
map.calc_type = "人工估值"
|
||||
}else if(r.gujia_bds_clmtd == 2){
|
||||
map.calc_type = "样本计算"
|
||||
}else if(r.gujia_bds_clmtd == 3){
|
||||
map.calc_type = "神经网络"
|
||||
}
|
||||
})
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+285
-2
@@ -1,11 +1,12 @@
|
||||
package com.fangjia.script.commData
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import net.sf.json.JSONArray
|
||||
import net.sf.json.JSONObject
|
||||
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
@@ -23,6 +24,12 @@ import com.mongodb.DBCollection
|
||||
import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.QueryOperators
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class CommonDatautils {
|
||||
|
||||
@@ -75,6 +82,17 @@ class CommonDatautils {
|
||||
|
||||
public static final DBCollection DISTRICT_ANALY_DATA_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_analy_data", "mongo.db.fangjia.com")
|
||||
|
||||
|
||||
static def DIRECTIONS = ["东北", "西北", "东南", "西南", "南北", "东西", "东", "南", "西", "北"]
|
||||
private static final HashMap<String, List<String>> FITMENTS_TYPES_MAPS = new HashMap<String, List<String>>()
|
||||
static{
|
||||
FITMENTS_TYPES_MAPS.put("毛坯", ["毛坯", "清水", "无装修", "独栋毛坯", "毛胚", "白坯", "旧装", "坯", "原房", "毛坏"])
|
||||
FITMENTS_TYPES_MAPS.put("简装", ["简装", "普通装修", "普通", "简单装修", "简易装修", "普装", "一般装修", "一般", "简", "粗装修"])
|
||||
FITMENTS_TYPES_MAPS.put("精装", ["精装", "全装修", "全装", "中等装修", "中装", "中档装修", "精致装修", "中档", "中等", "精", "中修", "优质装修", "时尚装修", "良装", "中高挡"])
|
||||
FITMENTS_TYPES_MAPS.put("豪装", ["豪华装修", "高档", "豪华", "豪装", "高级装修", "高装", "奢侈"])
|
||||
}
|
||||
|
||||
|
||||
public static DSCollection getHouseDataStoreConnection(){
|
||||
if(house_dataStoreConnection != null) {
|
||||
return house_dataStoreConnection
|
||||
@@ -3518,5 +3536,270 @@ class CommonDatautils {
|
||||
def analyData = DISTRICT_ANALY_DATA_COLL.findOne(q)
|
||||
return analyData
|
||||
}
|
||||
|
||||
|
||||
static 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(date_range).must(area_range)
|
||||
if(cat){
|
||||
queryBuilder.must(QueryBuilders.termQuery("cat", cat))
|
||||
}
|
||||
|
||||
if(!alias){
|
||||
alias = []
|
||||
}
|
||||
if(!alias.contains(name)){
|
||||
alias.add(name)
|
||||
}
|
||||
|
||||
|
||||
if(alias && alias.size()>0){
|
||||
BoolQueryBuilder inBuilder = QueryBuilders.boolQuery();
|
||||
for(def s : alias){
|
||||
inBuilder.should(QueryBuilders.matchQuery("district_name", s));
|
||||
}
|
||||
queryBuilder.must(inBuilder)
|
||||
}
|
||||
|
||||
|
||||
def rets = []
|
||||
def hosts = ["192.168.0.206","192.168.0.211","192.168.0.212","192.168.0.213","192.168.0.214","192.168.0.215"]
|
||||
def index = new Random().nextInt(5);
|
||||
|
||||
def houses = ElasticUtils.executeSimpleQuery(hosts[index], "seawater-20*", queryBuilder);
|
||||
|
||||
if(houses){
|
||||
for (int k=0;k<houses.size();k++) {
|
||||
def map = houses[k];
|
||||
DBObject seawater = new BasicDBObject(map)
|
||||
|
||||
if(estate_type2 && estate_type2=="普通住宅"){
|
||||
if(seawater.estate_type && (seawater.estate_type.contains("商住") || seawater.estate_type.contains("商业") || seawater.estate_type.contains("商务"))){
|
||||
// println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(seawater.estate_type&& seawater.estate_type.contains("别墅")){
|
||||
//// println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
|
||||
// continue;
|
||||
// }
|
||||
// def vallaFlag = isVilla(seawater.area, seawater.name, seawater.height, seawater.room)
|
||||
// if(vallaFlag){
|
||||
// continue;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
if(!seawater.total_price){
|
||||
continue;
|
||||
}
|
||||
if(!seawater.avg_price){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(seawater.height && seawater.height>60){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
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 rowMap = [:];
|
||||
|
||||
rowMap.houseId = seawater.id
|
||||
rowMap.area = seawater.area
|
||||
rowMap.address = seawater.address
|
||||
rowMap.total_price = seawater.total_price
|
||||
rowMap.avg_price = seawater.avg_price
|
||||
rowMap.build_type = seawater.build_type
|
||||
rowMap.build_date = seawater.build_date
|
||||
rowMap.district_name = seawater.district_name
|
||||
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
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
return rets;
|
||||
}
|
||||
|
||||
static def parseFloor(def floorDesc){
|
||||
if(floorDesc){
|
||||
floorDesc = floorDesc.replaceAll("[\\s ]+", "")
|
||||
if(floorDesc){
|
||||
Pattern pat1 = Pattern.compile("第(\\d{1,2})层");
|
||||
Matcher matcher1 = pat1.matcher(floorDesc);
|
||||
if (matcher1.find()) {
|
||||
return matcher1.group(1)
|
||||
}
|
||||
pat1 = Pattern.compile("(\\d{1,2})层?(/|\\()共?\\d{1,2}(层|F)?");
|
||||
matcher1 = pat1.matcher(floorDesc);
|
||||
if (matcher1.find()) {
|
||||
return matcher1.group(1)
|
||||
}
|
||||
// if(floorDesc.contains("中楼层") || floorDesc.contains("中层")){
|
||||
// return "中层"
|
||||
// }
|
||||
//
|
||||
// if(floorDesc.contains("高楼层") || floorDesc.contains("高层")){
|
||||
// return "高层"
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if(floorDesc.contains("低楼层") || floorDesc.contains("低层")){
|
||||
// return "低层"
|
||||
// }
|
||||
if(floorDesc.isNumber()){
|
||||
return floorDesc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String parseDirection(String directionDesc) {
|
||||
if (directionDesc == null) {
|
||||
return null
|
||||
}
|
||||
directionDesc = directionDesc.replaceAll("(\\(|(|《|\"|“|【|〔).+?(\\)|》|)|\"|”|】|〕)", "#_#")
|
||||
StringBuffer sb = new StringBuffer()
|
||||
for (int i = 0; i < directionDesc.length(); i++) {
|
||||
String c = directionDesc.substring(i, i + 1)
|
||||
if (DIRECTIONS.contains(c)) {
|
||||
if (directionDesc.substring(i).startsWith(c + "#_#")) {
|
||||
sb.append(c + " ")
|
||||
} else {
|
||||
sb.append(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String d : DIRECTIONS) {
|
||||
if (sb.toString().startsWith(d)) {
|
||||
return d
|
||||
}
|
||||
}
|
||||
for (String d : DIRECTIONS) {
|
||||
if (sb.toString().contains(d)) {
|
||||
return d
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
static String parseFitment(String fitmentDesc) {
|
||||
if (fitmentDesc == null) {
|
||||
return null
|
||||
}
|
||||
fitmentDesc = fitmentDesc.replaceAll("[\\s ]+", "")
|
||||
if (fitmentDesc.equals("非毛坯")) {
|
||||
return null
|
||||
}
|
||||
Iterator<Map.Entry<String, List<String>>> it = FITMENTS_TYPES_MAPS
|
||||
.entrySet().iterator()
|
||||
Map.Entry<String, List<String>> entry
|
||||
while (it.hasNext()) {
|
||||
entry = it.next()
|
||||
if (fitmentDesc.contains(entry.getKey())) {
|
||||
return entry.getKey()
|
||||
}
|
||||
for (String fitmentKey : entry.getValue()) {
|
||||
if (fitmentDesc.contains(fitmentKey)) {
|
||||
return entry.getKey()
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是别墅
|
||||
* @return
|
||||
*/
|
||||
public boolean isVilla(area, name, height, room) {
|
||||
if (area == null) {
|
||||
return false;
|
||||
}
|
||||
if (area >= 150 && StringUtils.indexOfAny(name, TAGS) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
if (height != null && room != null) {
|
||||
if (height <= 3) {
|
||||
if (area > 200 && room >= 5) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
} else if (height == null && room != null) {
|
||||
if (area > 360 && room >= 6) {
|
||||
ret = true;
|
||||
}
|
||||
} else if (height == null && room == null) {
|
||||
if (area > 500) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class FjtResponseTimeAnaly extends BaseBatch{
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
//run();
|
||||
jms.sendMail("gaojuan@fangjia.com", "测试发邮件", "收到了?")
|
||||
jms.sendMail("gaojuan@fangjia.com", "测试发邮件", "收到了2?")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
@@ -69,29 +70,43 @@ import com.mongodb.DBObject
|
||||
//
|
||||
//
|
||||
//})
|
||||
println "开始统计"
|
||||
def datas = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\成交\\202202.xlsx",0,1)
|
||||
def map = [:]
|
||||
for(def d : datas){
|
||||
def prices = map.get(d['B'])
|
||||
if(!prices){
|
||||
prices = []
|
||||
map.put(d['B'], prices)
|
||||
}
|
||||
prices << d['G']
|
||||
}
|
||||
|
||||
def regions = ["闵行","浦东","嘉定","普陀","青浦","静安","金山","松江","虹口","杨浦","奉贤","长宁","宝山","徐汇","崇明","黄浦"]
|
||||
def rows = []
|
||||
rows << ["区域","数量", "均价"]
|
||||
|
||||
regions.each{e->
|
||||
def prices = map.get(e)
|
||||
def price = (prices.sum()/prices.size()).toInteger()
|
||||
rows << [e, prices.size(), price]
|
||||
}
|
||||
//map.each{region,prices->
|
||||
// def price = (prices.sum()/prices.size()).toInteger()
|
||||
// rows << [region, prices.size(), price]
|
||||
//println "开始统计"
|
||||
//def datas = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\成交\\202202.xlsx",0,1)
|
||||
//def map = [:]
|
||||
//for(def d : datas){
|
||||
// def prices = map.get(d['B'])
|
||||
// if(!prices){
|
||||
// prices = []
|
||||
// map.put(d['B'], prices)
|
||||
// }
|
||||
// prices << d['G']
|
||||
//}
|
||||
ExcelUtils.write("C:\\Users\\gaojuan\\Desktop\\成交\\trend-2202.xlsx", rows, "结果")
|
||||
//
|
||||
//def regions = ["闵行","浦东","嘉定","普陀","青浦","静安","金山","松江","虹口","杨浦","奉贤","长宁","宝山","徐汇","崇明","黄浦"]
|
||||
//def rows = []
|
||||
//rows << ["区域","数量", "均价"]
|
||||
//
|
||||
//regions.each{e->
|
||||
// def prices = map.get(e)
|
||||
// def price = (prices.sum()/prices.size()).toInteger()
|
||||
// rows << [e, prices.size(), price]
|
||||
//}
|
||||
////map.each{region,prices->
|
||||
//// def price = (prices.sum()/prices.size()).toInteger()
|
||||
//// rows << [region, prices.size(), price]
|
||||
////}
|
||||
//ExcelUtils.write("C:\\Users\\gaojuan\\Desktop\\成交\\trend-2202.xlsx", rows, "结果")
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\其它\\城市等级.xlsx",{d->
|
||||
// d['C'] = RegionData.formatCity(d['A'])
|
||||
//})
|
||||
|
||||
DBCollection SERVER_AREA_CONN = MongoUtils.getCollectionByName("fangjia", "server_area", MongoUtils.MongoDB_Domain_mongo);
|
||||
ExcelUtils.modify("D:\\数据\\其它\\城市等级.xlsx",{d->
|
||||
def q = new BasicDBObject()
|
||||
q.put("display", d['C'])
|
||||
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("new_city_grade",d['E'].toString().toDouble().toInteger())
|
||||
SERVER_AREA_CONN.update(q, new BasicDBObject('$set', udata))
|
||||
})
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.fangjia.script.gj.district
|
||||
|
||||
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.util.DbUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/**
|
||||
* 通过房源更改电梯
|
||||
*/
|
||||
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class AddDistrictElevatorBatch extends BaseBatch{
|
||||
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(60)
|
||||
|
||||
|
||||
static main(args) {
|
||||
runBatch(new AddDistrictElevatorBatch(), args)
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void process(Object args) {
|
||||
run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
for(def c : citys){
|
||||
def dists = CommonDatautils.findAllDistricts(c, "district", ["city","region","name","alias", "build_type", "estate_type2", "is_elevator"])
|
||||
addEvevatorProcess(c, dists)
|
||||
}
|
||||
}
|
||||
|
||||
def addEvevatorProcess(c, dists){
|
||||
def totalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(dists.size())
|
||||
println "小区量:"+dists.size()
|
||||
|
||||
def rets = new CopyOnWriteArrayList()
|
||||
for(def i=0;i<dists.size();i++){
|
||||
final def dist = dists[i];
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try {
|
||||
totalCount.addAndGet(1)
|
||||
if(!dist.is_elevator){
|
||||
def houses = CommonDatautils.findHouses(dist.city, dist.region, null, 20200101, 20230701, dist.name, dist.alias, dist.estate_type2)
|
||||
def haveHouses = []
|
||||
for(def h : houses){
|
||||
if(h.height){
|
||||
haveHouses << h
|
||||
}
|
||||
}
|
||||
def newHouses = analyElevator(haveHouses, dist.estate_type2)
|
||||
if(newHouses && newHouses.size()>=3 && newHouses.size()>=haveHouses.size()*0.6){
|
||||
println totalCount.get()+" [${dist.estate_type2}] "+dist.name +" 原:"+houses.size()+" 有值:"+haveHouses.size()+" 10层以上:"+newHouses.size()
|
||||
BasicDBObject udata = new BasicDBObject()
|
||||
if(dist.estate_type2 == "别墅"){
|
||||
udata.put("is_elevator", false)
|
||||
}else{
|
||||
udata.put("is_elevator", true)
|
||||
}
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject('_id', dist._id),new BasicDBObject('$set',udata))
|
||||
rets << dist
|
||||
}else{
|
||||
if(dist.build_type && dist.build_type.contains("高层")){
|
||||
BasicDBObject udata = new BasicDBObject('is_elevator',true)
|
||||
udata.put("m_date", new Date())
|
||||
DbUtils.seaweed.update(new BasicDBObject('_id', dist._id),new BasicDBObject('$set',udata))
|
||||
rets << dist
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
latch.await()
|
||||
println c +" "+ rets.size()
|
||||
// return retMap
|
||||
}
|
||||
|
||||
def analyElevator(houses, estateType){
|
||||
def heights = []
|
||||
for(def h : houses){
|
||||
if(estateType=="别墅"){
|
||||
if(h.height && h.height<=4) {
|
||||
heights << h.height
|
||||
}
|
||||
}else{
|
||||
if(h.height && h.height>=10){
|
||||
heights << h.height
|
||||
}
|
||||
}
|
||||
}
|
||||
return heights
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
* 小区字段入库(自动入库)
|
||||
* 小区字段填充入库(自动入库)
|
||||
*/
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class DistrictFieldAddBatch extends BaseBatch{
|
||||
|
||||
+43
-1
@@ -4,6 +4,7 @@ import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.looplineinfo.InsidePolygon
|
||||
import com.fangjia.script.looplineinfo.Point
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
@@ -15,7 +16,48 @@ class SameDistName {
|
||||
|
||||
static main(args) {
|
||||
def task = new SameDistName()
|
||||
task.run()
|
||||
// task.run()
|
||||
//地址和地址别名完全一致
|
||||
// task.addressPocess()
|
||||
}
|
||||
|
||||
|
||||
|
||||
def addressPocess(){
|
||||
def citys = CommonDatautils.findAllCity();
|
||||
|
||||
for(def c : citys){
|
||||
def dists = CommonDatautils.findAllDistrictByCity(c, "district", ["city","region", "name", "address","addr_alias"])
|
||||
if(dists){
|
||||
def index = 0
|
||||
for(def dist : dists){
|
||||
if(dist.address){
|
||||
// if(dist.address.toString().endsWith("弄")){
|
||||
// dist.address = dist.address.toString().replace("弄","号")
|
||||
// }
|
||||
if(dist.addr_alias && dist.addr_alias.contains(dist.address)){
|
||||
def new_address_alias = []
|
||||
for(def addr : dist.addr_alias){
|
||||
if(!new_address_alias.contains(addr) && addr!=dist.address){
|
||||
new_address_alias << addr
|
||||
}
|
||||
}
|
||||
index ++
|
||||
|
||||
println "[${index}] "+dist.city +" "+dist.name+" 旧:"+dist.addr_alias+" 新:"+ new_address_alias
|
||||
|
||||
def d = new BasicDBObject()
|
||||
d.put("_id", dist._id)
|
||||
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("m_date", new Date())
|
||||
udata.put("addr_alias", new_address_alias)
|
||||
DbUtils.seaweed.update(d, new BasicDBObject('$set', udata))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def run(){
|
||||
|
||||
Reference in New Issue
Block a user