From e6a0da2452e2774f83fb15570e0f3813b149e38e Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Fri, 27 May 2022 09:05:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/script/temp/shenjian/poi/SeaweedPoiDetail.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedPoiDetail.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedPoiDetail.groovy index 3ae943007..ea6d9cc67 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedPoiDetail.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedPoiDetail.groovy @@ -81,6 +81,9 @@ class SeaweedPoiDetail { if (CollectionUtils.isEmpty(pois)) { pois = GaoDeUtils.searchPoi(city, name, region, typecodes) } + if (CollectionUtils.isEmpty(pois)) { + pois = GaoDeUtils.searchPoi(city, address, region, typecodes) + } List detailList = CommonDtoUtils.transformListV(AmapPoiDetail.class, pois); // for (AmapPoi amapPoi : pois) { From 95cd48bc06c71c334b287a065665e8dda9ce6aed Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 30 May 2022 20:59:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=93=E5=8F=96=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=B0=8F=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/poi/GetPoiFromExcel.groovy | 19 ++++++++++++------- .../temp/shenjian/util/GaoDeUtils.groovy | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy index bd49875b0..f9b073743 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy @@ -2,6 +2,8 @@ package com.fangjia.script.temp.shenjian.poi import com.alibaba.fastjson.JSONObject import com.fangjia.script.statistics.poi.AmapPoi +import com.fangjia.script.statistics.poi.AmapPoiDetail +import com.fangjia.script.temp.shenjian.util.CommonDtoUtils import com.fangjia.script.temp.shenjian.util.ExcelUtils import com.fangjia.script.temp.shenjian.util.GaoDeUtils import com.fangjia.script.temp.shenjian.util.HttpUtils @@ -14,13 +16,15 @@ 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 final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoiDetail" + // 住宅类 + static final String typecodes = "120000|120100|120200|120201|120202|120203|120300|120301|120302|120303|120304"; static void main(String[] args) { AtomicLong atomicLong = new AtomicLong(0) //List fileList = FileUtils.listFiles(new File("D:\\Users\\Domi\\Desktop\\房价网\\项目\\建行\\模型级联\\POI"), null, false); - List fileList = FileUtils.listFiles(new File("D:\\Users\\Domi\\Desktop\\房价网\\项目\\建行\\模型级联\\高德反查无ID"), null, false); + List fileList = FileUtils.listFiles(new File("D:\\Users\\Domi\\Documents\\知识库\\建行\\审核小区"), null, false); for (File file : fileList) { List> seaweeds = ExcelUtils.read(file.getPath()) for (List infoTemp : seaweeds) { @@ -28,12 +32,13 @@ class GetPoiFromExcel { executorService.submit(new Runnable() { @Override void run() { - String city = info.get(0) - String region = info.get(1) - String seaweedName = info.get(2) - List pois = GaoDeUtils.searchPoi(city, seaweedName, region, "120300|120301|120302"); + String city = info.get(1) + String region = info.get(2) + String seaweedName = info.get(3) + List pois = GaoDeUtils.searchPoi(city, seaweedName, region, typecodes); if (CollectionUtils.isNotEmpty(pois)) { - String jsonStr = JSONObject.toJSONString(pois) + List detailList = CommonDtoUtils.transformListV(AmapPoiDetail.class, pois); + String jsonStr = JSONObject.toJSONString(detailList) HttpUtils.postForJson(URL, jsonStr) atomicLong.incrementAndGet() } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index ea456aa50..6b880c5ea 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger class GaoDeUtils { // 新获取key - def static GAO_DE_AK = ["4ccfe3c898a9489884bd2bcb1ef6dcde", "4e9592208336433ee1b7aa4d1d434418"] + def static GAO_DE_AK = ["4e9592208336433ee1b7aa4d1d434418"] def static AtomicInteger keyUsed = new AtomicInteger(0) def static codeNameMap = new HashMap(){{ From e97f28e23965fd13bf8942046682b083eab006e4 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 1 Jun 2022 10:24:53 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shenjian/didata/MatchFromExcel.groovy | 26 +++++++++++++++++++ .../temp/shenjian/poi/GetPoiFromExcel.groovy | 6 ++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy new file mode 100644 index 000000000..20de59c5f --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy @@ -0,0 +1,26 @@ +package com.fangjia.script.temp.shenjian.didata + +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient + +/** + * 从excel中匹配出 + */ +ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识库\\地数\\数据建设\\待审核小区(地图匹配).xlsx", { row -> + def city = row['A'] + def region = row['B'] + def district_name = row['C'] + + def gaodeRegion = row['H'] + def gaodeName = row['I'] + + def jsonObject = OpenApiClient.addressMatch(city, null, "district", false, region, district_name, "strict") + if (jsonObject != null && jsonObject.precise != -1) { + row['D'] = jsonObject.get("name") + } + + def jsonObject2 = OpenApiClient.addressMatch(city, null, "district", false, gaodeRegion, gaodeName, "strict") + if (jsonObject != null && jsonObject.precise != -1) { + row['J'] = jsonObject.get("name") + } +}); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy index f9b073743..235d779e4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromExcel.groovy @@ -32,9 +32,9 @@ class GetPoiFromExcel { executorService.submit(new Runnable() { @Override void run() { - String city = info.get(1) - String region = info.get(2) - String seaweedName = info.get(3) + String city = info.get(0) + String region = info.get(1) + String seaweedName = info.get(2) List pois = GaoDeUtils.searchPoi(city, seaweedName, region, typecodes); if (CollectionUtils.isNotEmpty(pois)) { List detailList = CommonDtoUtils.transformListV(AmapPoiDetail.class, pois); From 620bf0f8d8d71619310b0dd2193d4543eccdbd14 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 1 Jun 2022 10:28:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/temp/shenjian/didata/MatchFromExcel.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy index 20de59c5f..6cf7730ee 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/didata/MatchFromExcel.groovy @@ -14,13 +14,15 @@ ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识 def gaodeRegion = row['H'] def gaodeName = row['I'] - def jsonObject = OpenApiClient.addressMatch(city, null, "district", false, region, district_name, "strict") + def jsonObject = OpenApiClient.addressMatch(city, district_name, "district", false, region, district_name, "strict") if (jsonObject != null && jsonObject.precise != -1) { row['D'] = jsonObject.get("name") } - def jsonObject2 = OpenApiClient.addressMatch(city, null, "district", false, gaodeRegion, gaodeName, "strict") - if (jsonObject != null && jsonObject.precise != -1) { - row['J'] = jsonObject.get("name") + if (gaodeRegion && gaodeName) { + def jsonObject2 = OpenApiClient.addressMatch(city, gaodeName, "district", false, gaodeRegion, gaodeName, "strict") + if (jsonObject2 != null && jsonObject2.precise != -1) { + row['J'] = jsonObject2.get("name") + } } });