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 index 1ac784f05..bfc2a005d 100644 --- 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 @@ -5,7 +5,11 @@ import com.fangjia.script.gj.village.ailiyun.SignatureUtils import com.fangjia.script.util.ExcelUtils //def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801" +<<<<<<< HEAD +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\注册地址-太仓农商行POC测试.xlsx"; +======= String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 ExcelUtils.removeEmptyRow(excelFilePath) def count = 0 ExcelUtils.singleThreadingModify(excelFilePath, { List items -> @@ -14,13 +18,43 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items -> if (count % 10 == 0) { println("已处理:" + count) } +<<<<<<< HEAD + sleep(80) +======= sleep(50) +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 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") +<<<<<<< HEAD + 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 + + } +======= items['D'] = province } if ("city" in map) { @@ -66,6 +100,7 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items -> // items['K'] = roadno // } +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 }) 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 index c1575a52f..91967ecf4 100644 --- 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 @@ -4,10 +4,17 @@ import com.fangjia.core.util.HttpRequest import com.fangjia.script.util.ExcelUtils +<<<<<<< HEAD +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\注册地址-太仓农商行POC测试.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> +======= String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; ExcelUtils.removeEmptyRow(excelFilePath) def count = 0 ExcelUtils.multiThreadingModify(excelFilePath, { List items -> +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 count += 1 if (count % 10 == 0) { println("已处理:" + count) @@ -15,6 +22,112 @@ ExcelUtils.multiThreadingModify(excelFilePath, { List items -> String address = items['A'] +<<<<<<< HEAD +// 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") + } + } + +// } + +======= String province = items['B'] if (province == null) { String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; @@ -120,5 +233,6 @@ ExcelUtils.multiThreadingModify(excelFilePath, { List items -> } +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 }) 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 index f59dcafe2..40ff50c4e 100644 --- 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 @@ -24,8 +24,13 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items -> def map = [:] map.put("address", address) +<<<<<<< HEAD + map.put("complete", "2") + map.put("addressAssessment", "2") +======= map.put("complete", "true") map.put("addressAssessment", "true") +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 map.put("type", "2") def content = httpRequest.getJsonContent(url, map, "UTF-8") 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/util/ExcelUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy index 8af7a4d6c..5c155319f 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,11 @@ public class ExcelUtils{ def data = ExcelUtils.read(fileName, srcSheetIndex, 0) def body = data.subList(1, data.size()) +<<<<<<< HEAD + def nThread = 1 +======= def nThread = 10 +>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011 println nThread ExecutorService executorService = Executors.newFixedThreadPool(3) final AtomicInteger counter = new AtomicInteger(0)