Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+50
@@ -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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
+85
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
+85
@@ -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<String, String>()
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
+35
@@ -5,7 +5,11 @@ import com.fangjia.script.gj.village.ailiyun.SignatureUtils
|
|||||||
import com.fangjia.script.util.ExcelUtils
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
|
||||||
//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801"
|
//def address = "江苏省徐州市贾汪区经济开发区大黄山镇孤山小区B3.801"
|
||||||
|
<<<<<<< HEAD
|
||||||
|
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\注册地址-太仓农商行POC测试.xlsx";
|
||||||
|
=======
|
||||||
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
|
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
ExcelUtils.removeEmptyRow(excelFilePath)
|
ExcelUtils.removeEmptyRow(excelFilePath)
|
||||||
def count = 0
|
def count = 0
|
||||||
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
||||||
@@ -14,13 +18,43 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
|||||||
if (count % 10 == 0) {
|
if (count % 10 == 0) {
|
||||||
println("已处理:" + count)
|
println("已处理:" + count)
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
sleep(80)
|
||||||
|
=======
|
||||||
sleep(50)
|
sleep(50)
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
|
|
||||||
def address = items['A']
|
def address = items['A']
|
||||||
def map = SignatureUtils.getAliAddressStrc(address)
|
def map = SignatureUtils.getAliAddressStrc(address)
|
||||||
//prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012
|
//prov=河南省 city=信阳市 district=息县 town=孙庙乡 community=前赵楼村 road=前赵楼村 poi=爱婆店 roomno=012
|
||||||
if ("prov" in map) {
|
if ("prov" in map) {
|
||||||
def province = map.get("prov")
|
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
|
items['D'] = province
|
||||||
}
|
}
|
||||||
if ("city" in map) {
|
if ("city" in map) {
|
||||||
@@ -66,6 +100,7 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
|||||||
// items['K'] = roadno
|
// items['K'] = roadno
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+114
@@ -4,10 +4,17 @@ import com.fangjia.core.util.HttpRequest
|
|||||||
import com.fangjia.script.util.ExcelUtils
|
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";
|
String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx";
|
||||||
ExcelUtils.removeEmptyRow(excelFilePath)
|
ExcelUtils.removeEmptyRow(excelFilePath)
|
||||||
def count = 0
|
def count = 0
|
||||||
ExcelUtils.multiThreadingModify(excelFilePath, { List items ->
|
ExcelUtils.multiThreadingModify(excelFilePath, { List items ->
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
count += 1
|
count += 1
|
||||||
if (count % 10 == 0) {
|
if (count % 10 == 0) {
|
||||||
println("已处理:" + count)
|
println("已处理:" + count)
|
||||||
@@ -15,6 +22,112 @@ ExcelUtils.multiThreadingModify(excelFilePath, { List items ->
|
|||||||
|
|
||||||
|
|
||||||
String address = items['A']
|
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<String, String>()
|
||||||
|
|
||||||
|
|
||||||
|
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']
|
String province = items['B']
|
||||||
if (province == null) {
|
if (province == null) {
|
||||||
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
|
String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify";
|
||||||
@@ -120,5 +233,6 @@ ExcelUtils.multiThreadingModify(excelFilePath, { List items ->
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+5
@@ -24,8 +24,13 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
|||||||
|
|
||||||
def map = [:]
|
def map = [:]
|
||||||
map.put("address", address)
|
map.put("address", address)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
map.put("complete", "2")
|
||||||
|
map.put("addressAssessment", "2")
|
||||||
|
=======
|
||||||
map.put("complete", "true")
|
map.put("complete", "true")
|
||||||
map.put("addressAssessment", "true")
|
map.put("addressAssessment", "true")
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
map.put("type", "2")
|
map.put("type", "2")
|
||||||
|
|
||||||
def content = httpRequest.getJsonContent(url, map, "UTF-8")
|
def content = httpRequest.getJsonContent(url, map, "UTF-8")
|
||||||
|
|||||||
@@ -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<String, String>()
|
||||||
|
|
||||||
|
|
||||||
|
def map = [:]
|
||||||
|
map.put("address", address)
|
||||||
|
map.put("showFullValue", "2")
|
||||||
|
map.put("showTestValue", "2")
|
||||||
|
map.put("type", "2")
|
||||||
@@ -454,7 +454,11 @@ public class ExcelUtils{
|
|||||||
|
|
||||||
def data = ExcelUtils.read(fileName, srcSheetIndex, 0)
|
def data = ExcelUtils.read(fileName, srcSheetIndex, 0)
|
||||||
def body = data.subList(1, data.size())
|
def body = data.subList(1, data.size())
|
||||||
|
<<<<<<< HEAD
|
||||||
|
def nThread = 1
|
||||||
|
=======
|
||||||
def nThread = 10
|
def nThread = 10
|
||||||
|
>>>>>>> f0061ade19d549f26467ab6be7e9eaaa66cd3011
|
||||||
println nThread
|
println nThread
|
||||||
ExecutorService executorService = Executors.newFixedThreadPool(3)
|
ExecutorService executorService = Executors.newFixedThreadPool(3)
|
||||||
final AtomicInteger counter = new AtomicInteger(0)
|
final AtomicInteger counter = new AtomicInteger(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user