From f6e421d4c5ee32e1ec7d68484081714dbf19287e Mon Sep 17 00:00:00 2001 From: mjt <13607600062@163.com> Date: Thu, 22 Feb 2024 14:47:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=89=E5=86=9C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../majintao/test/AliAddressTest.groovy | 72 +++++++++ .../test/AliAddressTestChecked.groovy | 76 +++++++++ .../script/majintao/test/FiveLevelTest.groovy | 64 ++++++++ .../script/majintao/test/SheNongTest.groovy | 124 +++++++++++++++ .../script/majintao/test/SheNongTest2.groovy | 147 ++++++++++++++++++ .../majintao/test/SheNongTestChecked.groovy | 44 ++++++ .../majintao/test/nanjingBankTest.groovy | 121 ++++++++++++++ .../test/sdklog/sdkclient_CommunicateLog_info | 0 .../test/sdklog/sdkclient_EMAYSDK_info | 0 .../fangjia/script/majintao/test/test.groovy | 72 +++++++++ .../com/fangjia/script/util/ExcelUtils.groovy | 2 +- 11 files changed, 721 insertions(+), 1 deletion(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTest.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTestChecked.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTestChecked.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/nanjingBankTest.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_CommunicateLog_info create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_EMAYSDK_info create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTest.groovy new file mode 100644 index 000000000..1ac784f05 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTest.groovy @@ -0,0 +1,72 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.gj.village.ailiyun.SignatureUtils +import com.fangjia.script.util.ExcelUtils + +//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801" +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + count = count + 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + sleep(50) + + def address = items['A'] + def map = SignatureUtils.getAliAddressStrc(address) + //prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012 + if ("prov" in map) { + def province = map.get("prov") + items['D'] = province + } + if ("city" in map) { + def city = map.get("city") + items['H'] = city + } + if ("district" in map) { + def district = map.get("district") + items['L'] = district + } + if ("town" in map) { + def town = map.get("town") + items['P'] = town + } + if ("community" in map) { + def community = map.get("community") + items['T'] = community + + } +// if ("road" in map) { +// def road = map.get("road") +// items['G'] = road +// +// } +// if ("poi" in map) { +// +// def poi = map.get("poi") +// items['H'] = poi +// +// } +// if ("roomno" in map) { +// def roomno = map.get("roomno") +// items['I'] = roomno +// +// } +// if ("devzone" in map) { +// def devzone = map.get("devzone") +// items['J'] = devzone +// +// } +// if ("roadno" in map) { +// def roadno = map.get("roadno") +// items['K'] = roadno +// } + + +}) + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTestChecked.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTestChecked.groovy new file mode 100644 index 000000000..e744b76d4 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTestChecked.groovy @@ -0,0 +1,76 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.gj.village.ailiyun.SignatureUtils +import com.fangjia.script.util.ExcelUtils + +//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801" +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + count = count + 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + sleep(50) + + def address = items['A'] + def pro = items['D'] + if (pro == null) { + + def map = SignatureUtils.getAliAddressStrc(address) + //prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012 + if ("prov" in map) { + def province = map.get("prov") + items['D'] = province + } + if ("city" in map) { + def city = map.get("city") + items['H'] = city + } + if ("district" in map) { + def district = map.get("district") + items['L'] = district + } + if ("town" in map) { + def town = map.get("town") + items['P'] = town + } + if ("community" in map) { + def community = map.get("community") + items['T'] = community + + } +// if ("road" in map) { +// def road = map.get("road") +// items['G'] = road +// +// } +// if ("poi" in map) { +// +// def poi = map.get("poi") +// items['H'] = poi +// +// } +// if ("roomno" in map) { +// def roomno = map.get("roomno") +// items['I'] = roomno +// +// } +// if ("devzone" in map) { +// def devzone = map.get("devzone") +// items['J'] = devzone +// +// } +// if ("roadno" in map) { +// def roadno = map.get("roadno") +// items['K'] = roadno +// } + } + + +}) + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy new file mode 100644 index 000000000..a430f9480 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy @@ -0,0 +1,64 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils +import net.sf.json.JSONObject + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\临时数据\\2.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + String url = "http://192.168.0.19:31080/FangJiaAddressService/v3/structure"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String address = items['A'] + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result){ + items['D'] = result.get("city") + } + if("cityCode" in result){ + items['E'] = result.get("cityCode") + } + if ("district" in result){ + + items['F'] = result.get("district") + } + if ("districtCode" in result){ + + items['G'] = result.get("districtCode") + } + if ("township" in result){ + + items['H'] = result.get("township") + } + if ("townshipCode" in result){ + + items['I'] = result.get("townshipCode") + print(result.get("townshipCode")) + } + if ("address" in result){ + + items['J'] = result.get("address") + } + if ("formatAddress" in result){ + items['K'] = result.get("formatAddress") + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy new file mode 100644 index 000000000..c1575a52f --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy @@ -0,0 +1,124 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.multiThreadingModify(excelFilePath, { List items -> + count += 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + + + String address = items['A'] + String province = items['B'] + if (province == null) { + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "1") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if (result != null) { + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result) { + items['D'] = result.get("city") + } + if ("cityCode" in result) { + items['E'] = result.get("cityCode") + } + if ("district" in result) { + + items['F'] = result.get("district") + } + if ("districtCode" in result) { + + items['G'] = result.get("districtCode") + } + if ("town" in result) { + + items['H'] = result.get("town") + } + if ("townCode" in result) { + + items['I'] = result.get("townCode") + } + + if ("committee" in result) { + + items['J'] = result.get("committee") + } + if ("committeeCode" in result) { + + items['K'] = result.get("committeeCode") + } + if ("typeCode" in result) { + + items['L'] = result.get("typeCode") + } + if ("typeName") { + items['M'] = result.get("typeName") + } + if ("verifyFlag") { + items['N'] = result.get("verifyFlag") + } + if ("addrVerify") { + items['O'] = result.get("addrVerify") + } + if ("countyLevelCity") { + items['P'] = result.get("countyLevelCity") + } + if ("countyGov") { + items['Q'] = result.get("countyGov") + } + if ("communitySource") { + items['R'] = result.get("communitySource") + } + + if ("administrativeTowns" in result) { + items['T'] = result.get("administrativeTowns") + } + if ("devDistrict" in result) { + items['V'] = result.get("devDistrict") + } + if ("devDistrictName" in result) { + items['W'] = result.get("devDistrictName") + } + if ("splitCommittee" in result) { + items['X'] = result.get("splitCommittee") + } + if ("splitStreet" in result) { + items['Y'] = result.get("splitStreet") + } + if ("poiName" in result) { + items['Z'] = result.get("poiName") + } + if ("splitStreetNum" in result) { + items['AA'] = result.get("splitStreetNum") + } + if ("dev" in result) { + items['AB'] = result.get("dev") + } + } + + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy new file mode 100644 index 000000000..7b84a95d5 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy @@ -0,0 +1,147 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\对公.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + count+=1 + if (count%10==0){ + println("已处理:"+count) + } + + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String address = items['A'] +// print(address) + +// province; +// city; +// district; +// town; +// committee; +// type; +// provinceCode; +// cityCode; +// districtCode; +// townCode; +// committeeCode; +// typeCode; +// typeName; +// verifyFlag;//涉农标识 +// addrVerify;//地址是否有效信息 +// countyLevelCity;//是否为县级市 +// administrativeTowns;//是否市辖建制镇 +// countyGov;//是否为县政府 +// devDistrict;//是否为开发区 +// devDistrictName;//开发区 +// splitCommittee; +// splitStreet; +// poiName; +// splitStreetNum; +// dev; +// communitySource;//居委来源 + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "2") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result){ + items['D'] = result.get("city") + } + if("cityCode" in result){ + items['E'] = result.get("cityCode") + } + if ("district" in result){ + + items['F'] = result.get("district") + } + if ("districtCode" in result){ + + items['G'] = result.get("districtCode") + } + if ("town" in result){ + + items['H'] = result.get("town") + } + if ("townCode" in result){ + + items['I'] = result.get("townCode") + } + + if ("committee" in result){ + + items['J'] = result.get("committee") + } + if ("committeeCode" in result){ + + items['K'] = result.get("committeeCode") + } + if ("typeCode" in result){ + + items['L'] = result.get("typeCode") + } + if ("typeName"){ + items['M'] = result.get("typeName") + } + if ("verifyFlag"){ + items['N'] = result.get("verifyFlag") + } + if ("addrVerify"){ + items['O'] = result.get("addrVerify") + } + if ("countyLevelCity"){ + items['P'] = result.get("countyLevelCity") + } + if ("countyGov"){ + items['Q'] = result.get("countyGov") + } + if ("communitySource"){ + items['R'] = result.get("communitySource") + } + + if ("administrativeTowns" in result){ + items['T'] = result.get("administrativeTowns") + } + if ("devDistrict" in result){ + items['V'] = result.get("devDistrict") + } + if ("devDistrictName" in result){ + items['W'] = result.get("devDistrictName") + } + if ("splitCommittee" in result){ + items['X'] = result.get("splitCommittee") + } + if ("splitStreet" in result){ + items['Y'] = result.get("splitStreet") + } + if ("poiName" in result){ + items['Z'] = result.get("poiName") + } + if ("splitStreetNum" in result){ + items['AA'] = result.get("splitStreetNum") + } + if ("dev" in result){ + items['AB'] = result.get("dev") + } + + + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTestChecked.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTestChecked.groovy new file mode 100644 index 000000000..8388fae47 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTestChecked.groovy @@ -0,0 +1,44 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据 - 副本.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + count += 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + + + String flag = items['X'] + String address = items['A'] + String tt = items['Y'] + if (flag == null&&"地址有效".equals(tt)) { + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "1") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if (result != null) { + if ("verifyFlag" in result) { + items['X'] = result.get("verifyFlag") + } + } + + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/nanjingBankTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/nanjingBankTest.groovy new file mode 100644 index 000000000..f59dcafe2 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/nanjingBankTest.groovy @@ -0,0 +1,121 @@ +package com.fangjia.script.majintao.test + + + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\南京银行测试.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + count+=1 + if (count%10==0){ + println("已处理:"+count) + } + + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String address = items['A'] + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "2") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result){ + items['D'] = result.get("city") + } + if("cityCode" in result){ + items['E'] = result.get("cityCode") + } + if ("district" in result){ + + items['F'] = result.get("district") + } + if ("districtCode" in result){ + + items['G'] = result.get("districtCode") + } + if ("town" in result){ + + items['H'] = result.get("town") + } + if ("townCode" in result){ + + items['I'] = result.get("townCode") + } + + if ("committee" in result){ + + items['J'] = result.get("committee") + } + if ("committeeCode" in result){ + + items['K'] = result.get("committeeCode") + } + if ("typeCode" in result){ + + items['L'] = result.get("typeCode") + } + if ("typeName"){ + items['M'] = result.get("typeName") + } + if ("verifyFlag"){ + items['N'] = result.get("verifyFlag") + } + if ("addrVerify"){ + items['O'] = result.get("addrVerify") + } + if ("countyLevelCity"){ + items['P'] = result.get("countyLevelCity") + } + if ("countyGov"){ + items['Q'] = result.get("countyGov") + } +// if ("communitySource"){ +// items['R'] = result.get("communitySource") +// } +// +// if ("administrativeTowns" in result){ +// items['T'] = result.get("administrativeTowns") +// } +// if ("devDistrict" in result){ +// items['V'] = result.get("devDistrict") +// } +// if ("devDistrictName" in result){ +// items['W'] = result.get("devDistrictName") +// } +// if ("splitCommittee" in result){ +// items['X'] = result.get("splitCommittee") +// } +// if ("splitStreet" in result){ +// items['Y'] = result.get("splitStreet") +// } +// if ("poiName" in result){ +// items['Z'] = result.get("poiName") +// } +// if ("splitStreetNum" in result){ +// items['AA'] = result.get("splitStreetNum") +// } +// if ("dev" in result){ +// items['AB'] = result.get("dev") +// } + + + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_CommunicateLog_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_CommunicateLog_info new file mode 100644 index 000000000..e69de29bb diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_EMAYSDK_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/sdklog/sdkclient_EMAYSDK_info new file mode 100644 index 000000000..e69de29bb diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy new file mode 100644 index 000000000..22a5ae18e --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy @@ -0,0 +1,72 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils +import net.sf.json.JSONObject + + +String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy1.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + String comprehensiveUrl = "http://localhost:9180/comprehensiveQuery/houseValueInformation"; + String communityUrl = "http://open.fangjia.com/addrSvc/avgPrice"; + String valueUrl = "http://open.fangjia.com/property/addressEvaluate"; + String caseUrl = "http://open.fangjia.com/house/case"; + String poiUrl = "http://open.fangjia.com/district/addrFacilitys"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String city = items['A'] + String address = items['B'] + double size = items['C'] + + System.out.println(city + "---" + address + "----" + size); + + map.put("city", city) + map.put("address", address) + map.put("size", size.toString()) + map.put("strctureArea", size.toString()) + map.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB") + + if (!address.contains("%")) { + // 发送HTTP请求 + long start + long end + +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(communityUrl, map, "UTF-8") +// +// +// end = System.currentTimeMillis(); +// items['D'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(valueUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['E'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(caseUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['F'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(poiUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['G'] = String.valueOf(end - start); + + start = System.currentTimeMillis(); + def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8") + end = System.currentTimeMillis(); + items['H'] = String.valueOf(end - start); + println content.get("msg") + if(content.get("msg").contains("该地址不支持估价!")) { + items['I'] = "该地址不支持估价!" + } + } + + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy index 87c14b741..8af7a4d6c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy @@ -454,7 +454,7 @@ public class ExcelUtils{ def data = ExcelUtils.read(fileName, srcSheetIndex, 0) def body = data.subList(1, data.size()) - def nThread = Runtime.getRuntime().availableProcessors() * 3 + def nThread = 10 println nThread ExecutorService executorService = Executors.newFixedThreadPool(3) final AtomicInteger counter = new AtomicInteger(0) From fd9c30d68c6c665d916a4f330f3344846e7fe4f4 Mon Sep 17 00:00:00 2001 From: mjt <13607600062@163.com> Date: Mon, 26 Feb 2024 13:46:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?open=E6=96=B0=E5=A2=9E=E6=B6=89=E5=86=9C?= =?UTF-8?q?=E6=96=B0=E8=A7=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/AddrSvcController.java | 63 ++++++++++++++++--- .../com/fangjia/open/model/AddressModel.java | 20 ++++++ 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index 020332464..e7dc05ae8 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -206,7 +206,7 @@ public class AddrSvcController { //新匹配接口 json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); BasicModel basicModel = new BasicModel(200, "ok"); - if (json != null && json.size()>0) { + if (json != null && json.size() > 0) { basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json)); } mav.setModel(basicModel); @@ -284,16 +284,16 @@ public class AddrSvcController { //新匹配接口 json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); BasicModel basicModel = new BasicModel(200, "ok"); - if (json != null && json.size()>0) { + if (json != null && json.size() > 0) { MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json); - District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(),"district"); + District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), "district"); if (null != district) { DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(dto.getCity(), dto.getDistrict(), dto.getName())); - if(null != statBo){ - if(statBo.getDistrictStat()!=null){ + if (null != statBo) { + if (statBo.getDistrictStat() != null) { dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice()); - }else if(statBo.getVillaDistrictStat()!=null){ + } else if (statBo.getVillaDistrictStat() != null) { dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice()); } @@ -309,8 +309,9 @@ public class AddrSvcController { return mav; } + /** - *五级地址标准化 + * 五级地址标准化 * * @param model * @return @@ -357,6 +358,54 @@ public class AddrSvcController { return mav; } + /** + * 涉农识别-新规则 + * + * @param model + * @return + */ + public Object villageIdentifyAction(AddressModel model) { + + RestfulModelAndView mav = new RestfulModelAndView(); + if (StringUtils.isBlank(model.getAddress())) { + mav.setModel(BasicModel.buildBadRequestModel("地址不能为空")); + return mav; + } + + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null); + params.put("address", model.getAddress()); + params.put("type", StringUtils.isNotBlank(model.getType()) ? model.getType() : null); + params.put("showFullValue", StringUtils.isNotBlank(model.getShowFullValue()) ? model.getShowFullValue() : null); + params.put("showTestValue", StringUtils.isNotBlank(model.getShowTestValue()) ? model.getShowTestValue() : null); + Integer radius = model.getRadius(); + params.put("radius", (radius != null && radius != 0) ? radius.toString() : null); + try { + json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8"); + } catch (Exception e) { + try { + json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8"); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + if (json != null) { + int code = json.getInt("msgCode"); + String msg = json.getString("msg"); + BasicModel basicModel = new BasicModel(code, msg); + if (json.containsKey("result")) { + basicModel.setResult(json.get("result")); + } + mav.setModel(basicModel); + } else { + mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中...")); + } + return mav; + } + public void setDistrictStatService(DistrictStatService districtStatService) { this.districtStatService = districtStatService; } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java index 4572cb47e..fe0a1741d 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/AddressModel.java @@ -42,6 +42,10 @@ public class AddressModel extends FangjiaApiModel { //是否使用地图poi数据 private boolean useMap; + //涉农到区之后,是否显式后面的字段值 + private String showFullValue; + //是否显示涉农测试用字段值 + private String showTestValue; public boolean isContainsLocation() { return containsLocation; } @@ -258,4 +262,20 @@ public class AddressModel extends FangjiaApiModel { public void setUseMap(boolean useMap) { this.useMap = useMap; } + + public String getShowFullValue() { + return showFullValue; + } + + public void setShowFullValue(String showFullValue) { + this.showFullValue = showFullValue; + } + + public String getShowTestValue() { + return showTestValue; + } + + public void setShowTestValue(String showTestValue) { + this.showTestValue = showTestValue; + } }