获取excel小区最新poi信息
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.poi
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.fangjia.script.statistics.poi.AmapPoi
|
||||||
|
import com.fangjia.script.temp.shenjian.util.ExcelUtils
|
||||||
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
|
import com.fangjia.script.temp.shenjian.util.HttpUtils
|
||||||
|
import org.apache.commons.collections.CollectionUtils
|
||||||
|
import org.apache.commons.io.FileUtils
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
|
||||||
|
class GetPoiFromExcel {
|
||||||
|
|
||||||
|
static final def URL = "http://192.168.0.216:38080/FangJiaDataService/saveAmapPoi"
|
||||||
|
static final ExecutorService executorService = Executors.newFixedThreadPool(10)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
AtomicLong atomicLong = new AtomicLong(0)
|
||||||
|
List<File> fileList = FileUtils.listFiles(new File("D:\\Users\\Domi\\Desktop\\房价网\\项目\\建行\\模型级联\\POI"), null, false);
|
||||||
|
for (File file : fileList) {
|
||||||
|
List<List<String>> seaweeds = ExcelUtils.read(file.getPath())
|
||||||
|
final cityTemp = file.getName().substring(0, file.getName().indexOf("高德"))
|
||||||
|
for (List<String> infoTemp : seaweeds) {
|
||||||
|
final List<String> info = infoTemp
|
||||||
|
executorService.submit(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
String city = cityTemp
|
||||||
|
String region = info.get(2)
|
||||||
|
String seaweedName = info.get(3)
|
||||||
|
List<AmapPoi> pois = GaoDeUtils.searchPoi(city, seaweedName, region, "120300|120301|120302");
|
||||||
|
if (CollectionUtils.isNotEmpty(pois)) {
|
||||||
|
String jsonStr = JSONObject.toJSONString(pois)
|
||||||
|
HttpUtils.postForJson(URL, jsonStr)
|
||||||
|
atomicLong.incrementAndGet()
|
||||||
|
}
|
||||||
|
synchronized (this) {
|
||||||
|
if (atomicLong.intValue() % 500 == 0) {
|
||||||
|
println(atomicLong.intValue())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
executorService.shutdown()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user