From 1dc9ef21d609fcaca87173a99951abebe6d185e6 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 12 Sep 2025 11:28:44 +0800 Subject: [PATCH 01/67] update --- .../script/ccbevaluation/AddSzDealData.groovy | 14 +- .../script/commData/CommonDatautils.groovy | 29 +++- .../script/fuzhou/FzDataResultStat.groovy | 14 ++ .../com/fangjia/script/fuzhou/Test1.groovy | 2 +- .../fangjia/script/gj/abc/SuzouPocTest.groovy | 13 +- .../script/gj/chongqingblank/DataMatch.groovy | 14 +- .../gj/data_handle/AddDevShapeData.groovy | 2 +- .../data_handle/AutoAddDistrictBatch.groovy | 126 +++++++++++++++++- .../data_handle/BusinessQuarterProcess.groovy | 12 +- .../fangjia/script/gj/district/ApiTest.groovy | 4 +- .../FjwBigdataForsaleBatch.groovy | 35 ++++- 11 files changed, 226 insertions(+), 39 deletions(-) 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 adabfcbcc..244eff12d 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 @@ -9,7 +9,7 @@ import com.mongodb.DBCollection * 深圳公众号成交数据录入 */ -def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳6月份成交数据.xlsx", 0, 1) +def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳7月成交.xlsx", 0, 1) def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) @@ -77,14 +77,14 @@ for(def d : datas){ 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'].toString().toDouble()*10000) + map.sell_price = (int)(d['I'].toString().replace("万","").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/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index cdd711513..955fc06e2 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 @@ -825,10 +825,31 @@ class CommonDatautils { def dbsour = SEAWEED_COLL.find(q, keys).batchSize(5000) def rets = [] for(def d : dbsour){ - if(!d.township){ - rets << d + rets << d + } + return rets; + } + + + public static def findAllRegionDistricts(def city, def region, def cat, def fields){ + + DBObject q = new BasicDBObject(); + q.put("status",0) + q.put("cat", cat); + q.put("city", city) + q.put("region", region) + + DBObject keys = new BasicDBObject(); + if(fields){ + for(def field : fields){ + keys.put(field, 1); } } + def dbsour = SEAWEED_COLL.find(q, keys).batchSize(5000) + def rets = [] + for(def d : dbsour){ + rets << d + } return rets; } @@ -4056,6 +4077,9 @@ class CommonDatautils { rowMap.c_date = DateUtils.getConverDate(seawater.m_date) rowMap.m_date = DateUtils.getConverDate(seawater.m_date) +// rowMap.location = seawater.location + rowMap.title = seawater.name + rets << rowMap } } @@ -4844,6 +4868,7 @@ class CommonDatautils { query.append("cat", "district") query.append("city", city) query.append("visible", 0) + query.append("name", "长城大厦") DBObject sdq = new BasicDBObject(); sdq.put("sd.point", lat + "," + lng); sdq.put("sd.sfield", "lat_lng"); 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 3b3d636e4..796876790 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 @@ -34,6 +34,20 @@ class FzDataResultStat { //// task.margeExcel() // task.saveCsvData() // task.testNewPrice() + +// task.statHouse() + } + + def statHouse(){ + ExcelUtils.multiThreadingModify("C:\\Users\\gaojuan\\Downloads\\福州待调查小区.xlsx",{d-> + def o = CommonDatautils.findDistrictById(d['A']) + if(o){ + def count = CommonDatautils.findHouseCountByDate(o.city, o.region, o.name, o.alias, "sell", 20220818) + d['K'] = count + println o.name +" "+count + } + + }) } def margeExcel(){ 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 e923d8d61..7449e503b 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_202506.csv") +def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202508.csv") def count0 = 0 def count1 = 0 def count2 = 0 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 2721a0641..0165a27cd 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 @@ -33,17 +33,16 @@ class SuzouPocTest { def test(){ ExcelUtils.modify("D:\\数据\\上海联合产权交易所\\第1批拟处置房产清单(长城大厦、台山碧桂园).xlsx", { d -> - if(d['O']){ + if(!d['P'] && d['I']){ def floorAdds = d['I'].split("/") - def ret1 = OpenApiClient.addressEvaluation(d['O'], null, d['D'], d['D'], d['K'], floorAdds[0], floorAdds[1]) + def ret1 = OpenApiClient.addressEvaluation(d['C'], null, d['D'], d['D'], d['K'], floorAdds[0], floorAdds[1]) if (ret1) { - d['N'] = ret1.totalPrice - d['M'] = ret1.avgPrice - d['P'] = ret1.district - d['Q'] = ret1.name + d['S'] = ret1.totalPrice + d['T'] = ret1.avgPrice + d['U'] = ret1.district + d['V'] = ret1.name } } - }); } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DataMatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DataMatch.groovy index cb615604a..5d5304f21 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DataMatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DataMatch.groovy @@ -12,6 +12,7 @@ import com.mongodb.BasicDBObject import com.mongodb.DBCollection import net.sf.json.JSONObject import com.fangjia.script.gj.* +import org.bson.types.ObjectId import java.util.regex.Matcher import java.util.regex.Pattern @@ -30,7 +31,18 @@ class DataMatch { // println task.findAddress("昌州街道棠香路") // task.run2MatchV2( "D:\\数据\\重庆农商行\\估值1-V2.xlsx") - task.fzWeiyuanshuMatch("D:\\数据\\福州\\连江楼盘.xlsx") +// task.fzWeiyuanshuMatch("D:\\数据\\福州\\连江楼盘.xlsx") + task.delRegionCode("D:\\数据\\需删除区域编码.xlsx") + } + + def delRegionCode(path){ + ExcelUtils.modify(path,{d-> + def q = new BasicDBObject("_id", new ObjectId(d['A'])) + def obj = FANGJIA_OFFICIAL_AREA_MAP.findOne(q) + if(obj){ + FANGJIA_OFFICIAL_AREA_MAP.remove(q) + } + }) } def fzWeiyuanshuMatch(fileName){ 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 cc5d6fce6..891851d37 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:\\数据\\数据建设\\开发区外包\\0812' + def directoryPath = 'D:\\数据\\数据建设\\开发区外包\\0903' def dir = new File(directoryPath) if (dir.isDirectory()) { dir.eachFileRecurse(FileType.FILES) { file -> diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy index 1cdff119f..7435071f5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy @@ -1,10 +1,14 @@ package com.fangjia.script.gj.data_handle +import com.fangjia.core.util.GeoUtils import com.fangjia.script.BaseBatch import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.linxsh.util.AddressUtil +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.ElasticUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils @@ -27,20 +31,21 @@ class AutoAddDistrictBatch extends BaseBatch{ public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) - def fullCityMap = CommonDatautils.queryFullNameCity() - def mcaDistMap = CommonDatautils.queryDistNameCityByMapping() + def fullCityMap = null//CommonDatautils.queryFullNameCity() + def mcaDistMap = null//CommonDatautils.queryDistNameCityByMapping() static main(args) { - runBatch(new AutoAddDistrictBatch(), args) +// runBatch(new AutoAddDistrictBatch(), args) -// def task = new AutoAddDistrictBatch(); + def task = new AutoAddDistrictBatch(); // task.checkMap() + task.addDistrict() } @Override void process(Object args) { //查找第三方匹配没有匹配上的小区 - def citys = ["三明"]//CommonDatautils.findAllCity() + def citys = ["泉州"]//CommonDatautils.findAllCity() def list = [] list << ["城市", "区域", "名称", "成交量", "房源量", "百度地图", "百度类型","高德地图", "高德类型"] for(def c : citys){ @@ -52,7 +57,7 @@ class AutoAddDistrictBatch extends BaseBatch{ def fileName = "/home/goojia/gj/add_dist_info.xlsx" if (CommonDatautils.isWindow()) { - fileName = "D:\\数据\\数据建设\\小区\\add_dist_info_1.xlsx" + fileName = "D:\\数据\\数据建设\\小区\\泉州待新增小区.xlsx" } ExcelUtils.write(fileName, list, "待入库数据") @@ -109,7 +114,7 @@ class AutoAddDistrictBatch extends BaseBatch{ gaode_name = gaode_obj.name } println "[ "+totalCount.get()+"/"+noMatchCount+" ]"+key +" trade_count:"+trade_count+" house_count:"+house_count+" baidu_count:"+baidu_count+" gaode_count:"+gaode_count - rets << [arrs[0], arrs[1], arrs[2], trade_count, house_count, baidu_count, gaode_type, gaode_count, gaode_type, gaode_name] + rets << [arrs[0], arrs[1], arrs[2], trade_count, house_count, baidu_count, baidu_type, gaode_count, gaode_type, gaode_name] } catch (Exception e) { e.printStackTrace() } finally { @@ -187,6 +192,7 @@ class AutoAddDistrictBatch extends BaseBatch{ q.put("match_id", new BasicDBObject('$exists',false)) q.put("old_match_id", new BasicDBObject('$exists',false)) q.put("city", c) + q.put("district", "丰泽") def dbcursor = thirdSeaweedMappingColl.find(q).batchSize(5000) def rMap = [:] for(def d : dbcursor){ @@ -293,4 +299,110 @@ class AutoAddDistrictBatch extends BaseBatch{ // d['O'] = score }) } + + def addDistrict(){ + def path = "D:\\数据\\数据建设\\小区\\新增价格.xlsx" + ExcelUtils.modify(path, { d -> + def dbo = new BasicDBObject() + dbo.city = d['A']; + dbo.region = d['B']; + if(d['M']){ + dbo.name = d['M'] + def alias = [] + alias << d['C'] + dbo.alias = alias + }else{ + dbo.name = d['C'] + } + + if(d['D']){ + dbo.estate_type2 = d['D'] + }else{ + if(d['C'].contains("别墅")){ + dbo.estate_type2 = "别墅" + }else if(d['C'].contains("商住")){ + dbo.estate_type2 = "商住" + }else{ + dbo.estate_type2 = "普通住宅" + } + } + + dbo.status = 0; + dbo.cat = "district" + dbo.c_date = new Date() + dbo.m_date = new Date() + + +// def rets = getEsDatas(d['A'], d['B'], d['C']) +// for(def r : rets){ +// if(r.address && !dbo.address){ +// dbo.address = r.address +// } +// if(!dbo.lng){ +// if(r.location){ +// def lng = r.location.x +// def lat = r.location.y +// Long gaode_lng = lng*10000000000L +// Long gaode_lat = lat*10000000000L +// dbo.put("lng", gaode_lng) +// dbo.put("lat", gaode_lat) +// def bdpoint = FangjiaClientUtils.convert(lng+","+lat, 1) +// if(bdpoint){ +// dbo.put("lng2", (bdpoint[0]*10000000000).longValue()) +// dbo.put("lat2", (bdpoint[1]*10000000000).longValue()) +// } +// } +// } +// } +// println dbo +// def q = new BasicDBObject() +// q.put("city", dbo.city) +// q.put("name", dbo.name) +// q.put("cat", "district") +// q.put("status", 1) +// q.put("region", dbo.region) +// def obj = DbUtils.seaweed.findOne(q) +// if(obj){ +// println "【存在】"+dbo +// def udata = new BasicDBObject() +// udata.put("status", 1) +// udata.put("m_date", new Date()) +// DbUtils.seaweed.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', udata)) +// }else{ +// DbUtils.seaweed.save(dbo); +// +// } + + def stop = false +// while (!stop){ + def dist = CommonDatautils.findDistrict(dbo.city, dbo.region, dbo.name, "district") + if(dist){ + d['N'] = "已处理" + //发重算均价命令 + addPrice(dist.city, dist.region, dist.name, dist.estate_type2, DateUtils.parseFromTightByPattern('2025-08-01','yyyy-MM-dd'),new Date()) + stop = true + } +// } + + }) + + } + + def getEsDatas(city, region, name){ + String sql = "select * from community where city='${city}' and region='${region}' and name='${name}' " + def datas = [] + ElasticUtils.executeSqlQuery(sql,{ data-> + datas << data + }) + return datas; + } + + + def addPrice(city, region, name, estateType2,startDate, endDate){ + def weekends = DateUtils.getWeekendBetweenDates(startDate, endDate) + for(def weekend : weekends){ + CommonUtils.recalculationAverage(city, region, name, estateType2, weekend,false,0) + } + } + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/BusinessQuarterProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/BusinessQuarterProcess.groovy index f122be3c0..93a7dda3f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/BusinessQuarterProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/BusinessQuarterProcess.groovy @@ -43,9 +43,9 @@ class BusinessQuarterProcess { } def run(){ // synchBusinessData() -// updateBusinessQuarter() + updateBusinessQuarter() // addRegion() - synchBusinessToEs() +// synchBusinessToEs() } def addRegion(){ @@ -172,11 +172,11 @@ class BusinessQuarterProcess { bk_business_coll.update(new BasicDBObject("_id", row._id), new BasicDBObject('$set', row),true, false) } def updateBusinessQuarter(){ - def citys = CommonDatautils.findAllCity() + def citys = ["上海"]//CommonDatautils.findAllCity() for(def c : citys){ - if(["上海","北京"].contains(c)){ - continue - } +// if(["上海","北京"].contains(c)){ +// continue +// } def cityBusinessList = CommonDatautils.findBusinessByCity(c) def districts = CommonDatautils.findAllDistricts(c, "district", ["city","region","name", "business_quarter", "lat", "lng"]) businessProcess(c, districts, cityBusinessList) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy index 0b63bf38e..b121c1209 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy @@ -33,10 +33,10 @@ class ApiTest { // task.addressAvgPrice("D:\\数据\\北交所\\拍卖案例(-地址估值接口).xlsx")//地址出小区均价 -// task.addressEvaluate("D:\\数据\\北交所\\拍卖案例(-地址均价接口).xlsx")//地址估值 + task.addressEvaluate("D:\\数据\\北交所\\拍卖案例(-地址均价接口).xlsx")//地址估值 // task.arroundFacilitiesByAddress("D:\\数据\\北交所\\拍卖案例(-周边poi接口).xlsx")//北交所周边poi 地址 // task.jsAbcHouseCastTestByAddress("D:\\数据\\北交所\\拍卖案例(房源接口500条-价格控20%).xlsx") - task.houseValueInformation("D:\\数据\\北交所\\北交所综合接口测试.xlsx") +// task.houseValueInformation("D:\\数据\\北交所\\北交所综合接口测试.xlsx") //五级地址标准化 // task.addrStructure("D:\\数据\\地数\\地址标准化-测试用例.xlsx") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy index 304f46830..9d42392f1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy @@ -85,7 +85,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ public void process(Object args) { //目前查询库中是否已存在,用的是Oracle def index = 0 - def citys = CcbCommonUtils.getRunningCitys(["all"]) + def citys = CcbCommonUtils.getRunningCitys(["all"]) def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() @@ -201,7 +201,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ } finally { latch.countDown() } - }; + }; }) } latch.await() @@ -492,7 +492,8 @@ class FjwBigdataForsaleBatch extends BaseBatch{ def findHousesByMdate(def city, def region, def cat, def startDate, def endDate, def name, def alias, def estate_type2, rets1){ - def date = DateUtils.addMonth(endDate.toString(), -3, "yyyyMMdd") +// def date = DateUtils.addMonth(endDate.toString(), -3, "yyyyMMdd") + def date = DateUtils.addMonth(endDate.toString(), -12, "yyyyMMdd") def startMdate = DateUtils.parseFromTightByPattern(date,"yyyyMMdd")//DateUtils.parseFromTightByPattern("20240519","yyyyMMdd") def endMdate = DateUtils.parseFromTightByPattern(endDate.toString(), "yyyyMMdd")//DateUtils.parseFromTightByPattern("20240718", "yyyyMMdd") @@ -530,11 +531,15 @@ class FjwBigdataForsaleBatch extends BaseBatch{ } } - if(estate_type2 && estate_type2=="别墅"){ + if(estate_type2 && estate_type2=="别墅" && !name.contains("别墅")){ def newName = name + "(别墅)" if(!alias.contains(newName)){ alias << newName } + newName = name + "别墅" + if(!alias.contains(newName)){ + alias << newName + } } if(estate_type2 && estate_type2=="商住"){ @@ -544,6 +549,21 @@ class FjwBigdataForsaleBatch extends BaseBatch{ } } + if(name.contains("别墅")){ + def newName = name.replace("别墅", "").replace("()", "").replace("()", "") + def obj = CommonDatautils.findDistrict(city,region,newName,"district") + if(!alias.contains(newName)){ + alias << newName + } + if(obj && obj.alias){ + for(def s1 : alias){ + if(!alias.contains(s1)){ + alias << s1 + } + } + } + } + if(alias && alias.size()>0){ BoolQueryBuilder inBuilder = QueryBuilders.boolQuery(); for(def s : alias){ @@ -586,6 +606,11 @@ class FjwBigdataForsaleBatch extends BaseBatch{ if(vallaFlag){ continue; } + }else if (estate_type2 && estate_type2=="别墅"){ + def vallaFlag = isVilla(seawater.area, seawater.name, seawater.height, seawater.room) + if(!vallaFlag){ + continue; + } } @@ -628,7 +653,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ if(!seawater.toilet){ seawater.toilet = null } - if(seawater.toilet && (seawater.toilet>=5 || seawater.toilet<1)){ + if(seawater.toilet && (seawater.toilet>=10 || seawater.toilet<1)){ continue; } From 63cc2e734eed627b4c4f8c22c59cf2da0389c7e4 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 15 Sep 2025 13:09:24 +0800 Subject: [PATCH 02/67] =?UTF-8?q?=E4=BE=9B=E6=95=B0200=E4=B8=AA=E7=A6=8F?= =?UTF-8?q?=E5=B7=9E=E5=B0=8F=E5=8C=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/commData/CommonDatautils.groovy | 4 + .../script/fuzhou/FzDataResultStat.groovy | 15 +- .../com/fangjia/script/fuzhou/GongShu.groovy | 500 ++++++++++++++++++ 3 files changed, 508 insertions(+), 11 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy 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 cdd711513..8c0af3862 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 @@ -4905,6 +4905,10 @@ class CommonDatautils { if(!dataMap.containsKey("tuboshi_esf_price") && db.tuboshi_esf_price && db.tuboshi_esf_price>3000){ dataMap.put("tuboshi_esf_price", db.tuboshi_esf_price) } + + if (!dataMap.containsKey("soufang_esf_price") && db.soufang_esf_price && db.soufang_esf_price > 3000) { + dataMap.put("soufang_esf_price", db.soufang_esf_price) + } if(!dataMap.containsKey("zhongyuan_esf_price") && db.zhongyuan_esf_price && db.zhongyuan_esf_price>3000){ dataMap.put("zhongyuan_esf_price", db.zhongyuan_esf_price) } 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 3b3d636e4..19310f4e6 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 @@ -1,19 +1,12 @@ package com.fangjia.script.fuzhou -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.Bytes -import com.mongodb.DBCollection -import com.mongodb.DBCursor -import com.mongodb.DBObject -import com.rabbitmq.client.AMQP -import com.rabbitmq.client.impl.AMQImpl +import com.mongodb.* import org.apache.commons.io.FileUtils import org.bson.types.ObjectId - /** * 福州数据结果统计 */ @@ -89,7 +82,7 @@ class FzDataResultStat { map2.put(key, obj) } def rows = [] - rows << ["城市","区域","名称","${curMonth}价格","${lastMonth}价格", "涨跌幅","计算方式", "是否有效", "涨跌绝对值"] + rows << ["ID","城市","区域","名称","${curMonth}价格","${lastMonth}价格", "涨跌幅","计算方式", "是否有效", "涨跌绝对值"] def index = 0 map1.each {k,obj1-> def keys = k.split("##") @@ -114,7 +107,7 @@ class FzDataResultStat { if(markup){ markup_abs = Math.abs(markup) } - def row = [obj1.city, obj1.region, obj1.name, obj1?obj1.avg_price:'', lastPrice?lastPrice.avg_price:'', markup,obj1?obj1.value_type:'', flag, markup_abs] + def row = [obj1._id.toString(), obj1.city, obj1.region, obj1.name, obj1?obj1.avg_price:'', lastPrice?lastPrice.avg_price:'', markup,obj1?obj1.value_type:'', flag, markup_abs] rows << row index++ println row 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 new file mode 100644 index 000000000..9e73b0422 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/GongShu.groovy @@ -0,0 +1,500 @@ +package com.fangjia.script.majintao.FuZhou + +import com.fangjia.core.util.DateUtil +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.EsUtils +import com.fangjia.script.util.CommonUtils +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 java.util.concurrent.atomic.AtomicInteger + +class GongShu { + static main(args) { + def task = new GongShu(); + task.run(); + } + + def run() { + String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202509.xlsx"; +// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx"; + String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; +// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; + String path3 = "E:\\goojia\\file\\excel文件\\福州\\福州贝壳小区.xlsx"; +// String path2 = "E:\\goojia\\file\\excel文件\\福州\\1.xlsx"; +// String path1 = "E:\\goojia\\file\\excel文件\\福州\\福州全部小区.xlsx"; +// findID(path2) +// findDelDistrict(path2) +// findDistrictByAlias(path2) +// match19UseMAP(path2) +// addFjwPrice(path2) + +// match(path2, path1) +// match2(path3, path1) +// houseCase(path2) + thirdPrice(path1) +// priceAvg(path1) +// futurePrice(path2) +// rePrice(path2) + } + + def findID(path2) { + def count = new AtomicInteger(0) + ExcelUtils.defineByInputThreadingModify(10, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def city = d['C'] + def region = d['D'] + def name = d['E'] + def district = CommonDatautils.findDistrict(city, region, name, "district") + if (district) { + d['B'] = district._id.toString() + } + }) + + } + + def findDelDistrict(path2) { + def count = new AtomicInteger(0) + ExcelUtils.defineByInputThreadingModify(10, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def city = d['C'] + def region = d['D'] + def name = d['E'] + def district = CommonDatautils.findDistrictAll(city, region, name, "district") + if ("1" == district.status.toString()) { +// d['B'] = district._id.toString() + d['G'] = "已删除" + } + }) + } + + def findDistrictByAlias(path2) { + def count = new AtomicInteger(0) + ExcelUtils.defineByInputThreadingModify(10, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + if (d['G']) { + def city = d['C'] + def region = d['D'] + def name = d['E'] + def district = CommonDatautils.findSeaweedByAlias(city, region, name, "district") + if (district) { + d['H'] = district.get(0)._id.toString() + } + } + }) + } + + def match19UseMAP(path1) { + def count = new AtomicInteger(0) + ExcelUtils.defineByInputThreadingModify(10, path1, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def address = d['B'] + d['D'] + d['C'] + def city = d['B'] + def name = d['C'] + def region = d['D'] + + //19匹配 + String url = "http://192.168.0.19:31080/FangJiaNlpService/match"; + def map = [:] + map.put("address", address) + map.put("city", city) + map.put("useMap", "true") + map.put("category", "property") + HttpRequest httpRequest = new HttpRequest(); + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content + if (result != null && "name" in result) { + if ("city" in result) { + d['G'] = result.get("city").toString().replaceAll("null", "") + } + if ("district" in result) { + d['H'] = result.get("district").toString().replaceAll("null", "") + } + if ("name" in result) { + d['I'] = result.get("name").toString().replaceAll("null", "") + } + + } else { + address = d['B'] + d['D'] + d['A'] + map.put("address", address) + def content2 = httpRequest.getJsonContent(url, map, "UTF-8") + def result2 = content2 + if (result2 != null && "name" in result2) { + if ("city" in result2) { + d['G'] = result2.get("city").toString().replaceAll("null", "") + } + if ("district" in result2) { + d['H'] = result2.get("district").toString().replaceAll("null", "") + } + if ("name" in result2) { + d['I'] = result2.get("name").toString().replaceAll("null", "") + } + + } + } + }) + + } + + def addFjwPrice(path1) { + ExcelUtils.defineByInputThreadingModify(5, path1, { d -> + if (d['B']) { + def dist = CommonDatautils.findDistrictById(d['B']) + if (dist) { + def price = CommonDatautils.queryThisMonthDistrictAvgPrice(dist, "2024-11-01") + if (price) { + d['F'] = price.avg_price + d['G'] = price.avg_price_2b + def dbo = price + // 计算方式 + if (dbo.value_type == 1) { + dbo.cal_type = "指导价" + } else if (dbo.value_type == 2) { + dbo.cal_type = "自身样本" + } else if (dbo.value_type == 3) { + dbo.cal_type = "第三方" + } else if (dbo.value_type == 4) { + dbo.cal_type = "交易数据" + } else if (dbo.value_type == 5) { + dbo.cal_type = "周边楼盘" + } else if (dbo.value_type == 6) { + dbo.cal_type = "推导" + } else if (dbo.value_type == 9) { + dbo.cal_type = "神经网络" + } else if (dbo.value_type == 10) { + dbo.cal_type = "无方式" + } else { + dbo.cal_type = "" + } + d['I'] = dbo.cal_type + } + + } + } + + }) + } + + def match2(path2, path1) { + def count = new AtomicInteger(0) + def map = [:] + ExcelUtils.removeEmptyRow(path1) + ExcelUtils.removeEmptyRow(path2) + ExcelUtils.defineByInputThreadingModify(1, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def key = d['G'] + d['H'] + d['I'] + map.put(key, d) + }) + print(map) + + ExcelUtils.defineByInputThreadingModify(1, path1, { List d -> + def key = "福州" + d['C'] + d['D'] + if (map.containsKey(key)) { + def value = map.get(key) + d['J'] = value['B'] + d['K'] = value['D'] + d['L'] = value['C'] + + } + }) + } + + def match(path2, path1) { + def count = new AtomicInteger(0) + def map = [:] + ExcelUtils.removeEmptyRow(path1) + ExcelUtils.removeEmptyRow(path2) + ExcelUtils.defineByInputThreadingModify(1, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def key = d['C'] + d['D'] + d['E'] + map.put(key, d) + }) + print(map) + + ExcelUtils.defineByInputThreadingModify(1, path1, { List d -> + def key = "福州" + d['C'] + d['D'] + if (map.containsKey(key)) { + def value = map.get(key) + if (!d['J']) { + d['J'] = value['J'] + d['K'] = value['K'] + d['L'] = value['L'] + if (value['J']) { + d['M'] = "pp" + } + } + } + }) + + } + + // 房源及数量 + def houseCase(path2) { + def count = new AtomicInteger() + ExcelUtils.defineByInputThreadingModify(10, path2, { List d -> + count.incrementAndGet() + if (count % 10 == 0) { + println("已处理:" + count) + } + def price = [] + + def city + def region + def name + if (d['J'] && d['K'] && d['L']) { + city = d['J'] + region = d['K'] + name = d['L'] + + def must = [] + def term1 = ["terms": ["root": ["ke.com"]]] // 修正terms查询的格式 + must << term1 + def term2 = ["terms": ["cat": ["sell"]]] + must << term2 + def term3 = ["terms": ["city": [city]]] + must << term3 + def term4 = ["terms": ["region": [region]]] + must << term4 + def term5 = ["terms": ["district_name": [name]]] + must << term5 + def params = ["query": ["bool": ["must": must]]] + + // 添加 p_date 大于 20240101 的条件 + def term6 = ["range": ["p_date": ["gt": "20240401"]]] + must << term6 + + def s = EsUtils.httpSaveData(params, "http://192.168.0.206:9200/seawater-20*/_search"); + def total = 0 + if (s) { + def doc = new groovy.json.JsonSlurper().parseText(s) + def hits = doc.hits + if (hits) { + total = hits.total.value + if (hits.hits.size() > 0) { + hits.hits.each { hit -> + if (hit._source && hit._source.avg_price) { + price.add(hit._source.avg_price) + } + } + } + + } + } + if (price.size() > 0) { + println(price) + + // 计算中位数 + def medianPrice = calculateMedian(price) + // 找到与中位数最接近的有效价格 + def nearestPrice = findNearestPrice(medianPrice, price) + print(nearestPrice) + d['O'] = nearestPrice + d['P'] = total + + } + } + + }) + } + //查找三方价格 + def thirdPrice(path1) { + def count = 0 + ExcelUtils.multiThreadingModify( path1, { List d -> + count++ + if (count % 10 == 0) { + println("已处理:" + count) + } + def city = "福州" + def region = d['B'] + def name = d['C'] + def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202505, 202508) + if (valusMap) { + def dataMap = valusMap.get(city + "##" + region + "##" + name) + if (dataMap.get("anjuke_esf_price")) { + d['F'] = (int)(dataMap.get("anjuke_esf_price") * 0.9) + } + if (dataMap.get("maitian_esf_price")) { + d['G'] = (int)(dataMap.get("maitian_esf_price") * 0.9) + } + if (dataMap.get("soufang_esf_price")) { + d['H'] = (int)(dataMap.get("soufang_esf_price") * 0.9) + } + if (dataMap.get("cityhouse_esf_price")) { + d['I'] = (int)(dataMap.get("cityhouse_esf_price") * 0.9) + } + } + + }) + } + + def priceAvg(path1) { + def count = 0 + ExcelUtils.multiThreadingModify(path1, { List d -> + count++ + if (count % 10 == 0) { + println("已处理:" + count) + } + if (d['B']) { + def city + def region + def name + if (d['B'] && d['C']) { + city ="福州" + region = d['B'] + name = d['C'] + String sql = "select * from community where city = '${city}' and region = '${region}' and name.keyword = '${name}' " + + "and source = '贝壳找房' "; + ElasticUtils.executeSqlQuery(sql, { result -> + if (result.size() > 0) { + println(name +" "+result.avg_price) + if ("avg_price" in result) { + d['N'] = result.avg_price + } + if ("half_year_deal_avg_price" in result) { + d['E'] = result.half_year_deal_avg_price + } + } + }) + } + } + + }) + } + + def futurePrice(path1) { + DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017) + def count = 0 + ExcelUtils.removeEmptyRow(path1) + ExcelUtils.defineByInputThreadingModify(1, path1, { List d -> + count++ + if (count % 10 == 0) { + println("已处理:" + count) + } + if (d['C'] && d['D'] && d['E']) { + String city = d['C'] + String region = d['D'] + String name = d['E'] + def q = new BasicDBObject() + q.put("city", city) + q.put("region", region) + q.put("district_name", name) + def dbcursor = DISTRICT_STAT.find(q).sort(new BasicDBObject("weekend", -1)).limit(1) + def futurePrice + for (def db : dbcursor) { + if (db.future_value) { + futurePrice = db.future_value + d['H'] = futurePrice + break; + } + } + } + + }) + } + + //重算小区价格 + def rePrice(path2) { + ExcelUtils.removeEmptyRow(path2) + ExcelUtils.defineByInputThreadingModify(10, path2, { List d -> + if (d['A'] && d['B'] && d['C']) { + String city = d['A'] + String region = d['B'] + String name = d['C'] +// CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20240721", "yyyyMMdd")) + CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20240915", "yyyyMMdd")) + CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20240922", "yyyyMMdd")) + CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20240929", "yyyyMMdd")) + CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20241006", "yyyyMMdd")) + CommonUtils.recalculationAverage(city, region, name, "小区", DateUtil.parseDate("20241013", "yyyyMMdd")) + + } + + }) + } + + + // 计算中位数 + def calculateMedian(prices) { + def sortedPrices = prices.sort() + def size = sortedPrices.size() + if (size % 2 == 0) { + // 如果列表长度为偶数,则取中间两个数的平均值作为中位数 + def midIndex = (size / 2).toInteger() + return (sortedPrices[midIndex - 1] + sortedPrices[midIndex]) / 2.0 + } else { + // 如果列表长度为奇数,则取中间的数作为中位数 + return sortedPrices[((size - 1) / 2).toInteger()] + } + } + + def findNearestPrice(targetPrice, validPrices) { + def nearestPrice = validPrices.first() // 假设第一个有效价格是最接近的价格 + def minDiff = Math.abs(targetPrice - nearestPrice) + + validPrices.each { price -> + def diff = Math.abs(targetPrice - price) + if (diff < minDiff) { + minDiff = diff + nearestPrice = price + } + } + + return nearestPrice + } + + def match235(path2) { + DBCollection DATA_PROCESS = MongoUtils.getCollectionByName("fangjia_craw", "data_process", "192.168.0.235", 27018); + + def count = 0 + ExcelUtils.defineByInputThreadingModify(1, path2, { List d -> + count++ + if (count % 10 == 0) { + println("已处理:" + count) + } + def matchCity = d['B'] + def matchRegion = d['C'] + def matchName = d['D'] + def q = new BasicDBObject(); + q.put("match_city", matchCity) + q.put("match_region", matchRegion) + q.put("match_name", matchName) + q.put("source", "链家") + q.put("s_date", 202404) + def data = DATA_PROCESS.find(q) + for (da in data) { + if (da) { + def city = da.city + def region = da.region + def name = da.name + d['G'] = city + d['H'] = region + d['I'] = name + } + } + + + }) + } +} From 4805fe7760578b75b573b1403cc3d0c36cfb3fc5 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 23 Sep 2025 16:21:17 +0800 Subject: [PATCH 03/67] =?UTF-8?q?=E5=8D=97=E4=BA=AC=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9-=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/AddrSvcController.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index 44defb7b8..852bbd508 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -576,13 +576,21 @@ public class AddrSvcController { if (json.containsKey("result")) { //我们的结果 JSONObject result = json.getJSONObject("result"); - //我们省级及以上有开发区,直接用我们的结果 - if (result.containsKey("devDistrictName")) { - basicModel.setResult(result); + if (result.containsKey("devDistrictName") && StringUtils.isNotBlank(result.get("devDistrictName").toString())) { +// basicModel.setResult(result); + if(result.containsKey("countyGov") && StringUtils.isNotBlank(result.get("countyGov").toString())){ + result.put("countyGov",""); + } + } + basicModel.setResult(result); + + //我们省级及以上有开发区,直接用我们的结果 + /*if (result.containsKey("devDistrictName")) { + basicModel.setResult(result); } else if (!"2".equals(type)) { // 对私的不用齐梁 basicModel.setResult(result); - } else { + }else { try { //如果是江苏省或者浙江省 调用齐梁的结果 if (result.containsKey("province") && ("中国".equals(result.getString("province")))) { @@ -632,7 +640,7 @@ public class AddrSvcController { basicModel.setResult(result); } - } + }*/ } mav.setModel(basicModel); From 9115926ad54bd68d4bde670b9acf2485a8f25dfd Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Sun, 28 Sep 2025 09:08:16 +0800 Subject: [PATCH 04/67] update --- .../script/ccbevaluation/AddSzDealData.groovy | 2 +- .../com/fangjia/script/gj/OpenApiUtils.groovy | 20 ++++++++ .../script/gj/village/GuangDaVillage.groovy | 47 +++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy 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 244eff12d..634e78d3f 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 @@ -9,7 +9,7 @@ import com.mongodb.DBCollection * 深圳公众号成交数据录入 */ -def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳7月成交.xlsx", 0, 1) +def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳8月成交数据.xlsx", 0, 1) def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 3dec1f46f..6ca9048ac 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -778,6 +778,26 @@ class OpenApiUtils { return null; } + + static def addrVerifyGuangda(city, address){ + address = URLEncoder.encode(address, "utf-8"); + def url = "http://192.168.0.19:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" +// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + if(city){ + url = url + "&city=${city}" + } + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.msgCode ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + + // 省、市、区、街道、社区居委、POI补全 static def complete(city, address){ def url = "http://open.fangjia.com/addrSvc/complete?city=${city}&address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy new file mode 100644 index 000000000..13470de95 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy @@ -0,0 +1,47 @@ +package com.fangjia.script.gj.village + +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.ExcelUtils + +class GuangDaVillage { + static main(args) { + def task = new GuangDaVillage(); + task.run() + } + + def run(){ + ExcelUtils.multiThreadingModify("D:\\数据\\光大\\公开数据信息补充v3.xlsx",{ d-> + + if(!d['R']){ + def dto = OpenApiUtils.addrVerifyGuangda(null, d['A']) + if(dto){ +// def dto = jsonObj.result + d['F'] = dto.province + d['G'] = dto.provinceCode + d['H'] = dto.city + d['I'] = dto.cityCode; + d['J'] = dto.district + d['K'] = dto.districtCode + d['L'] = dto.town + d['M'] = dto.townCode + d['N'] = dto.committee + d['O'] = dto.committeeCode + d['P'] = dto.typeCode + d['Q'] = dto.typeName + d['R'] = dto.verifyFlag//涉农标识 + d['S'] = dto.addrVerify//地址是否有效信息 + d['T'] = dto.countyLevelCity//是否为县级市 + d['U'] = dto.countyGov//是否为县政府 + d['V'] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + d['W'] = dto.devDistrict//是否为开发区 + d['X'] = dto.devDistrictName//开发区 + d['Y'] = dto.devLevel//开发区等级 + d['Z']= dto.administrativeTowns;//是否市辖建制 + d['AA'] = dto.prefectureLevelOrAbove ;// 是否为地级市以上行政区划 + d['AB'] = dto.countyGovTown; //县政府所在镇 + } + } + + }) + } +} From 704c8ffbdd6774ed03d5d137c605ed6d216d424a Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 20 Oct 2025 09:56:19 +0800 Subject: [PATCH 05/67] update --- .../fuzhou/DistrictPriceExportBatch.groovy | 2 +- .../com/fangjia/script/fuzhou/GongShu.groovy | 8 +- .../com/fangjia/script/fuzhou/Test1.groovy | 2 +- .../com/fangjia/script/gj/OpenApiUtils.groovy | 38 ++++++++- .../fangjia/script/gj/abc/SuzouPocTest.groovy | 82 +++++++++++++++++- .../gj/data_handle/AddDevShapeData.groovy | 2 +- .../data_handle/AutoAddDistrictBatch.groovy | 85 +++++++++++++------ .../fangjia/script/gj/district/ApiTest.groovy | 9 +- .../jiangnanblank/TestEvaluation.groovy | 77 ++++++++++++++++- 9 files changed, 268 insertions(+), 37 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy index bcbf9d34c..271b157aa 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy @@ -28,7 +28,7 @@ class DistrictPriceExportBatch extends BaseBatch{ static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com") - def specialDistsPriceMap = ["津泰新村9-13号、15-18号":37500,"津泰新村14号":51000,"津泰新村1-6号、8号":23500,"津泰新村7号":38000,"津泰新村19号":36000] + def specialDistsPriceMap = ["津泰新村9-13号、15-18号":37500,"津泰新村14号":51000,"津泰新村1-6号、8号":23500,"津泰新村7号":38000,"津泰新村19号":36000, "金泉公寓15、16、17栋":24000,"金泉小区(1-12栋)":14000] static main(args) { runBatch(new DistrictPriceExportBatch(), args) } 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 9e73b0422..c73330ded 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个小区抽样价格核验202509.xlsx"; + String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202510.xlsx"; // String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx"; String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; // String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx"; @@ -36,8 +36,8 @@ class GongShu { // match(path2, path1) // match2(path3, path1) // houseCase(path2) - thirdPrice(path1) -// priceAvg(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, 202505, 202508) + def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202506, 202509) 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 7449e503b..22fe1b3d6 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_202508.csv") +def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202509.csv") def count0 = 0 def count1 = 0 def count2 = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 6ca9048ac..3c827d188 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -635,8 +635,25 @@ class OpenApiUtils { } static def similarRank(proCode, cityCode, regionCode, name, area, floor, height){ - def url = "http://localhost:8080/fangjia-open/house/similar?aboveFloorAmount=${height}&buildingName=${name}&city=${cityCode}&district=${regionCode}&" + - "propertyTypeCode=01&province=${proCode}&floorNumber=${floor}&strctureArea=${area}" + def url = "http://open.fangjia.com/house/similar?aboveFloorAmount=${height}&buildingName=${name}&city=${cityCode}&district=${regionCode}&" + + "propertyTypeCode=01&province=${proCode}&floorNumber=${floor}&strctureArea=${area}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + println url + String content = new HttpRequest().get(url, "utf-8"); + def dto = [] + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + + + static def shopSimilarRank(proCode, cityCode, regionCode, name, area, floor, height){ + def url = "http://open.fangjia.com/house/shopSimilar?aboveFloorAmount=${height}&buildingName=${name}&city=${cityCode}&district=${regionCode}&" + + "province=${proCode}&floorNumber=${floor}&strctureArea=${area}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" println url String content = new HttpRequest().get(url, "utf-8"); def dto = [] @@ -713,7 +730,7 @@ class OpenApiUtils { static def financialRating(city, address){ def url = "http://open.fangjia.com/address/financialRating?city=${city}&address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" String content = new HttpRequest().get(url, "utf-8"); - print(url) + println(url) if(content){ def doc = new JsonSlurper().parseText(content) if(doc && doc.code ==0 && doc.result){ @@ -725,6 +742,21 @@ class OpenApiUtils { } + static def propertyRating(id){ + def url = "http://open.fangjia.com/address/propertyRating?id=${id}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + String content = new HttpRequest().get(url, "utf-8"); +// print(url) + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + + //源地址的完整性进行验证 static def addrVerify(city, address){ def url = "http://open.fangjia.com/addrSvc/addrVerify?city=${city}&address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" 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 0165a27cd..4693542de 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 @@ -3,14 +3,18 @@ package com.fangjia.script.gj.abc import com.fangjia.core.RegionData import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.OpenApiUtils import com.fangjia.script.gj.district.FangjiaClientUtils 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.fangjia.script.util.OpenApiClient import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils import com.mongodb.BasicDBObject +import com.mongodb.DBCollection import com.mongodb.DBObject import java.util.concurrent.CopyOnWriteArrayList @@ -24,11 +28,15 @@ class SuzouPocTest { public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) + public static DBCollection COMMUNITY_RATE_COLL = MongoUtils.getCollectionByName("fangjia_stat", "community_rate", "mongo.db.fangjia.com") + static main(args) { def task = new SuzouPocTest() // task.run() // task.newRun() - task.test() +// task.test()//有楼层 +// task.testEval()//无楼层 + task.level()//楼盘评级 } def test(){ @@ -47,6 +55,78 @@ class SuzouPocTest { } + def level(){ + ExcelUtils.modify("D:\\数据\\其它\\附件1:POC测试样本(匹配).xlsx", { d -> + if(d['O']){ +// def obj = CommonDatautils.findDistrict(d['K'], d['L'], d['M'], "district") +// if(obj){ +// d['N'] = obj._id.toString() +// def ret = OpenApiUtils.propertyRating(obj._id.toString()) +// def ret = OpenApiUtils.financialRating(d['K'], d['K']+d['L']+d['M']) + def ret = findCommunityRate(d['O']) + if(ret){ + d['X'] = ret.community_price_rating +// d['W'] = ret.total_score + } +// def summary = findCommunitySummary(obj._id.toString()) +// if(summary){ +// d['O'] = summary.building_rating +// } + +// } + + } + + }) + } + + def findCommunityRate(id){ + def q = new BasicDBObject() + q.put("date", 202509) + q.put("comm_id", id) + return COMMUNITY_RATE_COLL.findOne(q) + } + + def findCommunitySummary(id){ + def obj = null + def sql = "select * from community_summary where id='${id}'" + ElasticUtils.executeSqlQuery(sql, { + obj = it + }) + return obj + } + + def testEval(){ + ExcelUtils.modify("D:\\数据\\其它\\附件1:POC测试样本(匹配).xlsx", { d -> + if(d['O'] && !d['T']){ +// def city = d['C'] +// if(city == "市辖区"){ +// city = d['B'] +// } + def obj = CommonDatautils.findDistrictById(d['O']) + if(obj){ + d['R'] = obj.city + d['S'] = obj.region + d['T'] = obj.name + def ret1 = OpenApiClient.addressEvaluation(obj.city, obj.region, obj.city+obj.region+obj.name, obj.name, d['F'], null, null) + if (ret1) { + d['P'] = ret1.totalPrice + d['Q'] = ret1.avgPrice + }else{ + def dbo = CommonDatautils.queryFirstDistrictPrice(obj.city, obj.region, obj.name) + if(dbo) { + d['P'] = (int)(dbo.avg_price_2b*d['F'].toString().toDouble()) + d['Q'] = dbo.avg_price_2b + + } + + } + } + + } + }); + } + def newRun(){ println("start:"+new Date().toString()) 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 891851d37..c9053f536 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:\\数据\\数据建设\\开发区外包\\0903' + def directoryPath = 'D:\\数据\\数据建设\\开发区外包\\1016' def dir = new File(directoryPath) if (dir.isDirectory()) { dir.eachFileRecurse(FileType.FILES) { file -> diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy index 7435071f5..8e7a656f3 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy @@ -31,48 +31,85 @@ class AutoAddDistrictBatch extends BaseBatch{ public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) - def fullCityMap = null//CommonDatautils.queryFullNameCity() - def mcaDistMap = null//CommonDatautils.queryDistNameCityByMapping() + def fullCityMap = CommonDatautils.queryFullNameCity() + def mcaDistMap = CommonDatautils.queryDistNameCityByMapping() static main(args) { -// runBatch(new AutoAddDistrictBatch(), args) + runBatch(new AutoAddDistrictBatch(), args) - def task = new AutoAddDistrictBatch(); +// def task = new AutoAddDistrictBatch(); // task.checkMap() - task.addDistrict() +// task.addDistrict() } @Override void process(Object args) { //查找第三方匹配没有匹配上的小区 - def citys = ["泉州"]//CommonDatautils.findAllCity() - def list = [] - list << ["城市", "区域", "名称", "成交量", "房源量", "百度地图", "百度类型","高德地图", "高德类型"] - for(def c : citys){ - def noMatchDatas = findNoMatchResult(c) - println c +" 新旧算法未匹配的数据量:"+noMatchDatas.size() - def rets = checkDatas(noMatchDatas.keySet()) - list.addAll(rets) - } +// def citys = ["苏州"]//CommonDatautils.findAllCity() +// def list = [] +// list << ["城市", "区域", "名称", "成交量", "房源量", "百度地图", "百度类型","高德地图", "高德类型", "高德名称", "库中是否存在", "是否新增入库"] +// def citystr = "" +// for(def c : citys){ +// def noMatchDatas = findNoMatchResult(c) +// println c +" 新旧算法未匹配的数据量:"+noMatchDatas.size() +// def rets = checkDatas(noMatchDatas.keySet()) +// list.addAll(rets) +// citystr = citystr + c+"_" +// } +// +// def fileName = "/home/goojia/gj/add_dist_info.xlsx" +// if (CommonDatautils.isWindow()) { +// fileName = "D:\\数据\\数据建设\\小区\\"+citystr+"待新增小区.xlsx" +// } +// ExcelUtils.write(fileName, list, "待入库数据") +// +// check(fileName) - def fileName = "/home/goojia/gj/add_dist_info.xlsx" - if (CommonDatautils.isWindow()) { - fileName = "D:\\数据\\数据建设\\小区\\泉州待新增小区.xlsx" - } - ExcelUtils.write(fileName, list, "待入库数据") - - check(fileName) + addFlag("D:\\数据\\数据建设\\小区\\苏州_待新增小区.xlsx") } + def addFlag(fileName){ + ExcelUtils.modify(fileName,{d-> + if(!d['L'] && d['I'].toString().contains('住宅')){ + if(d['K']){ + d['L'] = "不新增" + }else if(d['C'].toString().endsWith("路") || d['C'].toString().endsWith("街") || d['C'].toString().endsWith("广场") ){ + d['L'] = "不新增" + }else if(d['C'].toString().contains("公共租赁") || d['C'].toString().contains("自建房") || d['C'].toString().contains("商场")){ + d['L'] = "不新增" + }else if(d['C'].toString().endsWith("路小区") && d['E'].toString().toDouble().toInteger()==0){ + d['L'] = "不新增" + }else if(d['C'].toString().contains("社区") && d['E'].toString().toDouble().toInteger()==0){ + d['L'] = "不新增" + }else if(d['B'].toString().contains("周边")){ + d['L'] = "不新增" + }else if((d['C'].toString().endsWith("村") || d['C'].toString().endsWith("巷") || d['C'].toString().contains("街小区")) && d['F'].toString().toDouble().toInteger()==0){ + d['L'] = "不新增" + }else if((d['C'].toString().endsWith("号小区") || d['C'].toString().endsWith("宿舍"))&& d['E'].toString().toDouble().toInteger()==0 && d['F'].toString().toDouble().toInteger()==0){ + d['L'] = "不新增" + }else if(d['C'].toString().contains("路") && d['C'].toString().contains("号") && d['E'].toString().toDouble().toInteger()==0){ + d['L'] = "不新增" + }else if(d['G'] && (d['G'].toString().contains("行政地标") || d['G'].toString().contains("旅游") ||d['G'].toString().contains("休闲")||d['G'].toString().contains("购物")||d['G'].toString().contains("生活服务") )){ + d['L'] = "不新增" + }else if(d['J'] && d['C']==d['J'] && d['I'].toString().contains('住宅')){ + d['L'] = "新增" + }else if (d['G'] && d['G'].contains("住宅")){ + d['L'] = "新增" + } + } + }) + } + + def check(fileName){ ExcelUtils.multiThreadingModify(fileName,{d-> def dists = CommonDatautils.findAllDistrictByName(d[0], d[1], d[2], "district") if(dists){ - d['J'] = "库中已存在" + d['K'] = "库中已存在" }else{ dists = CommonDatautils.findDistrictByAlias(d[0], d[1], d[2], "district") if(dists){ - d['J'] = "库中别名中存在" + d['K'] = "库中别名中存在" } } }) @@ -192,7 +229,7 @@ class AutoAddDistrictBatch extends BaseBatch{ q.put("match_id", new BasicDBObject('$exists',false)) q.put("old_match_id", new BasicDBObject('$exists',false)) q.put("city", c) - q.put("district", "丰泽") +// q.put("district", "丰泽") def dbcursor = thirdSeaweedMappingColl.find(q).batchSize(5000) def rMap = [:] for(def d : dbcursor){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy index b121c1209..a245c0cd2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/ApiTest.groovy @@ -26,6 +26,7 @@ class ApiTest { def task = new ApiTest() // task.rankRunTest()//小区排名接口测试 // task.similarRunTest()//相似房源接口测试 + task.jnBankSearch() //江南行小区搜索 // task.loupanLevelTest()//楼盘评级接口测试 // task.jsAbcHouseCastTest()//北交所房源接口测试 小区 @@ -33,7 +34,7 @@ class ApiTest { // task.addressAvgPrice("D:\\数据\\北交所\\拍卖案例(-地址估值接口).xlsx")//地址出小区均价 - task.addressEvaluate("D:\\数据\\北交所\\拍卖案例(-地址均价接口).xlsx")//地址估值 +// task.addressEvaluate("D:\\数据\\北交所\\拍卖案例(-地址均价接口).xlsx")//地址估值 // task.arroundFacilitiesByAddress("D:\\数据\\北交所\\拍卖案例(-周边poi接口).xlsx")//北交所周边poi 地址 // task.jsAbcHouseCastTestByAddress("D:\\数据\\北交所\\拍卖案例(房源接口500条-价格控20%).xlsx") // task.houseValueInformation("D:\\数据\\北交所\\北交所综合接口测试.xlsx") @@ -206,6 +207,12 @@ class ApiTest { }) } + def jnBankSearch(){ + ExcelUtils.modify("D:\\数据\\江南农商行\\住宅信息V2-差异案例(反馈).xlsx", { d -> + + }) + } + def similarRunTest(){ ExcelUtils.modify("D:\\数据\\江南农商行\\住宅信息V2-差异案例(反馈).xlsx", { d -> 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 090c30dd1..db29b6b68 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 @@ -1,7 +1,11 @@ package com.fangjia.script.jiangnanblank import com.fangjia.core.util.HttpRequest +import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.ccb.CcbCodeUtils +import com.fangjia.script.gj.district.FangjiaClientUtils +import com.fangjia.script.util.ExcelUtils import java.util.concurrent.ExecutorService import java.util.concurrent.Executors @@ -13,9 +17,80 @@ class TestEvaluation { static main(args) { def task = new TestEvaluation(); - task.run(); +// task.run(); + +// task.match() + task.houseSimilar() } + def houseSimilar(){ + ExcelUtils.modify("D:\\数据\\江南农商行\\异地押品未自动重估明细(小区与无样本).xlsx",{d-> + if(d['I'] && d['C']=="商铺、商场"){ + def dist = CommonDatautils.findDistrictById(d['I']) + if(dist){ + def map = CcbCommonUtils.findAllDistrictCodeValue(dist.city) + if(map){ + def codeObj = map.get(dist.region) + if(codeObj){ + def cityCode = codeObj.city_code + def regionCode = codeObj.district_code + def provCode = codeObj.city_code.toString().substring(0,2)+"0000" + def height = null + if(d['M']){ + height = d['M'].toString().toDouble().toInteger() + } + def floor = null + if(d['N']){ + floor = d['N'].toString().toDouble().toInteger() + } +// def results = com.fangjia.script.gj.OpenApiUtils.similarRank(provCode, cityCode,regionCode, d['L'], d['O'], floor, height) + def results = com.fangjia.script.gj.OpenApiUtils.shopSimilarRank(provCode, cityCode,regionCode, d['L'], d['O'], floor, height) + if(results){ + def str = "" + for(def r : results){ + str = str + r.buildingName+"-"+r.strctureArea+"-"+r.unitPrice+"\n" + } + d['Q'] = str + } + } + } + + } + } + + }) + } + + def match(){ + ExcelUtils.modify("D:\\数据\\江南农商行\\异地押品未自动重估明细(小区与无样本).xlsx",{d-> + if(["商铺、商场"].contains(d['C'])){ + if(d['H'] && !d['I']){ + def address = d['H'] + def city = d['E'] + if(city=="市辖区"){ + city = d['D'] + } + if(!address.contains("省") && !address.contains("市")){ + address = d['D'] +city + d['F']+d['H'] + } + def jsonObject = FangjiaClientUtils.newMatch(city, address, "shop", false) + if(!jsonObject && d['G']){ + jsonObject = FangjiaClientUtils.newMatch(city, d['F']+d['G'], "shop", false) + } + if(jsonObject){ + d['I'] = jsonObject.get("id") + d['J'] = jsonObject.get("city") + d['K'] = jsonObject.get("district") + d['L'] = jsonObject.get("name") + } + } + + } + + }) + } + + def run(){ def citys = CommonDatautils.findAllCity(); for(def city :citys){ From fef6749ff75e1202ff9e0aae26b6e9f7095c454d Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 24 Oct 2025 10:34:31 +0800 Subject: [PATCH 06/67] update --- .../com/fangjia/script/gj/OpenApiUtils.groovy | 20 ++++++++++++++++++- .../gj/data_handle/AddDevShapeData.groovy | 2 +- .../gj/data_handle/DevUpdateTestBatch.groovy | 4 ++-- .../script/gj/village/GuangDaVillage.groovy | 4 ++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 3c827d188..56d1edabf 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -813,7 +813,7 @@ class OpenApiUtils { static def addrVerifyGuangda(city, address){ address = URLEncoder.encode(address, "utf-8"); - def url = "http://192.168.0.19:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" + def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" // def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" if(city){ url = url + "&city=${city}" @@ -830,6 +830,24 @@ class OpenApiUtils { } + static def addrVerifyBase(city, address){ + address = URLEncoder.encode(address, "utf-8"); + def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" +// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + if(city){ + url = url + "&city=${city}" + } + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.msgCode ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + // 省、市、区、街道、社区居委、POI补全 static def complete(city, address){ def url = "http://open.fangjia.com/addrSvc/complete?city=${city}&address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" 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 c9053f536..dd09d15a5 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:\\数据\\数据建设\\开发区外包\\1016' + def directoryPath = 'D:\\数据\\数据建设\\开发区外包\\1020' def dir = new File(directoryPath) if (dir.isDirectory()) { dir.eachFileRecurse(FileType.FILES) { 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 50ec412b8..671266e38 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/village/GuangDaVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy index 13470de95..a064f1913 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/GuangDaVillage.groovy @@ -10,9 +10,9 @@ class GuangDaVillage { } def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\光大\\公开数据信息补充v3.xlsx",{ d-> + ExcelUtils.multiThreadingModify("D:\\数据\\光大\\公开数据地址情况.xlsx",{ d-> - if(!d['R']){ + if(!d['R'] && d['A']){ def dto = OpenApiUtils.addrVerifyGuangda(null, d['A']) if(dto){ // def dto = jsonObj.result From 68386e531f42c0f35f3181659e17c9ebeec3a341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Tue, 28 Oct 2025 14:22:06 +0800 Subject: [PATCH 07/67] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E8=B5=B0=E5=8A=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/service/datastore/CitySellStatServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CitySellStatServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CitySellStatServiceImpl.java index 877313a33..eced083e8 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CitySellStatServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CitySellStatServiceImpl.java @@ -132,7 +132,7 @@ public class CitySellStatServiceImpl implements CitySellStatService { q.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate)); List s = new ArrayList(); - s.add(new SortParam("date", false)); + s.add(new SortParam("date", true)); return citySellStatDao.findAllByParams(q, s, count); } From 251c6668c4601fd1284044a08acabc7f65c360ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Thu, 30 Oct 2025 16:07:30 +0800 Subject: [PATCH 08/67] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/coresite/controllers/SaleLeadsController.java | 3 --- .../com/fangjia/coresite/controllers/UserController.java | 6 ------ 2 files changed, 9 deletions(-) diff --git a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/SaleLeadsController.java b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/SaleLeadsController.java index 9b208b918..b0bea5a68 100644 --- a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/SaleLeadsController.java +++ b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/SaleLeadsController.java @@ -573,9 +573,6 @@ public class SaleLeadsController { System.out.println(mobile + " 验证码 【"+ code+"】"); //测试先去掉发短信 smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - if(FangjiaConfig.getConfig().isTestEnvironment()){ - DingDingMessageUtil.sendTextMessage("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - } resultModel.setResult(Message.RESULT_SUCCESS); CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, FangJiaUserService.class, mobile + "_" + type, code); CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, FangJiaUserService.class, mobile, new Date().getTime()); diff --git a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/UserController.java b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/UserController.java index 140fc1930..03f3a1d99 100644 --- a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/UserController.java +++ b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/UserController.java @@ -168,9 +168,6 @@ public class UserController { String code = fangJiaUserService.randomCode(); try { smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - if(FangjiaConfig.getConfig().isTestEnvironment()){ - DingDingMessageUtil.sendTextMessage("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - } smsSendLog = new SmsSendLog(); smsSendLog.setContent("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); smsSendLog.setMobile(model.getMobile()); @@ -520,9 +517,6 @@ public class UserController { CacheUtils.putValue(CachePolicyEnum.TODAY, FangJiaUserService.class, ip, ipVisitCount+1); smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - if(FangjiaConfig.getConfig().isTestEnvironment()){ - DingDingMessageUtil.sendTextMessage("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。"); - } resultModel.setResult(Message.RESULT_SUCCESS); CacheUtils.putValue(CachePolicyEnum.TINY, FangJiaUserService.class, mobile + "_" + type, code); CacheUtils.putValue(CachePolicyEnum.TINY, FangJiaUserService.class, mobile, new Date().getTime()); From 307c7bac6bbfebf8f6baa1ef7ade1a81ca295ead Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Fri, 31 Oct 2025 09:58:34 +0800 Subject: [PATCH 09/67] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=88=BF=E4=BB=B7?= =?UTF-8?q?=E7=BD=91=E9=92=89=E9=92=89=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fangjia/service/sms/EmppSmsService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/sms/EmppSmsService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/sms/EmppSmsService.java index 9ca56fc64..214a91398 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/sms/EmppSmsService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/sms/EmppSmsService.java @@ -105,7 +105,6 @@ public class EmppSmsService implements SmsService { private void doSend(final String mobile, final String messageContent, final boolean isForRongshidai) throws SmsException { try { - DingDingMessageUtil.sendTextMessage(messageContent); jmsTemplate.send(smsOutgoingDestination, new MessageCreator() { public Message createMessage(Session session) throws JMSException { ActiveMQObjectMessage message = new ActiveMQObjectMessage(); From 5d67323fad821be896c007aa92acb64f71e07445 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Fri, 31 Oct 2025 09:59:13 +0800 Subject: [PATCH 10/67] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=88=BF=E4=BB=B7?= =?UTF-8?q?=E7=BD=91=E9=92=89=E9=92=89=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/util/PoiSearchResult.groovy | 29 +++ .../com/fangjia/script/util/PoiUtils.groovy | 176 ++++++++++++++++++ .../script/wenyan/temp/LouPanPingJi.groovy | 91 +++++++++ 3 files changed, 296 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiSearchResult.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiUtils.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/LouPanPingJi.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiSearchResult.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiSearchResult.groovy new file mode 100644 index 000000000..0af5ea201 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiSearchResult.groovy @@ -0,0 +1,29 @@ +package com.fangjia.script.util + +/** + * POI查询结果数据类 + */ +class PoiSearchResult { + // 总数量 + long totalCount + + // 最近距离(米) + Double minDistanceMeters + + // 最近的N个POI列表 + List nearestPois = [] + + // 类型分布统计 + Map typeDistribution = [:] + + // 主类型分布统计 + Map mainTypeDistribution = [:] + + // 区域分布统计 + Map districtDistribution = [:] + + @Override + String toString() { + return super.toString() + } +} \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiUtils.groovy new file mode 100644 index 000000000..0b8796e96 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/PoiUtils.groovy @@ -0,0 +1,176 @@ +package com.fangjia.script.util + +import org.apache.http.HttpHost +import org.apache.http.auth.AuthScope +import org.apache.http.auth.UsernamePasswordCredentials +import org.apache.http.client.CredentialsProvider +import org.apache.http.client.config.RequestConfig +import org.apache.http.impl.client.BasicCredentialsProvider +import org.apache.http.impl.nio.client.HttpAsyncClientBuilder +import org.elasticsearch.action.search.SearchRequest +import org.elasticsearch.action.search.SearchResponse +import org.elasticsearch.client.RequestOptions +import org.elasticsearch.client.RestClient +import org.elasticsearch.client.RestClientBuilder +import org.elasticsearch.client.RestHighLevelClient +import org.elasticsearch.common.unit.DistanceUnit +import org.elasticsearch.index.query.BoolQueryBuilder +import org.elasticsearch.index.query.QueryBuilders +import org.elasticsearch.search.builder.SearchSourceBuilder +import org.elasticsearch.search.sort.SortBuilders +import org.elasticsearch.search.sort.SortOrder +import org.elasticsearch.xpack.sql.jdbc.EsDataSource + +public class PoiUtils { + + static RestHighLevelClient client = getClient() + + static RestHighLevelClient getClient() { + RestClientBuilder builder = RestClient.builder(new HttpHost("192.168.0.89", 9200, "http")); + builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() { + @Override + RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) { + requestConfigBuilder.setConnectionRequestTimeout(1000 * 60); + requestConfigBuilder.setSocketTimeout(1000 * 180); + return requestConfigBuilder; + } + }) + builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { + @Override + HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) { + httpAsyncClientBuilder.disableAuthCaching(); + CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); + credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "elasticsearch")); + httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider); + return httpAsyncClientBuilder; + } + }) + return new RestHighLevelClient(builder) + } + + /** + * 根据经纬度搜索POI + * @param city + * @param lng + * @param lat + * @param tags + * @param distance + * @param maxResults + * @return + */ + public static PoiSearchResult searchPoi(String city, Double lng, Double lat, List tags =[],String distance = "1km", int maxResults = 20) { + PoiSearchResult poiSearchResult = null + SearchResponse response = null + try { + SearchSourceBuilder sourceBuilder = new SearchSourceBuilder() + // 构建查询条件 + BoolQueryBuilder boolQuery = QueryBuilders.boolQuery() + + // 地理位置查询 + boolQuery.must(QueryBuilders.geoDistanceQuery("location") + .point(lat, lng) + .distance(distance)) + + boolQuery.must(QueryBuilders.termQuery("city", city)) + if(!tags.isEmpty()){ + boolQuery.must(QueryBuilders.termsQuery("small_type", tags)) + } + sourceBuilder.trackTotalHits(true) // 强制追踪总数 +// boolQuery.must(QueryBuilders.termQuery("status", "0")) + sourceBuilder.query(boolQuery) + sourceBuilder.sort(SortBuilders.geoDistanceSort("location", lat, lng) + .order(SortOrder.ASC) + .unit(DistanceUnit.METERS)) + sourceBuilder.size(maxResults) + SearchRequest searchRequest = new SearchRequest("didata_map_poi_shards") + searchRequest.source(sourceBuilder) + response = client.search(searchRequest, RequestOptions.DEFAULT) + poiSearchResult = parseSearchResponse(response) + + } catch (Exception e) { + throw new RuntimeException("根据名称搜索POI失败: ${e.message}", e) + }finally { + + } + return poiSearchResult + } + + /** + * 解析搜索响应 + */ + private static PoiSearchResult parseSearchResponse(SearchResponse response) { + PoiSearchResult result = new PoiSearchResult() + // 总数量 + result.totalCount = response.hits.totalHits.value + // 最近的POI列表 + result.nearestPois = parsePoiInfos(response, true) + if(result.nearestPois.size() > 0){ + result.minDistanceMeters = result.nearestPois[0].distanceMeters + } + return result + } + + /** + * 解析POI信息列表 + */ + private static List parsePoiInfos(SearchResponse response, boolean includeDistance = true) { + List pois = [] + response.hits.hits.each { hit -> + def source = hit.sourceAsMap + PoiInfo poi = new PoiInfo( + id: source.id, + name: source.name, + type: source.type, + cat: source.cat, + mainType: source.main_type as Integer, + secondaryType: source.secondary_type, + smallType: source.small_type, + address: source.address, + city: source.city, + district: source.district, + province: source.province, + location: source.location as Map, + dataSource: source.data_source, + status: source.status + ) + // 添加距离信息 + if (includeDistance && hit.sortValues && hit.sortValues.length > 0) { + // 距离通常是最后一个排序字段 + def distanceValue = hit.sortValues[hit.sortValues.length - 1] + if (distanceValue instanceof Number) { + poi.distanceMeters = (int)distanceValue.doubleValue() + } + } + pois.add(poi) + } + return pois + } + + + + static void main(String[] args) { + PoiSearchResult result = PoiUtils.searchPoi("上海市", 121.19563,31.296209, ["便民商店/便利店","7-ELEVEn便利店","OK便利店"]) + println(result) + } +} + + +class PoiInfo { + String id + String name + String type + String cat + Integer mainType + String secondaryType + String smallType + String address + String city + String district + String province + Map location + Integer distanceMeters + String dataSource + String status +} + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/LouPanPingJi.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/LouPanPingJi.groovy new file mode 100644 index 000000000..96e53dedf --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/LouPanPingJi.groovy @@ -0,0 +1,91 @@ +package com.fangjia.script.wenyan.temp + +import com.fangjia.core.util.DataUtil +import com.fangjia.script.util.ExcelUtils +import org.apache.commons.lang3.StringUtils + + +public static Double normalize(Double orgValue, double min, double max) { + if (min > max) { + throw new IllegalArgumentException("min should be less than or equal to max"); + } + if(orgValue == null){ + return null; + } + double value = orgValue; + // 大于 max:不断除以 2,直到 ≤ max + while (value > max) { + value /= 2.0; + } + + // 小于 min:不断乘以 2,直到 ≥ min + while (value < min) { + if(value < 0){ + value /= 2.0; + }else{ + value *= 2.0; + } + + } + + return DataUtil.roundDouble(value, 2); +} +//def map1 =[:] +//ExcelUtils.read("C:\\Users\\goojia\\Desktop\\楼盘评级\\楼盘数据2.xlsx").each { +// map1[it[0]] = it[1] +//} +//ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈.xlsx",{List item-> +// item["X"] = map1.getOrDefault(item["A"],null) +// if(item["X"]){ +// DataUtil.roundDouble(item["X"],2) +// } +//}, 1) +// +//ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈.xlsx",{List item-> +// item["X"] = map1.getOrDefault(item["A"],null) +// if(item["X"]){ +// DataUtil.roundDouble(item["X"],2) +// } +//}, 3) + +//ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈.xlsx",{List item-> +// def row = "l" +// if(!(item[row] instanceof Double) && StringUtils.isBlank(item[row])){ +// item[ row] = null +// } +// if(item[row] && item[row] instanceof String){ +// println("---" + item) +// } +// item[row] = normalize(item[row], -30, 20); +// +//},0) +//ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈.xlsx",{List item-> +// def row = "l" +// if(!(item[row] instanceof Double) && StringUtils.isBlank(item[row])){ +// item[ row] = null +// } +// if(item[row] && item[row] instanceof String){ +// println("---" + item) +// } +// item[row] = normalize(item[row], -30, 20); +//},1) +ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈V3.xlsx",{List item-> + def row = "l" + if(!(item[row] instanceof Double) && StringUtils.isBlank(item[row])){ + item[ row] = null + } + if(item[row] && item[row] instanceof String){ + println("---" + item) + } + item[row] = normalize(item[row], -30, 13); +},2) +ExcelUtils.multiThreadingModify("C:\\Users\\goojia\\Desktop\\楼盘评级\\估家科技楼盘评级数据测试反馈V3.xlsx",{List item-> + def row = "l" + if(!(item[row] instanceof Double) && StringUtils.isBlank(item[row])){ + item[ row] = null + } + if(item[row] && item[row] instanceof String){ + println("---" + item) + } + item[row] = normalize(item[row], -30, 13); +},3) From 43897a25756409a1b09bb180410f7e29e4679150 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 31 Oct 2025 10:04:34 +0800 Subject: [PATCH 11/67] add --- .../script/ccbevaluation/AddSzDealData.groovy | 4 +- .../com/fangjia/script/gj/OpenApiUtils.groovy | 2 +- .../gj/village/ailiyun/KunlunVillage.groovy | 47 +++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy 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 634e78d3f..9ebbbcaa2 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:\\数据\\建行\\房产估值\\成交\\深圳8月成交数据.xlsx", 0, 1) +def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳9月份成交数据.xlsx", 0, 1) def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 56d1edabf..b9ddb598b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -832,7 +832,7 @@ class OpenApiUtils { static def addrVerifyBase(city, address){ address = URLEncoder.encode(address, "utf-8"); - def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" + def url = "http://192.168.0.100:32080/FangJiaAddressService/enterpriseVillageIdentify?address=${address}" // def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" if(city){ url = url + "&city=${city}" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy new file mode 100644 index 000000000..dce484e27 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy @@ -0,0 +1,47 @@ +package com.fangjia.script.gj.village.ailiyun + +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.ExcelUtils + +class KunlunVillage { + static main(args) { + def task = new KunlunVillage(); + task.run() + } + + def run(){ + ExcelUtils.multiThreadingModify("D:\\数据\\昆仑\\3987户需批量更新涉农信息明细-20251023-结果.xlsx",{ d-> + + if(!d['R'] && d['B']){ + def dto = OpenApiUtils.addrVerifyGuangda(null, d['B']) + if(dto){ +// def dto = jsonObj.result + d['F'] = dto.province + d['G'] = dto.provinceCode + d['H'] = dto.city + d['I'] = dto.cityCode; + d['J'] = dto.district + d['K'] = dto.districtCode + d['L'] = dto.town + d['M'] = dto.townCode + d['N'] = dto.committee + d['O'] = dto.committeeCode + d['P'] = dto.typeCode + d['Q'] = dto.typeName + d['R'] = dto.verifyFlag//涉农标识 + d['S'] = dto.addrVerify//地址是否有效信息 + d['T'] = dto.countyLevelCity//是否为县级市 + d['U'] = dto.countyGov//是否为县政府 + d['V'] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + d['W'] = dto.devDistrict//是否为开发区 + d['X'] = dto.devDistrictName//开发区 + d['Y'] = dto.devLevel//开发区等级 + d['Z']= dto.administrativeTowns;//是否市辖建制 + d['AA'] = dto.prefectureLevelOrAbove ;// 是否为地级市以上行政区划 + d['AB'] = dto.countyGovTown; //县政府所在镇 + } + } + + }) + } +} From 19867cd1d791668fd99d878c599388bd8e8fdc61 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Fri, 31 Oct 2025 11:22:27 +0800 Subject: [PATCH 12/67] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=A7=9F=E9=87=91=E6=9C=88=E6=95=B0=E4=B8=8D?= =?UTF-8?q?=E6=98=AF12=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/open/controllers/SqmetreRentController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java index 313fa748a..d00eb39d5 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java @@ -92,7 +92,7 @@ public class SqmetreRentController { // 设置返回结果,防止 subList 越界 if (result.size() > 1) { - mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size()))); + mav.setModel(BasicModel.buildOKModel().setResult(result)); } else { mav.setModel(BasicModel.buildOKModel().setResult(null)); } @@ -166,7 +166,7 @@ public class SqmetreRentController { // 设置返回结果,防止 subList 越界 if (result.size() > 1) { - mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size()))); + mav.setModel(BasicModel.buildOKModel().setResult(result)); } else { mav.setModel(BasicModel.buildOKModel().setResult(null)); } From 415e8946c2b033f44f7c093276cd004c5c705ae7 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 31 Oct 2025 20:43:41 +0800 Subject: [PATCH 13/67] =?UTF-8?q?=E4=B8=8A=E6=B5=B7=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/AddrSvcController.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index 852bbd508..3174945c7 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -864,9 +864,9 @@ public class AddrSvcController { if (result.containsKey("town")) { map.put("town", result.getString("town")); } - if (result.containsKey("committee")) { - map.put("committee", result.getString("committee")); - } +// if (result.containsKey("committee")) { +// map.put("committee", result.getString("committee")); +// } if (result.containsKey("provinceCode")) { map.put("provinceCode", result.getString("provinceCode")); } @@ -879,15 +879,15 @@ public class AddrSvcController { if (result.containsKey("townCode")) { map.put("townCode", result.getString("townCode")); } - if (result.containsKey("committeeCode")) { - map.put("committeeCode", result.getString("committeeCode")); - } - if (result.containsKey("typeCode")) { - map.put("typeCode", result.getString("typeCode")); - } - if (result.containsKey("typeName")) { - map.put("typeName", result.getString("typeName")); - } +// if (result.containsKey("committeeCode")) { +// map.put("committeeCode", result.getString("committeeCode")); +// } +// if (result.containsKey("typeCode")) { +// map.put("typeCode", result.getString("typeCode")); +// } +// if (result.containsKey("typeName")) { +// map.put("typeName", result.getString("typeName")); +// } if (result.containsKey("verifyFlag")) { map.put("verifyFlag", result.getString("verifyFlag")); } else { @@ -921,6 +921,9 @@ public class AddrSvcController { if (result.containsKey("countyGovTown")) { map.put("countyGovTown", result.getString("countyGovTown")); } + if (result.containsKey("remark")) { + map.put("remark", result.getString("remark")); + } basicModel.setResult(map); mav.setModel(basicModel); } else { From d761ed88cd3e77734cbe4aa13b729e5720d17b1e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 3 Nov 2025 09:54:45 +0800 Subject: [PATCH 14/67] update --- .../com/fangjia/script/gj/OpenApiUtils.groovy | 19 +++++++ .../gj/data_handle/DevUpdateTestBatch.groovy | 4 +- .../fangjia/script/gj/village/ShBank.groovy | 50 +++++++++++++++++ .../jiangnanblank/TestEvaluation.groovy | 56 ++++++++++++++++++- 4 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBank.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 56d1edabf..9e33ce586 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -830,6 +830,25 @@ class OpenApiUtils { } + static def addrVerifyShBank(city, address){ + address = URLEncoder.encode(address, "utf-8"); +// def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" + def url = "http://localhost:8080/addrSvc/boscEnterpriseVillageIdentify?address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + if(city){ + url = url + "&city=${city}" + } + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + + static def addrVerifyBase(city, address){ address = URLEncoder.encode(address, "utf-8"); def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" 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/village/ShBank.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBank.groovy new file mode 100644 index 000000000..ba01edc17 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBank.groovy @@ -0,0 +1,50 @@ +package com.fangjia.script.gj.village + +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.ExcelUtils + +class ShBank { + static main(args) { + def task = new ShBank(); + task.run() + } + + def run(){ + ExcelUtils.multiThreadingModify("D:\\数据\\上海银行\\上海银行新逻辑的测试案例.xls",{ d-> + + if(!d['R'] && d['B']){ + def dto = OpenApiUtils.addrVerifyShBank(null, d['B']) + if(dto){ +// def dto = jsonObj.result + d['E'] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + d['F'] = dto.remark + + d['G'] = dto.province + d['H'] = dto.provinceCode + d['I'] = dto.city + d['J'] = dto.cityCode; + d['K'] = dto.district + d['L'] = dto.districtCode + d['M'] = dto.town + d['N'] = dto.townCode +// d['N'] = dto.committee +// d['O'] = dto.committeeCode +// d['P'] = dto.typeCode +// d['Q'] = dto.typeName + d['O'] = dto.verifyFlag//涉农标识 + d['P'] = dto.addrVerify//地址是否有效信息 + d['Q'] = dto.countyLevelCity//是否为县级市 + d['R'] = dto.countyGov//是否为县政府 + d['S'] = dto.devDistrict//是否为开发区 + d['T'] = dto.devDistrictName//开发区 + d['U'] = dto.devLevel//开发区等级 + d['V']= dto.administrativeTowns;//是否市辖建制 + d['W'] = dto.prefectureLevelOrAbove ;// 是否为地级市以上行政区划 + d['X'] = dto.countyGovTown; //县政府所在镇 + + } + } + + }) + } +} 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 db29b6b68..9e3f88cc9 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 @@ -6,6 +6,7 @@ import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.gj.ccb.CcbCodeUtils import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient import java.util.concurrent.ExecutorService import java.util.concurrent.Executors @@ -20,7 +21,9 @@ class TestEvaluation { // task.run(); // task.match() - task.houseSimilar() +// task.houseSimilar() + + task.newAndOldMatch() } def houseSimilar(){ @@ -133,4 +136,55 @@ class TestEvaluation { println s } + def newAndOldMatch(){ + 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) + 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") + }else{ + jsonObject = FangjiaClientUtils.newMatch(city, address, "property", 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") + } + } + } + + + if(!d['G']){ + def jsonObject2 = OpenApiClient.addressMatch(city, address, "shop", false, null, null) + 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") + } +// else{ +// jsonObject2 = OpenApiClient.addressMatch(city, address, "property", true, null, null) +// if(jsonObject2 != null && jsonObject2.precise!=-1) { +// d['F'] = jsonObject2.get("id") +// d['G'] = jsonObject2.get("city")+"(地图)" +// d['H'] = jsonObject2.get("district") +// d['I'] = jsonObject2.get("name") +// } +// } + } + + } + + }) + } + } From 50c91f98e78d3d65f7301ae54d7438d7c6d614e8 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 3 Nov 2025 10:04:36 +0800 Subject: [PATCH 15/67] update --- .../com/fangjia/script/gj/OpenApiUtils.groovy | 17 +++++++ .../{ailiyun => }/KunlunVillage.groovy | 2 +- .../script/gj/village/ShBankVillage.groovy | 48 +++++++++++++++++++ .../jiangnanblank/TestEvaluation.groovy | 24 ++++++++-- 4 files changed, 87 insertions(+), 4 deletions(-) rename projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/{ailiyun => }/KunlunVillage.groovy (97%) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBankVillage.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index b9ddb598b..92c015c5c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -810,6 +810,23 @@ class OpenApiUtils { return null; } + static def addrVerifyShBank(city, address){ + address = URLEncoder.encode(address, "utf-8"); + def url = "http://192.168.0.100:32080/FangJiaAddressService/boscEnterpriseVillageIdentify?address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" +// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + if(city){ + url = url + "&city=${city}" + } + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.msgCode ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } static def addrVerifyGuangda(city, address){ address = URLEncoder.encode(address, "utf-8"); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy similarity index 97% rename from projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy rename to projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy index dce484e27..d8b140529 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/KunlunVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy @@ -1,4 +1,4 @@ -package com.fangjia.script.gj.village.ailiyun +package com.fangjia.script.gj.village import com.fangjia.script.gj.OpenApiUtils import com.fangjia.script.util.ExcelUtils diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBankVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBankVillage.groovy new file mode 100644 index 000000000..022aabf6d --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ShBankVillage.groovy @@ -0,0 +1,48 @@ +package com.fangjia.script.gj.village + +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.ExcelUtils + +class ShBankVillage { + static main(args) { + def task = new ShBankVillage(); + task.run() + } + + def run(){ + ExcelUtils.multiThreadingModify("D:\\数据\\上海银行\\内部测试数据.xlsx", { d -> + + if (!d['R'] && d['B']) { + def dto = OpenApiUtils.addrVerifyShBank(null, d['B']) + if (dto) { +// def dto = jsonObj.result + d['E'] = dto.remark + d['F'] = dto.province + d['G'] = dto.provinceCode + d['H'] = dto.city + d['I'] = dto.cityCode; + d['J'] = dto.district + d['K'] = dto.districtCode + d['L'] = dto.town + d['M'] = dto.townCode + d['N'] = dto.committee + d['O'] = dto.committeeCode + d['P'] = dto.typeCode + d['Q'] = dto.typeName + d['R'] = dto.verifyFlag//涉农标识 + d['S'] = dto.addrVerify//地址是否有效信息 + d['T'] = dto.countyLevelCity//是否为县级市 + d['U'] = dto.countyGov//是否为县政府 + d['V'] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + d['W'] = dto.devDistrict//是否为开发区 + d['X'] = dto.devDistrictName//开发区 + d['Y'] = dto.devLevel//开发区等级 + d['Z'] = dto.administrativeTowns;//是否市辖建制 + d['AA'] = dto.prefectureLevelOrAbove;// 是否为地级市以上行政区划 + d['AB'] = dto.countyGovTown; //县政府所在镇 + } + } + + }) + } +} 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 db29b6b68..6930717fd 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 @@ -3,13 +3,11 @@ package com.fangjia.script.jiangnanblank import com.fangjia.core.util.HttpRequest import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.commData.CommonDatautils -import com.fangjia.script.gj.ccb.CcbCodeUtils import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.util.ExcelUtils import java.util.concurrent.ExecutorService import java.util.concurrent.Executors - /** * Created by gaojuan on 2017/12/7. */ @@ -20,7 +18,8 @@ class TestEvaluation { // task.run(); // task.match() - task.houseSimilar() +// task.houseSimilar() + task.newMatch() } def houseSimilar(){ @@ -91,6 +90,25 @@ class TestEvaluation { } + def newMatch(){ + ExcelUtils.multiThreadingModify("D:\\数据\\估值\\地址估价-匹配(加写字楼-商铺) - v2.xlsx", { d -> + def city = "上海" + def address = d['A'] + if(!d['B'] && address){ + def jsonObject = FangjiaClientUtils.newMatch(city, address, "", 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")?jsonObject.get("propertyType"):jsonObject.get("category") + d['G'] = jsonObject.get("credit") + } + } + + }); + } def run(){ def citys = CommonDatautils.findAllCity(); for(def city :citys){ From 6b2436c5ef17aae9d260ba99686547efe1490787 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 3 Nov 2025 10:09:33 +0800 Subject: [PATCH 16/67] =?UTF-8?q?=E5=8E=A6=E9=97=A8=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E8=B7=91=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/gj/village/XiamenVillage.groovy | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy new file mode 100644 index 000000000..6d8badbb2 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy @@ -0,0 +1,47 @@ +package com.fangjia.script.gj.village + +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.ExcelUtils + +class XiamenVillage { + static main(args) { + def task = new XiamenVillage(); + task.run() + } + + def run(){ + ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\涉农组织类型判定(to估家,2025-09-30)-结果.xlsx",{ d-> + + if(!d['R']){ + def dto = OpenApiUtils.addrVerifyXiameng(null, d['B'], 2) + if(dto){ +// def dto = jsonObj.result + d['F'] = dto.province + d['G'] = dto.provinceCode + d['H'] = dto.city + d['I'] = dto.cityCode; + d['J'] = dto.district + d['K'] = dto.districtCode + d['L'] = dto.town + d['M'] = dto.townCode + d['N'] = dto.committee + d['O'] = dto.committeeCode + d['P'] = dto.typeCode + d['Q'] = dto.typeName + d['R'] = dto.verifyFlag//涉农标识 + d['S'] = dto.addrVerify//地址是否有效信息 + d['T'] = dto.countyLevelCity//是否为县级市 + d['U'] = dto.countyGov//是否为县政府 + d['V'] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + d['W'] = dto.devDistrict//是否为开发区 + d['X'] = dto.devDistrictName//开发区 + d['Y'] = dto.devLevel//开发区等级 + d['Z']= dto.administrativeTowns;//是否市辖建制 + d['AA'] = dto.prefectureLevelOrAbove ;// 是否为地级市以上行政区划 + d['AB'] = dto.countyGovTown; //县政府所在镇 + } + } + + }) + } +} From 3bf9b8dc68c39678d3243504d1c68182669c6ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Wed, 5 Nov 2025 17:56:53 +0800 Subject: [PATCH 17/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=B0=E5=80=BC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/PropertyController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index fdec48ff0..18270c8ab 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -1196,9 +1196,18 @@ public class PropertyController { int orgAvgPrice = 0; if (districtStatBo != null) { if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) { - orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + if(districtStatBo.getVillaDistrictStat().getAvg_price_2b() != null && districtStatBo.getVillaDistrictStat().getAvg_price_2b() > 0){ + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvg_price_2b(); + }else{ + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } + } else if (districtStatBo.getDistrictStat() != null) { - orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + if(districtStatBo.getDistrictStat().getAvg_price_2b() != null && districtStatBo.getDistrictStat().getAvg_price_2b() > 0){ + orgAvgPrice = districtStatBo.getDistrictStat().getAvg_price_2b(); + }else{ + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } } } if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { From af77031018bf7c4096b7651130e8784ee975313f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 5 Nov 2025 18:23:31 +0800 Subject: [PATCH 18/67] =?UTF-8?q?=E6=88=90=E4=BA=A4=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=9C=9D=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fangjia/open/model/CommercialModel.java | 6 +++--- .../fangjia/service/mongo/fangjia/DealPriceServiceImpl.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/CommercialModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/CommercialModel.java index 0a91d3da7..a136e8ef0 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/CommercialModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/CommercialModel.java @@ -14,7 +14,7 @@ public class CommercialModel extends FangjiaApiModel{ private Integer maxFloor;//总楼层 private Integer passengerFlow;//客流量---0:高 1:中 2:低 - private Integer LeaseStability;//租约稳定性---0:持续稳定出租 1:阶段性出租 2:偶尔出租 3:未出租 + private Integer leaseStability;//租约稳定性---0:持续稳定出租 1:阶段性出租 2:偶尔出租 3:未出租 private Integer sellType;//出售/转让---0:出售 1:转让 private Integer decorationCost;//装修成本(单位:万元) private Integer decorationYear;//装修年限(单位:年) @@ -72,11 +72,11 @@ public class CommercialModel extends FangjiaApiModel{ } public Integer getLeaseStability() { - return LeaseStability; + return leaseStability; } public void setLeaseStability(Integer leaseStability) { - LeaseStability = leaseStability; + leaseStability = leaseStability; } public Integer getSellType() { diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java index dd205bd77..8a93f201e 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java @@ -177,7 +177,7 @@ public class DealPriceServiceImpl implements DealPriceService { sortParams.add(new SortParam("tradeDate", false)); return dealPriceDao.findAllByParams(params, sortParams, 0, max, new String[] { "city", "region", "districtName", "avgPrice", "fitment", "area", "totalPrice", - "tradeDate", "source", "room", "hall", "toilet", "height", "floor" }); + "tradeDate", "source", "room", "hall", "toilet", "height", "floor","direction" }); } @Override From 1e01b4b9d06ac36a6b5d6c22819badddc88311d0 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 10 Nov 2025 08:33:57 +0800 Subject: [PATCH 19/67] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=AB=98=E5=BE=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuzhou/DistrictSellStatBatch.groovy | 58 +++++++++----- .../com/fangjia/script/gj/OpenApiUtils.groovy | 13 ++++ .../fangjia/script/gj/abc/SuzouPocTest.groovy | 78 ++++++++++++++----- .../gj/data_handle/DevUpdateTestBatch.groovy | 6 +- .../gj/data_handle/NewGaoDePoiBatch.groovy | 2 +- .../gj/data_handle/TownStandardBatch.groovy | 4 +- .../gj/district/DistrictLocationGeo.groovy | 35 +++++++++ .../jiangnanblank/TestEvaluation.groovy | 21 ++++- .../fangjia/script/util/OpenApiClient.groovy | 69 ++++++++++++++++ .../yinjihaun/amap/GaoDeApiUtils.groovy | 4 +- 10 files changed, 242 insertions(+), 48 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy 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 7d934e984..4da8b5658 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 @@ -37,14 +37,14 @@ 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() + def months = DateUtils.getMonthList(202209) + months = months[0..(months.size()-1)] + println months + for(def month : months){ + def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") + calcMonthlyPrice(curDate) + } +// calcMonthlyPrice() } @@ -70,6 +70,8 @@ class DistrictSellStatBatch extends BaseBatch { curDate = new Date() } def citys = CommonUtils.findAllCity() + citys.remove("上海") + citys.remove("福州") 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(curDate)) @@ -87,22 +89,25 @@ class DistrictSellStatBatch extends BaseBatch { for(def city : citys){ index++ + if(index < 242){ + continue + } def districts = [] if(city == "福州"){ - if(day == 2){ + if(day == 29){ 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() } }else{ def q = new BasicDBObject("city", city).append("cat", "district").append("status", 0) -// q.put("name", "翠园楼") - if(day == 2){ +// q.put("name", "越华路小区") +// if(day == 30){ districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000).toList() - }else{ - q.put("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)) - districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000) - } +// }else{ +// q.put("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)) +// districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000) +// } } println index+" "+city +" "+districts.size()+" "+ curDate.toString() @@ -155,7 +160,7 @@ class DistrictSellStatBatch extends BaseBatch { def key = dist.region +"##" + dist.name def weekendPriceObj = weekendPriceMap.get(key) - if(weekendPriceObj){ + if(weekendPriceObj && weekendPriceObj.avg_price){ def curPriceObj = curMonthlyPriceMap.get(key) def lastMonthPriceObj = lastMonthlyPriceMap.get(key) def lastYearPriceObj = lastYearPriceMap.get(key) @@ -216,8 +221,19 @@ class DistrictSellStatBatch extends BaseBatch { data.put("credit", weekendPriceObj.credit) def q = new BasicDBObject() - q.put("date", curMonth) - q.put("commid", dist._id.toString()) + if(curPriceObj.commid){ + q.put("date", curMonth) + q.put("commid", dist._id.toString()) + }else{ + q.put("date", curMonth) + q.put("city", dist.city) + q.put("region", dist.region) + q.put("district_name", dist.name) + + data.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 curMonth+" [update]"+totalCount.get()+" "+ dist.city+" "+dist.name @@ -239,6 +255,8 @@ class DistrictSellStatBatch extends BaseBatch { DISTRICT_SELL_STAT.save(data) println curMonth+" [save]"+totalCount.get()+" "+ dist.city+" "+dist.name } + + } } catch (Exception e) { @@ -281,6 +299,10 @@ class DistrictSellStatBatch extends BaseBatch { if(d.avg_price_2b && d.value_type!=1){ d.avg_price = d.avg_price_2b } + }else{ + if(d.avg_price_2b){ + d.avg_price = d.avg_price_2b + } } priceMap.put(d.region +"##"+d.district_name, d) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 6ded33f82..8026c0447 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -945,4 +945,17 @@ class OpenApiUtils { return null; } + + static def lactionEvaluation(area, lng, lat){ + def url = "http://192.168.0.100:30020/avmWeb/avmAnn?area=${area}&location=lng"+","+lat + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.msgCode ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } } 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 4693542de..4b5e0f2e3 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 @@ -36,7 +36,8 @@ class SuzouPocTest { // task.newRun() // task.test()//有楼层 // task.testEval()//无楼层 - task.level()//楼盘评级 +// task.level()//楼盘评级 + task.house() } def test(){ @@ -97,36 +98,73 @@ class SuzouPocTest { } def testEval(){ - ExcelUtils.modify("D:\\数据\\其它\\附件1:POC测试样本(匹配).xlsx", { d -> - if(d['O'] && !d['T']){ + ExcelUtils.modify("D:\\数据\\宏信息\\样本房源-估值.xlsx", { d -> + if(!d['O'] && d['E']){ // def city = d['C'] // if(city == "市辖区"){ // city = d['B'] // } - def obj = CommonDatautils.findDistrictById(d['O']) - if(obj){ - d['R'] = obj.city - d['S'] = obj.region - d['T'] = obj.name - def ret1 = OpenApiClient.addressEvaluation(obj.city, obj.region, obj.city+obj.region+obj.name, obj.name, d['F'], null, null) +// def obj = CommonDatautils.findDistrictById(d['O']) +// if(obj){ +// 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) if (ret1) { - d['P'] = ret1.totalPrice - d['Q'] = ret1.avgPrice - }else{ - def dbo = CommonDatautils.queryFirstDistrictPrice(obj.city, obj.region, obj.name) - if(dbo) { - d['P'] = (int)(dbo.avg_price_2b*d['F'].toString().toDouble()) - d['Q'] = dbo.avg_price_2b - - } - + d['J'] = ret1.totalPrice + d['K'] = ret1.avgPrice + d['L'] = ret1.city + d['M'] = ret1.district + d['N'] = ret1.name } - } +// else{ +// def dbo = CommonDatautils.queryFirstDistrictPrice(obj.city, obj.region, obj.name) +// if(dbo) { +// d['P'] = (int)(dbo.avg_price_2b*d['F'].toString().toDouble()) +// d['Q'] = dbo.avg_price_2b +// +// } +// +// } +// } } }); } + def house(){ + def cases = [] + cases << ["城市", "区域","板块", "名称", "面积", "单价","总价","装修", "朝向", "距离","所在楼层","总楼层","室","厅","卫","发布时间","标题", "序号"] + ExcelUtils.modify("D:\\数据\\宏信息\\样本房源-估值.xlsx", { d -> + if(d['L']){ + def obj = CommonDatautils.findDistrict(d['L'], d['M'], d['N'], "district") + if(obj){ + def lng = obj.lng/10000000000.0 + def lat = obj.lat/10000000000.0 + def location = String.valueOf(lng)+","+ String.valueOf(lat) + def result = OpenApiClient.houseAroundBylocationAction(location, d['I'], 0, 0, 50) + 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"],"挂牌"] + } + } + def address = d['L']+d['M']+d['N'] + def dealRets = OpenApiClient.dealHouse(d['L'], d['M'], d['N'], address, d['I']) + 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"], "成交"] + } + } + + } + + } + + }) + println cases.size() + ExcelUtils.write("D:\\数据\\宏信息\\样本房源-估值.xlsx", cases, "样本") + } + def newRun(){ println("start:"+new Date().toString()) 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 50ec412b8..45332f6f1 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,13 +33,11 @@ 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("新疆维吾尔自治区","喀什地区","麦盖提县", "麦盖提镇", "是") - - } def addDev(path){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy index ea28d2c0b..70b407ceb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy @@ -191,7 +191,7 @@ class NewGaoDePoiBatch extends BaseBatch{ if(smallArr && smallArr.size()>=1){ saveObj.small_type = smallArr[0] }else{ - saveObj.small_type = smallstr + saveObj.8 = smallstr } }else{ saveObj.small_type = saveObj.secondary_type diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy index 3797a3924..8edaa8a99 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy @@ -57,9 +57,9 @@ class TownStandardBatch extends BaseBatch{ } def TownStandard(){ - townStandardByCat("office") +// townStandardByCat("office") // townStandardByPoi() -// addTownByTownShape()//为没有乡镇街道的poi,补充乡镇街道,忽略区域,并使用地图 + addTownByTownShape()//为没有乡镇街道的poi,补充乡镇街道,忽略区域,并使用地图 // standardTown() // updateTownData() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy new file mode 100644 index 000000000..04ec66d5f --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -0,0 +1,35 @@ +package com.fangjia.script.gj.district + +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import org.bson.types.ObjectId + +class DistrictLocationGeo { + + final DBCollection seaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "seaweed_gaode_pois", "192.168.0.235", 27018) + + static main(args) { + def task = new DistrictLocationGeo() + task.run()//调用高德逆解析,并保存数据 + } + def run(){ + ExcelUtils.modify("D:\\数据\\京东\\需逆解析数据-test.xlsx",{ d-> + def jsonObject = GaoDeApiUtils.geocode(d['C']) + if(jsonObject){ + def dbo = new BasicDBObject() + dbo.put("old_id", d['B']) + dbo.put("old_location", d['C']) + dbo.put("formatted_address", jsonObject.regeocode.formatted_address) + dbo.put("addressComponent", jsonObject.regeocode.addressComponent) + dbo.put("pois", jsonObject.regeocode.pois) + dbo.put("roads", jsonObject.regeocode.roads) + dbo.put("roadinters", jsonObject.regeocode.roadinters) + dbo.put("aois", jsonObject.regeocode.aois) + seaweedGaodePoisColl.save(dbo) + } + }) + } +} 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 8621a2787..d4bff37bb 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 @@ -20,10 +20,12 @@ class TestEvaluation { // task.match() // task.houseSimilar() - task.newMatch() +// task.newMatch() // task.houseSimilar() - task.newAndOldMatch() +// task.newAndOldMatch() + + task.addFjwToBprice("D:\\数据\\估值\\地址估价-匹配(加写字楼-商铺) - v2.xlsx") } def houseSimilar(){ @@ -206,4 +208,19 @@ 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 + } + } + } + }) + } + + } 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 9d7fad788..c3dbfe651 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 @@ -8,6 +8,7 @@ import com.mongodb.DBCollection import com.mongodb.DBCursor import net.sf.json.JSONArray import net.sf.json.JSONObject +import net.sf.json.groovy.JsonSlurper import org.apache.commons.lang.StringUtils import org.apache.commons.lang.SystemUtils @@ -1577,5 +1578,73 @@ public class OpenApiClient { + public static def houseAroundBylocationAction(location, size, propertyType, houseType, pageSize) { + + def url ="https://open.fangjia.com/house/around?location="+location+"&size="+size+"&pageSize="+pageSize+"&propertyType="+propertyType+"&houseType="+houseType + url = url +"&token="+TOKEN + + def content = new HttpRequest().newGet(url, null, "utf-8") + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + + return null + } + + + static def dealHouse(city, region, name, area, address){ + + def url ="https://open.fangjia.com/property/deal?city="+city+"&address="+address+"&district="+region+"&name="+name+"&size="+area + url = url +"&token="+TOKEN + + def content = new HttpRequest().newGet(url, null, "utf-8") + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + + return null + } + + + public static JSONObject propertyHouseAction(city, district, name, size, propertyType) { + 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("propertyType", propertyType) + params.put("__refresh_cache","1") + + String content = new HttpRequest().get("https://open.fangjia.com/property/house", params, "utf-8") + JSONObject result = JSONObject.fromObject(content); + while (result == null) { + result = HttpRequestUtil.getJsonContent("https://open.fangjia.com/property/house", params, "utf-8") + println("${city} ${name} 程序调用异常") + Thread.sleep(6000) + } + if (result.getInt("code") == 0) { + 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 + } + + + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy index 60dc4ddb2..c9dceabe6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy @@ -13,7 +13,7 @@ import java.util.zip.GZIPInputStream class GaoDeApiUtils { //94c74c60e102972a8d17b7b75d7403be - def static GAO_DE_AK = "94c74c60e102972a8d17b7b75d7403be" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 + def static GAO_DE_AK = "a34894d151fffff94f9a33bae3d5565c" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 //15021384995:dfc2245bac8a7b2d5b62e060e59d4eca /** @@ -29,6 +29,8 @@ class GaoDeApiUtils { params.put("key", GAO_DE_AK) params.put("location", location) params.put("extensions","all") + params.put("radius", "3000") + params.put("poitype", "120000|120200|120203|120300|120301|120302|120303") String content def stop = true JSONObject jsonObj = null From 7694a310e24edcd3170c5d7ea84c5139ee43e1a0 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 10 Nov 2025 09:56:06 +0800 Subject: [PATCH 20/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/gj/OpenApiUtils.groovy | 17 ----------------- .../script/gj/village/XiamenVillage.groovy | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 6ded33f82..bfc91de49 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -847,23 +847,6 @@ class OpenApiUtils { } - static def addrVerifyShBank(city, address){ - address = URLEncoder.encode(address, "utf-8"); -// def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" - def url = "http://localhost:8080/addrSvc/boscEnterpriseVillageIdentify?address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" - if(city){ - url = url + "&city=${city}" - } - String content = new HttpRequest().get(url, "utf-8"); - if(content){ - def doc = new JsonSlurper().parseText(content) - if(doc && doc.code ==200 && doc.result){ - def dtos = doc.result - return dtos - } - } - return null; - } static def addrVerifyBase(city, address){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy index 6d8badbb2..4337e871e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy @@ -10,7 +10,7 @@ class XiamenVillage { } def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\涉农组织类型判定(to估家,2025-09-30)-结果.xlsx",{ d-> + ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\涉农组织类型判定(to估家,2025-10-31)-以此为准.xlsx",{ d-> if(!d['R']){ def dto = OpenApiUtils.addrVerifyXiameng(null, d['B'], 2) From 428fa5420787a12a5acd594b437af318a01bba68 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 10 Nov 2025 15:46:56 +0800 Subject: [PATCH 21/67] =?UTF-8?q?=E6=9F=A5=E6=88=BF=E6=BA=90=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/gj/district/DistrictLocationGeo.groovy | 8 +++++--- .../FjwBigdataForsaleBatch.groovy | 15 +++++---------- .../script/yinjihaun/amap/GaoDeApiUtils.groovy | 7 +++---- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy index 04ec66d5f..eefe4d587 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -5,7 +5,6 @@ import com.fangjia.script.util.MongoUtils import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection -import org.bson.types.ObjectId class DistrictLocationGeo { @@ -16,9 +15,10 @@ class DistrictLocationGeo { task.run()//调用高德逆解析,并保存数据 } def run(){ - ExcelUtils.modify("D:\\数据\\京东\\需逆解析数据-test.xlsx",{ d-> + ExcelUtils.multiThreadingModify("D:\\数据\\京东\\需逆解析数据.xlsx", { d -> def jsonObject = GaoDeApiUtils.geocode(d['C']) - if(jsonObject){ + def count = 0 + if (jsonObject) { def dbo = new BasicDBObject() dbo.put("old_id", d['B']) dbo.put("old_location", d['C']) @@ -29,7 +29,9 @@ class DistrictLocationGeo { dbo.put("roadinters", jsonObject.regeocode.roadinters) dbo.put("aois", jsonObject.regeocode.aois) seaweedGaodePoisColl.save(dbo) + count = jsonObject.regeocode.pois.size() } + d['D'] = count }) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy index 9d42392f1..c9801ad9e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy @@ -6,17 +6,15 @@ import com.fangjia.script.Watcher import com.fangjia.script.ccbevaluation.CcbCommonUtils 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 import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ExcelUtils -import com.fangjia.script.util.FangJiaAreaMapUtils -import com.google.common.hash.* +import com.google.common.hash.BloomFilter +import com.google.common.hash.Funnels import com.mongodb.BasicDBObject import com.mongodb.DBObject import groovy.sql.Sql import org.apache.commons.lang.StringUtils -import org.bson.types.ObjectId import org.elasticsearch.index.query.BoolQueryBuilder import org.elasticsearch.index.query.QueryBuilder import org.elasticsearch.index.query.QueryBuilders @@ -24,15 +22,12 @@ import org.elasticsearch.xpack.sql.jdbc.EsDataSource import java.nio.charset.StandardCharsets 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 import java.util.regex.Matcher import java.util.regex.Pattern - - /** * 建行模型估值项目 * 出售房源数据同步 @@ -201,7 +196,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ } finally { latch.countDown() } - }; + }; }) } latch.await() @@ -492,8 +487,8 @@ class FjwBigdataForsaleBatch extends BaseBatch{ def findHousesByMdate(def city, def region, def cat, def startDate, def endDate, def name, def alias, def estate_type2, rets1){ -// def date = DateUtils.addMonth(endDate.toString(), -3, "yyyyMMdd") - def date = DateUtils.addMonth(endDate.toString(), -12, "yyyyMMdd") + def date = DateUtils.addMonth(endDate.toString(), -3, "yyyyMMdd") +// def date = DateUtils.addMonth(endDate.toString(), -12, "yyyyMMdd") def startMdate = DateUtils.parseFromTightByPattern(date,"yyyyMMdd")//DateUtils.parseFromTightByPattern("20240519","yyyyMMdd") def endMdate = DateUtils.parseFromTightByPattern(endDate.toString(), "yyyyMMdd")//DateUtils.parseFromTightByPattern("20240718", "yyyyMMdd") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy index c9dceabe6..071511118 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy @@ -1,19 +1,17 @@ package com.fangjia.script.yinjihaun.amap import com.fangjia.core.util.HttpRequest -import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.thirdPriceCrawl.UserAgents import com.fangjia.script.util.ABuYunUtil import com.fangjia.script.util.JacksonUtil import net.sf.json.JSONObject import org.apache.commons.lang.StringUtils -import org.jsoup.Jsoup import java.util.zip.GZIPInputStream class GaoDeApiUtils { - //94c74c60e102972a8d17b7b75d7403be - def static GAO_DE_AK = "a34894d151fffff94f9a33bae3d5565c" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 + //67423021cae3b58e5c2ac595a389b036 :临时买的key + def static GAO_DE_AK = "67423021cae3b58e5c2ac595a389b036" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 //15021384995:dfc2245bac8a7b2d5b62e060e59d4eca /** @@ -39,6 +37,7 @@ class GaoDeApiUtils { try { content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") } catch (Exception e) { + println location + " 出错:"+content content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") } jsonObj = JSONObject.fromObject(content) From 321c830768dd48cb0f34be0354f93116b013d216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Sun, 16 Nov 2025 10:18:22 +0800 Subject: [PATCH 22/67] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AD=98=E5=82=A8=EF=BC=9Aclass=20net.sf.json.JSONNull?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/interceptors/AuditInterceptor.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuditInterceptor.java b/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuditInterceptor.java index dc87931f8..cd2da8ea8 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuditInterceptor.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuditInterceptor.java @@ -1,6 +1,7 @@ package com.fangjia.open.interceptors; import com.fangjia.core.util.AnalyticsUtil; +import com.fangjia.core.util.JsonUtils; import com.fangjia.dal.mongo.open.model.OpenResource; import com.fangjia.dal.mongo.tool.model.OpenUriLog; import com.fangjia.dal.sql.model.ApiUser; @@ -12,6 +13,8 @@ import com.fangjia.open.model.BasicModel; import com.fangjia.open.model.RestfulModelAndView; import com.fangjia.service.open.OpenResourceService; import com.fangjia.service.open.OpenUriLogService; +import com.fasterxml.jackson.databind.ObjectMapper; +import net.sf.json.JSONNull; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import net.sf.json.processors.JsonValueProcessor; @@ -22,17 +25,13 @@ import org.sothis.web.mvc.ActionContext; import org.sothis.web.mvc.ActionInvocation; import org.sothis.web.mvc.ActionInvocationException; import org.sothis.web.mvc.Interceptor; - import javax.servlet.http.HttpServletRequest; -import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; + /** * API审计日志监控器 * @@ -116,7 +115,6 @@ public class AuditInterceptor implements Interceptor { } return params; } - /** * @param request * @param apiUser @@ -163,7 +161,7 @@ public class AuditInterceptor implements Interceptor { if(isSaveResult(request)){ JSONObject json = JSONObject.fromObject(result, DEFAULT_JSON_CONFIG); json.remove("tid"); - openUriLog.setResMap(json); + openUriLog.setResMap((Map)JsonUtils.convertJsonToJavaObj(json, Map.class)); } } catch (Exception e) { LOGGER.error("", e); From 0e7cbd435a5a87303b8f97adbb9439b1d01d1d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Sun, 16 Nov 2025 10:35:33 +0800 Subject: [PATCH 23/67] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/service/address/AddressParserServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java index 6f6590ee0..caf1898b7 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java @@ -339,7 +339,11 @@ public class AddressParserServiceImpl implements AddressParserService { } } } - district = districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS); + if(district == null){ + logger.error("未找到匹配的CPDB数据:" + addr + "ID:" + matchedMate.getId()); + }else{ + district = districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS); + } if(district == null){ logger.error("未找到匹配的CPDB数据:" + addr + "ID:" + district.getId()); } From ece1bd56f405bea388b6d7b9fb4cc43c600feef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Sun, 16 Nov 2025 10:49:57 +0800 Subject: [PATCH 24/67] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/service/address/AddressParserServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java index caf1898b7..e49a3286a 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserServiceImpl.java @@ -345,7 +345,7 @@ public class AddressParserServiceImpl implements AddressParserService { district = districtService.findById(district.getId(), MATCH_PROPERTY_FIELDS); } if(district == null){ - logger.error("未找到匹配的CPDB数据:" + addr + "ID:" + district.getId()); + logger.error("未找到匹配的CPDB数据:" + addr + "ID:" + matchedMate.getId()); } return new Building(district, scoreResult.getScore(matchedMate)); }else{ From 1a15f8d2cff63f361648975f7a4172f089373a58 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 19 Nov 2025 11:42:41 +0800 Subject: [PATCH 25/67] =?UTF-8?q?=E5=B8=B8=E5=B7=9E=E5=95=86=E9=93=BA?= =?UTF-8?q?=E5=90=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/jiangnanblank/CZDataBatch.groovy | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy index 4e23f59e1..5a037dba9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy @@ -56,7 +56,7 @@ class CZDataBatch extends BaseBatch{ def weekend = DateUtils.getFirstDayOfWeek(new Date()) def statMap = CommonDatautils.queryAllDistrictPriceByWeekend(city, weekend) def commids = findAllJnBankDatas(city) - +// def districts = converList(CommonDatautils.findAllDistricts(city, "district", fields)); FzDataUtils.removeNoUpdate(city, districts) districtRun(districts, statMap, commids); @@ -219,14 +219,14 @@ class CZDataBatch extends BaseBatch{ // 商铺名称 map.name = shop.name map.alias = shop.alias - map.build_date = getBuildDate(shop); + map.build_date = FzDataUtils.getBuildDate(shop); //附属属性 map.build_type = shop.build_type map.property_life = shop.property_life map.estate_type2 = shop.estate_type2 map.build_structure = shop.build_structure // 楼盘均价 - map.avg_price = getShopPrice(priceString, shop.city, shop.region, shop.name); + map.avg_price = FzDataUtils.getShopPrice(priceString, shop.city, shop.region, shop.name); // 省 市 区 if(shop.city == "常州"){ map.province_code = regionMap.get("江苏"); @@ -241,28 +241,28 @@ class CZDataBatch extends BaseBatch{ // 地址 map.address = shop.address // 所属区域 - map.in_region_code = getRegionCode(shop.region); + map.in_region_code = FzDataUtils.getRegionCode(shop.region); // 商铺类型 - map.estate_type = getShopEstateTypeCode(shop.estate_type2); + map.estate_type = FzDataUtils.getShopEstateTypeCode(shop.estate_type2); // 公共服务配套 - map.public_service_set_code = getPublicServiceSetCode(shop.city, shop.lat2, shop.lng2); + map.public_service_set_code = FzDataUtils.getPublicServiceSetCode(shop.city, shop.lat2, shop.lng2); // 基础设施 map.facilities_code = "01"; // 商业密度 - map.sophistication_code = getSophisticationCode(shop.city, shop.lat2, shop.lng2); + map.sophistication_code = FzDataUtils.getSophisticationCode(shop.city, shop.lat2, shop.lng2); // 交通条件 - map.traffic_code = getTrafficCode(shop.city, shop.lat2, shop.lng2); + map.traffic_code = FzDataUtils.getTrafficCode(shop.city, shop.lat2, shop.lng2); // 泊车条件 / map.stop_car_code = "01"; // 临街道路 - map.street_code = getStreetCode(street); + map.street_code = FzDataUtils.getStreetCode(street); // 租金 - map.shop_rent = getRentNumber(rentPrice, shop.city, shop.region, shop.name); + map.shop_rent = FzDataUtils.getRentNumber(rentPrice, shop.city, shop.region, shop.name); // 物业公司 - map.estate_company = getEstateCompany(shop.estate_company); + map.estate_company = FzDataUtils.getEstateCompany(shop.estate_company); // 物业费(每月每平米) - map.estate_charge = getEstateCharge(shop.estate_charge); + map.estate_charge = FzDataUtils.getEstateCharge(shop.estate_charge); saveShop(map); } From 3ffa7fb9571c9e2dca23be726295c01e007f176e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 19 Nov 2025 11:45:27 +0800 Subject: [PATCH 26/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/commData/CommonDatautils.groovy | 3 +- .../fuzhou/DistrictInfoExportBatch.groovy | 1 + .../fuzhou/DistrictPriceExportBatch.groovy | 1 + .../com/fangjia/script/gj/OpenApiUtils.groovy | 36 ++--- .../gj/data_handle/DevUpdateTestBatch.groovy | 4 +- .../gj/district/DistrictLocationGeo.groovy | 151 ++++++++++++++++-- .../gj/district/FangjiaClientUtils.groovy | 2 +- .../script/gj/village/KunlunVillage.groovy | 25 ++- .../com/fangjia/script/util/ExcelUtils.groovy | 2 +- .../yinjihaun/amap/GaoDeApiUtils.groovy | 41 ++++- 10 files changed, 224 insertions(+), 42 deletions(-) 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 c64ee5c4b..736ff631d 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 @@ -813,8 +813,9 @@ class CommonDatautils { // q.put("status",new BasicDBObject('$ne', 0)) q.put("cat", cat); q.put("city", city) + // q.put("loop_line_info",new BasicDBObject('$exists',false)) -// q.put("name","经纬天地园二期") +// q.put("name","扬州北街8号") DBObject keys = new BasicDBObject(); if(fields){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy index d49b696f3..9c7fa617d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy @@ -211,6 +211,7 @@ class DistrictInfoExportBatch extends BaseBatch{ def getFzDistricts(def city, def mdate, def endMDate){ def q = new BasicDBObject() q.put("city", city) + if(mdate){ q.put("m_date", new BasicDBObject('$gte', mdate).append('$lt', endMDate)) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy index 271b157aa..862fd5f8f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy @@ -99,6 +99,7 @@ class DistrictPriceExportBatch extends BaseBatch{ def getFzDistricts(def city, def mdate, def endMDate){ def q = new BasicDBObject() q.put("city", city) + if(mdate){ q.put("m_date", new BasicDBObject('$gte', mdate).append('$lt', endMDate)) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 8026c0447..cb3b51b5a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -831,7 +831,7 @@ class OpenApiUtils { static def addrVerifyGuangda(city, address){ address = URLEncoder.encode(address, "utf-8"); def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" -// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" +// def url = "http://localhost:8080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" if(city){ url = url + "&city=${city}" } @@ -847,23 +847,23 @@ class OpenApiUtils { } - static def addrVerifyShBank(city, address){ - address = URLEncoder.encode(address, "utf-8"); -// def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" - def url = "http://localhost:8080/addrSvc/boscEnterpriseVillageIdentify?address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" - if(city){ - url = url + "&city=${city}" - } - String content = new HttpRequest().get(url, "utf-8"); - if(content){ - def doc = new JsonSlurper().parseText(content) - if(doc && doc.code ==200 && doc.result){ - def dtos = doc.result - return dtos - } - } - return null; - } +// static def addrVerifyShBank(city, address){ +// address = URLEncoder.encode(address, "utf-8"); +//// def url = "http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify?address=${address}" +// def url = "http://localhost:8080/addrSvc/boscEnterpriseVillageIdentify?address=${address}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" +// if(city){ +// url = url + "&city=${city}" +// } +// String content = new HttpRequest().get(url, "utf-8"); +// if(content){ +// def doc = new JsonSlurper().parseText(content) +// if(doc && doc.code ==200 && doc.result){ +// def dtos = doc.result +// return dtos +// } +// } +// return null; +// } static def addrVerifyBase(city, address){ 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 45332f6f1..6650ea864 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/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy index 04ec66d5f..be6dc0321 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -3,32 +3,157 @@ package com.fangjia.script.gj.district import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils +import com.mongodb.BasicDBList import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import net.sf.json.JSONNull import org.bson.types.ObjectId class DistrictLocationGeo { final DBCollection seaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "seaweed_gaode_pois", "192.168.0.235", 27018) + final DBCollection allSeaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "all_seaweed_gaode_pois", "192.168.0.235", 27018) static main(args) { def task = new DistrictLocationGeo() - task.run()//调用高德逆解析,并保存数据 + task.run()//通过经纬度,调用高德逆解析,并保存数据 +// task.run2();//通过地址,调用高德逆解析 } def run(){ - ExcelUtils.modify("D:\\数据\\京东\\需逆解析数据-test.xlsx",{ d-> - def jsonObject = GaoDeApiUtils.geocode(d['C']) + ExcelUtils.modify("D:\\数据\\京东\\失败.xlsx",{ d-> + if(d['E']){ + def jsonObject = GaoDeApiUtils.geocode(d['E']) + if(jsonObject){ + d["F"] = "高德" + def dbo = new BasicDBObject() + dbo.put("old_id", d['A']) + dbo.put("city", d['B']) + dbo.put("region", d['C']) + dbo.put("name", d['D']) + dbo.put("old_location", d['E']) + dbo.put("formatted_address", jsonObject.regeocode.formatted_address) + def addrComp = jsonObject.regeocode.addressComponent +// addrComp.remove("neighborhood") +// addrComp.remove("building") + dbo.put("addressComponent", addrComp) + dbo.put("pois", jsonObject.regeocode.pois) + dbo.put("roads", jsonObject.regeocode.roads) + dbo.put("roadinters", jsonObject.regeocode.roadinters) + dbo.put("aois", jsonObject.regeocode.aois) + dbo = cleanGeoData(dbo) + dbo = convertToDBObject(dbo) + println(dbo) + + allSeaweedGaodePoisColl.save(dbo) + } + } + }) + + + } + + static BasicDBObject convertToDBObject(Map map) { + if (!map) return null + + BasicDBObject dbObject = new BasicDBObject() + map.each { key, value -> + def convertedValue = convertValue(value) + if (convertedValue != null) { + dbObject.put(key, convertedValue) + } + } + return dbObject + } + + static Object convertValue(Object value) { + if (value == null) return null + + switch (value) { + case Map: + return convertToDBObject(value as Map) + case List: + return convertList(value as List) + default: + return value + } + } + + static BasicDBList convertList(List list) { + BasicDBList dbList = new BasicDBList() + list.each { item -> + def convertedItem = convertValue(item) + if (convertedItem != null) { + dbList.add(convertedItem) + } + } + return dbList + } + + static def cleanGeoData(data) { + if (data == null) return null + + def result = [:] + + data.each { key, value -> + def cleanedValue = cleanValue(value) + if (cleanedValue != null && !isEmptyCollection(cleanedValue)) { + result[key] = cleanedValue + } + } + + return result + } + + static def cleanValue(value) { + if (value == null) return null + + switch (value) { + case Map: + def cleanedMap = [:] + value.each { k, v -> + def cleaned = cleanValue(v) + if (cleaned != null && !isEmptyCollection(cleaned)) { + cleanedMap[k] = cleaned + } + } + return cleanedMap ? cleanedMap : null + + case List: + def cleanedList = value.collect { cleanValue(it) } + .findAll { it != null && !isEmptyCollection(it) } + return cleanedList ? cleanedList : null + + case JSONNull: + return null + + default: + // 检查是否是包含JSONNull的字符串表示 + if (value instanceof String && value.contains("JSONNull")) { + return null + } + return value + } + } + + static def isEmptyCollection(obj) { + if (obj instanceof Map) return obj.isEmpty() + if (obj instanceof List) return obj.isEmpty() + return false + } + + def run2(){ + ExcelUtils.modify("D:\\数据\\昆仑\\263未出居委数据.xlsx",{ d-> + def jsonObject = GaoDeApiUtils.geocodeByAddress(d['C'], d['B']) + Thread.sleep(1000) if(jsonObject){ - def dbo = new BasicDBObject() - dbo.put("old_id", d['B']) - dbo.put("old_location", d['C']) - dbo.put("formatted_address", jsonObject.regeocode.formatted_address) - dbo.put("addressComponent", jsonObject.regeocode.addressComponent) - dbo.put("pois", jsonObject.regeocode.pois) - dbo.put("roads", jsonObject.regeocode.roads) - dbo.put("roadinters", jsonObject.regeocode.roadinters) - dbo.put("aois", jsonObject.regeocode.aois) - seaweedGaodePoisColl.save(dbo) + def rets = jsonObject.geocodes + if(rets){ + def dbo = rets[0] + if(dbo){ + d['D'] = dbo.formatted_address + d['E'] = dbo.level + } + } } }) } 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 ad2d5309a..0dfe2daab 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 @@ -355,7 +355,7 @@ class FangjiaClientUtils { address = address.toString().replace("{","") int retryCount = 0 while (retryCount < 3) { - url = "http://192.168.0.93:8080/FangJiaNlpService/formatNinelevel?address="+URLEncoder.encode(address,"UTF-8")+"&complete=false&useMap=false&addressAssessment=true&fields=dev_confi" + url = "http://192.168.0.100:32080/FangJiaNlpService/formatNinelevel?address="+URLEncoder.encode(address,"UTF-8")+"&complete=false&useMap=false&addressAssessment=true&fields=dev_confi" if(city){ url = url +"&city="+URLEncoder.encode(city,"UTF-8") } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy index d8b140529..86bb2ea86 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/KunlunVillage.groovy @@ -1,19 +1,36 @@ package com.fangjia.script.gj.village import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.util.ExcelUtils class KunlunVillage { static main(args) { def task = new KunlunVillage(); task.run() +// task.addrCheck() } - def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\昆仑\\3987户需批量更新涉农信息明细-20251023-结果.xlsx",{ d-> + def addrCheck(){ - if(!d['R'] && d['B']){ - def dto = OpenApiUtils.addrVerifyGuangda(null, d['B']) + ExcelUtils.modify("D:\\数据\\昆仑\\2025年11月18日批次跑批涉农地址-发估家.xlsx",{ d-> + def obj = FangjiaClientUtils.formatNinelevel(null, d["C"]) + if(obj){ + println obj + d['AB'] = obj.addressAssessment.msg + } + }) + + } + + + def run(){ + def index = 0 + ExcelUtils.modify("D:\\数据\\昆仑\\2025年11月18日批次跑批涉农地址-发估家.xlsx",{ d-> + index++ + if(!d['R'] && d['C']){ + println index + def dto = OpenApiUtils.addrVerifyBase(null, d['C']) if(dto){ // def dto = jsonObj.result d['F'] = dto.province 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 da882ff58..0b095093c 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() * 6 + def nThread = Runtime.getRuntime().availableProcessors() * 8 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/yinjihaun/amap/GaoDeApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy index c9dceabe6..bf3d8acab 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy @@ -13,7 +13,7 @@ import java.util.zip.GZIPInputStream class GaoDeApiUtils { //94c74c60e102972a8d17b7b75d7403be - def static GAO_DE_AK = "a34894d151fffff94f9a33bae3d5565c" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 + def static GAO_DE_AK = "947cd51c2f3110a93cbd755f697a526d" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 //15021384995:dfc2245bac8a7b2d5b62e060e59d4eca /** @@ -30,7 +30,10 @@ class GaoDeApiUtils { params.put("location", location) params.put("extensions","all") params.put("radius", "3000") - params.put("poitype", "120000|120200|120203|120300|120301|120302|120303") +// params.put("poitype", "120000|120200|120203|120300|120301|120302|120303")//纯住宅类型 + + //京东测试允许类型 + params.put("poitype", "100000|100100|100101|100102|100103|100104|100105|100200|100201|120000|120200|120203|120300|120301|120302|120303|120304|190000|190100|190400|190401|190402|190403|190500|190600|190700") String content def stop = true JSONObject jsonObj = null @@ -57,6 +60,40 @@ class GaoDeApiUtils { return jsonObj } + def static geocodeByAddress(String city, String address) { + Map params = new HashMap() + params.put("key", GAO_DE_AK) + params.put("address", address) + params.put("batch", "true") + params.put("city", city) +// params.put("poitype", "120000|120200|120203|120300|120301|120302|120303") + String content + def stop = true + JSONObject jsonObj = null + def errorCount = 1 + while (stop){ + try { + content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/geo", params, "utf-8") + } catch (Exception e) { + content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/geo", params, "utf-8") + } + jsonObj = JSONObject.fromObject(content) + println jsonObj + if(jsonObj.status!="1"){ + println jsonObj + errorCount ++ + Thread.sleep(3000) + if(errorCount>3){ + stop = false + } + }else{ + stop = false + } + } + + return jsonObj + } + def static geo(city, address) { Map params = new HashMap() params.put("key", "a34894d151fffff94f9a33bae3d5565c")//许镕杰 From 88cd67a3fe43aeb9b63612b443a01178b0b2b72b Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 19 Nov 2025 11:49:40 +0800 Subject: [PATCH 27/67] update --- .../fangjia/script/gj/district/DistrictLocationGeo.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy index 999e954a2..512e54ee4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -6,14 +6,11 @@ import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils import com.mongodb.BasicDBList import com.mongodb.BasicDBObject import com.mongodb.DBCollection -<<<<<<< .mine + import net.sf.json.JSONNull import org.bson.types.ObjectId -======= ->>>>>>> .theirs - class DistrictLocationGeo { final DBCollection seaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "seaweed_gaode_pois", "192.168.0.235", 27018) From d864488e21e548d1a41dfb96c1589034d298fe98 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 24 Nov 2025 11:04:19 +0800 Subject: [PATCH 28/67] =?UTF-8?q?=E6=B1=9F=E5=8D=97=E8=A1=8C=E5=95=86?= =?UTF-8?q?=E9=93=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/commData/CommonDatautils.groovy | 64 +++++++++++++++++++ .../script/jiangnanblank/CZDataBatch.groovy | 55 ++++++++++++---- .../script/jiangnanblank/FzDataUtils.groovy | 1 + 3 files changed, 108 insertions(+), 12 deletions(-) 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 736ff631d..ad3537664 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 @@ -5818,4 +5818,68 @@ class CommonDatautils { } return address; } + + + static def findSeawater(city, lng, lat, distance, p_date, cat){ + def header = [:] + header["Authorization"] = "Basic ${Base64.getEncoder().encodeToString("elastic:goojia123456".getBytes("UTF-8"))}".toString() + String seawaterUrl = "http://192.168.0.206:9200/seawater-*/_search" + def body = """ + { + "query": { + "bool": { + "must": [ + { + "geo_distance": { + "distance": "1km", + "location": { + "lat": ${lat}, + "lon": ${lng} + } + } + }, + { + "term": { + "city": "${city}" + } + }, + { + "term": { + "cat": "${cat}" + } + }, + { + "range": { + "publish_date": { + "gte": "${p_date}", + "format": "yyyy-MM-dd" + } + } + } + ] + } + }, + "sort": [ + { + "publish_date": { + "order": "desc" + } + } + ], + "size":30 + } + """ + HttpRequest request = new HttpRequest() + String res = request.postWithBody(seawaterUrl, JSONObject.fromObject(body.toString()), header, "UTF-8") + def response = new JsonSlurper().parseText(res) + + def esObj = null + if(response && response.hits){ + esObj = response.hits.hits + } + return esObj + } + + + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy index 5a037dba9..4f61afd3a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.jiangnanblank +import com.fangjia.core.util.DateUtil import com.fangjia.script.BaseBatch import com.fangjia.script.BatchOwner import com.fangjia.script.Watcher @@ -7,24 +8,16 @@ import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.util.DateUtils 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 com.rabbitmq.client.AMQP -import net.sf.json.JSONObject import org.apache.poi.hssf.usermodel.HSSFWorkbook import org.bson.types.ObjectId -import java.text.DecimalFormat import java.util.concurrent.CountDownLatch import java.util.concurrent.ExecutorService import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicLong -import java.util.regex.Matcher -import java.util.regex.Pattern - /** * Created by gaojuan on 2017/12/11. * 批量全国小区及商铺字段转换 @@ -33,7 +26,7 @@ import java.util.regex.Pattern class CZDataBatch extends BaseBatch{ public static def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; - def fields = ["city","region","name", "address", "cat","lat2","lng2","alias","property_life","estate_type2","build_date","build_structure","build_type","finish_building_date","live_date","open_date","virescence_percent","cubage_percent","estate_company","estate_charge","car_site", "build_type"] + def fields = ["city","region","name", "address", "cat","lat2","lng2","lat","lng","alias","property_life","estate_type2","build_date","build_structure","build_type","finish_building_date","live_date","open_date","virescence_percent","cubage_percent","estate_company","estate_charge","car_site", "build_type"] public static DBCollection DIST_COLL = MongoUtils.getCollectionByName2("business", "jn_bank_district", dbUrl) //final def czIdMap = readCZDistrict("d:\\常州数据结果\\原始数据\\常州江南银行住宅编号.xls"); @@ -227,11 +220,14 @@ class CZDataBatch extends BaseBatch{ map.build_structure = shop.build_structure // 楼盘均价 map.avg_price = FzDataUtils.getShopPrice(priceString, shop.city, shop.region, shop.name); + if(!map.avg_price){ + map.avg_price = getSellPrice(shop.city, shop.lng/10000000000.0, shop.lat/10000000000.0) + } // 省 市 区 if(shop.city == "常州"){ - map.province_code = regionMap.get("江苏"); - map.city_code = regionMap.get(shop.city); - map.region_code = regionMap.get(shop.region); + map.province_code = FzDataUtils.regionMap.get("江苏"); + map.city_code = FzDataUtils.regionMap.get(shop.city); + map.region_code = FzDataUtils.regionMap.get(shop.region); map.province = "江苏"; map.price_old_string = priceString; map.heights = heights; @@ -259,6 +255,9 @@ class CZDataBatch extends BaseBatch{ map.street_code = FzDataUtils.getStreetCode(street); // 租金 map.shop_rent = FzDataUtils.getRentNumber(rentPrice, shop.city, shop.region, shop.name); + if(!map.shop_rent){ + map.shop_rent = getRentPrice(shop.city, shop.lng/10000000000.0, shop.lat/10000000000.0) + } // 物业公司 map.estate_company = FzDataUtils.getEstateCompany(shop.estate_company); // 物业费(每月每平米) @@ -267,6 +266,38 @@ class CZDataBatch extends BaseBatch{ saveShop(map); } + def getSellPrice(def city, def lng, def lat){ + def p_date = DateUtils.formatDateByPattern(DateUtil.add(new Date(), -365),'yyyy-MM-dd') + def rets = CommonDatautils.findSeawater(city, lng, lat, "1km", p_date, "shop_sell") + if(rets){ + def prices = [] + for(def r : rets){ + prices << r._source.avg_price + } + if(prices){ + def price = (int)(prices.sum()/prices.size()) + return price + } + } + return null; + } + + def getRentPrice(def city, def lng, def lat){ + def p_date = DateUtils.formatDateByPattern(DateUtil.add(new Date(), -365),'yyyy-MM-dd') + def rets = CommonDatautils.findSeawater(city, lng, lat, "1km", p_date, "shop_rent") + if(rets){ + def prices = [] + for(def r : rets){ + prices << r._source.avg_price + } + if(prices){ + def day_price = (prices.sum()/prices.size())/30 + return DataHandleUtils.getDoubleRound(2, day_price) + } + } + return null; + } + def saveShop(def m){ DBObject q = new BasicDBObject(); q.put("city",m.city) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/FzDataUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/FzDataUtils.groovy index 51e58e28e..0c5917dfd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/FzDataUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/FzDataUtils.groovy @@ -809,4 +809,5 @@ class FzDataUtils { } + } From 697771b4b0903327fff598b45601b5a4a0774ffd Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 24 Nov 2025 11:47:32 +0800 Subject: [PATCH 29/67] update --- .../house/DistrictSellHouseStatBatch.groovy | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy index 52203c79c..5742b35c4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy @@ -1,25 +1,19 @@ package com.fangjia.script.house -import com.fangjia.core.util.DateUtil + import com.fangjia.datastore.driver.DSCollection import com.fangjia.datastore.driver.DataStore 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.util.CommonUtils import com.fangjia.script.util.DateUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject -import com.mongodb.Bytes import com.mongodb.DBCollection import com.mongodb.DBObject -import com.mongodb.QueryOperators - - import java.util.concurrent.ExecutorService import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit @BatchOwner(Watcher.GaoJuan) class DistrictSellHouseStatBatch extends BaseBatch{ @@ -48,14 +42,17 @@ class DistrictSellHouseStatBatch extends BaseBatch{ for(def city : citys){ index ++ ; def districts = CommonDatautils.getAllDistrictBaseInfo(city, "district") - def sellRet = houseStatCount(districts, startDate, endDate, sDate); + + String start = DateUtils.formatDateByPattern(startDate, "yyyyMMdd") + + def sellRet = houseStatCount(districts, start.toInteger(), sDate); saveResult(city, sDate, sellRet); println "[${city} ${index}/${citys.size()}]" +new Date().toString(); } } - def houseStatCount(def districts, def startDate, def endDate, def sDate){ + def houseStatCount(def districts, def startDate, def sDate){ def index = 0; @@ -75,8 +72,12 @@ class DistrictSellHouseStatBatch extends BaseBatch{ void run() { index++; def map = [:]; - map.sell_count = findHouseCount(dist, "sell", startDate, endDate); - map.rent_count = findHouseCount(dist, "rent", startDate, endDate); +// map.sell_count = findHouseCount(dist, "sell", startDate, endDate); +// map.rent_count = findHouseCount(dist, "rent", startDate, endDate); + + map.sell_count = CommonDatautils.findHouseCountByDate(dist.city, dist.region, dist.name, dist.alias, "sell", startDate) + map.rent_count = CommonDatautils.findHouseCountByDate(dist.city, dist.region, dist.name, dist.alias, "rent", startDate) + map.city = dist.city; map.region = dist.region; map.name = dist.name; From fca72b79670dd19a049a237014ebc299443cd0d2 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 24 Nov 2025 13:17:39 +0800 Subject: [PATCH 30/67] update --- .../com/fangjia/script/house/DistrictSellHouseStatBatch.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy index 5742b35c4..7f3f4027b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/house/DistrictSellHouseStatBatch.groovy @@ -14,6 +14,7 @@ import com.mongodb.DBObject import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit @BatchOwner(Watcher.GaoJuan) class DistrictSellHouseStatBatch extends BaseBatch{ From 1f3107504144b7d155235f095369fa866677bedd Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 24 Nov 2025 13:29:54 +0800 Subject: [PATCH 31/67] =?UTF-8?q?=E5=95=86=E9=93=BA=E7=A7=9F=E9=87=91?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=88=B02=E5=85=AC=E9=87=8C=EF=BC=8C3?= =?UTF-8?q?=E5=85=AC=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/commData/CommonDatautils.groovy | 2 +- .../com/fangjia/script/jiangnanblank/CZDataBatch.groovy | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 ad3537664..8eedfcae0 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 @@ -5831,7 +5831,7 @@ class CommonDatautils { "must": [ { "geo_distance": { - "distance": "1km", + "distance": "${distance}", "location": { "lat": ${lat}, "lon": ${lng} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy index 4f61afd3a..211a4ccb5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy @@ -285,6 +285,12 @@ class CZDataBatch extends BaseBatch{ def getRentPrice(def city, def lng, def lat){ def p_date = DateUtils.formatDateByPattern(DateUtil.add(new Date(), -365),'yyyy-MM-dd') def rets = CommonDatautils.findSeawater(city, lng, lat, "1km", p_date, "shop_rent") + if(!rets){ + rets = CommonDatautils.findSeawater(city, lng, lat, "2km", p_date, "shop_rent") + if(!rets){ + rets = CommonDatautils.findSeawater(city, lng, lat, "3km", p_date, "shop_rent") + } + } if(rets){ def prices = [] for(def r : rets){ From dec254bd4b3686e8bc7f50734cac7a1c8a635f68 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 24 Nov 2025 14:26:25 +0800 Subject: [PATCH 32/67] =?UTF-8?q?=E6=B1=9F=E5=8D=97=E8=A1=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/commData/CommonDatautils.groovy | 27 +++++++++++++++++++ .../script/jiangnanblank/CZDataBatch.groovy | 20 +++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) 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 8eedfcae0..76eed7432 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 @@ -832,6 +832,33 @@ class CommonDatautils { } + public static def findNewUpdateDistricts(def city, def cat, def fields){ + + def startDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd") + DBObject q = new BasicDBObject(); + q.put("status",0) +// q.put("status",new BasicDBObject('$ne', 0)) + q.put("cat", cat); + q.put("city", city) + q.put("m_date", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate))) +// q.put("loop_line_info",new BasicDBObject('$exists',false)) +// q.put("name","扬州北街8号") + + DBObject keys = new BasicDBObject(); + if(fields){ + for(def field : fields){ + keys.put(field, 1); + } + } + def dbsour = SEAWEED_COLL.find(q, keys).batchSize(5000) + def rets = [] + for(def d : dbsour){ + rets << d + } + return rets; + } + + public static def findAllRegionDistricts(def city, def region, def cat, def fields){ DBObject q = new BasicDBObject(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy index 211a4ccb5..5ca528cfb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/CZDataBatch.groovy @@ -17,6 +17,7 @@ import org.bson.types.ObjectId import java.util.concurrent.CountDownLatch import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicLong /** * Created by gaojuan on 2017/12/11. @@ -40,6 +41,8 @@ class CZDataBatch extends BaseBatch{ @Override void process(Object args) { + println "args 参数:"+args.toString() + def citys = CommonDatautils.findAllCity(); citys.remove("常州"); @@ -50,12 +53,21 @@ class CZDataBatch extends BaseBatch{ def statMap = CommonDatautils.queryAllDistrictPriceByWeekend(city, weekend) def commids = findAllJnBankDatas(city) // - def districts = converList(CommonDatautils.findAllDistricts(city, "district", fields)); - FzDataUtils.removeNoUpdate(city, districts) + def districts = null; + def shops = null; + if(args && args[0]== "all"){ + districts = converList(CommonDatautils.findAllDistricts(city, "district", fields)); + FzDataUtils.removeNoUpdate(city, districts) + }else{ + districts = converList(CommonDatautils.findNewUpdateDistricts(city, "district", fields)); + } districtRun(districts, statMap, commids); - - def shops = CommonDatautils.findAllDistricts(city, "shop", fields); + if(args && args[0]== "all"){ + shops = CommonDatautils.findAllDistricts(city, "shop", fields); + }else{ + shops = CommonDatautils.findNewUpdateDistricts(city, "shop", fields); + } shops = mergeShop(shops); shopRun(shops); } From 6ee5aa79756382d31afd3d31006c7634880a97bd Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 1 Dec 2025 13:44:14 +0800 Subject: [PATCH 33/67] update --- .../java/com/fangjia/open/controllers/CommercialController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java index d670c7367..8137c18b1 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java @@ -93,7 +93,7 @@ public class CommercialController { if (json != null) { if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) { HashMap resultMap = new HashMap(); - resultMap.put("avgPrice", Long.valueOf(json.getString("unitPrice"))); + resultMap.put("avgPrice", Double.valueOf(json.getString("unitPrice"))); resultMap.put("totalPrice", Long.valueOf(json.getString("totalPrice"))); if (model.getShowSample()!=null && model.getShowSample()==1 && json.containsKey("case")) { From 82dca1449010cf90714e8245c80933ef6459ef84 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 1 Dec 2025 13:46:55 +0800 Subject: [PATCH 34/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/open/controllers/CommercialController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java index 8137c18b1..29a6066d0 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java @@ -80,6 +80,11 @@ public class CommercialController { } + /** + * 商铺出租 + * @param model + * @return + */ public Object shopRentEvaluateAction(CommercialModel model) { RestfulModelAndView mav = new RestfulModelAndView(); From 5033b0b4753fda8669e9e6c0795b85afce5fdff7 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 4 Dec 2025 11:07:29 +0800 Subject: [PATCH 35/67] update --- .../script/ccbevaluation/AddSzDealData.groovy | 2 +- .../ccbevaluation/CcbCommonUtils.groovy | 2 +- .../gj/district/DistrictLocationGeo.groovy | 53 +++---- .../script/gj/district/JindDongGeoTest.groovy | 144 ++++++++++++++++++ 4 files changed, 171 insertions(+), 30 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/JindDongGeoTest.groovy 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 9ebbbcaa2..0f76938ce 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 @@ -9,7 +9,7 @@ import com.mongodb.DBCollection * 深圳公众号成交数据录入 */ -def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳9月份成交数据.xlsx", 0, 1) +def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳10月份成交数据11.20.xlsx", 0, 1) def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) 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 4dd815364..88194c547 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 @@ -443,7 +443,7 @@ class CcbCommonUtils { } // q.put("c_date", new BasicDBObject('$lt', DateUtils.parseFromTightYYYYMMDD("2023-05-01")))//因5月1日新增过多,所以暂且先去掉 此批数据改为name_cat=13 -// q.put("name","龙源星城") +// q.put("name","登高西路安置小区C区") // q.put("name_cat", 0); // q.put("name", new BasicDBObject('$in', ["中信泰富又一城一期","中信泰富又一城"])) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy index 512e54ee4..b25c63f1e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.gj.district +import com.fangjia.core.util.GeoUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils @@ -13,40 +14,36 @@ import org.bson.types.ObjectId class DistrictLocationGeo { - final DBCollection seaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "seaweed_gaode_pois", "192.168.0.235", 27018) - final DBCollection allSeaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "all_seaweed_gaode_pois", "192.168.0.235", 27018) + final DBCollection JD_SEAWEED_COLL = MongoUtils.getCollectionByName("business", "jingdong_community", "192.168.0.206",27020) + final DBCollection JD_GEO_COLL = MongoUtils.getCollectionByName("business", "jingdong_geo", "192.168.0.206",27020) static main(args) { def task = new DistrictLocationGeo() task.run()//通过经纬度,调用高德逆解析,并保存数据 -// task.run2();//通过地址,调用高德逆解析 +// def distance = GeoUtils.calculateDistance(130.573501, 45.752712, 130.573527,45.753287); +// println distance + } def run(){ - ExcelUtils.modify("D:\\数据\\京东\\失败.xlsx",{ d-> - if(d['E']){ - def jsonObject = GaoDeApiUtils.geocode(d['E']) - if(jsonObject){ - d["F"] = "高德" - def dbo = new BasicDBObject() - dbo.put("old_id", d['A']) - dbo.put("city", d['B']) - dbo.put("region", d['C']) - dbo.put("name", d['D']) - dbo.put("old_location", d['E']) - dbo.put("formatted_address", jsonObject.regeocode.formatted_address) - def addrComp = jsonObject.regeocode.addressComponent -// addrComp.remove("neighborhood") -// addrComp.remove("building") - dbo.put("addressComponent", addrComp) - dbo.put("pois", jsonObject.regeocode.pois) - dbo.put("roads", jsonObject.regeocode.roads) - dbo.put("roadinters", jsonObject.regeocode.roadinters) - dbo.put("aois", jsonObject.regeocode.aois) - dbo = cleanGeoData(dbo) - dbo = convertToDBObject(dbo) - println(dbo) - - allSeaweedGaodePoisColl.save(dbo) + ExcelUtils.multiThreadingModify("D:\\数据\\京东\\京东新增数据5.6万.xlsx",{ d-> + if(d['A']){ + def dbo = JD_SEAWEED_COLL.findOne(new BasicDBObject("_id", new ObjectId(d['A']))) + if(dbo && dbo.longitude){ + def jsonObject = GaoDeApiUtils.geocode(dbo.longitude+","+dbo.latitude) + if(jsonObject){ + d["F"] = "高德" +// def dbo = new BasicDBObject() + dbo.put("formatted_address", jsonObject.regeocode.formatted_address) + def addrComp = jsonObject.regeocode.addressComponent + dbo.put("addressComponent", addrComp) + dbo.put("pois", jsonObject.regeocode.pois) + dbo.put("roads", jsonObject.regeocode.roads) + dbo.put("roadinters", jsonObject.regeocode.roadinters) + dbo.put("aois", jsonObject.regeocode.aois) + dbo = cleanGeoData(dbo) + dbo = convertToDBObject(dbo) + JD_GEO_COLL.save(dbo) + } } } }) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/JindDongGeoTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/JindDongGeoTest.groovy new file mode 100644 index 000000000..2b0dfcb18 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/JindDongGeoTest.groovy @@ -0,0 +1,144 @@ +package com.fangjia.script.gj.district + +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils +import com.mongodb.BasicDBList +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import net.sf.json.JSONNull + +class JindDongGeoTest { + final DBCollection seaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "seaweed_gaode_pois", "192.168.0.235", 27018) + final DBCollection allSeaweedGaodePoisColl = MongoUtils.getCollectionByName("fangjia", "all_seaweed_gaode_pois", "192.168.0.235", 27018) + + static main(args) { + def task = new JindDongGeoTest() + task.run()//通过经纬度,调用高德逆解析,并保存数据 + } + + + def run(){ + ExcelUtils.modify("D:\\数据\\京东\\失败.xlsx",{ d-> + if(d['E']){ + def jsonObject = GaoDeApiUtils.geocode(d['E']) + if(jsonObject){ + d["F"] = "高德" + def dbo = new BasicDBObject() + dbo.put("old_id", d['A']) + dbo.put("city", d['B']) + dbo.put("region", d['C']) + dbo.put("name", d['D']) + dbo.put("old_location", d['E']) + dbo.put("formatted_address", jsonObject.regeocode.formatted_address) + def addrComp = jsonObject.regeocode.addressComponent +// addrComp.remove("neighborhood") +// addrComp.remove("building") + dbo.put("addressComponent", addrComp) + dbo.put("pois", jsonObject.regeocode.pois) + dbo.put("roads", jsonObject.regeocode.roads) + dbo.put("roadinters", jsonObject.regeocode.roadinters) + dbo.put("aois", jsonObject.regeocode.aois) + dbo = cleanGeoData(dbo) + dbo = convertToDBObject(dbo) + println(dbo) + + allSeaweedGaodePoisColl.save(dbo) + } + } + }) + + + } + + static BasicDBObject convertToDBObject(Map map) { + if (!map) return null + + BasicDBObject dbObject = new BasicDBObject() + map.each { key, value -> + def convertedValue = convertValue(value) + if (convertedValue != null) { + dbObject.put(key, convertedValue) + } + } + return dbObject + } + + static Object convertValue(Object value) { + if (value == null) return null + + switch (value) { + case Map: + return convertToDBObject(value as Map) + case List: + return convertList(value as List) + default: + return value + } + } + + static BasicDBList convertList(List list) { + BasicDBList dbList = new BasicDBList() + list.each { item -> + def convertedItem = convertValue(item) + if (convertedItem != null) { + dbList.add(convertedItem) + } + } + return dbList + } + + static def cleanGeoData(data) { + if (data == null) return null + + def result = [:] + + data.each { key, value -> + def cleanedValue = cleanValue(value) + if (cleanedValue != null && !isEmptyCollection(cleanedValue)) { + result[key] = cleanedValue + } + } + + return result + } + + static def cleanValue(value) { + if (value == null) return null + + switch (value) { + case Map: + def cleanedMap = [:] + value.each { k, v -> + def cleaned = cleanValue(v) + if (cleaned != null && !isEmptyCollection(cleaned)) { + cleanedMap[k] = cleaned + } + } + return cleanedMap ? cleanedMap : null + + case List: + def cleanedList = value.collect { cleanValue(it) } + .findAll { it != null && !isEmptyCollection(it) } + return cleanedList ? cleanedList : null + + case JSONNull: + return null + + default: + // 检查是否是包含JSONNull的字符串表示 + if (value instanceof String && value.contains("JSONNull")) { + return null + } + return value + } + } + + static def isEmptyCollection(obj) { + if (obj instanceof Map) return obj.isEmpty() + if (obj instanceof List) return obj.isEmpty() + return false + } + + +} From 91a2a291e5c762e5c82aaf882dc581de34680c4a Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 4 Dec 2025 20:00:42 +0800 Subject: [PATCH 36/67] =?UTF-8?q?=E6=9C=88=E5=BA=A6=E5=9D=87=E4=BB=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuzhou/DistrictSellStatBatch.groovy | 121 +++++++++++++++--- 1 file changed, 101 insertions(+), 20 deletions(-) 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 a4727d6fc..a06af6e14 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 @@ -4,11 +4,13 @@ import com.fangjia.core.util.DataUtil 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.util.CommonUtils import com.fangjia.script.util.DateUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import com.mongodb.MongoClient import java.text.DecimalFormat import java.util.concurrent.CopyOnWriteArrayList @@ -26,6 +28,8 @@ class DistrictSellStatBatch extends BaseBatch { static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com") static final DBCollection FZ_DIST_COLL = MongoUtils.getCollectionByName("business", "fz_district", "mongo.db.fangjia.com") + public static final DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("fangjia_log", "calc_command", "log.mongo.db.fangjia.com",52002) + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) public static final DBCollection SEAWEED_MONGO_COLL = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com") @@ -37,14 +41,46 @@ class DistrictSellStatBatch extends BaseBatch { @Override void process(Object args) { - def months = DateUtils.getMonthList(202510) - months = months[0..(months.size()-1)] - println months - for(def month : months){ - def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") - calcMonthlyPrice(curDate) +// def months = DateUtils.getMonthList(202510) +// months = months[0..(months.size()-1)] +// println months +// for(def month : months){ +// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") +// calcMonthlyPrice(curDate) +// } + + def date = new Date() + def day = date.getDate() + def hours = date.getHours() + if(day == 4 && hours<24){ + calcMonthlyPrice() //正常算一期 + }else{ + //根据calc_type算历史 + def q = new BasicDBObject("category" ,"sell_month") + def commands = COMMAND_COLL.find(q) + println "共 【"+commands.size()+"】 个小区重算 "+new Date() + for(def command : commands){ + def calc_type = command.calc_type + def id = command._id + if(calc_type==1){ + //找出第一次均价计算的时间 + def obj = CommonDatautils.queryFirstOrLastDistrictPrice(command.city, command.region, command.name, 1) + if(obj){ + def weekend = obj.weekend + def startMonth = DateUtils.formatDateByPattern(weekend, "yyyyMM").toInteger() + def months = DateUtils.getMonthList(startMonth) + months = months[1..(months.size()-1)] + println months + for(def month : months){ + def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") + calcMonthlyPriceByName(curDate, command.city, command.region, command.name) + } + //删除命令 + COMMAND_COLL.remove(new BasicDBObject("_id", id)) + } + } + } } -// calcMonthlyPrice() } @@ -69,7 +105,7 @@ class DistrictSellStatBatch extends BaseBatch { if(!curDate){ curDate = new Date() } - def citys = ["上海"]//CommonUtils.findAllCity() + def citys = CommonUtils.findAllCity() // citys.remove("上海") // citys.remove("福州") def keys = new BasicDBObject("city", 1).append("name", 1).append("region", 1).append("estate_type2", 1).append("status", 1) @@ -92,15 +128,15 @@ class DistrictSellStatBatch extends BaseBatch { def districts = [] if(city == "福州"){ - if(day == 29){ +// if(day == 15){ 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() - } +// }else{ +// districts = FZ_DIST_COLL.find(new BasicDBObject("city", city).append("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)), keys).toList() +// } }else{ def q = new BasicDBObject("city", city).append("cat", "district").append("status", 0) // q.put("name", "越华路小区") -// if(day == 30){ +// if(day == 2){ districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000).toList() // }else{ // q.put("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)) @@ -113,10 +149,10 @@ class DistrictSellStatBatch extends BaseBatch { 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)//当月小区月均价 - def lastMonthlyPriceMap = findMonthlyPrice(city, monDate)//上个月小区月均价 - def lastYearPriceMap = findMonthlyPrice(city, yoyDate)//去年小区月均价 + def weekendPriceMap = findPriceMap(city, startDate, endDate, null, null)//上个月小区均价 + def curMonthlyPriceMap = findMonthlyPrice(city, curMonth, null, null)//当月小区月均价 + def lastMonthlyPriceMap = findMonthlyPrice(city, monDate, null, null)//上个月小区月均价 + def lastYearPriceMap = findMonthlyPrice(city, yoyDate, null, null)//去年小区月均价 if(weekendPriceMap){ running(curMonth, districts, weekendPriceMap, curMonthlyPriceMap, lastMonthlyPriceMap, lastYearPriceMap) } @@ -124,6 +160,44 @@ class DistrictSellStatBatch extends BaseBatch { } } + + def calcMonthlyPriceByName(curDate, city, region, name) { + //只有福州使用tob价格,改为所有城市都使用2B价格,除人工指导价除外 + if (!curDate) { + curDate = new Date() + } + + def keys = new BasicDBObject("city", 1).append("name", 1).append("region", 1).append("estate_type2", 1).append("status", 1) + + def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(curDate, "yyyyMM"), -1, "yyyyMM")); + def monDate = getMomDate(curMonth) + def yoyDate = getYoyDate(curMonth) + + def q = new BasicDBObject("city", city).append("cat", "district").append("status", 0).append("region", region).append("name", name) + + def districts = SEAWEED_MONGO_COLL.find(q, keys).toList() + + + + def startDate = DateUtils.getFirstDayOfMonth(curDate, -1); + def endDate = DateUtils.getLastDayOfMonth(curDate, -1); + if (districts.size() > 0) { + def weekendPriceMap = findPriceMap(city, startDate, endDate, region, name)//上个月小区均价 + def curMonthlyPriceMap = findMonthlyPrice(city, curMonth, region, name)//当月小区月均价 + def lastMonthlyPriceMap = findMonthlyPrice(city, monDate, region, name)//上个月小区月均价 + def lastYearPriceMap = findMonthlyPrice(city, yoyDate, region, name)//去年小区月均价 + if (weekendPriceMap) { + running(curMonth, districts, weekendPriceMap, curMonthlyPriceMap, lastMonthlyPriceMap, lastYearPriceMap) + } + } + + } + + + + + + def running(districts){ def totalCount = new AtomicLong() final CountDownLatch latch = new CountDownLatch(districts.size()) @@ -284,10 +358,13 @@ class DistrictSellStatBatch extends BaseBatch { } - def findPriceMap(city, startDate, endDate){ + def findPriceMap(city, startDate, endDate, region, name){ def q = new BasicDBObject() q.put("city", city) -// q.put("district_name","长春铺") + if(name){ + q.put("region", region) + q.put("district_name", 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 = [:] @@ -308,10 +385,14 @@ class DistrictSellStatBatch extends BaseBatch { return priceMap } - def findMonthlyPrice(city, monDate){ + def findMonthlyPrice(city, monDate, region, name){ def q = new BasicDBObject() q.put("city", city) q.put("date", monDate) + if(name){ + q.put("region", region) + q.put("district_name", name) + } def dbcursor = DISTRICT_SELL_STAT.find(q) def priceMap = [:] for(def d : dbcursor){ From 179fe15746c7a1899ba324e8c434ef6e8e2425f9 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 5 Dec 2025 10:39:42 +0800 Subject: [PATCH 37/67] =?UTF-8?q?=E4=BA=8C=E6=89=8B=E6=88=BF=E6=9C=88?= =?UTF-8?q?=E5=9D=87=E4=BB=B7=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a06af6e14..47a6ec543 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 @@ -52,7 +52,7 @@ class DistrictSellStatBatch extends BaseBatch { def date = new Date() def day = date.getDate() def hours = date.getHours() - if(day == 4 && hours<24){ + if(day == 2 && hours<7){ calcMonthlyPrice() //正常算一期 }else{ //根据calc_type算历史 From 889f5751169131b179e2d963130d5ec8e26db587 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 8 Dec 2025 11:22:13 +0800 Subject: [PATCH 38/67] =?UTF-8?q?=E5=95=86=E9=93=BA=E4=BC=B0=E5=80=BC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/open/controllers/CommercialController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java index 29a6066d0..d26105bd5 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/CommercialController.java @@ -203,6 +203,9 @@ public class CommercialController { HttpRequest request = new HttpRequest(); JSONObject json = null; Map params = new HashMap(); + if(StringUtils.isNotBlank(model.getCityName())){ + params.put("city", model.getCityName()); + } if(StringUtils.isNotBlank(model.getAddress())){ params.put("address", model.getAddress()); } From bcbb9552fb021bc58e1abea0c6e24fee7862a7bb Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 10 Dec 2025 10:43:21 +0800 Subject: [PATCH 39/67] update --- .../script/fuzhou/DistrictSellStatBatch.groovy | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 47a6ec543..084ff8148 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 @@ -69,14 +69,16 @@ class DistrictSellStatBatch extends BaseBatch { def weekend = obj.weekend def startMonth = DateUtils.formatDateByPattern(weekend, "yyyyMM").toInteger() def months = DateUtils.getMonthList(startMonth) - months = months[1..(months.size()-1)] - println months - for(def month : months){ - def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") - calcMonthlyPriceByName(curDate, command.city, command.region, command.name) - } - //删除命令 - COMMAND_COLL.remove(new BasicDBObject("_id", id)) + if(months.size()>1){ + months = months[1..(months.size()-1)] + println months + for(def month : months){ + def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd") + calcMonthlyPriceByName(curDate, command.city, command.region, command.name) + } + //删除命令 + COMMAND_COLL.remove(new BasicDBObject("_id", id)) + } } } } From 52f522c060ae0b1884be86e3d9041782c85215df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Wed, 17 Dec 2025 14:52:37 +0800 Subject: [PATCH 40/67] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fangjia/open/controllers/PoiController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java index 08c74dfef..1797aba1c 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java @@ -287,7 +287,7 @@ public class PoiController { double lng = Double.parseDouble(lngStr); double lat = Double.parseDouble(latStr); Map> result = new HashMap>(); - List bankSmallType = Arrays.asList("银行", "中国人民银行", "国家开发银行", "中国进出口银行", + List bankSmallType = Arrays.asList("中国人民银行", "国家开发银行", "中国进出口银行", "中国银行", "中国工商银行", "中国建设银行", "中国农业银行", "交通银行", "招商银行", "华夏银行", "中信银行", "中国民生银行", "中国光大银行", "上海银行", "上海浦东发展银行", "平安银行", "兴业银行", "北京银行", "广发银行", "农村商业银行", "香港恒生银行", "东亚银行", "花旗银行", "渣打银行", "汇丰银行", From 476fe6471fe06df9bb94ea7d8110f1cb897e4015 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 18 Dec 2025 12:10:54 +0800 Subject: [PATCH 41/67] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=8A=E6=8E=A5=E5=8F=A3bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/OfficeSellController.java | 74 ++- .../open/controllers/PoiController.java | 2 +- .../open/controllers/PropertyController.java | 534 +++++++++++++++++- .../com/fangjia/open/dto/HouseCaseDto.java | 150 +++++ .../open/model/PropertyEvaluationModel.java | 65 +++ .../src/main/resources/urlrewrite2.0.xml | 6 + .../service/address/AddressParserImpl.java | 1 + .../service/api/AddressMatchProxyService.java | 11 + .../api/AddressMatchProxyServiceImpl.java | 29 + .../datastore/DistrictSellStatService.java | 11 +- .../DistrictSellStatServiceImpl.java | 13 + .../datastore/DistrictServiceImpl.java | 10 +- .../service/datastore/HouseService.java | 28 + .../service/datastore/HouseServiceImpl.java | 252 ++++++++- .../service/datastore/OfficeServiceImpl.java | 13 +- .../mongo/fangjia/DealPriceService.java | 2 + .../mongo/fangjia/DealPriceServiceImpl.java | 27 + 17 files changed, 1187 insertions(+), 41 deletions(-) create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseCaseDto.java diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeSellController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeSellController.java index 340914d13..3157eaf17 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeSellController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeSellController.java @@ -222,32 +222,50 @@ public class OfficeSellController { public Object evaluateSellAction(PropertyEvaluationModel model, HttpServletRequest request) { RestfulModelAndView mav = new RestfulModelAndView(); mav.setViewType("rest"); - if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName()) - || StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0 || model.getCity().contains("全国") - || model.getDistrict().contains("全国")) { - mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,写字楼名,面积(size)为必填项")); + + if (StringUtils.isBlank(model.getCity()) || model.getSize()<=0) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,面积为必填项")); return mav; } - if (model.getCity().endsWith("市")) { - model.setCity(model.getCity().replaceAll("市$", "")); + + if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个")); + return mav; } + + /* 先到CPDB库中查找写字楼 */ - District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), "office"); + District district = null; + + if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())) { + district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), "office"); + } if (district == null) { - if (model.getDistrict().contains("市辖区") || model.getDistrict().contains(model.getCity())) { + if (StringUtils.isNotBlank(model.getDistrict()) && (model.getDistrict().contains("市辖区") || model.getDistrict().contains(model.getCity()))) { district = districtService.findByNameAndAlias(model.getCity(), null, model.getName(), "office"); } - if (district == null) { - mav.setModel(BasicModel.buildBadRequestModel("该写字楼不存在")); - return mav; + + } + + if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) { + JSONObject resultObject = null; + if(StringUtils.isNotBlank(model.getAddress())){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "office", false); + }else if(StringUtils.isNotBlank(model.getName())){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "office", false); } + if(resultObject != null){ + String id = (String) resultObject.get("id"); + district = districtService.findById(id); + } + } + + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("该写字楼不存在")); + return mav; } model.setName(district.getName()); - if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) { - mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法")); - return mav; - } if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)")); return mav; @@ -287,16 +305,19 @@ public class OfficeSellController { districtPriceMap.put("district", district.getRegion()); districtPriceMap.put("name", district.getName()); districtPriceMap.put("unitPrice", evaluation.getUnitPrice()); - districtPriceMap.put("samples", evaluation.getSeawater()); - - mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); - try { - if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { - openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/officeSell/evaluateSell"); - } - } catch (Exception e) { - e.printStackTrace(); + Long totalPrice = (long) (evaluation.getUnitPrice() * model.getSize()); + districtPriceMap.put("totalPrice", totalPrice); + if(model.getShow()!=null && model.getShow()==1){ + districtPriceMap.put("samples", evaluation.getSeawater()); } + mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); +// try { +// if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { +// openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/officeSell/evaluateSell"); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } return mav; } else { @@ -473,7 +494,10 @@ public class OfficeSellController { if (StringUtils.isNotBlank(model.getOtherFactor())) { evaluation.setOtherFactor(model.getOtherFactor()); } - evaluation.setRegion(model.getDistrict()); + if(StringUtils.isNotBlank(model.getDistrict())){ + evaluation.setRegion(model.getDistrict()); + } + if (null != model.getRoom()) { evaluation.setRoom(model.getRoom()); } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java index 08c74dfef..18b6f3b6d 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PoiController.java @@ -372,7 +372,7 @@ public class PoiController { for (Map hit : hits) { Map source = (Map) hit.get("_source"); - if (source.containsKey("name")) { + if (source.containsKey("name") && !source.get("name").toString().contains("公司")) { poiNames.add(source.get("name").toString()); } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index 18270c8ab..c4a7831bf 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -51,6 +51,7 @@ import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; +import org.apache.solr.client.solrj.util.ClientUtils; import org.bson.types.ObjectId; import org.slf4j.Logger; import org.sothis.core.util.CollectionUtils; @@ -1660,7 +1661,16 @@ public class PropertyController { } } } - + if (district == null) { + //使用新匹配再配一遍,不加类型,有结果,类型为district则走小区估值,其它类型也走经纬度估值 + JSONObject resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), null, false); + if (resultObject != null && resultObject.containsKey("category") && resultObject.get("category")!=null) { + if(resultObject.containsKey("id") && resultObject.get("category").equals("district")){ + String id = (String) resultObject.get("id"); + district = districtService.findById(id); + } + } + } if (district == null) { //加上高德获取经纬度 和 根据经纬度估值 @@ -2493,9 +2503,19 @@ public class PropertyController { item.put("name", districtStat.getDistrictName()); item.put("avgPrice", districtStat.getAvgPrice()); item.put("date", districtStat.getDate() / 100 + "-" + String.format("%02d", districtStat.getDate() % 100)); - item.put("changePercent", BigDecimal.valueOf(districtStat.getMom() * 100) - .setScale(2, RoundingMode.HALF_UP) - .doubleValue()); + if(null == districtStat.getMom()){ + if(result.size()>0){ + Integer avgPrice = (Integer) result.get(result.size() - 1).get("avgPrice"); + double mom = (districtStat.getAvgPrice() - avgPrice)*100.0/avgPrice; + item.put("changePercent", DataUtil.getRound(2, mom)); + }else{ + item.put("changePercent", 0); + } + }else{ + item.put("changePercent", BigDecimal.valueOf(districtStat.getMom() * 100) + .setScale(2, RoundingMode.HALF_UP) + .doubleValue()); + } result.add(item); } } @@ -6013,6 +6033,512 @@ public class PropertyController { return mav; } + public Object sellCaseAction(PropertyEvaluationModel model, HttpServletRequest request){ + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + + if (StringUtils.isBlank(model.getCity())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项")); + return mav; + } + + if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个")); + return mav; + } + + String estateType = null; + if(StringUtils.isNotBlank(model.getPropertyType())){ + if(model.getPropertyType().equals("0")){ + estateType = "普通住宅"; + }else if(model.getPropertyType().equals("1")){ + estateType = "别墅"; + }else if(model.getPropertyType().equals("2")){ + estateType = "商住"; + } + } + + District district = null; + + if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())){ + if(StringUtils.isNotBlank(model.getEstateType()) && model.getEstateType().equals("别墅") && !model.getName().contains("别墅")){ + district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName()+"别墅","district"); + }else{ + district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district"); + } + } + + if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) { + JSONObject resultObject = null; + if(StringUtils.isNotBlank(model.getAddress())){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "property", false); + }else if(StringUtils.isNotBlank(model.getName())){ + if(estateType !=null && estateType.equals("别墅") && !model.getName().contains("别墅")){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName()+"别墅", "property", false); + }else{ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "property", false); + } + + } + + if(resultObject != null){ + String id = (String) resultObject.get("id"); + district = districtService.findById(id); + } + } + if(district == null && StringUtils.isBlank(model.getLocation())){ + mav.setModel(BasicModel.buildOKModel().setResult(null)); + return mav; + } + + + String startDate = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -3),"yyyyMMdd"); + String endDate = DateUtil.formatByPattern(new Date(), "yyyyMMdd"); + + List caseDtos = new ArrayList(); + + Pager pager = new Pager(); + pager.setStartRow(0); + if (model.getPageSize() != null) { + pager.setPageSize(model.getPageSize()); +// if(model.getPageSize() <=50){ +// pager.setPageSize(model.getPageSize()); +// }else{ +// pager.setPageSize(50); +// } + } else { + pager.setPageSize(5); + } + + // 默认1公里内 + if (model.getRadius() == null) { + model.setRadius(1000); + } + + + if(district != null){ + if(model.getMinPrice() == null){ + DistrictSellStat districtSellStat = districtSellStatService.findFirstByParams(district.getCity(), district.getRegion(), district.getName()); + if(districtSellStat != null) { + int minPrice = (int) (districtSellStat.getAvgPrice() - districtSellStat.getAvgPrice() * 0.1); + model.setMinPrice(minPrice); + + int maxPrice = (int) (districtSellStat.getAvgPrice() + districtSellStat.getAvgPrice() * 0.1); + model.setMaxPrice(maxPrice); + } + }else{ + if(model.getMinPrice() != null && model.getMinPrice()>0){ + model.setMinPrice(model.getMinPrice()); + } + if(model.getMaxPrice() != null && model.getMaxPrice()>0){ + model.setMaxPrice(model.getMaxPrice()); + } + } + //先查成交案例 + Date startTime = DateUtil.parseDate(startDate,"yyyyMMdd"); + Date endTime = DateUtil.parseDate(endDate,"yyyyMMdd"); + List dealPrices = dealPriceService.findDealPrices(district.getId(), pager.getPageSize(), model.getMinPrice(), model.getMaxPrice(), startTime, endTime); + + if(dealPrices!=null && dealPrices.size()>0){ + caseDtos = createDealHouseCase(caseDtos, dealPrices, 0, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + + if(caseDtos.size() < pager.getPageSize()){ + //查自身样本 + List houseSelf = houseService.findSelfHouseByParams(district, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + if(caseDtos.size() < pager.getPageSize() && StringUtils.isNotBlank(estateType) && district.getName().contains("别墅")){ + District newDist = new District(); + newDist.setCity(district.getCity()); + newDist.setRegion(district.getRegion()); + newDist.setName(district.getName().replace("别墅","")); + newDist.setEstateType2(estateType); + houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + } + //有物业类型且自身样本数据不足,忽略物业类型查 + if(caseDtos.size() ==0 && StringUtils.isNotBlank(estateType)){ + District newDist = new District(); + newDist.setCity(district.getCity()); + newDist.setRegion(district.getRegion()); + newDist.setName(district.getName().replace("别墅","")); + newDist.setEstateType2(estateType); + houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), null, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + } + + //自身样本不足,查周边成交 + List districts = districtService.findNearestDistrict(district, 1000, 20); + if(districts!=null && districts.size()>0){ + for(District d : districts){ + if(!district.getId().equals(d.getId())){ + dealPrices = dealPriceService.findDealPrices(d.getId(), pager.getPageSize(), model.getMinPrice(), model.getMaxPrice(), DateUtil.parseDate(startDate,"yyyyMMdd"), DateUtil.parseDate(endDate,"yyyyMMdd")); + if(dealPrices!=null && dealPrices.size()>0 && d.getLng()!=null && d.getLng()>0){ + double distance = GeoUtils.calculateDistance(district.getLng()/10000000000.0, district.getLat()/10000000000.0, d.getLng()/10000000000.0, d.getLat()/10000000000.0); + caseDtos = createDealHouseCase(caseDtos, dealPrices, (int)distance, model.getShowSource()); + if(caseDtos.size()>pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + break; + } + } + } + } + if(caseDtos.size() == pager.getPageSize()){ + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + } + + } + + //自身成交,自身样本,周边成交不足,查周边挂牌 + List houseAround = null; + if (caseDtos.size() < pager.getPageSize() ) { + Double lng = null; + Double lat = null; + if(district!=null && district.getLat()!=null && district.getLat()>0){ + lng = district.getLng()/10000000000.0; + lat = district.getLat()/10000000000.0; + if(estateType == null ){ + estateType = district.getEstateType2(); + } + }else if(StringUtils.isNotBlank(model.getLocation())){ + String[] locationStr = model.getLocation().split(","); + String numberPattern = "-?\\d+(\\.\\d+)?"; // 匹配整数或浮点数 + for (String loc : locationStr) { + if (!loc.trim().matches(numberPattern)) { + mav.setModel(BasicModel.buildBadRequestModel("location(经纬度)格式错误")); + return mav; + } + } + lng = Double.valueOf(locationStr[0]); + lat = Double.valueOf(locationStr[1]); + if (lng < 70 || lng > 140 || lat < 0 || lat > 55) { + mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度")); + return mav; + } + } + if(lat !=null && lat>0){ + houseAround = houseService.findArroundHouseByParams("sell", lng, lat, Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager, model.getRadius()); + } + if(houseAround != null && houseAround.size()>0){ + caseDtos = createHouseCase(caseDtos, houseAround, model.getShowSource()); + } + } + if(caseDtos.size()>pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + } + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + + + public Object rentCaseAction(PropertyEvaluationModel model, HttpServletRequest request){ + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + + if (StringUtils.isBlank(model.getCity())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项")); + return mav; + } + + if (StringUtils.isBlank(model.getName()) && StringUtils.isBlank(model.getAddress()) ) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:名称或地址至少填一个")); + return mav; + } + + District district = null; + String estateType = null; + if(StringUtils.isNotBlank(model.getPropertyType())){ + if(model.getPropertyType().equals("0")){ + estateType = "普通住宅"; + }else if(model.getPropertyType().equals("1")){ + estateType = "别墅"; + }else if(model.getPropertyType().equals("2")){ + estateType = "商住"; + } + } + + if(StringUtils.isNotBlank(model.getDistrict()) && StringUtils.isNotBlank(model.getName())){ + district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district"); + } + + if (district == null && (StringUtils.isNotBlank(model.getName()) || StringUtils.isNotBlank(model.getAddress()))) { + JSONObject resultObject = null; + if(StringUtils.isNotBlank(model.getAddress())){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getAddress(), "property", false); + }else if(StringUtils.isNotBlank(model.getName())){ + if(estateType !=null && estateType.equals("别墅") && !model.getName().contains("别墅")){ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName()+"别墅", "property", false); + }else{ + resultObject = addressMatchProxyService.newMatch(model.getCity(), model.getName(), "property", false); + } + + } + + if(resultObject != null){ + String id = (String) resultObject.get("id"); + district = districtService.findById(id); + } + } + if(district == null && StringUtils.isBlank(model.getLocation())){ + mav.setModel(BasicModel.buildOKModel().setResult(null)); + return mav; + } + + String startDate = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -6),"yyyyMMdd"); + String endDate = DateUtil.formatByPattern(new Date(), "yyyyMMdd"); + + List caseDtos = new ArrayList(); + + Pager pager = new Pager(); + pager.setStartRow(0); + if (model.getPageSize() != null) { +// pager.setPageSize(model.getPageSize()); + if(model.getPageSize() <=50){ + pager.setPageSize(model.getPageSize()); + }else{ + pager.setPageSize(50); + } + } else { + pager.setPageSize(5); + } + + // 默认1公里内 + if (model.getRadius() == null) { + model.setRadius(1000); + } + + + if(district != null){ + if(model.getMinPrice() == null){ + SqmetreRent rent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), "district"); + + if(rent != null) { + int minPrice = (int) (rent.getAvgPrice().intValue() - rent.getAvgPrice().intValue() * 0.1); + model.setMinPrice(minPrice); + + int maxPrice = (int) (rent.getAvgPrice().intValue() + rent.getAvgPrice().intValue() * 0.1); + model.setMaxPrice(maxPrice); + } + }else{ + if(model.getMinPrice() != null && model.getMinPrice()>0){ + model.setMinPrice(model.getMinPrice()); + } + if(model.getMaxPrice() != null && model.getMaxPrice()>0){ + model.setMaxPrice(model.getMaxPrice()); + } + } + + + if(caseDtos.size() < pager.getPageSize()){ + //查自身样本 + List houseSelf = houseService.findSelfHouseByParams(district, "rent", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + + if(caseDtos.size() < pager.getPageSize() && StringUtils.isNotBlank(estateType) && district.getName().contains("别墅")){ + District newDist = new District(); + newDist.setCity(district.getCity()); + newDist.setRegion(district.getRegion()); + newDist.setName(district.getName().replace("别墅","")); + newDist.setEstateType2(estateType); + houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + } + + + //有物业类型且自身样本数据不足,忽略物业类型查 + if(caseDtos.size() ==0 && StringUtils.isNotBlank(estateType)){ + District newDist = new District(); + newDist.setCity(district.getCity()); + newDist.setRegion(district.getRegion()); + newDist.setName(district.getName().replace("别墅","")); + newDist.setEstateType2(estateType); + houseSelf = houseService.findSelfHouseByParams(newDist, "sell", Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), null, pager); + if(houseSelf!=null && houseSelf.size()>0){ + caseDtos = createHouseCase(caseDtos, houseSelf, model.getShowSource()); + if(caseDtos.size() == pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + } + } + } + } + + //自身样本不足,查周边挂牌 + List houseAround = null; + if (caseDtos.size() < pager.getPageSize() ) { + Double lng = null; + Double lat = null; + if(district!=null && district.getLat()!=null && district.getLat()>0){ + lng = district.getLng()/10000000000.0; + lat = district.getLat()/10000000000.0; + if(estateType == null ){ + estateType = district.getEstateType2(); + } + }else if(StringUtils.isNotBlank(model.getLocation())){ + String[] locationStr = model.getLocation().split(","); + String numberPattern = "-?\\d+(\\.\\d+)?"; // 匹配整数或浮点数 + for (String loc : locationStr) { + if (!loc.trim().matches(numberPattern)) { + mav.setModel(BasicModel.buildBadRequestModel("location(经纬度)格式错误")); + return mav; + } + } + lng = Double.valueOf(locationStr[0]); + lat = Double.valueOf(locationStr[1]); + if (lng < 70 || lng > 140 || lat < 0 || lat > 55) { + mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度")); + return mav; + } + } + if(lat !=null && lat>0){ + houseAround = houseService.findArroundHouseByParams("rent", lng, lat, Integer.parseInt(startDate), Integer.parseInt(endDate), model.getMinPrice(), model.getMaxPrice(), estateType, pager, model.getRadius()); + } + if(houseAround != null && houseAround.size()>0){ + caseDtos = createHouseCase(caseDtos, houseAround, model.getShowSource()); + } + } + if(caseDtos.size()>pager.getPageSize()){ + caseDtos = caseDtos.subList(0, caseDtos.size()-1); + } + mav.setModel(BasicModel.buildOKModel().setResult(caseDtos)); + return mav; + } + + + + private List createDealHouseCase(List caseDtos, List dealPrices,int distance, Integer showSource){ + if(dealPrices!=null && dealPrices.size()>0){ + List ids = new ArrayList(); + for(HouseCaseDto dto : caseDtos){ + ids.add(dto.getId()); + } + for(DealPrice dp : dealPrices){ + if(!ids.contains(dp.getId())){ + HouseCaseDto dto = new HouseCaseDto(); + dto.setId(dp.getId()); + dto.setCity(dp.getCity()); + dto.setDistrict(dp.getRegion()); + dto.setName(dp.getDistrictName()); + dto.setSize(dp.getArea()); + dto.setDistance(distance); + dto.setUnitPrice(dp.getAvgPrice()); + dto.setTotalPrice(dp.getTotalPrice()); + dto.setDecoration(dp.getFitment()); + dto.setDirection(dp.getDirection()); + dto.setFloor(dp.getFloor()); + dto.setMaxFloor(dp.getHeight()); + dto.setRoom(String.valueOf(dp.getRoom())); + dto.setHall(String.valueOf(dp.getHall())); + dto.setCaseDate(DateUtil.formatByPattern(dp.getTradeDate(), "yyyy-MM-dd")); + if(showSource!=null && showSource==1){ + dto.setSource("成交"); + } + caseDtos.add(dto); + } + } + return caseDtos; + } + return null; + } + + + private List createHouseCase(List caseDtos, List houses, Integer showSource){ + if (houses != null && !houses.isEmpty()) { + Set seenIds = new HashSet(); + Iterator iterator = houses.iterator(); + while (iterator.hasNext()) { + Seawater s = iterator.next(); + if (!seenIds.add(s.getId())) { + // 如果已经存在,则从列表中移除 + iterator.remove(); + } + } + + List ids = new ArrayList(); + for(HouseCaseDto dto : caseDtos){ + ids.add(dto.getId()); + } + for (Seawater house : houses) { + if(!ids.contains(house.getId())){ + HouseCaseDto caseDto = new HouseCaseDto(); + caseDto.setId(house.getId()); + caseDto.setCity(house.getCity()); + caseDto.setDistrict(house.getRegion()); + caseDto.setName(house.getDistrictName()); + caseDto.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea()); + caseDto.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice()); + caseDto.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice()); + caseDto.setDirection(house.getDirection()); + caseDto.setDecoration(house.getFitment()); + caseDto.setFloor(house.getFloor() == null || house.getFloor() == 0 ? null : house.getFloor()); + caseDto.setMaxFloor(house.getHeight() == null || house.getHeight() == 0 ? null : house.getHeight()); + caseDto.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom().toString()); + caseDto.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall().toString()); + + if (house.getpDate() != null && house.getpDate() > 10000000) { + String numberStr = String.valueOf(house.getpDate()); + // 拆分字符串并格式化 + String year = numberStr.substring(0, 4); // 前四位是年份 + String month = numberStr.substring(4, 6); // 中间两位是月份 + String day = numberStr.substring(6, 8); // 最后两位是日期 + String formattedDate = year + "-" + month + "-" + day; + caseDto.setCaseDate(formattedDate); + } + caseDto.setDistance(house.getDistance()); + if(showSource!=null && showSource==1){ + caseDto.setSource("挂牌"); + } + caseDtos.add(caseDto); + } + } + } + return caseDtos; + } public void setHouseLoudongService(HouseLoudongService houseLoudongService) { this.houseLoudongService = houseLoudongService; diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseCaseDto.java b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseCaseDto.java new file mode 100644 index 000000000..f662a9eba --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseCaseDto.java @@ -0,0 +1,150 @@ +package com.fangjia.open.dto; + +public class HouseCaseDto { + + private String id;//房源id + private String city;//城市 + private String district;//区域 + private String name;//楼盘名称 + private Integer distance;//距离(单位:米) + private Double size;//面积(单位:平米) + private Integer unitPrice;//单价(单位:元/平米) + private Integer totalPrice;//总价(单位:元) + private String decoration;//装修(如:精装) + private String direction;//朝向(如:南) + private Integer floor;//所在楼层 + private Integer maxFloor;//总楼层 + private String room;//室 + private String hall;//厅 + private String caseDate;//案例时间(如: 2013-07-12) + private String source;//来源 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getDistance() { + return distance; + } + + public void setDistance(Integer distance) { + this.distance = distance; + } + + public Double getSize() { + return size; + } + + public void setSize(Double size) { + this.size = size; + } + + public Integer getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(Integer unitPrice) { + this.unitPrice = unitPrice; + } + + public Integer getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(Integer totalPrice) { + this.totalPrice = totalPrice; + } + + public String getDecoration() { + return decoration; + } + + public void setDecoration(String decoration) { + this.decoration = decoration; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public Integer getFloor() { + return floor; + } + + public void setFloor(Integer floor) { + this.floor = floor; + } + + public Integer getMaxFloor() { + return maxFloor; + } + + public void setMaxFloor(Integer maxFloor) { + this.maxFloor = maxFloor; + } + + public String getRoom() { + return room; + } + + public void setRoom(String room) { + this.room = room; + } + + public String getHall() { + return hall; + } + + public void setHall(String hall) { + this.hall = hall; + } + + public String getCaseDate() { + return caseDate; + } + + public void setCaseDate(String caseDate) { + this.caseDate = caseDate; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } +} diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java index 0d134164c..fe0c4f31b 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java @@ -296,6 +296,39 @@ public class PropertyEvaluationModel extends FangjiaApiModel { private String sampleIds; + private Integer max; + + + private Date startDate; + private Date endDate; + private Integer pageSize; + + /** + * 显示来源 + */ + private Integer showSource; + + /** + * 显示房源 1:显示 0:默认 不显示 + */ + private Integer show; + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Integer getShowSource() { + return showSource; + } + + public void setShowSource(Integer showSource) { + this.showSource = showSource; + } + public void setDecorationAge(int decorationAge) { this.decorationAge = decorationAge; } @@ -962,4 +995,36 @@ public class PropertyEvaluationModel extends FangjiaApiModel { public String getSampleIds() { return sampleIds; } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Integer getShow() { + return show; + } + + public void setShow(Integer show) { + this.show = show; + } } diff --git a/projects/fangjia-open/src/main/resources/urlrewrite2.0.xml b/projects/fangjia-open/src/main/resources/urlrewrite2.0.xml index 22c9f3057..49a308d0a 100644 --- a/projects/fangjia-open/src/main/resources/urlrewrite2.0.xml +++ b/projects/fangjia-open/src/main/resources/urlrewrite2.0.xml @@ -49,5 +49,11 @@ + + + /evaluateSell + + + \ No newline at end of file diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserImpl.java index c5416a402..65204b58b 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/address/AddressParserImpl.java @@ -1469,6 +1469,7 @@ public class AddressParserImpl implements AddressParser { .replaceAll("【】()\\(\\)\\[\\]", "").replaceAll("\\*+", "").replaceAll("[\\s ]+", ""); } + public void setDistrictService(DistrictService districtService) { this.districtService = districtService; } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyService.java index 01e5b41dc..dc7c83017 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyService.java @@ -88,5 +88,16 @@ public interface AddressMatchProxyService { JSONObject addressStructure(String city, String address); + + + /** + * 最新的匹配算法(穆) + * @param city + * @param address + * @param category + * @param useMap + * @return + */ + JSONObject newMatch(String city, String address, String category, boolean useMap ); } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyServiceImpl.java index ce98de284..a7ef5db02 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/api/AddressMatchProxyServiceImpl.java @@ -866,6 +866,35 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme } } + @Override + public JSONObject newMatch(String city, String address, String category, boolean useMap ){ + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("city", city); + params.put("address", address); + if(StringUtils.isNotBlank(category)){ + params.put("category", category); + } + + params.put("useMap", String.valueOf(useMap)); + try { + json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); + } catch (Exception e) { + try { + json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + if (json != null && json.size()>0) { + return (JSONObject)json; + } + return null; + } + + public void setHouseLoudongService(HouseLoudongService houseLoudongService) { this.houseLoudongService = houseLoudongService; } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatService.java index 248c24f17..9098abe9f 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatService.java @@ -99,6 +99,15 @@ public interface DistrictSellStatService { * @return */ Long findCityMarkDownDistrictCount(String city); - + + + /** + * 查找最新一期的月度增价 + * @param city + * @param region + * @param name + * @return + */ + DistrictSellStat findFirstByParams(String city, String region,String name); } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatServiceImpl.java index cd820055b..b42369813 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictSellStatServiceImpl.java @@ -219,4 +219,17 @@ public class DistrictSellStatServiceImpl implements DistrictSellStatService { params.add(new QueryParam("mom", QueryParam.LESS_THAN_OPERATOR, 0)); return districtSellStatDao.findCountByParams(params); } + + @Override + public DistrictSellStat findFirstByParams(String city, String region,String name) { + List queryParams = ImmutableList.of( + new QueryParam("city", city), + new QueryParam("region", region), + new QueryParam("districtName", name) + ); + List sortParams = ImmutableList.of( + new SortParam("date", false) + ); + return districtSellStatDao.findFirstByParams(queryParams, sortParams); + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java index 238c968db..f6d2dc833 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java @@ -2014,6 +2014,13 @@ public class DistrictServiceImpl implements DistrictService { if (city == null){ return null; } + if(RegionData.isRegion(city, region)){ + region = RegionData.formatRegion(city, region); + } + if(region == null){ + return null; + } + District districtInfo = findDistrict(new DistrictKey(city, region, name), target); // 先精确查询,查不到再根据别名匹配 if (districtInfo != null) { @@ -2449,6 +2456,7 @@ public class DistrictServiceImpl implements DistrictService { List params = new ArrayList(); params.add(new QueryParam("category", "district")); params.add(new QueryParam("city", district.getCity())); + params.add(new QueryParam("estateType2", district.getEstateType2())); params.add(new QueryParam("visible", 0)); SdQuery sdQuery = new SdQuery(); sdQuery.setPoint((double) district.getLat() / 10000000000.0 + "," + (double) district.getLng() / 10000000000.0); @@ -2456,7 +2464,7 @@ public class DistrictServiceImpl implements DistrictService { sdQuery.setDistance(String.valueOf((double) radiusMeters / 1000.0)); params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery)); List list = districtDao.findAllByParams(params, null, 0, limit * 2, - new String[] { "city", "region", "name", "estateType2", "id" }); + new String[] { "city", "region", "name", "estateType2", "id","lat","lng" }); if (list.isEmpty()) { return Collections.emptyList(); } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseService.java index 1b112e38c..3bcf1649a 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseService.java @@ -8,6 +8,7 @@ import java.util.Map; import com.fangjia.dal.FacetQuery; import com.fangjia.dal.common.DistrictKey; import com.fangjia.dal.datastore.model.RentHouse; +import com.fangjia.dal.seawater.model.Seawater; import com.fangjia.datastore.driver.FacetResult; import com.fangjia.service.bo.HousePDSBo; import com.fangjia.service.bo.HouseScorer; @@ -473,5 +474,32 @@ public interface HouseService extends ModeService { List findNearestHasHouseByLocation(String city, Double lat, Double lng, String cat, int radiusMeters, int limit); + /** + * 查询自身房源 + * @param district + * @param cat + * @param startTime + * @param endTime + * @param startPrie + * @param endPrice + * @param pager + * @return + */ + List findSelfHouseByParams(District district, String cat, Integer startTime, Integer endTime, Integer startPrie, Integer endPrice, String estateType, Pager pager); + + /** + * 根据经纬度查周边样本 + * @param lng + * @param lat + * @param startTime + * @param endTime + * @param startPrie + * @param endPrice + * @param pager + * @param radius + * @return + */ + List findArroundHouseByParams(String cat, Double lng, Double lat, Integer startTime, Integer endTime, Integer startPrie, Integer endPrice, String estateType, Pager pager, Integer radius); + } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseServiceImpl.java index 5eb20dfea..ec788a71c 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/HouseServiceImpl.java @@ -11,16 +11,18 @@ import com.fangjia.dal.datastore.model.House; import com.fangjia.dal.datastore.model.RentHouse; import com.fangjia.dal.mongo.dao.UserHouseDao; import com.fangjia.dal.mongo.fangjia.model.ServerArea; +import com.fangjia.dal.mongo.model.DistrictStat; +import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap; import com.fangjia.dal.mongo.model.UserHouse; +import com.fangjia.dal.mongo.model.bkoff.DealPrice; +import com.fangjia.dal.seawater.dao.SeawaterDao; +import com.fangjia.dal.seawater.model.Seawater; import com.fangjia.dal.seaweed.model.District; import com.fangjia.datastore.driver.DSCollection; import com.fangjia.datastore.driver.DataStore; import com.fangjia.datastore.driver.FacetResult; import com.fangjia.service.api.KnowbaseService; -import com.fangjia.service.bo.HouseBo; -import com.fangjia.service.bo.HousePDSBo; -import com.fangjia.service.bo.HouseScorer; -import com.fangjia.service.bo.KnowbaseBo; +import com.fangjia.service.bo.*; import com.fangjia.service.common.SellSimilar; import com.fangjia.service.datastore.bean.HouseQueryBean; import com.fangjia.service.district.DistrictStatService; @@ -31,6 +33,7 @@ import com.fangjia.service.menu.Menu; import com.fangjia.service.mode.ModeEnum; import com.fangjia.service.mongo.fangjia.MetroService; import com.fangjia.service.query.QueryBean; +import com.fangjia.service.util.CommonUtils; import com.fangjia.service.util.ServiceUtil; import com.fangjia.service.util.SitenameUtil; import com.fangjia.service.web.MenuService; @@ -38,6 +41,7 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBObject; import org.apache.commons.lang.StringUtils; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; @@ -83,7 +87,9 @@ public class HouseServiceImpl implements HouseService { * 房源样本估价简洁模式检索属性 */ private static final String[] SAMPLE_COMPACT = {"id", "city", "region", "districtName", "name", "area", "hall", "room", "toilet", "floor", "height", "direction", "fitment", "totalPrice", "url", "publishDate" }; - + + public static String[] TAGS = new String[]{"独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"}; + private HouseDao houseDao; private PicService picService; private DistrictService districtService; @@ -94,6 +100,7 @@ public class HouseServiceImpl implements HouseService { private BoostQueryPolicy boostQueryInformationPolicy; private UserHouseDao userHouseDao; private DistrictStatService districtStatService; + private SeawaterDao seawaterDao; public FacetQueryResult randomGainHouse(HouseQueryBean queryBean, int count) { long totalCount = this.findHouseCount(queryBean); @@ -2635,4 +2642,239 @@ public class HouseServiceImpl implements HouseService { return list; } + + @Override + public List findSelfHouseByParams(District district, String cat, Integer startTime, Integer endTime, Integer startPrie, Integer endPrice, String estateType, Pager pager) { + SeawaterQuery query = new SeawaterQuery(); + // 先用名字查自身的样本 + query.setCityDisplay(district.getCity()); + query.setRegion(district.getRegion()); + query.setDistrictName(district.getName()); + query.setCat(cat); + query.setStartDate(startTime); + query.setEndDate(endTime); + if(StringUtils.isNotBlank(estateType)){ + query.setEstateType(estateType); + } + + if (startPrie != null) { + query.setStartPrice(startPrie); + } + if(endPrice != null){ + query.setEndPrice(endPrice); + } + query.setPager(pager); + query.setSortField("p_date"); + query.setOrder(false); + query.setTable("latest_seawater"); +// if(StringUtils.isNotBlank(estateType)){ + List seawaters = seawaterDao.findSeawatersByQuery(query); + List houses = new ArrayList(); + for(Seawater s : seawaters){ + if(StringUtils.isNotBlank(district.getEstateType2())){ + if (district.getEstateType2().equals("普通住宅")) {//01:普通住宅 02:别墅 + if (StringUtils.isNotBlank(s.getEstateType()) && s.getEstateType().contains("别墅")) { + continue; + } + if (isVilla(s.getArea(), s.getName(), s.getHeight(), s.getRoom())) { + continue; + } + houses.add(s); + } else if (district.getEstateType2().equals("别墅")) { + if (s.getHeight() != null && s.getHeight() >= 10) { + continue; + } + if (s.getFloor() != null && s.getFloor() >= 10) { + continue; + } + if (s.getArea()<=150) { + continue; + } + houses.add(s); + } + } + } + return houses; +// } +// return seawaterDao.findSeawatersByQuery(query); + } + + @Override + public List findArroundHouseByParams(String cat, Double lng, Double lat, Integer startTime, Integer endTime, Integer startPrie, Integer endPrice, String estateType, Pager pager, Integer radius) { + SeawaterQuery query = new SeawaterQuery(); + query.setLat(lat); + query.setLng(lng); + query.setRadius(radius); + + query.setCat(cat); + query.setStartDate(startTime); + query.setEndDate(endTime); + + if (startPrie != null) { + query.setStartPrice(startPrie); + } + if(endPrice != null){ + query.setEndPrice(endPrice); + } + if(StringUtils.isNotBlank(estateType)){ + query.setEstateType(estateType); + } + query.setPager(pager); + query.setSortField("p_date"); + query.setOrder(false); + query.setTable("latest_seawater"); + + return seawaterDao.findSeawatersByQuery(query); + } + + /** + * + * @param estateType 用户查询物业类型 + * @param startDate + * @return + */ + private List findByDistrict(District district, List keys, List names, Date startDate, Integer startPrice, Integer endPrice) { + + //改为从ES 查房源 + ArrayList districtNames = new ArrayList(); + BooleanQuery nameQuery = new BooleanQuery(); + int c = 0; + for (String namekey : keys) { + if (StringUtils.isNotBlank(namekey)) { + namekey = ClientUtils.escapeQueryChars(namekey); + if (namekey.contains("_")) { + districtNames.add(namekey.split("_")[0]); + } + c++; + nameQuery.add(new TermQuery(new Term("districtname_key", namekey)), BooleanClause.Occur.SHOULD); + } + } + + List samples = new ArrayList(); + List nolianjiaSamples = new ArrayList(); + + List houseQuery = new ArrayList(); + houseQuery.add(new QueryParam("city", district.getCity())); + houseQuery.add(new QueryParam("region", district.getRegion())); + SeawaterQuery seawaterQuery = new SeawaterQuery(); + if (startPrice!=null && startPrice>0) { + houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startPrice)); + } + if(endPrice!=null && endPrice>0){ + houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, endPrice)); + } + + if (nameQuery.clauses().isEmpty()) { + return samples; + } + BooleanQuery srQuery = new BooleanQuery(); + srQuery.add(nameQuery, BooleanClause.Occur.MUST); + houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery))); + if (startDate != null) { + houseQuery.add(new QueryParam("publishDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); + } + + List houseSortParams = new ArrayList(); + houseSortParams.add(new SortParam("publishDate", false)); + + seawaterQuery.setCityDisplay(district.getCity()); + seawaterQuery.setDistrictAlias(names); + seawaterQuery.setRegion(district.getRegion()); + seawaterQuery.setDistrictName(district.getName()); + + seawaterQuery.setSortField("p_date"); + seawaterQuery.setOrder(false); + Pager pager = new Pager(0, 200); + pager.setPageSize(200); + seawaterQuery.setTable("latest_seawater"); + seawaterQuery.setPager(pager); + seawaterQuery.setCat("sell"); + List seawaters = seawaterDao.findSeawatersByQuery(seawaterQuery); + List houses = CommonUtils.transformListV(House.class, seawaters); + + int height = 0; + int maxFloor = 0; + boolean allSampleHasHeight = true; + for (House house : houses) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().equals("普通住宅")) {//01:普通住宅 02:别墅 + if (StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("别墅")) { + continue; + } + if (isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())) { + continue; + } + } else if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().equals("别墅")) { + if (house.getHeight() != null && house.getHeight() >= 10) { + continue; + } + if (house.getFloor() != null && house.getFloor() >= 10) { + continue; + } + } + + SampleWrapper sample = null;//convertHouse2Sample(house); + if (isAvailableSample(sample)) { + if (house.getUrl().contains("lianjia.com") || house.getUrl().contains("ke.com")) { + samples.add(sample); + } else { + nolianjiaSamples.add(sample); + } + } + + + } + + return samples; + } + + /** + * 判断样本是否可用 + * + * @param sample + * @return + */ + private boolean isAvailableSample(SampleWrapper sample) { + if (sample.getStrctureArea() > 500 || sample.getStrctureArea() < 10) { + return false; + } + + return true; + } + + /** + * 是否是别墅 + * + * @return + */ + public boolean isVilla(Double area, String name, Integer height, Integer 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; + } + + public void setSeawaterDao(SeawaterDao seawaterDao) { + this.seawaterDao = seawaterDao; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java index 70d7fa37f..0e0648ab9 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java @@ -197,9 +197,6 @@ public class OfficeServiceImpl implements OfficeService { params.add(new QueryParam("city", evaluation.getCity())); params.add(new QueryParam("district", evaluation.getRegion())); params.add(new QueryParam("name", evaluation.getDistrictName())); - // 获取上个月yyyyMM日期 - String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -2), "yyyyMM"); - params.add(new QueryParam("date", Integer.parseInt(date))); // 按日期降序排序,取最新的数据,可能上月还未更新,则取上上个月的数据 List sortParams = new ArrayList(); @@ -207,7 +204,15 @@ public class OfficeServiceImpl implements OfficeService { // 第二步:基准价*楼层系数*装修系数*朝向系数 OfficeRentStat officeRentStat = officeRentStatDao.findFirstByParams(params); - Double avgPrice = officeRentStat.getAvgPrice(); +// if(officeRentStat == null){ +// // 获取上个月yyyyMM日期 +// String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -1), "yyyyMM"); +// params.add(new QueryParam("date", Integer.parseInt(date))); +// } + Double avgPrice = null; + if(officeRentStat != null){ + avgPrice = officeRentStat.getAvgPrice(); + } if (avgPrice != null) { Double factor = 1.0; if (evaluation.getFitment() != null) { diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceService.java index fbd4dd7ea..4caf96ee2 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceService.java @@ -69,6 +69,8 @@ public interface DealPriceService { */ public List findDealPrices(List params, int max); + public List findDealPrices(String id, int max, Integer startPrice, Integer endPrice, Date startDate, Date endDate); + public Integer findDealPrices(String city, String region, String districtName, Date startDate, Date endDate); public List findDealPriceList(String city, String region, String districtName, Date startDate, diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java index 8a93f201e..300dca8f6 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/DealPriceServiceImpl.java @@ -180,6 +180,33 @@ public class DealPriceServiceImpl implements DealPriceService { "tradeDate", "source", "room", "hall", "toilet", "height", "floor","direction" }); } + @Override + public List findDealPrices(String id, int max, Integer startPrice, Integer endPrice, Date startDate, Date endDate) { + List params = new ArrayList(); + params.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, DateUtil.add(new Date(), -6))); + params.add(new QueryParam("matchId", id)); + if(startPrice!=null && startPrice>0){ + params.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startPrice)); + } + if(startPrice!=null && startPrice>0){ + params.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, endPrice)); + } + + if(startDate!=null){ + params.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate)); + } + if(endDate!=null){ + params.add(new QueryParam("tradeDate", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate)); + } + + + List sortParams = new ArrayList(); + sortParams.add(new SortParam("tradeDate", false)); + return dealPriceDao.findAllByParams(params, sortParams, 0, max, + new String[] { "city", "region", "districtName", "avgPrice", "fitment", "area", "totalPrice", + "tradeDate", "source", "room", "hall", "toilet", "height", "floor","direction" }); + } + @Override public Integer findDealPrices(String city, String region, String districtName, Date startDate, Date endDate) { List params = new ArrayList(); From 7b0125d7a78f259d3db1e04f7d8ec3fb3fc7a282 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 18 Dec 2025 15:23:04 +0800 Subject: [PATCH 42/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E5=8F=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia-coresite/src/main/webapp/about/contact.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/ad/introduce.ftl | 2 +- .../src/main/webapp/addressAnaly/dialog.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/alidata/download.ftl | 2 +- projects/fangjia-coresite/src/main/webapp/api/all.ftl | 2 +- .../fangjia-coresite/src/main/webapp/api/budongchan.ftl | 2 +- .../fangjia-coresite/src/main/webapp/api/dianzhifenxi.ftl | 2 +- .../fangjia-coresite/src/main/webapp/api/jiazhifenxi.ftl | 2 +- .../fangjia-coresite/src/main/webapp/api/testApply.ftl | 4 ++-- .../src/main/webapp/api/yapinfengkong.ftl | 2 +- projects/fangjia-coresite/src/main/webapp/app/index.ftl | 2 +- projects/fangjia-coresite/src/main/webapp/beans/done.ftl | 2 +- .../fangjia-coresite/src/main/webapp/company/about.ftl | 6 +++--- .../fangjia-coresite/src/main/webapp/daikuan/fail.ftl | 2 +- .../fangjia-coresite/src/main/webapp/daikuan/show.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/diaoyudao/index.ftl | 2 +- .../src/main/webapp/evaluation/checkUser.ftl | 2 +- .../src/main/webapp/evaluation/loan_apply.ftl | 2 +- .../src/main/webapp/evaluation/reportNew.ftl | 2 +- .../fangjia-coresite/src/main/webapp/footer/footer.ftl | 2 +- .../src/main/webapp/footer/introduceFooter.ftl | 2 +- .../src/main/webapp/footer/simpleFooter.ftl | 4 ++-- .../src/main/webapp/footer/simpleFooterNew.ftl | 4 ++-- projects/fangjia-coresite/src/main/webapp/gjs/index.ftl | 2 +- .../fangjia-coresite/src/main/webapp/header/header.ftl | 4 ++-- .../src/main/webapp/header/v2/_footer.ftl | 2 +- .../src/main/webapp/header/v5/_footer.ftl | 6 +++--- .../src/main/webapp/header/v5/_footer2.ftl | 4 ++-- .../src/main/webapp/header/v5/contact.ftl | 2 +- .../fangjia-coresite/src/main/webapp/header/v5/index.ftl | 6 +++--- .../src/main/webapp/header/v5/noBoxApp_footer.ftl | 4 ++-- .../src/main/webapp/header/v5/noFooterM_footer.ftl | 2 +- .../src/main/webapp/header/v6/_footer.ftl | 4 ++-- .../src/main/webapp/header/v6/float_wid.ftl | 2 +- .../fangjia-coresite/src/main/webapp/help/contactUs.ftl | 2 +- .../fangjia-coresite/src/main/webapp/help/friendLink.ftl | 2 +- .../src/main/webapp/industry/consulting.ftl | 2 +- .../fangjia-coresite/src/main/webapp/industry/cost.ftl | 2 +- .../fangjia-coresite/src/main/webapp/industry/itfin.ftl | 2 +- .../src/main/webapp/loanLeads/addSuccess.ftl | 2 +- .../src/main/webapp/loanLeads/success.ftl | 2 +- .../src/main/webapp/personalcenter/index.ftl | 4 ++-- .../src/main/webapp/personalcenter/rechargeHistory.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/recharge/buyList.ftl | 4 ++-- .../src/main/webapp/recharge/prechargePay.ftl | 6 +++--- .../src/main/webapp/recharge/rechargeList.ftl | 4 ++-- .../src/main/webapp/recharge/setPassword.ftl | 4 ++-- .../src/main/webapp/recharge/statement.ftl | 4 ++-- .../src/main/webapp/saleLeads/dataAbility.ftl | 2 +- .../src/main/webapp/saleLeads/didataApply.ftl | 2 +- .../src/main/webapp/saleLeads/didataResult.ftl | 2 +- .../fangjia-coresite/src/main/webapp/saleLeads/result.ftl | 2 +- .../fangjia-coresite/src/main/webapp/solution/card.ftl | 2 +- .../src/main/webapp/solution/location.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/solution/outlets.ftl | 2 +- .../fangjia-coresite/src/main/webapp/solution/paimai.ftl | 4 ++-- projects/fangjia-coresite/src/main/webapp/user/login.ftl | 2 +- .../fangjia-coresite/src/main/webapp/user/login_check.ftl | 2 +- .../fangjia-coresite/src/main/webapp/user/password.ftl | 2 +- .../fangjia-coresite/src/main/webapp/user/regSuccess.ftl | 2 +- .../fangjia-coresite/src/main/webapp/user/register.ftl | 2 +- .../src/main/webapp/user/reqUserLoginPage.ftl | 8 ++++---- .../src/main/webapp/user/reqUserRegPage.ftl | 6 +++--- .../src/main/webapp/user/reqUserResetPassPage.ftl | 4 ++-- .../fangjia-coresite/src/main/webapp/xingshang/regist.ftl | 2 +- .../src/main/webapp/jsp/fangjia/_footer.jsp | 2 +- .../src/main/webapp/jsp/fangshidai/_footer.jsp | 4 ++-- .../src/main/webapp/jsp/loan/house-loan-index.jsp | 2 +- 68 files changed, 101 insertions(+), 101 deletions(-) diff --git a/projects/fangjia-coresite/src/main/webapp/about/contact.ftl b/projects/fangjia-coresite/src/main/webapp/about/contact.ftl index da753c519..53ae27c93 100644 --- a/projects/fangjia-coresite/src/main/webapp/about/contact.ftl +++ b/projects/fangjia-coresite/src/main/webapp/about/contact.ftl @@ -28,12 +28,12 @@
涓婃捣浼板缃戠粶绉戞妧鏈夐檺鍏徃
-
鍜ㄨ鐑嚎锛� 4001883787
锛堝懆涓�鑷冲懆浜� 09:00-18:00锛�
+
鍜ㄨ鐑嚎锛� 021-62393138
锛堝懆涓�鑷冲懆浜� 09:00-18:00锛�

涓婃捣鎬婚儴

- 鐢�  璇�锛� 4001883787锛堝懆涓�鑷冲懆浜� 09:00-18:00锛�
+ 鐢�  璇�锛� 021-62393138锛堝懆涓�鑷冲懆浜� 09:00-18:00锛�
閭�  绠�锛� gujia@fangjia.com
鍦�  鍧�锛� 涓婃捣甯傞暱瀹佸尯鍗忓拰璺�1033鍙锋枃娲嬪ぇ鍘搴�10妤�
閭�  缂�锛� 200335

diff --git a/projects/fangjia-coresite/src/main/webapp/ad/introduce.ftl b/projects/fangjia-coresite/src/main/webapp/ad/introduce.ftl index 2d9a9968e..de93cd5e9 100644 --- a/projects/fangjia-coresite/src/main/webapp/ad/introduce.ftl +++ b/projects/fangjia-coresite/src/main/webapp/ad/introduce.ftl @@ -63,7 +63,7 @@
鍏嶈垂浣撻獙璇疯仈绯伙細 - 4001883787 + 021-62393138
diff --git a/projects/fangjia-coresite/src/main/webapp/addressAnaly/dialog.ftl b/projects/fangjia-coresite/src/main/webapp/addressAnaly/dialog.ftl index d441969a5..66f113c0c 100644 --- a/projects/fangjia-coresite/src/main/webapp/addressAnaly/dialog.ftl +++ b/projects/fangjia-coresite/src/main/webapp/addressAnaly/dialog.ftl @@ -44,7 +44,7 @@ -

鎮ㄤ篃鍙互鐩存帴鑱旂郴鍟嗗姟锛屽晢鍔$儹绾匡細4001883787

+

鎮ㄤ篃鍙互鐩存帴鑱旂郴鍟嗗姟锛屽晢鍔$儹绾匡細021-62393138

@@ -61,7 +61,7 @@ - 鍗曟鍏嶈垂鎵归噺鍒嗘瀽100鏉′笂娴峰湴鍧�鏁版嵁锛屽闇�鍒嗘瀽瓒呰繃100鏉℃暟鎹垨娴嬭瘯鍏朵粬鍩庡競璇疯仈绯诲晢鍔★細4001883787 + 鍗曟鍏嶈垂鎵归噺鍒嗘瀽100鏉′笂娴峰湴鍧�鏁版嵁锛屽闇�鍒嗘瀽瓒呰繃100鏉℃暟鎹垨娴嬭瘯鍏朵粬鍩庡競璇疯仈绯诲晢鍔★細021-62393138 diff --git a/projects/fangjia-coresite/src/main/webapp/alidata/download.ftl b/projects/fangjia-coresite/src/main/webapp/alidata/download.ftl index e1f816cc9..5741795e3 100644 --- a/projects/fangjia-coresite/src/main/webapp/alidata/download.ftl +++ b/projects/fangjia-coresite/src/main/webapp/alidata/download.ftl @@ -72,7 +72,7 @@

diff --git a/projects/fangjia-coresite/src/main/webapp/api/budongchan.ftl b/projects/fangjia-coresite/src/main/webapp/api/budongchan.ftl index c85afd432..732356ab5 100644 --- a/projects/fangjia-coresite/src/main/webapp/api/budongchan.ftl +++ b/projects/fangjia-coresite/src/main/webapp/api/budongchan.ftl @@ -86,7 +86,7 @@ diff --git a/projects/fangjia-coresite/src/main/webapp/api/dianzhifenxi.ftl b/projects/fangjia-coresite/src/main/webapp/api/dianzhifenxi.ftl index 7e593f544..1c03811e8 100644 --- a/projects/fangjia-coresite/src/main/webapp/api/dianzhifenxi.ftl +++ b/projects/fangjia-coresite/src/main/webapp/api/dianzhifenxi.ftl @@ -86,7 +86,7 @@ diff --git a/projects/fangjia-coresite/src/main/webapp/api/jiazhifenxi.ftl b/projects/fangjia-coresite/src/main/webapp/api/jiazhifenxi.ftl index d66d3a83b..580052a89 100644 --- a/projects/fangjia-coresite/src/main/webapp/api/jiazhifenxi.ftl +++ b/projects/fangjia-coresite/src/main/webapp/api/jiazhifenxi.ftl @@ -84,7 +84,7 @@ diff --git a/projects/fangjia-coresite/src/main/webapp/api/testApply.ftl b/projects/fangjia-coresite/src/main/webapp/api/testApply.ftl index ebd64a57e..faf58c105 100644 --- a/projects/fangjia-coresite/src/main/webapp/api/testApply.ftl +++ b/projects/fangjia-coresite/src/main/webapp/api/testApply.ftl @@ -287,8 +287,8 @@
- 鍓嶅彴鎬绘満锛�021-62393138
- 瀹㈡湇鐑嚎锛�4001883787
+ 瀹㈡湇鐑嚎锛�021-62393138
+<#-- 瀹㈡湇鐑嚎锛�4001883787
--> 涓婃捣鎵炬埧瀛�锛�浼版埧浠�锛岀櫨搴� 鎴夸环缃�
鐢靛瓙閭锛歡ujia@fangjia.com
diff --git a/projects/fangjia-coresite/src/main/webapp/api/yapinfengkong.ftl b/projects/fangjia-coresite/src/main/webapp/api/yapinfengkong.ftl index 869d4eab2..be0b19256 100644 --- a/projects/fangjia-coresite/src/main/webapp/api/yapinfengkong.ftl +++ b/projects/fangjia-coresite/src/main/webapp/api/yapinfengkong.ftl @@ -86,7 +86,7 @@ diff --git a/projects/fangjia-coresite/src/main/webapp/app/index.ftl b/projects/fangjia-coresite/src/main/webapp/app/index.ftl index bd01a269a..e22f3a1b6 100644 --- a/projects/fangjia-coresite/src/main/webapp/app/index.ftl +++ b/projects/fangjia-coresite/src/main/webapp/app/index.ftl @@ -258,7 +258,7 @@
-

400-188-3787

+

021-62393138

鍛ㄤ竴鑷冲懆浜� 09:00-18:00
diff --git a/projects/fangjia-coresite/src/main/webapp/beans/done.ftl b/projects/fangjia-coresite/src/main/webapp/beans/done.ftl index ea6dc9d6c..6ffa1ebe3 100644 --- a/projects/fangjia-coresite/src/main/webapp/beans/done.ftl +++ b/projects/fangjia-coresite/src/main/webapp/beans/done.ftl @@ -40,7 +40,7 @@ 1.

璇风珛鍗崇櫥闄嗕細鍛樹腑蹇冩垨娉ㄥ唽鏂颁細鍛橈紝鍚﹀垯灏嗘棤娉曞緱鍒版埧璞嗗強鐩稿簲濂栧姳


2.鎰熻阿鎮ㄧ殑鍙備笌锛岃鑰愬績绛夊緟浜哄伐瀹℃牳
3.鍦ㄦ埧浠风綉浼氬憳涓績鐨勨�滅敤鎴蜂腑蹇冣�濆彲鏌ョ湅浠诲姟瀹℃牳杩涘害銆佹埧璞嗘暟閲�
- 4.濡傛湁鐤戦棶锛屾杩庢嫧鎵撳鏈嶇儹绾�4001883787 + 4.濡傛湁鐤戦棶锛屾杩庢嫧鎵撳鏈嶇儹绾�021-62393138 diff --git a/projects/fangjia-coresite/src/main/webapp/company/about.ftl b/projects/fangjia-coresite/src/main/webapp/company/about.ftl index 6867ffbf8..a7864e3d6 100644 --- a/projects/fangjia-coresite/src/main/webapp/company/about.ftl +++ b/projects/fangjia-coresite/src/main/webapp/company/about.ftl @@ -140,7 +140,7 @@
鎻愪緵浜у搧鍜ㄨ涓庢湇鍔�
-
+
(鍛ㄤ竴鑷冲懆浜� 09:00-18:00)
@@ -159,7 +159,7 @@
鎻愪緵浜у搧鍜ㄨ涓庢湇鍔�
-
+
(鍛ㄤ竴鑷冲懆浜� 09:00-18:00)
@@ -175,7 +175,7 @@
-
鍦板潃:涓婃捣甯傞潤瀹夊尯姹熷畞璺�212鍙峰嚡杩厠澶у帵1709瀹�
+
鍦板潃:涓婃捣甯傞暱瀹佸尯閲戦挓璺�658寮�10鍙�201-202瀹�
閭:gujia@fangjia.com
閭紪:200003
diff --git a/projects/fangjia-coresite/src/main/webapp/daikuan/fail.ftl b/projects/fangjia-coresite/src/main/webapp/daikuan/fail.ftl index 7e1a6b37c..77f77763e 100644 --- a/projects/fangjia-coresite/src/main/webapp/daikuan/fail.ftl +++ b/projects/fangjia-coresite/src/main/webapp/daikuan/fail.ftl @@ -37,7 +37,7 @@ 鎵�  鏈猴細
-
鎴栫洿鎺ユ嫧鎵撳鏈嶇儹绾匡細4001883787
+
鎴栫洿鎺ユ嫧鎵撳鏈嶇儹绾匡細021-62393138
锛堟湇鍔℃椂闂达細鍛ㄤ竴鑷冲懆浜�9:00-18:00锛�
diff --git a/projects/fangjia-coresite/src/main/webapp/daikuan/show.ftl b/projects/fangjia-coresite/src/main/webapp/daikuan/show.ftl index 93a1fd772..043ef5745 100644 --- a/projects/fangjia-coresite/src/main/webapp/daikuan/show.ftl +++ b/projects/fangjia-coresite/src/main/webapp/daikuan/show.ftl @@ -125,7 +125,7 @@ 鎻� 浜�
- 鐢宠鎻愪氦鍚庤鏈烘瀯瀹㈡埛缁忕悊浼氬湪24灏忔椂鍐呬富鍔ㄨ仈绯绘偍锛岃鑰愬績绛夊緟銆�
濡傛湁鐤戦棶璇锋嫧鎵撳鏈嶇儹绾匡細4001883787 + 鐢宠鎻愪氦鍚庤鏈烘瀯瀹㈡埛缁忕悊浼氬湪24灏忔椂鍐呬富鍔ㄨ仈绯绘偍锛岃鑰愬績绛夊緟銆�
濡傛湁鐤戦棶璇锋嫧鎵撳鏈嶇儹绾匡細021-62393138
@@ -195,7 +195,7 @@ $(document).ready(function(){ function(data){ data = eval("(" + data + ")"); if(data.msg == 'OK') { - showAlert("鎰熻阿鎮ㄧ殑鐢宠锛岃鏈烘瀯瀹㈡埛缁忕悊浼氬敖蹇仈绯绘偍锛岃阿璋紒
瀹㈡湇鐑嚎锛�4001883787"); + showAlert("鎰熻阿鎮ㄧ殑鐢宠锛岃鏈烘瀯瀹㈡埛缁忕悊浼氬敖蹇仈绯绘偍锛岃阿璋紒
瀹㈡湇鐑嚎锛�021-62393138"); $("#_sqForm").hide(); }else{ showAlert(data.msg); diff --git a/projects/fangjia-coresite/src/main/webapp/diaoyudao/index.ftl b/projects/fangjia-coresite/src/main/webapp/diaoyudao/index.ftl index 44575521d..03009c752 100644 --- a/projects/fangjia-coresite/src/main/webapp/diaoyudao/index.ftl +++ b/projects/fangjia-coresite/src/main/webapp/diaoyudao/index.ftl @@ -85,7 +85,7 @@

diff --git a/projects/fangjia-coresite/src/main/webapp/evaluation/checkUser.ftl b/projects/fangjia-coresite/src/main/webapp/evaluation/checkUser.ftl index e9786ba7d..d47ee671f 100644 --- a/projects/fangjia-coresite/src/main/webapp/evaluation/checkUser.ftl +++ b/projects/fangjia-coresite/src/main/webapp/evaluation/checkUser.ftl @@ -65,7 +65,7 @@ 鐧诲綍
鎴�
-

濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
瀹㈡湇鐑嚎锛�4001883787

+

濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
瀹㈡湇鐑嚎锛�021-62393138

diff --git a/projects/fangjia-coresite/src/main/webapp/evaluation/loan_apply.ftl b/projects/fangjia-coresite/src/main/webapp/evaluation/loan_apply.ftl index 481c69d3c..1e7db029d 100644 --- a/projects/fangjia-coresite/src/main/webapp/evaluation/loan_apply.ftl +++ b/projects/fangjia-coresite/src/main/webapp/evaluation/loan_apply.ftl @@ -60,7 +60,7 @@

鎮ㄧ殑鐢宠宸叉彁浜�

绋嶅悗浼氭湁宸ヤ綔浜哄憳鍜屾偍鑱旂郴锛岃鑰愬績绛夊緟锛�

- + 纭 diff --git a/projects/fangjia-coresite/src/main/webapp/evaluation/reportNew.ftl b/projects/fangjia-coresite/src/main/webapp/evaluation/reportNew.ftl index 34a2e10c4..b8bb39ffd 100644 --- a/projects/fangjia-coresite/src/main/webapp/evaluation/reportNew.ftl +++ b/projects/fangjia-coresite/src/main/webapp/evaluation/reportNew.ftl @@ -280,7 +280,7 @@
-

濡傛湁鍟嗗姟鍚堜綔闇�姹傦紝璇峰~鍐欐偍鐨勪俊鎭紝鎴戜滑鐨勫鏈嶄汉鍛樹細灏藉揩涓庢偍鍙栧緱鑱旂郴銆傛偍涔熷彲浠ユ嫧鎵�400-188-3787锛堝懆涓�鑷冲懆浜�9:00-18:00锛変笌鎴戜滑鑱旂郴銆�

+

濡傛湁鍟嗗姟鍚堜綔闇�姹傦紝璇峰~鍐欐偍鐨勪俊鎭紝鎴戜滑鐨勫鏈嶄汉鍛樹細灏藉揩涓庢偍鍙栧緱鑱旂郴銆傛偍涔熷彲浠ユ嫧鎵�021-62393138锛堝懆涓�鑷冲懆浜�9:00-18:00锛変笌鎴戜滑鑱旂郴銆�

diff --git a/projects/fangjia-coresite/src/main/webapp/footer/footer.ftl b/projects/fangjia-coresite/src/main/webapp/footer/footer.ftl index bae05243e..6a06ea6cb 100644 --- a/projects/fangjia-coresite/src/main/webapp/footer/footer.ftl +++ b/projects/fangjia-coresite/src/main/webapp/footer/footer.ftl @@ -70,7 +70,7 @@

- 鍓嶅彴鎬绘満锛�021-62393138
- 瀹㈡湇鐑嚎锛�4001883787
+ 瀹㈡湇鐑嚎锛�021-62393138
+<#-- 瀹㈡湇鐑嚎锛�4001883787
--> 涓婃捣鎵炬埧瀛�锛�浼版埧浠�锛岀櫨搴� 鎴夸环缃�
鐢靛瓙閭锛歡ujia@fangjia.com
diff --git a/projects/fangjia-coresite/src/main/webapp/footer/simpleFooterNew.ftl b/projects/fangjia-coresite/src/main/webapp/footer/simpleFooterNew.ftl index 9d2ffbb46..48856c9f9 100644 --- a/projects/fangjia-coresite/src/main/webapp/footer/simpleFooterNew.ftl +++ b/projects/fangjia-coresite/src/main/webapp/footer/simpleFooterNew.ftl @@ -18,8 +18,8 @@
- 鍓嶅彴鎬绘満锛�021-62393138
- 瀹㈡湇鐑嚎锛�4001883787
+<#-- 鍓嶅彴鎬绘満锛�021-62393138
--> + 瀹㈡湇鐑嚎锛�021-62393138
涓婃捣鎵炬埧瀛�锛�浼版埧浠�锛岀櫨搴� 鎴夸环缃�
鐢靛瓙閭锛歡ujia@fangjia.com
diff --git a/projects/fangjia-coresite/src/main/webapp/gjs/index.ftl b/projects/fangjia-coresite/src/main/webapp/gjs/index.ftl index 6d99e4205..fd6e10bdb 100644 --- a/projects/fangjia-coresite/src/main/webapp/gjs/index.ftl +++ b/projects/fangjia-coresite/src/main/webapp/gjs/index.ftl @@ -193,7 +193,7 @@
璇锋偍濉叆鍑嗙‘淇℃伅锛屼互渚夸及浠峰笀鑳藉強鏃惰仈缁滃埌鎮ㄣ��
鐐瑰嚮鍙戦�佸悗锛屼及浠峰笀灏嗗湪24灏忔椂鍐呬富鍔ㄨ仈缁滄偍锛岃鑰愬績绛夊緟锛岃阿璋紒

- 瀹㈡湇鐑嚎锛�4001883787 锛堝伐浣滄棩9:00-18:00锛� + 瀹㈡湇鐑嚎锛�021-62393138 锛堝伐浣滄棩9:00-18:00锛�
diff --git a/projects/fangjia-coresite/src/main/webapp/header/header.ftl b/projects/fangjia-coresite/src/main/webapp/header/header.ftl index ad4d77af2..90fa84a7e 100644 --- a/projects/fangjia-coresite/src/main/webapp/header/header.ftl +++ b/projects/fangjia-coresite/src/main/webapp/header/header.ftl @@ -51,7 +51,7 @@
  • class="current">鍏充簬鎴戜滑
  • @@ -70,7 +70,7 @@
    -

    400-188-3787

    +

    021-62393138

    鍛ㄤ竴鑷冲懆浜� 09:00-18:00
    diff --git a/projects/fangjia-coresite/src/main/webapp/header/v2/_footer.ftl b/projects/fangjia-coresite/src/main/webapp/header/v2/_footer.ftl index 4c231568a..6fc5ee05e 100644 --- a/projects/fangjia-coresite/src/main/webapp/header/v2/_footer.ftl +++ b/projects/fangjia-coresite/src/main/webapp/header/v2/_footer.ftl @@ -198,7 +198,7 @@

    -

    瀹㈡湇鐑嚎锛�4001883787 鐢靛瓙閭锛歡ujia@fangjia.com
    +

    瀹㈡湇鐑嚎锛�021-62393138 鐢靛瓙閭锛歡ujia@fangjia.com
    ©2006-${now?string("yyyy")} 鎴夸环缃� 鐗堟潈鎵�鏈� 娌狪CP澶�10203734鍙�-1
    "><#if (!serverAreaMap?exists && actionName == 'index')>${cityName}鎵炬埧瀛�锛�">浼版埧浠�锛岀櫨搴� 鎴夸环缃�

    diff --git a/projects/fangjia-coresite/src/main/webapp/header/v5/_footer.ftl b/projects/fangjia-coresite/src/main/webapp/header/v5/_footer.ftl index fcda2fdf4..17bcb0e81 100644 --- a/projects/fangjia-coresite/src/main/webapp/header/v5/_footer.ftl +++ b/projects/fangjia-coresite/src/main/webapp/header/v5/_footer.ftl @@ -46,7 +46,7 @@
    -

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 400-188-3787 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    +

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 021-62393138 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    绔嬪嵆鍜ㄨ
    -

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 400-188-3787 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    +

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 021-62393138 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    绔嬪嵆鍜ㄨ
    diff --git a/projects/fangjia-coresite/src/main/webapp/solution/outlets.ftl b/projects/fangjia-coresite/src/main/webapp/solution/outlets.ftl index d5e59dcaa..23dbd1acb 100644 --- a/projects/fangjia-coresite/src/main/webapp/solution/outlets.ftl +++ b/projects/fangjia-coresite/src/main/webapp/solution/outlets.ftl @@ -77,7 +77,7 @@
    -

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 400-188-3787 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    +

    濡傛兂浜嗚В璇︽儏锛岃鑷寸數 021-62393138 鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    绔嬪嵆鍜ㄨ
    diff --git a/projects/fangjia-coresite/src/main/webapp/solution/paimai.ftl b/projects/fangjia-coresite/src/main/webapp/solution/paimai.ftl index 261a6ab84..27abd0d6c 100644 --- a/projects/fangjia-coresite/src/main/webapp/solution/paimai.ftl +++ b/projects/fangjia-coresite/src/main/webapp/solution/paimai.ftl @@ -157,12 +157,12 @@

    -

    濡傛兂鑾峰彇鎮ㄦ墍鍏虫敞鍩庡競鐨勬硶鎷嶆埧甯傚満鍒嗘瀽鎶ュ憡锛屾垨鑰呮煡璇换涓�妤肩洏鐨勬硶鎷嶆垚浜ゆ姌鎵g巼锛岃鑷寸數  400-188-3787  鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    +

    濡傛兂鑾峰彇鎮ㄦ墍鍏虫敞鍩庡競鐨勬硶鎷嶆埧甯傚満鍒嗘瀽鎶ュ憡锛屾垨鑰呮煡璇换涓�妤肩洏鐨勬硶鎷嶆垚浜ゆ姌鎵g巼锛岃鑷寸數  021-62393138  鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    绔嬪嵆浣撻獙

    -

    濡傛兂鑾峰彇鎮ㄦ墍鍏虫敞鍩庡競鐨勬硶鎷嶆埧甯傚満鍒嗘瀽鎶ュ憡锛屾垨鑰呮煡璇换涓�妤肩洏鐨勬硶鎷嶆垚浜ゆ姌鎵g巼锛岃鑷寸數鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    +

    濡傛兂鑾峰彇鎮ㄦ墍鍏虫敞鍩庡競鐨勬硶鎷嶆埧甯傚満鍒嗘瀽鎶ュ憡锛屾垨鑰呮煡璇换涓�妤肩洏鐨勬硶鎷嶆垚浜ゆ姌鎵g巼锛岃鑷寸數鑱旂郴鎴戜滑锛屾垨鑰呯暀涓嬫偍鐨勮仈绯绘柟寮忓拰闇�姹傦紝鎴戜滑浼氱涓�鏃堕棿鑱旂郴鎮ㄣ��

    绔嬪嵆浣撻獙
    diff --git a/projects/fangjia-coresite/src/main/webapp/user/login.ftl b/projects/fangjia-coresite/src/main/webapp/user/login.ftl index 254c8002f..76bf98520 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/login.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/login.ftl @@ -152,7 +152,7 @@
    鎴�
    -

    濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�4001883787

    +

    濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�021-62393138

    diff --git a/projects/fangjia-coresite/src/main/webapp/user/login_check.ftl b/projects/fangjia-coresite/src/main/webapp/user/login_check.ftl index 55d4778a1..1d9156034 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/login_check.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/login_check.ftl @@ -66,7 +66,7 @@ 鐧诲綍
    鎴�
    -

    濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�4001883787

    +

    濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�021-62393138

    diff --git a/projects/fangjia-coresite/src/main/webapp/user/password.ftl b/projects/fangjia-coresite/src/main/webapp/user/password.ftl index 0ca8a83b7..5dcd0d9ac 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/password.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/password.ftl @@ -127,7 +127,7 @@
    鎴�
    -

    濡傛灉鎮ㄤ负闈炴墜鏈烘敞鍐岀敤鎴枫�佹捣澶栫敤鎴锋垨褰撳墠鎵嬫満涓嶇敤/涓㈠け锛�
    璇疯嚧鐢靛鏈嶏細4001883787

    +

    濡傛灉鎮ㄤ负闈炴墜鏈烘敞鍐岀敤鎴枫�佹捣澶栫敤鎴锋垨褰撳墠鎵嬫満涓嶇敤/涓㈠け锛�
    璇疯嚧鐢靛鏈嶏細021-62393138

    diff --git a/projects/fangjia-coresite/src/main/webapp/user/regSuccess.ftl b/projects/fangjia-coresite/src/main/webapp/user/regSuccess.ftl index cd9b74e06..4088fff7e 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/regSuccess.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/regSuccess.ftl @@ -51,7 +51,7 @@

    鎰熻阿鎮ㄧ殑娉ㄥ唽

    -

    鑻ユ偍鏈変换浣曢棶棰橈紝娆㈣繋鎷ㄦ墦瀹㈡湇鐢佃瘽锛�400-188-3787

    +

    鑻ユ偍鏈変换浣曢棶棰橈紝娆㈣繋鎷ㄦ墦瀹㈡湇鐢佃瘽锛�021-62393138

    diff --git a/projects/fangjia-coresite/src/main/webapp/user/register.ftl b/projects/fangjia-coresite/src/main/webapp/user/register.ftl index 6fce0e272..e1f33dfa5 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/register.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/register.ftl @@ -146,7 +146,7 @@
    鎴�
    -

    鑻ユ湁浠讳綍闂锛岃鑷寸數瀹㈡湇锛�400-188-3787

    +

    鑻ユ湁浠讳綍闂锛岃鑷寸數瀹㈡湇锛�021-62393138

    diff --git a/projects/fangjia-coresite/src/main/webapp/user/reqUserLoginPage.ftl b/projects/fangjia-coresite/src/main/webapp/user/reqUserLoginPage.ftl index b44337846..f42cd6398 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/reqUserLoginPage.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/reqUserLoginPage.ftl @@ -121,7 +121,7 @@ 鎵嬫満缁戝畾鎴愬姛鍚庯紝鎮ㄥ彲閫氳繃鎵嬫満鍙风爜涓庡師璐﹀彿瀵嗙爜鐧诲綍 - 娴峰鐢ㄦ埛璇疯嚧鐢靛鏈嶏細4001883787 + 娴峰鐢ㄦ埛璇疯嚧鐢靛鏈嶏細021-62393138 @@ -157,7 +157,7 @@ 杩斿洖 鏂扮敤鎴锋敞鍐� - 濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�4001883787
    + 濡傛灉鎮ㄤ笉鏄�氳繃鎵嬫満娉ㄥ唽鐨勭敤鎴凤紝璇风洿鎺ヨ嚧鐢靛鏈嶆壘鍥炲瘑鐮�
    瀹㈡湇鐑嚎锛�021-62393138
    @@ -103,8 +103,8 @@
    - 鍓嶅彴鎬绘満锛�021-62393138
    - 瀹㈡湇鐑嚎锛�4001883787
    +<#-- 鍓嶅彴鎬绘満锛�021-62393138
    --> + 瀹㈡湇鐑嚎锛�021-62393138
    涓婃捣鎵炬埧瀛�锛�浼版埧浠�锛岀櫨搴� 鎴夸环缃�
    鐢靛瓙閭锛歡ujia@fangjia.com
    diff --git a/projects/fangjia-coresite/src/main/webapp/user/reqUserResetPassPage.ftl b/projects/fangjia-coresite/src/main/webapp/user/reqUserResetPassPage.ftl index 1f6145775..adc215c12 100644 --- a/projects/fangjia-coresite/src/main/webapp/user/reqUserResetPassPage.ftl +++ b/projects/fangjia-coresite/src/main/webapp/user/reqUserResetPassPage.ftl @@ -52,7 +52,7 @@ 鎯宠捣瀵嗙爜璇风洿鎺�鐧诲綍 - 濡傛灉鎮ㄤ负闈炴墜鏈烘敞鍐岀敤鎴枫�佹捣澶栫敤鎴锋垨褰撳墠鎵嬫満涓嶇敤/涓㈠け锛岃鑷寸數瀹㈡湇锛�4001883787 + 濡傛灉鎮ㄤ负闈炴墜鏈烘敞鍐岀敤鎴枫�佹捣澶栫敤鎴锋垨褰撳墠鎵嬫満涓嶇敤/涓㈠け锛岃鑷寸數瀹㈡湇锛�021-62393138 @@ -73,7 +73,7 @@
    鍓嶅彴鎬绘満锛�021-62393138
    - 瀹㈡湇鐑嚎锛�4001883787
    +<#-- 瀹㈡湇鐑嚎锛�4001883787
    --> 涓婃捣鎵炬埧瀛�锛�浼版埧浠�锛岀櫨搴� 鎴夸环缃�
    鐢靛瓙閭锛歡ujia@fangjia.com
    diff --git a/projects/fangjia-coresite/src/main/webapp/xingshang/regist.ftl b/projects/fangjia-coresite/src/main/webapp/xingshang/regist.ftl index a2c4ee406..74890b771 100644 --- a/projects/fangjia-coresite/src/main/webapp/xingshang/regist.ftl +++ b/projects/fangjia-coresite/src/main/webapp/xingshang/regist.ftl @@ -123,7 +123,7 @@ 鐑棬鍝佺墝

    diff --git a/projects/fangjia-static/src/main/webapp/jsp/fangshidai/_footer.jsp b/projects/fangjia-static/src/main/webapp/jsp/fangshidai/_footer.jsp index d9a2ed8c4..05f7696fe 100644 --- a/projects/fangjia-static/src/main/webapp/jsp/fangshidai/_footer.jsp +++ b/projects/fangjia-static/src/main/webapp/jsp/fangshidai/_footer.jsp @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/projects/fangjia-static/src/main/webapp/jsp/loan/house-loan-index.jsp b/projects/fangjia-static/src/main/webapp/jsp/loan/house-loan-index.jsp index 734bc33c2..14c2ad9aa 100644 --- a/projects/fangjia-static/src/main/webapp/jsp/loan/house-loan-index.jsp +++ b/projects/fangjia-static/src/main/webapp/jsp/loan/house-loan-index.jsp @@ -39,7 +39,7 @@ 鏇挎偍閲忚韩鎼滅储鍚堥�傜殑閾惰浜у搧
    鐩存帴鐢佃瘽鑱旂郴閾惰涓氬姟浜哄憳
    璁╂偍璐锋涓嶅啀璐瑰姴
    - 鎴夸环缃戝鏈嶏細4001883787

    + 鎴夸环缃戝鏈嶏細021-62393138

    From a1154e786f5711f0612e1da7c5b41cccb71656fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Thu, 18 Dec 2025 16:08:57 +0800 Subject: [PATCH 43/67] =?UTF-8?q?=E5=B9=B3=E7=B1=B3=E7=A7=9F=E9=87=91?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E5=A4=A9=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/PropertyController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index 18270c8ab..fe69f2c56 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -2617,7 +2617,7 @@ public class PropertyController { item.put("city", sqmetreRent.getCity()); item.put("district", sqmetreRent.getRegion()); item.put("name", sqmetreRent.getDistrictName()); - item.put("rent", sqmetreRent.getAvgPrice().intValue()); + item.put("rent", DataUtil.roundDouble(sqmetreRent.getAvgPrice().doubleValue()/30.0, 2)); item.put("date", DateUtil.formatByPattern(sqmetreRent.getWeekend(), "yyyy-MM")); result.add(item); } From 34b90844c51d522cc7c5b439d801fbb3e125ef1e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 19 Dec 2025 10:09:35 +0800 Subject: [PATCH 44/67] =?UTF-8?q?=E5=91=A8=E8=BE=B9=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E4=BF=AE=E6=94=B9=E5=8F=8A=E5=B9=B3=E7=B1=B3?= =?UTF-8?q?=E7=A7=9F=E9=87=91=E6=8E=A5=E5=8F=A3=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/HouseController.java | 42 +++++++++++-------- .../controllers/SqmetreRentController.java | 6 ++- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java index dc37725aa..516d54bd4 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java @@ -975,6 +975,21 @@ public class HouseController { mav.setModel(BasicModel.buildBadRequestModel("非中国经纬度")); return mav; } + + List houses = new ArrayList(); + List houseSelf = new ArrayList(); + List houseAround = new ArrayList(); + List houseList = new ArrayList(); +// if (cat.contains("_")) { + // 商铺,写字楼有经纬度,直接查 + SeawaterQuery query = new SeawaterQuery(); + // 先用名字查自身的样本 + query.setCityDisplay(city); + query.setRegion(region); + query.setDistrictName(districtName); + query.setStartDate(model.getStartTime()); + query.setEndDate(model.getEndTime()); + String category = "district"; if ("1".equals(model.getPropertyType())) { category = "office"; @@ -991,6 +1006,11 @@ public class HouseController { } else { cat = "rent"; } + if (model.getPrice() != null) { + query.setStartPrice((int) (model.getPrice() * 0.9 * 30)); + query.setEndPrice((int) (model.getPrice() * 1.1 * 30)); + } + } else { if ("1".equals(model.getPropertyType())) { cat = "office_sell"; @@ -998,21 +1018,13 @@ public class HouseController { if ("2".equals(model.getPropertyType())) { cat = "shop_sell"; } + if (model.getPrice() != null) { + query.setStartPrice((int) (model.getPrice() * 0.9)); + query.setEndPrice((int) (model.getPrice() * 1.1)); + } + } - List houses = new ArrayList(); - List houseSelf = new ArrayList(); - List houseAround = new ArrayList(); - List houseList = new ArrayList(); -// if (cat.contains("_")) { - // 商铺,写字楼有经纬度,直接查 - SeawaterQuery query = new SeawaterQuery(); - // 先用名字查自身的样本 - query.setCityDisplay(city); - query.setRegion(region); - query.setDistrictName(districtName); query.setCat(cat); - query.setStartDate(model.getStartTime()); - query.setEndDate(model.getEndTime()); if (model.getSize() != null && model.getSize() != 0) { query.setStartArea(model.getSize() * 0.9); @@ -1025,10 +1037,6 @@ public class HouseController { } else { pager.setPageSize(5); } - if (model.getPrice() != null) { - query.setStartPrice((int) (model.getPrice() * 0.9)); - query.setEndPrice((int) (model.getPrice() * 1.1)); - } query.setPager(pager); query.setSortField("p_date"); query.setOrder(false); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java index d00eb39d5..17c168e00 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/SqmetreRentController.java @@ -1,6 +1,7 @@ package com.fangjia.open.controllers; import com.fangjia.core.RegionData; +import com.fangjia.core.util.DataUtil; import com.fangjia.core.util.DateUtil; import com.fangjia.dal.mongo.model.SqmetreRent; import com.fangjia.dal.seaweed.model.District; @@ -232,7 +233,8 @@ public class SqmetreRentController { item.put("district", sqmetreRent.getRegion()); item.put("name", sqmetreRent.getDistrictName()); Integer currentRent = (sqmetreRent.getAvgPrice() != null) ? sqmetreRent.getAvgPrice().intValue() : 0; - item.put("rent", currentRent); + Double dayRentPrice = currentRent/30.0; + item.put("rent", DataUtil.getRound(2, dayRentPrice)); item.put("date", sqmetreRent.getWeekend() != null ? DateUtil.formatByPattern(sqmetreRent.getWeekend(), "yyyy-MM") : "未知日期"); // 计算月涨幅 @@ -249,7 +251,7 @@ public class SqmetreRentController { } // 设置返回结果,防止 subList 越界 - if (result.size() > 1) { + if (result.size() > 0) { mav.setModel(BasicModel.buildOKModel().setResult(result.subList(1, result.size()))); } else { mav.setModel(BasicModel.buildOKModel().setResult(null)); From 9eb7f0710ab4b0565a69dd1c17c6b3a714cceccd Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 19 Dec 2025 14:47:05 +0800 Subject: [PATCH 45/67] =?UTF-8?q?=E5=91=A8=E8=BE=B9=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=8D=95=E4=BD=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/dal/seawater/model/Seawater.java | 6 +++--- .../open/controllers/HouseController.java | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/seawater/model/Seawater.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/seawater/model/Seawater.java index db70eae13..3bb471310 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/seawater/model/Seawater.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/seawater/model/Seawater.java @@ -66,7 +66,7 @@ public class Seawater implements SeawaterEntity { private String url; private String root; private Integer avgPrice; - private Integer unitPrice; + private Number unitPrice; private String purpose; private String estateType; private String buildType; @@ -458,11 +458,11 @@ public class Seawater implements SeawaterEntity { this.maxFloor = maxFloor; } - public Integer getUnitPrice() { + public Number getUnitPrice() { return unitPrice; } - public void setUnitPrice(Integer unitPrice) { + public void setUnitPrice(Number unitPrice) { this.unitPrice = unitPrice; } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java index 516d54bd4..bb3602076 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java @@ -57,6 +57,7 @@ import com.fangjia.service.sql.ApiUserService; import com.fangjia.service.sql.UserService; import com.fangjia.service.web.MenuService; import net.sf.json.JSONObject; +import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.bson.types.ObjectId; import org.sothis.core.util.Closure; @@ -980,6 +981,7 @@ public class HouseController { List houseSelf = new ArrayList(); List houseAround = new ArrayList(); List houseList = new ArrayList(); + String[] categories = {"rent", "shop_rent", "office_rent"}; // if (cat.contains("_")) { // 商铺,写字楼有经纬度,直接查 SeawaterQuery query = new SeawaterQuery(); @@ -1043,6 +1045,9 @@ public class HouseController { query.setTable("latest_seawater"); if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(districtName)) { houseSelf = seawaterDao.findSeawatersByQuery(query); + for(Seawater house : houseSelf){ + house.setDistance(0); + } houses.addAll(houseSelf); } // 如果自身样本数不够,再查周边 @@ -1088,7 +1093,15 @@ public class HouseController { } } seawater.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea()); - seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice()); + if(ArrayUtils.contains(categories, cat)){ + if(house.getAvgPrice() != null){ + double dayRentPrice = (double)(house.getAvgPrice()/30.0); + seawater.setUnitPrice(DataUtil.getDoubleRound(2,dayRentPrice)); + } + }else{ + seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice()); + } + seawater.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice()); seawater.setDirection(house.getDirection()); seawater.setFloor(house.getFloor() == null || house.getFloor() == 0 ? null : house.getFloor()); @@ -1096,7 +1109,7 @@ public class HouseController { // seawater.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom()); // seawater.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall()); // seawater.setToilet(house.getToilet() == null || house.getToilet() == 0 ? null : house.getToilet()); - seawater.setDayUnitPrice(house.getDayUnitPrice() == null || house.getDayUnitPrice() == 0 ? null : house.getDayUnitPrice()); +// seawater.setDayUnitPrice(house.getDayUnitPrice() == null || house.getDayUnitPrice() == 0 ? null : house.getDayUnitPrice()); seawater.setRentType(house.getRentType()); seawater.setPayType(house.getPayType()); seawater.setBusinessStatus(house.getBusinessStatus()); From c4f6cf660868fcc3fbd846f72cd873673c418ca6 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 19 Dec 2025 17:44:53 +0800 Subject: [PATCH 46/67] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BB=B7=E6=A0=BC=E6=94=B9=E4=B8=BA=E6=9C=88?= =?UTF-8?q?=E5=BA=A6=E5=9D=87=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/PropertyController.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index c4a7831bf..649ffb3d1 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -760,12 +760,14 @@ public class PropertyController { districtInfoDto.setAddress(district.getAddress()); //int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null); // 返回2B价格,小程序用,其他也改为2B - int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null); - if (avgPrice == 0) { - avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7)); - } - if (avgPrice != 0) { - districtInfoDto.setAvgPrice(avgPrice); +// int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null); +// if (avgPrice == 0) { +// avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7)); +// } + + DistrictSellStat sellStat = districtSellStatService.findFirstByParams(district.getCity(), district.getRegion(), district.getName()); + if (sellStat != null) { + districtInfoDto.setAvgPrice(sellStat.getAvgPrice()); } districtInfoDto.setPropertyType(district.getEstateType2()); if (district.getLat2() != null && district.getLat2() != 0 && district.getLng2() != null From 6cf26b835e1ce7cac761efc00e78b15c3cddd587 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 19 Dec 2025 18:03:36 +0800 Subject: [PATCH 47/67] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=9B=B4=E6=94=B9=E7=9A=84=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=88=A0=E9=99=A4=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FjwBigdataForsaleBatch.groovy | 76 ++++++++++++++++--- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy index c9801ad9e..2c0cd6f32 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.gj.fjwPriceBaseData +import cn.emay.mina.util.ConcurrentHashSet import com.fangjia.script.BaseBatch import com.fangjia.script.BatchOwner import com.fangjia.script.Watcher @@ -119,9 +120,14 @@ class FjwBigdataForsaleBatch extends BaseBatch{ def exportSellCSV(index,city, cityCodeDataMap, distCodeMap, districts, startDate, endDate, houseIdsfilter){ def retMap = findAllCommHouse(index,city, cityCodeDataMap, distCodeMap, districts, startDate, endDate, houseIdsfilter) - println city + "(原)房源总量:"+retMap.size() + def cityCode = cityCodeDataMap.get(city) + def delHouseIds = retMap.del_houses + println city + "(删除)房源总量:"+delHouseIds.size() + delHousesToPgSql(cityCode, delHouseIds) - def allDatas = retMap.values() + + def allDatas = retMap.add_houses.values() + println city + "(新增)房源总量:"+allDatas.size() saveToPgSql(allDatas) } @@ -133,6 +139,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ BloomFilter curhousefilter = BloomFilter.create(Funnels.stringFunnel(StandardCharsets.UTF_8), 200000000, 0.000001); def retMap = new ConcurrentHashMap() + def delHouseIds = new ConcurrentHashSet() for(def i=0;i + def sql = "delete from base.bigdata_forsale where urbn_id=? and gujia_sell_id=?" + def stmt = conn.prepareStatement(sql) + + try { + int count = 0 + ids.each { id -> + stmt.setObject(1, cityCode) + stmt.setObject(2, id) + stmt.addBatch() + count++ + + // 每20000条执行一次 + if (count % 20000 == 0) { + stmt.executeBatch() + println "已执行批处理: $count" + } + } + + // 执行剩余的 + if (ids.size() % 20000 != 0) { + stmt.executeBatch() + println "执行最后一批: ${ids.size() % 20000}" + } + + println "总处理记录数: $count" + } finally { + stmt.close() + } + } + + println "end: "+new Date() + } + def saveToPgSql(rows){ for(def r : rows) { From 93075b8e2d0bb288301f9285129d2709c3654d30 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 24 Dec 2025 08:43:23 +0800 Subject: [PATCH 48/67] =?UTF-8?q?=E4=B8=8A=E6=B5=B7=E5=AE=8F=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 6 +- .../ccbevaluation/CcbCommonUtils.groovy | 23 ++ .../script/commData/CommonDatautils.groovy | 24 ++ .../com/fangjia/script/fuzhou/GongShu.groovy | 6 +- .../com/fangjia/script/fuzhou/Test1.groovy | 2 +- .../fangjia/script/gj/AddAvgpriceBatch.groovy | 9 +- .../fangjia/script/gj/abc/SuzouPocTest.groovy | 110 +++++++-- .../gj/district/FangjiaClientUtils.groovy | 18 ++ .../fangjia/script/gj/poc/AddPriceTest.groovy | 6 +- .../jiangnanblank/TestEvaluation.groovy | 231 +++++++++++++++--- .../com/fangjia/script/util/DbUtils.groovy | 2 +- .../com/fangjia/script/util/ExcelUtils.groovy | 2 +- .../fangjia/script/util/OpenApiClient.groovy | 58 +++++ 13 files changed, 429 insertions(+), 68 deletions(-) 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 + } + } From 469ee5f2edf34cd31e56f307cb5c8cbf23b5f679 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 24 Dec 2025 16:20:21 +0800 Subject: [PATCH 49/67] =?UTF-8?q?=E4=BA=AC=E4=B8=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gj/district/DistrictLocationGeo.groovy | 29 ++++++++++++------- .../jiangnanblank/TestEvaluation.groovy | 19 ++++++++++-- .../yinjihaun/amap/GaoDeApiUtils.groovy | 2 +- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy index b25c63f1e..23e7330f1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictLocationGeo.groovy @@ -1,22 +1,19 @@ package com.fangjia.script.gj.district -import com.fangjia.core.util.GeoUtils +import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils import com.mongodb.BasicDBList import com.mongodb.BasicDBObject import com.mongodb.DBCollection - import net.sf.json.JSONNull -import org.bson.types.ObjectId - class DistrictLocationGeo { final DBCollection JD_SEAWEED_COLL = MongoUtils.getCollectionByName("business", "jingdong_community", "192.168.0.206",27020) final DBCollection JD_GEO_COLL = MongoUtils.getCollectionByName("business", "jingdong_geo", "192.168.0.206",27020) - + final DBCollection JD_review_GEO_COLL = MongoUtils.getCollectionByName("business", "jingdong_review_geo", "192.168.0.206",27020) static main(args) { def task = new DistrictLocationGeo() task.run()//通过经纬度,调用高德逆解析,并保存数据 @@ -25,14 +22,23 @@ class DistrictLocationGeo { } def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\京东\\京东新增数据5.6万.xlsx",{ d-> + ExcelUtils.multiThreadingModify("D:\\数据\\京东\\房价网重复小区数据5-1217【机密】(1).xlsx",{ d-> if(d['A']){ - def dbo = JD_SEAWEED_COLL.findOne(new BasicDBObject("_id", new ObjectId(d['A']))) - if(dbo && dbo.longitude){ - def jsonObject = GaoDeApiUtils.geocode(dbo.longitude+","+dbo.latitude) +// def dbo = JD_SEAWEED_COLL.findOne(new BasicDBObject("_id", new ObjectId(d['A']))) + def obj = CommonDatautils.findDistrictById(d['A']) + if(obj && obj.lat){ + def lat = obj.lat/10000000000.0; + def lng = obj.lng/10000000000.0; + def jsonObject = GaoDeApiUtils.geocode(lng+","+lat) if(jsonObject){ d["F"] = "高德" -// def dbo = new BasicDBObject() + def dbo = new BasicDBObject() + dbo.put("city", obj.city) + dbo.put("district", obj.region) + dbo.put("name", obj.name) + dbo.put("comm_id", d['A']) + dbo.put("lng", lng) + dbo.put("lat", lat) dbo.put("formatted_address", jsonObject.regeocode.formatted_address) def addrComp = jsonObject.regeocode.addressComponent dbo.put("addressComponent", addrComp) @@ -42,13 +48,14 @@ class DistrictLocationGeo { dbo.put("aois", jsonObject.regeocode.aois) dbo = cleanGeoData(dbo) dbo = convertToDBObject(dbo) - JD_GEO_COLL.save(dbo) + JD_review_GEO_COLL.save(dbo) } } } }) + } static BasicDBObject convertToDBObject(Map map) { 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 5a92ee89f..c395ff47d 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,9 +5,7 @@ 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 @@ -40,7 +38,9 @@ class TestEvaluation { // task.addOptName() // task.addDistId() - task.addEvaluationToDB() +// task.addEvaluationToDB() + + task.addEvaluationDetail() } def houseSimilar(){ @@ -392,4 +392,17 @@ class TestEvaluation { } + def addEvaluationDetail(){ + def rets = [] + ExcelUtils.modify("D:\\数据\\宏信息\\宏信项目-最终.xlsx", { d -> + if (d['G']) { + def dist = CommonDatautils.findDistrictById(d['G']) + if (dist) { + + } + } + }); + } + + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy index 7a14f7431..f41071b91 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy @@ -11,7 +11,7 @@ import java.util.zip.GZIPInputStream class GaoDeApiUtils { //67423021cae3b58e5c2ac595a389b036 :临时买的key - def static GAO_DE_AK = "67423021cae3b58e5c2ac595a389b036" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 + def static GAO_DE_AK = "d22fcd4274e037fdd1e9357d91152504" //宝剑:c6fcd4bfbc40d73ee762b8115dca3390 //15021384995:dfc2245bac8a7b2d5b62e060e59d4eca /** From 5abf2ddaaaead79e383399b8ef35cfa3b0c725da Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 25 Dec 2025 08:53:00 +0800 Subject: [PATCH 50/67] =?UTF-8?q?=E5=AE=8F=E4=BF=A1=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/core/util/PriceData.java | 82 +++++ .../java/com/fangjia/core/util/PriceDto.java | 49 +++ .../java/com/fangjia/core/util/SvgUtils.java | 316 ++++++++++++++++++ projects/fangjia-script/pom.xml | 6 + .../script/gj/test/JingDongTest.groovy | 62 ++++ .../jiangnanblank/TestEvaluation.groovy | 160 ++++++++- .../fangjia/script/util/OpenApiClient.groovy | 41 +++ 7 files changed, 712 insertions(+), 4 deletions(-) create mode 100644 projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java create mode 100644 projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceDto.java create mode 100644 projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JingDongTest.groovy diff --git a/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java new file mode 100644 index 000000000..7c3d7e4f8 --- /dev/null +++ b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java @@ -0,0 +1,82 @@ +package com.fangjia.core.util; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +@Data +public class PriceData { + private String yearmonth; + private Double price; + private Double volume; // 鏂板鎴愪氦閲忓瓧娈� + + public PriceData() {} + + public PriceData(String yearmonth, Double price) { + this.yearmonth = yearmonth; + this.price = price; + } + + public PriceData(String yearmonth, Double price, Double volume) { + this.yearmonth = yearmonth; + this.price = price; + this.volume = volume; + } + + public static List getSampleData() { + List data = new ArrayList<>(); + double basePrice = 22000; + double minPrice = basePrice * (1 - 0.04); + double maxPrice = basePrice * (1 + 0.04); + Random random = new Random(); + + for (int i = 0; i < 2; i++) { + int year = 2024; + int month = i + 4; + if (month > 12) { + year++; + month -= 12; + } + String date = String.format("%d-%02d", year, month); + double price = minPrice + random.nextDouble() * (maxPrice - minPrice); + double volume = 100 + random.nextInt(100); + data.add(new PriceData(date, price, volume)); + System.out.println(data.get(i)); + } + return data; + } + + public static List getSampleData(double basePrice) { + List data = new ArrayList<>(); + double minPrice = basePrice * (1 - 0.02); + double maxPrice = basePrice * (1 + 0.02); + Random random = new Random(); + + for (int i = 0; i < 12; i++) { + int year = 2025; + int month = i + 1; + if (month > 12) { + year++; + month -= 12; + } + String date = String.format("%d-%02d", year, month); + double price = minPrice + random.nextDouble() * (maxPrice - minPrice); + double volume = 100 + random.nextInt(200); + data.add(new PriceData(date, price, volume)); + System.out.println(data.get(i)); + } + return data; + } + + public static List getSampleData2() { + List data = new ArrayList<>(); + data.add(new PriceData("2025-01", 11110.0, 90.0)); + data.add(new PriceData("2025-02", 11115.0, 110.0)); + data.add(new PriceData("2025-03", 11112.0, 95.0)); + data.add(new PriceData("2025-04", 11120.0, 150.0)); + data.add(new PriceData("2025-05", 11118.0, 140.0)); + return data; + } +} diff --git a/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceDto.java b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceDto.java new file mode 100644 index 000000000..899c1832f --- /dev/null +++ b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceDto.java @@ -0,0 +1,49 @@ +package com.fangjia.core.util; + +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +/** + * @author shenjian + * @since 2024/12/17 + */ +@Data +public class PriceDto { + private Integer id; + + private Integer avgPrice;//鏈懆鍧囦环 + + private PriceTrend priceTrend; //鍧囦环璧板娍 + + private List rentPrices;//鏈湀绉熼噾 + + private PriceTrend rentTrend;//绉熼噾璧板娍 + + @Data + @Builder + public static class RentPrice { + private String name; + private Integer price; + } + + @Data + public static class PriceTrend { + private List categories; + private List series; + private List doubleSeries; + } + + @Data + public static class Series { + private String name; + private List data; + } + + @Data + public static class DoubleSeries { + private String name; + private List data; + } +} diff --git a/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java b/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java new file mode 100644 index 000000000..ce45c16da --- /dev/null +++ b/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java @@ -0,0 +1,316 @@ +package com.fangjia.core.util; + + + +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * SVG宸ュ叿绫伙紝鐢ㄤ簬鐢熸垚浠锋牸瓒嬪娍鐨凷VG鍥捐〃 + */ + +public class SvgUtils { + + // SVG鐢诲竷灏哄 + private static final int WIDTH = 800; + private static final int HEIGHT = 500; + private static final int PADDING = 60; + + // 鐢熸垚SVG鎶樼嚎鍥撅紙鏀寔澶氭潯绾匡級锛屾柊澧瀌ecimalPlaces鍙傛暟鎺у埗Y杞村皬鏁颁綅 + public static String generatePriceTrendSvg(List> dataSets, List labels, String title, String subtitle, int decimalPlaces) { + if (dataSets.isEmpty() || dataSets.get(0).isEmpty()) { + return ""; + } + // 杩囨护涓虹┖鐨勬暟鎹� + dataSets = dataSets.stream() + .map(innerList -> innerList.stream() + .filter(priceData -> priceData != null && priceData.getPrice() != null) + .collect(Collectors.toList())) + .collect(Collectors.toList()); + + // 璁$畻浠锋牸鍜屾椂闂寸殑鑼冨洿 + double minPrice = dataSets.stream() + .flatMap(List::stream) + .filter((p) -> p != null && p.getPrice() != null) + .mapToDouble(PriceData::getPrice) + .min() + .orElse(0) * 0.8; + double maxPrice = dataSets.stream() + .flatMap(List::stream) + .filter((p) -> p != null && p.getPrice() != null) + .mapToDouble(PriceData::getPrice) + .max() + .orElse(1) * 1.2; + double buffer = 0.1; + minPrice = minPrice * (1 - buffer); + maxPrice = maxPrice * (1 + buffer); + + // 濡傛灉decimalPlaces涓�0锛岃皟鏁磎inPrice鍜宮axPrice涓烘暣鏁扮瓑宸� +// if (decimalPlaces == 0) { +// long step = calculateStep((long) Math.ceil(maxPrice) - (long) Math.floor(minPrice)); +// minPrice = Math.floor(minPrice / step) * step; +// maxPrice = Math.ceil(maxPrice / step) * step; +// } + + // 瑙f瀽鏈�灏忓拰鏈�澶ф棩鏈� + String minYearMonth = dataSets.stream() + .flatMap(List::stream) + .map(PriceData::getYearmonth) + .min(String::compareTo) + .orElse("2024-08"); + String maxYearMonth = dataSets.stream() + .flatMap(List::stream) + .map(PriceData::getYearmonth) + .max(String::compareTo) + .orElse("2025-01"); + + // 鏋勫缓SVG鍐呭 + StringBuilder svg = new StringBuilder(); + svg.append(String.format("", WIDTH, HEIGHT)); + svg.append(String.format("", WIDTH, HEIGHT)); + + // 娣诲姞鏍囬鍜屽壇鏍囬 + svg.append(String.format("%s", + WIDTH / 2, 30, title)); + svg.append(String.format("%s", + WIDTH / 2, 50, subtitle)); + + // 鐢昏櫄绾跨綉鏍肩嚎鍜屽潗鏍囪酱 + svg.append(drawGrid(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces)); + svg.append(drawAxis(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces)); + + // 鐢诲鏉℃姌绾垮拰鍥句緥 + String[] colors = {"#66B3FF", "#FF6666", "#FFA500", "#8A2BE2"}; + for (int i = 0; i < dataSets.size(); i++) { + svg.append(drawSmoothLine(dataSets.get(i), minYearMonth, maxYearMonth, minPrice, maxPrice, colors[i % colors.length], decimalPlaces)); + svg.append(String.format("", 650, 60 + i * 20, colors[i % colors.length])); + svg.append(String.format("%s", 670, 70 + i * 20, labels.get(i))); + } + + svg.append(""); + return svg.toString(); + } + + // 缁樺埗骞虫粦鎶樼嚎 + private static String drawSmoothLine(List data, String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, String color, int decimalPlaces) { +// if (data.size() < 2) return ""; + StringBuilder path = new StringBuilder("", x, y, color)); + pointsAndLabels.append(String.format("%." + decimalPlaces + "f", + x + 5, y - 5, color, point.getPrice())); + + path.append("M").append(x).append(",").append(y); + } else if (data.size() > 1) { + for (int i = 0; i < data.size() - 1; i++) { + PriceData point1 = data.get(i); + PriceData point2 = data.get(i + 1); + int monthIndex1 = Math.max(0, Math.min(totalMonths - 1, getMonthIndex(point1.getYearmonth()) - getMonthIndex(minYearMonth))); + int monthIndex2 = Math.max(0, Math.min(totalMonths - 1, getMonthIndex(point2.getYearmonth()) - getMonthIndex(minYearMonth))); + + int x1 = PADDING + (monthIndex1 * (WIDTH - 2 * PADDING) / (totalMonths - 1)); + int y1 = HEIGHT - PADDING - (int) ((point1.getPrice() - minPrice) * (HEIGHT - 2 * PADDING) / (maxPrice - minPrice)); + int x2 = PADDING + (monthIndex2 * (WIDTH - 2 * PADDING) / (totalMonths - 1)); + int y2 = HEIGHT - PADDING - (int) ((point2.getPrice() - minPrice) * (HEIGHT - 2 * PADDING) / (maxPrice - minPrice)); + + int controlX1 = x1 + (x2 - x1) / 3; + int controlY1 = y1; + int controlX2 = x2 - (x2 - x1) / 3; + int controlY2 = y2; + + if (i == 0) path.append(x1).append(",").append(y1); + path.append(" C").append(controlX1).append(",").append(controlY1).append(" ").append(controlX2).append(",").append(controlY2).append(" ").append(x2).append(",").append(y2); + + pointsAndLabels.append(String.format("", x1, y1, color)); + pointsAndLabels.append(String.format("%." + decimalPlaces + "f", + x1 + 5, y1 - 5, color, point1.getPrice())); + } + + PriceData lastPoint = data.get(data.size() - 1); + int lastMonthIndex = Math.max(0, Math.min(totalMonths - 1, getMonthIndex(lastPoint.getYearmonth()) - getMonthIndex(minYearMonth))); + int lastX = PADDING + (lastMonthIndex * (WIDTH - 2 * PADDING) / (totalMonths - 1)); + int lastY = HEIGHT - PADDING - (int) ((lastPoint.getPrice() - minPrice) * (HEIGHT - 2 * PADDING) / (maxPrice - minPrice)); + pointsAndLabels.append(String.format("", lastX, lastY, color)); + pointsAndLabels.append(String.format("%." + decimalPlaces + "f", + lastX + 5, lastY - 5, color, lastPoint.getPrice())); + } + path.append("' fill='none' stroke='").append(color).append("' stroke-width='2'/>"); + path.append(pointsAndLabels); + return path.toString(); + } + + // 缁樺埗缃戞牸绾� + private static String drawGrid(String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, int decimalPlaces) { + StringBuilder grid = new StringBuilder(); + double step = calculateYStep(minPrice, maxPrice, decimalPlaces); + int numSteps = (int) ((maxPrice - minPrice) / step) + 1; + + for (int i = 0; i < numSteps; i++) { + double price = minPrice + i * step; + if (price > maxPrice) break; + int y = HEIGHT - PADDING - (int) ((price - minPrice) * (HEIGHT - 2 * PADDING) / (maxPrice - minPrice)); + grid.append(String.format("", + PADDING, y, WIDTH - PADDING, y)); + } + return grid.toString(); + } + + // 缁樺埗鍧愭爣杞� + private static String drawAxis(String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, int decimalPlaces) { + StringBuilder axis = new StringBuilder(); + + // X杞� + axis.append(String.format("", + PADDING, HEIGHT - PADDING, WIDTH - PADDING, HEIGHT - PADDING)); + axis.append(String.format("", + PADDING, PADDING, PADDING, HEIGHT - PADDING)); + + // X杞村埢搴� + int totalMonths = getMonthIndex(maxYearMonth) - getMonthIndex(minYearMonth) + 1; + for (int i = 0; i < totalMonths; i++) { + int x; + if (totalMonths == 1) { + // 褰撳彧鏈変竴涓湀鏃讹紝灏嗗埢搴︽斁鍦ㄤ腑闂翠綅缃� + x = PADDING + (WIDTH - 2 * PADDING) / 2; + } else { + x = PADDING + i * (WIDTH - 2 * PADDING) / (totalMonths - 1); + } + String monthLabel = getMonthLabel(minYearMonth, i); + axis.append(String.format("", + x, HEIGHT - PADDING + 5, x, HEIGHT - PADDING)); + axis.append(String.format("%s", + x, HEIGHT - PADDING + 20, monthLabel)); + } + + // Y杞村埢搴� + double step = calculateYStep(minPrice, maxPrice, decimalPlaces); + int numSteps = (int) ((maxPrice - minPrice) / step) + 1; + for (int i = 0; i < numSteps; i++) { + double price = minPrice + i * step; + int y = HEIGHT - PADDING - (int) ((price - minPrice) * (HEIGHT - 2 * PADDING) / (maxPrice - minPrice)); + axis.append(String.format("", + PADDING - 5, y, PADDING, y)); + axis.append(String.format("%." + decimalPlaces + "f", + PADDING - 10, y + 5, price)); + } + + return axis.toString(); + } + + // 璁$畻Y杞存闀� + private static double calculateYStep(double minPrice, double maxPrice, int decimalPlaces) { + double range = maxPrice - minPrice; + if (decimalPlaces == 0) { + return calculateStep((long) range); + } + double step = range / 10.0; // 榛樿10涓棿闅� + double scale = Math.pow(10, decimalPlaces); + return Math.round(step * scale) / scale; + } + + // 璁$畻鏁存暟姝ラ暱 + private static long calculateStep(long range) { + long step = (long) Math.pow(10, Math.floor(Math.log10(range))); + if (range / step < 4) step /= 2; + else if (range / step > 8) step *= 2; + return step; + } + + // 鑾峰彇鏈堜唤鏍囩鍜岀储寮曪紙淇濇寔涓嶅彉锛� + private static String getMonthLabel(String minYearMonth, int offset) { + int totalMonths = getMonthIndex(minYearMonth); + int targetMonthIndex = totalMonths + offset; + int year = 2024 + targetMonthIndex / 12; + int month = targetMonthIndex % 12 + 1; + return String.format("%d-%02d", year, month); + } + + private static int getMonthIndex(String yearMonth) { + int year = Integer.parseInt(yearMonth.substring(0, 4)); + int month = Integer.parseInt(yearMonth.substring(5)); + return (year - 2024) * 12 + (month - 1); + } + + + public static void generateSvg(String svgContent, String outputPath) { + try (FileWriter writer = new FileWriter(outputPath)) { + writer.write(svgContent); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 瀵归綈宸叉湁绯诲垪鏁版嵁涓庢柊鐨勬椂闂磋酱 + */ + public static void alignSeriesData(List newCategories, List series, PriceDto.PriceTrend rentTrend) { + for (PriceDto.DoubleSeries s : series) { + List originalData = s.getData(); + List originalCategories = new ArrayList<>(rentTrend.getCategories()); // 鍋囪鍘熷鏃堕棿杞村彲浠庡埆澶勮幏鍙� + List alignedData = new ArrayList<>(); + + // 鏍规嵁鏂扮殑鏃堕棿杞村榻愭暟鎹� + for (String date : newCategories) { + int index = originalCategories.indexOf(date); + if (index >= 0 && index < originalData.size()) { + alignedData.add(originalData.get(index)); + } else { + alignedData.add(null); // 鏃ユ湡涓嶅瓨鍦ㄦ椂琛� null + } + } + s.setData(alignedData); + } + } + + // 娴嬭瘯鏂规硶 + public static void main(String[] args) { + List data1 = PriceData.getSampleData(5200); + List> dataSets = new ArrayList<>(); + dataSets.add(data1); + String name = "鏂颁笘绾ぇ鍘�"; + List labels = Arrays.asList(name); + + String title = "浠锋牸璧板娍鍥�"; + String subtitle = "2024-12 鑷� 2025-11"; + +// // 娴嬭瘯灏忔暟浣嶄负2 +// String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 2); +// System.out.println("With 2 decimal places:"); +// System.out.println(svgWithoutDecimals); + + // 娴嬭瘯灏忔暟浣嶄负0锛堟暣鏁扮瓑宸級 + String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 0); + System.out.println("With 0 decimal places (integer steps):"); + System.out.println(svgWithoutDecimals); + + try { + generateSvg(svgWithoutDecimals, name + ".svg"); + System.out.println("PNG image generated successfully at: price_trend.png"); + } catch (Exception e) { + e.printStackTrace(); + } + +// String locationStr = "114.407048,30.481859"; +// String[] location = locationStr.split(","); +// Double lng = Double.parseDouble(location[0]); +// Double lat = Double.parseDouble(location[1]); +// String mapUrl = "https://restapi.amap.com/v3/staticmap?location=" + lng + "," + lat +// + "&zoom=14&size=780*300&markers=mid,,A:" + lng + "," + lat +// + "&key=ee95e52bf08006f63fd29bcfbcf21df0"; +// System.out.println(mapUrl); + } +} \ No newline at end of file diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 698a360f2..17e32cbde 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -602,5 +602,11 @@ mysql-connector-java 8.0.33 + + + + + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JingDongTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JingDongTest.groovy new file mode 100644 index 000000000..8acc1ff69 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JingDongTest.groovy @@ -0,0 +1,62 @@ +package com.fangjia.script.gj.test + +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.GeoHelper + +class JingDongTest { + + static main(args) { +// def task = new JingDongTest() +// def path = "D:\\数据\\京东\\京东测试数据.xlsx" +// task.run(path) +// task.addPrice(path) +// 120.12063,30.281452 +// 120.120419,30.2767 +// 120.116349,30.29144 +// 120.137169,30.272963 +// 120.108109,30.265553 + + ExcelUtils.modify("C:\\Users\\gaojuan\\Downloads\\商铺出租信息 (3).xlsx",{d-> + if(d['J']){ + def arrs = d['J'].split(",") + def distance = GeoHelper.GetDistance(arrs[1].toString().toDouble(), arrs[0].toString().toDouble(), 22.554693, 113.869516) + d['F'] = distance + } + + }) + + } + + def run(path){ + + def cityMap = ["北京":"大兴","厦门":"思明","泉州":"丰泽","安顺":"西秀"] + def rets = [] + rets << ["城市","区域","名称","地址","高德经度","高德纬度","均价"] + for(def m : cityMap) { + println m.key +" "+m.value + def districts = CommonDatautils.findAllRegionDistricts(m.key, m.value, "district", ["city", "region", "name", "address", "lng", "lat"]); + for(def d : districts){ + if(d.lng){ + println d + rets << [d.city, d.region, d.name, d.address, d.lng/10000000000.0, d.lat/10000000000.0] + } + + } + } + ExcelUtils.write(path, rets, "数据") + } + + def addPrice(path){ + ExcelUtils.multiThreadingModify(path,{d-> + if(!d['G']){ + def dbo = CommonDatautils.findDistrictPrice(d['A'], d['B'], d['C']) + if(dbo){ + d['G'] = dbo.avg_price_2b + d['H'] = DateUtils.formatDateByPattern(dbo.weekend,"yyyy-MM-dd") + } + } + }) + } +} 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 c395ff47d..8a70933ab 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 @@ -1,22 +1,27 @@ package com.fangjia.script.jiangnanblank import com.fangjia.core.util.HttpRequest +import com.fangjia.core.util.PriceData +import com.fangjia.core.util.SvgUtils import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.OpenApiUtils import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.OpenApiClient +import groovy.json.JsonBuilder import groovy.sql.Sql import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import groovy.json.JsonOutput /** * Created by gaojuan on 2017/12/7. */ class TestEvaluation { def sql = Sql.newInstance( - "jdbc:mysql://192.168.0.92:3306/fangjiatong?useSSL=false&serverTimezone=Asia/Shanghai", + "jdbc:mysql://192.168.0.92:3306/fangjiatong?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai", "goojia", "G0ojia123456!@#", "com.mysql.cj.jdbc.Driver" @@ -357,7 +362,7 @@ class TestEvaluation { if(d['B'] == "公寓"){ buildType = 8 }else if(d['B'] == "别墅"){ - buildType = 4 + buildType = 11 }else if(d['B'] == "商铺"){ buildType = 1 }else if(d['B'] == "办公楼"){ @@ -365,11 +370,13 @@ class TestEvaluation { } def lat = dist.lat/10000000000.0 def lng = dist.lng/10000000000.0 - def cat = 5 - if(buildType==3 || buildType==8 || buildType ==4){ + def cat = 6 + if(buildType==3 || buildType==8 || buildType ==11){ cat = 1 }else if(buildType == 1){ cat = 4 + }else if(buildType == 2){ + cat = 6 } 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()] @@ -394,14 +401,159 @@ class TestEvaluation { def addEvaluationDetail(){ def rets = [] + + def detailList = ExcelUtils.read("D:\\数据\\宏信息\\宏信房源台账-基准价-详情.xlsx", 0 , 1) ExcelUtils.modify("D:\\数据\\宏信息\\宏信项目-最终.xlsx", { d -> if (d['G']) { def dist = CommonDatautils.findDistrictById(d['G']) if (dist) { + def ret = [] + ret << d['L'].toString().toDouble().toInteger() + def houses = [] + if(["住宅","别墅","公寓"].contains(d["B"])){ + def propertyType = 0 + if(d["B"] == "别墅"){ + propertyType = 1 + } + def avgPrice = d['K'] + def minPrice = null + def maxPrice = null + if(avgPrice){ + minPrice = (int)(avgPrice - avgPrice * 0.1) + maxPrice = (int)(avgPrice + avgPrice * 0.1) + } + houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 5) + } + if(houses){ + ret << houses + }else{ + ret << [] + } + if(d['K']){ + ret << createTrend(d['K'].toString().toDouble().toInteger(), d['A']) + }else{ + ret << '{"trendSvg":""}' + } + ret << [] + ret << "上海宏信建设发展有限公司" + ret << new Date() + ret << new Date() + ret << 1 + ret << d['A'] + ret << [createAttachment(detailList, d['G'], d['B'], dist)] + + rets.add(ret) + + def sqlstring = "insert into evaluation_edit_data(evaluation_id, house_samples, market_analysis, custom_properties, company, create_time, update_time, validity_period, subject_name, attachments) values (?,?,?,?,?,?,?,?,?,?)" + + sql.withBatch(1, sqlstring){ ps-> + for(def r : rets) { + + def houseSamplesJson = null + if (r[1]) { + // 修复中文转义 + houseSamplesJson = fixUnicodeEscapes(JsonOutput.toJson(r[1])) + } + def marketAnalysisJson = null + if (r[2]) { + // 修复中文转义 + marketAnalysisJson = fixUnicodeEscapes(JsonOutput.toJson(r[2])) + } + + def customPropertiesJson = r[1] ? JsonOutput.toJson(r[3]) : null + def attachmentsJson = null + if(r[9]){ + // 修复中文转义 + attachmentsJson = fixUnicodeEscapes(JsonOutput.toJson(r[9])) + } + + ps.addBatch(r[0], houseSamplesJson, marketAnalysisJson, customPropertiesJson, r[4], r[5], r[6], r[7], r[8], attachmentsJson) + ps.toString() + } + } + } } }); + + + } + + def createTrend(price, name){ + List data1 = PriceData.getSampleData(price); + List> dataSets = new ArrayList<>(); + dataSets.add(data1); + List labels = Arrays.asList(name); + + def priceTrendMap = [:] + def categories = [] + + def priceData = [] + for(PriceData pd : data1){ + categories << pd.yearmonth + priceData << (int)pd.price + } + + priceTrendMap.put("categories", categories) + priceTrendMap.put("series", [["name":name,"data":priceData]]) + + String title = "价格走势图"; + String subtitle = categories[0] + " 至 "+categories[categories.size()-1]; + // 测试小数位为0(整数等差) + String svgWithoutDecimals = SvgUtils.generatePriceTrendSvg(dataSets, labels, title, subtitle, 0); + return ["avgPrice":price, "priceTrend":priceTrendMap,"trendSvg":svgWithoutDecimals] + } + + def createAttachment(detailList, id, type, dist){ + def items = [] + for(def data : detailList){ + if(data["I"]==id && type==data['D']){ + def totalPrice = (int)(data['H'] * data['N']) + items << ["city":dist.city, "district":dist.region, "address":data['B'], "area":data['H'], "unitPrice":data['N'].toString().toDouble().toInteger(), "totalPrice":totalPrice] + } + } + + def time = new Date().getTime() + def resMap = ["id":"attachment_"+time, "title": "出售资产价格清单","type": 1,"editing": false,"items":items] + return resMap + } + + + def fixUnicodeEscapes(jsonString){ + if (!jsonString){ + return jsonString + } + + def result = new StringBuilder() + def matcher = jsonString =~ /\\u([0-9a-fA-F]{4})/ + def lastIndex = 0 + + while (matcher.find()) { + // 添加前面的部分 + result.append(jsonString.substring(lastIndex, matcher.start())) + + // 转换Unicode转义字符 + String hex = matcher.group(1) + int codePoint = Integer.parseInt(hex, 16) + + // 检查是否是中文字符(常用中文字符范围) + // 中文Unicode范围:0x4E00-0x9FFF,0x3400-0x4DBF,0x20000-0x2A6DF等 + if ((codePoint >= 0x4E00 && codePoint <= 0x9FFF) || + (codePoint >= 0x3400 && codePoint <= 0x4DBF)) { + // 是中文,转换为实际字符 + result.append(new String(Character.toChars(codePoint))) + } else { + // 不是中文,保留转义格式 + result.append("\\u").append(hex) + } + + lastIndex = matcher.end() + } + + // 添加剩余部分 + result.append(jsonString.substring(lastIndex)) + return result.toString() } 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 4636489d1..7b8012be3 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 @@ -1607,6 +1607,47 @@ public class OpenApiClient { + + public static def newHouseAction(String city, String district, String name, String propertyType, Integer minPrice, Integer maxPrice, Integer pageSize) { + try { + Map params = new HashMap(); + params.put("city", city); + params.put("district", district); + params.put("name", name) + params.put("token", TOKEN); + params.put("propertyType", propertyType) + params.put("showSource", "1") +// if(minPrice){ +// params.put("minPrice", minPrice) +// } +// if(maxPrice){ +// params.put("maxPrice", maxPrice) +// } +// if(pageSize){ +// params.put("maxPrice", pageSize) +// } + + String content = new HttpRequest().get("http://open.fangjia.com/property/sellCase", params, "utf-8") + JSONObject result = JSONObject.fromObject(content); + while (result == null) { + result = HttpRequestUtil.getJsonContent("http://open.fangjia.com/property/sellCase", params, "utf-8") + println("${city} ${name} 程序调用异常") + Thread.sleep(6000) + } + if (result.getInt("code") == 200) { + return result.get("result"); + } else if (result.getInt("code") !=0) { + println("${city} ${name}") + } + } catch (Exception e) { + println("${city} ${name} ${e.getMessage()}") + e.printStackTrace(); + } + return null + } + + + public static def houseAroundBylocationAction(location, size, propertyType, houseType, pageSize) { def url ="https://open.fangjia.com/house/around?location="+location+"&size="+size+"&pageSize="+pageSize+"&propertyType="+propertyType+"&houseType="+houseType From 54f0b7f2a0af98b92734bb0196d8806446f40534 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 26 Dec 2025 08:16:54 +0800 Subject: [PATCH 51/67] =?UTF-8?q?jdk=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=EF=BC=8C=E6=95=B0=E6=8D=AE=E8=B7=91=E5=AE=8C=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-core/pom.xml | 38 ++-- .../jiangnanblank/TestEvaluation.groovy | 181 +++++++++++------- .../fangjia/script/util/OpenApiClient.groovy | 22 +-- 3 files changed, 141 insertions(+), 100 deletions(-) diff --git a/projects/fangjia-core/pom.xml b/projects/fangjia-core/pom.xml index 2a0d00ddd..4b5915438 100644 --- a/projects/fangjia-core/pom.xml +++ b/projects/fangjia-core/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.fangjia fangjia-core @@ -17,8 +17,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 8 + 8 GBK @@ -105,15 +105,15 @@ 3.5.0 - net.sourceforge.pinyin4j - pinyin4j - 2.5.0 + net.sourceforge.pinyin4j + pinyin4j + 2.5.0 - com.ibm.icu - icu4j - 3.4.4 - + com.ibm.icu + icu4j + 3.4.4 + net.sf.json-lib json-lib @@ -124,7 +124,7 @@ commons-beanutils 1.8.3 - + org.apache.httpcomponents httpclient @@ -155,11 +155,11 @@ hanlp portable-1.6.6 - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + com.alibaba.nacos nacos-client @@ -170,5 +170,11 @@ json RELEASE + + org.projectlombok + lombok + 1.18.20 + compile + 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 8a70933ab..aafc471e4 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 @@ -379,7 +379,7 @@ class TestEvaluation { cat = 6 } 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()] + 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(), 2] } } },1) @@ -388,11 +388,11 @@ class TestEvaluation { } 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" + 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,report_type,average_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.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], r[15],r[14]) ps.toString() } } @@ -404,80 +404,94 @@ class TestEvaluation { def detailList = ExcelUtils.read("D:\\数据\\宏信息\\宏信房源台账-基准价-详情.xlsx", 0 , 1) ExcelUtils.modify("D:\\数据\\宏信息\\宏信项目-最终.xlsx", { d -> - if (d['G']) { - def dist = CommonDatautils.findDistrictById(d['G']) - if (dist) { - def ret = [] - ret << d['L'].toString().toDouble().toInteger() - def houses = [] - if(["住宅","别墅","公寓"].contains(d["B"])){ - def propertyType = 0 - if(d["B"] == "别墅"){ - propertyType = 1 + if (d['G'] && d['L'] && d['L'].toString().toDouble().toInteger()>=3472507) { + def rows = findEvaluationIdExists(d['L'].toString().toDouble().toInteger()) + if(!rows){ + def dist = CommonDatautils.findDistrictById(d['G']) + if (dist) { + def ret = [] + ret << d['L'].toString().toDouble().toInteger() + def houses = [] + if(["住宅","别墅","公寓"].contains(d["B"])){ + def propertyType = 0 + if(d["B"] == "别墅"){ + propertyType = 1 + } + def avgPrice = d['K'] + def minPrice = null + def maxPrice = null + if(avgPrice){ + minPrice = avgPrice + maxPrice = (int)(avgPrice + avgPrice * 0.1) + } + houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 5) + + if(houses.size()<5){ + if(avgPrice){ + minPrice = avgPrice + maxPrice = (int)(avgPrice + avgPrice * 0.2) + } + houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 15) + } } - def avgPrice = d['K'] - def minPrice = null - def maxPrice = null - if(avgPrice){ - minPrice = (int)(avgPrice - avgPrice * 0.1) - maxPrice = (int)(avgPrice + avgPrice * 0.1) + if(houses){ + ret << createHouse(houses) + }else{ + ret << [] + } + if(d['K']){ + ret << createTrend(d['K'].toString().toDouble().toInteger(), d['A']) + }else{ + ret << '{"trendSvg":""}' } - houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 5) - } - if(houses){ - ret << houses - }else{ ret << [] + ret << "上海宏信建设发展有限公司" + ret << new Date() + ret << new Date() + ret << 1 + ret << d['A'] + ret << createAttachment(detailList, d['G'], d['B'], dist) +// rets.add(ret) + saveEvaluationEditData(ret) + } - if(d['K']){ - ret << createTrend(d['K'].toString().toDouble().toInteger(), d['A']) - }else{ - ret << '{"trendSvg":""}' - } - ret << [] - ret << "上海宏信建设发展有限公司" - ret << new Date() - ret << new Date() - ret << 1 - ret << d['A'] - ret << [createAttachment(detailList, d['G'], d['B'], dist)] - - rets.add(ret) - - def sqlstring = "insert into evaluation_edit_data(evaluation_id, house_samples, market_analysis, custom_properties, company, create_time, update_time, validity_period, subject_name, attachments) values (?,?,?,?,?,?,?,?,?,?)" - - sql.withBatch(1, sqlstring){ ps-> - for(def r : rets) { - - def houseSamplesJson = null - if (r[1]) { - // 修复中文转义 - houseSamplesJson = fixUnicodeEscapes(JsonOutput.toJson(r[1])) - } - def marketAnalysisJson = null - if (r[2]) { - // 修复中文转义 - marketAnalysisJson = fixUnicodeEscapes(JsonOutput.toJson(r[2])) - } - - def customPropertiesJson = r[1] ? JsonOutput.toJson(r[3]) : null - def attachmentsJson = null - if(r[9]){ - // 修复中文转义 - attachmentsJson = fixUnicodeEscapes(JsonOutput.toJson(r[9])) - } - - ps.addBatch(r[0], houseSamplesJson, marketAnalysisJson, customPropertiesJson, r[4], r[5], r[6], r[7], r[8], attachmentsJson) - ps.toString() - } - } - - } } }); + } + + def saveEvaluationEditData(r){ + + def sqlstring = "insert into evaluation_edit_data(evaluation_id, house_samples, market_analysis, custom_properties, company, create_time, update_time, validity_period, subject_name, attachments) values (?,?,?,?,?,?,?,?,?,?)" + + sql.withBatch(1, sqlstring){ ps-> + def houseSamplesJson = null + if (r[1]) { + // 修复中文转义 + houseSamplesJson = fixUnicodeEscapes(JsonOutput.toJson(r[1])) + } + def marketAnalysisJson = null + if (r[2]) { + // 修复中文转义 + marketAnalysisJson = fixUnicodeEscapes(JsonOutput.toJson(r[2])) + } + + def customPropertiesJson = r[1] ? JsonOutput.toJson(r[3]) : null + def attachmentsJson = null + if(r[9]){ + // 修复中文转义 + attachmentsJson = fixUnicodeEscapes(JsonOutput.toJson(r[9])) + } + + ps.addBatch(r[0], houseSamplesJson, marketAnalysisJson, customPropertiesJson, r[4], r[5], r[6], r[7], r[8], attachmentsJson) + ps.toString() + } + } + def findEvaluationIdExists(evaluationId){ + def query = "SELECT * FROM evaluation_edit_data WHERE evaluation_id = ? LIMIT 1" + return sql.firstRow(query, [evaluationId]) } def createTrend(price, name){ @@ -509,14 +523,24 @@ class TestEvaluation { def items = [] for(def data : detailList){ if(data["I"]==id && type==data['D']){ - def totalPrice = (int)(data['H'] * data['N']) - items << ["city":dist.city, "district":dist.region, "address":data['B'], "area":data['H'], "unitPrice":data['N'].toString().toDouble().toInteger(), "totalPrice":totalPrice] + def totalPrice = 0 + if (data['H'] && data['N']){ + totalPrice = (int)(data['H'] * data['N']) + } + def unitPrice = 0 + if(data['N']){ + unitPrice = data['N'].toString().toDouble().toInteger() + } + items << ["city":dist.city, "district":dist.region, "address":data['B'], "area":data['H'], "unitPrice":unitPrice, "totalPrice":totalPrice] } } - def time = new Date().getTime() - def resMap = ["id":"attachment_"+time, "title": "出售资产价格清单","type": 1,"editing": false,"items":items] - return resMap + if(items.size()>1){ + def time = new Date().getTime() + def resMap = ["id":"attachment_"+time, "title": "出售资产价格清单","type": 1,"editing": false,"items":items] + return [resMap] + } + return [] } @@ -556,5 +580,16 @@ class TestEvaluation { return result.toString() } + def createHouse(houses){ + def rets = [] + def i = 0 + def time = new Date().getTime() + for(def h : houses){ + def pdate = h.caseDate.replace("-","").substring(0,6) + rets << ["city":h.city, "district":h.district, "name":h.name, "publishDate":pdate, "unitPrice":h.unitPrice, "_uid":"sample_"+time+"_"+i,"source":h.source, "area":h.size, "distance":h.distance, "totalPrice":h.totalPrice] + i++ + } + return rets; + } } 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 7b8012be3..72e9652a6 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 @@ -1617,20 +1617,20 @@ public class OpenApiClient { params.put("token", TOKEN); params.put("propertyType", propertyType) params.put("showSource", "1") -// if(minPrice){ -// params.put("minPrice", minPrice) -// } -// if(maxPrice){ -// params.put("maxPrice", maxPrice) -// } -// if(pageSize){ -// params.put("maxPrice", pageSize) -// } + if(minPrice){ + params.put("minPrice", minPrice.toString()) + } + if(maxPrice){ + params.put("maxPrice", maxPrice.toString()) + } + if(pageSize){ + params.put("pageSize", pageSize.toString()) + } - String content = new HttpRequest().get("http://open.fangjia.com/property/sellCase", params, "utf-8") + String content = new HttpRequest().get("http://localhost:8080/property/sellCase", params, "utf-8") JSONObject result = JSONObject.fromObject(content); while (result == null) { - result = HttpRequestUtil.getJsonContent("http://open.fangjia.com/property/sellCase", params, "utf-8") + result = HttpRequestUtil.getJsonContent("http://localhost:8080/property/sellCase", params, "utf-8") println("${city} ${name} 程序调用异常") Thread.sleep(6000) } From e409e88fbc07ebc3041d01d5f66f21adcb490ef0 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Fri, 26 Dec 2025 09:59:29 +0800 Subject: [PATCH 52/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=B3=E7=B1=B3?= =?UTF-8?q?=E7=A7=9F=E9=87=91=E8=84=9A=E6=9C=AC=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=8F=91=E9=80=81=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../averager/InsertMonitorSquareRentCalcCommandBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy index c72b0288a..884f5a1e6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy @@ -153,7 +153,7 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch { query.append("cat", "block") blockCount = SQMETRE_RENT_COLL.count(query) def msg = "本月(${weekend.format("yyyyMM")})小区平米租金计算量:".toString() + districtCount + ";本月城市平米租金计算量:" + cityCount + ";本月区域平米租金计算量:" + regionCount + ";本月版块平米租金计算量:" + blockCount + ";运行时间:" + secondToTime(time) + "." - sendDingDingMsg(TOKEN, msg) + sendDingDingMsg(TOKEN, msg, "13916076378") } /** * 均价是否计算完成 From 0f09380b841eb4db196b8a3ad66beb5d3d06e7f9 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Fri, 26 Dec 2025 13:28:32 +0800 Subject: [PATCH 53/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9MySQL=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 698a360f2..80cdd5037 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -597,10 +597,10 @@ - - mysql - mysql-connector-java - 8.0.33 - + + + + + From 0eda9a4629ded49b7b8a7363dfe17d0d6f3c3ba6 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 14:34:36 +0800 Subject: [PATCH 54/67] =?UTF-8?q?=E5=8E=A6=E9=97=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=B7=91=E6=89=B9=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 10 +- .../script/gj/village/NanjiangVillage.groovy | 2 +- .../script/gj/village/XiamenVillage.groovy | 4 +- .../gj/xiamen/RelatedTaiWanBatch.groovy | 2 +- .../gj/xiamen/XiaMenVillageBatch.groovy | 86 ++++++ .../gj/xiamen/XmBankVillageFtpUtils.groovy | 127 +++++++++ .../jiangnanblank/TestEvaluation.groovy | 11 +- .../com/fangjia/script/util/ExcelUtils.groovy | 269 +++++++++++++++++- 8 files changed, 495 insertions(+), 16 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 17e32cbde..036189765 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -597,11 +597,11 @@ - - mysql - mysql-connector-java - 8.0.33 - + + + + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy index 76b670d6b..cc128d0cc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/NanjiangVillage.groovy @@ -11,7 +11,7 @@ class NanjiangVillage { } def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\南京银行\\县城清洗-结果.xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\数据\\南京银行\\新地址核实(县城).xlsx",{d-> if(!d['F']){ def dto = OpenApiUtils.addrVerifyNanjing(null, d['A'], 2) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy index 4337e871e..a6240e4bd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/XiamenVillage.groovy @@ -10,10 +10,10 @@ class XiamenVillage { } def run(){ - ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\涉农组织类型判定(to估家,2025-10-31)-以此为准.xlsx",{ d-> + ExcelUtils.multiThreadingModify("D:\\数据\\厦门\\工业园区与涉农组织类型矛盾.xlsx",{ d-> if(!d['R']){ - def dto = OpenApiUtils.addrVerifyXiameng(null, d['B'], 2) + def dto = OpenApiUtils.addrVerifyXiameng(null, d['A'], 2) if(dto){ // def dto = jsonObj.result d['F'] = dto.province diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy index 5cf2d132a..d04835c28 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy @@ -18,7 +18,7 @@ import com.mongodb.DBCollection */ -//@BatchOwner(Watcher.GaoJuan) +@BatchOwner(Watcher.GaoJuan) class RelatedTaiWanBatch extends BaseBatch{ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy new file mode 100644 index 000000000..ed8e73738 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -0,0 +1,86 @@ +package com.fangjia.script.gj.xiamen + +import com.fangjia.script.BaseBatch +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.util.DateUtil +import com.fangjia.script.util.ExcelUtils + +/** + * 厦门每月月初自动跑涉农数据 + */ +class XiaMenVillageBatch extends BaseBatch{ + + + static main(args) { + runBatch(new XiaMenVillageBatch(), args); + } + + @Override + void process(Object args) { + def monthStr = DateUtil.formatByPattern(new Date(), "yyyy-MM"); + def outFileName = "xmbank_"+monthStr+"_result.xlsx" + def inFileName = "xmbank_"+monthStr+".xlsx" + def exists = checkFileExists(outFileName) + if(!exists){ + def rows = [] + rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] + def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) + if(rets){ + for(def row : rets){ + if(row[1]){ + def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) + if(dto){ + row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + if(dto.devDistrictName){ + row[3] = dto.devDistrictName//开发区 + }else{ + row[3] = "" + } + + } + } + rows << row + } + } + uploadExcel(rows, outFileName) + + }else{ + println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + } + + } + + static boolean uploadExcel(def data, String fileName, String sheetName = "Sheet1") { + if (data == null || data.isEmpty()) { + println "数据为空,无法生成Excel" + return false + } + + try { + // 1. 生成Excel内容 + byte[] excelBytes = ExcelUtils.createExcelBytes(data, sheetName) + + // 2. 上传到服务器 + return XmBankVillageFtpUtils.uploadExcelBytes(excelBytes, fileName) + + } catch (Exception e) { + println "生成并上传Excel失败: ${e.message}" + e.printStackTrace() + return false + } + } + + def checkFileExists(def fileName){ + def files = XmBankVillageFtpUtils.listOutFileNames() + def existsFlag = false + if(files){ + for(def file : files){ + if(file.filename == fileName){ + existsFlag = true + break + } + } + } + return existsFlag + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy new file mode 100644 index 000000000..3f43e236e --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankVillageFtpUtils.groovy @@ -0,0 +1,127 @@ +package com.fangjia.script.gj.xiamen + +import com.fangjia.script.jiangnanblank.SFTP +import com.fangjia.script.util.ExcelUtils +import com.jcraft.jsch.ChannelSftp +import org.apache.poi.ss.usermodel.Cell +import org.apache.poi.ss.usermodel.Row +import org.apache.poi.ss.usermodel.Sheet +import org.apache.poi.ss.usermodel.Workbook +import org.apache.poi.ss.usermodel.WorkbookFactory + +import java.nio.charset.Charset + +class XmBankVillageFtpUtils { + static def ftpServer = "192.168.0.86" + static def ftpPort = 17495 + static def ftpUser = "xmbank" + static def ftpPassword = "Xmbank123!@#" + static def ftpPath = "/output/village_data" + static def ftpInPath = "/input/village" + + + + static SFTP sftp = new SFTP(); + static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword); + + + static def ftpUpload(outputPath_dist, month){ + //上传到ftp + sftpChannel = reConnect(); + sftp.upload(ftpPath, outputPath_dist, sftpChannel); + + + } + + 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 listOutFileNames(){ + //上传到ftp + sftpChannel = reConnect(); + Vector files = sftp.listFiles(ftpPath+"/", sftpChannel); + return files + } + + static def listInFileNames(){ + //上传到ftp + sftpChannel = reConnect(); + Vector files = sftp.listFiles(ftpInPath+"/", sftpChannel); + return files + } + + static def getFileLength(String path, String month){ + sftpChannel = reConnect(); + def size = sftp.getFileSize(ftpPath+ month+"/"+path, sftpChannel) + return size + } + + static def readExcelFile(String fileName) { + sftpChannel = reConnect() + try { + // 构建完整的远程路径 + String fullRemotePath = ftpInPath + "/"+fileName + println "开始读取Excel文件: ${fullRemotePath}" + // 从SFTP服务器获取文件流 + InputStream inputStream = sftpChannel.get(fullRemotePath) + def excelData = ExcelUtils.readFromStream(inputStream, 0, 1) + println "Excel共有 ${excelData.size()} 行数据" + inputStream.close() + return excelData + } catch (Exception e) { + println "读取Excel文件失败: ${e.message}" + e.printStackTrace() + return null + } + } + + + /** + * 上传Excel字节数组到服务器 + * @param excelBytes Excel字节数组 + * @param fileName 文件名 + * @return 上传是否成功 + */ + private static boolean uploadExcelBytes(byte[] excelBytes, String fileName) { + sftpChannel = reConnect() + + try { + // 构建完整的远程路径 + String remoteFilePath = "${ftpPath}/${fileName}" + + println "开始上传Excel文件到: ${remoteFilePath}" + println "文件大小: ${excelBytes.length} 字节" + + // 将字节数组转换为输入流 + InputStream inputStream = new ByteArrayInputStream(excelBytes) + + // 上传文件 + sftpChannel.put(inputStream, remoteFilePath) + + // 关闭流 + inputStream.close() + + println "Excel文件上传成功: ${remoteFilePath}" + + return true + + } catch (Exception e) { + println "上传Excel文件失败: ${e.message}" + e.printStackTrace() + return false + } + } + +} 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 aafc471e4..c92f34b28 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 @@ -39,13 +39,13 @@ class TestEvaluation { // task.newAndOldMatch() // task.addFjwToBprice("D:\\数据\\宏信息\\宏信房源台账-价格.xlsx") -// task.addAreaFactor() + task.addAreaFactor() // task.addOptName() // task.addDistId() // task.addEvaluationToDB() - task.addEvaluationDetail() +// task.addEvaluationDetail() } def houseSimilar(){ @@ -298,7 +298,7 @@ class TestEvaluation { def addAreaFactor(){ - ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\宏信房源台账-基准价(含ID).xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\数据\\宏信息\\(红色)宏信估值详情-最新0106.xlsx",{d-> if(d['I'] && d['J'] && d['K']){ def dist = CommonDatautils.findDistrictById(d['I']) if(dist){ @@ -314,6 +314,11 @@ class TestEvaluation { // } // d['L']=(int)(d['J']*d['K']) // d['N'] = (int)(d['L'] + d['L']*d['M']) + def obj = CommonDatautils.queryDistrictPriceData(dist.city, dist.region, dist.name) + if(obj && obj.avg_price_2b){ + d['M'] = obj.avg_price_2b + d['L'] = (int)(obj.avg_price_2b * d['K']) + } } } 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 50882747b..43265e606 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 @@ -11,6 +11,7 @@ import org.apache.poi.ss.usermodel.* import org.apache.poi.ss.util.CellRangeAddress import org.apache.poi.ss.util.RegionUtil import org.apache.poi.xssf.streaming.SXSSFWorkbook +import org.apache.poi.xssf.usermodel.XSSFWorkbook import java.util.concurrent.ExecutorService import java.util.concurrent.Executors @@ -103,6 +104,50 @@ public class ExcelUtils{ } + public static List> readFromStream(def inp,int sheetIndex = 0,int skipRow = 1){ + List> ret = new ArrayList>(); + try { + Workbook workbook = WorkbookFactory.create(inp) + workbook.setForceFormulaRecalculation(true) + Sheet sheet = workbook.getSheetAt(sheetIndex); + //行号 + int rowIndex = 0; + for(Row row : sheet){ + rowIndex ++ + if(rowIndex <= skipRow){ + continue; + } + short minColIx = 0; + short maxColIx = row.getLastCellNum(); + List rowData = new ExcelRow(); + for(short colIx=minColIx; colIx rowDataList = data.get(rowIndex); - if(rowDataList == null) continue + if(rowDataList == null) continue try{ for(int cellIndex = 0 ; cellIndex < rowDataList.size();cellIndex++){ Cell cell = row.createCell(cellIndex); @@ -499,9 +544,9 @@ public class ExcelUtils{ try{ return cell.getStringCellValue() }catch (Exception ex){ - println cell.getColumnIndex() - println cell.getRowIndex() - return cell.getRichStringCellValue().getString() + println cell.getColumnIndex() + println cell.getRowIndex() + return cell.getRichStringCellValue().getString() } } case Cell.CELL_TYPE_NUMERIC: @@ -515,4 +560,220 @@ public class ExcelUtils{ return null; } } + + /** + * 创建Excel字节数组 + * @param data Excel数据 + * @param sheetName Sheet名称 + * @return Excel文件的字节数组 + */ + private static byte[] createExcelBytes(List> data, String sheetName) { + Workbook workbook = null + ByteArrayOutputStream outputStream = null + + try { + // 创建新的工作簿(使用.xlsx格式) + workbook = new XSSFWorkbook() + + // 创建样式(可选) + CellStyle headerStyle = createHeaderStyle(workbook) + CellStyle dataStyle = createDataStyle(workbook) + + // 创建Sheet + Sheet sheet = workbook.createSheet(sheetName) + sheet.setColumnWidth(0, 5 * 256) + sheet.setColumnWidth(1, 100 * 256) + sheet.setColumnWidth(2, 20 * 256) + sheet.setColumnWidth(3, 50 * 256) + + // 写入数据 + writeDataToSheet(sheet, data, headerStyle, dataStyle) + + // 自动调整列宽(可选) +// autoSizeColumns(sheet, data) + + // 将工作簿写入字节数组 + outputStream = new ByteArrayOutputStream() + workbook.write(outputStream) + + return outputStream.toByteArray() + + } catch (Exception e) { + throw new RuntimeException("创建Excel失败: ${e.message}", e) + } finally { + // 关闭资源 + try { + if (outputStream != null) { + outputStream.close() + } + } catch (Exception e) { + e.printStackTrace() + } + } + } + + /** + * 创建表头样式 + */ + private static CellStyle createHeaderStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle() + + // 设置字体 + Font font = workbook.createFont() +// font.setBoldweight(7) + font.setBoldweight(Font.BOLDWEIGHT_BOLD) + font.setFontHeightInPoints((short) 12) + font.setColor(IndexedColors.BLACK.getIndex()) + style.setFont(font) + + // 设置背景色 + style.setFillForegroundColor(IndexedColors.TURQUOISE.getIndex()) + style.setFillPattern(FillPatternType.SOLID_FOREGROUND) + + // 设置边框 +// style.setBorderBottom(BorderStyle.THIN) +// style.setBorderTop(BorderStyle.THIN) +// style.setBorderRight(BorderStyle.THIN) +// style.setBorderLeft(BorderStyle.THIN) + + // 居中 + style.setAlignment(HorizontalAlignment.CENTER) + style.setVerticalAlignment(VerticalAlignment.CENTER) + + return style + } + + /** + * 创建数据样式 + */ + private static CellStyle createDataStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle() + + // 设置边框 +// style.setBorderBottom(BorderStyle.THIN) +// style.setBorderTop(BorderStyle.THIN) +// style.setBorderRight(BorderStyle.THIN) +// style.setBorderLeft(BorderStyle.THIN) + + // 自动换行 + style.setWrapText(true) + + return style + } + + /** + * 自动调整列宽 + */ + private static void autoSizeColumns(Sheet sheet, List> data) { + if (data.isEmpty()) return + + int maxColumns = data.max { it.size() }?.size() ?: 0 + + for (int i = 0; i < maxColumns; i++) { + sheet.autoSizeColumn(i) + } + } + + /** + * 写入数据到Sheet + */ + private static void writeDataToSheet(Sheet sheet, List> data, + CellStyle headerStyle, CellStyle dataStyle) { + // 判断是否有表头(第一行是否为表头) + boolean hasHeader = data.size() > 0 + + for (int rowIndex = 0; rowIndex < data.size(); rowIndex++) { + List rowData = data[rowIndex] + Row row = sheet.createRow(rowIndex) + + if(rowIndex == 0){ + row.setHeightInPoints(35.0) + } + for (int colIndex = 0; colIndex < rowData.size(); colIndex++) { + Cell cell = row.createCell(colIndex) + String cellValue = rowData[colIndex] ?: "" + + // 设置单元格值 + setCellValue(cell, cellValue) + + // 应用样式 + if (rowIndex == 0 && hasHeader && headerStyle != null) { + cell.setCellStyle(headerStyle) + } else if (dataStyle != null) { + cell.setCellStyle(dataStyle) + } + } + } + } + + + /** + * 设置单元格值(智能识别类型) + */ + private static void setCellValue(Cell cell, String value) { + if (value == null || value.trim().isEmpty()) { + cell.setCellValue("") + return + } + + // 尝试判断是否为数字 + if (isNumeric(value)) { + try { + if (value.contains(".")) { + cell.setCellValue(Double.parseDouble(value)) + } else { + cell.setCellValue(Long.parseLong(value)) + } + return + } catch (Exception e) { + // 如果不是数字,继续 + } + } + + // 尝试判断是否为日期 + if (isDate(value)) { + try { + // 这里可以添加日期格式转换逻辑 + // 暂时按字符串处理 + cell.setCellValue(value) + } catch (Exception e) { + cell.setCellValue(value) + } + return + } + + // 默认为字符串 + cell.setCellValue(value) + } + + + /** + * 检查字符串是否为数字 + */ + private static boolean isNumeric(String str) { + if (str == null || str.isEmpty()) { + return false + } + // 允许小数点、负号 + return str.matches("-?\\d+(\\.\\d+)?") + } + + /** + * 检查字符串是否为日期(简单判断) + */ + private static boolean isDate(String str) { + if (str == null || str.isEmpty()) { + return false + } + // 常见的日期格式模式 + def datePatterns = [ + /^\d{4}-\d{2}-\d{2}$/, + /^\d{4}\/\d{2}\/\d{2}$/, + /^\d{4}年\d{2}月\d{2}日$/, + /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/ + ] + + return datePatterns.any { pattern -> str =~ pattern } + } + } \ No newline at end of file From 69e9a76c9062d173fe027b4ddb37b612edae329f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 14:36:50 +0800 Subject: [PATCH 55/67] =?UTF-8?q?=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 036189765..adf710e80 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -602,11 +602,18 @@ + + + + + + + From b81a29d1b26918a215a58ab92bebe5ceb4ca7d20 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 14:38:37 +0800 Subject: [PATCH 56/67] update --- projects/fangjia-script/pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index adf710e80..d15619573 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -605,15 +605,5 @@ - - - - - - - - - - From b847121603492f51d61d761f819bf7967c8bd92e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 14:43:12 +0800 Subject: [PATCH 57/67] =?UTF-8?q?=E5=8E=BB=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 9c2561dbb..d02a60460 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -602,11 +602,6 @@ -<<<<<<< HEAD - - -======= ->>>>>>> 0f09380b841eb4db196b8a3ad66beb5d3d06e7f9 From 8fafe1e90f48b8f0141405b95f7f7d125c9b7810 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 14:57:34 +0800 Subject: [PATCH 58/67] update --- .../java/com/fangjia/core/util/SvgUtils.java | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java b/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java index ce45c16da..8d3b92739 100644 --- a/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java +++ b/projects/fangjia-core/src/main/java/com/fangjia/core/util/SvgUtils.java @@ -11,29 +11,29 @@ import java.util.stream.Collectors; /** - * SVG宸ュ叿绫伙紝鐢ㄤ簬鐢熸垚浠锋牸瓒嬪娍鐨凷VG鍥捐〃 + * SVG工具类,用于生成价格趋势的SVG图表 */ public class SvgUtils { - // SVG鐢诲竷灏哄 + // SVG画布尺寸 private static final int WIDTH = 800; private static final int HEIGHT = 500; private static final int PADDING = 60; - // 鐢熸垚SVG鎶樼嚎鍥撅紙鏀寔澶氭潯绾匡級锛屾柊澧瀌ecimalPlaces鍙傛暟鎺у埗Y杞村皬鏁颁綅 + // 生成SVG折线图(支持多条线),新增decimalPlaces参数控制Y轴小数位 public static String generatePriceTrendSvg(List> dataSets, List labels, String title, String subtitle, int decimalPlaces) { if (dataSets.isEmpty() || dataSets.get(0).isEmpty()) { return ""; } - // 杩囨护涓虹┖鐨勬暟鎹� + // 过滤为空的数据 dataSets = dataSets.stream() .map(innerList -> innerList.stream() .filter(priceData -> priceData != null && priceData.getPrice() != null) .collect(Collectors.toList())) .collect(Collectors.toList()); - // 璁$畻浠锋牸鍜屾椂闂寸殑鑼冨洿 + // 计算价格和时间的范围 double minPrice = dataSets.stream() .flatMap(List::stream) .filter((p) -> p != null && p.getPrice() != null) @@ -50,14 +50,14 @@ public class SvgUtils { minPrice = minPrice * (1 - buffer); maxPrice = maxPrice * (1 + buffer); - // 濡傛灉decimalPlaces涓�0锛岃皟鏁磎inPrice鍜宮axPrice涓烘暣鏁扮瓑宸� + // 如果decimalPlaces为0,调整minPrice和maxPrice为整数等差 // if (decimalPlaces == 0) { // long step = calculateStep((long) Math.ceil(maxPrice) - (long) Math.floor(minPrice)); // minPrice = Math.floor(minPrice / step) * step; // maxPrice = Math.ceil(maxPrice / step) * step; // } - // 瑙f瀽鏈�灏忓拰鏈�澶ф棩鏈� + // 解析最小和最大日期 String minYearMonth = dataSets.stream() .flatMap(List::stream) .map(PriceData::getYearmonth) @@ -69,22 +69,22 @@ public class SvgUtils { .max(String::compareTo) .orElse("2025-01"); - // 鏋勫缓SVG鍐呭 + // 构建SVG内容 StringBuilder svg = new StringBuilder(); svg.append(String.format("", WIDTH, HEIGHT)); svg.append(String.format("", WIDTH, HEIGHT)); - // 娣诲姞鏍囬鍜屽壇鏍囬 + // 添加标题和副标题 svg.append(String.format("%s", WIDTH / 2, 30, title)); svg.append(String.format("%s", WIDTH / 2, 50, subtitle)); - // 鐢昏櫄绾跨綉鏍肩嚎鍜屽潗鏍囪酱 + // 画虚线网格线和坐标轴 svg.append(drawGrid(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces)); svg.append(drawAxis(minYearMonth, maxYearMonth, minPrice, maxPrice, decimalPlaces)); - // 鐢诲鏉℃姌绾垮拰鍥句緥 + // 画多条折线和图例 String[] colors = {"#66B3FF", "#FF6666", "#FFA500", "#8A2BE2"}; for (int i = 0; i < dataSets.size(); i++) { svg.append(drawSmoothLine(dataSets.get(i), minYearMonth, maxYearMonth, minPrice, maxPrice, colors[i % colors.length], decimalPlaces)); @@ -96,14 +96,14 @@ public class SvgUtils { return svg.toString(); } - // 缁樺埗骞虫粦鎶樼嚎 + // 绘制平滑折线 private static String drawSmoothLine(List data, String minYearMonth, String maxYearMonth, double minPrice, double maxPrice, String color, int decimalPlaces) { // if (data.size() < 2) return ""; StringBuilder path = new StringBuilder("", PADDING, HEIGHT - PADDING, WIDTH - PADDING, HEIGHT - PADDING)); axis.append(String.format("", PADDING, PADDING, PADDING, HEIGHT - PADDING)); - // X杞村埢搴� + // X轴刻度 int totalMonths = getMonthIndex(maxYearMonth) - getMonthIndex(minYearMonth) + 1; for (int i = 0; i < totalMonths; i++) { int x; if (totalMonths == 1) { - // 褰撳彧鏈変竴涓湀鏃讹紝灏嗗埢搴︽斁鍦ㄤ腑闂翠綅缃� + // 当只有一个月时,将刻度放在中间位置 x = PADDING + (WIDTH - 2 * PADDING) / 2; } else { x = PADDING + i * (WIDTH - 2 * PADDING) / (totalMonths - 1); @@ -196,7 +196,7 @@ public class SvgUtils { x, HEIGHT - PADDING + 20, monthLabel)); } - // Y杞村埢搴� + // Y轴刻度 double step = calculateYStep(minPrice, maxPrice, decimalPlaces); int numSteps = (int) ((maxPrice - minPrice) / step) + 1; for (int i = 0; i < numSteps; i++) { @@ -211,18 +211,18 @@ public class SvgUtils { return axis.toString(); } - // 璁$畻Y杞存闀� + // 计算Y轴步长 private static double calculateYStep(double minPrice, double maxPrice, int decimalPlaces) { double range = maxPrice - minPrice; if (decimalPlaces == 0) { return calculateStep((long) range); } - double step = range / 10.0; // 榛樿10涓棿闅� + double step = range / 10.0; // 默认10个间隔 double scale = Math.pow(10, decimalPlaces); return Math.round(step * scale) / scale; } - // 璁$畻鏁存暟姝ラ暱 + // 计算整数步长 private static long calculateStep(long range) { long step = (long) Math.pow(10, Math.floor(Math.log10(range))); if (range / step < 4) step /= 2; @@ -230,7 +230,7 @@ public class SvgUtils { return step; } - // 鑾峰彇鏈堜唤鏍囩鍜岀储寮曪紙淇濇寔涓嶅彉锛� + // 获取月份标签和索引(保持不变) private static String getMonthLabel(String minYearMonth, int offset) { int totalMonths = getMonthIndex(minYearMonth); int targetMonthIndex = totalMonths + offset; @@ -255,44 +255,44 @@ public class SvgUtils { } /** - * 瀵归綈宸叉湁绯诲垪鏁版嵁涓庢柊鐨勬椂闂磋酱 + * 对齐已有系列数据与新的时间轴 */ public static void alignSeriesData(List newCategories, List series, PriceDto.PriceTrend rentTrend) { for (PriceDto.DoubleSeries s : series) { List originalData = s.getData(); - List originalCategories = new ArrayList<>(rentTrend.getCategories()); // 鍋囪鍘熷鏃堕棿杞村彲浠庡埆澶勮幏鍙� + List originalCategories = new ArrayList<>(rentTrend.getCategories()); // 假设原始时间轴可从别处获取 List alignedData = new ArrayList<>(); - // 鏍规嵁鏂扮殑鏃堕棿杞村榻愭暟鎹� + // 根据新的时间轴对齐数据 for (String date : newCategories) { int index = originalCategories.indexOf(date); if (index >= 0 && index < originalData.size()) { alignedData.add(originalData.get(index)); } else { - alignedData.add(null); // 鏃ユ湡涓嶅瓨鍦ㄦ椂琛� null + alignedData.add(null); // 日期不存在时补 null } } s.setData(alignedData); } } - // 娴嬭瘯鏂规硶 + // 测试方法 public static void main(String[] args) { List data1 = PriceData.getSampleData(5200); List> dataSets = new ArrayList<>(); dataSets.add(data1); - String name = "鏂颁笘绾ぇ鍘�"; + String name = "新世纪大厦"; List labels = Arrays.asList(name); - String title = "浠锋牸璧板娍鍥�"; - String subtitle = "2024-12 鑷� 2025-11"; + String title = "价格走势图"; + String subtitle = "2024-12 至 2025-11"; -// // 娴嬭瘯灏忔暟浣嶄负2 +// // 测试小数位为2 // String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 2); // System.out.println("With 2 decimal places:"); // System.out.println(svgWithoutDecimals); - // 娴嬭瘯灏忔暟浣嶄负0锛堟暣鏁扮瓑宸級 + // 测试小数位为0(整数等差) String svgWithoutDecimals = generatePriceTrendSvg(dataSets, labels, title, subtitle, 0); System.out.println("With 0 decimal places (integer steps):"); System.out.println(svgWithoutDecimals); From 869bef1c7fc512130b0f6ed87e836834a54cf08f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 15:00:13 +0800 Subject: [PATCH 59/67] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fangjia/core/util/PriceData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java index 7c3d7e4f8..591bc73bb 100644 --- a/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java +++ b/projects/fangjia-core/src/main/java/com/fangjia/core/util/PriceData.java @@ -10,7 +10,7 @@ import java.util.Random; public class PriceData { private String yearmonth; private Double price; - private Double volume; // 鏂板鎴愪氦閲忓瓧娈� + private Double volume; // 新增成交量字段 public PriceData() {} From 64d35d4cfba2da9ec1bf7a18755257ceb8fc52cb Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 15:17:10 +0800 Subject: [PATCH 60/67] update --- .../com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index ed8e73738..afb3aaf93 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -1,6 +1,8 @@ package com.fangjia.script.gj.xiamen import com.fangjia.script.BaseBatch +import com.fangjia.script.BatchOwner +import com.fangjia.script.Watcher import com.fangjia.script.gj.OpenApiUtils import com.fangjia.script.util.DateUtil import com.fangjia.script.util.ExcelUtils @@ -8,6 +10,7 @@ import com.fangjia.script.util.ExcelUtils /** * 厦门每月月初自动跑涉农数据 */ +@BatchOwner(Watcher.GaoJuan) class XiaMenVillageBatch extends BaseBatch{ @@ -20,6 +23,7 @@ class XiaMenVillageBatch extends BaseBatch{ def monthStr = DateUtil.formatByPattern(new Date(), "yyyy-MM"); def outFileName = "xmbank_"+monthStr+"_result.xlsx" def inFileName = "xmbank_"+monthStr+".xlsx" + println "输入文件:"+inFileName+" 输出文件:"+outFileName def exists = checkFileExists(outFileName) if(!exists){ def rows = [] @@ -43,7 +47,7 @@ class XiaMenVillageBatch extends BaseBatch{ } } uploadExcel(rows, outFileName) - + println "新增文件,上传已完成" }else{ println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") } From 729fc7dcd8232ae07a60e3bd5533ad1c5734ea61 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 16:01:45 +0800 Subject: [PATCH 61/67] =?UTF-8?q?maven=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index d02a60460..6615f1e8d 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -17,8 +17,10 @@ maven-compiler-plugin 2.3.2 - 1.8 - 1.8 + 1.6 + 1.6 + + GBK From e13f5bfc9357120875bf5e48ba808f01a0ab8b9f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 17:29:43 +0800 Subject: [PATCH 62/67] test --- projects/fangjia-script/pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 6615f1e8d..d02a60460 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -17,10 +17,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 - - + 1.8 + 1.8 GBK From 22526ed8348fe23dcc73b9ede3d6b6d9a9a699b7 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 17:30:51 +0800 Subject: [PATCH 63/67] test --- .../gj/xiamen/XiaMenVillageBatch.groovy | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index afb3aaf93..e8d3c6ea1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -24,33 +24,33 @@ class XiaMenVillageBatch extends BaseBatch{ def outFileName = "xmbank_"+monthStr+"_result.xlsx" def inFileName = "xmbank_"+monthStr+".xlsx" println "输入文件:"+inFileName+" 输出文件:"+outFileName - def exists = checkFileExists(outFileName) - if(!exists){ - def rows = [] - rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] - def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) - if(rets){ - for(def row : rets){ - if(row[1]){ - def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) - if(dto){ - row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) - if(dto.devDistrictName){ - row[3] = dto.devDistrictName//开发区 - }else{ - row[3] = "" - } - - } - } - rows << row - } - } - uploadExcel(rows, outFileName) - println "新增文件,上传已完成" - }else{ - println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") - } +// def exists = checkFileExists(outFileName) +// if(!exists){ +// def rows = [] +// rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] +// def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) +// if(rets){ +// for(def row : rets){ +// if(row[1]){ +// def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) +// if(dto){ +// row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) +// if(dto.devDistrictName){ +// row[3] = dto.devDistrictName//开发区 +// }else{ +// row[3] = "" +// } +// +// } +// } +// rows << row +// } +// } +// uploadExcel(rows, outFileName) +// println "新增文件,上传已完成" +// }else{ +// println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") +// } } From 0e20ddf47b703d75541ab05243ac08347f4e82c3 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 17:35:18 +0800 Subject: [PATCH 64/67] test --- .../com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index e8d3c6ea1..440f6b420 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -24,7 +24,7 @@ class XiaMenVillageBatch extends BaseBatch{ def outFileName = "xmbank_"+monthStr+"_result.xlsx" def inFileName = "xmbank_"+monthStr+".xlsx" println "输入文件:"+inFileName+" 输出文件:"+outFileName -// def exists = checkFileExists(outFileName) + def exists = checkFileExists(outFileName) // if(!exists){ // def rows = [] // rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] From 5fb995fe3378082cdb4d3a494a584805d49128b8 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 17:41:40 +0800 Subject: [PATCH 65/67] test --- .../gj/xiamen/XiaMenVillageBatch.groovy | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index 440f6b420..afb3aaf93 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -25,32 +25,32 @@ class XiaMenVillageBatch extends BaseBatch{ def inFileName = "xmbank_"+monthStr+".xlsx" println "输入文件:"+inFileName+" 输出文件:"+outFileName def exists = checkFileExists(outFileName) -// if(!exists){ -// def rows = [] -// rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] -// def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) -// if(rets){ -// for(def row : rets){ -// if(row[1]){ -// def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) -// if(dto){ -// row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) -// if(dto.devDistrictName){ -// row[3] = dto.devDistrictName//开发区 -// }else{ -// row[3] = "" -// } -// -// } -// } -// rows << row -// } -// } -// uploadExcel(rows, outFileName) -// println "新增文件,上传已完成" -// }else{ -// println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") -// } + if(!exists){ + def rows = [] + rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] + def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) + if(rets){ + for(def row : rets){ + if(row[1]){ + def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) + if(dto){ + row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + if(dto.devDistrictName){ + row[3] = dto.devDistrictName//开发区 + }else{ + row[3] = "" + } + + } + } + rows << row + } + } + uploadExcel(rows, outFileName) + println "新增文件,上传已完成" + }else{ + println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + } } From 2e00a876a18bad4e47a7e8aa680ccb758738cc3f Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 17:53:23 +0800 Subject: [PATCH 66/67] test --- .../com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index afb3aaf93..22e4d41dd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -48,8 +48,10 @@ class XiaMenVillageBatch extends BaseBatch{ } uploadExcel(rows, outFileName) println "新增文件,上传已完成" + println "*******************************************************************************************" }else{ println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + println "*******************************************************************************************" } } From 03ceb6fed4611952d202ec29211b989af9919b0e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 9 Jan 2026 18:11:32 +0800 Subject: [PATCH 67/67] update --- .../gj/xiamen/XiaMenVillageBatch.groovy | 44 +++++++++++-------- .../com/fangjia/script/biz/DataTransfer.java | 2 +- .../fangjia/script/statistics/ApiUtil.java | 2 +- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy index 22e4d41dd..3a641d7b5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XiaMenVillageBatch.groovy @@ -26,29 +26,37 @@ class XiaMenVillageBatch extends BaseBatch{ println "输入文件:"+inFileName+" 输出文件:"+outFileName def exists = checkFileExists(outFileName) if(!exists){ - def rows = [] - rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] - def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) - if(rets){ - for(def row : rets){ - if(row[1]){ - def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) - if(dto){ - row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) - if(dto.devDistrictName){ - row[3] = dto.devDistrictName//开发区 - }else{ - row[3] = "" - } + def inExists = checkFileExists(inFileName) + if(inExists){ + def rows = [] + rows << ["序号","地址","判定后涉农组织类型(城市企业[不含县城企业]、农村企业、县城企业)","所属工业园区或经济开发区"] + def rets = XmBankVillageFtpUtils.readExcelFile(inFileName) + if(rets){ + for(def row : rets){ + if(row[1]){ + def dto = OpenApiUtils.addrVerifyXiameng(null, row[1], 2) + if(dto){ + row[2] = dto.addrArea //所属区域 农村区域 城市区域 县城城区(对公) + if(dto.devDistrictName){ + row[3] = dto.devDistrictName//开发区 + }else{ + row[3] = "" + } + } } + rows << row } - rows << row } + uploadExcel(rows, outFileName) + println "新增文件,上传已完成 "+DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + println "*******************************************************************************************" + }else{ + println "输入${inFileName}文件不存在,待客户上传 "+DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + println "*******************************************************************************************" } - uploadExcel(rows, outFileName) - println "新增文件,上传已完成" - println "*******************************************************************************************" + + }else{ println "已存在 "+ DateUtil.formatByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") println "*******************************************************************************************" diff --git a/projects/fangjia-script/src/main/java/com/fangjia/script/biz/DataTransfer.java b/projects/fangjia-script/src/main/java/com/fangjia/script/biz/DataTransfer.java index 73151adeb..e2f3b78c3 100644 --- a/projects/fangjia-script/src/main/java/com/fangjia/script/biz/DataTransfer.java +++ b/projects/fangjia-script/src/main/java/com/fangjia/script/biz/DataTransfer.java @@ -67,7 +67,7 @@ public class DataTransfer { DBObject q_43 = new BasicDBObject(); q_43.put("from_user_id", "1007497"); DBCursor cursor_43 = col_43.find(q_43).addOption(Bytes.QUERYOPTION_NOTIMEOUT).batchSize(500); - List db43List = new ArrayList<>(); + List db43List = new ArrayList(); while(cursor_43.hasNext()) { DBObject obj_43 = cursor_43.next(); if(obj_43 != null) { diff --git a/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/ApiUtil.java b/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/ApiUtil.java index 129465804..887d415c0 100644 --- a/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/ApiUtil.java +++ b/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/ApiUtil.java @@ -49,7 +49,7 @@ public class ApiUtil { String signature = ""; try { //参数排序,保证签名一致 - List fileds = new ArrayList<>(); + List fileds = new ArrayList(); Set> set = body.entrySet(); for (Entry entry : set) { fileds.add(entry.getKey());