diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/DataMigration.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/DataMigration.groovy index 7b8e5ff28..7f1f66d47 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/DataMigration.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/DataMigration.groovy @@ -31,26 +31,60 @@ class DataMigration { public static final DBCollection STA = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com"); public static final DBCollection UN_RELATION = MongoUtils.getCollectionByName("fangjia", "un_relation", "mongo.db.fangjia.com"); static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") + + public static DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("fangjia_log", "calc_command", "192.168.0.42", 52002) + static main(args) { - DBCursor cursor = DEAL_PRICE_COLL.find().batchSize(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT); - DBObject dbo - int i =0 - while(cursor.hasNext()){ - i++ - dbo = cursor.next() - if(dbo.get("total_price") instanceof Double){ - dbo.put("total_price", dbo.get("total_price").toString().toDouble().toInteger()) - dbo.put("c_date",new Date()) - DEAL_PRICE_COLL.save(dbo); - } - - if(i%10000==0){ - println i + + DBCursor cursor = COMMAND_COLL.find().addOption(Bytes.QUERYOPTION_NOTIMEOUT); + def list = [] + for(def o : cursor){ + def key = o.city +"##"+o.region+"##"+o.name + if(!list.contains(key)){ + list << key + def q = new BasicDBObject("city", o.city).append("region", o.region).append("district_name", o.name) + DBCursor dealpriceCursor = DEAL_PRICE_COLL.find(q) + for(def dl : dealpriceCursor){ + if(dl.get("hall")){ + if(dl.get("hall") instanceof String){ + println dl._id.toString() +" hall 为字符串" + def dbo = new BasicDBObject() + dbo.put("hall", dl.get("hall").toString().toInteger()) + DEAL_PRICE_COLL.update(new BasicDBObject("_id", dl._id), new BasicDBObject('$set', dbo)) + } + }else{ + if(!dl.get("area")){ + println dl._id.toString() +" 面积为空" + DEAL_PRICE_COLL.remove(new BasicDBObject("_id", dl._id)) + } + } + } } + } - - - + + + + + + +// DBCursor cursor = DEAL_PRICE_COLL.find().batchSize(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT); +// DBObject dbo +// int i =0 +// while(cursor.hasNext()){ +// i++ +// dbo = cursor.next() +// if(dbo.get("total_price") instanceof Double){ +// dbo.put("total_price", dbo.get("total_price").toString().toDouble().toInteger()) +// dbo.put("c_date",new Date()) +// DEAL_PRICE_COLL.save(dbo); +// } +// +// if(i%10000==0){ +// println i +// } +// } + } // migration(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy index 88eb4cbd3..adabfcbcc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy @@ -1,6 +1,6 @@ package com.fangjia.script.ccbevaluation - +import com.fangjia.script.util.DateUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject @@ -9,7 +9,7 @@ import com.mongodb.DBCollection * 深圳公众号成交数据录入 */ -def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\2025年5月深圳成交明细.xlsx", 0, 1) +def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳6月份成交数据.xlsx", 0, 1) def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) @@ -73,18 +73,18 @@ for(def d : datas){ } - map.area = d['F'].replace("平","").toString().toDouble() - map.total_price = (int)(d['G'].replace("万","").toString().toDouble().toInteger()*10000) - map.avg_price = (int)(d['H'].replace("元/平","").toString().toDouble()) + map.area = d['F'].toString().toDouble() + map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000) + map.avg_price = (int)(d['H'].toString().toDouble()) if(d['I']){ - map.sell_price = (int)(d['I'].replace("万","").toString().toDouble()*10000) + map.sell_price = (int)(d['I'].toString().toDouble()*10000) } - map.trade_date = d['J'] -// def trade_date = d['J'] -// if(trade_date){ -// map.trade_date = DateUtils.parseFromTightByPattern(trade_date,'yyyy/MM/dd') -// } +// map.trade_date = d['J'] + def trade_date = d['J'] + if(trade_date){ + map.trade_date = DateUtils.parseFromTightByPattern(trade_date,'yyyy/MM/dd') + } // else{ // def trade_date1 = DateUtils.getRandomDate("2024-03-01", "2024-03-31") // map.trade_date = DateUtils.parseFromTightByPattern(trade_date1, "yyyy-MM-dd") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy index 09de965da..16aa473be 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy @@ -43,6 +43,13 @@ class DistrictSellStatBatch extends BaseBatch { @Override void process(Object args) { +// def months = DateUtils.getMonthList(202206) +// months = months[0..(months.size()-2)] +// println months +// for(def month : months){ +// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") +// calcMonthlyPrice(curDate) +// } calcMonthlyPrice() } @@ -63,21 +70,24 @@ class DistrictSellStatBatch extends BaseBatch { return calendar.getTime().format("yyyyMM").toInteger() } - def calcMonthlyPrice(){ + def calcMonthlyPrice(curDate){ //只有福州使用tob价格,改为所有城市都使用2B价格,除人工指导价除外 - def citys = CommonUtils.findAllCity() + if(!curDate){ + curDate = new Date() + } + def citys = ["福州"]//CommonUtils.findAllCity() def keys = new BasicDBObject("city", 1).append("name", 1).append("region", 1).append("estate_type2", 1).append("status", 1) - def lastMonthWeekend = DateUtils.truncateDay(DateUtils.getLastSundayInWeekOfLastMonth(new Date())) + def lastMonthWeekend = DateUtils.truncateDay(DateUtils.getLastSundayInWeekOfLastMonth(curDate)) - def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); + def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(curDate, "yyyyMM"), -1, "yyyyMM")); def monDate = getMomDate(curMonth) def yoyDate = getYoyDate(curMonth) def day = new Date().getDate() - def startMDate = DateUtils.truncateDay(new Date()-7) - def endMDate = DateUtils.truncateDay(new Date()) + def startMDate = DateUtils.truncateDay(curDate-7) + def endMDate = DateUtils.truncateDay(curDate) def index = 0 for(def city : citys){ @@ -85,7 +95,7 @@ class DistrictSellStatBatch extends BaseBatch { index++ def districts = [] if(city == "福州"){ - if(day == 2){ + if(day == 12){ districts = FZ_DIST_COLL.find(new BasicDBObject("city", city), keys).toList() }else{ districts = FZ_DIST_COLL.find(new BasicDBObject("city", city).append("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)), keys).toList() @@ -101,10 +111,10 @@ class DistrictSellStatBatch extends BaseBatch { } } - println index+" "+city +" "+districts.size()+" "+ (new Date()).toString() + println index+" "+city +" "+districts.size()+" "+ curDate.toString() - def startDate = DateUtils.getFirstDayOfMonth(new Date(), -1); - def endDate = DateUtils.getLastDayOfMonth(new Date(), -1); + def startDate = DateUtils.getFirstDayOfMonth(curDate, -1); + def endDate = DateUtils.getLastDayOfMonth(curDate, -1); if(districts.size()>0){ def weekendPriceMap = findPriceMap(city, startDate, endDate)//上个月小区均价 def curMonthlyPriceMap = findMonthlyPrice(city, curMonth)//当月小区月均价 @@ -141,13 +151,13 @@ class DistrictSellStatBatch extends BaseBatch { final CountDownLatch latch = new CountDownLatch(districts.size()) def rets = new CopyOnWriteArrayList() - districts.each{dist-> + for(def i=0;i3){ - def randMarkup = nextDouble(0, 3) + if(Math.abs(mom)*100>8){ + def randMarkup = nextDouble(5, 8) if(mom < 0){ mom = DataUtil.roundDouble(randMarkup*(-1)/100, 4) }else{ @@ -192,7 +202,7 @@ class DistrictSellStatBatch extends BaseBatch { } double yoy = 0d - if(lastYearPriceObj){ + if(lastYearPriceObj && lastYearPriceObj.avg_price>0){ yoy = DataUtil.roundDouble(((curPrice - lastYearPriceObj.avg_price)/(double)lastYearPriceObj.avg_price),4) } @@ -215,7 +225,7 @@ class DistrictSellStatBatch extends BaseBatch { q.put("commid", dist._id.toString()) DISTRICT_SELL_STAT.update(q , new BasicDBObject('$set', data),true,false) // DISTRICT_SELL_STAT.update(new BasicDBObject("_id", curPriceObj._id) , new BasicDBObject('$set', data),true,false) - println "[update]"+totalCount.get()+" "+ dist.city+" "+dist.name + println curMonth+" [update]"+totalCount.get()+" "+ dist.city+" "+dist.name } }else{ def data = new BasicDBObject() @@ -232,7 +242,7 @@ class DistrictSellStatBatch extends BaseBatch { data.put("mom", mom) data.put("yoy", yoy) DISTRICT_SELL_STAT.save(data) - println "[save]"+totalCount.get()+" "+ dist.city+" "+dist.name + println curMonth+" [save]"+totalCount.get()+" "+ dist.city+" "+dist.name } } @@ -265,18 +275,18 @@ class DistrictSellStatBatch extends BaseBatch { def findPriceMap(city, startDate, endDate){ def q = new BasicDBObject() q.put("city", city) -// q.put("district_name","金福花园") +// q.put("district_name","长春铺") q.put("weekend", new BasicDBObject('$lte', endDate).append('$gte', startDate)) def dbcursor = DISTRICT_STAT.find(q).sort(new BasicDBObject().append("weekend", -1)) def priceMap = [:] for(def d : dbcursor){ - if(!priceMap.containsKey(d.region +"##"+d.district_name+"##"+d.estate_type)){ + if(!priceMap.containsKey(d.region +"##"+d.district_name)){ if(city == "福州"){ if(d.avg_price_2b && d.value_type!=1){ d.avg_price = d.avg_price_2b } } - priceMap.put(d.region +"##"+d.district_name+"##"+d.estate_type, d) + priceMap.put(d.region +"##"+d.district_name, d) } } return priceMap @@ -289,11 +299,7 @@ class DistrictSellStatBatch extends BaseBatch { def dbcursor = DISTRICT_SELL_STAT.find(q) def priceMap = [:] for(def d : dbcursor){ - if(d.estate_type=="别墅"){ - priceMap.put(d.region +"##"+d.district_name+"##别墅", d) - }else{ - priceMap.put(d.region +"##"+d.district_name+"##小区", d) - } + priceMap.put(d.region +"##"+d.district_name, d) } return priceMap diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy index 139a37980..3b3d636e4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy @@ -29,11 +29,11 @@ class FzDataResultStat { static main(args) { def task = new FzDataResultStat() -// task.priceMarkupRun(); + task.priceMarkupRun(); // task.regionPriceTrendRun() //// task.margeExcel() // task.saveCsvData() - task.testNewPrice() +// task.testNewPrice() } def margeExcel(){ @@ -82,7 +82,7 @@ class FzDataResultStat { } // List list2 = FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${lastMonth}.csv")) - def list2 = findFzDistrictStat(Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -4, "yyyyMM"))) + def list2 = findFzDistrictStat(Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"))) def map2 = [:] for(def obj : list2) { def key = obj.city + "##" + obj.region + "##" + obj.name @@ -119,7 +119,7 @@ class FzDataResultStat { index++ println row } - ExcelUtils.write("D:\\数据\\福州\\价格比对5_${curMonth}.xlsx", rows, "数据") + ExcelUtils.write("D:\\数据\\福州\\价格比对_${curMonth}.xlsx", rows, "数据") def regions = ["鼓楼","仓山","台江","晋安","马尾","长乐"]; diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy index 2fc6f160d..673aa591a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy @@ -17,6 +17,7 @@ import org.apache.commons.io.FileUtils import org.bson.types.ObjectId DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") +DBCollection dist_stat_coll = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") import com.fangjia.core.util.HttpRequest @@ -117,15 +118,15 @@ import com.fangjia.core.util.HttpRequest - -def findThirdPrice(city, region, name, AVERAGE_STATISTICS){ - def q = new BasicDBObject() - q.put("city", city) - q.put("region", region) - q.put("name", name) - q.put("s_date", 202304) - return AVERAGE_STATISTICS.findOne(q) -} +// +//def findThirdPrice(city, region, name, AVERAGE_STATISTICS){ +// def q = new BasicDBObject() +// q.put("city", city) +// q.put("region", region) +// q.put("name", name) +// q.put("s_date", 202304) +// return AVERAGE_STATISTICS.findOne(q) +//} //DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com") //def datas = FileUtils.readLines("D:\\数据\\其它\\FJW_COMM_20221015.csv") @@ -236,25 +237,32 @@ def findThirdPrice(city, region, name, AVERAGE_STATISTICS){ //},0) -def files = CommonDatautils.getAllFiles("D:\\数据\\福州\\原始数据") -if(files){ - for(def filepath : files){ - def filename = filepath.getPath() - def rets = read(filename); - def date = filename.substring(filename.toString().lastIndexOf("_")+1, filename.toString().indexOf(".")) - println date +" "+rets.size() +//def files = CommonDatautils.getAllFiles("D:\\数据\\福州\\原始数据") +//if(files){ +// for(def filepath : files){ +// def filename = filepath.getPath() +// def rets = read(filename); +// def date = filename.substring(filename.toString().lastIndexOf("_")+1, filename.toString().indexOf(".")) +// println date +" "+rets.size() +// } +//} +// +// +//def read(path){ +// File file = new File(path); +// def rets = [] +// file.eachLine{it-> +// rets << it +// } +// return rets; +//} + +ExcelUtils.multiThreadingModify("D:\\数据\\福州\\福州价格比对.xlsx",{d-> + def obj = dist_stat_coll.findOne(new BasicDBObject("city", d['B']).append("region",d['C']).append("district_name",d['D']).append("weekend",DateUtils.parseFromTightYYYYMMDD("2025-06-29"))) + if(obj){ + d['H'] = obj.avg_price_2b } -} - - -def read(path){ - File file = new File(path); - def rets = [] - file.eachLine{it-> - rets << it - } - return rets; -} +}) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy index f391d5dad..e923d8d61 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy @@ -14,7 +14,7 @@ import com.mongodb.DBCollection //福州第三方均价统计,发送钉钉消息 //def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1) //def datas = CsvUtils.read("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv"); -def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202403.csv") +def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202506.csv") def count0 = 0 def count1 = 0 def count2 = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AddDevShapeData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AddDevShapeData.groovy index a605dcc02..cc5d6fce6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AddDevShapeData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AddDevShapeData.groovy @@ -189,7 +189,7 @@ class AddDevShapeData { def run(){ - def directoryPath = 'D:\\数据\\数据建设\\开发区外包\\623西安' + def directoryPath = 'D:\\数据\\数据建设\\开发区外包\\0812' def dir = new File(directoryPath) if (dir.isDirectory()) { dir.eachFileRecurse(FileType.FILES) { file -> @@ -300,7 +300,7 @@ class AddDevShapeData { areaMap.count = coordinates.size() def areas = [] - if(name.contains("陕西蓝田工业园")){ +// if(name.contains("陕西蓝田工业园")){ for(def pointList : coordinates){ index ++ def gaode_coordinates = [] @@ -343,7 +343,7 @@ class AddDevShapeData { } areaMap.area_info = areas.join("\n") - } +// } }else{ println file +" 有多个" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy index 671266e38..50ec412b8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy @@ -33,8 +33,8 @@ class DevUpdateTestBatch { static main(args) { def task = new DevUpdateTestBatch() def path = "D:\\数据\\数据建设\\开发区\\开发区-园区.xlsx"//开发区-园区.xlsx - task.addDev(path) -// task.addDevAddress(path) +// task.addDev(path) + task.addDevAddress(path) // // task.updateHasGov("新疆维吾尔自治区","喀什地区","麦盖提县", "麦盖提镇", "是") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy index 5c6e27c8a..225203124 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy @@ -26,14 +26,16 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ @Override public void process(Object args) { def indexName = "administrative_mapping" - def retMap = synchAdminiMappingTo100() + synchAdminiMappingTo100() + + def retMap = getAdminiMappingTo100() synchToEs(retMap, "192.168.0.89", indexName) synchToEs(retMap, "192.168.0.52", indexName) println(" 运行完成") } - def synchAdminiMappingTo100(city){ + def synchAdminiMappingTo100(){ //删除旧的,再同步新的 ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject()) @@ -45,7 +47,7 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ for(def d : dbcursor){ datas << d retMap.put(d._id.toString(), d) - if (datas.size() >= 2000) { + if (datas.size() >=1000) { ADMINISTRATIVE_MAPPING_COLL_100.insert(datas); datas.clear(); } @@ -59,6 +61,23 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ return retMap; } + + def getAdminiMappingTo100(){ + def q = new BasicDBObject() + def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q).batchSize(2000) + def datas = [] + def retMap = [:] + for(def d : dbcursor){ + datas << d + retMap.put(d._id.toString(), d) + if(retMap.size()%10000==0){ + print "." + } + + } + return retMap; + } + def synchToEs(retMap, host, indexName){ QueryBuilder queryBuilder = QueryBuilders.boolQuery() // queryBuilder.must(QueryBuilders.termQuery("street", "喀拉玛盖镇")) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy index 9eaa268fc..d5721c96e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy @@ -22,9 +22,9 @@ import java.util.concurrent.atomic.AtomicLong class AddPriceTest { public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50) - - def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse", - "postgres", "postgres", "org.postgresql.Driver") +// +// def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse", +// "postgres", "postgres", "org.postgresql.Driver") //235为房价网内部计算均价的库 def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified", @@ -38,15 +38,15 @@ class AddPriceTest { task.run(); } def run(){ - def filePath = "D:\\数据\\价格\\惠州.xlsx" + def filePath = "D:\\数据\\福州\\福州价格比对.xlsx" // addGXDPrice(filePath) -// addCcbPrice(filePath) + addCcbPrice(filePath) // addThirdPrice(filePath) // addFjwPrice(filePath) // exportPkPrice() // addRegion() // addTradePrice(filePath) - addThirdSamplePrice("D:\\数据\\建行\\房产估值\\指导价\\级联、国信达价格导入_0313.xlsx") +// addThirdSamplePrice("D:\\数据\\建行\\房产估值\\指导价\\级联、国信达价格导入_0313.xlsx") } @@ -218,19 +218,19 @@ class AddPriceTest { ExcelUtils.multiThreadingModify(filepath,{ d-> if(d['A']){ def cityId = cityCodeDataMap.get(d['B']) - def map = findAvgPrice(d['A'], cityId) - if(map){ - d['I'] = map.avg_price - d['J'] = map.month -// d['H'] = map.calc_type -// d['AM'] = map.credit_value - } +// def map = findAvgPrice(d['A'], cityId) +// if(map){ +// d['I'] = map.avg_price +// d['J'] = map.month +//// d['H'] = map.calc_type +//// d['AM'] = map.credit_value +// } - def newPriceMap = findNewFjwAvgPrice(d['A'], cityId) + def newPriceMap = findNewFjwAvgPrice2(d['A'], cityId, 202506) if(newPriceMap){ - d['G'] = newPriceMap.avg_price - d['H'] = newPriceMap.month - d['H'] = map.calc_type + d['I'] = newPriceMap.avg_price +// d['H'] = newPriceMap.month +// d['H'] = map.calc_type // d['AM'] = map.credit_value } } @@ -277,6 +277,27 @@ class AddPriceTest { return map } + + + def findNewFjwAvgPrice2(def commid, def cityid, def sdate){ + def sql = "SELECT gujia_bds_clc_avprc,gujia_bds_clmtd,gujiabds_clc_yrmo_val,gujia_bds_cfdc_dgr from price_stat.avm_community_base_price where urbn_id='${cityid}' and gujia_bds_id='${commid}' and gujiabds_clc_yrmo_val=${sdate}" + def map = [:] + pgsqlInstance235.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 + } + def addThirdPrice(filepath){ ExcelUtils.multiThreadingModify(filepath, { d -> if (!d['X']) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/linxsh/util/AddressUtil.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/linxsh/util/AddressUtil.groovy index 1c928ddaa..ab83090b7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/linxsh/util/AddressUtil.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/linxsh/util/AddressUtil.groovy @@ -296,7 +296,8 @@ class AddressUtil { } public static void main(String[] args){ - def addr = AddressUtil.formatAddress("福州", "北三环路201号琴亭信和小区") + AddressUtil.initCityMap() +// def addr = AddressUtil.formatAddress("福州", "北三环路201号琴亭信和小区") } }