diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/PoseidonOnce.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/PoseidonOnce.groovy index fa4c6891f..48b616432 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/PoseidonOnce.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/PoseidonOnce.groovy @@ -78,7 +78,7 @@ class PoseidonOnce { // DBCursor cur = coll.find() // println cur.count() String url = "http://www.fangjia.com"; - DBCollection coll = MongoUtils.getCollectionByName("fangjia", "test2", "192.168.0.188") + DBCollection coll = MongoUtils.getCollectionByName("fangjia", "FiveLevelTest", "192.168.0.188") // for(int i=426000;i<1000000;i++) { // String s = url + i + "_" + url.hashCode() // DBObject dbo = new BasicDBObject() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/meishubao/MsbPocTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/meishubao/MsbPocTest.groovy index f517a80b8..522a1fe7e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/meishubao/MsbPocTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/meishubao/MsbPocTest.groovy @@ -19,7 +19,7 @@ class MsbPocTest { // match(inputfile) // matchOld(inputfile) // addPrice("D:\\数据\\美术宝\\美术宝测试数据(价格).xlsx") -// test("D:\\数据\\美术宝\\test2.xlsx") +// test("D:\\数据\\美术宝\\FiveLevelTest.xlsx") // cityPrice() // mergeMatchPrice("D:\\数据\\美术宝\\美术宝-新接口价格.xlsx") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy new file mode 100644 index 000000000..a430f9480 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/FiveLevelTest.groovy @@ -0,0 +1,64 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils +import net.sf.json.JSONObject + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\临时数据\\2.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + + String url = "http://192.168.0.19:31080/FangJiaAddressService/v3/structure"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String address = items['A'] + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result){ + items['D'] = result.get("city") + } + if("cityCode" in result){ + items['E'] = result.get("cityCode") + } + if ("district" in result){ + + items['F'] = result.get("district") + } + if ("districtCode" in result){ + + items['G'] = result.get("districtCode") + } + if ("township" in result){ + + items['H'] = result.get("township") + } + if ("townshipCode" in result){ + + items['I'] = result.get("townshipCode") + print(result.get("townshipCode")) + } + if ("address" in result){ + + items['J'] = result.get("address") + } + if ("formatAddress" in result){ + items['K'] = result.get("formatAddress") + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy new file mode 100644 index 000000000..c1575a52f --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest.groovy @@ -0,0 +1,124 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\涉农对私测试数据.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.multiThreadingModify(excelFilePath, { List items -> + count += 1 + if (count % 10 == 0) { + println("已处理:" + count) + } + + + String address = items['A'] + String province = items['B'] + if (province == null) { + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "1") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if (result != null) { + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result) { + items['D'] = result.get("city") + } + if ("cityCode" in result) { + items['E'] = result.get("cityCode") + } + if ("district" in result) { + + items['F'] = result.get("district") + } + if ("districtCode" in result) { + + items['G'] = result.get("districtCode") + } + if ("town" in result) { + + items['H'] = result.get("town") + } + if ("townCode" in result) { + + items['I'] = result.get("townCode") + } + + if ("committee" in result) { + + items['J'] = result.get("committee") + } + if ("committeeCode" in result) { + + items['K'] = result.get("committeeCode") + } + if ("typeCode" in result) { + + items['L'] = result.get("typeCode") + } + if ("typeName") { + items['M'] = result.get("typeName") + } + if ("verifyFlag") { + items['N'] = result.get("verifyFlag") + } + if ("addrVerify") { + items['O'] = result.get("addrVerify") + } + if ("countyLevelCity") { + items['P'] = result.get("countyLevelCity") + } + if ("countyGov") { + items['Q'] = result.get("countyGov") + } + if ("communitySource") { + items['R'] = result.get("communitySource") + } + + if ("administrativeTowns" in result) { + items['T'] = result.get("administrativeTowns") + } + if ("devDistrict" in result) { + items['V'] = result.get("devDistrict") + } + if ("devDistrictName" in result) { + items['W'] = result.get("devDistrictName") + } + if ("splitCommittee" in result) { + items['X'] = result.get("splitCommittee") + } + if ("splitStreet" in result) { + items['Y'] = result.get("splitStreet") + } + if ("poiName" in result) { + items['Z'] = result.get("poiName") + } + if ("splitStreetNum" in result) { + items['AA'] = result.get("splitStreetNum") + } + if ("dev" in result) { + items['AB'] = result.get("dev") + } + } + + } + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy new file mode 100644 index 000000000..7b84a95d5 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/SheNongTest2.groovy @@ -0,0 +1,147 @@ +package com.fangjia.script.majintao.test + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils + + +String excelFilePath = "C:\\Users\\Goojia\\Desktop\\对公.xlsx"; +ExcelUtils.removeEmptyRow(excelFilePath) +def count = 0 +ExcelUtils.singleThreadingModify(excelFilePath, { List items -> + count+=1 + if (count%10==0){ + println("已处理:"+count) + } + + String url = "http://192.168.0.100:32080/FangJiaAddressService/villageIdentify"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String address = items['A'] +// print(address) + +// province; +// city; +// district; +// town; +// committee; +// type; +// provinceCode; +// cityCode; +// districtCode; +// townCode; +// committeeCode; +// typeCode; +// typeName; +// verifyFlag;//涉农标识 +// addrVerify;//地址是否有效信息 +// countyLevelCity;//是否为县级市 +// administrativeTowns;//是否市辖建制镇 +// countyGov;//是否为县政府 +// devDistrict;//是否为开发区 +// devDistrictName;//开发区 +// splitCommittee; +// splitStreet; +// poiName; +// splitStreetNum; +// dev; +// communitySource;//居委来源 + + def map = [:] + map.put("address", address) + map.put("complete", "true") + map.put("addressAssessment", "true") + map.put("type", "2") + + def content = httpRequest.getJsonContent(url, map, "UTF-8") + def result = content.get("result") + if ("province" in result) { + items['B'] = result.get("province") + } + if ("provinceCode" in result) { + items['C'] = result.get("provinceCode") + } + if ("city" in result){ + items['D'] = result.get("city") + } + if("cityCode" in result){ + items['E'] = result.get("cityCode") + } + if ("district" in result){ + + items['F'] = result.get("district") + } + if ("districtCode" in result){ + + items['G'] = result.get("districtCode") + } + if ("town" in result){ + + items['H'] = result.get("town") + } + if ("townCode" in result){ + + items['I'] = result.get("townCode") + } + + if ("committee" in result){ + + items['J'] = result.get("committee") + } + if ("committeeCode" in result){ + + items['K'] = result.get("committeeCode") + } + if ("typeCode" in result){ + + items['L'] = result.get("typeCode") + } + if ("typeName"){ + items['M'] = result.get("typeName") + } + if ("verifyFlag"){ + items['N'] = result.get("verifyFlag") + } + if ("addrVerify"){ + items['O'] = result.get("addrVerify") + } + if ("countyLevelCity"){ + items['P'] = result.get("countyLevelCity") + } + if ("countyGov"){ + items['Q'] = result.get("countyGov") + } + if ("communitySource"){ + items['R'] = result.get("communitySource") + } + + if ("administrativeTowns" in result){ + items['T'] = result.get("administrativeTowns") + } + if ("devDistrict" in result){ + items['V'] = result.get("devDistrict") + } + if ("devDistrictName" in result){ + items['W'] = result.get("devDistrictName") + } + if ("splitCommittee" in result){ + items['X'] = result.get("splitCommittee") + } + if ("splitStreet" in result){ + items['Y'] = result.get("splitStreet") + } + if ("poiName" in result){ + items['Z'] = result.get("poiName") + } + if ("splitStreetNum" in result){ + items['AA'] = result.get("splitStreetNum") + } + if ("dev" in result){ + items['AB'] = result.get("dev") + } + + + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/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.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy similarity index 98% rename from projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy rename to projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy index 350ffa191..22a5ae18e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test/test.groovy @@ -1,4 +1,4 @@ -package com.fangjia.script.majintao +package com.fangjia.script.majintao.test import com.fangjia.core.util.HttpRequest import com.fangjia.script.util.ExcelUtils diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test2.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test2.groovy deleted file mode 100644 index 2c6e2d2ea..000000000 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test2.groovy +++ /dev/null @@ -1,4 +0,0 @@ -import org.bson.types.ObjectId - -a = new ObjectId() -print(a) \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/webCrawl/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/webCrawl/Test.groovy index 796aaedcb..11d317c09 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/webCrawl/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/webCrawl/Test.groovy @@ -43,15 +43,15 @@ class Test { static main(args) { // String test1 = " qwdwqd ssss "; -// String test2 = " qwdwqd ss"; +// String FiveLevelTest = " qwdwqd ss"; // String test3 = "qwdwqd dd"; // // test1 = test1.replaceAll(" |\\s+", " "); -// test2 = test2.replaceAll(" |\\s+", " "); +// FiveLevelTest = FiveLevelTest.replaceAll(" |\\s+", " "); // test3 = test3.replaceAll(" |\\s+", " "); // // String[] arrs1 = test1.split("\\s+") -// String[] arrs2 = test2.split("\\s+") +// String[] arrs2 = FiveLevelTest.split("\\s+") // String[] arrs3 = test3.split("\\s+") // // println arrs1