江苏银行涉农测试

This commit is contained in:
mjt
2024-03-04 08:59:29 +08:00
parent 16aca7639c
commit b356c2cea3
17 changed files with 934 additions and 1 deletions
@@ -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
}
})
@@ -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
}
}
}
}
}
});
@@ -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
}
})
@@ -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
}
})
@@ -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
// }
}
})
@@ -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, String>()
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")
}
})
@@ -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<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")
}
}
// }
})
@@ -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, String>()
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")
}
})
@@ -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<String, String>()
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")
}
}
}
})
@@ -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, String>()
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")
// }
})
@@ -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")
@@ -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, String>()
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'] = "该地址不支持估价!"
}
}
})
@@ -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)