补充学校经纬度
This commit is contained in:
+21
-9
@@ -5,6 +5,9 @@ import com.fangjia.script.temp.shenjian.util.EsUtils
|
||||
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
/**
|
||||
* ²¹³äѧУ¾Î³¶È
|
||||
* @author shenjian
|
||||
@@ -12,16 +15,25 @@ import com.fangjia.script.util.ElasticUtils
|
||||
*/
|
||||
class FillLngLat {
|
||||
|
||||
static ExecutorService executorService = Executors.newFixedThreadPool(4)
|
||||
static void main(String[] args) {
|
||||
ElasticUtils.executeSqlQuery("select * from dws_poi where location is null", { data ->
|
||||
println(data)
|
||||
def lngLat = GaoDeUtils.parserByGaode(data.city, data.region + data.name + data.address)
|
||||
if (lngLat != null && lngLat.size() == 2 ) {
|
||||
JSONObject jsonObject = new JSONObject()
|
||||
jsonObject.put("lon", Double.valueOf(lngLat['lng']))
|
||||
jsonObject.put("lat", Double.valueOf(lngLat['lat']))
|
||||
EsUtils.bulkUpdateFieldByIds("dws_poi", "location", jsonObject, Arrays.asList(data.source_id))
|
||||
}
|
||||
ElasticUtils.executeSqlQuery("select * from dws_poi where location is null", { dataT ->
|
||||
final def data = dataT
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
println(data)
|
||||
def lngLat = GaoDeUtils.parserByGaode(data.city, data.region + data.name + data.address)
|
||||
if (lngLat != null && lngLat.size() == 2 ) {
|
||||
JSONObject jsonObject = new JSONObject()
|
||||
jsonObject.put("lon", Double.valueOf(lngLat['lng']))
|
||||
jsonObject.put("lat", Double.valueOf(lngLat['lat']))
|
||||
EsUtils.bulkUpdateFieldByIds("dws_poi", "location", jsonObject, Arrays.asList(data.source_id))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
executorService.shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user