小区字段修改
This commit is contained in:
+9
-4
@@ -5137,17 +5137,22 @@ class CommonDatautils {
|
|||||||
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q, keys).batchSize(5000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q, keys).batchSize(5000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||||
def townMap = [:]
|
def townMap = [:]
|
||||||
for(def d : dbcursor){
|
for(def d : dbcursor){
|
||||||
|
def distName = null
|
||||||
if(d.mzb_district_name){
|
if(d.mzb_district_name){
|
||||||
def list = townMap.get(d.mzb_district_name)
|
distName = d.mzb_district_name
|
||||||
|
}else{
|
||||||
|
distName = d.district
|
||||||
|
}
|
||||||
|
if(distName){
|
||||||
|
def list = townMap.get(distName)
|
||||||
if(!list){
|
if(!list){
|
||||||
list = []
|
list = []
|
||||||
}
|
}
|
||||||
list << d
|
list << d
|
||||||
townMap.put(d.mzb_district_name, list)
|
townMap.put(distName, list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// println "[${city}] 乡镇街道 加载完成 "+new Date().format("yyyy-MM-dd HH:mm:ss")
|
||||||
println "[${city}] 乡镇街道 加载完成 "+new Date().format("yyyy-MM-dd HH:mm:ss")
|
|
||||||
return townMap
|
return townMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+75
-1
@@ -26,7 +26,8 @@ class EsMonthHouseStat {
|
|||||||
// task.statHouseUpdateCount()
|
// task.statHouseUpdateCount()
|
||||||
|
|
||||||
// task.statDistHouse()
|
// task.statDistHouse()
|
||||||
task.statRent()
|
// task.statRent()
|
||||||
|
task.statOfficeHouse()
|
||||||
}
|
}
|
||||||
|
|
||||||
def statRent(){
|
def statRent(){
|
||||||
@@ -201,6 +202,51 @@ class EsMonthHouseStat {
|
|||||||
},0)
|
},0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def statOfficeHouse(){
|
||||||
|
def citys = CommonDatautils.findAllCity()
|
||||||
|
def allLists = []
|
||||||
|
allLists << ["城市", "近一年写字楼出售量", "写字楼量", "近一年出售房源量大于3的写字楼量", "大于3写字楼量占比"]
|
||||||
|
citys.each{c->
|
||||||
|
def count = findHouseCountByCat(c, "office_sell",20240101, 20250201)
|
||||||
|
|
||||||
|
def districts = CommonDatautils.findAllDistricts(c, "office", ["city", "region", "name", "alias"]);
|
||||||
|
def disthouseCount = 0
|
||||||
|
for(def dist : districts){
|
||||||
|
def alias = []
|
||||||
|
if(dist.alias){
|
||||||
|
if(!dist.alias.contains(dist.name)){
|
||||||
|
dist.alias << dist.name
|
||||||
|
}
|
||||||
|
alias = dist.alias
|
||||||
|
}else{
|
||||||
|
alias << dist.name
|
||||||
|
}
|
||||||
|
|
||||||
|
def distCount = 0
|
||||||
|
if(count){
|
||||||
|
distCount = findHouseCountByCat(dist.city, dist.region, alias, 20240101, 20250201, "office_sell")
|
||||||
|
if(distCount && distCount>=3){
|
||||||
|
disthouseCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// println dist.city+" "+dist.region+" "+dist.name+" "+distCount
|
||||||
|
}
|
||||||
|
|
||||||
|
println "disthouseCount:"+disthouseCount
|
||||||
|
// println districts.size()
|
||||||
|
def precent = 0
|
||||||
|
if(districts){
|
||||||
|
precent = DataHandleUtils.getDoubleRound(2, disthouseCount*100.0/districts.size())
|
||||||
|
}
|
||||||
|
def row = [c , count, districts.size(), disthouseCount, precent+"%"]
|
||||||
|
println row
|
||||||
|
allLists << row
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelUtils.write("D:\\数据\\写字楼\\全国写字楼情况占比统计.xlsx", allLists, "写字楼情况")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def findHouseCount(def city, def region, def alias, def startDate, def endDate){
|
def findHouseCount(def city, def region, def alias, def startDate, def endDate){
|
||||||
def aliasStr = null;
|
def aliasStr = null;
|
||||||
@@ -219,6 +265,23 @@ class EsMonthHouseStat {
|
|||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def findHouseCountByCat(def city, def region, def alias, def startDate, def endDate, cat){
|
||||||
|
def aliasStr = null;
|
||||||
|
def total = 0
|
||||||
|
try{
|
||||||
|
aliasStr = escapeExprSpecialWord(alias.join("','"))
|
||||||
|
String sql = "select count(*) as c from latest_seawater where cat='${cat}' and city='${city}' and p_date >= ${startDate} and p_date<${endDate} and region='${region}' and district_name in ('${aliasStr}') "
|
||||||
|
|
||||||
|
ElasticUtils.executeSqlQuery(sql,{data->
|
||||||
|
total = data.c
|
||||||
|
})
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转义字符串中的特殊字符
|
* 转义字符串中的特殊字符
|
||||||
* 仅过滤Lucene regexps, 其他的勿用
|
* 仅过滤Lucene regexps, 其他的勿用
|
||||||
@@ -240,6 +303,17 @@ class EsMonthHouseStat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def findHouseCountByCat(def city, def cat, def startDate, def endDate){
|
||||||
|
|
||||||
|
String sql = "select count(*) as c from latest_seawater where cat='${cat}' and city='${city}' and p_date >= ${startDate} and p_date<${endDate} "
|
||||||
|
def total = 0
|
||||||
|
ElasticUtils.executeSqlQuery(sql,{ data->
|
||||||
|
total = data.c
|
||||||
|
})
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user