From ac7f29e912507fe348d3cecc16b110b8e49912d1 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Fri, 1 Jul 2022 14:25:24 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E5=81=8F=E5=B7=AE=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/temp/shenjian/oracle/ExportExceptionPrice.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/oracle/ExportExceptionPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/oracle/ExportExceptionPrice.groovy index ce6a0b94b..9bb7c8c4b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/oracle/ExportExceptionPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/oracle/ExportExceptionPrice.groovy @@ -34,7 +34,7 @@ sqlInstance.eachRow(sql, { r -> if (year_month == '202205') { fiveMap.put(key, r['avg_price'] + "|" + r['calc_type']) } else if ((year_month == '202206')) { - fiveMap.put(key, r['avg_price'] + "|" + r['calc_type']) + sixMap.put(key, r['avg_price'] + "|" + r['calc_type']) } }) for (String key : sixMap.keySet()) { @@ -47,4 +47,4 @@ for (String key : sixMap.keySet()) { } } } -ExcelUtils.write("F:\\数据\\价格\\东莞上海价格偏差大.xlsx", result, "统计") \ No newline at end of file +ExcelUtils.write("D:\\数据\\价格\\东莞上海价格偏差大.xlsx", result, "统计") \ No newline at end of file From 09734a698dc477daa10564eb13870d4a7e153c83 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Sat, 2 Jul 2022 14:47:36 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B0=8F=E5=8C=BA=E6=8A=93=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shenjian/poi/GetPoiFromCommunity.groovy | 84 +++++++++++++ .../temp/shenjian/poi/entity/Community.groovy | 49 ++++++++ .../temp/shenjian/poi/entity/MyId.groovy | 17 +++ .../script/temp/shenjian/util/EsUtils.groovy | 116 ++++++++++++++++++ 4 files changed, 266 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/Community.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/MyId.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy new file mode 100644 index 000000000..c466f3250 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy @@ -0,0 +1,84 @@ +package com.fangjia.script.temp.shenjian.poi + + +import com.alibaba.fastjson.JSONObject +import com.fangjia.script.statistics.poi.AmapPoi +import com.fangjia.script.statistics.poi.AmapPoiDetail +import com.fangjia.script.temp.shenjian.poi.entity.Community +import com.fangjia.script.temp.shenjian.util.CommonDtoUtils +import com.fangjia.script.temp.shenjian.util.EsUtils +import com.fangjia.script.temp.shenjian.util.GaoDeUtils +import com.fangjia.script.temp.shenjian.util.HttpUtils +import org.apache.commons.collections.CollectionUtils +import org.elasticsearch.index.query.QueryBuilder +import org.elasticsearch.index.query.QueryBuilders + +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicLong +import java.util.stream.Collectors + +/** + * 从ES获取POI + */ +class GetPoiFromCommunity { + + static final ExecutorService executorService = Executors.newFixedThreadPool(10) + static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoiDetail" + // 住宅类 + static final String typecodes = "120000|120100|120200|120201|120202|120203|120300|120301|120302|120303|120304"; + + static void main(String[] args) { + AtomicLong atomicLong = new AtomicLong(0) + Map map = new ConcurrentHashMap<>() + def rets = this.findCommunities() + for (def retTemp : rets) { + final def ret = retTemp + executorService.submit(new Runnable() { + @Override + void run() { + final String id = ret._id // 索引ID,并非小区ID + String city = ret.city + String region = ret.region + String seaweedName = ret.name + String address = ret.address + List pois = new ArrayList<>(); + List namePois = GaoDeUtils.searchPoi(city, seaweedName, region, typecodes); + List addressPois = GaoDeUtils.searchPoi(city, address, region, typecodes); + if (CollectionUtils.isNotEmpty(namePois)) { + pois.addAll(namePois) + } + if (CollectionUtils.isNotEmpty(addressPois)) { + pois.addAll(addressPois) + } + if (CollectionUtils.isNotEmpty(pois)) { + List detailList = CommonDtoUtils.transformListV(AmapPoiDetail.class, pois); + String jsonStr = JSONObject.toJSONString(detailList) + HttpUtils.postForJson(URL, jsonStr) + } + synchronized (map) { + map.put(id, id) + if (map.size() % 100 == 0) { + atomicLong.addAndGet(map.size()) + List ids = map.values().stream().collect(Collectors.toList()) + EsUtils.bulkUpdateFieldByIds("community", "crawl_flag", 0, ids) + map.clear() + println(atomicLong.intValue()) + } + } + } + }) + } + executorService.shutdown() + } + + static def findCommunities(){ + QueryBuilder queryBuilder = QueryBuilders.boolQuery() + .filter(QueryBuilders.termQuery("city", "东莞")) + .mustNot(QueryBuilders.termQuery("crawl_flag", 0)) + List communities = EsUtils.scrollQuery("community", queryBuilder, Community.class) + return communities + } + +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/Community.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/Community.groovy new file mode 100644 index 000000000..ba2bfaaea --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/Community.groovy @@ -0,0 +1,49 @@ +package com.fangjia.script.temp.shenjian.poi.entity; + +public class Community extends MyId { + private String id; + private String city; + private String region; + private String name; + private String address; + + String getId() { + return id + } + + void setId(String id) { + this.id = id + } + + String getCity() { + return city + } + + void setCity(String city) { + this.city = city + } + + String getRegion() { + return region + } + + void setRegion(String region) { + this.region = region + } + + String getName() { + return name + } + + void setName(String name) { + this.name = name + } + + String getAddress() { + return address + } + + void setAddress(String address) { + this.address = address + } +} \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/MyId.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/MyId.groovy new file mode 100644 index 000000000..53bd1b98b --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/entity/MyId.groovy @@ -0,0 +1,17 @@ +package com.fangjia.script.temp.shenjian.poi.entity + +class MyId { + + /** + * 索引id + */ + String _id; + + String get_id() { + return _id + } + + void set_id(String _id) { + this._id = _id + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy new file mode 100644 index 000000000..ee66cfce7 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy @@ -0,0 +1,116 @@ +package com.fangjia.script.temp.shenjian.util + +import com.alibaba.fastjson.JSONObject +import com.fangjia.script.temp.shenjian.es.util.RestHighLevelClientUtils +import com.fangjia.script.temp.shenjian.poi.entity.MyId +import org.elasticsearch.action.DocWriteRequest +import org.elasticsearch.action.bulk.BulkRequest +import org.elasticsearch.action.search.* +import org.elasticsearch.action.update.UpdateRequest +import org.elasticsearch.client.RequestOptions +import org.elasticsearch.client.RestHighLevelClient +import org.elasticsearch.common.unit.TimeValue +import org.elasticsearch.index.query.QueryBuilder +import org.elasticsearch.search.Scroll +import org.elasticsearch.search.SearchHit +import org.elasticsearch.search.builder.SearchSourceBuilder +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +/** + * @author shenjian + * @since 2022/07/02 + */ +class EsUtils { + + private static RestHighLevelClient ES_CLIENT = RestHighLevelClientUtils.getClient() + private static final Logger logger = LoggerFactory.getLogger(EsUtils.class) + + /** + * 滚动方式查询大批量es数据 + * + * @param index 索引 + * @param boolQuery 查询语句 + * @param clazz 要返回的实体类型 + * @param + * @return + */ + public static List scrollQuery(String index, QueryBuilder boolQuery, Class clazz) { + List result = new ArrayList<>(); + // 存活时间,当索引数据量特别大时,出现超时可能性大,此值适当调大 + Scroll scroll = new Scroll(TimeValue.timeValueMinutes(30L)); + SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); + searchSourceBuilder.query(boolQuery); + // TEST 用!!!!!!!!!!!!!!!!!!!!!! + //searchSourceBuilder.size(1); + searchSourceBuilder.size(10000); + SearchRequest searchRequest = new SearchRequest().indices(index).scroll(scroll).source(searchSourceBuilder); + SearchResponse searchResponse = null; + try { + searchResponse = ES_CLIENT.search(searchRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + logger.error("查询es数据异常:{}", e); + } + String scrollId = searchResponse.getScrollId(); + SearchHit[] searchHits = searchResponse.getHits().getHits(); + if (searchHits != null) { + for (SearchHit searchHit : searchHits) { + T t = JSONObject.parseObject(searchHit.getSourceAsString(), clazz); + t.set_id(searchHit.getId()) + result.add(t); + } + } + // 遍历搜索命中的数据,直到没有数据 + while (searchHits != null && searchHits.length > 0) { + SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); + scrollRequest.scroll(scroll); + try { + searchResponse = ES_CLIENT.scroll(scrollRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + logger.error("查询es数据异常:{}", e); + } + scrollId = searchResponse.getScrollId(); + searchHits = searchResponse.getHits().getHits(); + if (searchHits != null && searchHits.length > 0) { + for (SearchHit searchHit : searchHits) { + T t = JSONObject.parseObject(searchHit.getSourceAsString(), clazz); + t.set_id(searchHit.getId()) + result.add(t); + } + } + } + // clean scroll + ClearScrollRequest clearScrollRequest = new ClearScrollRequest(); + clearScrollRequest.addScrollId(scrollId); + ClearScrollResponse clearScrollResponse = null; + try { + clearScrollResponse = ES_CLIENT.clearScroll(clearScrollRequest, RequestOptions.DEFAULT); + } catch (IOException e) {} + boolean succeeded = clearScrollResponse.isSucceeded(); + if (succeeded) { + return result; + } + return null; + } + + + /** + * 批量更新es某个字段值 + * @param index 索引名 + * @param field 字段名 + * @param val 字段新值 + * @param ids 要更新的文档id + */ + public static void bulkUpdateFieldByIds(String index, String field, Object val, List ids) { + if (ids.size() > 1000) { + throw new RuntimeException("批量更新数量过多") + } + BulkRequest bulkRequest = new BulkRequest(); + for (String id : ids) { + Map doc = new HashMap<>(); + doc.put(field, val) + bulkRequest.add(new UpdateRequest(index, id).doc(doc)); + } + ES_CLIENT.bulk(bulkRequest, RequestOptions.DEFAULT); + } +} From acc809b3ae930177f2dfcf0e1dac686277e13bec Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Sat, 2 Jul 2022 15:35:04 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/poi/GetPoiFromCommunity.groovy | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy index c466f3250..1aab2c40b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy @@ -14,6 +14,7 @@ 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 @@ -33,6 +34,7 @@ class GetPoiFromCommunity { AtomicLong atomicLong = new AtomicLong(0) Map map = new ConcurrentHashMap<>() def rets = this.findCommunities() + CountDownLatch countDownLatch = new CountDownLatch(rets.size()) for (def retTemp : rets) { final def ret = retTemp executorService.submit(new Runnable() { @@ -59,6 +61,7 @@ class GetPoiFromCommunity { } synchronized (map) { map.put(id, id) + countDownLatch.countDown() if (map.size() % 100 == 0) { atomicLong.addAndGet(map.size()) List ids = map.values().stream().collect(Collectors.toList()) @@ -70,7 +73,15 @@ class GetPoiFromCommunity { } }) } - executorService.shutdown() + countDownLatch.await() + if (map.size() > 0) { + atomicLong.addAndGet(map.size()) + List ids = map.values().stream().collect(Collectors.toList()) + EsUtils.bulkUpdateFieldByIds("community", "crawl_flag", 0, ids) + map.clear() + println(atomicLong.intValue()) + } + System.exit(1) } static def findCommunities(){ From 2fec35aa97996e2f9a3b721cdb622f90ff8cad9d Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Sat, 2 Jul 2022 15:49:24 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BC=98=E5=8C=96es=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/temp/shenjian/poi/GetPoiFromCommunity.groovy | 1 - .../com/fangjia/script/temp/shenjian/util/EsUtils.groovy | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy index 1aab2c40b..f93b844d7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoiFromCommunity.groovy @@ -86,7 +86,6 @@ class GetPoiFromCommunity { static def findCommunities(){ QueryBuilder queryBuilder = QueryBuilders.boolQuery() - .filter(QueryBuilders.termQuery("city", "东莞")) .mustNot(QueryBuilders.termQuery("crawl_flag", 0)) List communities = EsUtils.scrollQuery("community", queryBuilder, Community.class) return communities diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy index ee66cfce7..b158c9351 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/EsUtils.groovy @@ -35,7 +35,7 @@ class EsUtils { * @param * @return */ - public static List scrollQuery(String index, QueryBuilder boolQuery, Class clazz) { + public static List scrollQuery(String index, QueryBuilder boolQuery, Class clazz, def limitSize=300000) { List result = new ArrayList<>(); // 存活时间,当索引数据量特别大时,出现超时可能性大,此值适当调大 Scroll scroll = new Scroll(TimeValue.timeValueMinutes(30L)); @@ -61,7 +61,7 @@ class EsUtils { } } // 遍历搜索命中的数据,直到没有数据 - while (searchHits != null && searchHits.length > 0) { + while (searchHits != null && searchHits.length > 0 && result.size() < limitSize) { SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); scrollRequest.scroll(scroll); try { From bf526771dcabbf1c6da25e01636f647eb889ceff Mon Sep 17 00:00:00 2001 From: gaojuan Date: Tue, 5 Jul 2022 16:13:05 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=9A=90=E8=97=8Fapp=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/webapp/header/v5/_header.ftl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-coresite/src/main/webapp/header/v5/_header.ftl b/projects/fangjia-coresite/src/main/webapp/header/v5/_header.ftl index 293708039..cfea9915a 100644 --- a/projects/fangjia-coresite/src/main/webapp/header/v5/_header.ftl +++ b/projects/fangjia-coresite/src/main/webapp/header/v5/_header.ftl @@ -58,7 +58,7 @@ -
  • APP涓嬭浇
  • +<#--
  • APP涓嬭浇
  • --> @@ -148,9 +148,9 @@ -
  • - APP涓嬭浇 -
  • +<#--
  • --> +<#-- APP涓嬭浇--> +<#--
  • --> From aa4b3b784f2964065adb753585ddba23cc9a2c6d Mon Sep 17 00:00:00 2001 From: gaojuan Date: Wed, 6 Jul 2022 11:50:45 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=8F=91=E9=82=AE=E4=BB=B6=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=B7=B2=E7=A6=BB=E5=BC=80=E7=9A=84=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/auto/CityInfoEmailSender.groovy | 9 +-- .../script/gj/crawl/AnjukeHouseCrawl.groovy | 21 ++++-- .../script/gj/crawl/PaimaiDataSend.groovy | 71 +++++++++++++++++++ .../hubingliang/PdsUseStatisticBatch.groovy | 4 +- .../hubingliang/pds/DaiQianGuZhiBatch.groovy | 3 +- .../hubingliang/pds/KeHuFenLeiBatch.groovy | 3 +- .../hubingliang/pds/KeHuPingJiBatch.groovy | 4 +- .../fangjia/script/wenyan/temp/QinLin.groovy | 4 +- .../batch/ApiProductFieldStatBatch.groovy | 2 +- 9 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/auto/CityInfoEmailSender.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/auto/CityInfoEmailSender.groovy index cb0a3f0f7..323ce415b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/auto/CityInfoEmailSender.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/auto/CityInfoEmailSender.groovy @@ -23,14 +23,7 @@ class CityInfoEmailSender extends BaseBatch{ private static final Jms jms = Jms.create('tcp://monitor.jms.db.fangjia.com:61616') final static DBCollection fsDB = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB('fangjia_fs').getCollection('files') def emails = [ - "wangsheng@fangjia.com" - ,"xuyejun@fangjia.com" - ,"tiki@fangjia.com" - ,"zhangzx@fangjia.com" - ,"panyingjiao@fangjia.com" - ,"yangqixing@fangjia.com" - ,"james.lin@fangjia.com" - ,"jhu@fangjia.com" + "gaojuan@fangjia.com" ] 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 81056b29d..7c6dcf4de 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,14 +25,14 @@ class AnjukeHouseCrawl { System.setProperty("http.nonProxyHosts", "localhost"); WebDriver driver = new ChromeDriver() - def href = "https://sh.esf.fang.com/loupan/1210043376.htm" + def href = "https://sh.58.com/hezu/50696364798384x.shtml" def doc = getDocument(href, driver) // def doc = ClaABuYun.getResponse(href) // def newUrl = href.substring(0, hrefs.indexOf("?")) - sendMq(href, doc, "district_detail_fang") + sendMq(href, doc, "rent_58") -// for(def i=1;i<50;i++){ -// def url = "https://fz.anjuke.com/sale/guloue/p${i}/" +// for(def i=25;i<50;i++){ +// def url = "https://fz.anjuke.com/sale/jinana/p${i}/" // def doc = getDocument(url, driver) // def eles = JQueryUtils.select(".list-main .list-left .list .property a", doc) // println "页数:"+i+" 记录数:"+eles.size() @@ -203,7 +203,18 @@ class AnjukeHouseCrawl { } if(!els){ - els = JQueryUtils.select(".village_info", doc) + els = JQueryUtils.select(".detail-content", doc) + } + if(!els){ + els = JQueryUtils.select(".content", doc) + } + + if(!els){ + els = JQueryUtils.select(".wrapper", doc) + } + + if(!els){ + els = JQueryUtils.select(".main-wrap", doc) } if(els && els.size()>0){ stop = true; diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy new file mode 100644 index 000000000..cdbcbc915 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy @@ -0,0 +1,71 @@ +package com.fangjia.script.gj.crawl + +import com.alibaba.fastjson.JSON +import com.alibaba.fastjson.JSONObject +import com.fangjia.script.temp.shenjian.util.MessageUtils +import com.fangjia.script.util.CommonUtils +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.rabbitmq.client.AMQP + +import java.text.SimpleDateFormat + +DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "ali_fapai_detail", "192.168.0.235", 27018) + +def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; +DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) + + +//Date date=new Date(1550455200000); +//SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +//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://susong-item.taobao.com/auction/648798773106.htm") + +//def cur = paimai43_COLL.find(pmquery) +//def urls = [] +//for(def o : cur){ +// urls << o.url +//} + +def index = 0 +//for(def url : urls){ + def q = new BasicDBObject() +// q.put("url", url) + def dbcursor = collection.find(q) + + for(def d : dbcursor){ + index++ + println index + JSON json = new JSONObject() + json.put("project", "paimai_taobao") + json.put("url", d.url) + + JSON result = new JSONObject() + result.put("content", d.content) + def bid_content = net.sf.json.JSONObject.fromObject(d.bid_content) + result.put("trades", bid_content) + result.put("condition", d.condition) + result.put("sub_count", d.sub_count) + def data_json = net.sf.json.JSONObject.fromObject(d.json) + result.put("data_json", data_json) + result.put("desc_content", d.desc_content) + result.put("item_notice_content", d.item_notice_content) + result.put("notice_detail_content", d.notice_detail_content) + + json.put("result", result) + + byte[] packedMsg = MessageUtils.pack(json) + CommonUtils.sendMessage("result2parse", packedMsg) + } +//} + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/PdsUseStatisticBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/PdsUseStatisticBatch.groovy index 98110403e..3579922b1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/PdsUseStatisticBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/PdsUseStatisticBatch.groovy @@ -44,9 +44,7 @@ class PdsUseStatisticBatch extends BaseBatch{ private static final Jms jms = Jms.create('tcp://monitor.jms.db.fangjia.com:61616') final static DBCollection fsDB = MongoUtils.getCollectionByName("fangjia_fs", "files", MongoUtils.MongoDB_Domain_fs_mongo, 27000) def static emails = [ - "hubingliang@fangjia.com", - "james.lin@fangjia.com", - "panyingjiao@fangjia.com", + "duweiliang@fangjia.com", "yaojingmeng@fangjia.com", "xuqi@fangjia.com", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/DaiQianGuZhiBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/DaiQianGuZhiBatch.groovy index e1f6932eb..49db7393c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/DaiQianGuZhiBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/DaiQianGuZhiBatch.groovy @@ -34,8 +34,7 @@ class DaiQianGuZhiBatch extends BaseBatch{ final static DBCollection fsDB = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB('fangjia_fs').getCollection('files') def static emails = [ "hubingliang@fangjia.com", - "james.lin@fangjia.com", - "panyingjiao@fangjia.com" + "james.lin@fangjia.com" ] static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuFenLeiBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuFenLeiBatch.groovy index 6fdaf20e3..da74f4bd4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuFenLeiBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuFenLeiBatch.groovy @@ -34,8 +34,7 @@ class KeHuFenLeiBatch extends BaseBatch{ final static DBCollection fsDB = MongoUtils.getCollectionByName("fangjia_fs", "files", MongoUtils.MongoDB_Domain_fs_mongo, 27000) def static emails = [ "hubingliang@fangjia.com", - "james.lin@fangjia.com", - "panyingjiao@fangjia.com" + "james.lin@fangjia.com" ] static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuPingJiBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuPingJiBatch.groovy index 9aad05cf6..a2219d524 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuPingJiBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/pds/KeHuPingJiBatch.groovy @@ -33,9 +33,7 @@ class KeHuPingJiBatch extends BaseBatch{ private static final Jms jms = Jms.create('tcp://monitor.jms.db.fangjia.com:61616') final static DBCollection fsDB = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB('fangjia_fs').getCollection('files') def static emails = [ - "hubingliang@fangjia.com", - "james.lin@fangjia.com", - "panyingjiao@fangjia.com" + ] static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy index 1297ca3ea..8bca701d7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/QinLin.groovy @@ -11,8 +11,8 @@ import org.bson.Document import static com.mongodb.client.model.Filters.* MongoCollection OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log") -def startDate = DateUtil.parseDate("20220501", "yyyyMMdd") -def endDate = DateUtil.parseDate("20220601", "yyyyMMdd") +def startDate = DateUtil.parseDate("20220601", "yyyyMMdd") +def endDate = DateUtil.parseDate("20220701", "yyyyMMdd") Calendar calendar = Calendar.getInstance() calendar.setTime(startDate) def count = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/batch/ApiProductFieldStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/batch/ApiProductFieldStatBatch.groovy index 6f120465c..026ec703f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/batch/ApiProductFieldStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/batch/ApiProductFieldStatBatch.groovy @@ -62,7 +62,7 @@ class ApiProductFieldStatBatch extends BaseBatch { private static final Jms jms = Jms.create('tcp://monitor.jms.db.fangjia.com:61616') final static DBCollection fsDB = MongoUtils.getCollectionByName("fangjia_fs", "files", MongoUtils.MongoDB_Domain_fs_mongo, 27000) def emails = [ - "yinjihuan@fangjia.com","panyingjiao@fangjia.com","liyan@fangjia.com", "jiangxiaochun@fangjia.com" + "jiangxiaochun@fangjia.com" ] static def allDis = [] static DecimalFormat df = new DecimalFormat("0.00%") From 28ce5945e70bd25a949d9bc180927264a05ace7e Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Wed, 6 Jul 2022 17:01:48 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=96=B0=E5=A2=9Ekey?= 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 6b880c5ea..af5f5fc8b 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 @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger class GaoDeUtils { // 新获取key - def static GAO_DE_AK = ["4e9592208336433ee1b7aa4d1d434418"] + def static GAO_DE_AK = ["4e9592208336433ee1b7aa4d1d434418", "10bcb421d2ee4e51ed9268d6dca58ad1"] def static AtomicInteger keyUsed = new AtomicInteger(0) def static codeNameMap = new HashMap(){{ From 0d0f52ca5428c87a6e2e5c0e542c2404735ba53c Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 8 Jul 2022 10:30:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=BC=98=E5=85=88=E5=8C=B9=E9=85=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=90=8E=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/thirdPriceCrawl/ThirdDataToGatherBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/ThirdDataToGatherBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/ThirdDataToGatherBatch.groovy index 3c2bcde38..89e0e9483 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/ThirdDataToGatherBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/ThirdDataToGatherBatch.groovy @@ -132,7 +132,7 @@ class ThirdDataToGatherBatch extends BaseBatch{ q.put("s_date", SHORT_DATE); def ret = [] try{ - def dbcursor = dataProcessColl.find(q).sort(new BasicDBObject("m_date", -1).append("type",1)) + def dbcursor = dataProcessColl.find(q).sort(new BasicDBObject("type",1).append("m_date", -1)) if(dbcursor){ for(def dbo : dbcursor){ From 6c904ebb362b08b00f1e0a4b670d9dcd0e863cae Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 8 Jul 2022 10:31:42 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DealAndThirdPriceDataProcess.groovy | 1 - .../script/gj/crawl/AnjukeAppCrawl.groovy | 21 ++- .../script/gj/crawl/AnjukeHouseCrawl.groovy | 4 +- .../script/gj/crawl/ZhugeFangDistCrawl.groovy | 4 +- .../script/gj/paimai/ExportPaimai.groovy | 147 ++++++++++++++++++ .../{crawl => paimai}/PaimaiDataSend.groovy | 34 ++-- .../TestCrawlTotalCount.groovy | 4 +- 7 files changed, 190 insertions(+), 25 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy rename projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/{crawl => paimai}/PaimaiDataSend.groovy (79%) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy index f35522733..406d043a8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy @@ -383,7 +383,6 @@ class DealPriceDataProcess { def sql = "delete from BIGDATA_THIRD_PARTY_PRICE_GJ where commid='${m.commid}' and price_date=${month} and community_price=${m.price}" sqlInstance236.executeUpdate(sql) } - } } 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 5354eafe8..21ddf507c 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 @@ -48,13 +48,14 @@ class AnjukeAppCrawl { // task.run(); // task.run2() - task.addThirdPrice() +// task.addThirdPrice() // task.saveToEs() // task.saveToEs1() // task.groupByCity() // task.selectNoSave() // task.statCount() + task.exportFzDist() } def saveToEs1(){ def lists = getAllAppDatas() @@ -75,6 +76,24 @@ class AnjukeAppCrawl { }) } + def exportFzDist(){ + def q = new BasicDBObject() + q.put("city","福州") + def dbcursor = detail.find(q).batchSize(5000) + def index = 0 + def rets = [] + rets << ["city","region","name","_id","id","sale_num","city_short","source"] + for(def d : dbcursor){ + def count = 0 + if(d.propInfo.saleNum){ + count = d.propInfo.saleNum.toInteger() + } + rets << [d.base.cityName, d.base.areaName, d.base.name, d._id.toString(),d.base.id, count, "fz","安居客"] + } + + ExcelUtils.write("D:\\数据\\福州\\福州小区.xlsx", rets, "数据") + } + def selectNoSave(){ def esData = findAllEsData() def q = new BasicDBObject() 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 7c6dcf4de..bd7567c8e 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://sh.58.com/hezu/50696364798384x.shtml" + def href = "https://fz.anjuke.com/prop/view/S2512363126645770" def doc = getDocument(href, driver) // def doc = ClaABuYun.getResponse(href) // def newUrl = href.substring(0, hrefs.indexOf("?")) - sendMq(href, doc, "rent_58") + sendMq(href, doc, "sell_anjuke") // 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/ZhugeFangDistCrawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/ZhugeFangDistCrawl.groovy index c9ca234ce..a465c984a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/ZhugeFangDistCrawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/ZhugeFangDistCrawl.groovy @@ -23,14 +23,14 @@ class ZhugeFangDistCrawl { def run(){ System.setProperty("webdriver.chrome.driver", "C:\\Users\\gaojuan\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"); System.setProperty("http.nonProxyHosts", "localhost"); - def url = "https://fz.esfxiaoqu.zhuge.com/pingtan/" + def url = "https://fz.esfxiaoqu.zhuge.com/changle/" WebDriver driver = new ChromeDriver() driver.manage().deleteAllCookies() getRegions(driver, url) } def getRegions(driver, url) { - for(def i=1;i<=4;i++){ + for(def i=1;i<=7;i++){ def newUrl = url+"page${i}/" println newUrl def doc = getDocument(newUrl, driver) 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 new file mode 100644 index 000000000..0cd120438 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/ExportPaimai.groovy @@ -0,0 +1,147 @@ +package com.fangjia.script.gj.paimai + +import com.fangjia.script.linxsh.util.AddressUtil +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection + +class ExportPaimai { + + + def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) + + static main(args) { + def task = new ExportPaimai(); + task.run() +// task.addressStandard() +// task.addPrice() +// task.stat() + } + + def stat(){ + 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){ +// index1++ +// def sumTradePrice = d['S'] +// def marketPrice = d['Y'] +// rates1 << sumTradePrice/marketPrice +// } + if(d['S']>2000000){ + index1++ + def sumTradePrice = d['S'] + def marketPrice = d['Y'] + rates1 << sumTradePrice/marketPrice + } + } + } + def rate = rates1.sum()/rates1.size() + println index1 +" "+ rate + } + + def addPrice(){ + ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\法拍\\宿迁法拍数据.xlsx",{d-> + if(!d['Y'] && d['Z']){ + d['Y'] = d['Z'] + } + }) + } + def addressStandard(){ + ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\法拍\\重庆法拍数据.xlsx",{d-> + def formatAddress = AddressUtil.formatAddress(d['C'], d['A']) + if(formatAddress){ + d['F'] = formatAddress + } + }) + } + + def run(){ + def datas = findPaimaiData() + println "总量:"+datas.size() + def rows = [] + def header = ["标地物地址","省","城市","区域","地址","标题提取地址","楼栋号","单元","室号","楼盘名称","建筑面积","竣工日期","房屋用途","总楼层", + "拍卖状态","是否成交","拍卖阶段","拍卖方式","成交价","拍卖开始时间","拍卖结束时间","起拍价","保证金","加价幅度","评估价","市场价", + "变卖预缴款","竞价周期","延时周期","优先购买权人","报名人数","围观人数","设置提醒人数","延迟次数","URL"] + rows << header + def set = new HashSet() + def index = 0 + for(def d : datas){ + if(!set.contains(d.title)){ + index++ + println index + set << d.title + def row = [] + row << d.title + row << d.province + row << d.city + row << d.region + row << d.address + row << "" +// def formatAddress = AddressUtil.formatAddress(d.city, d.title) +// if(formatAddress){ +// row << formatAddress +// }else{ +// row << "" +// } + row << d.houseNum + row << d.unitNum + row << d.roomNum + row << d.matchName + row << d.area + row << d.buildYear + row << d.estateType + row << "" + row << "" + row << d.status + row << d.stage + row << "" + row << d.tradePrice + row << DateUtils.formatDateByPattern(d.startDate, "yyyy-MM-dd") + row << DateUtils.formatDateByPattern(d.finishDate, "yyyy-MM-dd") + row << d.startPrice + row << d.depositPrice + row << d.addPrice + row << d.evalatePrice + row << d.marketPrice + row << d.sellOffAdvancePay + row << d.pricePkWeekly + row << d.delayWeekly + row << d.preemptivePerson + row << d.enrollCount + row << d.lookCount + row << d.callCount + row << d.delayCount + row << d.url + + rows << row + } + } + ExcelUtils.write("D:\\数据\\重庆农商行\\法拍\\重庆法拍原数据.xlsx",rows,"数据") + } + + def findPaimaiData(){ + def pmquery = new BasicDBObject() + pmquery.put("city","重庆") + 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","已成交") + def dbcursor = paimai43_COLL.find(pmquery).sort(new BasicDBObject("finishDate",-1)) + def rets = [] + for(def db : dbcursor){ +// if(db.estateType && db.estateType=="车库"){ +// continue +// } + rets << db + } + return rets + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy similarity index 79% rename from projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy rename to projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy index cdbcbc915..2f0d142d2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/PaimaiDataSend.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/PaimaiDataSend.groovy @@ -1,4 +1,4 @@ -package com.fangjia.script.gj.crawl +package com.fangjia.script.gj.paimai import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSONObject @@ -24,27 +24,27 @@ DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "p //System.out.println(str); def pmquery = new BasicDBObject() -//pmquery.put("city","重庆") -//pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) +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://susong-item.taobao.com/auction/648798773106.htm") - -//def cur = paimai43_COLL.find(pmquery) -//def urls = [] -//for(def o : cur){ -// urls << o.url -//} +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) def dbcursor = collection.find(q) - + index++ + println index for(def d : dbcursor){ - index++ - println index + JSON json = new JSONObject() json.put("project", "paimai_taobao") json.put("url", d.url) @@ -64,8 +64,8 @@ def index = 0 json.put("result", result) byte[] packedMsg = MessageUtils.pack(json) - CommonUtils.sendMessage("result2parse", packedMsg) + CommonUtils.sendMessage("result2parse2dev", packedMsg) } -//} +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy index 4ac878217..383911899 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy @@ -14,8 +14,8 @@ class TestCrawlTotalCount { def run(){ def sources = ["房估估","诸葛找房","安居客","搜房","中原地产","赶集","链家","兔博士","城市房产","贝壳找房","Q房","Q房(新)","中原地产(新)","乐有家","乐有家(新)","房探","房多多","小资家","我爱我家","麦田","房途","C21","乐居","房产超市","58同城","365淘房","吉屋"] for(def source :sources){ - def count1 = findTotalCount(source, 202204); - def count2 = findTotalCount(source, 202205); + def count1 = findTotalCount(source, 202205); + def count2 = findTotalCount(source, 202206); println source +" "+count1 +" "+count2 } }