From 657d058394f97aa54bbdae827d08724dd0cbe04f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 20 Aug 2024 16:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=88=BF=E4=BA=A7=E8=B6=85=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccbevaluation/AddThirdPriceSample.groovy | 40 +++++++++ .../fangjia/script/ccbevaluation/Test.groovy | 84 +++++++++++++------ .../ccbevaluation/ThirdPartyPriceBatch.groovy | 9 ++ .../script/gj/data_handle/MinglujiData.groovy | 35 +++++--- 4 files changed, 129 insertions(+), 39 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy new file mode 100644 index 000000000..d1ec16934 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy @@ -0,0 +1,40 @@ +package com.fangjia.script.ccbevaluation + +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 + +/** + * 将国信达及成交对标数据加入到第三方均价表,做为均价参考 + */ +class AddThirdPriceSample { + + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + + static main(args) { + def task = new AddThirdPriceSample() + task.run() + } + def run(){ + for(def i=1;i<19;i++){ + ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\级联待优化小区集合_7月.xlsx",{d-> + if(d['A'] && d['C']){ + def dist = CommonDatautils.findDistrictById(d['A'].toString().trim()) + if(dist){ + def q = new BasicDBObject("city", dist.city).append("region", dist.region).append("name", dist.name).append("s_date", 202407) + def udata = new BasicDBObject("zhongyuan_esf_price", d['C'].toString().toDouble().toInteger()) + + AVERAGE_STATISTICS.update(q,new BasicDBObject('$set', udata),false, false) + }else{ + println d['A'] +" 没查到" + } + } + }, i) + + println(i) + } + + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy index 13a46482e..0d36523e6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy @@ -612,9 +612,9 @@ def findAllData(sqlInstance236, citycode){ ////},0) // -//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\二期\\252个城市删除小区.xlsx",{d-> +//ExcelUtils.multiThreadingModify("D:\\数据\\建行\\房产估值\\删除小区.xlsx",{d-> // if(d['A']){ -// def dbo = CommonDatautils.findDistrictById(d['D']) +// def dbo = CommonDatautils.findDistrictById(d['A']) // if(dbo){ // def udata = new BasicDBObject() //// udata.put("name_cat", 11) @@ -630,6 +630,38 @@ def findAllData(sqlInstance236, citycode){ // } //},0) + +ExcelUtils.modify("D:\\数据\\建行\\房产估值\\添加别名.xlsx",{d-> + if(d['A'] && d['B']){ + def dbo = CommonDatautils.findDistrictById(d['A']) + if(dbo){ + def alias = null + if(!dbo.alias){ + alias = [] + }else{ + alias = dbo.alias + } + if(!alias.contains(d['B'])){ + alias << d['B'] + } + if(alias){ + def udata = new BasicDBObject() + udata.put("alias", alias) + udata.put("m_date",new Date()) + + def q = new BasicDBObject() + q.put("_id", dbo._id) + DbUtils.seaweed.update(q, new BasicDBObject('$set', udata)) + }else{ + println d['A']+" "+"别名已存在" + } + + }else{ + println dbo._id.toString() +" 没找到" + } + } +}) + //def citys = ["海口","三亚","三沙","五指山","琼海","儋州","文昌","万宁","东方","定安","屯昌","澄迈","临高","白沙","昌江","乐东","陵水","保亭","琼中"] //for(def c : citys){ // def districts = CommonDatautils.findAllDistrictByCity(c, "district", ["city","name"]) @@ -1299,34 +1331,34 @@ def findAvgPrice(def commid, def pgsqlInstance, def cityid){ -def fileName = "D:\\数据\\建行\\房产估值\\指导价\\20240806--国信达价格录入.xlsx" - -ExcelUtils.multiThreadingModify(fileName, {d-> - if(d['J']){ -// def region = RegionData.formatRegion(d['A'], d['J']) -// if(region){ -// def dist = CommonDatautils.findDistrict(d['A'], region, d['K'], "district") +//def fileName = "D:\\数据\\建行\\房产估值\\指导价\\20240806--国信达价格录入.xlsx" +// +//ExcelUtils.multiThreadingModify(fileName, {d-> +// if(d['J']){ +//// def region = RegionData.formatRegion(d['A'], d['J']) +//// if(region){ +//// def dist = CommonDatautils.findDistrict(d['A'], region, d['K'], "district") +//// if(dist){ +//// d['B'] = dist.region +//// d['C'] = dist.name +//// d['L'] = dist.status-dist.name_cat +//// } +//// } +//// if(d['J'] instanceof String){ +// def dist = CommonDatautils.findDistrictById(d['J']) // if(dist){ +// d['A'] = dist.city // d['B'] = dist.region // d['C'] = dist.name -// d['L'] = dist.status-dist.name_cat +// d['K'] = dist.estate_type2 +// d['L'] = dist.status +// d['M'] = dist.name_cat +// +//// d['H'] = dist.name // } -// } -// if(d['J'] instanceof String){ - def dist = CommonDatautils.findDistrictById(d['J']) - if(dist){ - d['A'] = dist.city - d['B'] = dist.region - d['C'] = dist.name - d['K'] = dist.estate_type2 - d['L'] = dist.status - d['M'] = dist.name_cat - -// d['H'] = dist.name - } -// } - } -},0) +//// } +// } +//},0) //def file = "D:\\数据\\建行\\房产估值\\指导价\\5城价格翻新6-21.xlsx" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy index 52fd3ddb2..5f5a53f33 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy @@ -257,6 +257,9 @@ class ThirdPartyPriceBatch extends BaseBatch { if(third.get("5i5j_esf_price")){ price_map.wiwj_avg_price = third.get("5i5j_esf_price") } + if(third.get("fccs_esf_price")){ + price_map.fccs_avg_price = third.get("fccs_esf_price") + } dataMap.updatetime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") allRows << dataMap } @@ -303,6 +306,8 @@ class ThirdPartyPriceBatch extends BaseBatch { web = "房多多" }else if(k=="wiwj_avg_price"){ web = "我爱我家" + }else if(k=="fccs_avg_price"){ + web = "房产超市" } ret << sourceMap.get(web) @@ -584,6 +589,10 @@ class ThirdPartyPriceBatch extends BaseBatch { if(!dataMap.get("5i5j_esf_price") && db.get("5i5j_esf_price") && db.get("5i5j_esf_price")>3000){ dataMap.put("5i5j_esf_price", db.get("5i5j_esf_price")) } + + if(!dataMap.get("fccs_esf_price") && db.get("fccs_esf_price") && db.get("fccs_esf_price")>3000){ + dataMap.put("fccs_esf_price", db.get("fccs_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) // } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy index e68ef59b1..0ae018d53 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy @@ -35,7 +35,7 @@ class MinglujiData { } def matchDev(prov, city){ def devs = loadAllDevs(prov) - ExcelUtils.modify("D:\\数据\\数据建设\\名录集\\${city}.xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\${city}.xlsx",{d-> if(d['E'] && !d['N'] ){ def obj = findDevByName(d['E']) if(!obj){ @@ -67,8 +67,8 @@ class MinglujiData { } def matchCommunity(city){ - ExcelUtils.modify("D:\\数据\\数据建设\\名录集\\${city}.xlsx",{d-> - if(d['A'] && d['B'] && d['L'] && !d['Q'] && d['L']=="东村委会"){ + ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\名录集\\${city}-5.xlsx",{d-> + if(d['A'] && d['B'] && d['L'] && !d['Q']){ def list = findCommunityByName(d['A'], d['B'], d['L']) if(!list){ list = findCommunityBySimlar(d['A'], d['B'], d['L']) @@ -97,7 +97,7 @@ class MinglujiData { } } } - }) + }, 0) } def loadAllDevs(prov){ @@ -110,19 +110,28 @@ class MinglujiData { name = name.replace("经济开发区", "经济技术开发区").replace("工业园区", "工业园") def last = null for(def d : devs){ - def alias = null + def alias1 = null if(!d.alias){ - alias = [] + alias1 = [] }else{ - alias = d.alias + alias1 = d.alias } - alias << d.name - for(def n : alias){ - n = n.replace("经济开发区", "经济技术开发区").replace("工业园区", "工业园") - if(d.city && d.city.contains(city) && (n.contains(name) || name.contains(n))){ - last = d - break + if(!alias1.contains(d.name)){ + alias1 << d.name + } + if(alias1){ + try { + for(def n : alias1){ + n = n.replace("经济开发区", "经济技术开发区").replace("工业园区", "工业园") + if(d.city && d.city.contains(city) && (n.contains(name) || name.contains(n))){ + last = d + break + } + } + }catch(exception){ + println alias1 } + } if(last){ break