From f7f5ad1acf81f209424714c4fd8c3aef945b4f82 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 24 Jan 2022 11:11:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=88=BF=E9=87=91?= =?UTF-8?q?=E9=83=A8=E8=87=AA=E5=8A=A8=E6=A3=80=E6=B5=8B=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/temp/shenjian/SnapshotMonitor.groovy | 2 ++ .../script/temp/shenjian/poi/GetPoiFromExcel.groovy | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/SnapshotMonitor.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/SnapshotMonitor.groovy index fecb21729..e638088fe 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/SnapshotMonitor.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/SnapshotMonitor.groovy @@ -19,6 +19,8 @@ class SnapshotMonitor extends BaseBatch { // 运维组 运维警报 static final access_token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c" + // 房金部自动检测机器人 + // https://oapi.dingtalk.com/robot/send?access_token=1b6d0d782d3c316f2d3b6b18ea5144816170dd392befbf2042a24a01fb84b736 static void main(String[] args) { runBatch(new SnapshotMonitor(), args) 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 d2644582e..bd49875b0 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 @@ -19,18 +19,18 @@ class GetPoiFromExcel { 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\\房价网\\项目\\建行\\模型级联\\POI"), null, false); + List fileList = FileUtils.listFiles(new File("D:\\Users\\Domi\\Desktop\\房价网\\项目\\建行\\模型级联\\高德反查无ID"), null, false); for (File file : fileList) { List> seaweeds = ExcelUtils.read(file.getPath()) - final cityTemp = file.getName().substring(0, file.getName().indexOf("高德")) for (List infoTemp : seaweeds) { final List info = infoTemp executorService.submit(new Runnable() { @Override void run() { - String city = cityTemp - 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, "120300|120301|120302"); if (CollectionUtils.isNotEmpty(pois)) { String jsonStr = JSONObject.toJSONString(pois) From b79d97fcb77247f083ce1b68eac5bef8b758bf8a Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 21 Feb 2022 11:36:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=89=8D=E6=B5=B7?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/qianhai/QianhaiTest.groovy | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy new file mode 100644 index 000000000..b0b4e16c2 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy @@ -0,0 +1,89 @@ +package com.fangjia.script.temp.shenjian.qianhai + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.CommonUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient +import com.fangjia.script.xingyebank.CityUtil +import net.sf.json.JSONObject +import org.apache.commons.lang.StringUtils + +ExcelUtils.multiThreadingModify("D:\\数据\\前海\\前海征信测试数据test.xlsx",{List item-> + + if(StringUtils.isBlank(item['B'])){ + return; + } + HttpRequest request = new HttpRequest() + def params = [:] + params["address"] = item['B'] + params["city"] = getCityFormAddress(item['B']) + params["token"] = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + JSONObject json = request.getJsonContent("http://open.fangjia.com/qhzx/propertyDetail", params, "UTF-8") + + if(json.code == 200 && json.result){ + JSONObject result = json.result + item['C'] = CityUtil.getProvinceByCity(result.city) + item['D'] = result.city + item['E'] = result.district + item['F'] = result.name + if (result.name) { + item['O'] = '住宅地址' + } else { + item['O'] = '非住宅地址' + } + item['G'] = result.address + item['H'] = result.lng + item['I'] = result.lat + + // 小区均价查询 + int avgPrice = OpenApiClient.queryDistrictAvgPrice(result.city,result.district,result.name) + if(avgPrice > 0){ + item['M'] = avgPrice + } + params.clear() + params["city"] = result.city + params["district"] = result.district + params["name"] = result.name + params["token"] = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + // 小区周边一公里均价 + json = request.getJsonContent("http://open.fangjia.com/property/aroundAverage", params, "UTF-8") + if(json.result){ + item['J'] = json.getJSONObject("result").averagePrice + } + } + params.clear() + params["city"] = getCityFormAddress(item['B']) + params["address"] = item['B'] + params["token"] = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + + // 地址认证接口 + json = request.getJsonContent("http://open.fangjia.com/address/realAuth", params, "UTF-8") + if(json && json.result){ + JSONObject result = json.result + item['K'] = result.formattedAddress + item['L'] = result.authLevel + } + // 小区详情接口 + params.clear() + params["token"] = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" + params["city"] = getCityFormAddress(item['B']) + params["name"] = item['F'] + params["region"] = item['E'] + + json = request.getJsonContent("http://open.fangjia.com/district/show", params, "UTF-8") + if(json){ + item['N'] = json.buildType + } + + println(item) +}) + +def getCityFormAddress(String addr){ + List cities = CommonUtils.findAllCity() + for(String city : cities){ + if(addr.contains(city)){ + return city + } + } + return null +} \ No newline at end of file From 72237096e81ad247b1b515f21e987032e936195e Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 21 Feb 2022 11:49:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E6=B5=B7?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy index b0b4e16c2..7c92e5a3e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/qianhai/QianhaiTest.groovy @@ -57,7 +57,7 @@ ExcelUtils.multiThreadingModify("D:\\ params["token"] = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB" // 地址认证接口 - json = request.getJsonContent("http://open.fangjia.com/address/realAuth", params, "UTF-8") + json = request.getJsonContent("http://open.fangjia.com/address/auth", params, "UTF-8") if(json && json.result){ JSONObject result = json.result item['K'] = result.formattedAddress