添加街道字段

This commit is contained in:
2021-05-18 12:51:48 +08:00
parent 947853db4d
commit c363a8d0ca
3 changed files with 71 additions and 39 deletions
@@ -671,7 +671,7 @@ public class PropertyController {
&& !"1007486".equals(userId) && !"1007533".equals(userId) && !"1007630".equals(userId) && !"1007486".equals(userId) && !"1007533".equals(userId) && !"1007630".equals(userId)
&& !"1007705".equals(userId) && !"1007739".equals(userId) && !"1007736".equals(userId) && !"1007705".equals(userId) && !"1007739".equals(userId) && !"1007736".equals(userId)
&& !"1007741".equals(userId) && !"1007742".equals(userId) && !"1007743".equals(userId) && !"1007741".equals(userId) && !"1007742".equals(userId) && !"1007743".equals(userId)
&& !"1007747".equals(userId) && !"1007747".equals(userId) && !"1007757".equals(userId)
&& model.getDetailLevel() != null && model.getDetailLevel() != 0) {// 临时权限控制 && model.getDetailLevel() != null && model.getDetailLevel() != 0) {// 临时权限控制
mav.setModel(BasicModel.buildUnAuthorizedModel()); mav.setModel(BasicModel.buildUnAuthorizedModel());
return mav; return mav;
@@ -4,6 +4,7 @@ import com.fangjia.core.ProvinceData
import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DataUtil import com.fangjia.script.util.DataUtil
import com.fangjia.script.util.DbUtils import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
@@ -11,45 +12,71 @@ import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import net.sf.json.JSONObject import net.sf.json.JSONObject
import org.apache.commons.lang.StringUtils import org.apache.commons.lang.StringUtils
DBCollection SEAWEED_TOWNSHIP = MongoUtils.getCollectionByName("fangjia_base", "seaweed_township", "192.168.0.235", 27018) //DBCollection SEAWEED_TOWNSHIP = MongoUtils.getCollectionByName("fangjia_base", "seaweed_township", "192.168.0.235", 27018)
def count = 0 //def count = 0
List<List<String>> data = Collections.synchronizedList([]) //List<List<String>> data = Collections.synchronizedList([])
data << ["ID","城市","区域","小区名","经度","纬度","街道"] //data << ["ID","城市","区域","小区名","经度","纬度","街道"]
//
//CommonUtils.findAllCity().each {def city->
// DbUtils.multiThreadingExecuteQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item->
// if(StringUtils.isBlank(item.township) && item.lng){
// count++
// def lng = item.lng/10000000000d
// def lat = item.lat/10000000000d
// def location = "${lng},${lat}"
// JSONObject resp = GaoDeApiUtils.geocode(location)
// def row = []
// row << item._id.toString()
// row << item.city
// row << item.region
// row << item.name
// row << lng
// row << lat
// BasicDBObject dbo = new BasicDBObject()
// dbo.id = item._id.toString()
// dbo.city = item.city
// dbo.region = item.region
// dbo.name = item.name
// dbo.lng = lng
// dbo.lat = lat
// if(resp.regeocode && resp.regeocode.addressComponent && resp.regeocode.addressComponent.township){
// row << resp.regeocode.addressComponent.township
// dbo.township = resp.regeocode.addressComponent.township
// }
// println(row)
// data << row
// SEAWEED_TOWNSHIP.insert(dbo)
// }
// })
//}
//ExcelUtils.write("D:\\街道补充数据.xlsx", data, "补充数据")
CommonUtils.findAllCity().each {def city-> //ExcelUtils.modify("D:\\街道补充数据.xlsx",{List item ->
DbUtils.multiThreadingExecuteQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item-> // if(item["G"] && item["H"] == null){
if(StringUtils.isBlank(item.township) && item.lng){ // DbUtils.seaweed.update(new BasicDBObject("_id", item["A"]), new BasicDBObject('$set', new BasicDBObject('township', item["G"])))
count++ // }
def lng = item.lng/10000000000d // println(item)
def lat = item.lat/10000000000d //})
def location = "${lng},${lat}"
JSONObject resp = GaoDeApiUtils.geocode(location) //ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\错误经纬度.xlsx",{List item->
def row = [] // def location = "${item["A"]},${item["B"]}"
row << item._id.toString() // JSONObject resp = GaoDeApiUtils.geocode(location)
row << item.city // if(resp.regeocode && resp.regeocode.formatted_address){
row << item.region // item['G'] = resp.regeocode.formatted_address
row << item.name // println(item)
row << lng // }
row << lat //})
BasicDBObject dbo = new BasicDBObject()
dbo.id = item._id.toString() //def count = 0
dbo.city = item.city //CommonUtils.findAllCity().each {def city->
dbo.region = item.region // DbUtils.executeQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item->
dbo.name = item.name // if(item.township){
dbo.lng = lng // count++
dbo.lat = lat // }
if(resp.regeocode && resp.regeocode.addressComponent && resp.regeocode.addressComponent.township){ // }, new BasicDBObject("township", 1))
row << resp.regeocode.addressComponent.township //}
dbo.township = resp.regeocode.addressComponent.township //println(count)
}
println(row) ElasticUtils.executeSqlQuery("select count(*), p_date from seawater where p_date > 20210501 group by p_date",{
data << row println(it)
SEAWEED_TOWNSHIP.insert(dbo)
}
}) })
}
ExcelUtils.write("D:\\街道补充数据.xlsx", data, "补充数据")
@@ -9,6 +9,11 @@ import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject import net.sf.json.JSONObject
def strt(String addr){
}
ExcelUtils.modify("D:\\nextcloud\\数据\\地址类服务测试\\建行地址相似度评级测试.xlsx",{List item-> ExcelUtils.modify("D:\\nextcloud\\数据\\地址类服务测试\\建行地址相似度评级测试.xlsx",{List item->
def city = item["A"] def city = item["A"]
def address1 = item["B"] def address1 = item["B"]