diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/TongCheng.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/TongCheng.groovy new file mode 100644 index 000000000..a0e5faf71 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/TongCheng.groovy @@ -0,0 +1,151 @@ +package com.fangjia.script.wenyan + +import com.fangjia.core.util.Mongo3Utils +import com.fangjia.core.util.MongoUtils +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.fangjia.script.yinjihaun.amap.GaoDeApiUtils +import com.mongodb.BasicDBObject +import net.sf.json.JSONArray +import net.sf.json.JSONObject +import org.bson.Document + +//def data = ExcelUtils.read("D:\\Users\\wenyan\\Downloads\\TC重新跑数据.xlsx") +//def addMap = [:] +//data.each {def list-> +// if(list["C"] == "有效"){ +// addMap[list["B"]] = list +// } +//} +//ExcelUtils.modify("D:\\Users\\wenyan\\Downloads\\data_gj20220616.xlsx",{List item-> +// if(addMap.containsKey(item["B"])){ +// List list = addMap.get(item["B"]) +// item["C"] = list["D"] +// item["D"] = list["E"] +// item["E"] = list["F"] +// item["S"] = "有效" +// println(item) +// } +//}) + +def DISTRICT_ANALY_DATA = Mongo3Utils.getDbCollection("fangjia_stat", "district_analy_data") +ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\data_gj20220616.xlsx", { List item -> +// if(item["S"] == null){ +// if(item["Q"] != null || item["R"] != null){ +// item["S"] = "有效" +// } +// } +// if(item["S"] == null){ +// def source = null +// JSONObject resp = OpenApiClient.addressMatch(item["A"], item["B"], "property") +// source = "小区库" +// if(resp.credit == 0){ +// resp = OpenApiClient.addressMatch(item["A"], item["B"], null) +// source = "小区库" +// } +// if(resp.credit == 0){ +// resp = OpenApiClient.addressMatch(item["A"], item["B"], null, true) +// source = "地图" +// } +// +// if(resp.credit > 0){ +// println(resp) +// item["C"] = resp.city +// item["D"] = resp.district +// item["E"] = resp.name +// item["F"] = source +// item["G"] = resp.lng +// item["H"] = resp.lat +// item["I"] = resp.propertyType +// } +// if(item["G"] != null && !["普通住宅", "商住", "别墅"].contains(item["I"])){ +// List seaweeds = DbUtils.findAroundDistrict(item["G"], item["H"], 1000 ,1, 2) +// if(seaweeds.size() > 0){ +// BasicDBObject s = seaweeds[0] +// item["C"] = s.city +// item["D"] = s.region +// item["E"] = s.name +// item["F"] = "周边" +// item["G"] = s.lng/10000000000d +// item["H"] = s.lat/10000000000d +// item["I"] = s.estate_type2 +// } +// } +// } + + + +// if(item["S"]|| item["T"]){ +// if(!item["i"]){ +// JSONObject result = GaoDeApiUtils.geo(item["A"], item["B"]) +// if(result != null && result.getInt("status") == 1){ +// JSONArray geocodes = result.getJSONArray("geocodes"); +// if(geocodes != null && geocodes.size() > 0){ +// JSONObject geocode = geocodes.getJSONObject(0); +// String location = geocode.getString("location") +// item["i"] = location.split(",")[0].toDouble() +// item["j"] = location.split(",")[1].toDouble() +// } +// } +// println(item) +// } +// } +// if(item["D"] == null && item["F"] != null){ +// String kw = item["F"] +// if(item["E"]){ +// kw = item["E"] + kw +// } +// JSONObject result = GaoDeApiUtils.geo(item["A"], kw) +// if(result != null && result.getInt("status") == 1){ +// JSONArray geocodes = result.getJSONArray("geocodes"); +// if(geocodes != null && geocodes.size() > 0){ +// JSONObject geocode = geocodes.getJSONObject(0); +// String location = geocode.getString("location") +// item["i"] = location.split(",")[0].toDouble() +// item["j"] = location.split(",")[1].toDouble() +// } +// } +// println(item) +// } +// if(item["E"] != null && ["普通住宅", "商住", "别墅"].contains(item["I"])){ +// Document doc = DISTRICT_ANALY_DATA.find(new Document("city", item["C"]).append("region", item["D"]).append("district_name", item["E"])).first() +// if(doc){ +// item["N"] =doc["rank"] +// } +// } +// if (item["S"] != "有效" || item["F"] != null) { +// return +// } +// JSONObject resp = OpenApiClient.addressMatch(item["A"], item["E"], "property", false, item["D"], null, "strict") +// if(resp.credit > 0){ +// println(resp) +// item["C"] = resp.city +// item["D"] = resp.district +// item["E"] = resp.name +// item["F"] = "小区库" +// item["G"] = resp.lng +// item["H"] = resp.lat +// item["I"] = resp.propertyType +// } +// println(resp) +// if (item["F"] == null) { +// String kw = item["E"] +// if (item["D"]) { +// kw = item["D"] + kw +// } +// JSONObject result = GaoDeApiUtils.geo(item["A"], kw) +// if (result != null && result.getInt("status") == 1) { +// JSONArray geocodes = result.getJSONArray("geocodes"); +// if (geocodes != null && geocodes.size() > 0) { +// JSONObject geocode = geocodes.getJSONObject(0); +// String location = geocode.getString("location") +// item["G"] = location.split(",")[0].toDouble() +// item["H"] = location.split(",")[1].toDouble() +// item["F"] = "反查经纬度" +// } +// } +// println(item) +// } +})