From 3315ec5d3654097dc31e4a46bcf2a5963f96aec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Mon, 18 Oct 2021 15:53:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/AddressController.java | 2 +- .../fangjia/script/wenyan/temp/Price.groovy | 44 +++++++++++++++---- .../fangjia/script/wenyan/temp/QinLin.groovy | 6 +-- .../wenyan/temp/SiChuanJingCheng.groovy | 4 +- .../script/wenyan/temp/Test1122.groovy | 25 ++++++----- .../sql/EvaluationRateServiceImpl.java | 1 - 6 files changed, 54 insertions(+), 28 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java index 953611a47..708786087 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java @@ -2773,7 +2773,7 @@ public class AddressController { if(json.getInt("code")==200){ JSONObject resultJson = json.getJSONObject("result"); JSONObject searchAddress = resultJson.getJSONObject("searchAddress"); - if(resultJson.getInt("credit")>0){ + if(resultJson.getDouble("credit")>0){ District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district"); if(district != null){ resultMap.put("riskLevel","A"); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Price.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Price.groovy index b245cfec6..a60bd7b2b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Price.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Price.groovy @@ -1,16 +1,42 @@ package com.fangjia.script.wenyan.temp - +import com.fangjia.core.RegionData +import com.fangjia.core.util.MongoUtils +import com.fangjia.script.common.ServerAreaData +import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.DbUtils +import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient import com.mongodb.BasicDBObject +import net.sf.json.JSONObject -def data = [["城市", "区域", "小区名", "别名", "地址", "地址别名"]] -["ID", "北京", "重庆", "哈尔滨"].each {def city-> - DbUtils.seaweed.find(DbUtils.buildSeaweedQuery(city)).each {BasicDBObject district-> - def item = [district._id.toString(), district.city, district.region, district.name, district.alias?.join(","), district.address, district.addr_alias?.join(",")] - println(item) - data << item +//city_sell_stat = MongoUtils.getDbCollection("fangjia_stat", "city_sell_stat") +//data = [["城市", "202101", "202106"]] +//CommonUtils.findAllCity().each {def city-> +// BasicDBObject serverArea = ServerAreaData.getServerAreaByDisplay(city) +// if(!serverArea.ranking || !serverArea.ranking.toString().contains("县级行政单位")){ +// BasicDBObject pre = city_sell_stat.findOne(new BasicDBObject("city", city).append("date", 202101)) +// BasicDBObject now = city_sell_stat.findOne(new BasicDBObject("city", city).append("date", 202106)) +// println([serverArea.display, pre?.avg_price, now?.avg_price]) +// data << [serverArea.display, pre?.avg_price, now?.avg_price] +// } +//} +//ExcelUtils.write("D:\\城市均价数据.xlsx", data, "城市均价") + +//ExcelUtils.multiThreadingModify("C:\\Users\\wenyan\\Downloads\\经纬度错误数据修正.xlsx",{List item-> +// String city = item["B"] +// String region = RegionData.formatRegion(city, item["D"]) +// String sql = "select count(1) as count from latest_seawater where cat='sell' and city='${item["B"]}' and region='${region}' and district_name='${item["F"]}'" +// ElasticUtils.executeSqlQuery(sql,{Map result-> +// item["P"] = result.get("count") +// }) +// println(item) +//}) +ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Desktop\\装修案例.xlsx",{List item-> + JSONObject json = OpenApiClient.addressMatch("西安", item["H"], "property", false, item["C"]) + if(json.name){ + item["I"] = json.district + item["J"] = json.name } -} -ExcelUtils.write("D:\\待抓取小区.xlsx", data, "数据") \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy index ca851bcb7..785addef5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy @@ -11,8 +11,8 @@ import org.bson.Document import static com.mongodb.client.model.Filters.* MongoCollection OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log") -def startDate = DateUtil.parseDate("20210501", "yyyyMMdd") -def endDate = DateUtil.parseDate("20210601", "yyyyMMdd") +def startDate = DateUtil.parseDate("20210901", "yyyyMMdd") +def endDate = DateUtil.parseDate("20211001", "yyyyMMdd") Calendar calendar = Calendar.getInstance() calendar.setTime(startDate) def count = 0 @@ -22,7 +22,7 @@ while (startDate.before(endDate)) { calendar.add(Calendar.DATE, 1) def nextDate = calendar.getTime() count++ - OPEN_URI_LOG.find(and(eq("user_id", "1007757"), eq("request_uri", "/property/detail"), eq("data_status", 1), lt("c_date", nextDate), gte("c_date", startDate))).each { Document doc -> + OPEN_URI_LOG.find(and(eq("user_id", "1007705"), eq("request_uri", "/property/detail"), eq("data_status", 1), lt("c_date", nextDate), gte("c_date", startDate))).each { Document doc -> def result = JSONObject.fromObject(doc.res_map.result) if (!hashSet.contains(result)) { def item = ["60a3202c0b42a00001aad385", "qlkjgx", doc.ip, doc.request_uri, doc.c_date.format("yyyy-MM-dd HH:mm:ss"), doc.data_status, doc.code, doc.msg, JSONObject.fromObject(doc.parameter_map).toString(), result.toString()] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/SiChuanJingCheng.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/SiChuanJingCheng.groovy index 82cf47113..8243bde22 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/SiChuanJingCheng.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/SiChuanJingCheng.groovy @@ -11,8 +11,8 @@ import org.bson.Document import static com.mongodb.client.model.Filters.* MongoCollection OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log") -def startDate = DateUtil.parseDate("20210601", "yyyyMMdd") -def endDate = DateUtil.parseDate("20210701", "yyyyMMdd") +def startDate = DateUtil.parseDate("20210901", "yyyyMMdd") +def endDate = DateUtil.parseDate("20211001", "yyyyMMdd") Calendar calendar = Calendar.getInstance() calendar.setTime(startDate) def count = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test1122.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test1122.groovy index 6909f23a1..ec3f9affa 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test1122.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test1122.groovy @@ -261,15 +261,16 @@ import org.dom4j.io.SAXReader // data << [dbo.parameter_map.city, dbo.parameter_map.address, dbo.res_map.result.province, dbo.res_map.result.city, dbo.res_map.result.district, dbo.res_map.result.developmentZone, dbo.res_map.result.township, dbo.res_map.result.street,dbo.res_map.result.streetNumber,dbo.res_map.result.name,dbo.res_map.result.buildingNumber,dbo.res_map.result.unitNumber,dbo.res_map.result.roomNumber,dbo.res_map.result.formattedAddress] //} //ExcelUtils.write("D:\\建行测试地址.xlsx", data, "结果") -DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com") -def query = new BasicDBObject() -query.cat = "region" -query.city= "上海" -query.weekend = Date.parse("yyyyMMdd", "20210228") -def doc = [] -def prices = [] -SQMETRE_RENT_COLL.find(query, new BasicDBObject("region", 1).append("avg_price", 1)).each { - doc.add(new BasicDBObject("name", it.region+"区").append("value", it.avg_price)) - prices << it.avg_price -} -println(JSONArray.fromObject(doc).toString()) \ No newline at end of file +//DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com") +//def query = new BasicDBObject() +//query.cat = "region" +//query.city= "上海" +//query.weekend = Date.parse("yyyyMMdd", "20210228") +//def doc = [] +//def prices = [] +//SQMETRE_RENT_COLL.find(query, new BasicDBObject("region", 1).append("avg_price", 1)).each { +// doc.add(new BasicDBObject("name", it.region+"区").append("value", it.avg_price)) +// prices << it.avg_price +//} +//println(JSONArray.fromObject(doc).toString()) +DbUtils.seaweed.remove(new BasicDBObject("_id", DbUtils.seaweed.findById("6103bf1c64baf60001e7e1d0")._id)) \ No newline at end of file diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/sql/EvaluationRateServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/sql/EvaluationRateServiceImpl.java index 3310cce53..4c6147db6 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/sql/EvaluationRateServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/sql/EvaluationRateServiceImpl.java @@ -912,7 +912,6 @@ public class EvaluationRateServiceImpl implements EvaluationRateService { evaluatePrice = (long) (evaluatePrice * houseFloorRate); } }else{ - int mid = evaluation.getHeight()/2; double num = getFloorRate(mid, flag); evaluatePrice = (long) (evaluatePrice * num * houseFloorRate);