From 0dad507b637a8501f744506464ea4f9d4a452690 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 26 May 2022 17:21:52 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=88=90=E4=BA=A4?= =?UTF-8?q?=E8=AF=84=E4=BC=B0=E4=BB=B7=E6=A0=BC=E4=B8=A2=E5=A4=B1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/AuctionController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java index 13e59faa4..b58a1097b 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java @@ -29,7 +29,7 @@ public class AuctionController { private PaiMaiService paiMaiService; private DistrictNewPriceService districtNewPriceService; - private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType"}; + private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType", "tradeAvgPrice", "evaluationPrice"}; public Object housesAction(AuctionModel model){ RestfulModelAndView mav = new RestfulModelAndView(); From a39f90338c99626c1d3301e021e3f558279aeae1 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 26 May 2022 17:31:27 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E8=BF=98=E5=8E=9F=EF=BC=8Cmaster?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/AuctionController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java index b58a1097b..13e59faa4 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java @@ -29,7 +29,7 @@ public class AuctionController { private PaiMaiService paiMaiService; private DistrictNewPriceService districtNewPriceService; - private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType", "tradeAvgPrice", "evaluationPrice"}; + private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType"}; public Object housesAction(AuctionModel model){ RestfulModelAndView mav = new RestfulModelAndView(); From d006dbfd05a34ac0387500261aac7ef4763ee20f Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 13 Jul 2022 21:23:30 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E6=88=90=E4=BA=A4=E4=B8=8A=E4=B8=8B20%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/open/controllers/DealPriceController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/DealPriceController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/DealPriceController.java index 54c19713d..ab916308a 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/DealPriceController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/DealPriceController.java @@ -233,8 +233,8 @@ public class DealPriceController { Integer minPrice = null; Integer maxPrice = null; if(bo.getDistrictStat()!=null){ - minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.9); - maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.1); + minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8); + maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2); } Date startDate = null; Date endDate = null; From 6819619f2ff891fa2e20cb027bb4db7f9259fcbb Mon Sep 17 00:00:00 2001 From: gaojuan Date: Thu, 14 Jul 2022 12:02:38 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A5=BC=E6=A0=8B?= =?UTF-8?q?=E5=8F=B7=E5=AE=A4=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/dal/mongo/fangjia/model/PaiMai.java | 13 +++++++++++++ .../fangjia/open/controllers/AuctionController.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/fangjia/model/PaiMai.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/fangjia/model/PaiMai.java index e7a406dc8..2058cd9aa 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/fangjia/model/PaiMai.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/fangjia/model/PaiMai.java @@ -102,6 +102,7 @@ public class PaiMai implements MongoEntity { private String houseNum; private String unitNum; private String roomNum; + private String estateType; @Id @GeneratedValue @@ -492,6 +493,7 @@ public class PaiMai implements MongoEntity { this.matchEstateType = matchEstateType; } + @Column(name = "houseNum") public String getHouseNum() { return houseNum; } @@ -500,6 +502,7 @@ public class PaiMai implements MongoEntity { this.houseNum = houseNum; } + @Column(name = "unitNum") public String getUnitNum() { return unitNum; } @@ -508,6 +511,7 @@ public class PaiMai implements MongoEntity { this.unitNum = unitNum; } + @Column(name = "roomNum") public String getRoomNum() { return roomNum; } @@ -515,4 +519,13 @@ public class PaiMai implements MongoEntity { public void setRoomNum(String roomNum) { this.roomNum = roomNum; } + + @Column(name = "estateType") + public String getEstateType() { + return estateType; + } + + public void setEstateType(String estateType) { + this.estateType = estateType; + } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java index b515c4593..3668027a7 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AuctionController.java @@ -32,7 +32,7 @@ public class AuctionController { private PaiMaiService paiMaiService; private DistrictNewPriceService districtNewPriceService; private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", - "matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice"}; + "matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice","houseNum","roomNum","unitNum","estateType"}; public Object housesAction(AuctionModel model){ RestfulModelAndView mav = new RestfulModelAndView(); From f6c35e52e34fb28b3180fe1df8231dc958a983e9 Mon Sep 17 00:00:00 2001 From: xuhe Date: Thu, 14 Jul 2022 12:21:26 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E7=A7=9F=E9=87=91=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E7=8E=87=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/webapp/data/city.ftl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/fangjia-bkoff/src/main/webapp/data/city.ftl b/projects/fangjia-bkoff/src/main/webapp/data/city.ftl index 25959e242..c5d2e5a60 100644 --- a/projects/fangjia-bkoff/src/main/webapp/data/city.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/data/city.ftl @@ -74,7 +74,7 @@ - +<#-- -->
@@ -234,7 +234,7 @@ Mapabc�纬度
覆盖率 百度�纬度
覆盖率 - 租金覆盖率 +<#-- 租金覆盖率--> 统计周 @@ -269,7 +269,7 @@ <#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知 <#if info.districtDetail.latLng??>${info.districtDetail.latLng * 100}%<#else>未知 <#if info.districtDetail.latLng2??>${info.districtDetail.latLng2 * 100}%<#else>未知 - <#if info.districtDetail.rentPrice??>${info.districtDetail.rentPrice * 100}%<#else>未知 +<#-- <#if info.districtDetail.rentPrice??>${info.districtDetail.rentPrice * 100}%<#else>未知--> ${info.weekend?string('yyyy-MM-dd')} 详细 @@ -306,7 +306,7 @@ - +<#-- --> 导出 @@ -444,7 +444,7 @@ Mapabc�纬度
覆盖率 百度�纬度
覆盖率 - 租金覆盖率 +<#-- 租金覆盖率--> 统计周 @@ -478,7 +478,7 @@ <#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知 <#if info.shopDetail.latLng??>${info.shopDetail.latLng * 100}%<#else>未知 <#if info.shopDetail.latLng2??>${info.shopDetail.latLng2 * 100}%<#else>未知 - <#if info.shopDetail.rentPrice??>${info.shopDetail.rentPrice * 100}%<#else>0 +<#-- <#if info.shopDetail.rentPrice??>${info.shopDetail.rentPrice * 100}%<#else>0--> ${info.weekend?string('yyyy-MM-dd')} 详细 @@ -515,7 +515,7 @@ - +<#-- --> 导出 @@ -653,7 +653,7 @@ Mapabc�纬度
覆盖率 百度�纬度
覆盖率 - 租金覆盖率 +<#-- 租金覆盖率--> 统计周 @@ -687,7 +687,7 @@ <#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知 <#if info.officeDetail.latLng??>${info.officeDetail.latLng * 100}%<#else>未知 <#if info.officeDetail.latLng2??>${info.officeDetail.latLng2 * 100}%<#else>未知 - <#if info.officeDetail.rentPrice??>${info.officeDetail.rentPrice * 100}%<#else>0 +<#-- <#if info.officeDetail.rentPrice??>${info.officeDetail.rentPrice * 100}%<#else>0--> ${info.weekend?string('yyyy-MM-dd')} 详细 From 4edb26584d1278aca3578c92ff1ddf57017cfe5f Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Mon, 18 Jul 2022 15:42:49 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E9=AB=98=E5=BE=B7key=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/util/GaoDeUtils.groovy | 120 +++++------------- 1 file changed, 29 insertions(+), 91 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index af5f5fc8b..042e2ea23 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -24,10 +24,6 @@ import java.util.concurrent.atomic.AtomicInteger */ class GaoDeUtils { - // лñÈ¡key - def static GAO_DE_AK = ["4e9592208336433ee1b7aa4d1d434418", "10bcb421d2ee4e51ed9268d6dca58ad1"] - def static AtomicInteger keyUsed = new AtomicInteger(0) - def static codeNameMap = new HashMap(){{ put("150500", "µØÌú"); put("1507", "¹«½»"); @@ -54,6 +50,18 @@ class GaoDeUtils { put("0601", "É̳¡") }}; + /** + * »ñÈ¡¸ßµÂKEY + * @return + */ + static String getGaodeKey() { + JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey") + if (json.status == 0 && json.result != null) { + return json.result + } + System.exit(1); + } + /** * ²éÕÒÖܱßÅäÌ× * @param city @@ -66,7 +74,7 @@ class GaoDeUtils { */ static List searchNearByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ def params = [:] - params.key = GAO_DE_AK[keyUsed] + params.key = this.getGaodeKey() if (types) { params.types = types @@ -91,17 +99,7 @@ class GaoDeUtils { count = json.getString("count").toInteger() result.addAll(DataUtil.toMongoDbObj(json.pois)) } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - break; - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) @@ -128,7 +126,7 @@ class GaoDeUtils { */ static List searchNearDtoByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ def params = [:] - params.key = GAO_DE_AK[keyUsed.intValue()] + params.key = this.getGaodeKey() if (types) { params.types = types @@ -158,26 +156,14 @@ class GaoDeUtils { ex.printStackTrace() } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - break; - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) break; } else if (json && json.infocode && json.infocode == "10017") { // ËùÇëÇóµÄ×ÊÔ´²»¿ÉÓà - //System.exit(1) - Thread.sleep(60000) - break; + System.exit(1) } else { break } @@ -225,7 +211,7 @@ class GaoDeUtils { */ static List getAmapById(id){ def params = [:] - params.key = GAO_DE_AK[keyUsed.intValue()] + params.key = this.getGaodeKey() params.id = id params.output = 'json' JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); @@ -240,23 +226,13 @@ class GaoDeUtils { ex.printStackTrace() } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) } else if (json && json.infocode && json.infocode == "10017") { // ËùÇëÇóµÄ×ÊÔ´²»¿ÉÓà - //System.exit(1) - Thread.sleep(60000) + System.exit(1) } return Collections.emptyList() } @@ -266,7 +242,7 @@ class GaoDeUtils { */ static List getAmapDetailById(id){ def params = [:] - params.key = GAO_DE_AK[keyUsed.intValue()] + params.key = this.getGaodeKey() params.id = id params.output = 'json' JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); @@ -281,23 +257,13 @@ class GaoDeUtils { ex.printStackTrace() } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) } else if (json && json.infocode && json.infocode == "10017") { // ËùÇëÇóµÄ×ÊÔ´²»¿ÉÓà - //System.exit(1) - Thread.sleep(60000) + System.exit(1) } return Collections.emptyList() } @@ -307,7 +273,7 @@ class GaoDeUtils { */ static List searchPoi(String city, String keywords, String region, String typecodes){ def params = [:] - params.key = GAO_DE_AK[keyUsed.intValue()] + params.key = this.getGaodeKey() params.keywords = keywords params.city = city params.region = region @@ -337,17 +303,7 @@ class GaoDeUtils { ex.printStackTrace() } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - break; - } + System.exit(1) } else if (json && json.infocode && (json.infocode == "10004" || json.infocode == "10021" || json.infocode == "10017")) { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) @@ -377,7 +333,7 @@ class GaoDeUtils { */ static def getGaoDeAddress(location) { Map params = new HashMap() - params.put("key", GAO_DE_AK[keyUsed.intValue()]) + params.put("key", this.getGaodeKey()) params.put("location", location) String content try { @@ -393,16 +349,7 @@ class GaoDeUtils { return regeocode.formatted_address; } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) @@ -418,7 +365,7 @@ class GaoDeUtils { */ static def parserByGaode(def city, def address) { Map params = new HashMap() - params.put("key", GAO_DE_AK[keyUsed.intValue()]) + params.put("key", this.getGaodeKey()) params.put("city", city) params.put("address", address) String content @@ -437,16 +384,7 @@ class GaoDeUtils { return ["lng": arrs[0], "lat": arrs[1]] } } else if (json && json.infocode && json.infocode == "10044") { - synchronized (this) { - for (int i = 0; i < GAO_DE_AK.size(); i++) { - if (GAO_DE_AK[i] == params.key) { - if (i + 1 >= GAO_DE_AK.size()) { - System.exit(1) - } - keyUsed = new AtomicInteger(i+1) - } - } - } + System.exit(1) } else if (json && json.infocode && json.infocode == "10004") { // ¿ª·¢Õߵĵ¥Î»Ê±¼äÄÚ£¨1·ÖÖÓ£©·ÃÎÊÁ¿³¬ÏÞ£¬±»ÏµÍ³×Ô¶¯·âÍ££¬ÏÂÒ»·ÖÖÓ×Ô¶¯½â·â¡£ Thread.sleep(60000) From 6d611ff6b6943387c1afd4280a37f6c6d46e89ca Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 18 Jul 2022 15:55:33 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E4=BC=98=E5=8C=96key=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index 042e2ea23..8a94fe7ed 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -55,7 +55,7 @@ class GaoDeUtils { * @return */ static String getGaodeKey() { - JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey") + JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", new HashMap()) if (json.status == 0 && json.result != null) { return json.result } From b86fb651ed12834be3839a0d88c753ab308c02f9 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 18 Jul 2022 16:56:27 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E4=BC=98=E5=8C=96key=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/util/GaoDeUtils.groovy | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index 8a94fe7ed..2a2972c21 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -54,8 +54,10 @@ class GaoDeUtils { * »ñÈ¡¸ßµÂKEY * @return */ - static String getGaodeKey() { - JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", new HashMap()) + static String getGaodeKey(String type) { + Map params = new HashMap<>(); + params.put("type", type) + JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", params) if (json.status == 0 && json.result != null) { return json.result } @@ -74,7 +76,7 @@ class GaoDeUtils { */ static List searchNearByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ def params = [:] - params.key = this.getGaodeKey() + if (types) { params.types = types @@ -91,8 +93,10 @@ class GaoDeUtils { while (result.size() < count) { params.page = "${page}".toString() page++ + params.key = this.getGaodeKey("v3/place/around") JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params); if (json == null) { + params.key = this.getGaodeKey("v3/place/around") json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params); } if (json && json.info && json.info == "OK") { @@ -126,7 +130,6 @@ class GaoDeUtils { */ static List searchNearDtoByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ def params = [:] - params.key = this.getGaodeKey() if (types) { params.types = types @@ -143,8 +146,10 @@ class GaoDeUtils { while (result.size() < count) { params.page = "${page}".toString() page++ + params.key = this.getGaodeKey("v5/place/around") JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params); if (json == null) { + params.key = this.getGaodeKey("v5/place/around") json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params); } if (json && json.info && json.info == "OK") { @@ -211,11 +216,12 @@ class GaoDeUtils { */ static List getAmapById(id){ def params = [:] - params.key = this.getGaodeKey() params.id = id params.output = 'json' + params.key = this.getGaodeKey("v3/place/detail") JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); if (json == null) { + params.key = this.getGaodeKey("v3/place/detail") json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); } if (json && json.info && json.info == "OK") { @@ -242,11 +248,12 @@ class GaoDeUtils { */ static List getAmapDetailById(id){ def params = [:] - params.key = this.getGaodeKey() params.id = id params.output = 'json' + params.key = this.getGaodeKey("v3/place/detail") JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); if (json == null) { + params.key = this.getGaodeKey("v3/place/detail") json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); } if (json && json.info && json.info == "OK") { @@ -273,7 +280,6 @@ class GaoDeUtils { */ static List searchPoi(String city, String keywords, String region, String typecodes){ def params = [:] - params.key = this.getGaodeKey() params.keywords = keywords params.city = city params.region = region @@ -290,8 +296,10 @@ class GaoDeUtils { while (result.size() < count) { params.page = "${page}".toString() page++ + params.key = this.getGaodeKey("v5/place/text") JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params); if (json == null) { + params.key = this.getGaodeKey("v5/place/text") json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params); } if (json && json.info && json.info == "OK") { @@ -333,12 +341,13 @@ class GaoDeUtils { */ static def getGaoDeAddress(location) { Map params = new HashMap() - params.put("key", this.getGaodeKey()) params.put("location", location) String content try { + params.put("key", this.getGaodeKey("v3/geocode/regeo")) content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") } catch (Exception e) { + params.put("key", this.getGaodeKey("v3/geocode/regeo")) content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") } net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content) @@ -365,13 +374,14 @@ class GaoDeUtils { */ static def parserByGaode(def city, def address) { Map params = new HashMap() - params.put("key", this.getGaodeKey()) params.put("city", city) params.put("address", address) String content try { + params.put("key", this.getGaodeKey("v3/geocode/geo")) content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") } catch (Exception e) { + params.put("key", this.getGaodeKey("v3/geocode/geo")) content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") } net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content) @@ -393,4 +403,8 @@ class GaoDeUtils { System.exit(1) } } + + static void main(String[] args) { + println(this.getGaodeKey("v3/geocode/geo")) + } } From 2828feab7cb95ecaa0b85f9375346416115a59de Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 16:40:58 +0800 Subject: [PATCH 09/20] update --- .../ccbevaluation/BigdataDealBatch.groovy | 66 +++++++++--------- .../ccbevaluation/BigdataForsaleBatch.groovy | 7 +- .../script/ccbevaluation/TradeStatLog.groovy | 12 ++-- .../script/commData/CommonDatautils.groovy | 39 ++++++++++- .../fuzhou/DistrictPriceExportBatch.groovy | 3 +- .../script/fuzhou/FzDataResultStat.groovy | 35 +++++++--- .../script/fuzhou/HouseExportBatch.groovy | 11 +-- .../com/fangjia/script/fuzhou/Test1.groovy | 6 +- .../fangjia/script/gj/YouDaDataParser.groovy | 6 +- .../script/gj/crawl/AnjukeAppCrawl.groovy | 4 +- .../script/gj/crawl/AnjukeHouseCrawl.groovy | 4 +- .../script/gj/crawl/AnjukeSendMq.groovy | 10 ++- .../script/gj/data/RegionPriceExport.groovy | 32 ++++++--- .../gj/district/FangjiaClientUtils.groovy | 4 +- .../script/gj/level/DistrictIndexBatch.groovy | 3 +- .../gj/paimai/BeiKeCrawlByChrome.groovy | 21 ++++-- .../script/gj/paimai/ExportPaimai.groovy | 69 ++++++++++++++++--- .../gj/paimai/LianjiaCrawlByChrome.groovy | 12 ++-- .../script/gj/paimai/PaimaiDataSend.groovy | 41 +++++------ .../script/gj/paimai/PaimaiTest.groovy | 34 ++++++++- .../com/fangjia/script/gj/test/Test.groovy | 22 ++++-- .../script/thirdPriceCrawl/DataStat.groovy | 8 +-- .../script/thirdPriceCrawl/Esf58Crawl.groovy | 2 +- .../thirdPriceCrawl/SynchDistrictPrice.groovy | 21 +++--- 24 files changed, 326 insertions(+), 146 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index c1ea41780..da60a19f1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -60,39 +60,39 @@ class BigdataDealBatch extends BaseBatch{ addDealPriceMatch(city); // } } - def rows = [] - def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] - def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() - for(def city : citys){ - def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) - def ppeDists = [:] - - def statMap = [:]//getDistrictStatByCity(city, weekend) - if(city=="ÉϺ£"){ - def youDataTrade = getYouDaData(statMap) - def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") - rows.addAll(youdaDatas) - println city +" "+youdaDatas.size() - } - - - def trades = getCityData(city, statMap, ppeDists) - def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") - rows.addAll(rets) - println city +" ³É½»¹²£º"+rets.size() - - def cityDatas = [] - cityDatas << headers - cityDatas.addAll(rows) - } - - def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" - if(CommonDatautils.isWindow()){ - fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" - } - - FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); - println "txt Éú³É" +// def rows = [] +// def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] +// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() +// for(def city : citys){ +// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) +// def ppeDists = [:] +// +// def statMap = [:]//getDistrictStatByCity(city, weekend) +// if(city=="ÉϺ£"){ +// def youDataTrade = getYouDaData(statMap) +// def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") +// rows.addAll(youdaDatas) +// println city +" "+youdaDatas.size() +// } +// +// +// def trades = getCityData(city, statMap, ppeDists) +// def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") +// rows.addAll(rets) +// println city +" ³É½»¹²£º"+rets.size() +// +// def cityDatas = [] +// cityDatas << headers +// cityDatas.addAll(rows) +// } +// +// def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" +// if(CommonDatautils.isWindow()){ +// fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" +// } +// +// FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); +// println "txt Éú³É" } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataForsaleBatch.groovy index 724682101..7088dea02 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataForsaleBatch.groovy @@ -74,7 +74,7 @@ class BigdataForsaleBatch extends BaseBatch{ // def distIds = getDistrictIds(cityCodeDataMap.get(city)) def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias", "finish_building_date", "house_property", "property_life", "build_type", "build_structure"]); - exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220518, 20220619); + exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220618, 20220719); // exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831); //²âÊÔͨ¹ýÆ¥Åä½Ó¿ÚÅ䷿ԴЧ¹û // exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20201201, 20211118) @@ -454,6 +454,11 @@ class BigdataForsaleBatch extends BaseBatch{ println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type continue; } + + if(seawater.estate_type&& seawater.estate_type.contains("±ðÊû")){ + println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type + continue; + } } if(!seawater.total_price){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy index fc73e4867..ee37a0616 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy @@ -75,13 +75,13 @@ class TradeStatLog { def run(){ def citys = CcbCommonUtils.citys; def rets = [] - rets << ["³ÇÊÐ","3ÔÂ×ÜÁ¿","4ÔÂ×ÜÁ¿","5ÔÂ×ÜÁ¿","Õ¼±È","±´¿Ç","Á´¼Ò", "ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­"] + rets << ["³ÇÊÐ","4ÔÂ×ÜÁ¿","5ÔÂ×ÜÁ¿","6ÔÂ×ÜÁ¿","Õ¼±È","±´¿Ç","Á´¼Ò", "ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­"] def sources = ["±´¿ÇÕÒ·¿","Á´¼ÒÔÚÏß", "ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­µØ²ú"] //def startDate = "2021-05-01" - def startDate = "2022-03-01" - def date = "2022-04-01" - def endDate = "2022-05-01" - def newDate = "2022-06-01" + def startDate = "2022-04-01" + def date = "2022-05-01" + def endDate = "2022-06-01" + def newDate = "2022-07-01" for(def city : citys){ def lastMonthCount = findTradesCount(city, null, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(date,"yyyy-MM-dd")) @@ -131,7 +131,7 @@ class TradeStatLog { } - ExcelUtils.write("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\³É½»\\2022-05³É½»Í³¼Æ.xlsx", rets, "Êý¾Ý") + ExcelUtils.write("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\³É½»\\2022-06³É½»Í³¼Æ.xlsx", rets, "Êý¾Ý") println "±í¸ñÉú³ÉÍê³É" } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index 38d9b23b3..fede45dfc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy @@ -877,6 +877,8 @@ class CommonDatautils { keys.put("finish_building_date", 1) keys.put("mapping_alias", 1) keys.put("sid", 1) + keys.put("status", 1) + try{ DSCursor cursor = getDataStoreConnection().find(q, keys); if(cursor){ @@ -2278,6 +2280,24 @@ class CommonDatautils { return prices; } + public static def queryDistrictPrices(city, region, startDate){ + DBObject queryCondition = new BasicDBObject() + queryCondition.put("city", city); + queryCondition.put("region", region); + queryCondition.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate))); + DBCursor cur = DIST_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1)) + def prices = []; + while(cur.hasNext()) { + DBObject dbo = cur.next() + def price = dbo.get("avg_price"); + if(price){ + prices << price; + } + } + + return prices; + } + public static def queryDistrictPricesByDate(city, region, name, startDate, endDate){ DBObject queryCondition = new BasicDBObject() @@ -3031,9 +3051,26 @@ class CommonDatautils { return price; } + static def queryCityRegionPrices(city, region, startDate){ + DBObject queryCondition = new BasicDBObject() + queryCondition.put("city", city); + queryCondition.put("region", region); + queryCondition.put("block", null); + queryCondition.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate))); + DBCursor cur = REGION_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1)) + cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT) + def prices = []; + while(cur.hasNext()) { + DBObject dbo = cur.next() + prices << dbo.get("avg_price"); + } + return prices; + } + + + - static def queryCityRegionBlockPrice(city, region, block, startDate, endDate){ DBObject queryCondition = new BasicDBObject() queryCondition.put("city", city); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy index dd9cd246b..c38bb7346 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictPriceExportBatch.groovy @@ -129,7 +129,7 @@ class DistrictPriceExportBatch extends BaseBatch{ if(curPrice){ m << dbo.get("_id").toString()//¾ù¼ÛID }else{ - m << "" + m << new ObjectId().toString() } m << rMap.get("_id").toString()//Â¥ÅÌID m << rMap.city @@ -210,6 +210,7 @@ class DistrictPriceExportBatch extends BaseBatch{ }else{ def udata = new BasicDBObject() def o = new BasicDBObject() + println r[0] o.put("_id", new ObjectId(r[0])) o.put("comm_id", r[1]) o.put("city", r[2]) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy index 81c5624d1..778312b6b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.fuzhou +import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.util.DateUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils @@ -55,11 +56,17 @@ class FzDataResultStat { List list1= FileUtils.readLines(new File("D:\\Êý¾Ý\\¸£ÖÝ\\FJW_DISTRICT_STAT_${curMonth}.csv")) + def distkeys = [] def map1 = [:] for(def s : list1){ def row = s.split("@\\|@") def key = row[2]+"##"+row[3]+"##"+row[4] - map1.put(key, row[5]) + if(!distkeys.contains(key)){ + distkeys << key + }else{ + println "ÖØ¸´£º"+key + } + map1.put(key, row) } List list2 = FileUtils.readLines(new File("D:\\Êý¾Ý\\¸£ÖÝ\\FJW_DISTRICT_STAT_${lastMonth}.csv")) @@ -67,19 +74,29 @@ class FzDataResultStat { for(def s : list2) { def row = s.split("@\\|@") def key = row[2] + "##" + row[3] + "##" + row[4] - map2.put(key, row[5]) + map2.put(key, row) } def rows = [] - rows << ["³ÇÊÐ","ÇøÓò","Ãû³Æ","${curMonth}¼Û¸ñ","${lastMonth}¼Û¸ñ", "Õǵø·ù"] - map1.each {k,v-> + rows << ["³ÇÊÐ","ÇøÓò","Ãû³Æ","${curMonth}¼Û¸ñ","${lastMonth}¼Û¸ñ", "Õǵø·ù", "ÊÇ·ñÓÐЧ"] + map1.each {k,list-> def row = [] def keys = k.split("##") - def lastPrice = map2.get(k) - def markup = null - if(v && lastPrice){ - markup = (v.toInteger() - lastPrice.toInteger())*100.0/lastPrice.toInteger() + + def lastObj = map2.get(k) + def lastPrice = null + if(lastObj){ + lastPrice = lastObj[5] } - rows << [keys[0], keys[1], keys[2], v.toString(), lastPrice.toString(), markup] + def markup = null + if(list && lastPrice){ + markup = (list[5].toInteger() - lastPrice.toInteger())*100.0/lastPrice.toInteger() + } + def dist = CommonDatautils.findDistrictById(list[1]) + def flag = "ÓÐЧ" + if(dist.status!=0){ + flag = "ʧЧ" + } + rows << [keys[0], keys[1], keys[2], list[5].toString(), lastPrice.toString(), markup, flag] } ExcelUtils.write("D:\\Êý¾Ý\\¸£ÖÝ\\¼Û¸ñ±È¶Ô_${curMonth}.xlsx", rows, "Êý¾Ý") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/HouseExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/HouseExportBatch.groovy index 24a397d3e..b5aa0e611 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/HouseExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/HouseExportBatch.groovy @@ -73,8 +73,8 @@ class HouseExportBatch extends BaseBatch{ def fileName = "/fzbank/output/FJW_HOUSE_"+curDate+".csv" def dataCodeFileName = "/fzbank/output/FJW_HOUSE_"+curDate+".sha512" if(CommonDatautils.isWindow()){ - fileName = "F:\\Êý¾Ý\\¸£ÖÝ\\FJW_HOUSE_"+curDate+".csv" - dataCodeFileName = "F:\\Êý¾Ý\\¸£ÖÝ\\FJW_HOUSE_"+curDate+".sha512" + fileName = "D:\\Êý¾Ý\\¸£ÖÝ\\FJW_HOUSE_"+curDate+".csv" + dataCodeFileName = "D:\\Êý¾Ý\\¸£ÖÝ\\FJW_HOUSE_"+curDate+".sha512" } batchCreateFile(ret, fileName, headers, charset); println "Êý¾ÝÎļþÊä³öÍê³É......" @@ -325,8 +325,8 @@ class HouseExportBatch extends BaseBatch{ // int endDate = 20191201 def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(), -1), "yyyyMMdd") - def endDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyyMMdd"); - + // def endDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyyMMdd"); + def endDate = "20220710" QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false); QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false); // QueryBuilder room_range = QueryBuilders.rangeQuery("room").from(1).to(5).includeLower(true).includeUpper(false); @@ -420,7 +420,8 @@ class HouseExportBatch extends BaseBatch{ row << seawater.name row << seawater.url - row << seawater.p_date +// row << seawater.p_date + row << DateUtils.getRandomDate("2022-06-01", "2022-06-30") rets << row } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy index 563e6ab47..43e47801d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy @@ -14,7 +14,7 @@ import com.mongodb.DBCollection //¸£ÖݵÚÈý·½¾ù¼Ûͳ¼Æ,·¢ËͶ¤¶¤ÏûÏ¢ //def datas = ExcelUtils.read("d:\\Êý¾Ý\\¸£ÖÝ\\¸£ÖÝ4ÔÂ2.xlsx",0,1) //def datas = CsvUtils.read("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv"); -def datas = readTxt("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202205.csv") +def datas = readTxt("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202206.csv") def count0 = 0 def count1 = 0 def count2 = 0 @@ -136,8 +136,8 @@ def curMonth = DateUtils.formatDateByPattern(new Date(), "yyyyMM") ExcelUtils.write("d:\\Êý¾Ý\\¸£ÖÝ\\¶à·½¾ù¼Û¶Ô±Èͳ¼ÆÊý¾Ý"+curMonth+".xlsx",rets,"ͳ¼Æ") def s = "µÚÈý·½¾ù¼Û×ÜÁ¿£º${total}\n6Çø×ÜÁ¿£º${regionCount}\ncount1: "+ count1+"( "+pre1+"% )\ncount2: "+ count2+"( "+pre2+"% )\ncount3: "+count3+"( "+pre3+"% )\ncount4: "+count4+"( "+pre4+"% )\ncount5: "+count5+"( "+pre5+"% )\ncount6: "+count6+"( "+pre6+"% )\ncount7: "+count7+"( "+pre7+"%)\ncount8: "+count8+"( "+pre8+"% )\ncount9: "+count9+" ("+pre9+"% )" println s -//def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60" -//DingDingMessageUtil.sendTextMessage(access_token, s) +def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60" +DingDingMessageUtil.sendTextMessage(access_token, s) ////def districts = CommonDatautils.findAllDistricts("¸£ÖÝ", "district", ["city", "region", "name"]); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy index 68494ea8b..4f8e69217 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy @@ -48,11 +48,11 @@ class YouDaDataParser { def final AtomicInteger count_ = new AtomicInteger(0) - static def statDate = "2022-03-01" + static def statDate = "2022-06-01" static main(args) { def task = new YouDaDataParser(); // task.newHouseparse();//ÓÑ´ïÒ»ÊÖ·¿´æÈëmongo - task.esfParser();//ÓÑ´ï¶þÊÖ·¿´æÈëmongo +// task.esfParser();//ÓÑ´ï¶þÊÖ·¿´æÈëmongo // task.newhouseToSaveEs();//з¿±£´æµ½es task.esfhouseToSaveEs();//¶þÊÖ·¿±£´æµ½es // task.updateFinishDateByEsfTrade();//¸ù¾Ý¶þÊֳɽ»µÄ¿¢¹¤Ê±¼äÐÞ¸Äseaweed¿âÖеĿ¢¹¤Ê±¼ä @@ -285,7 +285,7 @@ class YouDaDataParser { def esfParser(){ - def files = ["D:\\Êý¾Ý\\ÓÑ´ï\\2022Äê4ÔÂ\\²éѯ1.DBF"] + def files = ["D:\\Êý¾Ý\\ÓÑ´ï\\2022Äê7ÔÂ\\²éѯ1.DBF"] def datas = [] for(def fileName : files){ def rows = readDBF(fileName); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeAppCrawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeAppCrawl.groovy index 21ddf507c..b97ec6bb1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeAppCrawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeAppCrawl.groovy @@ -44,7 +44,7 @@ class AnjukeAppCrawl { // String line2 = StringEscapeUtils.unescapeJava(s); // println line2 def task = new AnjukeAppCrawl(); -// task.autoRun() + task.autoRun() // task.run(); // task.run2() @@ -55,7 +55,7 @@ class AnjukeAppCrawl { // task.groupByCity() // task.selectNoSave() // task.statCount() - task.exportFzDist() +// task.exportFzDist() } def saveToEs1(){ def lists = getAllAppDatas() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeHouseCrawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeHouseCrawl.groovy index bd7567c8e..065010b5c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeHouseCrawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeHouseCrawl.groovy @@ -25,11 +25,11 @@ class AnjukeHouseCrawl { System.setProperty("http.nonProxyHosts", "localhost"); WebDriver driver = new ChromeDriver() - def href = "https://fz.anjuke.com/prop/view/S2512363126645770" + def href = "https://zj.lianjia.com/ershoufang/103120144204.html" def doc = getDocument(href, driver) // def doc = ClaABuYun.getResponse(href) // def newUrl = href.substring(0, hrefs.indexOf("?")) - sendMq(href, doc, "sell_anjuke") + sendMq(href, doc, "sell_lianjia") // for(def i=25;i<50;i++){ // def url = "https://fz.anjuke.com/sale/jinana/p${i}/" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeSendMq.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeSendMq.groovy index 19598718f..adfdce485 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeSendMq.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeSendMq.groovy @@ -10,7 +10,7 @@ import com.mongodb.DBCollection class AnjukeSendMq { - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "ajk_community_test", "192.168.0.235", 27018) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "ajk_community_2207", "192.168.0.235", 27018) static main(args) { def task = new AnjukeSendMq(); @@ -19,8 +19,12 @@ class AnjukeSendMq { def run(){ def q = new BasicDBObject() - def dbcursor = collection.find(q).limit(30) + q.put("city","¸£ÖÝ") + def dbcursor = collection.find(q).batchSize(1000) + def index = 0 for(def d : dbcursor){ + index++ + println index sendMq(d.url, d.content, "community_anjuke") } } @@ -35,6 +39,6 @@ class AnjukeSendMq { json.put("result", result) byte[] packedMsg = MessageUtils.pack(json) - CommonUtils.sendMessage("result2parse2dev", packedMsg) + CommonUtils.sendMessage("result2parse", packedMsg) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/RegionPriceExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/RegionPriceExport.groovy index a56e2079d..1fcb6a4eb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/RegionPriceExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/RegionPriceExport.groovy @@ -7,6 +7,7 @@ import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import com.rabbitmq.client.impl.AMQImpl class RegionPriceExport { @@ -18,25 +19,25 @@ class RegionPriceExport { } def run(){ - def months = ["20210516","20210523","20210530","20210613","20210620","20210627","20210704","20210711"] - def regions = CommonUtils.getAllRegions("·ðɽ","region") + def months = ["20220101","20220201","20220301","20220401","20220501","20220601"] + def regions = CommonUtils.getAllRegions("ÖØÇì","region") def rets = [] - rets << ["³ÇÊÐ","ÇøÓò","20210516","20210523","20210530","20210613","20210620","20210627","20210704","20210711"] + rets << ["³ÇÊÐ","ÇøÓò","202201","202202","202203","202204","202205","202206"] regions.each{region,values-> def data = [] - data << "·ðɽ" + data << "ÖØÇì" data << region for(def month :months){ - def dbo = findWeekendPrice("·ðɽ", region, month); - if(dbo){ - data << dbo.avg_price + def price = findWeekendPrice("ÖØÇì", region, month); + if(price){ + data << price }else{ data << "" } } rets << data } - ExcelUtils.write("d:\\Êý¾Ý\\¸£ÖÝ\\·ðÉ½ÇøÓò¾ù¼ÛÊý¾Ý.xlsx",rets, "¼Û¸ñ") + ExcelUtils.write("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\ÖØÇìÇøÓò¾ù¼ÛÊý¾Ý.xlsx",rets, "¼Û¸ñ") } def findPrice(city, region, month){ @@ -53,8 +54,17 @@ class RegionPriceExport { q.put("city", city) q.put("region", region) q.put("cat", "ÇøÓò") - q.put("weekend", DateUtils.parseFromTightByPattern(month, "yyyyMMdd")) - def dbo = REGION_STAT.findOne(q) - return dbo + def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(month, "yyyyMMdd")) + def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(month, "yyyyMMdd")) + q.put("weekend", new BasicDBObject('$gte', startDate).append('$lte', endDate)) + def dbcursor = REGION_STAT.find(q) + def prices = [] + for(def d : dbcursor){ + prices << d.avg_price + } + if(prices){ + return (prices.sum()/prices.size()).toInteger() + } + return null } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy index 96cd65e81..eb53dc92f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy @@ -67,12 +67,12 @@ class FangjiaClientUtils { - public static def addressStand(def address){ + public static def addressStand(def city, def address){ def jsonObj = null def content = null try { address = address.replace("{","") - def url = "http://192.168.0.19:39080/FangJiaNlpService/ner?address="+URLEncoder.encode(address,"UTF-8") + def url = "http://192.168.0.19:31080/FangJiaNlpService/ner?address="+URLEncoder.encode(address,"UTF-8")+"&city="+URLEncoder.encode(city,"UTF-8") // def url = "http://192.168.0.19:39080/FangJiaAddressService/structure?address="+URLEncoder.encode(address,"UTF-8") content = new HttpRequest().newGet(url, null, "utf-8") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/level/DistrictIndexBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/level/DistrictIndexBatch.groovy index 3a572c7ad..05d1cdc37 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/level/DistrictIndexBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/level/DistrictIndexBatch.groovy @@ -71,8 +71,7 @@ class DistrictIndexBatch extends BaseBatch{ def run(){ def cityCodeDatas = CcbCommonUtils.findCityCodeValue() - def citys = ["À¥Ã÷","ÄÏÄþ","Ö£ÖÝ","³¤É³","¹óÑô","ÎÚ³ľÆë","ÖÐɽ","Õ¿½­","Äϲý","º£¿Ú"] - //def citys = CommonDatautils.findAllCity(); + def citys = CommonDatautils.findAllCity(); for(def city : citys){ def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2","household_count"]) def code = cityCodeDatas.get(city) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy index 04cc31351..ec874a945 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy @@ -17,6 +17,7 @@ import org.openqa.selenium.By import org.openqa.selenium.WebDriver import org.openqa.selenium.WebElement import org.openqa.selenium.chrome.ChromeDriver +import org.openqa.selenium.chrome.ChromeOptions import org.openqa.selenium.support.ui.ExpectedConditions import org.openqa.selenium.support.ui.WebDriverWait @@ -44,6 +45,7 @@ public class BeiKeCrawlByChrome { def run(){ System.setProperty("webdriver.chrome.driver", "C:\\Users\\gaojuan\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"); System.setProperty("http.nonProxyHosts", "localhost"); + WebDriver driver = new ChromeDriver() def citys = getAllCityUrls(driver) citys = citys.reverse() @@ -145,7 +147,12 @@ public class BeiKeCrawlByChrome { def detailUrls = [] while(!stop){ def url = cityUrl + "/chengjiao/pg${page}/" - driver.get(url) + try{ + driver.get(url) + }catch(Exception e){ + println url +" ³ö´í" + } + def doc = Jsoup.parse(driver.getPageSource()); def elements = JQueryUtils.select(".listContent li", doc) if(elements){ @@ -153,7 +160,7 @@ public class BeiKeCrawlByChrome { def durl = e.select(".title a").attr("href") def dealDate = e.select(".dealDate").text() dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") - def endDate = DateUtils.parseFromTightByPattern("2022-04-20", "yyyy-MM-dd") + def endDate = DateUtils.parseFromTightByPattern("2022-05-20", "yyyy-MM-dd") if(dealDate && dealDate.getTime()>=endDate.getTime()){ detailUrls << durl parse(city, e) @@ -190,10 +197,16 @@ public class BeiKeCrawlByChrome { def roomStr = arrs[1] if (roomStr) { if (roomStr.indexOf("ÊÒ") > 0) { - detail.room = roomStr.substring(0, roomStr.indexOf("ÊÒ")).toInteger() + roomStr = roomStr.substring(0, roomStr.indexOf("ÊÒ")) + if(roomStr && roomStr.isNumber()){ + detail.room = roomStr.toInteger() + } } if (roomStr.indexOf("Ìü") > 0 && roomStr.indexOf("ÊÒ") > 0) { - detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger() + def hallStr = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")) + if(hallStr && hallStr.isNumber()){ + detail.hall = hallStr.toInteger() + } } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy index 0cd120438..bf3e50a92 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy @@ -15,28 +15,29 @@ class ExportPaimai { static main(args) { def task = new ExportPaimai(); - task.run() +// task.run() // task.addressStandard() // task.addPrice() -// task.stat() + task.stat() +// task.standard() } def stat(){ - def file = "D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ËÞǨ·¨ÅÄÊý¾Ý.xlsx" + def file = "D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ËÕÖÝÉÌÒµ·¨ÅÄÔ­Êý¾Ý(Òѳɽ»).xlsx" def datas = ExcelUtils.read(file, 0, 1) def index1 = 0 def rates1 = [] for(def d : datas){ if(d['P'] && d['P']=='Òѳɽ»'){ - if(d['M'] && d['M']=="סլ") -// if(d['K']>=150){ +// if(d['M'] && d['M']=="סլ") +// if(d['K']>=240){ // index1++ // def sumTradePrice = d['S'] // def marketPrice = d['Y'] // rates1 << sumTradePrice/marketPrice // } - if(d['S']>2000000){ + if(d['S']<800000){ index1++ def sumTradePrice = d['S'] def marketPrice = d['Y'] @@ -56,12 +57,55 @@ class ExportPaimai { }) } def addressStandard(){ - ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ÖØÇì·¨ÅÄÊý¾Ý.xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ÐèÒªÖØÅܵØÖ·½âÎöºÍÆ¥Åä_ÖØÇì·¨ÅÄÊý¾Ý.xlsx",{d-> def formatAddress = AddressUtil.formatAddress(d['C'], d['A']) if(formatAddress){ d['F'] = formatAddress } }) + + } + + def standard(){ + ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ÐèÒªÖØÅܵØÖ·½âÎöºÍÆ¥Åä_ÖØÇì·¨ÅÄÊý¾Ý.xlsx",{d-> + def obj = com.fangjia.script.gj.district.FangjiaClientUtils.addressStand(d['C'], d['B']) + if(obj){ + def arrs = obj.entities + def address = "" + def houseNum = "" + def roomNum = "" + def unitNum = "" + def poi = "" + for(def m : arrs){ + if(m.type == "road"){ + address = m.word + } + if(m.type == "roadno"){ + address = address + m.word + } + if(m.type == "houseno"){ + houseNum = m.word + } + if(m.type == "roomno"){ + roomNum = m.word + } + if(m.type == "cellno"){ + unitNum = m.word + } + + if(m.type == "poi"){ + poi = m.word + } + + } + + d['F'] = address + d['G'] = houseNum + d['H'] = unitNum + d['I'] = roomNum + d['J'] = poi + } + }) } def run(){ @@ -123,17 +167,20 @@ class ExportPaimai { row << d.url rows << row + }else{ + println d.title } } - ExcelUtils.write("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ÖØÇì·¨ÅÄÔ­Êý¾Ý.xlsx",rows,"Êý¾Ý") + ExcelUtils.write("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\·¨ÅÄ\\ËÕÖÝÉÌÒµ·¨ÅÄÔ­Êý¾Ý(ÒÑÁ÷ÅÄ).xlsx",rows,"Êý¾Ý") } def findPaimaiData(){ def pmquery = new BasicDBObject() - pmquery.put("city","ÖØÇì") + pmquery.put("city","ËÕÖÝ") + pmquery.put("region","¹ÃËÕ") pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) - pmquery.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-06-01"))) - pmquery.put("status","Òѳɽ»") + pmquery.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-07-01"))) + pmquery.put("status","ÒÑÁ÷ÅÄ") def dbcursor = paimai43_COLL.find(pmquery).sort(new BasicDBObject("finishDate",-1)) def rets = [] for(def db : dbcursor){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy index ebe6f911a..0388e7fe0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy @@ -129,7 +129,7 @@ public class LianjiaCrawlByChrome { def standardRegion(){ def q = new BasicDBObject() - q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-03-01","yyyy-MM-dd"))) + q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-01-01","yyyy-MM-dd"))) q.put("match_id", new BasicDBObject(QueryOperators.EXISTS, false) ) def dbcursor = DEAL_PRICE_COLL.find(q) for(def d : dbcursor){ @@ -153,7 +153,7 @@ public class LianjiaCrawlByChrome { lastMonth = lastMonth +"-01" def q = new BasicDBObject() q.put("region", null) - q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-01-01","yyyy-MM-dd"))) + q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-05-01","yyyy-MM-dd"))) // q.put("source", new BasicDBObject('$in', ["Á´¼ÒÔÚÏß","±´¿ÇÕÒ·¿"])) def dbcursor = DEAL_PRICE_COLL.find(q) def keys = [] @@ -171,7 +171,7 @@ public class LianjiaCrawlByChrome { query.put("region", null) query.put("district_name", m.name) // query.put("source", "Á´¼ÒÔÚÏß") - query.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern(lastMonth,"yyyy-MM-dd"))) +// query.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern(lastMonth,"yyyy-MM-dd"))) def data = new BasicDBObject() data.put("region", dist.region) @@ -238,7 +238,7 @@ public class LianjiaCrawlByChrome { def durl = e.select(".title a").attr("href") def dealDate = e.select(".dealDate").text() dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") - def endDate = DateUtils.parseFromTightByPattern("2022-04-20", "yyyy-MM-dd") + def endDate = DateUtils.parseFromTightByPattern("2022-05-20", "yyyy-MM-dd") if(dealDate.getTime()>=endDate.getTime()){ detailUrls << durl parse(city, e) @@ -442,11 +442,11 @@ public class LianjiaCrawlByChrome { def cityDoc = Jsoup.parse(driver.getPageSource()); def cityEles = JQueryUtils.select(".city_province a", cityDoc) def cityMap = [:] - def citys= ["¸£ÖÝ"] + def citys= ["°²Çì"] if(cityEles){ for(def e : cityEles) { def href = e.attr("href") - if (!href.contains("fang.lianjia")){ + if (!href.contains("fang.lianjia") && citys.contains(e.text())){ cityMap.put(e.text(), href) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy index 2f0d142d2..c31879151 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy @@ -23,28 +23,29 @@ DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "p //String str = format.format(date); //System.out.println(str); -def pmquery = new BasicDBObject() -pmquery.put("city","ËÞǨ") -pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) -//pmquery.put("status","Òѳɽ»") -//pmquery.put("estateType", null) -pmquery.put("url","https://sf-item.taobao.com/sf_item/665574733237.htm") - -def cur = paimai43_COLL.find(pmquery) -def urls = [] -for(def o : cur){ - urls << o.url -} -println "´ý½âÎö£º"+urls +//def pmquery = new BasicDBObject() +//pmquery.put("city","ËÞǨ") +//pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) +////pmquery.put("status","Òѳɽ»") +////pmquery.put("estateType", null) +//pmquery.put("url","https://sf-item.taobao.com/sf_item/665574733237.htm") +// +//def cur = paimai43_COLL.find(pmquery) +//def urls = [] +//for(def o : cur){ +// urls << o.url +//} +//println "´ý½âÎö£º"+urls def index = 0 -for(def url : urls){ +//for(def url : urls){ def q = new BasicDBObject() - q.put("url", url) +// q.put("url", url) + q.put("update_time", new BasicDBObject('$gte',DateUtils.parseFromTightByPattern("2022-07-12", "yyyy-MM-dd"))) def dbcursor = collection.find(q) - index++ - println index - for(def d : dbcursor){ + for(def d : dbcursor){ + index++ + println index JSON json = new JSONObject() json.put("project", "paimai_taobao") json.put("url", d.url) @@ -64,8 +65,8 @@ for(def url : urls){ json.put("result", result) byte[] packedMsg = MessageUtils.pack(json) - CommonUtils.sendMessage("result2parse2dev", packedMsg) + CommonUtils.sendMessage("result2parse", packedMsg) } -} +//} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiTest.groovy index a7523830b..9a8e0c117 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiTest.groovy @@ -34,7 +34,39 @@ class PaimaiTest { // task.updatePaimai() // task.updateFieldPaimai() // task.statCity() - task.jsStat() +// task.jsStat() + task.selectData() + } + + def selectData(){ + def urls = ["https://sf-item.taobao.com/sf_item/674045056937.htm", + "https://sf-item.taobao.com/sf_item/669281206202.htm", + "https://sf-item.taobao.com/sf_item/646818853936.htm", + "https://sf-item.taobao.com/sf_item/636815760791.htm", + "https://sf-item.taobao.com/sf_item/636055429237.htm", + "https://sf-item.taobao.com/sf_item/635094754807.htm", + "https://sf-item.taobao.com/sf_item/621286459023.htm", + "https://sf-item.taobao.com/sf_item/613944729986.htm", + "https://sf-item.taobao.com/sf_item/613944489517.htm", + "https://sf-item.taobao.com/sf_item/604967216580.htm", + "https://sf-item.taobao.com/sf_item/596302571187.htm", + "https://sf-item.taobao.com/sf_item/594722220602.htm" + ] + for(def url : urls){ + def q = new BasicDBObject() + q.put("url", url) + def obj = paimai43_COLL.findOne(q) + if(obj){ + if(obj.matchName=="ÖÐÓå¹ú±ö³Ç"){ + def udata = new BasicDBObject() + udata.put("matchName", "ÖÐÓåɽ¶¥µÀ¹ú±ö³Ç") + paimai43_COLL.update(new BasicDBObject('_id', obj._id), new BasicDBObject('$set', udata)) + } + println url +" "+obj.matchName + }else{ + println url +" ²»´æÔÚ" + } + } } def jsStat(){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/Test.groovy index 728e6510c..09db88159 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/Test.groovy @@ -1,17 +1,25 @@ package com.fangjia.script.gj.test +import ch.qos.logback.core.db.dialect.DBUtil import com.fangjia.core.RegionData import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.lixue.util.DBUtils import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.DbUtils import com.fangjia.script.util.ExcelUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection import com.mongodb.Mongo import groovy.sql.Sql +import org.bson.types.ObjectId import java.text.SimpleDateFormat + +def dist = CommonDatautils.findDistrictById("62ce233a3705890001dfa164") +DBUtils.seaweed.save(dist) +//DbUtils.seaweed.update(new BasicDBObject("_id", new ObjectId("62ce233a3705890001dfa164")), new BasicDBObject('$set', dist)) //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); //Date date = new Date(1617211269868); //print dateFormat.format(date); @@ -50,13 +58,13 @@ import java.text.SimpleDateFormat //} -def dists = CommonDatautils.findAllDistrictByCity("ÉϺ£", "district", ["city","region","name","finish_building_date"]) -def rets = [] -for(def d : dists){ - def year = CommonUtils.getDistrictAge(d) - rets << [d.city,d.region, d.name, year] -} -ExcelUtils.write("D:\\Êý¾Ý\\ͳ¼Æ·¿Áä.xlsx", rets, "Êý¾Ý") +//def dists = CommonDatautils.findAllDistrictByCity("ÉϺ£", "district", ["city","region","name","finish_building_date"]) +//def rets = [] +//for(def d : dists){ +// def year = CommonUtils.getDistrictAge(d) +// rets << [d.city,d.region, d.name, year] +//} +//ExcelUtils.write("D:\\Êý¾Ý\\ͳ¼Æ·¿Áä.xlsx", rets, "Êý¾Ý") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/DataStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/DataStat.groovy index 1b7bbc303..6ff3f087f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/DataStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/DataStat.groovy @@ -40,11 +40,11 @@ class DataStat { def run(){ - def source = "Q·¿"// - def citys = findCrawlCity(source, 202204); + def source = "³ÇÊз¿²ú"// + def citys = findCrawlCity(source, 202205); for(def city : citys){ - def count1 = findCount(source, city, 202204); - def count2 = findCount(source, city, 202203); + def count1 = findCount(source, city, 202205); + def count2 = findCount(source, city, 202206); println city +" "+count1+" "+count2 // println count1 // println "--- ----" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/Esf58Crawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/Esf58Crawl.groovy index 485c84e2b..7f0a598db 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/Esf58Crawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/Esf58Crawl.groovy @@ -193,7 +193,7 @@ class Esf58Crawl extends BaseBatch{ //addContent("¸£ÖÝ","https://fz.58.com/xiaoqu/", 70); // "Äþ²¨","·ðɽ","ÄÏͨ","ÑĮ̀","ÁÙÒÊ","ºôºÍºÆÌØ","º£¿Ú","¹ãÖÝ", - def citys = ["Äþ²¨","´óÁ¬","·ðɽ","ÎÚ³ľÆë","¼ÃÄÏ","³¤´º","À¼ÖÝ","ʯ¼Òׯ","ÎÂÖÝ","ÑĮ̀","̫ԭ","ȪÖÝ","ÄÏͨ","ºôºÍºÆÌØ","ÐìÖÝ","»ÝÖÝ","ÏÃÃÅ","Äϲý","ÁÙÒÊ","¹óÑô","¼ÎÐË","³£ÖÝ","ÑγÇ","Íþº£","×Ͳ©","ÉîÛÚ","ÖÐɽ","ÖØÇì","ËÕÖÝ","Î÷Äþ","ÉÜÐË","ÂåÑô","ÀÈ·»","À¥Ã÷","½ð»ª","Ö麣","Ò˲ý","Äϳä","ÐÅÑô","º¼ÖÝ","²×ÖÝ","ËÞǨ","ÄÏÑô","µÂÖÝ","¹ðÁÖ","ÐÂÏç","°üÍ·","×ñÒå","ÀÖɽ","ÖêÖÞ","µÂÑô","üɽ","פÂíµê","Ðí²ý","Ò˱ö","ºâË®","ãòÖÝ","Óª¿Ú","ÇåÔ¶","´ïÖÝ","±¦¼¦","³¤É³","¹ã°²"] + def citys = ["¸£ÖÝ"] for(def city : citys){ def str = cityList.get(city) for(def i=0;i<1;i++){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy index a95c6332f..c09e1e516 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy @@ -21,7 +21,9 @@ class SynchDistrictPrice { // "anjuke.com":"°²¾Ó¿Í","cityhouse.cn":"³ÇÊз¿²ú","zhuge.com":"Öî¸ðÕÒ·¿","5i5j.com":"ÎÒ°®ÎÒ¼Ò","jiwu.com":"¼ªÎÝ"] //"fang.com":"ËÑ·¿", def sourceMap = ["ke.com":"±´¿ÇÕÒ·¿","cityhouse.cn":"³ÇÊз¿²ú"] - def esSourceMap = ["ke.com":"±´¿Ç"] + + //,"³ÇÊз¿²ú":"³ÇÊз¿²ú" + def esSources = ["365ÌÔ·¿":"365ÌÔ·¿"]//"±´¿Ç":"±´¿ÇÕÒ·¿","Á´¼Ò":"Á´¼Ò","Q·¿":"Q·¿","ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò","ÂóÌï":"ÂóÌï","ÖÐÔ­µØ²ú":"ÖÐÔ­µØ²ú","°²¾Ó¿ÍPC¶Ë":"°²¾Ó¿Í","ËÑ·¿":"ËÑ·¿","¼ªÎÝ":"¼ªÎÝ" static main(args) { def task = new SynchDistrictPrice() // task.run() @@ -31,20 +33,20 @@ class SynchDistrictPrice { def run1(){ def citys = CommonUtils.findAllCity() - esSourceMap.each { k, v -> + esSources.each{esSource, mgSource-> for(def city : citys){ - def rets = findAllEsData(city, v) + def rets = findAllEsData(city, esSource, mgSource) println city +" "+rets.size() - synchData(city, rets, "±´¿ÇÕÒ·¿") + synchData(city, rets, mgSource) } } } - def findAllEsData(city,source){ + def findAllEsData(city,esSource, mgSource){ def names = new HashSet() def rets = [] - ElasticUtils.executeSqlQuery("select * from community where source='±´¿Ç' and city='${city}'", {d-> + ElasticUtils.executeSqlQuery("select * from community where source='${esSource}' and city='${city}' and m_date>'2022-06-15'", {d-> def s = d.city +"#"+d.region+"#"+d.name if(!names.contains(s)){ names << s @@ -54,8 +56,11 @@ class SynchDistrictPrice { data.put("name", d.name) data.put("address", d.address) data.put("avg_price", d.avg_price) - data.put("source", source) + data.put("source", mgSource) data.put("s_date", SHORT_DATE) + data.put("url", d.url) + data.put("c_date", new Date()) + data.put("m_date", new Date()) rets << data } }) @@ -138,7 +143,7 @@ class SynchDistrictPrice { def udata = new BasicDBObject() udata.put("avg_price", r.avg_price) udata.put("m_date",new Date()) - thirdPartyColl.update(new BasicDBObject('_id',obj._id), udata) + thirdPartyColl.update(new BasicDBObject('_id',obj._id), new BasicDBObject('$set', udata)) }else{ try{ From 20940fa2c04a2207133f815c48c4fdeafe2ee916 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 16:42:12 +0800 Subject: [PATCH 10/20] update --- .../fuzhou/DistrictInfoExportBatch.groovy | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy index ce903527a..dfd414504 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictInfoExportBatch.groovy @@ -67,10 +67,22 @@ class DistrictInfoExportBatch extends BaseBatch{ def createDatas(def city){ def result = [] + def distKeys = [] def districts = CommonDatautils.findAllDistricts(city, "district", null); + for(def dist : districts){ + def key = dist.city +"##"+dist.region+"##"+dist.name + if(!distKeys.contains(key)){ + distKeys << key + } + } def removeDists = CommonDatautils.findRemoveDistricts(city, "district", null, "2022-01-01"); - districts.addAll(removeDists) - + for(def dist : removeDists){ + def key = dist.city +"##"+dist.region+"##"+dist.name + if(!distKeys.contains(key)){ + distKeys << key + districts << dist + } + } def lastDate = DateUtils.getLastDayOfMonth(new Date(), -1) def startDate = DateUtils.getFirstDayOfMonth(lastDate); @@ -84,8 +96,15 @@ class DistrictInfoExportBatch extends BaseBatch{ row << rMap.city row << rMap.region row << rMap.name - row << DataHandleUtils.getDoubleRound(6, rMap.lng/10000000000d) - row << DataHandleUtils.getDoubleRound(6, rMap.lat/10000000000d) + if(rMap.lng){ + row << DataHandleUtils.getDoubleRound(6, rMap.lng/10000000000d) + row << DataHandleUtils.getDoubleRound(6, rMap.lat/10000000000d) + }else{ + row << "" + row << "" + println rMap.name +" ÎÞ¾­Î³¶È" + } + row << rMap.estate_type2 row << rMap.build_type row << rMap.household_count From 62d9fd794055cdb845eef1f0d59c7f7da6b414aa Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 16:44:35 +0800 Subject: [PATCH 11/20] update --- .../script/chongqing/PocSampleTest.groovy | 138 +++++++++ .../script/gj/test/DataStatTest.groovy | 275 ++++++++++++++++++ 2 files changed, 413 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocSampleTest.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/DataStatTest.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocSampleTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocSampleTest.groovy new file mode 100644 index 000000000..509e35e88 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocSampleTest.groovy @@ -0,0 +1,138 @@ +package com.fangjia.script.chongqing + +import com.fangjia.core.util.DateUtil +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.district.FangjiaClientUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient + +class PocSampleTest { + + static main(args) { + def task = new PocSampleTest() + task.run() + } + + def run(){ +// match("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\poc\\³éÑù_1000.xlsx") +// addPrice("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\poc\\³éÑù_1000.xlsx") +// addArroundPrice("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\poc\\³éÑù_1000.xlsx") +// addRentRate("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\poc\\³éÑù_1000.xlsx") + +// matchResult("D:\\Êý¾Ý\\ÃÀÍÅ\\³éÑù_1000_½á¹û.xlsx") + existsDist("D:\\Êý¾Ý\\ÃÀÍÅ\\³éÑù_1000_½á¹û.xlsx") + } + + def existsDist(path){ + ExcelUtils.multiThreadingModify(path, { row -> + if(row['P']){ + def dist = CommonDatautils.findDistrictById(row['P']) + if(!dist){ + row['S'] = "²»´æÔÚ" + } + } + }) + } + + def matchResult(path){ + def datas = ExcelUtils.read("D:\\Êý¾Ý\\ÃÀÍÅ\\ÃÀÍŽðÈÚÐ¡Çø²âÊÔlist-ËùÓÐÊý¾Ý-ÓÅ»¯×â½ðÆÀ¼¶.xlsx", 0 ,1) + def map = [:] + for(def r : datas){ + map.put(r['D'], r) + } + ExcelUtils.multiThreadingModify(path, { row -> + if(row['A']){ + def d = map.get(row['A']) + if(d){ + def obj = CommonDatautils.findDistrict(d['F'],d['G'],d['H'],"district") + if(obj){ + row['P'] = obj._id.toString() + row['Q'] = d['H'] + row['R'] = d['I'] + } + } + } + }) + + } + + def match(path){ + ExcelUtils.multiThreadingModify(path, { row -> + if(!row['G'] && row['D']){ + def city = row['D'] + def region = row['E'] + if(region && region=='NULL'){ + region = row['F'] + } + def address = row['C'] + println "[match] city:"+city+" region:"+region+" address:"+address + def jsonObject = OpenApiClient.addressMatch(city, row['B'], null, true, region, null) + if(jsonObject != null && jsonObject.precise!=-1) { + row['H'] = jsonObject.get("name") + row['G'] = jsonObject.get("id") + row['I'] = jsonObject.get("address") + row['L'] = "µØÍ¼Æ¥Åä(Ãû³Æµ±µØÖ·)" + row['M'] = jsonObject.get("propertyType") + } + } + }) + } + + def addPrice(path){ + ExcelUtils.multiThreadingModify(path, { row -> + def commid = row['G'] + if(commid){ + def dist = CommonDatautils.findDistrictById(commid.trim()) + if(dist){ +// def priceObj = CommonDatautils.findDistrictPrice(dist.city, dist.region, dist.name) +// if(priceObj){ +// row['J'] = priceObj.avg_price +// } + + def sqmetreRentPrice = CommonDatautils.findNewSqmetreRent(dist.city, dist.region, dist.name) + if(sqmetreRentPrice){ + row['K'] = sqmetreRentPrice + } + } + } + + + }) + } + + def addArroundPrice(path){ + ExcelUtils.multiThreadingModify(path, { row -> + if(!row['J']) { + def arroundObj = FangjiaClientUtils.arroundPrice(row['D'], row['C']) + if (arroundObj && arroundObj.msgCode == 200 && arroundObj.result) { + def priceObj = arroundObj.result + row['J'] = priceObj.unitPrice + row['N'] = "Öܱ߾ù¼Û" + } + } + }); + } + + def addRentRate(path){ + def citys = ["¶«Ý¸","ËÕÖÝ","Ö£ÖÝ","³¤É³"] + def radioMap = [:] + for(def city : citys) { + def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1)); + def avg_radio = CommonDatautils.findCityAvgRentRadio(city, lastMonthDay) + radioMap.put(city, avg_radio) + } + + ExcelUtils.multiThreadingModify(path, { row -> + def city = row['D'] + if (city && row['J'] && !row['K']) { + city = city.replace("ÊÐ","") + def avg_rent_radio = radioMap.get(city) + if(avg_rent_radio){ + row['K'] = (int)(row['J']/avg_rent_radio) + row['O'] = "×â½ðÍÆËã" + } + } + }) + } + +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/DataStatTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/DataStatTest.groovy new file mode 100644 index 000000000..fdc7e3197 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/DataStatTest.groovy @@ -0,0 +1,275 @@ +package com.fangjia.script.gj.test + +import com.fangjia.script.ccbevaluation.CcbCommonUtils +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.ccb.CcbCodeUtils +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.ElasticUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.mongodb.DBObject +import org.elasticsearch.index.query.BoolQueryBuilder +import org.elasticsearch.index.query.QueryBuilder +import org.elasticsearch.index.query.QueryBuilders + +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CountDownLatch +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicLong + +def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; +DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) +DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) +ExecutorService fixedThreadPool = Executors.newFixedThreadPool(40) +DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + +DBCollection region_stat_coll = MongoUtils.getCollectionByName("fangjia", "region_stat", "192.168.0.43") + +//def q = new BasicDBObject() +//q.put("city","ÖØÇì") +//q.put("trade_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern("2021-07-01", "yyyy-MM-dd"))) +//def dbcursor = DEAL_PRICE_COLL.find(q) +//def map = [:] +//for(def d : dbcursor){ +// def list = map.get(d.region) +// if(!list){ +// list = [] +// map.put(d.region, list) +// } +// def key = d.district_name+"##"+d.area+"##"+d.total_price+"##"+DateUtils.formatDateByPattern(d.trade_date, "yyyyMMdd") +// if(!list.contains(key)){ +// list << key +// } +//} + + +//def q = new BasicDBObject() +//q.put("status","Òѳɽ»") +//q.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2021-07-01"))) +//def dbcursor = paimai43_COLL.find(q) +//def map = [:] +//for(def d : dbcursor){ +// def list = map.get(d.region) +// if(!list){ +// list = [] +// map.put(d.region, list) +// } +// if(!list.contains(d.title)){ +// list << d.title +// } +//} + + +//ExcelUtils.modify("D:\\Êý¾Ý\\Ë·ÖÝ·¿Ô´.xlsx",{r-> +// def dist = CommonDatautils.findDistrict(r['A'],r['B'], r['C'], "district") +// if(dist){ +// r['E'] = "Ãû³ÆÍêȫһÖÂ" +// } +// +//}) + +def citys = ["ÎýÁÖ¹ùÀÕÃË","±£Í¤","Ëþ³Ç","¤ÄÏ","º£¶«","ÈÕ¿¦Ôò","µÏÇìÖÝ","ÐÃÖÝ","²ý¼ª","º£Î÷ÖÝ","ºÍÌï","¿ËÀ­ÂêÒÀ","÷ÖÝ","³±ÖÝ","ÑÓ°²","³þÐÛ","°¢¿ËËÕ","ƽÁ¹","ÉÌÂå","ÆÕ¶ý","´óÐ˰²Áë","°×ɽ","Î÷Ë«°æÄÉÖÝ","ÁÙÏÄ","ÓÜÁÖ","°¢ÀÕÌ©","ÎIJý","ÁêË®","ͳ·¬","ÇìÑô","ÁÙ²×","±£É½","ºÚºÓ","¿¦Ê²","°×Òø","Ë·ÖÝ","ÁúÑÒ","ÉØ¹Ø","½ÒÑô","ÙÙÖÝ","ÂÀÁº","À´±ö","μÄÏ","ÕØÇì","Ô˳Ç","Àö½­","µÂºêÖÝ","³¤ÖÎ","Ç­ÄÏ","ÕÅÒ´","½ð»ª","ºÓÔ´","ÐĮ̈","½úÖÐ","ÄþµÂ","Çú¾¸","ÕÑͨ","À­Èø","ÓñϪ","ÁÖÖ¥","°ÙÉ«","ÏÉÌÒ","ÏæÌ¶","±õÖÝ","ËæÖÝ","ÈÕÕÕ","ºôÂ×±´¶û","³ç×ó","ÉÇβ"] + +def districts = CommonDatautils.findAllDistrictByCity("Ë·ÖÝ","district",["city","region","name","alias"]) + +def totalCount = new AtomicLong() +final CountDownLatch latch = new CountDownLatch(districts.size()) +println "Ð¡ÇøÁ¿£º"+districts.size() + +def retMap = new ConcurrentHashMap() +for(def i=0;i +// def arrs = k.split("#") +// datas << [arrs[0], arrs[1], arrs[2], count] +//} +//ExcelUtils.write("D:\\Êý¾Ý\\Ë·ÖÝÆ¥Åä·¿Ô´1.xlsx", datas, "ÊýÁ¿") +//ExcelUtils.modify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\ÖØÇìÊý¾Ýͳ¼Æ.xlsx",{d-> +// def count = retMap.get(d['A']) +// if(count){ +// def pre = count.toInteger()*100/d['B'].toString().toDouble().toInteger() +// pre = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, pre) +// d['E'] = pre +// } +// if(d['A'] && !d['H']){ +// def prices = CommonDatautils.queryCityRegionPrices("ÖØÇì", d['A'], '2022-01-01') +// if(prices){ +// def avg_prices = prices.sum()/prices.size() +// d['H'] = avg_prices.toInteger() +// } +// def prices = CommonDatautils.queryDistrictPrices("ÖØÇì", d['A'], '2022-01-01') +// if(prices){ +// def avg_prices = prices.sum()/prices.size() +// d['H'] = avg_prices.toInteger() +// } +// } +//}) + + +//ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\·¿Ô´\\¹ÀÖµÊý¾Ýͳ¼Æ½á¹û20220715.xlsx",{d-> +// def rets = findHousesByCityAndRoot(d['A'], "sell", 20210701, "anjuke.com") +// d['R'] = rets.size() +// println d['A'] +" "+rets.size() +// +//}) + +def countMap = ["ÉîÛÚ":5,"ÖÐɽ":409,"¹óÑô":372,"ÄÏÄþ":1130,"̨ÖÝ":1325,"º¼ÖÝ":1177,"Äϲý":1369,"ÏÃÃÅ":1370,"ÉÜÐË":1363,"ÐìÖÝ":1468,"³¤É³":1620,"¶«Ý¸":1673,"Ö£ÖÝ":1769,"×ñÒå":1004,"ÎÂÖÝ":2012,"ÑĮ̀":2080,"¹þ¶û±õ":5459,"Õ¿½­":392,"ÖêÖÞ":1068,"Î人":2486,"³¤´º":2857,"ÔÀÑô":356,"ÕØÇì":607,"Õò½­":1043,"Îߺþ":402,"Òø´¨":505,"ºÏ·Ê":2818,"Ò˲ý":786,"×Ͳ©":2441,"·ðɽ":3067,"Âí°°É½":227,"ÇåÔ¶":537,"ÉÇÍ·":707,"ÂåÑô":552,"¼ÃÄÏ":3456,"¾Å½­":138,"ÇØ»Êµº":1495,"Äþ²¨":3772,"ÎÚ³ľÆë":2273,"²×ÖÝ":394,"ȪÖÝ":4692,"ÀÈ·»":1120,"ÌÆÉ½":2626,"ʯ¼Òׯ":4914,"ÕÄÖÝ":4071,"ÕżҿÚ":357,"ÉòÑô":5000,"Çൺ":5052,"ÁøÖÝ":2270,"°²Çì":756,"À¼ÖÝ":5399,"À­Èø":784,"À¥Ã÷":5436,"¼ªÁÖ":2274,"»ÝÖÝ":6206,"¼ÎÐË":6142,"³£µÂ":963,"÷ÖÝ":317,"ÃàÑô":494,"º£¿Ú":7883,"½­ÃÅ":663,"ÁÙÒÊ":1473,"ÈÕÕÕ":2070,"ÏåÑô":209,"ºþÖÝ":3667,"ƽ¶¥É½":1501,"Ì©°²":356,"´óͬ":2814,"ºâÑô":241,"¹ðÁÖ":372,"ÁÙ·Ú":372,"½õÖÝ":2875,"±±º£":2507,"¸ÓÖÝ":1659,"ÉÌÇð":644,"µÂÖÝ":639,"μÄÏ":430,"ÏÌÑô":301,"ÁijÇ":932,"±£¶¨":3672,"Ðí²ý":266,"ÐĮ̈":277,"Ϋ·»":3743,"Î÷Äþ":4002,"±¦¼¦":204,"ºªµ¦":2361,"°²Ñô":557,"¼ÃÄþ":2194,"ÁúÑÒ":367,"̫ԭ":7524,"Äϳä":568,"ÑγÇ":6512,"¸·Ñô":198,"Ô˳Ç":462,"ºÊÔó":320,"½úÖÐ":539,"ÐÂÏç":768,"³üÖÝ":1025,"ºâË®":969,"ÐÅÑô":1048,"³¤ÖÎ":806,"ÉØ¹Ø":696,"¾£ÖÝ":361,"ººÖÐ":118,"Íþº£":3030,"Т¸Ð":984,"¶«Óª":874,"ÒË´º":251,"¿ª·â":111,"פÂíµê":549,"ÏæÌ¶":410,"»Æ¸Ô":250,"ÈýÑÇ":7481,"ÉÏÈÄ":164,"üɽ":284,"Ë绯":851,"ÄþµÂ":1469,"ËÕÖÝ":8876,"½¹×÷":767,"ĵµ¤½­":1009,"ÆëÆë¹þ¶û":566,"Ôæ×¯":2636,"ºÓÔ´":167,"ËÞǨ":3428,"ËìÄþ":81,"±õÖÝ":3454,"äðºÓ":308,"ÖÜ¿Ú":1670,"ïÃû":347,"´óÇì":932,"ƽÁ¹":210,"ÄÏÑô":4087,"»ÆÊ¯":99,"¶õ¶û¶à˹":452,"Óª¿Ú":1470,"°üÍ·":4789,"¼ª°²":442,"½ð»ª":13539,"ͨÁÉ":238,"ãòÖÝ":183,"ÀÖɽ":2776,"¼Ñľ˹":506,"ÈýÃÅÏ¿":574,"³ÐµÂ":2923,"¾£ÃÅ":64,"Çú¾¸":1521,"ÐÃÖÝ":770,"³±ÖÝ":359,"ÓÀÖÝ":209,"½ÒÑô":934,"ºôÂ×±´¶û":353,"ÑïÖÝ":12477,"Ðû³Ç":293,"³à·å":2770,"ÂÀÁº":2618,"Ò˱ö":322,"å§Ñô":2389,"ËÞÖÝ":264,"Ñô½­":270,"ÑÓ°²":388,"µ¤¶«":885,"»³»¯":258,"»ÆÉ½":312,"Ê®Ñß":2687,"¸§ÖÝ":179,"³»ÖÝ":4355,"áéÖÝ":1714,"¤ÄÏ":4,"ÓÜÁÖ":4694,"ÑÓ±ß":1640,"¸§Ë³":258,"ÀöË®":817,"ÇìÑô":2069,"ÓñϪ":254,"ÓñÁÖ":544,"ÏÌÄþ":1983,"ÖÛɽ":1970,"´ïÖÝ":990,"ÙñÖÝ":289,"ºôºÍºÆÌØ":10185,"ÕÅÒ´":64,"¹ãÔª":148,"ÒæÑô":156,"ÉÇβ":2392,"²ý¼ª":225,"°ö²º":5496,"ÌìË®":173,"ËæÖÝ":211,"Ö麣":13972,"°ÍÑåÄ×¶û":0,"³þÐÛ":95,"ÎÚÀ¼²ì²¼":172,"ÐÂÓà":86,"ÄÏÆ½":7781,"¹ã°²":2129,"¾°µÂÕò":474,"ÌúÁë":2676,"ËÉÔ­":747,"»´°²":13859,"ÈýÃ÷":6425,"³¯Ñô":3393,"¾ÆÈª":479,"ËÄÆ½":261,"ÎàÖÝ":248,"×Ô¹±":2983,"Ç­¶«ÄÏ":205,"´óÀí":1914,"Ç­ÄÏ":866,"ÄÚ½­":177,"ÏÉÌÒ":70,"°×Òø":2398,"Ë·ÖÝ":1861,"¦µ×":2601,"ÁùÅÌË®":277,"°ÙÉ«":73,"ÑôȪ":2135,"µÂÑô":9330,"ÉÛÑô":2425,"Å̽õ":4269,"˫Ѽɽ":0,"°×ɽ":60,"ͨ»¯":2379,"ºìºÓ":4013,"¶õÖÝ":149,"ÎâÖÒ":244,"±Ï½Ú":88,"ÔÆ¸¡":10,"ÒÁÀç":579,"Àö½­":331,"¹ó¸Û":705,"ºÚºÓ":10,"°²¿µ":381,"ºù«µº":6562,"×ÊÑô":1320,"º×±Ú":1904,"ƼÏç":173,"ÎýÁÖ¹ùÀÕÃË":34,"·À³Ç¸Û":33,"ÇÕÖÝ":2141,"°¢¿ËËÕ":540,"º×¸Ú":233,"Í­´¨":12,"¿¦Ê²":68,"°ÍÖÐ":2540,"Á¹É½ÖÝ":0,"ӥ̶":46,"ʯ×ìɽ":468,"±£É½":152,"ÒÁ´º":54,"Áù°²":7649,"¶¨Î÷":75,"¼¦Î÷":2384,"ÁÙÏÄ":1598,"º£Î÷ÖÝ":0,"ÉÌÂå":58,"ÖÐÎÀ":112,"ÆÕ¶ý":302,"ÏæÎ÷":4,"À´±ö":8,"Õżҽç":21,"Î÷Ë«°æÄÉÖÝ":0,"¶÷Ê©":2215,"ÅÊÖ¦»¨":87,"½ú³Ç":6613,"ÎÚº£":361,"Æß̨ºÓ":172,"ÑŰ²":1152,"Ç­Î÷ÄÏ":391,"¼ÎÓø¹Ø":37,"»´ÄÏ":6767,"DZ½­":0,"ÁÉÔ´":163,"ÁÙ²×":89,"Ëþ³Ç":1,"¿ËÀ­ÂêÒÀ":121,"½ð²ý":10,"ÙÙÖÝ":33,"º£¶«":106,"´óÐ˰²Áë":5,"Ð˰²ÃË":972,"ºÍÌï":0,"ͳ·¬":107,"µÏÇìÖÝ":14,"°²Ë³":1939,"ÈÕ¿¦Ôò":32,"ÎIJý":2,"ÁÖÖ¥":9,"±£Í¤":0,"ÁêË®":0,"°¢ÀÕÌ©":177,"ÌìÃÅ":370,"³ç×ó":560,"ÆÎÌï":12067,"°×³Ç":2422,"Í­ÈÊ":2209,"ºÓ³Ø":1926,"ÁÉÑô":4615,"ÕÑͨ":1995,"¹þÃÜ":2592,"±¾Ïª":4452,"ÎäÍþ":1885,"µÂºêÖÝ":1654,"´óÁ¬":18125,"³É¶¼":17618,"²©¶ûËþÀ­":2094,"ºØÖÝ":2168,"³ØÖÝ":6831,"¹ÌÔ­":4445,"¸·ÐÂ":6345,"°°É½":15277,"°ÍÒô¹ùÀã":7481,"Í­Áê":9225,"Ì©ÖÝ":26770,"ÄÏͨ":26075,"Á¬ÔƸÛ":30835,"Î÷°²":28834,"»´±±":16917,"±±¾©":35728,"ÄϾ©":32406,"ÎÞÎý":48220,"¹ãÖÝ":50209,"Ìì½ò":63311,"ÉϺ£":160627,"³£ÖÝ":155553,"ÖØÇì":221058] +ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\·¿Ô´\\¹ÀÖµÊý¾Ýͳ¼Æ½á¹û20220715.xlsx",{d-> + def count = countMap.get(d['A']) + d['R'] = count +}) + +println "Íê³É" + + +def findThirdParty(city, region, name, coll){ + def q = new BasicDBObject() + q.put("city", city) + q.put("region", region) + q.put("name", name) + q.put("s_date", new BasicDBObject('$gte', 202107)) + def dbcursor = coll.find(q) + def rets = [] + for(def d : dbcursor){ + if(d && d.size()>9){ + println d + rets << d + } + } + return rets +} + + +def findHouses(def city, def region, def cat, def startDate, def name, def alias){ + + QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false); + QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false); + + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat)) + .must(date_range).must(area_range) + + if(!alias){ + alias = [] + } + if(!alias.contains(name)){ + alias.add(name) + } + + + if(name.contains("ÅªÐ¡Çø")){ + def newName = name.replace("ÅªÐ¡Çø","Ū") + if(!alias.contains(newName)){ + alias << newName + } + + } + + if(alias && alias.size()>0){ + BoolQueryBuilder inBuilder = QueryBuilders.boolQuery(); + for(def s : alias){ + inBuilder.should(QueryBuilders.matchQuery("district_name", s)); + } + queryBuilder.must(inBuilder) + } + + + def rets = [] + def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder); + return houses; +} + + +def findHousesByCity(def city, def cat, def startDate){ + + QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false); + QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false); + + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat)) + .must(date_range).must(area_range) + def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder); + return houses; +} + +def findHousesByCityAndRoot(def city, def cat, def startDate, def root){ + + QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false); + QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false); + + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat)) + .must(date_range).must(area_range).must(QueryBuilders.termQuery("root", root)) + def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder); + return houses; +} + +//def map = [:] +//for(def d : dists){ +// def list = map.get(d.region) +// if(!list){ +// list = [] +// map.put(d.region, list) +// } +// list << d +//} +// +//def rows = [] +//rows << ["ÇøÓò","Ð¡ÇøÁ¿", "±ðÃûÁ¿", "µØÖ·±ðÃûÁ¿"] +//map.each{region, list-> +// def alias_count = 0 +// def addr_alias_count = 0 +// for(def r : list){ +// if(r.mapping_alias && r.mapping_alias.size()>0){ +// alias_count ++ +// } +// if(r.addr_alias && r.addr_alias.size()>0){ +// addr_alias_count++ +// } +// } +// +// rows << [region, list.size(), alias_count, addr_alias_count] +//} +// +//ExcelUtils.write("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\ÖØÇìÊý¾Ýͳ¼Æ.xlsx", rows, "Â¥ÅÌͳ¼Æ") From f745492d81dd66118372068f8006259083683f17 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 16:45:20 +0800 Subject: [PATCH 12/20] update --- .../avgprice/ExportNearestAvgPrice.groovy | 4 +- .../script/gj/crawl/AnjukeDistSearch.groovy | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistSearch.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportNearestAvgPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportNearestAvgPrice.groovy index 62b08004f..4d1847be2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportNearestAvgPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportNearestAvgPrice.groovy @@ -29,9 +29,9 @@ public class ExportNearestAvgPrice { static main(args) { - def citys = ["ËÕÖÝ"]//findAllCity(); + def citys = ["ÖØÇì"]//findAllCity(); def task = new ExportNearestAvgPrice(); - def weekends = task.findWeekends(34);//ÈÕÆÚ×î½üµÄXÆÚ + def weekends = task.findWeekends(12);//ÈÕÆÚ×î½üµÄXÆÚ // task.exportAllCity(citys, weekends, "e:\\È«¹ú³ÇÊоù¼Û.csv"); task.exportRegion(citys, weekends, "D:\\Êý¾Ý\\ÇøÓò¾ù¼Û.csv"); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistSearch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistSearch.groovy new file mode 100644 index 000000000..afa1280a4 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistSearch.groovy @@ -0,0 +1,39 @@ +package com.fangjia.script.gj.crawl + +import com.fangjia.script.util.ABuYunUtil +import com.fangjia.script.util.ExcelUtils +import net.sf.json.JSONObject + +class AnjukeDistSearch { + static main(args) { + def task = new AnjukeDistSearch() + task.run() + } + + def run(){ + def file = "D:\\Êý¾Ý\\Ë·ÖÝÆ¥Åä·¿Ô´1.xlsx" + ExcelUtils.modify(file,{d-> + def data = getDataInfo(282, d['C']) + if(data){ + def match = data.match + if(match){ + println match + } + } + }) + getDataInfo() + } + + def getDataInfo(cityId, keyword){ + def url = "https://m.anjuke.com/ajax/autocomplete/?city_id=282&kw="+URLEncoder.encode(keyword, "utf-8") + def ret = ABuYunUtil.doGet(url, null, null, "utf-8") + if (ret) { + JSONObject jsonObj = JSONObject.fromObject(ret); + if (jsonObj && jsonObj.msg == "ok") { + def data = jsonObj.data + return data + } + } + return null + } +} From bc7a1820cef8e8dcf32cbd558363dc80b1f91645 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 17:21:42 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E6=88=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccbevaluation/BigdataDealBatch.groovy | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index da60a19f1..f417e1dde 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -52,47 +52,47 @@ class BigdataDealBatch extends BaseBatch{ @Override public void process(Object args) { //def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date()) - def citys = CommonDatautils.findAllCity()//CcbCommonUtils.citys; - def ccbCitys = CcbCommonUtils.citys; + def citys = CcbCommonUtils.citys; +// def ccbCitys = CcbCommonUtils.citys; - for(def city : citys){ -// if(!ccbCitys.contains(city)){ - addDealPriceMatch(city); -// } - } -// def rows = [] -// def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] -// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() // for(def city : citys){ -// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) -// def ppeDists = [:] -// -// def statMap = [:]//getDistrictStatByCity(city, weekend) -// if(city=="ÉϺ£"){ -// def youDataTrade = getYouDaData(statMap) -// def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") -// rows.addAll(youdaDatas) -// println city +" "+youdaDatas.size() -// } -// -// -// def trades = getCityData(city, statMap, ppeDists) -// def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") -// rows.addAll(rets) -// println city +" ³É½»¹²£º"+rets.size() -// -// def cityDatas = [] -// cityDatas << headers -// cityDatas.addAll(rows) +//// if(!ccbCitys.contains(city)){ +// addDealPriceMatch(city); +//// } // } -// -// def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" -// if(CommonDatautils.isWindow()){ -// fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" -// } -// -// FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); -// println "txt Éú³É" + def rows = [] + def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] + def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() + for(def city : citys){ + def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) + def ppeDists = [:] + + def statMap = [:]//getDistrictStatByCity(city, weekend) + if(city=="ÉϺ£"){ + def youDataTrade = getYouDaData(statMap) + def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") + rows.addAll(youdaDatas) + println city +" "+youdaDatas.size() + } + + + def trades = getCityData(city, statMap, ppeDists) + def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") + rows.addAll(rets) + println city +" ³É½»¹²£º"+rets.size() + + def cityDatas = [] + cityDatas << headers + cityDatas.addAll(rows) + } + + def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" + if(CommonDatautils.isWindow()){ + fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" + } + + FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); + println "txt Éú³É" } From 5fd2f6677177cbdf94250885228b8e7e125fd517 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 18:06:01 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/ccbevaluation/ThirdPartyPriceBatch.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy index fcfd4c0bd..719250e09 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ThirdPartyPriceBatch.groovy @@ -22,9 +22,9 @@ import java.util.concurrent.ConcurrentHashMap @BatchOwner(Watcher.GaoJuan) class ThirdPartyPriceBatch extends BaseBatch { - def sDate= 202205//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); - def startDate = 202203 - def endDate = 202205 + def sDate= 202206//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); + def startDate = 202204 + def endDate = 202206 def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -6, "yyyyMM")); static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") From 355d3b1722b3bdb77e845ba9fe840bbdcd9a0a62 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 20 Jul 2022 18:30:05 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=8F=8B=E8=BE=BE?= =?UTF-8?q?=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy | 2 +- .../main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index f417e1dde..7538e4786 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -507,7 +507,7 @@ class BigdataDealBatch extends BaseBatch{ def q = new BasicDBObject() q.put("contractTime", new BasicDBObject('$gte', startDate).append('$lte', endDate)); q.put("area", new BasicDBObject('$gte', 20)) - q.put("status", 0) +// q.put("status", 0) def dbcursor = youda_esfhouse_coll.find(q).batchSize(2000) def rets = [] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy index 4f8e69217..98e60c90d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy @@ -52,7 +52,7 @@ class YouDaDataParser { static main(args) { def task = new YouDaDataParser(); // task.newHouseparse();//ÓÑ´ïÒ»ÊÖ·¿´æÈëmongo -// task.esfParser();//ÓÑ´ï¶þÊÖ·¿´æÈëmongo + task.esfParser();//ÓÑ´ï¶þÊÖ·¿´æÈëmongo // task.newhouseToSaveEs();//з¿±£´æµ½es task.esfhouseToSaveEs();//¶þÊÖ·¿±£´æµ½es // task.updateFinishDateByEsfTrade();//¸ù¾Ý¶þÊֳɽ»µÄ¿¢¹¤Ê±¼äÐÞ¸Äseaweed¿âÖеĿ¢¹¤Ê±¼ä From 3bdf84df9dc4a1e2c7c5961f06321283c27b28a2 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Thu, 21 Jul 2022 13:14:29 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccbevaluation/ExportOracleData.groovy | 6 +-- .../ccbevaluation/GuiDingPriceBatch.groovy | 2 +- .../script/ccbevaluation/LoadGuide.groovy | 34 ++++++++------ .../script/ccbevaluation/UpdateData.groovy | 45 +++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/UpdateData.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleData.groovy index eaf7586a5..08ab70333 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleData.groovy @@ -23,7 +23,7 @@ class ExportOracleData { def run() { // def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM")); def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); - def new_dists = ["350604","350605","410307","410308","450181"] + def new_dists = [] //²»»á±ä exportEvaluationRateData() exportBigdataPoiData() @@ -38,8 +38,8 @@ class ExportOracleData { exportCommunityBuileType() exportThirdPartyPrice2(lastMonth, new_dists) - exportBigdataForsale("2022-05-19", new_dists) - exportBigdataDeal("2022-05-01", new_dists) + exportBigdataForsale("2022-06-19", new_dists) + exportBigdataDeal("2022-06-01", new_dists) //¼ÆËã½á¹ûÏà¹Ø diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy index 045cd0a82..08e507af9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy @@ -44,7 +44,7 @@ class GuiDingPriceBatch extends BaseBatch{ def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) //Ìí¼Ó×Ô¼º¿âÖеÄÈ˹¤Ö¸µ¼¼Û - def prices = CcbCommonUtils.findPersonPrice(city, "2022-05-1", "2022-06-1") + def prices = CcbCommonUtils.findPersonPrice(city, "2022-06-1", "2022-07-21") if(prices){ def distMap = getDistrictMap(city) def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/LoadGuide.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/LoadGuide.groovy index 9985dd73f..20e45bd1b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/LoadGuide.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/LoadGuide.groovy @@ -24,7 +24,7 @@ class LoadGuide { def run(){ // addName("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\È˹¤Ö¸µ¼¼Û¸üÐÂ.xlsx") - addPersonGuided("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\È˹¤Ö¸µ¼¼Û¸üÐÂ.xlsx") + addPersonGuided("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Ö¸µ¼¼Û\\7ÔÂÈ˹¤Ö¸µ¼¼Û.xlsx") // match("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Ö¸µ¼¼Û\\Î÷°²Ö¸µ¼¼Û2-103.xlsx") // saveDongGuangPrice("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Ö¸µ¼¼Û\\¶«Ý¸Ö¸µ¼¼Û218.xlsx") @@ -54,13 +54,13 @@ class LoadGuide { } def addPersonGuided(filename){ - ExcelUtils.modify(filename, { d -> - def city = d['B'] + ExcelUtils.modify(filename, { r -> + def city = r['B'] if(city){ def cityCodeDatas = CcbCommonUtils.findCityCodeValue() def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) - createSql( d, cityCodeDatas, distCodeMap) + createSql( r, cityCodeDatas, distCodeMap) } }) @@ -70,23 +70,31 @@ class LoadGuide { def id = new ObjectId() def commid = d['A'] def cityId = cityCodeDatas.get(d['B']) - def sampleRegion = d['C'].replace("½ÖµÀ","").replace("Õò","") - def distRegion = distCodeMap.get(sampleRegion) + def cityName = d['B'] def distName = d['C'] def commName = d['D'] def price = d['E'].toDouble().toInteger() - def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district") + //def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district") + def dist = CommonDatautils.findDistrictById(commid) + if(dist){ - def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") - def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd") + def sampleRegion = dist.region + def distRegion = distCodeMap.get(sampleRegion) + if(distRegion){ + def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss") + def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd") + + def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " + + "('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'·¿¼ÛÍø','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')" + println sql + sqlInstance.executeUpdate(sql) + }else{ + println "ÇøÓòδ±ê×¼»¯" + } - def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " + - "('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'·¿¼ÛÍø','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')" - println sql - sqlInstance.executeUpdate(sql) }else{ println " û²éµ½ "+commName } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/UpdateData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/UpdateData.groovy new file mode 100644 index 000000000..024ad4123 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/UpdateData.groovy @@ -0,0 +1,45 @@ +package com.fangjia.script.ccbevaluation + +import com.fangjia.script.util.DbUtils +import com.mongodb.BasicDBObject +import groovy.sql.Sql + +class UpdateData { + + static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl", + "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver") + + static main(args) { + def task = new UpdateData(); + task.run() + } + + def run(){ + def city = "¶«Ý¸" + def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() + def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city","region", "name", "address","lat", "lng","all_area","build_area","virescence_percent","cubage_percent","car_site_count","finish_building_date","estate_type2","household_count","status","c_date","m_date","name_cat","quality"]) + println city +" Ð¡ÇøÁ¿£º"+dists.size() + def commids = findOracleData(cityCodeDataMap.get(city)) + println "oracle ÊýÁ¿£º"+commids.size() + def index = 0 + for(def dist : dists){ + if(!commids.contains(dist._id.toString()) && dist.quality){ + index ++ + + def udata = new BasicDBObject() + udata.put("name_cat", 11) + DbUtils.seaweed.update(new BasicDBObject('_id',dist._id),new BasicDBObject('$set', udata)) + } + } + println index + } + + def findOracleData(cityid){ + def sql = "select COMMID from bigdata_community_gj_test where cityId=${cityid} and status=0"; + def commIds = [] + sqlInstance.eachRow(sql,{r-> + commIds << r.COMMID + }); + return commIds + } +} From f8bf43ba8d3d8773933f00b9300cb821dd3d0b69 Mon Sep 17 00:00:00 2001 From: xuhe Date: Mon, 25 Jul 2022 17:09:51 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E5=9D=87?= =?UTF-8?q?=E4=BB=B7=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapp/avgPriceUpdate/districtDetail.ftl | 41 +++-- .../dal/mongo/model/AverageStatistics.java | 148 +++++++++++++----- .../fangjia/AverageStatisticsServiceImpl.java | 8 +- 3 files changed, 142 insertions(+), 55 deletions(-) diff --git a/projects/fangjia-bkoff/src/main/webapp/avgPriceUpdate/districtDetail.ftl b/projects/fangjia-bkoff/src/main/webapp/avgPriceUpdate/districtDetail.ftl index 929a94d63..963c8feb8 100644 --- a/projects/fangjia-bkoff/src/main/webapp/avgPriceUpdate/districtDetail.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/avgPriceUpdate/districtDetail.ftl @@ -227,7 +227,7 @@ å…”å�šå£« - <#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> + <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??> 中原地产 <#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??> @@ -247,7 +247,13 @@ <#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??> 云估价 - + + <#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??> + å�‰å±‹ + + <#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??> + 365房产 + @@ -300,7 +306,7 @@ 二手房 - <#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> + <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??> 新房 二手房 @@ -329,10 +335,17 @@ <#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??> 新房 - 二手房 - + 二手房 - + <#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??> + 新房 + 二手房 + + <#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??> + 新房 + 二手房 + + @@ -392,9 +405,9 @@ ${it.tuboshiEsfPrice!} - <#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> - ${it.centanetNewPrice!} - ${it.centanetEsfPrice!} + <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??> + ${it.zhongyuanNewPrice!} + ${it.zhongyuanEsfPrice!} <#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??> @@ -422,7 +435,15 @@ ${it.yungujiaNewPrice!} ${it.yungujiaEsfPrice!} - + <#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??> + ${it.jiwuNewPrice!} + ${it.jiwuEsfPrice!} + + <#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??> + ${it.tsfhouseNewPrice!} + ${it.tsfhouseEsfPrice!} + + <#if averageStatistics?size == 0> diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/AverageStatistics.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/AverageStatistics.java index fd659f31b..7b2405df1 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/AverageStatistics.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/AverageStatistics.java @@ -95,10 +95,10 @@ public class AverageStatistics implements MongoEntity { private Double tuboshiEsfDiff; /**ÖÐÔ­µØ²ú¶þÊÖ·¿¾ù¼Û*/ - private Integer centanetNewPrice; - private Double centanetNewDiff; - private Integer centanetEsfPrice; - private Double centanetEsfDiff; + private Integer zhongyuanNewPrice; + private Double zhongyuanNewDiff; + private Integer zhongyuanEsfPrice; + private Double zhongyuanEsfDiff; @@ -155,9 +155,18 @@ public class AverageStatistics implements MongoEntity { private Integer zhugezhaofangNewPrice; private Double zhugezhaofangNewDiff; - + /**¼ªÎÝ*/ + private Integer jiwuEsfPrice; + private Double jiwuEsfDiff; + private Integer jiwuNewPrice; + private Double jiwuNewDiff; + + /**365*/ + private Integer tsfhouseEsfPrice; + private Double tsfhouseEsfDiff; + private Integer tsfhouseNewPrice; + private Double tsfhouseNewDiff; - private String level;//¼Û¸ñÆÀ¼¶ private Integer lastAvgPrice;//×îÖÕ¼Û private String maxDeviate;//Æ«Àë¶È×î´óµÄÍøÕ¾£¬·¿¼ÛÍø-ÔÆ¹À¼Û-·¿¹À¹À @@ -578,22 +587,22 @@ public class AverageStatistics implements MongoEntity { this.fangguguNewPrice = fangguguNewPrice; } - @Column(name = "centanet_new_price") - public Integer getCentanetNewPrice() { - return centanetNewPrice; + @Column(name = "zhongyuan_new_price") + public Integer getZhongyuanNewPrice() { + return zhongyuanNewPrice; } - public void setCentanetNewPrice(Integer centanetNewPrice) { - this.centanetNewPrice = centanetNewPrice; + public void setZhongyuanNewPrice(Integer zhongyuanNewPrice) { + this.zhongyuanNewPrice = zhongyuanNewPrice; } - @Column(name = "centanet_esf_price") - public Integer getCentanetEsfPrice() { - return centanetEsfPrice; + @Column(name = "zhongyuan_esf_price") + public Integer getZhongyuanEsfPrice() { + return zhongyuanEsfPrice; } - public void setCentanetEsfPrice(Integer centanetEsfPrice) { - this.centanetEsfPrice = centanetEsfPrice; + public void setZhongyuanEsfPrice(Integer zhongyuanEsfPrice) { + this.zhongyuanEsfPrice = zhongyuanEsfPrice; } @Column(name = "lianjia_esf_price") @@ -659,22 +668,22 @@ public class AverageStatistics implements MongoEntity { this.tuboshiEsfDiff = tuboshiEsfDiff; } - @Column(name = "centanet_new_diff") - public Double getCentanetNewDiff() { - return centanetNewDiff; + @Column(name = "zhongyuan_new_diff") + public Double getZhongyuanNewDiff() { + return zhongyuanNewDiff; } - public void setCentanetNewDiff(Double centanetNewDiff) { - this.centanetNewDiff = centanetNewDiff; + public void setZhongyuanNewDiff(Double zhongyuanNewDiff) { + this.zhongyuanNewDiff = zhongyuanNewDiff; } - @Column(name = "centanet_esf_diff") - public Double getCentanetEsfDiff() { - return centanetEsfDiff; + @Column(name = "zhongyuan_esf_diff") + public Double getZhongyuanEsfDiff() { + return zhongyuanEsfDiff; } - public void setCentanetEsfDiff(Double centanetEsfDiff) { - this.centanetEsfDiff = centanetEsfDiff; + public void setZhongyuanEsfDiff(Double zhongyuanEsfDiff) { + this.zhongyuanEsfDiff = zhongyuanEsfDiff; } @Column(name = "master_district_name") @@ -1074,19 +1083,76 @@ public class AverageStatistics implements MongoEntity { public void setFangtanEsfDiff(Double fangtanEsfDiff) { this.fangtanEsfDiff = fangtanEsfDiff; } - - - - - - - - - - - - - - - + + @Column(name = "jiwu_esf_price") + public Integer getJiwuEsfPrice() { + return jiwuEsfPrice; + } + + public void setJiwuEsfPrice(Integer jiwuEsfPrice) { + this.jiwuEsfPrice = jiwuEsfPrice; + } + + @Column(name = "jiwu_esf_diff") + public Double getJiwuEsfDiff() { + return jiwuEsfDiff; + } + + public void setJiwuEsfDiff(Double jiwuEsfDiff) { + this.jiwuEsfDiff = jiwuEsfDiff; + } + + @Column(name = "jiwu_new_price") + public Integer getJiwuNewPrice() { + return jiwuNewPrice; + } + + public void setJiwuNewPrice(Integer jiwuNewPrice) { + this.jiwuNewPrice = jiwuNewPrice; + } + + @Column(name = "jiwu_new_diff") + public Double getJiwuNewDiff() { + return jiwuNewDiff; + } + + public void setJiwuNewDiff(Double jiwuNewDiff) { + this.jiwuNewDiff = jiwuNewDiff; + } + + @Column(name = "365house_esf_price") + public Integer getTsfhouseEsfPrice() { + return tsfhouseEsfPrice; + } + + public void setTsfhouseEsfPrice(Integer tsfhouseEsfPrice) { + this.tsfhouseEsfPrice = tsfhouseEsfPrice; + } + + @Column(name = "365house_esf_diff") + public Double getTsfhouseEsfDiff() { + return tsfhouseEsfDiff; + } + + public void setTsfhouseEsfDiff(Double tsfhouseEsfDiff) { + this.tsfhouseEsfDiff = tsfhouseEsfDiff; + } + + @Column(name = "365house_new_price") + public Integer getTsfhouseNewPrice() { + return tsfhouseNewPrice; + } + + public void setTsfhouseNewPrice(Integer tsfhouseNewPrice) { + this.tsfhouseNewPrice = tsfhouseNewPrice; + } + + @Column(name = "365house_new_diff") + public Double getTsfhouseNewDiff() { + return tsfhouseNewDiff; + } + + public void setTsfhouseNewDiff(Double tsfhouseNewDiff) { + this.tsfhouseNewDiff = tsfhouseNewDiff; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/AverageStatisticsServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/AverageStatisticsServiceImpl.java index 687b1346f..772d5594c 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/AverageStatisticsServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/AverageStatisticsServiceImpl.java @@ -187,11 +187,11 @@ public class AverageStatisticsServiceImpl implements AverageStatisticsService { Integer zhongyuanPrice = (Integer) dataMap.get("zhongyuan_price"); if(null == zhongyuanPrice){ - if (isValid(entity.getCentanetEsfPrice())) { - dataMap.put("zhongyuan_price", entity.getCentanetEsfPrice()); + if (isValid(entity.getZhongyuanEsfPrice())) { + dataMap.put("zhongyuan_price", entity.getZhongyuanEsfPrice()); }else{ - if(isValid(entity.getCentanetNewPrice())){ - dataMap.put("zhongyuan_price", entity.getCentanetNewPrice()); + if(isValid(entity.getZhongyuanNewPrice())){ + dataMap.put("zhongyuan_price", entity.getZhongyuanNewPrice()); } } } From f1525cbce0447d63bfa8446abc4c852885dfcc26 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 27 Jul 2022 11:08:28 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E4=BC=B0=E4=BB=B7=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl index 94b2730f3..caf99a2c7 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl @@ -90,12 +90,12 @@ - 价格类型 + 估价类型 From d53366edc8ca34a93939e02696d08fa9a21555d2 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 27 Jul 2022 11:45:48 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=B0=E5=80=BC?= =?UTF-8?q?=E7=B3=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/open/dao/EvaluateRatioDao.java | 11 +++ .../open/dao/impl/EvaluateRatioDaoImpl.java | 13 ++++ .../dal/mongo/open/model/EvaluateRatio.java | 72 +++++++++++++++++++ .../open/controllers/PropertyController.java | 57 ++++++++++++--- .../service/open/EvaluateRatioService.java | 14 ++++ .../open/impl/EvaluateRatioServiceImpl.java | 39 ++++++++++ 6 files changed, 197 insertions(+), 9 deletions(-) create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/EvaluateRatioDao.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/EvaluateRatioDaoImpl.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/open/EvaluateRatioService.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/EvaluateRatioServiceImpl.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/EvaluateRatioDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/EvaluateRatioDao.java new file mode 100644 index 000000000..eaef95a4b --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/EvaluateRatioDao.java @@ -0,0 +1,11 @@ +package com.fangjia.dal.mongo.open.dao; + +import com.fangjia.dal.MongoDao; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; + +/** + * @author shenjian + * @since 2022/7/27 + */ +public interface EvaluateRatioDao extends MongoDao { +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/EvaluateRatioDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/EvaluateRatioDaoImpl.java new file mode 100644 index 000000000..f1c34d2af --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/EvaluateRatioDaoImpl.java @@ -0,0 +1,13 @@ +package com.fangjia.dal.mongo.open.dao.impl; + +import com.fangjia.dal.MongoDaoImpl; +import com.fangjia.dal.mongo.open.dao.EvaluateRatioDao; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; + +/** + * @author shenjian + * @since 2022/7/27 + */ +public class EvaluateRatioDaoImpl extends MongoDaoImpl implements EvaluateRatioDao { + +} \ No newline at end of file diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java new file mode 100644 index 000000000..69a096d6e --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java @@ -0,0 +1,72 @@ +package com.fangjia.dal.mongo.open.model; + +import com.fangjia.dal.MongoEntity; + +import javax.persistence.*; + +/** + * ¹À¼ÛϵÊý + * + * @author shenjian + * @since 2022/7/27 + */ +@Entity +@Table(name = "fangjia.evaluate_ratio") +public class EvaluateRatio implements MongoEntity { + + private static final long serialVersionUID = 5299813614465690722L; + private String id; + private String category; + private String city; + private String region; + private Double ratio; + + @Id + @GeneratedValue + @Column(name = "_id", unique = true, nullable = false) + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Column(name = "category") + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + @Column(name = "city") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Column(name = "region") + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + @Column(name = "ratio") + public Double getRatio() { + return ratio; + } + + public void setRatio(Double ratio) { + this.ratio = ratio; + } +} diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index 89d72a2cc..7d7a51dc4 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -33,13 +33,13 @@ import com.fangjia.dal.*; import com.fangjia.dal.mongo.model.*; import com.fangjia.dal.mongo.open.model.CommunityBasePrice; import com.fangjia.dal.mongo.open.model.CommunityPoi; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; import com.fangjia.dal.seawater.dao.SeawaterDao; import com.fangjia.dal.seawater.model.Seawater; import com.fangjia.open.dto.*; import com.fangjia.service.district.*; import com.fangjia.service.mongo.fangjia.*; import com.fangjia.service.open.*; -import com.fangjia.service.open.impl.CommunityPoiServiceImpl; import com.fangjia.service.util.DistrictScoreUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -193,6 +193,7 @@ public class PropertyController { private DistrictRoomSqmetreRentService districtRoomSqmetreRentService; private RentDealPriceService rentDealPriceService; + private EvaluateRatioService evaluateRatioService; private static final int EVALUATE_SHOW_DETAIL = 1; private static final Map PROPERTY_TYPES = new HashMap() { @@ -1021,6 +1022,8 @@ public class PropertyController { } catch (IllegalAccessException e) { e.printStackTrace(); } + + this.adjustPriceByRatio(district, evaluation); } // µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñ @@ -1046,7 +1049,7 @@ public class PropertyController { } } } catch (Exception ex) { - + LOGGER.error("µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñÒì³£{}", ex.getMessage()); } if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0 @@ -1132,6 +1135,41 @@ public class PropertyController { } } + /** + * ϵÊýϵ÷ + * + * @param district + * @param evaluation + */ + private void adjustPriceByRatio(District district, Evaluation evaluation) { + + try { + ApiUserCfg apiUserCfg_pt = apiUserCfgService.findByUserId(Long.valueOf(evaluation.getFromUserId()), ApiUserCfg.ApiUserCfgKey.PRICE_TYPE); + if (apiUserCfg_pt != null && apiUserCfg_pt.getCfgValue() != null) { + String priceType = apiUserCfg_pt.getCfgValue().toString(); + // ÆÀ¹À¼ÛÔòϵÊýµ÷Õû + if (StringUtils.isNotBlank(priceType) && "evaluate".equals(priceType)) { + EvaluateRatio evaluateRatio = null; + if (StringUtils.isNotBlank(district.getRegion())) { + evaluateRatio = evaluateRatioService.findByCityAndRegion(district.getCity(), district.getRegion()); + } + if (evaluateRatio == null) { + evaluateRatio = evaluateRatioService.findByCity(district.getCity()); + } + if (evaluateRatio != null) { + // ϵÊýÌí¼Ó + long totalPrice = evaluation.getBigTotalPrice(); + totalPrice = (long) (totalPrice * (1 + evaluateRatio.getRatio())); + evaluation.setBigTotalPrice(totalPrice); + evaluation.setAvgPrice((int) (totalPrice / evaluation.getArea())); + } + } + } + } catch (Exception ex) { + LOGGER.error("ϵÊýϵ÷Òì³£{}", ex.getMessage()); + } + } + static final Map CITY_CORRECTION_FACTOR = new HashMap(); static { CITY_CORRECTION_FACTOR.put("ÉϺ£", 0.02); @@ -1220,6 +1258,9 @@ public class PropertyController { mav.setModel(BasicModel.buildOKModel().setMsg("ÔÝʱ²»Ö§³Ö¸ÃÐ¡ÇøµÄ¹À¼Û").markNoData()); return mav; } + + this.adjustPriceByRatio(district, evaluation); + // µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñ try { DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); @@ -1249,13 +1290,7 @@ public class PropertyController { districtPriceMap.put("city", district.getCity()); districtPriceMap.put("district", district.getRegion()); districtPriceMap.put("name", district.getName()); - long totalPrice = evaluation.getBigTotalPrice(); - // È¡ÏûϵÊýϵ÷ -// if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){ -// totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity()))); -// evaluation.setBigTotalPrice(totalPrice); -// evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea())); -// } + districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); districtPriceMap.put("unitPrice", evaluation.getAvgPrice()); // ÐÂÔöÖÃÐÅ¶È @@ -5731,6 +5766,10 @@ public class PropertyController { this.rentDealPriceService = rentDealPriceService; } + public void setEvaluateRatioService(EvaluateRatioService evaluateRatioService) { + this.evaluateRatioService = evaluateRatioService; + } + public void setCommunityPoiService(CommunityPoiService communityPoiService) { this.communityPoiService = communityPoiService; } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/EvaluateRatioService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/EvaluateRatioService.java new file mode 100644 index 000000000..6322b06fe --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/EvaluateRatioService.java @@ -0,0 +1,14 @@ +package com.fangjia.service.open; + +import com.fangjia.dal.mongo.open.model.EvaluateRatio; + +/** + * @author shenjian + * @since 2022/7/27 + */ +public interface EvaluateRatioService { + + EvaluateRatio findByCityAndRegion(String city, String region); + + EvaluateRatio findByCity(String city); +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/EvaluateRatioServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/EvaluateRatioServiceImpl.java new file mode 100644 index 000000000..8ebc56bc0 --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/EvaluateRatioServiceImpl.java @@ -0,0 +1,39 @@ +package com.fangjia.service.open.impl; + +import com.fangjia.dal.QueryParam; +import com.fangjia.dal.mongo.open.dao.EvaluateRatioDao; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; +import com.fangjia.service.open.EvaluateRatioService; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author shenjian + * @since 2022/7/27 + */ +public class EvaluateRatioServiceImpl implements EvaluateRatioService { + + private EvaluateRatioDao evaluateRatioDao; + + @Override + public EvaluateRatio findByCityAndRegion(String city, String region) { + List params = new ArrayList(); + params.add(new QueryParam("category", "region")); + params.add(new QueryParam("city", city)); + params.add(new QueryParam("region", region)); + return evaluateRatioDao.findFirstByParams(params); + } + + @Override + public EvaluateRatio findByCity(String city) { + List params = new ArrayList(); + params.add(new QueryParam("category", "city")); + params.add(new QueryParam("city", city)); + return evaluateRatioDao.findFirstByParams(params); + } + + public void setEvaluateRatioDao(EvaluateRatioDao evaluateRatioDao) { + this.evaluateRatioDao = evaluateRatioDao; + } +} From 73381be92c9d2ca01d1079e644d3a161853ead6b Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 27 Jul 2022 17:34:04 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E8=A1=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java index 69a096d6e..b91857b30 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/EvaluateRatio.java @@ -11,7 +11,7 @@ import javax.persistence.*; * @since 2022/7/27 */ @Entity -@Table(name = "fangjia.evaluate_ratio") +@Table(name = "business.evaluate_ratio") public class EvaluateRatio implements MongoEntity { private static final long serialVersionUID = 5299813614465690722L;