From d9a0aaf52ea4efca3388ff0df1fa683709cc8ce3 Mon Sep 17 00:00:00 2001 From: mjt <13607600062@163.com> Date: Tue, 2 Jan 2024 16:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=80=9F=E5=BA=A6=E4=BC=98=E5=8C=96=EF=BC=8C=E6=AF=8F?= =?UTF-8?q?=E4=B8=AA=E5=B0=8F=E5=8C=BA=E5=8F=96=E4=BA=94=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComprehensiveQueryController.java | 1 + .../com/fangjia/script/majintao/test.groovy | 44 +++++++++---------- .../sync/CommunityHouseSampleBatch.groovy | 12 ++--- .../com/fangjia/script/util/ExcelUtils.groovy | 2 +- .../datastore/CzbankSampleServiceImpl.java | 9 ++-- 5 files changed, 35 insertions(+), 33 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java index 710ced096..458b5fc42 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java @@ -228,6 +228,7 @@ public class ComprehensiveQueryController { JSONObject matchResponse = null; try { matchResponse = httpRequest.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8"); +// matchResponse = httpRequest.getJsonContent("http://192.168.0.19:31080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8"); } catch (HttpRequestException e) { } 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.groovy index b84e7f062..350ffa191 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.groovy @@ -9,7 +9,7 @@ String excelFilePath = "F:\\ ExcelUtils.removeEmptyRow(excelFilePath) ExcelUtils.singleThreadingModify(excelFilePath, { List items -> - String comprehensiveUrl = "http://open.fangjia.com/comprehensiveQuery/houseValueInformation"; + 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"; @@ -35,27 +35,27 @@ ExcelUtils.singleThreadingModify(excelFilePath, { List items -> 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(); +// 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") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy index 7e007ed94..f5c0a94c6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy @@ -13,7 +13,7 @@ import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection -@BatchOwner(Watcher.MaJinTao) +//@BatchOwner(Watcher.MaJinTao) class CommunityHouseSampleBatch extends BaseBatch { DBCollection SEAWEED = MongoUtils.getCollectionByName("fangjia", "seaweed", "192.168.0.43", 28017) @@ -85,8 +85,8 @@ class CommunityHouseSampleBatch extends BaseBatch { try { def cityList = CommonUtils.findAllCity() - -// cityList = cityList.subList(0,150) + // 测试 + cityList = cityList.subList(0, 5) cityList.each { city -> executorService.submit({ def count = 0 @@ -95,8 +95,8 @@ class CommunityHouseSampleBatch extends BaseBatch { def districtPriceMap = CommonDatautils.queryAllDistrictPrice(city, weekend) List districts = CommonDatautils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lat", "lng"]) - // 测试,只选一个 -// districts = districts.subList(0, 1) + // 测试 + districts = districts.subList(0, 10) districts.each { district -> Map houseMap = [:] @@ -105,7 +105,7 @@ class CommunityHouseSampleBatch extends BaseBatch { if (district_stat != null) { findHouseCase(district_stat, houseMap) } - if (houseMap.size() == 0) { + if (houseMap == null || houseMap.size() == 0) { def aroundDistrictList = DbUtils.findAroundDistrictByRadius(district, 3000) // def aroundDistrictList = (aroundDistrictListAll.size() >= 50) ? aroundDistrictListAll.subList(0, 50) : aroundDistrictListAll aroundDistrictList.each { aroundDistrict -> 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 60076381a..87c14b741 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 @@ -456,7 +456,7 @@ public class ExcelUtils{ def body = data.subList(1, data.size()) def nThread = Runtime.getRuntime().availableProcessors() * 3 println nThread - ExecutorService executorService = Executors.newFixedThreadPool(1) + ExecutorService executorService = Executors.newFixedThreadPool(3) final AtomicInteger counter = new AtomicInteger(0) final double total = body.size() for(int i = 0 ; i < body.size(); i++){ diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java index 89cd6a07e..f2185a8ad 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java @@ -466,11 +466,12 @@ public class CzbankSampleServiceImpl implements CzbankSampleService { } //将数据放入样本仓库 for (Map.Entry> entry : map.entrySet()) { - //超过两个,只取两个 - if (entry.getValue().size()>=2){ - querySamples.addAll(entry.getValue().subList(0,2)); + //每个小区取5个样本 + + if (entry.getValue().size()>=5){ + querySamples.addAll(entry.getValue().subList(0,5)); }else { - // 不超过两个,全部放入 + // 不超过五个,全部放入 querySamples.addAll(entry.getValue()); } }