diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml
index f398b19eb..698a360f2 100644
--- a/projects/fangjia-script/pom.xml
+++ b/projects/fangjia-script/pom.xml
@@ -597,6 +597,10 @@
-
+
+ mysql
+ mysql-connector-java
+ 8.0.33
+
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy
index 88194c547..e327733ab 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy
@@ -52,6 +52,9 @@ class CcbCommonUtils {
public static def pgsqlInstance = null //Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse","postgres", "postgres", "org.postgresql.Driver")
+ //235为房价网内部计算均价的库
+ public static def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified",
+ "postgres", "Goojia123456", "org.postgresql.Driver")
public static def getRunningCitys(def args){
def citys = []
@@ -728,6 +731,26 @@ class CcbCommonUtils {
return map
}
+
+ public static def findNewFjwAvgPrice(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
+ }
+
public static def updateTrades(startDate, endDate, cDate){
def q = new BasicDBObject()
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy
index 76eed7432..0fbbde404 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy
@@ -107,6 +107,9 @@ class CommonDatautils {
public static final DBCollection bk_business_coll = MongoUtils.getCollectionByName("fangjia_base", "bk_business", "mongo.db.fangjia.com")
public static final DBCollection BAIDU_POI_COLL = MongoUtils.getCollectionByName("crawl", "poi_wap_spider", "192.168.0.206",27020)
+ static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com")
+
+
public static DSCollection getHouseDataStoreConnection(){
if(house_dataStoreConnection != null) {
@@ -1968,6 +1971,10 @@ class CommonDatautils {
dbo.cal_type = "周边楼盘"
}else if(dbo.value_type == 6){
dbo.cal_type = "推导"
+ }else if(dbo.value_type == 7){
+ dbo.cal_type = "周边推算"
+ }else if(dbo.value_type == 8){
+ dbo.cal_type = "新模型"
}else if(dbo.value_type == 9){
dbo.cal_type = "神经网络"
}else if(dbo.value_type == 10){
@@ -2078,6 +2085,23 @@ class CommonDatautils {
}
+ public static def queryFirstDistrictSellStat(city, region, name){
+
+ DBObject queryCondition = new BasicDBObject()
+ queryCondition.put("city", city);
+ queryCondition.put("region", region);
+ queryCondition.put("district_name", name);
+
+ DBCursor cur = DISTRICT_SELL_STAT.find(queryCondition).sort(new BasicDBObject().append("date", -1)).limit(1)
+ cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
+ DBObject dbo = null
+ while(cur.hasNext()) {
+ dbo = cur.next()
+ }
+ return dbo;
+ }
+
+
public static def queryHouseCalutePrice(city, region, name, startWeekendDate){
DBObject queryCondition = new BasicDBObject()
queryCondition.put("city", city);
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy
index c73330ded..b2a89c157 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy
@@ -20,7 +20,7 @@ class GongShu {
}
def run() {
- String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202510.xlsx";
+ String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202512.xlsx";
// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx";
String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
@@ -36,7 +36,7 @@ class GongShu {
// match(path2, path1)
// match2(path3, path1)
// houseCase(path2)
-// thirdPrice(path1)
+ thirdPrice(path1)
priceAvg(path1)
// futurePrice(path2)
// rePrice(path2)
@@ -329,7 +329,7 @@ class GongShu {
def city = "福州"
def region = d['B']
def name = d['C']
- def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202506, 202509)
+ def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202509, 202511)
if (valusMap) {
def dataMap = valusMap.get(city + "##" + region + "##" + name)
if (dataMap.get("anjuke_esf_price")) {
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 22fe1b3d6..5fe90170f 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_202509.csv")
+def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202511.csv")
def count0 = 0
def count1 = 0
def count2 = 0
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy
index f8017e35e..43e4429ce 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy
@@ -35,10 +35,10 @@ class AddAvgpriceBatch {
// task.run1();
// task.test()
// task.sendPriceCommand()
-// task.sendNewDistPrice()
+ task.sendNewDistPrice()
// task.delNoExistsDistPrice()
- task.checkToBprice()
+// task.checkToBprice()
}
def checkToBprice(){
@@ -144,10 +144,11 @@ class AddAvgpriceBatch {
DBObject q = new BasicDBObject();
q.put("status",0)
q.put("cat", "district");
- q.put("c_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern("2023-11-14","yyyy-MM-dd")))
+ q.put("c_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern("2025-11-27","yyyy-MM-dd")))
def dbsour = DbUtils.seaweed.find(q)
+ println dbsour.count()
for(def d : dbsour){
- addPrice(d.city,d.region,d.name, d.estate_type2, DateUtils.parseFromTightByPattern('2023-07-01','yyyy-MM-dd'),DateUtils.parseFromTightByPattern('2023-11-19','yyyy-MM-dd'))
+ addPrice(d.city,d.region,d.name, d.estate_type2, DateUtils.parseFromTightByPattern('2025-11-01','yyyy-MM-dd'),DateUtils.parseFromTightByPattern('2025-11-27','yyyy-MM-dd'))
}
}
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/abc/SuzouPocTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/abc/SuzouPocTest.groovy
index 4b5e0f2e3..763fba889 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/abc/SuzouPocTest.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/abc/SuzouPocTest.groovy
@@ -1,6 +1,7 @@
package com.fangjia.script.gj.abc
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.OpenApiUtils
@@ -35,14 +36,14 @@ class SuzouPocTest {
// task.run()
// task.newRun()
// task.test()//有楼层
-// task.testEval()//无楼层
+ task.testEval()//无楼层
// task.level()//楼盘评级
- task.house()
+// task.house()
}
def test(){
- ExcelUtils.modify("D:\\数据\\上海联合产权交易所\\第1批拟处置房产清单(长城大厦、台山碧桂园).xlsx", { d ->
- if(!d['P'] && d['I']){
+ ExcelUtils.modify("D:\\数据\\慧合\\(中企华正诚评估回复)房产价值查询20251209-结果.xlsx", { d ->
+ if(!d['S'] && d['A']){
def floorAdds = d['I'].split("/")
def ret1 = OpenApiClient.addressEvaluation(d['C'], null, d['D'], d['D'], d['K'], floorAdds[0], floorAdds[1])
if (ret1) {
@@ -98,8 +99,8 @@ class SuzouPocTest {
}
def testEval(){
- ExcelUtils.modify("D:\\数据\\宏信息\\样本房源-估值.xlsx", { d ->
- if(!d['O'] && d['E']){
+ ExcelUtils.multiThreadingModify("D:\\数据\\海南\\地址清单.xlsx", { d ->
+ if(!d['L'] && d['B']){
// def city = d['C']
// if(city == "市辖区"){
// city = d['B']
@@ -109,13 +110,16 @@ class SuzouPocTest {
// d['R'] = obj.city
// d['S'] = obj.region
// d['T'] = obj.name
- def ret1 = OpenApiClient.addressEvaluation(d['C'], d['D'], d['C']+d['D']+d['E'], d['E'], d['I'], null, null)
+
+
+ def ret1 = OpenApiClient.addressEvaluation(d['G'], null, d['C'], d['B'], d['D'], null, null)
if (ret1) {
- d['J'] = ret1.totalPrice
- d['K'] = ret1.avgPrice
- d['L'] = ret1.city
- d['M'] = ret1.district
- d['N'] = ret1.name
+ d['M'] = ret1.avgPrice
+ d['L'] = ret1.totalPrice
+
+ d['N'] = ret1.city
+ d['O'] = ret1.district
+ d['P'] = ret1.name
}
// else{
// def dbo = CommonDatautils.queryFirstDistrictPrice(obj.city, obj.region, obj.name)
@@ -135,34 +139,96 @@ class SuzouPocTest {
def house(){
def cases = []
cases << ["城市", "区域","板块", "名称", "面积", "单价","总价","装修", "朝向", "距离","所在楼层","总楼层","室","厅","卫","发布时间","标题", "序号"]
- ExcelUtils.modify("D:\\数据\\宏信息\\样本房源-估值.xlsx", { d ->
- if(d['L']){
- def obj = CommonDatautils.findDistrict(d['L'], d['M'], d['N'], "district")
+ ExcelUtils.modify("D:\\数据\\湖北银行\\房产价格评估测试数据_1210-匹配-V2.xlsx", { d ->
+ if(d['Q']){
+ println d["P"]
+ def obj = CommonDatautils.findDistrict(d['N'], d['O'], d['P'], "district")
if(obj){
def lng = obj.lng/10000000000.0
def lat = obj.lat/10000000000.0
def location = String.valueOf(lng)+","+ String.valueOf(lat)
+ def price = d['Q']
+ def startPrice = null
+ def endPrice = 0
+ if(price && price>0){
+ startPrice = price - price*0.2
+ endPrice = price + price*0.2
+ }
def result = OpenApiClient.houseAroundBylocationAction(location, d['I'], 0, 0, 50)
+ def houseList = []
if(result){
for(def h : result){
- cases << [h.city, h.district, h.block, h.name, h.size, h.unitPrice, h.totalPrice, h.decoration, h.direction, h.distance, h.floor,h.maxFloor, h.room, h.hall, h.toilet, h.publishDate, h.title, d["A"],"挂牌"]
+ if(startPrice && h.unitPrice>=startPrice && h.unitPrice<=endPrice){
+ def startDate = DateUtils.parseFromTightByPattern("2025-01-01", "yyyy-MM-dd")
+ def pDate = DateUtils.parseFromTightByPattern(h.publishDate, "yyyy-MM-dd")
+ if(pDate.getTime()>=startDate.getTime()){
+ houseList << [h.city, h.district, h.block, h.name, h.size, h.unitPrice, h.totalPrice, h.decoration, h.direction, h.distance, h.floor,h.maxFloor, h.room, h.hall, h.toilet, h.publishDate, h.title, d["A"],"挂牌"]
+ }
+ }else{
+ println "价格过滤 "+startPrice +" "+endPrice +" "+ h.unitPrice
+ }
}
}
- def address = d['L']+d['M']+d['N']
- def dealRets = OpenApiClient.dealHouse(d['L'], d['M'], d['N'], address, d['I'])
+
+
+ def address = d['N']+d['O']+d['P']
+ def dealRets = OpenApiClient.dealHouse(d['N'], d['O'], d['P'], address, d['I'])
+ def dealList = []
if(dealRets){
for(def h : dealRets){
- cases << [h.city, h.district, "", h.name, h.size, h.avgPrice, h.totalPrice, h.decoration, h.direction, "", h.floor,h.maxFloor, h.room, h.hall, h.toilet, h.tradeDate, "", d["A"], "成交"]
+ def dist = CommonDatautils.findDistrict(h.city, h.district, h.name, "district")
+ def distance = ""
+ if(dist){
+ distance = GeoUtils.calculateDistance(lng, lat, dist.lng/10000000000.0, dist.lat/10000000000.0)
+ }
+ def startDate = DateUtils.parseFromTightByPattern("2025-01-01", "yyyy-MM-dd")
+ def pDate = DateUtils.parseFromTightByPattern(h.tradeDate, "yyyy-MM-dd")
+ if(pDate.getTime()>=startDate.getTime()){
+ if(startPrice && h.avgPrice>=startPrice && h.avgPrice<=endPrice) {
+ dealList << [h.city, h.district, "", h.name, h.size, h.avgPrice, h.totalPrice, h.decoration, h.direction, distance, h.floor, h.maxFloor, h.room, h.hall, h.toilet, h.tradeDate, "", d["A"], "成交"]
+ }
+ }
}
}
+ if(dealList.size()<5){
+ List list = DbUtils.findAroundDistrict(obj);
+ if(list){
+ for(def dist : list){
+ dealRets = OpenApiClient.dealHouse(dist.city, dist.region, dist.name, dist.address, d['I'])
+ if(dealRets){
+ for(def h : dealRets){
+ def distance = ""
+ if(dist){
+ distance = GeoUtils.calculateDistance(lng, lat, dist.lng/10000000000.0, dist.lat/10000000000.0)
+ }
+ def startDate = DateUtils.parseFromTightByPattern("2025-01-01", "yyyy-MM-dd")
+ def pDate = DateUtils.parseFromTightByPattern(h.tradeDate, "yyyy-MM-dd")
+ if(pDate.getTime()>=startDate.getTime()){
+ if(startPrice && h.avgPrice>=startPrice && h.avgPrice<=endPrice) {
+ dealList << [h.city, h.district, "", h.name, h.size, h.avgPrice, h.totalPrice, h.decoration, h.direction, distance, h.floor, h.maxFloor, h.room, h.hall, h.toilet, h.tradeDate, "", d["A"], "成交"]
+ }
+ }
+ }
+ }
+ if(dealList.size()>20){
+ break;
+ }
+ }
+ }
+ }
+
+ if(houseList){
+ cases.addAll(houseList)
+ }
+ if(dealList){
+ cases.addAll(dealList)
+ }
}
-
}
-
})
println cases.size()
- ExcelUtils.write("D:\\数据\\宏信息\\样本房源-估值.xlsx", cases, "样本")
+ ExcelUtils.write("D:\\数据\\湖北银行\\房产价格评估测试数据_1216-样本.xlsx", cases, "样本")
}
def newRun(){
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy
index 0dfe2daab..93c1f35da 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy
@@ -397,6 +397,24 @@ class FangjiaClientUtils {
}
+ public static def shopEvaluate(location, estateType, area){
+ def jsonObj = null
+ def content = null
+ try {
+
+ def url = "http://192.168.0.100:30020/avmWeb/shopSell?location="+location+"&area="+area+"&estateType="+estateType
+ content = new HttpRequest().newGet(url, null, "utf-8")
+ jsonObj = JSONObject.fromObject(content)
+ println jsonObj
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jsonObj;
+ }
+
+
+
+
/**
* 经纬度转换
* 1、高德转百度 2、高德转WGS84 3、百度转高德 4、WGS84转高德 5、百度转WGS84 6、WGS84转百度
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 62a0d2898..2d19f3778 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
@@ -40,9 +40,7 @@ class AddPriceTest {
task.run();
}
def run(){
-<<<<<<< HEAD
- def filePath = "D:\\数据\\福州\\福州价格比对.xlsx"
-=======
+
// def districts = CommonDatautils.findAllDistrictsFromMg("西安","district", ["_id","city","region", "name", "lng","lat", "build_date", "household_count"])
// def rets = []
// rets << ["id","城市","区域","名称","经度","纬度","户数","建成年代","价格","可信度"]
@@ -51,7 +49,7 @@ class AddPriceTest {
// }
// ExcelUtils.write("d:\\数据\\数据建设\\西安楼盘.xlsx", rets, "西安")
def filePath = "d:\\数据\\数据建设\\西安楼盘.xlsx"
->>>>>>> f1e97d18c2798cdeb33724a417ee98085c9aea04
+
// addGXDPrice(filePath)
addCcbPrice(filePath)
// addThirdPrice(filePath)
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
index d4bff37bb..5a92ee89f 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy
@@ -5,7 +5,10 @@ import com.fangjia.script.ccbevaluation.CcbCommonUtils
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.district.FangjiaClientUtils
import com.fangjia.script.util.ExcelUtils
+import com.fangjia.script.util.MongoUtils
import com.fangjia.script.util.OpenApiClient
+import com.mongodb.DBCollection
+import groovy.sql.Sql
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
@@ -14,6 +17,13 @@ import java.util.concurrent.Executors
*/
class TestEvaluation {
+ def sql = Sql.newInstance(
+ "jdbc:mysql://192.168.0.92:3306/fangjiatong?useSSL=false&serverTimezone=Asia/Shanghai",
+ "goojia",
+ "G0ojia123456!@#",
+ "com.mysql.cj.jdbc.Driver"
+ )
+
static main(args) {
def task = new TestEvaluation();
// task.run();
@@ -25,7 +35,12 @@ class TestEvaluation {
// task.newAndOldMatch()
- task.addFjwToBprice("D:\\数据\\估值\\地址估价-匹配(加写字楼-商铺) - v2.xlsx")
+// task.addFjwToBprice("D:\\数据\\宏信息\\宏信房源台账-价格.xlsx")
+// task.addAreaFactor()
+
+// task.addOptName()
+// task.addDistId()
+ task.addEvaluationToDB()
}
def houseSimilar(){
@@ -158,39 +173,42 @@ class TestEvaluation {
}
def newAndOldMatch(){
- ExcelUtils.multiThreadingModify("D:\\数据\\估值\\地址估价-匹配(加写字楼-商铺).xlsx",{d->
+ ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\宏信房源台账.xlsx",{d->
if(d['A']){
- def address = d['A']
- def city = '上海'
- if(!d['B']){
- def jsonObject = FangjiaClientUtils.newMatch(city, address, "property", false)
+ def address = d['B']
+ def city = d['F']
+ if( !d['L'] && d['D'] && ["办公室"].contains(d['D'])){
+ def jsonObject = FangjiaClientUtils.newMatch(city, address, "office", false)
+ if(!jsonObject && d['A']){
+ jsonObject = FangjiaClientUtils.newMatch(city, d['A'], "office", false)
+ }
if(jsonObject){
- d['B'] = jsonObject.get("id")
- d['C'] = jsonObject.get("city")
- d['D'] = jsonObject.get("district")
- d['E'] = jsonObject.get("name")
- d['F'] = jsonObject.get("propertyType")
+ d['L'] = jsonObject.get("id")
+ d['M'] = jsonObject.get("city")
+ d['N'] = jsonObject.get("district")
+ d['O'] = jsonObject.get("name")
+ d['P'] = jsonObject.get("propertyType")
}else{
- jsonObject = FangjiaClientUtils.newMatch(city, address, "property", true)
+ jsonObject = FangjiaClientUtils.newMatch(city, address, "office", true)
if(jsonObject){
- d['B'] = jsonObject.get("id")
- d['C'] = jsonObject.get("city")+"(地图)"
- d['D'] = jsonObject.get("district")
- d['E'] = jsonObject.get("name")
- d['F'] = jsonObject.get("propertyType")
+ d['L'] = jsonObject.get("id")
+ d['M'] = jsonObject.get("city")+"(地图)"
+ d['N'] = jsonObject.get("district")
+ d['O'] = jsonObject.get("name")
+ d['P'] = jsonObject.get("propertyType")
}
}
}
- if(!d['G']){
- def jsonObject2 = OpenApiClient.addressMatch(city, address, "shop", false, null, null)
+ if(!d['Q']){
+ def jsonObject2 = OpenApiClient.addressMatch(city, address, "office", false, null, d['A'])
if(jsonObject2 != null && jsonObject2.precise!=-1) {
- d['G'] = jsonObject2.get("id")
- d['H'] = jsonObject2.get("city")
- d['I'] = jsonObject2.get("district")
- d['J'] = jsonObject2.get("name")
- d['K'] = jsonObject2.get("propertyType")
+ d['Q'] = jsonObject2.get("id")
+ d['R'] = jsonObject2.get("city")
+ d['S'] = jsonObject2.get("district")
+ d['T'] = jsonObject2.get("name")
+ d['U'] = jsonObject2.get("propertyType")
}
// else{
// jsonObject2 = OpenApiClient.addressMatch(city, address, "property", true, null, null)
@@ -209,18 +227,169 @@ class TestEvaluation {
}
def addFjwToBprice(path){
- ExcelUtils.multiThreadingModify(path,{d->
- def dist = CommonDatautils.findDistrictById(d['B'])
- if(dist){
- def dbo = CommonDatautils.queryFirstDistrictPrice(dist.city, dist.region, dist.name)
- if(dbo){
- if(dbo.avg_price_2b){
- d['H'] = dbo.avg_price_2b
+ def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
+ ExcelUtils.modify(path,{d->
+ def id = d['X']
+ if(!id){
+ id = d['L']
+ }
+ if(!id){
+ id = d['Q']
+ }
+ if(id && !d['AA']){
+ if(d['E'] && d['E']=="商铺"){
+ def dist = CommonDatautils.findDistrictById(id)
+ if(dist && dist.lat && dist.lat>0){
+ def loc = dist.lng/10000000000.0+","+dist.lat/10000000000.0
+ def type = "1"
+// if(dist.cat=="district"){
+// type = "1"//"住宅底商"
+// }else{
+// type = "0" //临街商铺
+// }
+ def jsonObj = FangjiaClientUtils.shopEvaluate(loc, type, d['I'])
+ if(jsonObj.msg == "成功"){
+ d['Z'] = jsonObj.totalPrice
+ d['AA'] = jsonObj.unitPrice
+ }
+ }
+ }else if(d['E'] && d['E']=="办公楼"){
+ def dist = CommonDatautils.findDistrictById(id)
+ if(dist){
+ def jsonObj = OpenApiClient.officeSellEvaluate(dist.city, dist.region, dist.name, d['I'])
+ if(jsonObj){
+ d['Z'] = jsonObj.totalPrice
+ d['AA'] = jsonObj.unitPrice
+ }
+ }
+
+
+ }else{
+ def dist = CommonDatautils.findDistrictById(id)
+ if(dist){
+ def dbo = CommonDatautils.queryFirstDistrictPrice(dist.city, dist.region, dist.name)
+ if(dbo){
+ if(dbo.avg_price_2b){
+
+ d['AA'] = dbo.avg_price_2b
+ d['AB'] = dbo.cal_type
+ }
+
+ def cityId = cityCodeDataMap.get(dbo.city)
+ def priceMap = CcbCommonUtils.findNewFjwAvgPrice(dist._id.toString(), cityId, 202511)
+ if(priceMap){
+ d['AC'] = priceMap.avg_price
+ d['AD'] = priceMap.month
+ d['AE'] = priceMap.calc_type
+ d['AF'] = priceMap.credit_value
+ }
+ }
}
}
}
+
})
}
+ def addAreaFactor(){
+ ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\宏信房源台账-基准价(含ID).xlsx",{d->
+ if(d['I'] && d['J'] && d['K']){
+ def dist = CommonDatautils.findDistrictById(d['I'])
+ if(dist){
+// def result = OpenApiClient.areaFactor(dist.city, dist.region, dist.name, d['H'], d['J'])
+// if(result){
+// d['R'] = result.ratio
+// d['S'] = result.newAvgPrice
+// }
+
+// def obj = CommonDatautils.queryFirstDistrictSellStat(dist.city, dist.region, dist.name)
+// if(obj){
+// d['M'] = obj.mom
+// }
+// d['L']=(int)(d['J']*d['K'])
+// d['N'] = (int)(d['L'] + d['L']*d['M'])
+
+ }
+ }
+
+ });
+ }
+
+ def addOptName(){
+ def list = ExcelUtils.read("D:\\数据\\宏信息\\报告负责人.xlsx", 0, 1)
+ def nameMap = [:]
+ for(def d : list){
+ nameMap.put(d[0], d[4])
+ }
+
+ ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\宏信房源台账-基准价(含ID).xlsx", { d ->
+ if(d['A']){
+ def name = nameMap[d['A']]
+ d['O'] = name
+ }
+ });
+
+ }
+
+ def addDistId(){
+ def list = ExcelUtils.read("D:\\数据\\宏信息\\宏信房源台账-基准价(含ID).xlsx", 0, 1)
+ def nameMap = [:]
+ for(def d : list){
+ nameMap.put(d[0], d[8])
+ }
+
+ ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\报告负责人.xlsx", { d ->
+ if(d['A']){
+ def id = nameMap[d['A']]
+ d['G'] = id
+ }
+ });
+ }
+
+ def addEvaluationToDB(){
+ def rets = []
+ ExcelUtils.modify("D:\\数据\\宏信息\\宏信项目-最终.xlsx", { d ->
+ if(d['G']){
+ def dist = CommonDatautils.findDistrictById(d['G'])
+ if(dist){
+ def buildType = 3
+ if(d['B'] == "公寓"){
+ buildType = 8
+ }else if(d['B'] == "别墅"){
+ buildType = 4
+ }else if(d['B'] == "商铺"){
+ buildType = 1
+ }else if(d['B'] == "办公楼"){
+ buildType = 2
+ }
+ def lat = dist.lat/10000000000.0
+ def lng = dist.lng/10000000000.0
+ def cat = 5
+ if(buildType==3 || buildType==8 || buildType ==4){
+ cat = 1
+ }else if(buildType == 1){
+ cat = 4
+ }
+ def date = new Date()
+ rets << [d['E'], dist.city, dist.region, dist.name, dist.address,buildType,d['I'], d['J'].toString().toDouble().toInteger(), lng, lat, d['F'], date, date, cat, d['K'].toString().toDouble().toInteger()]
+ }
+ }
+ },1)
+
+ addDataToDB(rets)
+ }
+
+ def addDataToDB(rows){
+ def sqlstring = "insert into evaluation(user_id, city, region, district_name, address, build_type, house_area, total_price, lng, lat, org_code, create_time, update_time, cat, unit_price ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
+
+ sql.withBatch(1, sqlstring){ ps->
+ for(def r : rows) {
+ ps.addBatch(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14])
+ ps.toString()
+ }
+ }
+ }
+
+
}
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy
index 40e691bef..2fd7b7f96 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy
@@ -257,7 +257,7 @@ public class DbUtils{
def lng = district.lng / 10000000000.0
sdq.put("sd.point", lat + "," + lng);
sdq.put("sd.sfield", "lat_lng");
- sdq.put("sd.distance", String.valueOf((double) 5000 / 1000.0));
+ sdq.put("sd.distance", String.valueOf((double) 1000 / 1000.0));
query.append('$sd', sdq)
def keys = new BasicDBObject()
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
index 0b095093c..50882747b 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy
@@ -414,7 +414,7 @@ public class ExcelUtils{
def data = ExcelUtils.read(fileName, srcSheetIndex, 0)
def body = data.subList(1, data.size())
- def nThread = Runtime.getRuntime().availableProcessors() * 8
+ def nThread = Runtime.getRuntime().availableProcessors() * 4
println nThread
ExecutorService executorService = Executors.newFixedThreadPool(nThread)
final AtomicInteger counter = new AtomicInteger(0)
diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy
index c3dbfe651..4636489d1 100644
--- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy
+++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy
@@ -1161,6 +1161,35 @@ public class OpenApiClient {
return null
}
+
+ public static JSONObject areaFactor(city, region, name, size, avgPrice){
+ try {
+ HttpRequest request = new HttpRequest();
+ Map params = new HashMap();
+ params.put("city", city);
+ params.put("nae", name);
+ params.put("district", region);
+ params.put("name", name);
+ params.put("size", size.toString());
+ params.put("avgPrice", avgPrice.toDouble().toInteger().toString());
+ params.put("token", TOKEN);
+
+ String response = request.get("http://localhost:8080/property/areaFactor", params, "UTF-8");
+ JSONObject result = JSONObject.fromObject(response);
+ if (result.getInt("code") == 200) {
+ if (result.containsKey("result")) {
+ return result.getJSONObject("result")
+ }
+ } else if (result.getInt("code") == 500) {
+ println("地址估价失败:${city} ${name} ${size} ${result}")
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null
+ }
+
+
public static JSONObject evaluateDistrictPriceByAddress(String city, String address, double size) {
try {
HttpRequest request = new HttpRequest();
@@ -1645,6 +1674,35 @@ public class OpenApiClient {
}
+ public static JSONObject officeSellEvaluate(city, district, name, size) {
+ try {
+ Map params = new HashMap();
+ params.put("city", city);
+ params.put("district", district)
+ params.put("name", name)
+ params.put("size", size.toString());
+ params.put("token", TOKEN);
+ params.put("__refresh_cache","1")
+
+ String content = new HttpRequest().get("https://open.fangjia.com/officeSell/evaluateSell", params, "utf-8")
+ JSONObject result = JSONObject.fromObject(content);
+ while (result == null) {
+ result = HttpRequestUtil.getJsonContent("https://open.fangjia.com/office/evaluateSell", params, "utf-8")
+ println("${city} ${name} 程序调用异常")
+ Thread.sleep(6000)
+ }
+ if (result.getInt("code") == 200) {
+ return result.getJSONObject("result");
+ } else if (result.getInt("code") !=0) {
+ println("${city} ${name} ")
+ }
+ } catch (Exception e) {
+ println("${city} ${name} ${e.getMessage()}")
+ e.printStackTrace();
+ }
+ return null
+ }
+
}