From b356c2cea392e32fb303242236770b9b9467197c Mon Sep 17 00:00:00 2001 From: mjt <13607600062@163.com> Date: Mon, 4 Mar 2024 08:59:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B1=9F=E8=8B=8F=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E6=B6=89=E5=86=9C=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JSBankTest/JSBankAliAddress.groovy | 50 ++++++ .../JSBankTest/JSBankDevelopmentZOne.groovy | 85 ++++++++++ .../JSBankTest/JSBankSheNongTest.groovy | 85 ++++++++++ .../sdklog/sdkclient_CommunicateLog_info | 0 .../sdklog/sdkclient_EMAYSDK_info | 0 .../majintao/test/AliAddressTest.groovy | 51 ++++++ .../test/AliAddressTestChecked.groovy | 76 +++++++++ .../script/majintao/test/FiveLevelTest.groovy | 64 ++++++++ .../script/majintao/test/SheNongTest.groovy | 123 +++++++++++++++ .../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/t1.groovy | 15 ++ .../fangjia/script/majintao/test/test.groovy | 72 +++++++++ .../com/fangjia/script/util/ExcelUtils.groovy | 2 +- 17 files changed, 934 insertions(+), 1 deletion(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankAliAddress.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankDevelopmentZOne.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankSheNongTest.groovy rename projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/{ => JSBankTest}/sdklog/sdkclient_CommunicateLog_info (100%) rename projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/{ => JSBankTest}/sdklog/sdkclient_EMAYSDK_info (100%) 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/t1.groovy 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/JSBankTest/JSBankAliAddress.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankAliAddress.groovy new file mode 100644 index 000000000..cb9ef1193 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankAliAddress.groovy @@ -0,0 +1,50 @@ +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\\1.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + count = count + 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + sleep(80) + + 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['E'] = province + } + if ("city" in map) { + def city = map.get("city") + items['G'] = city + } + if ("district" in map) { + def district = map.get("district") + items['I'] = district + } + if ("town" in map) { + def town = map.get("town") + items['K'] = town + } +// if ("community" in map) { +// def community = map.get("community") +// items['S'] = community +// } + if ("devzone" in map) { + def devzone = map.get("devzone") + items['Q'] = devzone + + } + +}) + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankDevelopmentZOne.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankDevelopmentZOne.groovy new file mode 100644 index 000000000..7a2098677 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankDevelopmentZOne.groovy @@ -0,0 +1,85 @@ +package com.fangjia.script.majintao.JSBankTest; + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils; +import net.sf.json.JSONObject; +import java.util.Base64; +import net.sf.json.JSONArray; + + +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) + } + def zx = ["北京", "天津", "上海", "重庆"] +// String province = "天津"; + String province = items['E']; + if (zx.contains(province)) { + province = province + "市"; + } +// String name = "天津经济技术开发区"; + String name = items['Q']; + String elasticUsername = "elastic"; + String elasticPassword = "elasticsearch"; + + String seawaterUrl = "http://192.168.0.89:9200/development_zone/_search"; + String basicAuth = "Basic " + Base64.getEncoder().encodeToString((elasticUsername + ":" + elasticPassword).getBytes("UTF-8")); + + String body = """ + { + "query": { + "bool": { + "must": [ + { + "match": { + "name": { + "query": "${name}", + "operator": "and" + } + } + }, + { + "term": {"province": {"value": "${province}"}} + } + ] + } + } + } + """; + + HttpRequest request = new HttpRequest(); + JSONObject jsonBody = JSONObject.fromObject(body); + JSONObject header = new JSONObject(); + header.put("Authorization", basicAuth); + String res = request.postWithBody(seawaterUrl, jsonBody, header, "UTF-8"); + + JSONObject response = JSONObject.fromObject(res); + JSONObject obj = null; + if (response != null && response.containsKey("hits")) { + JSONObject hits = response.getJSONObject("hits"); + if (hits != null && hits.size() > 0) { + JSONArray hitsArray = hits.getJSONArray("hits"); + // 省略了之前的部分... + + if (hitsArray != null && hitsArray.size() > 0) { + for (int i = 0; i < hitsArray.size(); i++) { + JSONObject hit = hitsArray.getJSONObject(i); + JSONObject source = hit.getJSONObject("_source"); + String devName = source.optString("name"); // Assuming "name" is a String + String level = source.optString("level"); // Assuming "level" is a String + if (devName.equals(name)) { + items['O'] = "是"; + items['P'] = level; + println("省份:" + province + " 名称:" + name + " 开发区名:" + devName + " 开发区级别:" + level); + break + } + } + } + + } + } +}); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankSheNongTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankSheNongTest.groovy new file mode 100644 index 000000000..438897f64 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/JSBankSheNongTest.groovy @@ -0,0 +1,85 @@ +package com.fangjia.script.majintao.JSBankTest + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils +import org.apache.tools.ant.types.resources.selectors.None + + +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 address = items['B'] + + 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("showFullValue", "2") + map.put("showTestValue", "2") + map.put("type", "2") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if (result != null) { + if ("addrVerify") { + items['C'] = result.get("addrVerify") + } + + if ("province" in result) { + items['D'] = result.get("province") + } + if ("city" in result) { + items['F'] = result.get("city") + } + if ("district" in result) { + + items['H'] = result.get("district") + } + if ("town" in result) { + items['J'] = result.get("town") + } + if ("committee" in result) { + + items['L'] = result.get("committee") + } + if ("typeCode" in result) { + items['M'] = result.get("typeCode") + } + if ("countyGov") { + items['N'] = result.get("countyGov") + } + def devDistrict = "" + if ("devDistrict" in result) { + devDistrict = result.get("devDistrict") + } + def dev = "" + if ("dev" in result) { + dev = result.get("dev") + } + // 开发区级别暂时没有 + + // 暂时使用 + def defGrade = "" + if (!dev.equals("") && devDistrict.equals("否")) { + defGrade = "非国际级或省级" + devDistrict = "是" + } + if (!devDistrict.equals("")) { + items['O'] = devDistrict + } + items["P"] = defGrade + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_CommunicateLog_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/sdklog/sdkclient_CommunicateLog_info similarity index 100% rename from projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_CommunicateLog_info rename to projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/sdklog/sdkclient_CommunicateLog_info diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_EMAYSDK_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/sdklog/sdkclient_EMAYSDK_info similarity index 100% rename from projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_EMAYSDK_info rename to projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/JSBankTest/sdklog/sdkclient_EMAYSDK_info 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..16d11d368 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/AliAddressTest.groovy @@ -0,0 +1,51 @@ +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\\注册地址-太仓农商行POC测试.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + count = count + 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + sleep(80) + + 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['C'] = province + } + if ("city" in map) { + def city = map.get("city") + items['G'] = city + } + if ("district" in map) { + def district = map.get("district") + items['K'] = district + } + if ("town" in map) { + def town = map.get("town") + items['O'] = town + } + if ("community" in map) { + def community = map.get("community") + items['S'] = community + + } + if ("devzone" in map) { + def devzone = map.get("devzone") + items['AE'] = devzone + + } + +}) + + 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..a10f0b701 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy @@ -0,0 +1,123 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\注册地址-太仓农商行POC测试.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + count += 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + + + String address = items['A'] +// 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("showFullValue", "2") + map.put("showTestValue", "2") + map.put("type", "2") + + 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['E'] = result.get("provinceCode") + } + if ("city" in result) { + items['F'] = result.get("city") + } + if ("cityCode" in result) { + items['I'] = result.get("cityCode") + } + if ("district" in result) { + + items['J'] = result.get("district") + } + if ("districtCode" in result) { + + items['M'] = result.get("districtCode") + } + if ("town" in result) { + + items['N'] = result.get("town") + } + if ("townCode" in result) { + + items['Q'] = result.get("townCode") + } + + if ("committee" in result) { + + items['R'] = result.get("committee") + } + if ("committeeCode" in result) { + + items['U'] = result.get("committeeCode") + } + if ("typeCode" in result) { + + items['V'] = result.get("typeCode") + } + if ("typeName") { + items['W'] = result.get("typeName") + } + if ("verifyFlag") { + items['X'] = result.get("verifyFlag") + } + if ("addrVerify") { + items['Y'] = result.get("addrVerify") + } + if ("countyLevelCity") { + items['Z'] = result.get("countyLevelCity") + } + if ("countyGov") { + items['AA'] = result.get("countyGov") + } + if ("communitySource") { + items['AB'] = result.get("communitySource") + } + + if ("administrativeTowns" in result) { + items['AD'] = result.get("administrativeTowns") + } + if ("devDistrict" in result) { + items['AF'] = result.get("devDistrict") + } + if ("devDistrictName" in result) { + items['AG'] = result.get("devDistrictName") + } + if ("splitCommittee" in result) { + items['AH'] = result.get("splitCommittee") + } + if ("splitStreet" in result) { + items['AI'] = result.get("splitStreet") + } + if ("poiName" in result) { + items['AJ'] = result.get("poiName") + } + if ("splitStreetNum" in result) { + items['AK'] = result.get("splitStreetNum") + } + if ("dev" in result) { + items['AL'] = 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..b88be8d68 --- /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", "2") + map.put("addressAssessment", "2") + 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/t1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/t1.groovy new file mode 100644 index 000000000..9f339f5f0 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/t1.groovy @@ -0,0 +1,15 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest + +String url = "http://192.168.0.19:31080/FangJiaAddressService/villageIdentify"; + +HttpRequest httpRequest = new HttpRequest(); +map = new HashMap() + + +def map = [:] +map.put("address", address) +map.put("showFullValue", "2") +map.put("showTestValue", "2") +map.put("type", "2") \ No newline at end of file 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..4858d096f 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 = 1 println nThread ExecutorService executorService = Executors.newFixedThreadPool(3) final AtomicInteger counter = new AtomicInteger(0) From c2e26c5c17efa1313a26cb1600beddcdea5886a3 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 8 Mar 2024 10:36:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8A=A0=E7=BA=BF=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/district/DistrictHouseBatch.groovy | 23 ++++++--- .../fangjia/script/gj/CitySellStatTest.groovy | 50 ++++++++++++++++--- .../gj/village/ailiyun/SignatureUtils.groovy | 5 ++ .../gj/xiamen/SuggestionDataSynch.groovy | 2 +- 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy index dbc92b4dd..394463a8b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy @@ -44,12 +44,17 @@ class DistrictHouseBatch extends BaseBatch { public void process(Object args) { // DBObject q = new BasicDBObject(); -// q.put("_id", new ObjectId("6501174f6f5638447b264189")); -// def obj = CommonDatautils.getHouseDataStoreConnection().findOne(q) -// obj.put("c_date", new Date()) -// CommonDatautils.getHouseDataStoreConnection().save(obj) +// q.put("cat", "sell"); +// q.put("city","常州") +// q.put("district_name","清河苑一区") +// def dbcursor = CommonDatautils.getHouseDataStoreConnection().find(q) +// for(def obj : dbcursor){ +// obj.put("c_date", new Date()) +// CommonDatautils.getHouseDataStoreConnection().save(obj) +// } -// CommonDatautils.getHouseDataStoreConnection().find(new BasicDBObject("districtname_key","新城帝景南区_武进_常州")).each{ + +// CommonDatautils.getHouseDataStoreConnection().find(new BasicDBObject("districtname_key","清河苑一区_溧阳_常州")).each{ // println(it) // } @@ -62,14 +67,15 @@ class DistrictHouseBatch extends BaseBatch { c++ try { long sn = Long.parseLong("${new Date().format('yyyyMMddHHmmssSSS')}") - List districts = findDistrictByCity(city) +// List districts = findDistrictByCity(city) + def districts = CommonDatautils.findAllDistrictByCity(city, "district", ["city","region","name","alias"]) Map sellCountMap = facetDistrictInHouse("sell", city); Map rentCountMap = facetDistrictInHouse("rent", city); println c + "\t" + city + "\t" + "\tsn:" + sn + "\t" + districts.size() + "\t" + DateUtil.formatToTightYYYYMMDDhhmmss(new Date()) for(DBObject district : districts) { def names = [] names << district.name - if(district.alias && districts.size()>0){ + if(district.alias && districts.alias.size()>0){ for(def name : district.alias){ if(!names.contains(name)){ names << name @@ -93,6 +99,7 @@ class DistrictHouseBatch extends BaseBatch { } HOUSE_COLL.remove(new BasicDBObject("city", city).append('sn', new BasicDBObject('$ne', sn))) + println c + " " + city }catch (Exception e) { e.printStackTrace(); } @@ -151,7 +158,7 @@ class DistrictHouseBatch extends BaseBatch { q.put('city', city) q.put('cat', 'district') q.put('visible', 0) -// q.put("name","新城帝景") + q.put("name","清河苑") DSCursor cur = SEAWEED.find(q, fields).batchSize(2000) Iterator iter = cur.iterator() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CitySellStatTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CitySellStatTest.groovy index fc989d72f..49b75a911 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CitySellStatTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CitySellStatTest.groovy @@ -1,5 +1,7 @@ package com.fangjia.script.gj +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.temp.shenjian.poi.entity.Community import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject @@ -12,7 +14,41 @@ class CitySellStatTest { static main(args) { def task = new CitySellStatTest(); - task.run() +// task.run() + task.cityPriceRun() + } + + def cityPriceRun(){ + def cityObjs = CommonDatautils.findCitys(); + def rets = [] + rets << ["序号","城市","城市级别","城市均价起始月","起始均价","城市均价最新月","最新均价"] + def index = 1 + for(def o : cityObjs){ + def ret = [] + ret << index + ret << o.display + ret << o.new_city_grade + def row1 = findCityMonthPrice(o.display, 1) + if(row1){ + ret << row1.date + ret << row1.avg_price + }else{ + ret << "" + ret << "" + } + def row2 = findCityMonthPrice(o.display, -1) + if(row2){ + ret << row2.date + ret << row2.avg_price + }else{ + ret << "" + ret << "" + } + rets << ret + index++ + } + + ExcelUtils.write("D:\\数据\\其它\\全国城市均价.xlsx", rets, "城市均价") } def run(){ @@ -25,18 +61,20 @@ class CitySellStatTest { },0) } - def findFirstMonth(def city){ + def findCityMonthPrice(def city, def asc){ def q = new BasicDBObject(); q.put("city", city) - def dbcursor = CITY_STAT_COLL.find(q).sort(new BasicDBObject("_id",1)).limit(1) - def month; + def dbcursor = CITY_STAT_COLL.find(q).sort(new BasicDBObject("date", asc)).limit(1) + def obj = null for(def o : dbcursor){ - month = o.date + obj = o } - return month + return obj } + + def findTotalMonth(def city, def month){ def q = new BasicDBObject(); q.put("city", city) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/SignatureUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/SignatureUtils.groovy index 6dd3714bb..b2dbb9204 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/SignatureUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/ailiyun/SignatureUtils.groovy @@ -200,4 +200,9 @@ public class SignatureUtils { } return null; } + + public static void main(String[] args){ + def a = getAliAddressStrc("上海市长宁区新泾三村") + println a + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SuggestionDataSynch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SuggestionDataSynch.groovy index 8aa6511ac..2896b5c0b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SuggestionDataSynch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SuggestionDataSynch.groovy @@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong class SuggestionDataSynch extends BaseBatch{ static def targetUrl = "http://192.168.0.12:9200/seaweed/" - public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50) + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(100) def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; DBCollection SEAWEED_CONN = MongoUtils.getCollectionByName2("fangjia", "seaweed", MONGO100_URL) From 46b6bf7268f758ea8cf182ec397f436850446b73 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 8 Mar 2024 10:41:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=88=BF=E6=BA=90=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/district/DistrictHouseBatch.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy index dbc8722a3..5542b2c16 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/district/DistrictHouseBatch.groovy @@ -87,8 +87,12 @@ class DistrictHouseBatch extends BaseBatch { long rentCount = 0 for(def name : names){ String key = name.toString().trim() + "_" + district.get("region") + "_" + district.get("city") - sellCount = sellCount + (sellCountMap.get(key) ? sellCountMap.get(key) : 0) - rentCount = rentCount + (rentCountMap.get(key) ? rentCountMap.get(key) : 0) + if(!sellCount){ + sellCount = sellCountMap.get(key) ? sellCountMap.get(key) : 0 + } + if(!rentCount){ + rentCount = rentCountMap.get(key) ? rentCountMap.get(key) : 0 + } } saveToDistrictHouse(district.get('city'), district.get("region"), district.get("name"), sellCount, rentCount, sn) }