小区别名覆盖率统计
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.seaweed
|
||||||
|
|
||||||
|
import com.fangjia.script.lixue.util.DBUtils
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小区别名数量统计
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/4/15
|
||||||
|
*/
|
||||||
|
class SeaweedAliasExport {
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
def cities = ["重庆","苏州","昆明","柳州","曲靖","三明","达州","石狮","大理","福安","平潭","迪庆州"]
|
||||||
|
def result = []
|
||||||
|
result << ["城市", "小区数量", "别名数量", "别名覆盖率"]
|
||||||
|
for (def city : cities) {
|
||||||
|
def ret = []
|
||||||
|
|
||||||
|
DBObject query = new BasicDBObject();
|
||||||
|
query.put("city", city)
|
||||||
|
query.put("cat", "district")
|
||||||
|
query.put("visible", 0)
|
||||||
|
|
||||||
|
//def seaweedCount = DBUtils.seaweed.find(query).batchSize(5000).count()
|
||||||
|
|
||||||
|
int seaweedCount = 0;
|
||||||
|
int aliasCount = 0;
|
||||||
|
|
||||||
|
if (city == "平潭") {
|
||||||
|
query.put("city", "福州")
|
||||||
|
query.put("region", city)
|
||||||
|
}
|
||||||
|
if (city == "福安") {
|
||||||
|
query.put("city", "宁德")
|
||||||
|
query.put("region", city)
|
||||||
|
}
|
||||||
|
if (city == "石狮") {
|
||||||
|
query.put("city", "泉州")
|
||||||
|
query.put("region", city)
|
||||||
|
}
|
||||||
|
DBUtils.seaweed.find(query).batchSize(5000).each {obj ->
|
||||||
|
if (obj.alias) {
|
||||||
|
aliasCount++
|
||||||
|
}
|
||||||
|
seaweedCount++
|
||||||
|
}
|
||||||
|
|
||||||
|
ret[0] = city
|
||||||
|
ret[1] = seaweedCount
|
||||||
|
ret[2] = aliasCount
|
||||||
|
if (seaweedCount > 0) {
|
||||||
|
ret[3] = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, Double.valueOf(aliasCount) * 100 / Double.valueOf(seaweedCount))
|
||||||
|
}
|
||||||
|
result << ret
|
||||||
|
}
|
||||||
|
println(result)
|
||||||
|
ExcelUtils.write("F:\\数据\\小区别名覆盖率.xlsx", result, "统计")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user