修改系统bug
This commit is contained in:
+35
-9
@@ -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, "数据")
|
||||
})
|
||||
+3
-3
@@ -11,8 +11,8 @@ import org.bson.Document
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
|
||||
MongoCollection<Document> 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()]
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ import org.bson.Document
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
|
||||
MongoCollection<Document> 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
|
||||
|
||||
+13
-12
@@ -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())
|
||||
//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))
|
||||
Reference in New Issue
Block a user