新增POI抓取情况
This commit is contained in:
-3
@@ -69,9 +69,6 @@ public class ScoreExport {
|
|||||||
}
|
}
|
||||||
if (taskDetail.getRealityEndDate() != null && taskDetail.getRealityEndDate() > monthStartTime && taskDetail.getRealityEndDate() < endTime) {
|
if (taskDetail.getRealityEndDate() != null && taskDetail.getRealityEndDate() > monthStartTime && taskDetail.getRealityEndDate() < endTime) {
|
||||||
boolean find = false
|
boolean find = false
|
||||||
if (taskDetail.getResponse().getName() == '穆良书' && taskDetail.getName() == "模型级联算法方案设计") {
|
|
||||||
println('穆良书')
|
|
||||||
}
|
|
||||||
for (int i = 4; i < sortedResult[0].size(); i++) {
|
for (int i = 4; i < sortedResult[0].size(); i++) {
|
||||||
// 找到该项目下该负责人,则加工时
|
// 找到该项目下该负责人,则加工时
|
||||||
if (sortedResult[0][i] == taskDetail.getResponse().getName()) {
|
if (sortedResult[0][i] == taskDetail.getResponse().getName()) {
|
||||||
|
|||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.poi
|
||||||
|
|
||||||
|
import com.fangjia.script.temp.shenjian.util.MyStringUtils
|
||||||
|
import com.fangjia.script.util.ElasticUtils
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shenjian* @since 2021/7/7
|
||||||
|
*/
|
||||||
|
class StatisticsPoi {
|
||||||
|
static final cities = ["北京","上海","广州","深圳","重庆","郑州","长沙","西安","成都","东莞","佛山","杭州","合肥","南京",
|
||||||
|
"青岛","沈阳","苏州","天津","武汉","珠海","中山","长春","扬州","烟台","徐州","无锡","温州","太原",
|
||||||
|
"台州","石家庄","绍兴","厦门","泉州","宁波","南通","南宁","南昌","兰州","常州","大连","福州","贵阳",
|
||||||
|
"哈尔滨","海口","惠州","济南","嘉兴","金华","昆明","遵义","淄博","株洲","镇江","肇庆","漳州","湛江",
|
||||||
|
"岳阳","银川","宜昌","盐城","芜湖","乌鲁木齐","唐山","泰州","汕头","三亚","清远","秦皇岛","马鞍山","洛阳",
|
||||||
|
"柳州","连云港","廊坊","九江","吉林","淮安","湖州","呼和浩特","沧州","保定","安庆","张家口","西宁","日照",
|
||||||
|
"拉萨","锦州","大同","常德","北海","文昌","陵水","保亭"]
|
||||||
|
|
||||||
|
|
||||||
|
static final types = ['地铁', '公交', '医院', '写字楼', '学校', '银行', '大型超市', '商场', '餐饮', '旅游景点', '图书馆']
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
def result = []
|
||||||
|
|
||||||
|
result << ['城市', '数据量', '地铁', '公交', '医院', '写字楼', '学校', '银行', '大型超市', '商场', '餐饮', '旅游景点', '图书馆']
|
||||||
|
for (def city in cities) {
|
||||||
|
def ret = []
|
||||||
|
def total
|
||||||
|
String sql = "select count(*) total from amap_poi where cityname = '" + city + "' and status <> 1 "
|
||||||
|
ElasticUtils.executeSqlQuery(sql,{ data->
|
||||||
|
total = data.total
|
||||||
|
})
|
||||||
|
ret << city
|
||||||
|
ret << total
|
||||||
|
for (def type in types) {
|
||||||
|
def typeCode = SeaweedAroundPoi.KEYWORDS_MAP.get(type)
|
||||||
|
def typeCodeArr = typeCode.split("\\|")
|
||||||
|
String val = ""
|
||||||
|
String sqlType = ""
|
||||||
|
if (typeCodeArr[0].size() <= 4) {
|
||||||
|
val = MyStringUtils.joinLikeSql(typeCodeArr)
|
||||||
|
sqlType = "select count(*) total from amap_poi where cityname = '" + city + "' and (" + val + ") and status <> 1 "
|
||||||
|
} else {
|
||||||
|
val = MyStringUtils.joinInSql(typeCodeArr)
|
||||||
|
sqlType = "select count(*) total from amap_poi where cityname = '" + city + "' and typecode in (" + val + ") and status <> 1 "
|
||||||
|
}
|
||||||
|
|
||||||
|
ElasticUtils.executeSqlQuery(sqlType,{ data->
|
||||||
|
total = data.total
|
||||||
|
})
|
||||||
|
ret << total
|
||||||
|
}
|
||||||
|
result << ret
|
||||||
|
println(city)
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelUtils.write("F:\\工作\\房产估值模型及数据招标\\交付工作\\POI信息抓取情况总结.xlsx", result, "POI统计")
|
||||||
|
}
|
||||||
|
}
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.util
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcelFactory
|
||||||
|
import com.alibaba.excel.ExcelReader
|
||||||
|
import com.alibaba.excel.context.AnalysisContext
|
||||||
|
import com.alibaba.excel.event.AnalysisEventListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel¹¤¾ßÀà
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/15
|
||||||
|
*/
|
||||||
|
class ExcelUtils {
|
||||||
|
|
||||||
|
static List<List<String>> read(String filePath) {
|
||||||
|
SimpleExcelListener listener = new SimpleExcelListener(filePath);
|
||||||
|
ExcelReader excelReader = EasyExcelFactory.read(filePath, null, listener).headRowNumber(0).build();
|
||||||
|
excelReader.readAll()
|
||||||
|
List<List<String>> dataList = listener.getDataList();
|
||||||
|
excelReader.finish()
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SimpleExcelListener extends AnalysisEventListener {
|
||||||
|
|
||||||
|
private List<List<String>> dataList = new ArrayList<>()
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void invoke(Object o, AnalysisContext analysisContext) {
|
||||||
|
Map<String, String> map = o;
|
||||||
|
dataList.add(new ArrayList<String>(map.values()))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<List<String>> getDataList() {
|
||||||
|
return dataList
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDataList(List<List<String>> dataList) {
|
||||||
|
this.dataList = dataList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shenjian* @since 2021/7/7
|
||||||
|
*/
|
||||||
|
public class MyStringUtils {
|
||||||
|
|
||||||
|
public static joinSql(String[] str) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < str.size(); i++) {
|
||||||
|
sb.append("'").append(str[i]).append("'")
|
||||||
|
if (i != str.size() - 1) {
|
||||||
|
sb.append(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
public static joinInSql(String[] str) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < str.size(); i++) {
|
||||||
|
sb.append("'").append(str[i]).append("'")
|
||||||
|
if (i != str.size() - 1) {
|
||||||
|
sb.append(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
public static joinLikeSql(String[] str) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < str.size(); i++) {
|
||||||
|
sb.append(" typecode like '").append(str[i]).append("%' ")
|
||||||
|
if (i != str.size() - 1) {
|
||||||
|
sb.append(" or ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user