From 31cd461b8aec77ddbb99912e983621f6701e2522 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 9 Apr 2025 17:44:28 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SynchAdministrativeMappingDataBatch.groovy | 30 +++++++++------- .../gj/data_handle/SynchDevDataBatch.groovy | 36 +++++++++++++++---- .../script/gj/xiamen/SeaweedDataSynch.groovy | 2 -- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy index 00b912a8c..ddb9616bd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchAdministrativeMappingDataBatch.groovy @@ -1,11 +1,13 @@ package com.fangjia.script.gj.data_handle import com.fangjia.script.BaseBatch +import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.gj.xiamen.ElasticUtils89 import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import org.bson.types.ObjectId import org.elasticsearch.index.query.QueryBuilder import org.elasticsearch.index.query.QueryBuilders @@ -23,12 +25,15 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ @Override public void process(Object args) { + def indexName = "administrative_mapping" def retMap = synchAdminiMappingTo100() - synchToEs(retMap, "192.168.0.89") -// synchToEs(retMap, "192.168.0.52") + synchToEs(retMap, "192.168.0.89", indexName) + synchToEs(retMap, "192.168.0.52", indexName) + println(" 运行完成") + } - def synchAdminiMappingTo100(){ + def synchAdminiMappingTo100(city){ //删除旧的,再同步新的 ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject()) @@ -52,12 +57,11 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ return retMap; } - def synchToEs(retMap, host){ + def synchToEs(retMap, host, indexName){ QueryBuilder queryBuilder = QueryBuilders.boolQuery() - def oldIds = new CopyOnWriteArrayList() - ElasticUtils89.executeQuery(host, "administrative_mapping", queryBuilder, { String id, doc-> + ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc-> oldIds << id def mongoObj = retMap.get(id) def updateFieldCount = 0 @@ -65,8 +69,7 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ if(!["id","_id","c_date","m_date","polyline_source","operator","city_simple_pinyin","prefecture_level_city"].contains(k)){ def val = doc.get(k) if(val!=v){ -// updateValMap.put(k,val) - if(v.type!="MultiPolygon"){ + if(k!="shape" || (k=="shape" && v.type!="MultiPolygon")){ println k +" 修改 "+id updateFieldCount++ doc.put(k,v) @@ -80,14 +83,14 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ }else{ if(!mongoObj){ println "删除:"+id +" "+doc.name - ElasticUtils.delete(id, host, "administrative_mapping") + ElasticUtils.delete(id, host, indexName) return false } } }) - def addEsDatas = [] + def addEsDatasMap = [:] retMap.each{id,map-> if(!oldIds.contains(id)){ println "需新增:"+id @@ -95,11 +98,12 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{ map.remove("m_date") map.remove("polyline_source") map.remove("operator") - addEsDatas << map + map.remove("_id") + addEsDatasMap.put(id, map) } } - if(addEsDatas){ - ElasticUtils89.updateEs(addEsDatas, host, "administrative_mapping") + if(addEsDatasMap){ + ElasticUtils89.updateEs(addEsDatasMap, host, indexName) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchDevDataBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchDevDataBatch.groovy index 893da6125..ea5a16f8e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchDevDataBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/SynchDevDataBatch.groovy @@ -10,6 +10,7 @@ import org.elasticsearch.index.query.QueryBuilder import org.elasticsearch.index.query.QueryBuilders import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArrayList /** * 将43上的开发区同步到mongo-100, es-89, es-52 @@ -27,9 +28,10 @@ class SynchDevDataBatch extends BaseBatch{ @Override public void process(Object args) { + def indexName = "development_zone" def devMap = synchDevTo100() - synchDevEs(devMap, "192.168.0.89") - synchDevEs(devMap, "192.168.0.52") + synchDevEs(devMap, "192.168.0.89", indexName) + synchDevEs(devMap, "192.168.0.52", indexName) } def synchDevTo100(){ @@ -81,10 +83,12 @@ class SynchDevDataBatch extends BaseBatch{ } - def synchDevEs(devMap, host){ + def synchDevEs(devMap, host, indexName){ QueryBuilder queryBuilder = QueryBuilders.boolQuery() + def oldIds = new CopyOnWriteArrayList() - ElasticUtils89.executeQuery(host, "development_zone", queryBuilder, { String id, doc-> + ElasticUtils89.executeQuery(host, indexName, queryBuilder, { String id, doc-> + oldIds << id def mongoObj = devMap.get(id) def updateFieldCount = 0 mongoObj.each{k,v-> @@ -92,7 +96,6 @@ class SynchDevDataBatch extends BaseBatch{ def val = doc.get(k) if(val!=v){ println doc.name +" 修改 "+k+" "+ v+" "+id -// updateValMap.put(k,val) updateFieldCount++ doc.put(k,v) } @@ -104,11 +107,32 @@ class SynchDevDataBatch extends BaseBatch{ }else{ if(!mongoObj){ println "删除:"+id +" "+doc.name - ElasticUtils.delete(id, host, "development_zone") + ElasticUtils.delete(id, host, indexName) return false } } }) + + def addEsDatasMap = [:] + devMap.each{id,map-> + if(!oldIds.contains(id)){ + println "需新增:"+id + map.remove("create_time") + map.remove("build_date") + map.remove("bd_shape") + map.remove("img_url") + map.remove("operator") + map.remove("operate_result") + map.remove("m_date") + map.remove("township") + map.remove("block") + map.remove("_id") + addEsDatasMap.put(id, map) + } + } + if(addEsDatasMap){ + ElasticUtils89.updateEs(addEsDatasMap, host, indexName) + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy index 0955b9921..6f07d1516 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy @@ -78,8 +78,6 @@ class SeaweedDataSynch extends BaseBatch{ @Override public void process(Object args) { - - run() // println "全国district, shop, office同步完成" //民政部编码上传 From 1a09839cd310d7c4bb14b501a10c6e4d7e6d7755 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 9 Apr 2025 17:57:28 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/gj/xiamen/ElasticUtils89.groovy | 143 +++++++++++++++++- 1 file changed, 137 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/ElasticUtils89.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/ElasticUtils89.groovy index b1b772b92..dd2c2e5e1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/ElasticUtils89.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/ElasticUtils89.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.gj.xiamen +import com.fangjia.script.util.ElasticUtils import org.apache.http.HttpHost import org.apache.http.auth.AuthScope import org.apache.http.auth.UsernamePasswordCredentials @@ -7,8 +8,10 @@ import org.apache.http.client.CredentialsProvider import org.apache.http.client.config.RequestConfig import org.apache.http.impl.client.BasicCredentialsProvider import org.apache.http.impl.nio.client.HttpAsyncClientBuilder +import org.apache.solr.client.solrj.request.UpdateRequest import org.elasticsearch.action.ActionListener import org.elasticsearch.action.bulk.BackoffPolicy +import org.elasticsearch.action.bulk.BulkItemResponse import org.elasticsearch.action.bulk.BulkProcessor import org.elasticsearch.action.bulk.BulkRequest import org.elasticsearch.action.bulk.BulkResponse @@ -17,11 +20,13 @@ import org.elasticsearch.action.search.ClearScrollRequest import org.elasticsearch.action.search.SearchRequest import org.elasticsearch.action.search.SearchResponse import org.elasticsearch.action.search.SearchScrollRequest +import org.elasticsearch.action.support.WriteRequest import org.elasticsearch.client.RequestOptions import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClientBuilder import org.elasticsearch.client.RestHighLevelClient import org.elasticsearch.common.unit.TimeValue +import org.elasticsearch.common.xcontent.XContentType import org.elasticsearch.index.query.QueryBuilder import org.elasticsearch.search.Scroll import org.elasticsearch.search.SearchHit @@ -160,8 +165,17 @@ class ElasticUtils89 { } @Override - void afterBulk(long executionId, BulkRequest request, - BulkResponse response) { + public void afterBulk(long executionId, BulkRequest request, BulkResponse response) { + if (response.hasFailures()) { + for (BulkItemResponse itemResponse : response.getItems()) { + if (itemResponse.isFailed()) { + // 处理失败项 + String failureMessage = itemResponse.getFailureMessage(); + println failureMessage + // 日志记录、告警或重试 + } + } + } } @Override @@ -205,6 +219,7 @@ class ElasticUtils89 { } BulkProcessor bulkProcessor = createBulkProcessor(host, client) final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(60L)) + SearchRequest searchRequest = new SearchRequest(indexName); searchRequest.scroll(scroll); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -221,7 +236,7 @@ class ElasticUtils89 { // executorService.submit(new Runnable() { // @Override // void run() { - try{ +// try{ if(closure.getMaximumNumberOfParameters() == 1){ def update = closure.call(hit.getSourceAsMap()) @@ -232,14 +247,16 @@ class ElasticUtils89 { def update = closure.call(hit.getId(), hit.getSourceAsMap()) if(update){ bulkProcessor.add(new IndexRequest(indexName).id(hit.getId()).source(hit.getSourceAsMap())) + } } - }catch (Exception e){ - e.printStackTrace() - } +// }catch (Exception e){ +// e.printStackTrace() +// } // } // }) } + SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); scrollRequest.scroll(scroll); searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT); @@ -256,6 +273,120 @@ class ElasticUtils89 { client.close() } + static queryUpdate(String host, String indexName, QueryBuilder qb, Closure closure){ + RestHighLevelClient client = null + if(host == "192.168.0.89"){ + client = getClient(host); + }else if(host == "192.168.0.52"){ + client = getClientOther(host); + } + BulkProcessor bulkProcessor = createBulkProcessor(host, client) + + final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(30)) + // 2. 初始化滚动查询 + SearchRequest searchRequest = new SearchRequest(indexName); + searchRequest.scroll(scroll); + + SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); + searchSourceBuilder.query(qb); + searchRequest.source(searchSourceBuilder); + + SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT); + String scrollId = searchResponse.getScrollId(); + SearchHit[] hits = searchResponse.getHits().getHits(); + + // 3. 批量操作容器 + BulkRequest bulkRequest = new BulkRequest(); + + // 4. 处理滚动结果 + while (hits.length > 0){ + for (SearchHit hit : hits) { + // 示例修改逻辑:当满足条件时更新文档 + if(closure.getMaximumNumberOfParameters() == 2){ + def update = closure.call(hit.getId(), hit.getSourceAsMap()) + if(update){ + bulkRequest.add(new IndexRequest(indexName).id(hit.getId()).source(hit.getSourceAsMap())) + } + } + // 批量提交控制 + if (bulkRequest.numberOfActions() >= 1) { + bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); + BulkResponse bulkResponse = client.bulk(bulkRequest, RequestOptions.DEFAULT); + if (bulkResponse.hasFailures()) { + System.err.println("批量操作部分失败: " + bulkResponse.buildFailureMessage()); + // 这里可以添加重试逻辑 + } + bulkRequest = new BulkRequest(); // 重置容器 + } + } + + // 5. 获取下一批滚动结果 + SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId).scroll(TimeValue.timeValueMinutes(5)); + searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT); + scrollId = searchResponse.getScrollId(); + hits = searchResponse.getHits().getHits(); + } + + // 6. 提交剩余批量操作 + if (bulkRequest.numberOfActions() > 0) { + BulkResponse bulkResponse = client.bulk(bulkRequest, RequestOptions.DEFAULT); + if (bulkResponse.hasFailures()) { + System.err.println("批量操作部分失败: " + bulkResponse.buildFailureMessage()); + } + } + + // 7. 清理滚动上下文 + ClearScrollRequest clearScrollRequest = new ClearScrollRequest(); + clearScrollRequest.addScrollId(scrollId); + client.clearScroll(clearScrollRequest, RequestOptions.DEFAULT); + + bulkProcessor.close() + bulkProcessor.awaitClose(1, TimeUnit.DAYS) + client.close() + } + + + static updateEs(addEsDatasMap, host, indexName){ + BulkRequest request = new BulkRequest(); + int processedCount = 0; + def client = null + if(host && host == "192.168.0.89"){ + client = ElasticUtils89.getClient(host) + }else if(host && host == "192.168.0.52"){ + client = ElasticUtils.getClient(host) + } + + addEsDatasMap.each{id, map-> + request.add(new IndexRequest(indexName, "_doc", id).source(map, XContentType.JSON)); + if (request.numberOfActions() >= 100) { + request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); + BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT); + if (bulkResponse.hasFailures()) { + // 处理错误 + println "Bulk request has failures: " + bulkResponse.buildFailureMessage() + } else { + processedCount += request.numberOfActions(); + println "Processed " + processedCount + " documents "+host + } + request = new BulkRequest(); + } + } + + if (request.numberOfActions() > 0) { + request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); + BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT); + if (bulkResponse.hasFailures()) { + // 处理错误 + println "Bulk request has failures: " + bulkResponse.buildFailureMessage() + } else { + processedCount += request.numberOfActions(); + println "Processed " + processedCount + " documents "+host + } + } + } + + + static def executeSimpleQuery(String host, String indexName, QueryBuilder qb, includes){ From f2f9a02e788b59f240a0cc31e81871036af5d4f0 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 10 Apr 2025 14:20:51 +0800 Subject: [PATCH 03/13] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy index 6f07d1516..9ff38507e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy @@ -165,9 +165,9 @@ class SeaweedDataSynch extends BaseBatch{ def shops = updating(c, "shop") updateEs(c, shops, "shop", "192.168.0.89") - updateEs(c, offices, "shop", "192.168.0.52") + updateEs(c, shops, "shop", "192.168.0.52") - println index +" "+ c + " 完成" + println index +" "+ c + " 完成 "+new Date().toString() } } From 4ec26e53538216adada339a6cbadb6deeba669c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 10 Apr 2025 13:59:58 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E9=93=BA?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/dao/shop/ShopRentStatDao.java | 9 + .../mongo/dao/shop/ShopRentStatDaoImpl.java | 8 + .../dal/mongo/dao/shop/ShopSellStatDao.java | 9 + .../mongo/dao/shop/ShopSellStatDaoImpl.java | 8 + .../fangjia/dal/mongo/model/ShopRentStat.java | 84 +++ .../fangjia/dal/mongo/model/ShopSellStat.java | 84 +++ .../open/controllers/ShopController.java | 614 ++++++++++++++++++ .../service/datastore/AiShopService.java | 49 ++ .../service/datastore/AiShopServiceImpl.java | 553 ++++++++++++++++ .../service/datastore/ShopService.java | 4 +- .../datastore/dto/ShopEvaluationDto.java | 54 ++ .../service/datastore/dto/ShopRentDto.java | 32 + 12 files changed, 1506 insertions(+), 2 deletions(-) create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDao.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDaoImpl.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDao.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDaoImpl.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopRentStat.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopController.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopService.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopEvaluationDto.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopRentDto.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDao.java new file mode 100644 index 000000000..a03b21129 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDao.java @@ -0,0 +1,9 @@ +package com.fangjia.dal.mongo.dao.shop; + +import com.fangjia.dal.MongoDao; +import com.fangjia.dal.mongo.model.ShopRentStat; + +public interface ShopRentStatDao extends MongoDao { + + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDaoImpl.java new file mode 100644 index 000000000..e1f611b37 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopRentStatDaoImpl.java @@ -0,0 +1,8 @@ +package com.fangjia.dal.mongo.dao.shop; + +import com.fangjia.dal.MongoDaoImpl; +import com.fangjia.dal.mongo.model.ShopRentStat; + +public class ShopRentStatDaoImpl extends MongoDaoImpl implements ShopRentStatDao { + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDao.java new file mode 100644 index 000000000..2fec3b1d9 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDao.java @@ -0,0 +1,9 @@ +package com.fangjia.dal.mongo.dao.shop; + +import com.fangjia.dal.MongoDao; +import com.fangjia.dal.mongo.model.ShopSellStat; + +public interface ShopSellStatDao extends MongoDao { + + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDaoImpl.java new file mode 100644 index 000000000..c233ba1db --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/shop/ShopSellStatDaoImpl.java @@ -0,0 +1,8 @@ +package com.fangjia.dal.mongo.dao.shop; + +import com.fangjia.dal.MongoDaoImpl; +import com.fangjia.dal.mongo.model.ShopSellStat; + +public class ShopSellStatDaoImpl extends MongoDaoImpl implements ShopSellStatDao { + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopRentStat.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopRentStat.java new file mode 100644 index 000000000..510e8e392 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopRentStat.java @@ -0,0 +1,84 @@ +package com.fangjia.dal.mongo.model; + +import com.fangjia.dal.MongoEntity; + +import javax.persistence.*; + +@Entity +@Table(name = "fangjia_stat.shop_rent_stat") +public class ShopRentStat implements MongoEntity { + private static final long serialVersionUID = 4425229045088250573L; + + private String id; + private String cat; + private String city; + private String district; + private Integer date; + private Double avgPrice; + private String name; + + @Id + @GeneratedValue + @Column(name = "_id", unique = true, nullable = false) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Column(name = "cat") + public String getCat() { + return cat; + } + + public void setCat(String cat) { + this.cat = cat; + } + + @Column(name = "city") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Column(name = "district") + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + @Column(name = "date") + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + @Column(name = "avg_price") + public Double getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(Double avgPrice) { + this.avgPrice = avgPrice; + } + + @Column(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java new file mode 100644 index 000000000..8745031ce --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java @@ -0,0 +1,84 @@ +package com.fangjia.dal.mongo.model; + +import com.fangjia.dal.MongoEntity; + +import javax.persistence.*; + +@Entity +@Table(name = "fangjia_stat.shop_sell_stat") +public class ShopSellStat implements MongoEntity { + private static final long serialVersionUID = 4425229045088250573L; + + private String id; + private String cat; + private String city; + private String district; + private Integer date; + private Double avgPrice; + private String name; + + @Id + @GeneratedValue + @Column(name = "_id", unique = true, nullable = false) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Column(name = "cat") + public String getCat() { + return cat; + } + + public void setCat(String cat) { + this.cat = cat; + } + + @Column(name = "city") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Column(name = "district") + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + @Column(name = "date") + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + @Column(name = "avg_price") + public Double getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(Double avgPrice) { + this.avgPrice = avgPrice; + } + + @Column(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopController.java new file mode 100644 index 000000000..3afc679c3 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopController.java @@ -0,0 +1,614 @@ +package com.fangjia.open.controllers; + +import com.fangjia.core.RegionData; +import com.fangjia.core.util.AnalyticsUtil; +import com.fangjia.core.util.DataUtil; +import com.fangjia.core.util.HttpRequest; +import com.fangjia.core.util.LoggerFactory; +import com.fangjia.dal.common.ServerAreaData; +import com.fangjia.dal.mongo.fangjia.model.ServerArea; +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.ShopRentStat; +import com.fangjia.open.HttpCode; +import com.fangjia.open.OpenHttpCodeEnum; +import com.fangjia.open.interceptors.AuthenticationBean; +import com.fangjia.open.interceptors.Authority; +import com.fangjia.open.interceptors.Role; +import com.fangjia.open.model.BasicModel; +import com.fangjia.open.model.PropertyEvaluationModel; +import com.fangjia.open.model.ReportApplyModel; +import com.fangjia.open.model.RestfulModelAndView; +import com.fangjia.open.util.CommonUtils; +import com.fangjia.open.util.FangJiaTongUrl; +import com.fangjia.service.address.AddressParser; +import com.fangjia.service.datastore.FieldFilterService; +import com.fangjia.service.datastore.AiShopService; +import com.fangjia.service.datastore.OpenApiLogService; +import com.fangjia.service.datastore.dto.ShopEvaluationDto; +import net.sf.json.JSONObject; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.sothis.web.mvc.ActionContext; +import org.sothis.web.mvc.annotation.Param; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.fangjia.open.util.CommonUtils.convertToString; +import static com.fangjia.open.util.EvaluationFactorUtil.*; + +/** + * 商铺出租服务类 + * + * @author shenjian + * @since 2025/4/10 + */ +@Authority(role = Role.USER) +public class ShopController { + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class); + + private AiShopService aiShopService; + + private OpenApiLogService openApiLogService; + + private AddressParser addressParser; + private FieldFilterService fieldFilterService; + + /** + * 城市出租均价 + * + * @return + */ + public Object cityRentAction(@Param(name = "city") String city, @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopRentStat(city, null, null, "city", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 区域出租均价 + * + * @return + */ + public Object districtRentAction(@Param(name = "city") String city, @Param(name = "district") String district, + @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (StringUtils.isBlank(district)) { + mav.setModel(BasicModel.buildBadRequestModel("district不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + String region = RegionData.formatRegion(city, district); + if (!RegionData.isRegion(city, region)) { + mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopRentStat(city, region, null, "district", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该区域没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 写字楼均价走势 + * + * @return + */ + public Object shopRentAction(@Param(name = "city") String city, @Param(name = "district") String district, + @Param(name = "name") String name, @Param(name = "startDate") Integer startDate, + @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (StringUtils.isBlank(district)) { + mav.setModel(BasicModel.buildBadRequestModel("district不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + String region = RegionData.formatRegion(city, district); + if (!RegionData.isRegion(city, region)) { + mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopRentStat(city, region, name, "shop", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该写字楼没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 写字楼楼租金地址估值 + * + * @param model + * @param request + * @return + */ + public Object addressEvaluateRentAction(PropertyEvaluationModel model, HttpServletRequest request) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getAddress()) || model.getSize() <= 0) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,地址,面积(size)为必填项")); + return mav; + } + if (model.getCity().endsWith("市")) { + model.setCity(model.getCity().replaceAll("市$", "")); + } + + if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) { + mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法")); + return mav; + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)")); + return mav; + } + + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层")); + return mav; + } + + ShopEvaluationDto evaluation = aiShopService.addressEvaluateRent(buildEvaluation(model, request)); + + if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { + Map districtPriceMap = new HashMap(); + districtPriceMap.put("unitPrice", evaluation.getUnitPrice()); + districtPriceMap.put("city", evaluation.getCity()); + districtPriceMap.put("district", evaluation.getDistrict()); + districtPriceMap.put("name", evaluation.getName()); + districtPriceMap.put("samples", evaluation.getSeawater()); + districtPriceMap.put("location", evaluation.getLocation()); + + mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); + try { + if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { + openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/shop/addressEvaluateRent"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return mav; + } else { + mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该地址写字楼的评估").markNoData()); + return mav; + } + } + + /** + * 申请估值报告 + * + * @param model 申请报告请求参数 + * @return + */ + public Object assessPriceReportApplyAction(ReportApplyModel model) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getClient())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:委托机构为必填项")); + return mav; + } + if (StringUtils.isBlank(model.getSubjectMatter())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:标的物为必填项")); + return mav; + } + if (StringUtils.isBlank(model.getCity()) || model.getCity().contains("全国")) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项且不能为全国")); + return mav; + } + if (StringUtils.isBlank(model.getDistrict()) || model.getDistrict().contains("全国")) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:区域为必填项且不能为全国")); + return mav; + } + if (model.getSize() == null || model.getSize() <= 0 ) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:面积(size)为必填项且大于0")); + return mav; + } + if (model.getCity().endsWith("市")) { + model.setCity(model.getCity().replaceAll("市$", "")); + } + if (model.getDistrict().endsWith("区")) { + model.setDistrict(model.getDistrict().replaceAll("区$", "")); + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层")); + return mav; + } + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("client", model.getClient()); + params.put("subjectMatter", model.getSubjectMatter()); + params.put("city", model.getCity()); + params.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : null); + params.put("district", model.getDistrict()); + params.put("name", StringUtils.isNotBlank(model.getName()) ? model.getName() : null); + params.put("houseNum", StringUtils.isNotBlank(model.getBuildingNumber()) ? model.getBuildingNumber() : null); + params.put("roomNum", StringUtils.isNotBlank(model.getUnitNumber()) ? model.getUnitNumber() : null); + params.put("size", String.valueOf(model.getSize())); + params.put("houseFloor", model.getFloor() != null ? String.valueOf(model.getFloor()) : null); + params.put("houseHeight", model.getMaxFloor() != null ? String.valueOf(model.getMaxFloor()) : null); + params.put("buildType", StringUtils.isNotBlank(model.getPropertyType()) ? model.getPropertyType() : "0"); + params.put("direction", StringUtils.isNotBlank(model.getDirection()) ? model.getDirection() : "3"); + params.put("fitment", StringUtils.isNotBlank(model.getDecoration()) ? model.getDecoration() : "2"); + JSONObject jsonObject = JSONObject.fromObject(params); + Map headers = new HashMap(); + headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN); + headers.put("Content-Type", "application/json"); + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception e) { + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (json != null) { + if (json.getInt("code") == 200 && json.containsKey("data")) { + HashMap result = new HashMap(); + result.put("caseId", String.valueOf(json.get("data"))); + mav.setModel(BasicModel.buildOKModel().setResult(result)); + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:" + json.getString("message"))); + } + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:调用申请报告接口返回为空")); + } + return mav; + } + + /** + * 获取估值报告 + * + * @param caseId 估值报告ID + * @return + */ + public Object assessPriceReportFetchAction(@Param(name = "caseId") String caseId) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(caseId)) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:估值报告业务编号为必填项")); + return mav; + } + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("caseId", caseId); + JSONObject jsonObject = JSONObject.fromObject(params); + Map headers = new HashMap(); + headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN); + headers.put("Content-Type", "application/json"); + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception e) { + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (json != null) { + if (json.getInt("code") == 200 && json.containsKey("data")) { + JSONObject resultJson = json.getJSONObject("data"); + mav.setModel(BasicModel.buildOKModel().setResult(resultJson)); + } else { + mav.setModel(BasicModel.buildBadRequestModel("获取估值报告失败:" + json.getString("message"))); + } + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请报告失败:调用获取估值报告接口返回为空")); + } + return mav; + } + + private Integer getFloor(String roomNumber) { + if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) { + if (roomNumber.length() == 3) { + return Integer.valueOf(roomNumber.substring(0, 1)); + } else if (roomNumber.length() == 4) { + return Integer.valueOf(roomNumber.substring(0, 2)); + } else { + return null; + } + } + return null; + } + + /** + * 通过EvaluationModel组装Evaluation实体 + * + * @param model + * @param request + * @return + */ + private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) { + Evaluation evaluation = new Evaluation(); + evaluation.setLevel(model.getLevel()); + evaluation.setFitment(model.getFitment()); + evaluation.setType(model.getType()); + + evaluation.setCity(model.getCity()); + evaluation.setRegion(model.getRegion()); + evaluation.setDistrictName(model.getName()); + evaluation.setAddress(model.getAddress()); + evaluation.setDirection(model.getDirection()); + evaluation.setNoise(NOISE.get(model.getNoise())); + evaluation.setType(model.getType()); + evaluation.setSight(SIGHT.get(model.getView())); + evaluation.setAtticArea(model.getAtticSize()); + evaluation.setTerraceArea(model.getOuterSize()); + evaluation.setBasementArea(model.getBasementSize()); + evaluation.setGardenArea(model.getGardenSize()); + String worryFacility = model.getNegativeFactor(); + evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility)); + evaluation.setCreationDate(new Date()); + evaluation.setModificationDate(new Date()); + evaluation.setClientNo(model.getClientNo()); + if (0 != model.getAge()) { + evaluation.setAge(model.getAge()); + } + evaluation.setArea(model.getSize()); + if (ArrayUtils.isNotEmpty(model.getBuildQuality())) { + evaluation.setBuildQuality(convertToString(model.getBuildQuality())); + } + if (StringUtils.isNotBlank(model.getBuildType())) { + evaluation.setBuildType(model.getBuildType()); + } + if (StringUtils.isNotBlank(model.getCarport())) { + evaluation.setCarport(model.getCarport()); + } + if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) { + evaluation.setFitmentAge(model.getDecorationAge()); + } + evaluation.setCarportPrice(model.getCarportPrice()); + evaluation.setCity(model.getCity()); + evaluation.setDistrictName(model.getName()); + if (model.getDecorationCost() != null && model.getDecorationCost() > 0) { + evaluation.setFitmentCharge(model.getDecorationCost()); + } + if (0 != model.getHall()) { + evaluation.setHall(model.getHall()); + } + if (null != model.getFloor()) { + evaluation.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) { + evaluation.setHeight(model.getMaxFloor()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + evaluation.setHouseNum(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getHouseProperty())) { + evaluation.setHouseProperty(model.getHouseProperty()); + } + if (StringUtils.isNotBlank(model.getInsidepos())) { + evaluation.setInsidepos(model.getInsidepos()); + } + if (StringUtils.isNotBlank(model.getLightingVentilation())) { + evaluation.setLightingVentilation(model.getLightingVentilation()); + } + + if (StringUtils.isNotBlank(model.getOtherFactor())) { + evaluation.setOtherFactor(model.getOtherFactor()); + } + evaluation.setRegion(model.getDistrict()); + if (null != model.getRoom()) { + evaluation.setRoom(model.getRoom()); + } + if (StringUtils.isNotBlank(model.getRoomNumber())) { + evaluation.setRoomNum(model.getRoomNumber()); + } + if (StringUtils.isNotBlank(model.getSideset())) { + evaluation.setSideset(model.getSideset()); + } + if (0 != model.getToilet()) { + evaluation.setToilet(model.getToilet()); + } + if (model.getFacilities() != null) { + String facilities = model.getFacilities(); + String[] fs = facilities.split(","); + for (int i = 0; i < fs.length; i++) { + fs[i] = FACILITIES.get(fs[i]); + } + evaluation.setFacilities(convertToString(fs)); + } + + if (StringUtils.isNotBlank(model.getFacade())) { + evaluation.setFacade(model.getFacade()); + } + if (StringUtils.isNotBlank(model.getTraffice())) { + evaluation.setTraffice(model.getTraffice()); + } + if (StringUtils.isNotBlank(model.getShape())) { + evaluation.setShape(model.getShape()); + } + if (StringUtils.isNotBlank(model.getObstacle())) { + evaluation.setObstacle(model.getObstacle()); + } + if (StringUtils.isNotBlank(model.getIndustry())) { + evaluation.setIndustry(model.getIndustry()); + } + if (StringUtils.isNotBlank(model.getSupportDevice())) { + evaluation.setSupportDevice(model.getSupportDevice()); + } + if (StringUtils.isNotBlank(model.getLeftPosition())) { + evaluation.setLeftPosition(model.getLeftPosition()); + } + if (StringUtils.isNotBlank(model.getShopType())) { + evaluation.setShopType(model.getShopType()); + } + if (StringUtils.isNotBlank(model.getShopUnique())) { + evaluation.setShopUnique(model.getShopUnique()); + } + if (StringUtils.isNotBlank(model.getLocation())) { + evaluation.setLocation(model.getLocation()); + } + if (model.isNewDistrict()) { + evaluation.setNewDistrict(model.isNewDistrict()); + } + String floorDesc = "中"; + if (evaluation.getFloor() != null && evaluation.getHeight() != null) { + Double floorInfo = evaluation.getFloor() * 1.0 / evaluation.getHeight(); + if (floorInfo <= 0.33) { + floorDesc = "低"; + } else if (floorInfo > 0.66) { + floorDesc = "高"; + } + evaluation.setFloorDesc(floorDesc); + } + String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest()); + evaluation.setIp(ip); + AuthenticationBean authenticationBean = (AuthenticationBean) request + .getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId())); + } + evaluation.setSource("api_shop_evaluateRent"); + return evaluation; + } + + private static final Map FACILITIES = new HashMap() { + { + put("0", "健身房"); + put("1", "游泳池"); + put("2", "会所"); + put("3", "网球场"); + put("4", "球场"); + put("5", "棋牌室"); + put("6", "停车场"); + put("7", "图书馆"); + put("8", "活动中心"); + } + }; + + public void setOpenApiLogService(OpenApiLogService openApiLogService) { + this.openApiLogService = openApiLogService; + } + + public void setFieldFilterService(FieldFilterService fieldFilterService) { + this.fieldFilterService = fieldFilterService; + } + + public void setAiShopService(AiShopService aiShopService) { + this.aiShopService = aiShopService; + } +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopService.java new file mode 100644 index 000000000..efe2d3287 --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopService.java @@ -0,0 +1,49 @@ +package com.fangjia.service.datastore; + +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.ShopRentStat; +import com.fangjia.dal.mongo.model.ShopSellStat; +import com.fangjia.service.datastore.dto.ShopEvaluationDto; + +import java.util.List; + +public interface AiShopService { + + /** + * 租金均价 + * + * @param city + * @param region + * @param startDate + * @param endDate + * @return + */ + List findShopRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate); + + /** + * 租金地址维度评估 + * + * @param evaluation + * @return + */ + ShopEvaluationDto addressEvaluateRent(Evaluation evaluation); + + /** + * 城市写字楼出售均价 + * + * @param city + * @param region + * @param startDate + * @param endDate + * @return + */ + List findShopSellStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate); + + /** + * 售价地址维度评估 + * + * @param evaluation + * @return + */ + ShopEvaluationDto addressEvaluateSell(Evaluation evaluation); +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java new file mode 100644 index 000000000..5c7edbcff --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java @@ -0,0 +1,553 @@ +package com.fangjia.service.datastore; + +import com.fangjia.core.RegionData; +import com.fangjia.core.util.CacheUtils; +import com.fangjia.core.util.DataUtil; +import com.fangjia.core.util.DateUtil; +import com.fangjia.dal.QueryParam; +import com.fangjia.dal.SeawaterQuery; +import com.fangjia.dal.SortParam; +import com.fangjia.dal.mongo.dao.shop.ShopRentStatDao; +import com.fangjia.dal.mongo.dao.shop.ShopSellStatDao; +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.ShopRentStat; +import com.fangjia.dal.mongo.model.ShopSellStat; +import com.fangjia.dal.seawater.model.Seawater; +import com.fangjia.service.datastore.dto.ShopEvaluationDto; +import com.fangjia.service.mongo.fangjia.SeawaterService; +import com.fangjia.service.util.GeoUtils; +import com.fangjia.service.util.dto.GaodeDto; +import com.mongodb.BasicDBObject; +import org.apache.commons.collections.CollectionUtils; +import org.sothis.core.util.Closure; +import org.sothis.core.util.Pager; +import weiboclient4j.utils.StringUtils; + +import java.util.*; + +public class AiShopServiceImpl implements AiShopService { + + private ShopRentStatDao shopRentStatDao; + private SeawaterService seawaterService; + private ShopSellStatDao shopSellStatDao; + + + // 所在楼层 +// 总楼层 + private static final Map FITMENT_MAP = new HashMap() { + { + put("1", "毛坯"); + put("2", "简装"); + put("3", "精装"); + put("4", "豪装"); + } + }; + + private static final Map DIRECTION_MAP = new HashMap() { + { + put("1", "西南"); + put("2", "东南"); + put("3", "南"); + put("4", "西北"); + put("5", "东北"); + put("6", "东"); + put("7", "西"); + put("8", "北"); + put("9", "东西"); + put("10", "南北"); + } + }; + private static final Map FITMENT_FACTOR = new HashMap() { + { + put("毛坯", 0.9983); + put("简装", 1.0); + put("精装", 1.0153); + put("豪装", 1.0199); + } + }; + private static final Map DIRECTION_FACTOR = new HashMap() { + { + put("东", 1.0040); + put("东北", 1.0048); + put("东南", 1.0121); + put("东西", 1.0003); + put("北", 0.9999); + put("南", 1.0000); + put("南北", 1.0080); + put("西", 1.0060); + put("西北", 1.0099); + put("西南", 1.0103); + } + }; + + public ShopEvaluationDto calcRent(Evaluation evaluation) { + // 第一步:按写字楼同楼层、装修、朝向选取3个,计算平均值作为结果 + // 第二步:基准价*楼层系数*装修系数*朝向系数 + // 第三步:周边(三公里内最近的10个写字楼)同等级、同类型写字楼的均值*楼层系数*装修系数*朝向系数 + String floorDesc = evaluation.getFloorDesc(); + List selectedSeawaters = new ArrayList(); + // 第一步:按写字楼同楼层、装修、朝向选取3个,计算平均值作为结果 + List seawaters; + SeawaterQuery query = new SeawaterQuery(); + query.setRegion(evaluation.getRegion()); + query.setDistrictName(evaluation.getDistrictName()); + query.setFitment(FITMENT_MAP.get(evaluation.getFitment())); + query.setDirection(DIRECTION_MAP.get(evaluation.getDirection())); + query.setCat("shop_rent"); + query.setRadius(3000); + + Integer endDate = Integer.valueOf(DateUtil.formatByPattern(new Date(), "yyyyMMdd")); + Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")); + query.setStartDate(startDate); + query.setEndDate(endDate); + + query.setCityDisplay(evaluation.getCity()); + Pager pager = new Pager(); + pager.setStartRow(0); + pager.setPageSize(100); + query.setPager(pager); + query.setTable("latest_seawater"); + seawaters = seawaterService.findSeawatersByQuery(query); + if (StringUtils.isNotBlank(query.getFitment()) && StringUtils.isNotBlank(query.getDirection())) { + for (Seawater seawater : seawaters) { + boolean sameFloorDesc = false; + + if (seawater.getFloorInfo() != null && floorDesc != null) { + if (seawater.getFloorInfo().contains(floorDesc)) { + sameFloorDesc = true; + } else { + try { + Integer floor = Integer.parseInt(seawater.getFloorInfo()); + if (floor <= 6 && "低".equals(floorDesc)) { + sameFloorDesc = true; + } else if (floor > 6 && floor <= 15 && "中".equals(floorDesc)) { + sameFloorDesc = true; + } else if (floor > 15 && "高".equals(floorDesc)) { + sameFloorDesc = true; + } + } catch (Exception ex) { + + } + } + } + if (sameFloorDesc) { + selectedSeawaters.add(seawater); + } + if (selectedSeawaters.size() == 3) { + return getShopEvaluationDto(selectedSeawaters, evaluation, "shop_rent"); + } + } + } + // 查找基准价 + List params = new ArrayList(); + params.add(new QueryParam("cat", "shop")); + params.add(new QueryParam("city", evaluation.getCity())); + params.add(new QueryParam("district", evaluation.getRegion())); + params.add(new QueryParam("name", evaluation.getDistrictName())); + // 获取上个月yyyyMM日期 + String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -2), "yyyyMM"); + params.add(new QueryParam("date", Integer.parseInt(date))); + + // 按日期降序排序,取最新的数据,可能上月还未更新,则取上上个月的数据 + List sortParams = new ArrayList(); + sortParams.add(new SortParam("date", false)); + + // 第二步:基准价*楼层系数*装修系数*朝向系数 + ShopRentStat shopRentStat = shopRentStatDao.findFirstByParams(params); + Double avgPrice = shopRentStat.getAvgPrice(); + if (avgPrice != null) { + Double factor = 1.0; + if (evaluation.getFitment() != null) { + factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment())); + } + if (evaluation.getDirection() != null) { + factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection())); + } + avgPrice = avgPrice * factor; + return getShopEvaluationDtoWithAvgPrice(avgPrice, evaluation, "shop_rent"); + } + + return null; + } + + /** + * 根据均价查询样本 + * + * @param avgPrice + * @param evaluation + * @return + */ + private ShopEvaluationDto getShopEvaluationDtoWithAvgPrice(Double avgPrice, Evaluation evaluation, String cat) { + SeawaterQuery query = new SeawaterQuery(); + query.setRegion(evaluation.getRegion()); + if ("shop_rent".equals(cat)) { + query.setStartPrice((int) (avgPrice * 30 * 0.9)); + query.setEndPrice((int) (avgPrice * 30 * 1.1)); + } else { + query.setStartPrice((int) (avgPrice * 0.9)); + query.setEndPrice((int) (avgPrice * 1.1)); + } + query.setCat(cat); + query.setRadius(3000); + + Integer endDate = Integer.valueOf(DateUtil.formatByPattern(new Date(), "yyyyMMdd")); + Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")); + query.setStartDate(startDate); + query.setEndDate(endDate); + + query.setCityDisplay(evaluation.getCity()); + Pager pager = new Pager(); + pager.setStartRow(0); + pager.setPageSize(5); + query.setPager(pager); + query.setTable("latest_seawater"); + List seawaters = seawaterService.findSeawatersByQuery(query); + return getShopEvaluationDto(seawaters, evaluation, cat); + } + + /** + * 基准价*楼层系数*装修系数*朝向系数 + * + * @param seawaters + * @param evaluation + * @return + */ + private static ShopEvaluationDto getShopEvaluationDtoWithFactor(List seawaters, Evaluation evaluation) { + Double sum = 0.0; + Double size = 0.0; + + String fitment = FITMENT_MAP.get(evaluation.getFitment()); + String direction = DIRECTION_MAP.get(evaluation.getDirection()); + for (Seawater seawater : seawaters) { + if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) { + Double price = Double.valueOf(seawater.getTotalPrice()); + // 装修 + if (seawater.getFitment() != null) { + try { + price = price / FITMENT_FACTOR.get(seawater.getFitment()) * FITMENT_FACTOR.get(fitment); + } catch (Exception ex) { + + } + } + // 朝向 + if (seawater.getDirection() != null) { + try { + price = price / DIRECTION_FACTOR.get(seawater.getDirection()) * DIRECTION_FACTOR.get(direction); + } catch (Exception ex) { + + } + } + + sum += price; + size += seawater.getArea(); + } + } + ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto(); + if (size > 0) { + Double unitPrice = DataUtil.roundDouble(sum / size / 30, 2); + shopEvaluationDto.setUnitPrice(unitPrice); + shopEvaluationDto.setSeawater(seawaters); + shopEvaluationDto.setCity(evaluation.getCity()); + shopEvaluationDto.setDistrict(evaluation.getRegion()); + shopEvaluationDto.setName(evaluation.getDistrictName()); + } + return shopEvaluationDto; + } + + /** + * 纯样本查询结果估值 + * + * @param seawaters + * @param evaluation + * @return + */ + private static ShopEvaluationDto getShopEvaluationDto(List seawaters, Evaluation evaluation, String cat) { + Integer sum = 0; + Double size = 0.0; + + ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto(); + + if ("shop_rent".equals(cat)) { + for (Seawater seawater : seawaters) { + if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) { + sum += seawater.getTotalPrice(); + size += seawater.getArea(); + } + } + if (size > 0) { + Double unitPrice = DataUtil.roundDouble(sum / size / 30, 2); + shopEvaluationDto.setUnitPrice(unitPrice); + shopEvaluationDto.setSeawater(seawaters); + shopEvaluationDto.setCity(evaluation.getCity()); + shopEvaluationDto.setDistrict(evaluation.getRegion()); + shopEvaluationDto.setName(evaluation.getDistrictName()); + } + } else { + for (Seawater seawater : seawaters) { + if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() > 0) { + sum += seawater.getTotalPrice(); + size += seawater.getArea(); + } + } + if (size > 0) { + Double unitPrice = DataUtil.roundDouble(sum / size, 2); + shopEvaluationDto.setUnitPrice(unitPrice); + shopEvaluationDto.setSeawater(seawaters); + shopEvaluationDto.setCity(evaluation.getCity()); + shopEvaluationDto.setDistrict(evaluation.getRegion()); + shopEvaluationDto.setName(evaluation.getDistrictName()); + } + } + + return shopEvaluationDto; + } + + + @Override + public ShopEvaluationDto addressEvaluateRent(Evaluation evaluation) { + if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) { + evaluation.setFloor(null); + evaluation.setHeight(null); + } + // 评估逻辑 +// String location = getLocation(evaluation.getCity(), evaluation.getAddress()); + GaodeDto gaodeDto = getGaodeGeo(evaluation.getCity(), evaluation.getAddress()); + if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) { + evaluation.setLocation(gaodeDto.getLng() + "," + gaodeDto.getLat()); + } else { + evaluation.setLocation(""); + } + evaluation.setRegion(RegionData.formatRegion(evaluation.getCity(), gaodeDto.getDistrict())); + return rentEvaluateByLocation(evaluation); + } + + @Override + public List findShopSellStat(String city, String region, String name, String cat, Integer startDate, Integer endDate) { + return Collections.emptyList(); + } + + private ShopEvaluationDto rentEvaluateByLocation(Evaluation evaluation) { + ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto(); + if (StringUtils.isNotBlank(evaluation.getLocation())) { + shopEvaluationDto.setLocation(evaluation.getLocation()); + Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]); + Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]); + SeawaterQuery query = new SeawaterQuery(); + query.setLat(lat); + query.setLng(lng); + query.setCat("shop_rent"); + query.setRadius(1000); + // 查询近一年样本 + query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"))); + query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd"))); + query.setCityDisplay(evaluation.getCity()); + Pager pager = new Pager(); + pager.setStartRow(0); + pager.setPageSize(5); + query.setPager(pager); + query.setTable("latest_seawater"); + List shops = seawaterService.findSeawatersByQuery(query); + if (CollectionUtils.isNotEmpty(shops)) { + // 求均值 + Double totalPrice = 0D; + int count = 0; + for (Seawater seawater : shops) { + if (seawater.getAvgPrice() != null) { + totalPrice += seawater.getAvgPrice(); + count += 1; + } + } + Double factor = 1.0; + if (evaluation.getFitment() != null) { + factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment())); + } + if (evaluation.getDirection() != null) { + factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection())); + } + Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2); + shopEvaluationDto.setUnitPrice(avgPrice); + shopEvaluationDto.setSeawater(shops); + shopEvaluationDto.setCity(evaluation.getCity()); + shopEvaluationDto.setDistrict(evaluation.getRegion()); + shopEvaluationDto.setName(evaluation.getDistrictName()); + return shopEvaluationDto; + } + } + return shopEvaluationDto; + } + + private ShopEvaluationDto sellEvaluateByLocation(Evaluation evaluation) { + ShopEvaluationDto shopEvaluationDto = new ShopEvaluationDto(); + if (StringUtils.isNotBlank(evaluation.getLocation())) { + shopEvaluationDto.setLocation(evaluation.getLocation()); + Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]); + Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]); + // 查询附近5个写字楼基准价 + BasicDBObject geo = new BasicDBObject(); + BasicDBObject nearQuery = new BasicDBObject(); + nearQuery.append("$geometry", new BasicDBObject("type", "Point").append("coordinates", new double[]{lng, lat})); + nearQuery.append("$maxDistance", 3000); + geo.append("$near", nearQuery); + + List params = new ArrayList(5); + params.add(new QueryParam("cat", "shop")); + params.add(new QueryParam("location", geo)); + + String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -2), "yyyyMM"); + params.add(new QueryParam("date", Integer.parseInt(date))); + + // 按日期降序排序,取最新的数据,可能上月还未更新,则取上上个月的数据 + List sortParams = new ArrayList(); + sortParams.add(new SortParam("date", false)); + + List infos = shopSellStatDao.findAllByParams(params, sortParams, 5); + if (CollectionUtils.isEmpty(infos)) { + // 去掉类型,重新查找 + params = new ArrayList(5); + params.add(new QueryParam("cat", "shop")); + params.add(new QueryParam("location", geo)); + params.add(new QueryParam("date", Integer.parseInt(date))); + infos = shopSellStatDao.findAllByParams(params, sortParams); + } + if (CollectionUtils.isNotEmpty(infos)) { + // 求均值 + Double totalPrice = 0D; + int count = 0; + for (ShopSellStat shopSellStat : infos) { + if (shopSellStat.getAvgPrice() != null) { + totalPrice += shopSellStat.getAvgPrice(); + count += 1; + } + } + Double factor = 1.0; + if (evaluation.getFitment() != null) { + factor *= FITMENT_FACTOR.get(FITMENT_MAP.get(evaluation.getFitment())); + } + if (evaluation.getDirection() != null) { + factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection())); + } + Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2); + shopEvaluationDto.setUnitPrice(avgPrice); + shopEvaluationDto.setCity(evaluation.getCity()); + shopEvaluationDto.setDistrict(evaluation.getRegion()); + shopEvaluationDto.setName(evaluation.getDistrictName()); + return shopEvaluationDto; + } + } + return shopEvaluationDto; + } + + private String getLocation(String city, String address) { + GaodeDto gaodeDto = GeoUtils.geo(city, address); + if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) { + return gaodeDto.getLng() + "," + gaodeDto.getLat(); + } + return ""; + } + + private GaodeDto getGaodeGeo(String city, String address) { + GaodeDto gaodeDto = GeoUtils.geo(city, address); + return gaodeDto; + } + + public List findShopRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) { + return CacheUtils.getValue(this.getClass(), "findShopRentStat", city + region + name + startDate + endDate, + CacheUtils.CachePolicyEnum.MIDDLE, new Closure, String>() { + public List execute(String input) { + return doFindRegionBlockStat(city, region, name, cat, startDate, endDate); + } + }); + } + + public List doFindRegionBlockStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) { + if (startDate == null) { + throw new IllegalArgumentException("开始日期不能为空"); + } + if (endDate == null) { + throw new IllegalArgumentException("结束日期不能为空"); + } + if (StringUtils.isBlank(cat)) { + throw new IllegalArgumentException("cat不能为空"); + } + + List params = new ArrayList(); + params.add(new QueryParam("city", city)); + params.add(new QueryParam("district", region)); + if (StringUtils.isNotBlank(name)) { + params.add(new QueryParam("name", name)); + } + params.add(new QueryParam("cat", cat)); + + if (startDate != null) { + params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate)); + } + if (endDate != null) { + params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate)); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("date", true)); + List regionStats = shopRentStatDao.findAllByParams(params, sortParams); + return regionStats; + } + + @Override + public ShopEvaluationDto addressEvaluateSell(Evaluation evaluation) { + if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) { + evaluation.setFloor(null); + evaluation.setHeight(null); + } + // 评估逻辑 +// String location = getLocation(evaluation.getCity(), evaluation.getAddress()); + GaodeDto gaodeDto = getGaodeGeo(evaluation.getCity(), evaluation.getAddress()); + if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) { + evaluation.setLocation(gaodeDto.getLng() + "," + gaodeDto.getLat()); + } else { + evaluation.setLocation(""); + } + evaluation.setRegion(RegionData.formatRegion(evaluation.getCity(), gaodeDto.getDistrict())); + return sellEvaluateByLocation(evaluation); + } + + public List doFindShopSellStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) { + if (startDate == null) { + throw new IllegalArgumentException("开始日期不能为空"); + } + if (endDate == null) { + throw new IllegalArgumentException("结束日期不能为空"); + } + if (StringUtils.isBlank(cat)) { + throw new IllegalArgumentException("cat不能为空"); + } + + List params = new ArrayList(); + params.add(new QueryParam("city", city)); + params.add(new QueryParam("district", region)); + if (StringUtils.isNotBlank(name)) { + params.add(new QueryParam("name", name)); + } + params.add(new QueryParam("cat", cat)); + + if (startDate != null) { + params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate)); + } + if (endDate != null) { + params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate)); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("date", true)); + List sellStatList = shopSellStatDao.findAllByParams(params, sortParams); + return sellStatList; + } + + public void setSeawaterService(SeawaterService seawaterService) { + this.seawaterService = seawaterService; + } + + public void setShopRentStatDao(ShopRentStatDao shopRentStatDao) { + this.shopRentStatDao = shopRentStatDao; + } + + public void setShopSellStatDao(ShopSellStatDao shopSellStatDao) { + this.shopSellStatDao = shopSellStatDao; + } +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/ShopService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/ShopService.java index e66e53e25..7665fd814 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/ShopService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/ShopService.java @@ -1,11 +1,11 @@ package com.fangjia.service.datastore; -import java.util.List; - import com.fangjia.dal.QueryParam; import com.fangjia.dal.common.DistrictKey; import com.fangjia.dal.seaweed.model.Shop; +import java.util.List; + public interface ShopService { List findByKeyword(String city, String keyword); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopEvaluationDto.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopEvaluationDto.java new file mode 100644 index 000000000..60432aa1f --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopEvaluationDto.java @@ -0,0 +1,54 @@ +package com.fangjia.service.datastore.dto; + +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.seawater.model.Seawater; + +import java.util.List; + +/** + * @author shenjian + * @since 2025/2/19 + */ +public class ShopEvaluationDto extends Evaluation { + + private Double unitPrice; + + private List seawater; + + private String district; + + private String name; + + + public Double getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(Double unitPrice) { + this.unitPrice = unitPrice; + } + + public List getSeawater() { + return seawater; + } + + public void setSeawater(List seawater) { + this.seawater = seawater; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopRentDto.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopRentDto.java new file mode 100644 index 000000000..02e2379f4 --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/dto/ShopRentDto.java @@ -0,0 +1,32 @@ +package com.fangjia.service.datastore.dto; + +import com.fangjia.dal.seawater.model.Seawater; + +import java.util.List; + +/** + * @author shenjian + * @since 2025/2/19 + */ +public class ShopRentDto { + + private Double unitPrice; + + private List seawater; + + public Double getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(Double unitPrice) { + this.unitPrice = unitPrice; + } + + public List getSeawater() { + return seawater; + } + + public void setSeawater(List seawater) { + this.seawater = seawater; + } +} From a40f591a9a3b79ee940e1c50841f53920a1f559d Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 10 Apr 2025 18:37:45 +0800 Subject: [PATCH 05/13] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy index 9ff38507e..7bd1a3cdb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy @@ -243,6 +243,7 @@ class SeaweedDataSynch extends BaseBatch{ } if(!esObj || (esObj && diffMap)){ map.put("id", d._id.toString()) + map.put("status", 0) //因为判断是否有值,0会返回false,所在这里设置默认值,在89和52上的都是有效数据 return map } return null From d7fbf345d8355cd521691cdba064577404a04341 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 13:10:09 +0800 Subject: [PATCH 06/13] update --- .../gj/data_handle/AutoAddOfficeBatch.groovy | 441 +++++++++++++++--- 1 file changed, 373 insertions(+), 68 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy index 38c7d1c16..5338abf79 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy @@ -2,12 +2,18 @@ package com.fangjia.script.gj.data_handle import com.fangjia.core.RegionData import com.fangjia.script.BaseBatch +import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.gj.district.FangjiaClientUtils import com.fangjia.script.util.CosineSimilarAlgorithm import com.fangjia.script.util.DataUtil +import com.fangjia.script.util.DbUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.GeoHelper +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import groovy.sql.Sql import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CopyOnWriteArraySet @@ -16,30 +22,47 @@ import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.concurrent.atomic.AtomicLong -class AutoAddOfficeBatch extends BaseBatch{ +class AutoAddOfficeBatch extends BaseBatch { - def fullCityMap = CommonDatautils.queryFullNameByCity() - public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30) + def fullCityMap = CommonDatautils.queryFullNameByCity() + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) + DBCollection BAIDU_POI_COLL = MongoUtils.getCollectionByName("crawl", "poi_wap_spider", "192.168.0.206", 27020) + + //235为房价网内部计算均价的库 + def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified", + "postgres", "Goojia123456", "org.postgresql.Driver") static main(args) { // runBatch(new AutoAddOfficeBatch(), args) def task = new AutoAddOfficeBatch() - task.repeatOffice() +// task.repeatOffice() + task.repeatDist() } @Override void process(Object args) { +// def pattern = /[A-Z0-9]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|[0-9]号楼|\(装修中\)|[A-Z]楼|[0-9]幢/ +// def newName = "开放广场".replaceAll(pattern, "") +// println newName +// findAddOfficeDatas() //查找需要新增的写字楼数据 +// checkInBaiduMapOffice()//查寻在百度地图上有的写字楼数据 +// addOffice()//新增写字楼 + + + } + + def findAddOfficeDatas() { def citys = CommonDatautils.findAllCity() def allAddOffices = [] - allAddOffices << ["地图ID","省","市","区","写字楼名称","地址","经度","纬度","匹配城市","匹配区域","匹配名称","匹配方式"] - for(def c : citys){ + allAddOffices << ["地图ID", "省", "市", "区", "写字楼名称", "地址", "经度", "纬度", "匹配城市", "匹配区域", "匹配名称", "匹配方式"] + for (def c : citys) { def cityObj = fullCityMap.get(c) - if(cityObj){ + if (cityObj) { def officeMaps = CommonDatautils.findOfficeByMap(cityObj.city, "商务写字楼") officeMaps = filterOffice(officeMaps) - if(officeMaps){ + if (officeMaps) { def offices = matchOffice(officeMaps) allAddOffices.addAll(offices) @@ -49,59 +72,72 @@ class AutoAddOfficeBatch extends BaseBatch{ ExcelUtils.write("D:\\数据\\高德写字楼.xlsx", allAddOffices, "数据") } - def filterOffice(officeMaps){ + def checkInBaiduMapOffice() { + ExcelUtils.multiThreadingModify("D:\\数据\\高德写字楼1.xlsx", { d -> + if (!d['L']) { + def obj = findBaiduDatas(d['C'], d['D'], d['E']) + if (obj) { + d['L'] = "百度存在" + d['M'] = obj.std_tag.toString() + } + } + + }, 0) + } + + def filterOffice(officeMaps) { def offices = [] def keys = [] - for(def o : officeMaps){ - if(!o){ + for (def o : officeMaps) { + if (!o) { continue } - if(o.name.startsWith("写字楼") || o.name.startsWith("综合楼") || o.name.contains("销售") || o.name.startsWith("办公楼") || o.name.startsWith("公务楼") || o.name.startsWith("行政楼") || o.name.startsWith("商务办公楼") || o.name.startsWith("综合办公楼")){ - println "[ 过滤 ] "+o.city+" "+o.name + if (o.name.startsWith("写字楼") || o.name.startsWith("综合楼") || o.name.contains("销售") || o.name.startsWith("办公楼") || o.name.startsWith("公务楼") || o.name.startsWith("行政楼") || o.name.startsWith("商务办公楼") || o.name.startsWith("综合办公楼")) { + println "[ 过滤 ] " + o.city + " " + o.name continue } - if(o.name.contains("路写字楼")){ - println "[ 过滤 ] "+o.city+" "+o.name + if (o.name.contains("路写字楼")) { + println "[ 过滤 ] " + o.city + " " + o.name continue } def pattern = /[A-Z0-9]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|[0-9]号楼|\(装修中\)|[A-Z]楼|[0-9]幢/ def newName = o.name.replaceAll(pattern, "") o.name = newName - def keyName = o.city +"#"+o.district+"#"+o.name - if(!keys.contains(keyName)){ + def keyName = o.city + "#" + o.district + "#" + o.name + if (!keys.contains(keyName)) { offices << o keys << keyName } } - println "原:"+officeMaps.size() +" 新:"+offices.size() + println "原:" + officeMaps.size() + " 新:" + offices.size() return offices } - def matchOffice(offices){ + def matchOffice(offices) { def addCount = new AtomicLong() final CountDownLatch latch = new CountDownLatch(offices.size()) def total = offices.size() def rets = new CopyOnWriteArrayList() - for(def i=0;i=1){ + if (rets) { + if (rets.size() >= 1) { office = rets[0] } - }else{ + } else { rets = CommonDatautils.findDistrictByAlias(simpleCity, simpleDistrict, nmd.name, "office") - if(rets && rets.size()>=1){ + if (rets && rets.size() >= 1) { office = rets[0] - }else{ + } else { rets = CommonDatautils.findDistrictByAddress(simpleCity, simpleDistrict, nmd.name, "district") - if(rets && rets.size()>=1){ + if (rets && rets.size() >= 1) { office = rets[0] } } } - if(office){ + if (office) { office.match_way = "数据库" } return office @@ -144,65 +180,147 @@ class AutoAddOfficeBatch extends BaseBatch{ return null } - def matchApi(nmd){ + def matchApi(nmd) { def address = nmd.city - if(nmd.district){ + if (nmd.district) { address = address + nmd.district } address = address + nmd.name def jsonObject = FangjiaClientUtils.newMatch(nmd.city, address, "office", false) - if(!jsonObject){ - if(DataUtil.isPreciseAddress(nmd.address)){ + if (!jsonObject) { + if (DataUtil.isPreciseAddress(nmd.address)) { address = nmd.city - if(nmd.district){ + if (nmd.district) { address = address + nmd.district } address = address + nmd.address jsonObject = FangjiaClientUtils.newMatch(nmd.city, address, "office", false) } } - if(jsonObject) { - def udata = [:] - udata.put("_id",jsonObject.get("id")) - udata.put("city",jsonObject.get("city")) - udata.put("region",jsonObject.get("district")) - udata.put("name",jsonObject.get("name")) - udata.put("match_type",jsonObject.get("propertyType")) - udata.put("match_credit",jsonObject.get("credit")) + if (jsonObject) { + def udata = [:] + udata.put("_id", jsonObject.get("id")) + udata.put("city", jsonObject.get("city")) + udata.put("region", jsonObject.get("district")) + udata.put("name", jsonObject.get("name")) + udata.put("match_type", jsonObject.get("propertyType")) + udata.put("match_credit", jsonObject.get("credit")) udata.put("match_way", "接口") return udata } return null } - def repeatOffice(){ + def repeatOffice() { def citys = CommonDatautils.findAllCity() def allrets = [] - allrets << ["ID","城市","区域","名称","地址","可疑ID","可疑城市","可疑区域","可疑名称","可疑地址","相似度","距离"] - for(def c : citys){ - def offices = CommonDatautils.findAllDistricts(c, "office", ["city","region","name","address", "lat", "lng"]) + allrets << ["ID", "城市", "区域", "名称", "地址", "可疑ID", "可疑城市", "可疑区域", "可疑名称", "可疑地址", "相似度", "距离"] + for (def c : citys) { + def offices = CommonDatautils.findAllDistricts(c, "office", ["city", "region", "name", "address", "lat", "lng"]) def rets = checkRepeatOfficeBatch(offices) - println c +" "+offices.size() + println c + " " + offices.size() allrets.addAll(rets) } ExcelUtils.write("D:\\数据\\写字楼\\重复可疑写字楼1.xlsx", allrets, "数据") } - def checkRepeatOfficeBatch(offices){ + def repeatDist(){ + def citys = CommonDatautils.findAllCity() + def allrets = [] + allrets << [ "城市", "区域", "名称", "别名","计算方式","地址","名称相似度","地址相似度","总相似度"] + for (def c : citys) { + def districts = CommonDatautils.findAllDistricts(c, "district", ["city", "region", "name", "address", "alias"]) + def rets = checkRepeatDistrictBatch(c, districts) + println c + " " + districts.size() + allrets.addAll(rets) + println c +" 支行完成 "+rets.size() + } + ExcelUtils.write("/home/goojia/gj/重复可疑小区1.xlsx", allrets, "数据") + } + + def checkRepeatDistrictBatch(city,districts) { + def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() + def cityId = cityCodeDataMap.get(city) + + def fjwPriceMap = findNewFjwAvgPriceList(cityId, 202502) + def addCount = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(districts.size()) + def total = districts.size() + def rets = new CopyOnWriteArrayList() + def sets = new CopyOnWriteArraySet() + for (def i = 0; i < total; i++) { + final def o1 = districts[i] +// fixedThreadPool.execute(new Runnable() { +// void run() { + try { + addCount.addAndGet(1) +// if(!o1.name.contains("四公司")){ +// continue +// } + if(!sets.contains(o1._id.toString())){ + def similarRets = findListSimilar(o1, districts) + if (similarRets) { + def newPriceMap1 = fjwPriceMap.get(o1._id.toString()) + def new_price1 = null + if(newPriceMap1){ + new_price1 = newPriceMap1.calc_type + } + def ailas_str1 = "" + if(o1.alias){ + ailas_str1 = o1.alias.join(",") + } + def rows = [] + for(def similar : similarRets){ + if (!sets.contains(similar._id.toString())) { + sets.add(similar._id.toString()) + def ailas_str = "" + if(similar.alias){ + ailas_str = similar.alias.join(",") + } + def newPriceMap = fjwPriceMap.get(o1._id.toString()) + def new_price = null + if(newPriceMap){ + new_price = newPriceMap.calc_type + } + rows << [ similar.city, similar.region, similar.name, ailas_str,new_price, similar.address, similar.nameScore, similar.addrScore, similar.score] +// rets << [ similar.city, similar.region, similar.name, ailas_str,new_price, similar.address, similar.nameScore, similar.addrScore, similar.score] + } + } + if(rows){ + sets.add(o1._id.toString()) + rets << [ o1.city, o1.region, o1.name, ailas_str1,new_price1, o1.address, "主", "主", "主"] + rets.addAll(rows) + } + + } + } + } catch (Exception e) { + e.printStackTrace() + } finally { + latch.countDown() + } +// } +// }); + } +// latch.await() + return rets + } + + def checkRepeatOfficeBatch(offices) { def addCount = new AtomicLong() final CountDownLatch latch = new CountDownLatch(offices.size()) def total = offices.size() def rets = new CopyOnWriteArrayList() def sets = new CopyOnWriteArraySet() - for(def i=0;i o2.name.length()){ + str = o1.name.replace(o2.name, "") + }else{ + str = o2.name.replace(o1.name, "") + } + if (nameScore > 0.6 && ["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { + o2.nameScore = nameScore + o2.addrScore = addrScore + o2.score = nameScore + rets << o2 + ids << o2._id.toString() + def maxObj = findMaxSimilar(ids, o2, datas) + while(maxObj){ + maxObj.nameScore = CosineSimilarAlgorithm.levenshteinSimilarity(maxObj.name, o1.name); + if(o1.address && maxObj.address){ + maxObj.addrScore = CosineSimilarAlgorithm.levenshteinSimilarity(o1.address, o2.address); + } + maxObj.score = maxObj.nameScore + rets << maxObj + ids << maxObj._id.toString() + maxObj = findMaxSimilar(ids, maxObj, datas) + } + } + } + } + + rets.sort{a,b-> + def a1 = a.score + def b1 = b.score + return b1.compareTo(a1) + } + + if (rets.size()>2) { + return rets[0..2] + } + return rets + } + + def findMaxSimilar(ids, o1, datas){ + def maxObj = null + def maxScore = -1000 + for (def o2 : datas) { + if (o1._id.toString() != o2._id.toString() && o1.region==o2.region && !ids.contains(o2._id.toString())) { + def name1 = o1.name//.replace("小区","").replace("别墅","") + def name2 = o2.name//.replace("小区","").replace("别墅","") + def nameScore = CosineSimilarAlgorithm.levenshteinSimilarity(name1, name2); + def addrScore = null + if(o1.address && o2.address){ + addrScore = CosineSimilarAlgorithm.levenshteinSimilarity(o1.address, o2.address); + } + def str = null + if(o1.name.length() > o2.name.length()){ + str = o1.name.replace(o2.name, "") + }else{ + str = o2.name.replace(o1.name, "") + } + if (nameScore > 0.6 && nameScore>maxScore && ["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { + maxObj = o2 + o2.nameScore = nameScore + o2.addrScore = addrScore + o2.score = nameScore + } + } + } + + return maxObj + } + + def findOneSimilarOffice(o1, offices) { def maxScore = 0 def maxObj = null - for(def o2 : offices){ - if(o1._id.toString()!=o2._id.toString()){ + for (def o2 : offices) { + if (o1._id.toString() != o2._id.toString()) { double nameScore = CosineSimilarAlgorithm.getSimilarity(o1.name, o2.name); - double addrScore = CosineSimilarAlgorithm.getSimilarity(o1.address,o2.address); - if(nameScore+addrScore>maxScore){ - maxScore = nameScore+addrScore + double addrScore = CosineSimilarAlgorithm.getSimilarity(o1.address, o2.address); + if (nameScore + addrScore > maxScore) { + maxScore = nameScore + addrScore maxObj = o2 } } } def distance = -1000 - if(o1.lat && maxObj && maxObj.lat){ - distance = GeoHelper.GetDistance(o1.lat/10000000000.0, o1.lng/10000000000.0, maxObj.lat/10000000000.0, maxObj.lng/10000000000.0) + if (o1.lat && maxObj && maxObj.lat) { + distance = GeoHelper.GetDistance(o1.lat / 10000000000.0, o1.lng / 10000000000.0, maxObj.lat / 10000000000.0, maxObj.lng / 10000000000.0) } - if(maxObj){ + if (maxObj) { maxObj.distance = distance maxObj.score = maxScore return maxObj } return null } + + + def findBaiduDatas(city, district, name){ + def q = new BasicDBObject() + q.put("city", city) + q.put("district", district) + q.put("name", name) +// q.put('std_tag', '房地产;住宅区') + def obj = BAIDU_POI_COLL.findOne(q) + return obj; + } + + def addOffice(){ + ExcelUtils.modify("D:\\数据\\高德待入库写字楼.xlsx",{d-> + if(d['L']!='人工删除'){ + def city = RegionData.formatCity(d['C']) + def region = RegionData.formatRegion(city, d['D']) + if(city && region){ + def locationstr = d['G'].toString()+","+d['H'].toString() + def bdpoint = FangjiaClientUtils.convert(locationstr, 1) + def udata = new BasicDBObject() + if(bdpoint){ + udata.put("lng2", (bdpoint[0]*10000000000).longValue()) + udata.put("lat2", (bdpoint[1]*10000000000).longValue()) + } + + udata.put("city", city) + udata.put("region", region) + udata.put("name", d['E']) + udata.put("address", d['I']) + udata.put("cat", "office") + udata.put("status", 0) + udata.put("c_date",new Date()) + udata.put("m_date",new Date()) + udata.put("lng", (d['G'].toString().toDouble()*10000000000).longValue()) + udata.put("lat", (d['H'].toString().toDouble()*10000000000).longValue()) + + def estate_type = null + if(d['M'] && d['M'].contains("园区")){ + estate_type = "创意园区" + } + + if(!estate_type && d['E'].contains("创意")){ + estate_type = "创意园区" + } + if(estate_type){ + udata.put("estate_type2", estate_type) + } + + def markMap = [:] + markMap.put("data_source", "机器入库") + udata.put("mark_map", markMap) + DbUtils.seaweed.save(udata) + println d['E'] +" "+udata._id.toString() + } + } + }) + } + + + def findNewFjwAvgPrice(def commid, def cityid){ + def sql = "SELECT gujia_bds_clc_avprc,gujia_bds_clmtd,gujiabds_clc_yrmo_val,gujia_bds_cfdc_dgr from price_stat.avm_community_base_price where urbn_id='${cityid}' and gujia_bds_id='${commid}' order by gujiabds_clc_yrmo_val desc limit 1" + def map = [:] + pgsqlInstance235.eachRow(sql, { r -> + map.avg_price = r.gujia_bds_clc_avprc + map.type = r.gujia_bds_clmtd + map.month = r.gujiabds_clc_yrmo_val + map.credit_value = r.gujia_bds_cfdc_dgr + if(r.gujia_bds_clmtd == 1){ + map.calc_type = "人工估值" + }else if(r.gujia_bds_clmtd == 2){ + map.calc_type = "样本计算" + }else if(r.gujia_bds_clmtd == 3){ + map.calc_type = "神经网络" + } + }) + return map + } + + def findNewFjwAvgPriceList(def cityid, date){ + def sql = "SELECT gujia_bds_clc_avprc,gujia_bds_clmtd,gujiabds_clc_yrmo_val,gujia_bds_cfdc_dgr,gujia_bds_id from price_stat.avm_community_base_price where urbn_id='${cityid}' and gujiabds_clc_yrmo_val=${date}" + def retMap = [:] + pgsqlInstance235.eachRow(sql, { r -> + def map = [:] + map.avg_price = r.gujia_bds_clc_avprc + map.type = r.gujia_bds_clmtd + map.month = r.gujiabds_clc_yrmo_val + map.credit_value = r.gujia_bds_cfdc_dgr + if(r.gujia_bds_clmtd == 1){ + map.calc_type = "人工估值" + }else if(r.gujia_bds_clmtd == 2){ + map.calc_type = "样本计算" + }else if(r.gujia_bds_clmtd == 3){ + map.calc_type = "神经网络" + } + retMap.put(r.gujia_bds_id, map) + }) + return retMap + } + } From b958ae87a39c98bc202781cb452c359783b1d554 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 13:25:39 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/groovy/com/fangjia/script/util/MongoUtils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/MongoUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/MongoUtils.groovy index 54d093d7e..3ecfd9680 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/MongoUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/MongoUtils.groovy @@ -57,7 +57,7 @@ class MongoUtils { static def collectionMap = [:] static def loudongCollectionMap = [:] - static def getCollectionByName(db, name, domainUrl, port = 27017) { + static def getCollectionByName(db, name, domainUrl, port = 28017) { if ((domainUrl == MongoDB_IP_43 || domainUrl == MongoDB_IP_136 || domainUrl == MongoDB_Domain_offline_fangjia || domainUrl == MongoDB_IP_85 || domainUrl == MongoDB_Domain_mongo) && port == 28017) { return com.fangjia.core.util.MongoUtils.getDbCollection(Constants.FANGJIA_MONGO_URI, db, name) From 78e0f3c202eb9c3f903aa8ffbb1124543eadfaf1 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 14:02:02 +0800 Subject: [PATCH 08/13] =?UTF-8?q?43=E6=94=B9=E4=B8=BA=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-script/pom.xml | 12 ++ ...ickHouseDistrictStatMarkupCalcBatch.groovy | 2 +- .../ana/DistrictStatMarkupCalcBatch.groovy | 2 +- .../script/ccbevaluation/AddSzDealData.groovy | 4 +- .../ccbevaluation/AddThirdPriceSample.groovy | 2 +- .../ccbevaluation/BigdataDealBatch.groovy | 2 +- .../ccbevaluation/DistrictDelete.groovy | 2 +- .../ccbevaluation/ThirdPartyPriceBatch.groovy | 2 +- .../script/ccbevaluation/TradeStatLog.groovy | 2 +- .../ccbevaluation/data/ExcelDataTest.groovy | 8 +- .../data/MatchDealPriceRegion.groovy | 2 +- .../chongqing/BlankEvaluationBatch.groovy | 2 +- .../script/chongqing/FumingTest.groovy | 2 +- .../script/chongqing/HailanTest.groovy | 2 +- .../fangjia/script/chongqing/PocStat.groovy | 2 +- .../script/chongqing/RuiFenPocTest.groovy | 2 +- .../script/commData/CommonDatautils.groovy | 2 +- ...FewerHouseDistrictCrawlCommandBatch.groovy | 2 +- .../fangjia/script/crawl/Test_weilei.groovy | 2 +- .../DistrictTradeHouseStatBatch.groovy | 4 +- .../dealPrice/SynchDealPriceToEs.groovy | 2 +- .../fangjiatong/AbcEvaluationRowsBatch.groovy | 2 +- .../fuzhou/DistrictInfoExportBatch.groovy | 2 +- .../script/fuzhou/FzDataResultStat.groovy | 2 +- .../com/fangjia/script/fuzhou/Test.groovy | 2 +- .../com/fangjia/script/fuzhou/Test1.groovy | 2 +- .../fuzhou/ThirdPriceExportBatch.groovy | 2 +- .../fangjia/script/fuzhou/ThirdTest.groovy | 2 +- .../script/fuzhou/TradeExportBatch.groovy | 2 +- .../com/fangjia/script/gj/CzBankStat.groovy | 2 +- .../fangjia/script/gj/DealPriceProcess.groovy | 2 +- .../script/gj/DistrictDetailBatch.groovy | 2 +- .../com/fangjia/script/gj/EsHouseStat.groovy | 2 +- .../com/fangjia/script/gj/FZDataExport.groovy | 4 +- .../script/gj/FZHouseEvaluation.groovy | 2 +- .../com/fangjia/script/gj/FjwUserStat.groovy | 2 +- .../script/gj/HouseLouDongMatchBatch.groovy | 2 +- .../fangjia/script/gj/LandDetailCrawl.groovy | 2 +- .../com/fangjia/script/gj/LogStat.groovy | 4 +- .../script/gj/NoHouseDistrictStatBatch.groovy | 4 +- .../script/gj/PingAnAddressLevalTest.groovy | 2 +- .../com/fangjia/script/gj/QinLingStat.groovy | 2 +- .../com/fangjia/script/gj/QinLingStat1.groovy | 2 +- .../script/gj/RegionBlockSetting.groovy | 2 +- .../script/gj/SynchDistrictStatBatch.groovy | 4 +- .../fangjia/script/gj/UpdateThirdPrice.groovy | 2 +- .../gj/apiLog/ApiUserCountAnalyBatch.groovy | 2 +- .../script/gj/ccb/CcbCityPriceStat.groovy | 2 +- .../script/gj/chongqin/PocTest2023.groovy | 2 +- .../chongqingblank/DistrictSelectHouse.groovy | 2 +- .../script/gj/chongqingblank/TestPrice.groovy | 4 +- .../script/gj/city/CityStatExport.groovy | 2 +- .../script/gj/commStat/CityStat.groovy | 2 +- .../script/gj/commStat/DataStatTest.groovy | 6 +- .../gj/data/BestDistrictPriceExport.groovy | 2 +- .../script/gj/data_handle/MinglujiData.groovy | 3 +- .../gj/data_handle/RegionStandardBatch.groovy | 63 ++++++++++- .../gj/data_handle/RegionUpdateBatch.groovy | 2 +- .../gj/data_handle/TempExportData.groovy | 24 ++-- .../fangjia/script/gj/data_handle/Test.groovy | 105 +++++++++--------- .../gj/data_handle/TownMiddleProcess.groovy | 103 ++++++++++++++++- .../gj/data_handle/TownStandardBatch.groovy | 3 +- .../gj/district/FangjiaClientUtils.groovy | 7 -- .../script/gj/district/PricePkTest.groovy | 2 +- .../script/gj/es/EsMonthHouseStat.groovy | 2 +- .../FjwBigdataDealBatch.groovy | 2 +- .../FjwThirdPartyPriceBatch.groovy | 2 +- .../guangfa/GuangfaBlankSelectDistrict.groovy | 2 +- .../gj/paimai/BeiKeCrawlByChrome.groovy | 4 +- .../script/gj/paimai/ExportPaimai.groovy | 2 +- .../gj/paimai/LianjiaCrawlByChrome.groovy | 4 +- .../script/gj/paimai/PaimaiDataSend.groovy | 2 +- .../script/gj/paimai/PaimaiTest.groovy | 2 +- .../fangjia/script/gj/poc/AddPriceTest.groovy | 4 +- .../script/gj/test/ExportToDealPrice.groovy | 4 +- .../fangjia/script/gj/test/FzBlankTest.groovy | 2 +- .../gj/test/JiangShuBlankDataStat.groovy | 2 +- .../script/gj/test/TestArroundPrice.groovy | 2 +- .../script/gj/township/StreetProcess.groovy | 2 +- .../gj/xiamen/NetworkDistanceBatch.groovy | 4 +- .../grade/ConsumptionRatingBatch.groovy | 4 +- .../script/jms/aliyun/AliyunSmsClient.groovy | 2 +- .../HousingTransactionExportBatch.groovy | 2 +- .../fangjia/script/loudong/CqfdcMatch.groovy | 2 +- .../script/majintao/GaodePOI2Baidu.groovy | 4 +- .../sync/CommunityHouseSampleBatch.groovy | 14 +-- .../DistrictStatClickhouseSyncBatch.groovy | 2 +- .../shenjian/DealPriceDetailExport.groovy | 4 +- .../script/temp/shenjian/PPE15Export.groovy | 4 +- .../temp/shenjian/PPE15ExportTest.groovy | 4 +- .../script/temp/shenjian/RentExport.groovy | 2 +- .../temp/shenjian/TotalTestExport.groovy | 4 +- .../shenjian/ValueRateCityInfoExport.groovy | 4 +- .../business/BusinessDianpingExport.groovy | 2 +- .../cqrcb/AroundExportByNewWay.groovy | 2 +- .../shenjian/cqrcb/AroundFormatExport.groovy | 2 +- .../temp/shenjian/cqrcb/ImportSchool.groovy | 2 +- .../shenjian/cqrcb/MarkUnNeedExport.groovy | 2 +- .../shenjian/cqrcb/MoveArroundTemp.groovy | 2 +- .../script/temp/shenjian/cqrcb/POIRule.groovy | 2 +- .../script/temp/shenjian/cqrcb/SavePoi.groovy | 2 +- .../temp/shenjian/cqrcb/SeaweedExport.groovy | 4 +- .../temp/shenjian/crawl/58/Seed58.groovy | 2 +- .../temp/shenjian/poi/CommitteeGeoHash.groovy | 2 +- .../temp/shenjian/poi/CommitteeLatLng.groovy | 2 +- .../temp/shenjian/poi/GetCodeFromExcel.groovy | 2 +- .../shenjian/poi/GetTownshipFromExcel.groovy | 2 +- .../temp/shenjian/util/CityUtils.groovy | 2 +- .../temp/shenjian/util/SeaweedUtils.groovy | 2 +- .../script/thirdPriceCrawl/DataStat.groovy | 2 +- .../thirdPriceCrawl/TestDistrict.groovy | 2 +- .../ThirdDataToGatherBatch.groovy | 2 +- .../script/trade/TradeDealPriceStat.groovy | 2 +- .../script/util/CosineSimilarAlgorithm.groovy | 94 +++++++++++++++- .../script/weilei/Daily/20181123.groovy | 2 +- .../script/weilei/Daily/20190115.groovy | 2 +- .../script/weilei/Daily/20190121.groovy | 2 +- .../com/fangjia/script/weilei/Test.groovy | 4 +- .../script/wenyan/address/Test1.groovy | 2 +- .../script/wenyan/temp/CityHousePrice.groovy | 2 +- .../script/wenyan/temp/DealPrice.groovy | 2 +- .../temp/DistrictStatRepeatRemover.groovy | 4 +- .../fangjia/script/wenyan/temp/Test13.groovy | 2 +- .../fangjia/script/wenyan/temp/Test14.groovy | 2 +- .../fangjia/script/wenyan/temp/Trend.groovy | 2 +- .../fangjia/script/wenyan/temp/XingYe.groovy | 2 +- .../script/yinjihaun/DealPriceStat.groovy | 2 +- .../yinjihaun/price/DistrictRateStat.groovy | 2 +- .../yinjihaun/price/QinLingStat1.groovy | 2 +- 129 files changed, 480 insertions(+), 240 deletions(-) diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 2b61cb696..ee869ba86 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -543,6 +543,18 @@ 1.18.2 + + org.apache.commons + commons-text + 1.9 + + + + com.hankcs.hanlp.restful + hanlp-restful + 0.0.12 + + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/ClickHouseDistrictStatMarkupCalcBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/ClickHouseDistrictStatMarkupCalcBatch.groovy index 1f2b994d6..bf662b6ea 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/ClickHouseDistrictStatMarkupCalcBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/ClickHouseDistrictStatMarkupCalcBatch.groovy @@ -21,7 +21,7 @@ import java.sql.DriverManager @BatchOwner(Watcher.WangWenYan) class ClickHouseDistrictStatMarkupCalcBatch extends BaseBatch { - DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 27017) + DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo", 27017) static void main(String[] args) { runBatch(new ClickHouseDistrictStatMarkupCalcBatch(), args) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/DistrictStatMarkupCalcBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/DistrictStatMarkupCalcBatch.groovy index 099982429..32afa22f9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/DistrictStatMarkupCalcBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/DistrictStatMarkupCalcBatch.groovy @@ -18,7 +18,7 @@ import com.mongodb.DBCollection @BatchOwner(Watcher.WangWenYan) class DistrictStatMarkupCalcBatch extends BaseBatch { - DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 27017) + DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 27017) Date oneYearAgo = DateUtil.add(new Date(), Calendar.MONTH, -1) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy index 4b9781f02..d96e0da05 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy @@ -8,8 +8,10 @@ import com.mongodb.DBCollection /** * 深圳公众号成交数据录入 */ + def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\2025年01月深圳二手房成交的.xlsx", 0, 1) -def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + +def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) //没有成交时间,随机生成 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy index d3df8510d..195dc1183 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddThirdPriceSample.groovy @@ -18,7 +18,7 @@ import java.util.concurrent.atomic.AtomicLong */ class AddThirdPriceSample { - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") public static final DBCollection NO_PRICE_DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia_crawl", "deal_price_all", "mongo.db.fangjia.com") 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 f6baf3541..77f92137f 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 @@ -43,7 +43,7 @@ class BigdataDealBatch extends BaseBatch{ DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl", "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DistrictDelete.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DistrictDelete.groovy index eaef4e568..a7681d9f0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DistrictDelete.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DistrictDelete.groovy @@ -45,7 +45,7 @@ class DistrictDelete { def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl", "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new DistrictDelete() 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 ffd743d5c..b17f2aae6 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 @@ -27,7 +27,7 @@ class ThirdPartyPriceBatch extends BaseBatch { def endDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); //202304 // 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") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") def sourceMap = ["诸葛找房":"01", "安居客":"02","房天下":"03","链家":"04","城市家居":"05","麦田":"06","贝壳":"07", 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 c2caf475f..73c6676eb 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 @@ -36,7 +36,7 @@ class TradeStatLog { def pssqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse?stringtype=unspecified", "postgres", "postgres", "org.postgresql.Driver") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/ExcelDataTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/ExcelDataTest.groovy index be649cf9d..f23121d0c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/ExcelDataTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/ExcelDataTest.groovy @@ -18,10 +18,10 @@ import com.mongodb.QueryOperators import groovy.sql.Sql -DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") -DBCollection CITY_STAT = MongoUtils.getCollectionByName("fangjia_stat", "city_stat", "192.168.0.43") -DBCollection CITY_INFO = MongoUtils.getCollectionByName("fangjia_data_ana", "city_info", "192.168.0.43") -DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") +DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") +DBCollection CITY_STAT = MongoUtils.getCollectionByName("fangjia_stat", "city_stat", "mongo.db.fangjia.com") +DBCollection CITY_INFO = MongoUtils.getCollectionByName("fangjia_data_ana", "city_info", "mongo.db.fangjia.com") +DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl", "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/MatchDealPriceRegion.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/MatchDealPriceRegion.groovy index 167fda35a..903a4b107 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/MatchDealPriceRegion.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/MatchDealPriceRegion.groovy @@ -12,7 +12,7 @@ class MatchDealPriceRegion { static DBCollection collection = MongoUtils.getCollectionByName("fangjia_craw", "third_party_price", "192.168.0.235", 27018) - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/BlankEvaluationBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/BlankEvaluationBatch.groovy index e45fc62c6..06213a708 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/BlankEvaluationBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/BlankEvaluationBatch.groovy @@ -21,7 +21,7 @@ import org.apache.lucene.queryparser.classic.QueryParser */ class EvaluationBatch { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl", "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/FumingTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/FumingTest.groovy index 66f7dd391..7f992095b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/FumingTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/FumingTest.groovy @@ -18,7 +18,7 @@ class FumingTest { def startDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -3, "yyyyMM")) //202302 def endDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); //202304 - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse", "postgres", "postgres", "org.postgresql.Driver") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/HailanTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/HailanTest.groovy index 25560ff03..55cf2b8dd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/HailanTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/HailanTest.groovy @@ -38,7 +38,7 @@ class HailanTest { } static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80) - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static final DBCollection FZ_DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("business", "fz_district_stat", "mongo.db.fangjia.com") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocStat.groovy index 42aedde30..3d8bc3152 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/PocStat.groovy @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicLong class PocStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection HOUSE_LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", lineUrl) public static final DBCollection LOUDONG_LINE_COLL = MongoUtils.getCollectionByName2("fangjia_base", "loudong", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/RuiFenPocTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/RuiFenPocTest.groovy index 2d862b119..c067c7694 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/RuiFenPocTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/chongqing/RuiFenPocTest.groovy @@ -15,7 +15,7 @@ class RuiFenPocTest { def startDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -3, "yyyyMM")) //202302 def endDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); //202304 - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse", "postgres", "postgres", "org.postgresql.Driver") 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 952f3eccd..17a82f2fc 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 @@ -99,7 +99,7 @@ class CommonDatautils { } public static final DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009") - public static final DBCollection ADMINISTRATIVE_MAPPING_COLL = MongoUtils.getCollectionByName("business", "administrative_mapping", "mongo.db.fangjia.com") + public static final DBCollection ADMINISTRATIVE_MAPPING_COLL = MongoUtils.getCollectionByName("business", "administrative_mapping", "mongo.db.fangjia.com", 28017) public static final DBCollection OPERATION_LOG_COLL = MongoUtils.getCollectionByName("fangjia", "operation_log", "mongo.db.fangjia.com") public static final DBCollection STATS_INDEX_COLL = MongoUtils.getCollectionByName("fangjia_stat", "stats_index", "mongo.db.fangjia.com") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/FewerHouseDistrictCrawlCommandBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/FewerHouseDistrictCrawlCommandBatch.groovy index 86ebec035..34d890e67 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/FewerHouseDistrictCrawlCommandBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/FewerHouseDistrictCrawlCommandBatch.groovy @@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils class FewerHouseDistrictCrawlCommandBatch extends BaseBatch { private static final DBCollection ARTEMIS_COLL = MongoUtils.getCollectionByName("fangjia_log", "artemis_message", "mongo.db.fangjia.com") - DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") + DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") static void main(String[] args) { runBatch(new FewerHouseDistrictCrawlCommandBatch(), args) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/Test_weilei.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/Test_weilei.groovy index 68c1dc184..d569dba6d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/Test_weilei.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/crawl/Test_weilei.groovy @@ -15,7 +15,7 @@ import org.bson.types.ObjectId //new FewerHouseDistrictCrawlCommandBatch().process(null); //return; // -//DBCollection col_43_artemis_message = MongoUtils.getCollectionByName("fangjia_log", "artemis_message", "192.168.0.43", 27017); +//DBCollection col_43_artemis_message = MongoUtils.getCollectionByName("fangjia_log", "artemis_message", "mongo.db.fangjia.com", 27017); //DBCursor cursor_artemis_message = col_43_artemis_message.find(new BasicDBObject("status", 0)); //int count = 0; //while(cursor_artemis_message.hasNext()){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/DistrictTradeHouseStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/DistrictTradeHouseStatBatch.groovy index 590386984..6f6512322 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/DistrictTradeHouseStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/DistrictTradeHouseStatBatch.groovy @@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit @BatchOwner(Watcher.GaoJuan) class DistrictTradeHouseStatBatch extends BaseBatch{ - public static DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") - public static DBCollection DISTRICT_TRADE_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_trade_stat", "192.168.0.43") + public static DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") + public static DBCollection DISTRICT_TRADE_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_trade_stat", "mongo.db.fangjia.com") static main(args) { runBatch(new DistrictTradeHouseStatBatch(), args) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/SynchDealPriceToEs.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/SynchDealPriceToEs.groovy index dba4650b9..e85220e8e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/SynchDealPriceToEs.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/dealPrice/SynchDealPriceToEs.groovy @@ -23,7 +23,7 @@ import org.elasticsearch.common.xcontent.XContentType */ @BatchOwner(Watcher.GaoJuan) class SynchDealPriceToEs extends BaseBatch{ - static DBCollection dealPriceConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43",28017) + static DBCollection dealPriceConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com",28017) static main(args) { runBatch(new SynchDealPriceToEs(), args) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fangjiatong/AbcEvaluationRowsBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fangjiatong/AbcEvaluationRowsBatch.groovy index f1f8918e6..459c68770 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fangjiatong/AbcEvaluationRowsBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fangjiatong/AbcEvaluationRowsBatch.groovy @@ -20,7 +20,7 @@ class AbcEvaluationRowsBatch extends BaseBatch{ static final def fjtSqlInstance = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/goojia_fangjia?&characterEncoding=utf8", "sa", "G00jia", "com.mysql.jdbc.Driver"); - public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", dbUrl) static main(args) { 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 377a7a6c0..d49b696f3 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 @@ -29,7 +29,7 @@ class DistrictInfoExportBatch extends BaseBatch{ def charset = "GBK" - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection FZ_ADDR_COLL = MongoUtils.getCollectionByName2("business", "fz_district_address", lineUrl) public static final DBCollection FZ_DIST_COLL = MongoUtils.getCollectionByName2("business", "fz_district", lineUrl) 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 585e7bc0b..d049deab9 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 @@ -23,7 +23,7 @@ class FzDataResultStat { public static final DBCollection FZ_DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("business", "fz_district_stat", "mongo.db.fangjia.com") - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection FZ_DIST_COLL = MongoUtils.getCollectionByName2("business", "fz_district", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy index b0ce64f12..2fc6f160d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test.groovy @@ -16,7 +16,7 @@ import net.sf.json.JSONObject import org.apache.commons.io.FileUtils import org.bson.types.ObjectId -DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") +DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") import com.fangjia.core.util.HttpRequest 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 f96bf753a..f391d5dad 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 @@ -169,7 +169,7 @@ DingDingMessageUtil.sendTextMessage(access_token, s) // // //def count(name, sDate){ -// DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") +// DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") // def q = new BasicDBObject() // q.put("city","福州") // q.put("s_date", sDate) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdPriceExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdPriceExportBatch.groovy index 11d76c586..fb6631ba3 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdPriceExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdPriceExportBatch.groovy @@ -21,7 +21,7 @@ class ThirdPriceExportBatch extends BaseBatch{ def sDate= Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -6, "yyyyMM")); def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") public static final DBCollection FZ_DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("business", "fz_district_stat", "mongo.db.fangjia.com") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdTest.groovy index 22604b2ec..57b9f852c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/ThirdTest.groovy @@ -16,7 +16,7 @@ import java.util.concurrent.CountDownLatch class ThirdTest { - DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/TradeExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/TradeExportBatch.groovy index cd6252fb6..94efbb6df 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/TradeExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/TradeExportBatch.groovy @@ -25,7 +25,7 @@ class TradeExportBatch extends BaseBatch{ def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); - DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") + DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") static def districtMap = [:] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CzBankStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CzBankStat.groovy index a7ba664d1..599ef8f1e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CzBankStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/CzBankStat.groovy @@ -30,7 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger class CzBankStat { public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("business", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("business", "average_statistics", "mongo.db.fangjia.com") def static final DBCollection CZLOG = MongoUtils.getCollectionByName("fangjia_log", "cz_log2", "192.168.0.136") static main(args) { def task = new CzBankStat(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DealPriceProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DealPriceProcess.groovy index 493c42d8c..c6ce91e86 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DealPriceProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DealPriceProcess.groovy @@ -16,7 +16,7 @@ import org.apache.commons.lang.StringUtils import java.util.regex.Pattern class DealPriceProcess { - final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") + final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") def total = 0 static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DistrictDetailBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DistrictDetailBatch.groovy index a38cf6268..8fccafde8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DistrictDetailBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/DistrictDetailBatch.groovy @@ -17,7 +17,7 @@ import java.util.concurrent.Executors class DistrictDetailBatch { - public static DBCollection DISTRICT_DETAIL_COLL = MongoUtils.getCollectionByName("fangjia_youfang", "district_detail", "192.168.0.43") + public static DBCollection DISTRICT_DETAIL_COLL = MongoUtils.getCollectionByName("fangjia_youfang", "district_detail", "mongo.db.fangjia.com") public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/EsHouseStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/EsHouseStat.groovy index da0c07889..9d7c97533 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/EsHouseStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/EsHouseStat.groovy @@ -40,7 +40,7 @@ class EsHouseStat { dataSource.setProperties(connectionProperties) } - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) public static void main(String[] args){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZDataExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZDataExport.groovy index 6c33b2553..423764526 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZDataExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZDataExport.groovy @@ -16,8 +16,8 @@ import java.sql.ResultSet class FZDataExport { - final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") public static EsDataSource dataSource = new EsDataSource() private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZHouseEvaluation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZHouseEvaluation.groovy index 11123e02b..6e5a99f52 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZHouseEvaluation.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FZHouseEvaluation.groovy @@ -8,7 +8,7 @@ import com.mongodb.DBCollection class FZHouseEvaluation { - public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", dbUrl) def regionMap = [:] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FjwUserStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FjwUserStat.groovy index 5f73a32b9..a941d08e9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FjwUserStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FjwUserStat.groovy @@ -8,7 +8,7 @@ import com.mongodb.DBCollection class FjwUserStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection USER_COLL = MongoUtils.getCollectionByName2("fangjia_coresite", "user", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/HouseLouDongMatchBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/HouseLouDongMatchBatch.groovy index 1ffbaa246..a337263f9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/HouseLouDongMatchBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/HouseLouDongMatchBatch.groovy @@ -18,7 +18,7 @@ import org.bson.Document; import org.bson.conversions.Bson; class HouseLouDongMatch { - public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", dbUrl) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LandDetailCrawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LandDetailCrawl.groovy index 29bd4df02..e153f90b6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LandDetailCrawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LandDetailCrawl.groovy @@ -22,7 +22,7 @@ class LandDetailCrawl { DBCollection LAND_COLL = MongoUtils.getCollectionByName("fangjia_crawl", "land_deal_price1", "192.168.0.235", 27018) - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017"; public static final DBCollection FJT_LAND_COLL = MongoUtils.getCollectionByName2("business", "land_distinct", lineUrl) public static final DBCollection OFF_FJT_LAND_COLL = MongoUtils.getCollectionByName2("business", "land_distinct", offlineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LogStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LogStat.groovy index 7c62d7229..b99f162e1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LogStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/LogStat.groovy @@ -14,10 +14,10 @@ import org.apache.lucene.queryparser.classic.QueryParser class LogStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def static final DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new LogStat() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/NoHouseDistrictStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/NoHouseDistrictStatBatch.groovy index 276235d1d..7f1f0b25b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/NoHouseDistrictStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/NoHouseDistrictStatBatch.groovy @@ -21,8 +21,8 @@ import java.util.concurrent.Executors @BatchOwner(Watcher.GaoJuan) class NoHouseDistrictStatBatch extends BaseBatch{ - public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; -// public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; +// public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_stat", dbUrl) public static final DBCollection AVERAGER_CONFIG_COLL = MongoUtils.getCollectionByName2("fangjia", "averager_config", dbUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/PingAnAddressLevalTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/PingAnAddressLevalTest.groovy index 77c705569..e0e481909 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/PingAnAddressLevalTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/PingAnAddressLevalTest.groovy @@ -13,7 +13,7 @@ class PingAnAddressLevalTest { String token = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"; - DBCollection DIST_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_grade", "192.168.0.43") + DBCollection DIST_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_grade", "mongo.db.fangjia.com") static main(args) { def task = new PingAnAddressLevalTest() task.run(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat.groovy index 30c9481ef..62ae568e5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat.groovy @@ -329,7 +329,7 @@ def findDistrictPrice(def city, def region){ q.put("region", region); } //districtStatConn.addOption(Bytes.QUERYOPTION_SLAVEOK); - final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@192.168.0.43:28017","fangjia_stat", "district_stat"); + final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017","fangjia_stat", "district_stat"); def count = districtStatConn.count(q) return count; } \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat1.groovy index 67e127805..eb85734e0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/QinLingStat1.groovy @@ -343,7 +343,7 @@ def findDistrictPrice(def city, def region){ q.put("region", region); } //districtStatConn.addOption(Bytes.QUERYOPTION_SLAVEOK); - final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@192.168.0.43:28017","fangjia_stat", "district_stat"); + final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017","fangjia_stat", "district_stat"); def count = districtStatConn.count(q) return count; } \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/RegionBlockSetting.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/RegionBlockSetting.groovy index 92b2a9409..937c82184 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/RegionBlockSetting.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/RegionBlockSetting.groovy @@ -6,7 +6,7 @@ import com.mongodb.DBCollection class RegionBlockSetting { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection REGION_BLOCK_COLL = MongoUtils.getCollectionByName2("fangjia", "region_block", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/SynchDistrictStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/SynchDistrictStatBatch.groovy index 1cd14588a..d0f6320d7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/SynchDistrictStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/SynchDistrictStatBatch.groovy @@ -17,8 +17,8 @@ import com.mongodb.DBObject class SynchDistrictStatBatch extends BaseBatch{ - //public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017) - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + //public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 28017) + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017"; public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_stat", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateThirdPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateThirdPrice.groovy index b9147952a..2b7e1049e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateThirdPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateThirdPrice.groovy @@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicLong class UpdateThirdPrice { - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def static final DBCollection AVERAGE_STATISTICS_OFFLINE = CrawalDBUtil.getAverage_statistics_col(); public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/apiLog/ApiUserCountAnalyBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/apiLog/ApiUserCountAnalyBatch.groovy index 16063d88b..4ca121052 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/apiLog/ApiUserCountAnalyBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/apiLog/ApiUserCountAnalyBatch.groovy @@ -14,7 +14,7 @@ import groovy.sql.Sql class ApiUserCountAnalyBatch extends BaseBatch{ static final dbFangjia = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?autoReconnect=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver"); - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection AUTHORITY_COLL = MongoUtils.getCollectionByName2("fangjia", "authority.api_user_authority", lineUrl) DBCollection VISIT_COLL = MongoUtils.getCollectionByName2("business", "api_visit_count", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/CcbCityPriceStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/CcbCityPriceStat.groovy index 19709dd22..7ea251213 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/CcbCityPriceStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/CcbCityPriceStat.groovy @@ -10,7 +10,7 @@ import com.mongodb.DBCollection class CcbCityPriceStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqin/PocTest2023.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqin/PocTest2023.groovy index 27ea14198..08e1d9fb5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqin/PocTest2023.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqin/PocTest2023.groovy @@ -20,7 +20,7 @@ import com.mongodb.DBCollection */ class PocTest2023 { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) public static final DBCollection DISTRICT_ANALY_DATA_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_analy_data", "mongo.db.fangjia.com") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DistrictSelectHouse.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DistrictSelectHouse.groovy index ddcfd51fc..d0e32b227 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DistrictSelectHouse.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/DistrictSelectHouse.groovy @@ -15,7 +15,7 @@ import org.apache.commons.lang.math.RandomUtils class DistrictSelectHouse { DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new DistrictSelectHouse(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/TestPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/TestPrice.groovy index e252654d5..952d0033a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/TestPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/chongqingblank/TestPrice.groovy @@ -9,8 +9,8 @@ import com.mongodb.QueryOperators class TestPrice { - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/city/CityStatExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/city/CityStatExport.groovy index 7ecf720df..26b2fa122 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/city/CityStatExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/city/CityStatExport.groovy @@ -17,7 +17,7 @@ import org.elasticsearch.index.query.QueryBuilders class CityStatExport { - final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") + final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") public static final def dbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_stat", dbUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/CityStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/CityStat.groovy index fad0c6bd1..0ddc8afec 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/CityStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/CityStat.groovy @@ -16,7 +16,7 @@ import java.util.concurrent.atomic.AtomicLong class CityStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_stat", lineUrl) public static final DBCollection BAD_CASE_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "bad_case", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/DataStatTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/DataStatTest.groovy index bd2f0760b..aadcddc6e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/DataStatTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/commStat/DataStatTest.groovy @@ -21,13 +21,13 @@ 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"; +def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com: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 AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") -DBCollection region_stat_coll = MongoUtils.getCollectionByName("fangjia", "region_stat", "192.168.0.43") +DBCollection region_stat_coll = MongoUtils.getCollectionByName("fangjia", "region_stat", "mongo.db.fangjia.com") DBCollection mca_administrative_division_coll = MongoUtils.getCollectionByName("crawl", "mca_administrative_division_2022", "192.168.0.206", 27020) //def citys = ["乌鲁木齐","昌吉","阿克苏","伊犁","喀什"] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/BestDistrictPriceExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/BestDistrictPriceExport.groovy index 607d63378..69fe7a5be 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/BestDistrictPriceExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/BestDistrictPriceExport.groovy @@ -11,7 +11,7 @@ import com.mongodb.QueryOperators class BestDistrictPriceExport { DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new BestDistrictPriceExport(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy index 01b7a0338..99b05841f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy @@ -5,10 +5,8 @@ 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 import java.util.regex.Pattern - /** * 名录集 */ @@ -34,6 +32,7 @@ class MinglujiData { def prov = "江苏省" def city = "无锡" exportDatas(city) +// exportDatas(city) // matchDev(prov, city) // matchCommunity(city) // fiveLevelSplit(city) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionStandardBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionStandardBatch.groovy index 9608aee85..e6a6feaa8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionStandardBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionStandardBatch.groovy @@ -4,9 +4,12 @@ import com.fangjia.core.RegionData import com.fangjia.script.BaseBatch import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.gj.xiamen.ElasticUtils89 +import com.fangjia.script.looplineinfo.InsidePolygon import com.fangjia.script.util.DbUtils +import com.fangjia.script.util.ExcelUtils import com.mongodb.BasicDBObject import org.apache.commons.io.FileUtils +import org.bson.types.ObjectId import org.elasticsearch.action.bulk.BulkRequest import org.elasticsearch.action.update.UpdateRequest import org.elasticsearch.client.RequestOptions @@ -33,10 +36,14 @@ class RegionStandardBatch extends BaseBatch{ void process(Object args) { seaweedRegionStandard() // poiRegionStandard() +// seaweedRegionStandard() +// poiRegionStandard() + //通过乡镇街道修改区域 如:东莞市 +// updateRegionByTown() } def seaweedRegionStandard(){ - seaweedRegionStandardByCat("district") + seaweedRegionStandardByCat("office") } def poiRegionStandard(){ @@ -93,7 +100,7 @@ class RegionStandardBatch extends BaseBatch{ def seaweedRegionStandardByCat(cat){ - def citys = CommonDatautils.findAllCity() + def citys = ["伊春"]//CommonDatautils.findAllCity() for(def city : citys){ def rMap = regionMap.get(city) @@ -148,8 +155,12 @@ class RegionStandardBatch extends BaseBatch{ def streetMap = CommonDatautils.queryAllStreetNameByCity(fullCityName) if(streetMap){ set = streetMap.keySet() - def districts = CommonDatautils.findAllDistricts(city, cat, ["city","region","name"]) + def districts = CommonDatautils.findAllDistricts(city, cat, ["city","region","name","lng","lat"]) + println city +" "+ districts.size() + def index = 0 for(def d : districts){ + index ++ + println index +" "+ d.region if(set.contains(d.region)){ continue } @@ -157,8 +168,12 @@ class RegionStandardBatch extends BaseBatch{ def updateRegion = null def flag = null for(def key : set){ - def alias = streetMap.get(key) - if((alias && alias.contains(d.region)) || (!alias && key.contains(d.region))){ + def obj = streetMap.get(key) + def alias = null + if(obj && obj.alias){ + alias = obj.alias + } + if((alias && alias.contains(d.region)) || (!alias && key==d.region)){ def newRegion = RegionData.formatRegion(d.city, key) if(newRegion!=d.region){ updateRegion = newRegion @@ -166,13 +181,26 @@ class RegionStandardBatch extends BaseBatch{ flag = "pass" break; } + + if(obj.shape){ + def inAreaFlag = InsidePolygon.isInArea(d.lng/10000000000.0, d.lat/10000000000.0, InsidePolygon.createPoint4(obj.shape.coordinates)) + if(inAreaFlag){ + def newRegion = obj.street + newRegion = RegionData.formatRegion(d.city, newRegion) + if(newRegion!=d.region){ + updateRegion = newRegion + } + flag = "pass" + break; + } + } } if(updateRegion){ def udata = new BasicDBObject() udata.put("region", updateRegion) udata.put("m_date", new Date()) println d.city +" "+d.region+" "+d.name +" 区域修改为:"+updateRegion -// DbUtils.seaweed.update(new BasicDBObject("_id", d._id), new BasicDBObject('$set', udata)) + DbUtils.seaweed.update(new BasicDBObject("_id", d._id), new BasicDBObject('$set', udata)) }else{ if(flag!="pass"){ def udata = new BasicDBObject() @@ -402,4 +430,27 @@ class RegionStandardBatch extends BaseBatch{ return rets; } + def updateRegionByTown(){ + ExcelUtils.modify("d:\\数据\\城市与区域相同写字楼.xlsx",{d-> + def town = RegionData.formatRegion(d['B'], d['F']) + if(town){ + + def obj = CommonDatautils.findDistrict(d['B'], town, d['E'], "office") + if(!obj){ + def udata = new BasicDBObject() + udata.put("region", town) + udata.put("m_date", new Date()) + println d['F']+" "+" 区域修改为:" + town + DbUtils.seaweed.update(new BasicDBObject("_id", new ObjectId(d['A'])), new BasicDBObject('$set', udata)) + }else{ + def udata = new BasicDBObject() + udata.put("m_date", new Date()) + udata.put("status", 1) + println d['F']+" "+" 删除:" + town + DbUtils.seaweed.update(new BasicDBObject("_id", new ObjectId(d['A'])), new BasicDBObject('$set', udata)) + } + + } + }) + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionUpdateBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionUpdateBatch.groovy index 6fce88fa6..748447212 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionUpdateBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/RegionUpdateBatch.groovy @@ -16,7 +16,7 @@ class RegionUpdateBatch { public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50) - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new RegionUpdateBatch() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TempExportData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TempExportData.groovy index b5f4ceb7f..c3d0bf761 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TempExportData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TempExportData.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.gj.data_handle +import com.fangjia.core.RegionData import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ExcelUtils @@ -219,34 +220,41 @@ class TempExportData { } def exportOfficeHouseCount(){ - ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\写字楼\\待核实写字楼.xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\数据\\高德写字楼-房源第三方验证.xlsx",{d-> // def obj = findYuanQu(d['B'], d['D']) // if(obj){ // d['T'] = "前瞻存在" // } // if(!d['T']){ -// def obj = findYuanQu(d['B'], d['D']) +// def city = RegionData.formatCity(d['C']) +// def obj = findYuanQu(city, d['E']) // if(obj){ +// d['T'] = "前瞻存在" // d['U'] = obj.name // } // } // if(!d['T']) { -// def count = findHouseCountByCat(d['B'], d['C'], d['D'], "office_sell") +// def city = RegionData.formatCity(d['C']) +// def region = RegionData.formatRegion(city, d['D']) +// +// def count = findHouseCountByCat(city, region, d['E'], "office_sell") // if (!count) { -// count = findHouseCountByCat(d['B'], d['C'], d['D'], "office_rent") +// count = findHouseCountByCat(city, region, d['E'], "office_rent") // } -// d['S'] = count +// d['T'] = count // } - if(!d['J']){ - def datas = CommonDatautils.findThirdNetWorkOffices(d['B'], d['C'], d['D']) + if(!d['T']){ + def city = RegionData.formatCity(d['C']) + def region = RegionData.formatRegion(city, d['D']) + def datas = CommonDatautils.findThirdNetWorkOffices(city, region, d['E']) if(datas){ def sources = [] for(def o : datas){ sources << o.source } if(sources){ - d['K'] = sources.join(",") + d['V'] = sources.join(",") } } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/Test.groovy index 3f08229ce..1d22f4cc3 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/Test.groovy @@ -1,58 +1,57 @@ package com.fangjia.script.gj.data_handle -import com.fangjia.script.commData.CommonDatautils -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 -import org.apache.commons.lang.math.RandomUtils - -def mongoDbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; -DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName2("fangjia", "region_stat", mongoDbUrl) - - -def city = "昌江" -ExcelUtils.modify("D:\\数据\\海南\\海南省城市均价.xlsx",{d-> - def date = d['B'] - def start = DateUtils.getFirstDayOfMonth(date) - def end = DateUtils.getLastDayOfMonth(date) - def weekends = DateUtils.getWeekendBetweenDates(start, end) - for(def weekend : weekends){ - def avg_price = d['I'] - def val = random(-200,200) - def new_price = (int)(avg_price*val/10000 + avg_price) - def last_weekend = DateUtils.add(DateUtils.formatDateByPattern(weekend, "yyyy-MM-dd"), -7) - def last_price = CommonDatautils.queryCityPriceByWeekend(city, last_weekend) - - def o = new BasicDBObject() - o.put("avg_price", new_price) - o.put("c_date" , new Date()) - o.put("city", city) - o.put("m_date" , new Date()) - o.put("weekend", weekend) - o.put("cat","城市") - o.put("moving_average" , (int)avg_price) - if(!last_price){ - o.put("weekend_markup" , 0) - }else{ - def weekend_markup = (int)((new_price-last_price)*100/last_price) - o.put("weekend_markup" , weekend_markup) - } - - def q = new BasicDBObject("cat", "城市").append("city", city).append("weekend", weekend) - REGION_STAT_COLL.update(q, new BasicDBObject('$set', o),true, false) - } -},1) - - -public static final int random(int i1, int i2) { - int max = Math.max(i1, i2); - int min = Math.min(i1, i2); - return min + RandomUtils.nextInt(max - min + 1); -} - - +import org.bson.types.ObjectId +ObjectId objectId = new ObjectId("659c9ae92ae7732fd7d54e40"); +Date creationDate = objectId.getDate(); +System.out.println(creationDate); +//def mongoDbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; +//DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName2("fangjia", "region_stat", mongoDbUrl) +// +// +//def city = "昌江" +//ExcelUtils.modify("D:\\数据\\海南\\海南省城市均价.xlsx",{d-> +// def date = d['B'] +// def start = DateUtils.getFirstDayOfMonth(date) +// def end = DateUtils.getLastDayOfMonth(date) +// def weekends = DateUtils.getWeekendBetweenDates(start, end) +// for(def weekend : weekends){ +// def avg_price = d['I'] +// def val = random(-200,200) +// def new_price = (int)(avg_price*val/10000 + avg_price) +// def last_weekend = DateUtils.add(DateUtils.formatDateByPattern(weekend, "yyyy-MM-dd"), -7) +// def last_price = CommonDatautils.queryCityPriceByWeekend(city, last_weekend) +// +// def o = new BasicDBObject() +// o.put("avg_price", new_price) +// o.put("c_date" , new Date()) +// o.put("city", city) +// o.put("m_date" , new Date()) +// o.put("weekend", weekend) +// o.put("cat","城市") +// o.put("moving_average" , (int)avg_price) +// if(!last_price){ +// o.put("weekend_markup" , 0) +// }else{ +// def weekend_markup = (int)((new_price-last_price)*100/last_price) +// o.put("weekend_markup" , weekend_markup) +// } +// +// def q = new BasicDBObject("cat", "城市").append("city", city).append("weekend", weekend) +// REGION_STAT_COLL.update(q, new BasicDBObject('$set', o),true, false) +// } +//},1) +// +// +//public static final int random(int i1, int i2) { +// int max = Math.max(i1, i2); +// int min = Math.min(i1, i2); +// return min + RandomUtils.nextInt(max - min + 1); +//} +// +// +// +// +// diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownMiddleProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownMiddleProcess.groovy index f799e6651..31105176e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownMiddleProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownMiddleProcess.groovy @@ -3,23 +3,22 @@ package com.fangjia.script.gj.data_handle import com.fangjia.core.RegionData import com.fangjia.core.util.BaiDuApiUtils import com.fangjia.core.util.GeocodeUtils +import com.fangjia.core.util.HttpRequest import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.util.BaiduMapUtils -import com.fangjia.script.util.DataUtil import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.ProvinceData import com.mongodb.AggregationOutput import com.mongodb.BasicDBObject +import com.mongodb.Bytes import com.mongodb.DBCollection import com.mongodb.DBObject -import com.mongodb.client.AggregateIterable -import org.bson.Document +import net.sf.json.JSONObject import org.bson.types.ObjectId import java.util.regex.Pattern - /** * 乡镇街道中间表 * 包含市,区,乡镇街道别名,来源 统计局community表 @@ -45,6 +44,8 @@ class TownMiddleProcess { DBCollection DEVELOPMENT_ZONE_43_COLL = MongoUtils.getCollectionByName("fangjia_base", "development_zone", "mongo.db.fangjia.com") + static DBCollection POLYLINECOLL2025 = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "region_polyline_2025") + def fullCityMap = CommonDatautils.queryFullNameCity() static main(args) { @@ -96,6 +97,12 @@ class TownMiddleProcess { // checkCenterInTownRang()//检测乡镇街道中心点是否在围栏中 // addSpecialCityTownAlias() + + +// updateNewRegionPoyline()//更新新的区域围栏 + + updateMappingPolyline() + } @@ -681,7 +688,7 @@ class TownMiddleProcess { } def regionPolyline(){ - def dbcursor = REGIONPOLYLINE_COLL.find(new BasicDBObject("level","district")) + def dbcursor = POLYLINECOLL2025.find(new BasicDBObject("level","district")) def map = [:] for(def d : dbcursor){ def resultMap = [:] @@ -1356,4 +1363,90 @@ class TownMiddleProcess { keys.put("street", 1) return ADMINISTRATIVE_MAPPING_COLL.find(q, keys).toList() } + + def updateNewRegionPoyline(){ + + def regionPolylineMap = regionPolyline() + def q = new BasicDBObject() + q.put("type","区域") +// q.put("city", "苏州市") + def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q).setOptions(Bytes.QUERYOPTION_NOTIMEOUT) + for(def d : dbcursor){ + def shapeData = regionPolylineMap.get(d.city+"|@|"+d.district) + println d.city+" "+d.district + if(shapeData){ + println "新围栏数:"+shapeData.shape.coordinates.size() + } + + if(d.shape){ + println "旧围栏数:"+d.shape.coordinates.size() + } + + if(d.shape && shapeData && shapeData.shape!=d.shape){ + def udata = new BasicDBObject() + udata.shape = shapeData.shape + udata.location = shapeData.location + udata.m_date = new Date() + ADMINISTRATIVE_MAPPING_COLL.update(new BasicDBObject("_id",d._id), new BasicDBObject('$set',udata)) +// if(shapeData && d.shape && shapeData.shape.type=="polygon" && d.shape.type=="polygon"){ +// double area = com.fangjia.script.util.GeoHelper.calculateArea(shapeData.shape.coordinates[0]) +// double area1 = com.fangjia.script.util.GeoHelper.calculateArea(d.shape.coordinates[0]) +// if(Math.abs(area1-area)>=1){ +// println "新:"+area +// println "旧:"+area1 +// def udata = new BasicDBObject() +// udata.shape = shapeData.shape +// udata.location = shapeData.location +// //DMINISTRATIVE_MAPPING_COLL.update(new BasicDBObject("_id",d._id), new BasicDBObject('$set',udata)) +// } +// } + } + } + } + + def updateMappingPolyline(){ + def q = new BasicDBObject() + q.put("type","区域") + q.put("shape.type","polygon") + def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q) + for(def d : dbcursor){ + updateAdministrativeMapping(d._id.toString(), d.shape) + } + } + + + def updateAdministrativeMapping(def id, def shape){ + def header = [:] + header["Authorization"] = "Basic ${Base64.getEncoder().encodeToString("elastic:elasticsearch".getBytes("UTF-8"))}".toString() + String seawaterUrl = "http://192.168.0.89:9200/administrative_mapping/_update_by_query?conflicts=proceed&scroll_size=1000&wait_for_completion=false" + def body = """ + { + "script": { + "source": "ctx._source.shape = params.newshape", + "params":{ + "newshape":{ + "type":"${shape.type}", + "coordinates":${shape.coordinates} + } + } + }, + "query": { + "term": { + "_id": "${id}" + } + } + } + """ + HttpRequest request = new HttpRequest() + try{ + String res = request.postWithBody(seawaterUrl, JSONObject.fromObject(body.toString()), header, "UTF-8") + def response = JSONObject.fromObject(res) + println(response) + }catch(Exception e){ + println "error : "+e.getMessage() + } + + } + + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy index 0d458ec18..3797a3924 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/TownStandardBatch.groovy @@ -31,7 +31,6 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.concurrent.atomic.AtomicLong - /** * 区域标准化 * 1.小区库乡镇街道标准化,包含小区,商铺,写字楼 @@ -629,7 +628,7 @@ class TownStandardBatch extends BaseBatch{ // //通过调取地图api接口获取乡镇街道 // if(!saveObj.township){ -// def gaodeMap = BaiduMapUtils.geocoding(location.lat+","+location.lon) + def gaodeMap = BaiduMapUtils.geocoding(location.lat+","+location.lon) // if(gaodeMap && gaodeMap.addressComponent) { // def addressComponent = gaodeMap.addressComponent // if(addressComponent){ 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 b69e526a4..fd1066677 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 @@ -1,16 +1,9 @@ package com.fangjia.script.gj.district import com.fangjia.core.util.HttpRequest -import com.fangjia.script.addrepo.InvokeHttpRequest -import com.fangjia.script.statistics.poi.AmapPoi -import com.fangjia.script.temp.shenjian.util.GaoDeUtils import com.fangjia.script.temp.shenjian.util.HttpUtils -import com.fangjia.script.util.HttpRequestUtil -import com.mongodb.DBObject import net.sf.json.JSONArray import net.sf.json.JSONObject -import org.apache.commons.collections.CollectionUtils -import org.apache.commons.lang.StringUtils class FangjiaClientUtils { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/PricePkTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/PricePkTest.groovy index 975d618ee..beabc5fd2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/PricePkTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/PricePkTest.groovy @@ -9,7 +9,7 @@ import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection -def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; +def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def city = "常州" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/EsMonthHouseStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/EsMonthHouseStat.groovy index 1b4bd8a80..d5d3956e6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/EsMonthHouseStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/EsMonthHouseStat.groovy @@ -14,7 +14,7 @@ import org.apache.lucene.queryparser.classic.QueryParser class EsMonthHouseStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy index 59b61a9e5..f37ffa535 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy @@ -38,7 +38,7 @@ class FjwBigdataDealBatch extends BaseBatch{ DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy index 892ebfea5..c5f33716f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy @@ -29,7 +29,7 @@ class FjwThirdPartyPriceBatch extends BaseBatch { def endDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); //202304 // 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") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") def sourceMap = ["诸葛找房":"01", "安居客":"02","房天下":"03","链家":"04","城市家居":"05","麦田":"06","贝壳":"07", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/guangfa/GuangfaBlankSelectDistrict.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/guangfa/GuangfaBlankSelectDistrict.groovy index 7a00efd46..da8902cab 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/guangfa/GuangfaBlankSelectDistrict.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/guangfa/GuangfaBlankSelectDistrict.groovy @@ -27,7 +27,7 @@ class GuangfaBlankSelectDistrict { public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017"; public static final DBCollection youda_esfhouse_coll = MongoUtils.getCollectionByName2("business", "res_esfdealprice", offlineUrl) - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new GuangfaBlankSelectDistrict(); 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 2003db863..62474f6c5 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 @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong public class BeiKeCrawlByChrome { def DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -1, "yyyy-MM") WebDriver driver = null; @@ -118,7 +118,7 @@ public class BeiKeCrawlByChrome { } def crawlData(driver, citys){ - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def runedCitys = FileUtils.readTxt("d:\\数据\\成交抓取\\贝壳已抓城市.txt") 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 a458ccd56..b994d31e6 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,7 +15,7 @@ import java.util.regex.Pattern class ExportPaimai { - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) static main(args) { 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 ec1ad4acd..1730f28b7 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 @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong public class LianjiaCrawlByChrome { def DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -1, "yyyy-MM") WebDriver driver = null; @@ -189,7 +189,7 @@ public class LianjiaCrawlByChrome { } def crawlData(driver, cityList){ - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) def runedCitys = FileUtils.readTxt("d:\\数据\\成交抓取\\链家已抓城市.txt") 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 cf4bed800..f457e323e 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 @@ -28,7 +28,7 @@ class PaimaiDataSend { DBCollection jd_coll = MongoUtils.getCollectionByName("fangjia_crawl", "fapai_jd_detail", "192.168.0.235", 27018) DBCollection rmfysszc_coll = MongoUtils.getCollectionByName("fangjia_crawl", "fapai_rmfysszc_detail", "192.168.0.235", 27018) - def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) 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 52add2e69..36ee62699 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 @@ -26,7 +26,7 @@ class PaimaiTest { DBCollection paimaiResultColl = MongoUtils.getCollectionByAuth20190102("fangjia", "pai_mai") - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy index 2e27e41cc..9eaa268fc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy @@ -30,7 +30,7 @@ class AddPriceTest { def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified", "postgres", "Goojia123456", "org.postgresql.Driver") - static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") public static final DBCollection confirm_price_date = MongoUtils.getCollectionByName("fangjia", "confirm_price_data", "mongo.db.fangjia.com") static main(args) { @@ -230,6 +230,8 @@ class AddPriceTest { if(newPriceMap){ d['G'] = newPriceMap.avg_price d['H'] = newPriceMap.month + d['H'] = map.calc_type +// d['AM'] = map.credit_value } } }) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ExportToDealPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ExportToDealPrice.groovy index d4440f329..4633e64b4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ExportToDealPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ExportToDealPrice.groovy @@ -13,8 +13,8 @@ import java.util.concurrent.atomic.AtomicInteger class ExportToDealPrice { - DBCollection DEAL_PRICE_MATCH_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price_match", "192.168.0.43") - DBCollection DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") + DBCollection DEAL_PRICE_MATCH_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price_match", "mongo.db.fangjia.com") + DBCollection DISTRICT_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") DBCollection TRADE_MATCH_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "trade_match_price", "192.168.0.136") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/FzBlankTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/FzBlankTest.groovy index 976e008ba..5a8f83a8f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/FzBlankTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/FzBlankTest.groovy @@ -14,7 +14,7 @@ import java.util.regex.Pattern class FzBlankTest { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection FZ_ADDR_COLL = MongoUtils.getCollectionByName2("business", "fz_district_address", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JiangShuBlankDataStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JiangShuBlankDataStat.groovy index 838fcbd20..63543c6b5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JiangShuBlankDataStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/JiangShuBlankDataStat.groovy @@ -20,7 +20,7 @@ import java.util.regex.Pattern class JiangShuBlankDataStat { - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new JiangShuBlankDataStat() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/TestArroundPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/TestArroundPrice.groovy index d7b18e371..531870d89 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/TestArroundPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/TestArroundPrice.groovy @@ -12,7 +12,7 @@ import com.mongodb.DBCollection class TestArroundPrice { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection DIST_DATA_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_analy_data", lineUrl) public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017"; diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/township/StreetProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/township/StreetProcess.groovy index 967fa21ce..d7e5fe6fe 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/township/StreetProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/township/StreetProcess.groovy @@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicLong class StreetProcess { - final DBCollection TOWNSHIP = MongoUtils.getCollectionByName("fangjia", "township", "192.168.0.43") + final DBCollection TOWNSHIP = MongoUtils.getCollectionByName("fangjia", "township", "mongo.db.fangjia.com") public static final def MONGODB_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; public static final DBCollection TOWNSHIP100 = MongoUtils.getCollectionByName2("fangjia", "township", MONGODB_URL) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/NetworkDistanceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/NetworkDistanceBatch.groovy index bf848d990..627c30884 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/NetworkDistanceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/NetworkDistanceBatch.groovy @@ -27,9 +27,9 @@ class NetworkDistanceBatch extends BaseBatch{ public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) - final DBCollection NETWORK_COLL = MongoUtils.getCollectionByName("business", "xm_network", "192.168.0.43") + final DBCollection NETWORK_COLL = MongoUtils.getCollectionByName("business", "xm_network", "mongo.db.fangjia.com") - final DBCollection MAP_NETWORK_COLL = MongoUtils.getCollectionByName("business", "xm_network_map", "192.168.0.43") + final DBCollection MAP_NETWORK_COLL = MongoUtils.getCollectionByName("business", "xm_network_map", "mongo.db.fangjia.com") static main(args) { runBatch(new NetworkDistanceBatch(), args) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/grade/ConsumptionRatingBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/grade/ConsumptionRatingBatch.groovy index 4dc7c2384..43fd17c7d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/grade/ConsumptionRatingBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/grade/ConsumptionRatingBatch.groovy @@ -20,10 +20,10 @@ import java.util.regex.Pattern class ConsumptionRatingBatch extends BaseBatch { def weekend = DateUtil.truncateDay(DateUtil.getFirstDayOfWeek(new Date())) public static - final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") + final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") public static - final DBCollection CONSUMPTION_GRADE_COLL = MongoUtils.getCollectionByName("fangjia_stat", "consumption_grade", "192.168.0.85") + final DBCollection CONSUMPTION_GRADE_COLL = MongoUtils.getCollectionByName("fangjia_stat", "consumption_grade", "mongo.db.fangjia.com") final DBCollection AMAP_POI_New_COLL = MongoUtils.getCollectionByName("m_dianping", "dianping_9", "114.80.150.196", 27777) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/aliyun/AliyunSmsClient.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/aliyun/AliyunSmsClient.groovy index 05435c508..ededaa1db 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/aliyun/AliyunSmsClient.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/aliyun/AliyunSmsClient.groovy @@ -52,7 +52,7 @@ class AliyunSmsClient { } public static void main(String[] args) { - sendSms("13916076378", "SMS_135220034", '{"code":12345}') + sendSms("15021384995", "SMS_482915107", '{"code":12345}') } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jusfoun/HousingTransactionExportBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jusfoun/HousingTransactionExportBatch.groovy index 586237d04..e99c9b8c4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jusfoun/HousingTransactionExportBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jusfoun/HousingTransactionExportBatch.groovy @@ -30,7 +30,7 @@ import java.sql.SQLException class HousingTransactionExportBatch extends BaseBatch { - final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") + final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") static DBCollection _db_esf_transaction = MongoUtils.getCollectionByName("vip_site", "esf_transaction", "192.168.0.235", 27018); static MongoCollection PAI_MAI = Mongo3Utils.getDbCollection(Constants.FANGJIA_MONGO_URI, "fangjia_crawl", "pai_mai") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/loudong/CqfdcMatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/loudong/CqfdcMatch.groovy index 2a231a42c..22f0a1f93 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/loudong/CqfdcMatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/loudong/CqfdcMatch.groovy @@ -23,7 +23,7 @@ import java.util.regex.Pattern class CqfdcMatch { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection HOUSE_LOUDONG_COLL = MongoUtils.getCollectionByName2("fangjia", "house_loudong", lineUrl) static DBCollection loudongFdcConn = MongoUtils.getCollectionByName("fangjia_crawl", "loudong_cqfdc", "192.168.0.235", 27018) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/GaodePOI2Baidu.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/GaodePOI2Baidu.groovy index 9bd28e7fd..e557d8799 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/GaodePOI2Baidu.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/GaodePOI2Baidu.groovy @@ -53,8 +53,8 @@ def pcmap = [:] provinceList.remove("广西省") provinceList.add("广西壮族自治区") -DSCollection seabird = new DataStore("192.168.0.43", 28017).getCollection("fangjia_base.baidu_place_poi2") -DBCollection m43 = MongoUtils.getCollectionByName("fangjia_base", "baidu_place_poi2", "192.168.0.43", 28017) +DSCollection seabird = new DataStore("mongo.db.fangjia.com", 28017).getCollection("fangjia_base.baidu_place_poi2") +DBCollection m43 = MongoUtils.getCollectionByName("fangjia_base", "baidu_place_poi2", "mongo.db.fangjia.com", 28017) //def type3Not = ["学校内部设施", "进港", "出港", "候船室", "住宿服务相关"] // //def type2Not = ["学校", "专科医院", "综合医院", "诊所", "银行", "自动提款机", "便民商店/便利店", "家电电子卖场", "超级市场", "商场", "美容美发店", "地铁站", "港口码头", "住宿服务"] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy index f5c0a94c6..5bfa86aee 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/CommunityHouseSampleBatch.groovy @@ -16,9 +16,9 @@ import com.mongodb.DBCollection //@BatchOwner(Watcher.MaJinTao) class CommunityHouseSampleBatch extends BaseBatch { - DBCollection SEAWEED = MongoUtils.getCollectionByName("fangjia", "seaweed", "192.168.0.43", 28017) - DBCollection STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017) - DBCollection HOUSE_CASE = MongoUtils.getCollectionByName("business", "house_case", "192.168.0.43", 28017) + DBCollection SEAWEED = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com", 28017) + DBCollection STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 28017) + DBCollection HOUSE_CASE = MongoUtils.getCollectionByName("business", "house_case", "mongo.db.fangjia.com", 28017) DSCollection SEABIRD = new DataStore("seabird.db.fangjia.com").getCollection("fangjia.seabird") static void main(String[] args) { @@ -160,13 +160,13 @@ import com.mongodb.DBCollection @BatchOwner(Watcher.MaJinTao) class CommunityHouseSampleBatch extends BaseBatch { - DBCollection SEAWEED = MongoUtils.getCollectionByName("fangjia", "seaweed", "192.168.0.43", 28017) + DBCollection SEAWEED = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com", 28017) - DBCollection STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017) + DBCollection STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 28017) - DBCollection HOUSE_CASE = MongoUtils.getCollectionByName("business", "house_case", "192.168.0.43", 28017) + DBCollection HOUSE_CASE = MongoUtils.getCollectionByName("business", "house_case", "mongo.db.fangjia.com", 28017) -// DBCollection SEABIRD = MongoUtils.getCollectionByName("fangjia", "seabird", "192.168.0.43", 28017) +// DBCollection SEABIRD = MongoUtils.getCollectionByName("fangjia", "seabird", "1mongo.db.fangjia.com", 28017) DSCollection SEABIRD = new DataStore("seabird.db.fangjia.com").getCollection("fangjia.seabird") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/DistrictStatClickhouseSyncBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/DistrictStatClickhouseSyncBatch.groovy index 5ba702a2e..cb11ad4c7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/DistrictStatClickhouseSyncBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/sync/DistrictStatClickhouseSyncBatch.groovy @@ -16,7 +16,7 @@ import java.sql.Statement @BatchOwner(Watcher.WangWenYan) class DistrictStatClickhouseSyncBatch extends BaseBatch{ - DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 27017) + DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 27017) static void main(String[] args) { runBatch(new DistrictStatClickhouseSyncBatch(), args) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/DealPriceDetailExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/DealPriceDetailExport.groovy index 9f532247a..63cf10b20 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/DealPriceDetailExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/DealPriceDetailExport.groovy @@ -19,9 +19,9 @@ import java.util.concurrent.* class DealPriceDetailExport { // 小区均价集合 - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 28017) // 小区成交集合 - static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43", 28017) + static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com", 28017) static final Map retMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(10) static ExecutorService districtExecutorService = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15Export.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15Export.groovy index fb9b88402..2e0d4181a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15Export.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15Export.groovy @@ -23,9 +23,9 @@ import java.util.concurrent.atomic.AtomicInteger class PPE15Export { // 小区均价集合 - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43",28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com",28017) // 小区成交集合 - static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43",28017) + static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com",28017) static Map retMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(30) static ExecutorService districtExecutorService = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15ExportTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15ExportTest.groovy index 40a866be1..41d8a59b2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15ExportTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/PPE15ExportTest.groovy @@ -23,9 +23,9 @@ import java.util.concurrent.atomic.AtomicInteger class PPE15ExportTest { // 小区均价集合 - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43",28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com",28017) // 小区成交集合 - static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43",28017) + static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com",28017) static Map retMap = new ConcurrentHashMap() static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/RentExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/RentExport.groovy index dbcf2139f..00b5638de 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/RentExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/RentExport.groovy @@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger */ class RentExport { - static DBCollection collection = MongoUtils.getCollectionByName("fangjia", "district_stat_rent", "192.168.0.43",28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia", "district_stat_rent", "mongo.db.fangjia.com",28017) static ExecutorService executorService = Executors.newFixedThreadPool(30) static Map retMap = new ConcurrentHashMap() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/TotalTestExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/TotalTestExport.groovy index b0e7a120e..316e602cf 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/TotalTestExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/TotalTestExport.groovy @@ -20,9 +20,9 @@ import java.util.concurrent.CountDownLatch class TotalTestExport { // 小区均价集合 - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43",28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com",28017) // 小区成交集合 - static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43",28017) + static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com",28017) static Map retMap = new ConcurrentHashMap() // 在此更改时间 static final def TRADE_DATE_START = "2020-03-28" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/ValueRateCityInfoExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/ValueRateCityInfoExport.groovy index 82f000f52..c39dbc23d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/ValueRateCityInfoExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/ValueRateCityInfoExport.groovy @@ -20,9 +20,9 @@ import java.util.concurrent.CountDownLatch class ValueRateCityInfoExport { // 小区均价集合 - static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43",28017) + static DBCollection collection = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com",28017) // 小区成交集合 - static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43",28017) + static DBCollection fangjiaConn = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com",28017) static Map retMap = new ConcurrentHashMap() // 在此更改时间 static final def TRADE_DATE_START = "2020-03-28" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/business/BusinessDianpingExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/business/BusinessDianpingExport.groovy index 3f03c1c01..76d9104bd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/business/BusinessDianpingExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/business/BusinessDianpingExport.groovy @@ -16,7 +16,7 @@ import org.apache.commons.lang3.StringUtils class BusinessDianpingExport { static DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "business", "192.168.0.235", 27018) - static DBCollection cityCollection = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017) + static DBCollection cityCollection = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "mongo.db.fangjia.com", 28017) static void main(String[] args) { def cityCodes = ["320500","610100","340100"]; diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy index 3bffc1300..be6b759e2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy @@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger */ class AroundExportByNewWay { - static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static def resultMap = new ConcurrentHashMap() static def unMatchedMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundFormatExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundFormatExport.groovy index 89b1c7b3c..2e5f11e3e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundFormatExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundFormatExport.groovy @@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger */ class AroundFormatExport { - static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static def resultMap = new ConcurrentHashMap() static def unMatchedMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(30) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/ImportSchool.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/ImportSchool.groovy index b8f0452ee..242dd4c63 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/ImportSchool.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/ImportSchool.groovy @@ -14,7 +14,7 @@ import com.mongodb.DBObject */ class ImportSchool { - static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static void main(String[] args) { List> data = ExcelUtils.read("F:\\数据\\重庆农商行\\重庆学校_0902.xlsx", 1) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy index 9ce164947..4c4cfcffc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy @@ -16,7 +16,7 @@ import sun.swing.BakedArrayList */ class MarkUnNeedExport { - static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static void main(String[] args) { List> data = ExcelUtils.read("F:\\数据\\重庆农商行\\周边补充.xlsx", 1) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MoveArroundTemp.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MoveArroundTemp.groovy index c641a4fc8..cceebeef6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MoveArroundTemp.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MoveArroundTemp.groovy @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger class MoveArroundTemp { static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018) - static DBCollection conn43 = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection conn43 = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static ExecutorService executorService = Executors.newFixedThreadPool(30) static void main(String[] args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy index 1c907e236..02fda673e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy @@ -16,7 +16,7 @@ import java.util.regex.Pattern */ class POIRule { - static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) static void main(String[] args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SavePoi.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SavePoi.groovy index 40c42f36a..496be8386 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SavePoi.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SavePoi.groovy @@ -18,7 +18,7 @@ import java.util.concurrent.atomic.AtomicInteger class SavePoi { static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018) - static DBCollection conn43 = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + static DBCollection conn43 = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "mongo.db.fangjia.com", 28017) //3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息 static def types = "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|0601|141200|141201|141202|141203|141204" static def radius = 3000 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy index 9817c00cb..854052b17 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy @@ -27,9 +27,9 @@ import java.util.concurrent.Executors */ class SeaweedExport { - static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017) + static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "mongo.db.fangjia.com", 28017) static ExecutorService executorService = Executors.newFixedThreadPool(30) - static final DBCollection seaweed = MongoUtils.getCollectionByName("fangjia", "seaweed", "192.168.0.43", 28017) + static final DBCollection seaweed = MongoUtils.getCollectionByName("fangjia", "seaweed", "mongo.db.fangjia.com", 28017) static def map = new ConcurrentHashMap() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/crawl/58/Seed58.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/crawl/58/Seed58.groovy index 79bf00e9a..0dab33e51 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/crawl/58/Seed58.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/crawl/58/Seed58.groovy @@ -15,7 +15,7 @@ import com.mongodb.DBObject class Seaweed58 { static DBCollection districtSeedsConn = MongoUtils.getCollectionByName("seeddb", "district_seeds", "192.168.0.235", 27018) - static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017) + static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "mongo.db.fangjia.com", 28017) static void main(String[] args) { List list = cityMapConn.distinct("fangjia_city") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeGeoHash.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeGeoHash.groovy index 53b0679f0..60e5e17ce 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeGeoHash.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeGeoHash.groovy @@ -18,7 +18,7 @@ import java.util.concurrent.Executors */ class CommitteeGeoHash { - static DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "192.168.0.43", 28017) + static DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "mongo.db.fangjia.com", 28017) static ExecutorService executorService = Executors.newFixedThreadPool(30) static void main(String[] args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy index db1f5a13d..d83e43625 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy @@ -20,7 +20,7 @@ import java.util.concurrent.Executors */ class CommitteeLatLng { - static DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "192.168.0.43", 28017) + static DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "mongo.db.fangjia.com", 28017) static ExecutorService executorService = Executors.newFixedThreadPool(10) static void main(String[] args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetCodeFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetCodeFromExcel.groovy index f466ed3be..b190fbd0b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetCodeFromExcel.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetCodeFromExcel.groovy @@ -9,7 +9,7 @@ import com.mongodb.DBObject import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang.StringUtils -final DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "192.168.0.43", 28017) +final DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "mongo.db.fangjia.com", 28017) /** * 获取省市区编码 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetTownshipFromExcel.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetTownshipFromExcel.groovy index c8481a44a..4a12ce369 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetTownshipFromExcel.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetTownshipFromExcel.groovy @@ -9,7 +9,7 @@ import com.mongodb.DBObject import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang.StringUtils -final DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "192.168.0.43", 28017) +final DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "mongo.db.fangjia.com", 28017) /** * 获取国家标准居委街道 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/CityUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/CityUtils.groovy index 2949d3803..c73026057 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/CityUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/CityUtils.groovy @@ -9,7 +9,7 @@ import com.mongodb.DBCollection */ class CityUtils { - static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017) + static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "mongo.db.fangjia.com", 28017) static listCitySet() { List list = cityMapConn.distinct("fangjia_city") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy index c17285a78..d843c3034 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy @@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentHashMap */ class SeaweedUtils { - static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017) + static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "mongo.db.fangjia.com", 28017) static def map = new ConcurrentHashMap() static getRegionByCode(def district_code) { 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 42972bc05..b0bde2dcf 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 @@ -15,7 +15,7 @@ import org.apache.commons.codec.binary.Base64; class DataStat { def static final thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") static main(args) { def task = new DataStat(); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestDistrict.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestDistrict.groovy index aa6e24350..195136215 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestDistrict.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestDistrict.groovy @@ -12,7 +12,7 @@ import java.util.regex.Pattern class Test { - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")//192.168.0.85 + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com")//192.168.0.85 def static final fieldMap = [ "房估估":"fanggugu_esf","诸葛找房":"zhugezhaofang_esf","安居客":"anjuke_esf","搜房":"soufang_esf","中原地产":"zhongyuan_esf","赶集":"ganji_esf", "链家":"lianjia_esf","兔博士":"tuboshi_esf","城市房产":"cityhouse_esf","贝壳找房":"beike_esf","Q房":"qfang_esf","Q房(新)":"qfang_new","中原地产(新)":"zhongyuan_new", 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 d1fb7dc6f..f903f3172 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 @@ -27,7 +27,7 @@ class ThirdDataToGatherBatch extends BaseBatch{ def static final DBCollection AVERAGE_STATISTICS_OFFLINE = CrawalDBUtil.getAverage_statistics_col(); //MongoUtils.getMongoDBByAuth().getCollection("average_statistics") // def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com",38888) - def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")//192.168.0.85 + def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com")//192.168.0.85 def static final fieldMap = [ "房估估":"fanggugu_esf","诸葛找房":"zhugezhaofang_esf","安居客":"anjuke_esf","搜房":"soufang_esf","中原地产":"zhongyuan_esf","赶集":"ganji_esf", "链家":"lianjia_esf","兔博士":"tuboshi_esf","城市房产":"cityhouse_esf","贝壳找房":"beike_esf","Q房":"qfang_esf","Q房(新)":"qfang_new","中原地产(新)":"zhongyuan_new", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/TradeDealPriceStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/TradeDealPriceStat.groovy index 67858c081..e2e874695 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/TradeDealPriceStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/TradeDealPriceStat.groovy @@ -12,7 +12,7 @@ import java.sql.ResultSet class TradeDealPriceStat { - DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") + DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") static def districtMap = [:] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/CosineSimilarAlgorithm.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/CosineSimilarAlgorithm.groovy index 3f12f1b79..300c1ea6b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/CosineSimilarAlgorithm.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/CosineSimilarAlgorithm.groovy @@ -1,12 +1,28 @@ package com.fangjia.script.util +import com.hankcs.hanlp.restful.HanLPClient +import org.apache.commons.text.similarity.* +import org.apache.commons.text.similarity.JaroWinklerSimilarity + class CosineSimilarAlgorithm { + public static void main(String[] args){ - println CosineSimilarAlgorithm.getSimilarity("兰坪路301弄","兰坪路301弄12支弄,兰坪路301弄22支"); - println CosineSimilarAlgorithm.getSimilarity("兰坪路301弄12支弄,兰坪路301弄22支","兰坪路301弄"); - println CosineSimilarAlgorithm.getSimilarityRatio("江川路291号","江川路291弄") - println CosineSimilarAlgorithm.getSimilarityRatio("江川路291号","江川路290号"); + + def address1 = "市建四公司宿舍" + def address2 = "市建四公司小区" + + println "余弦相似:"+CosineSimilarAlgorithm.getSimilarity(address1, address2);//余弦相似 + println "编辑距离:"+CosineSimilarAlgorithm.levenshteinSimilarity(address1, address2);//编辑距离 + println "Jaro-Winkler 相似度:"+CosineSimilarAlgorithm.jaroWinklerSimilarity(address1, address2)//Jaro-Winkler 相似度 + println "综合相似:"+CosineSimilarAlgorithm.calculateSimilarity(address1, address2);//综合相似 + println "jaccard:"+CosineSimilarAlgorithm.jaccardSimilarity(address1, address2); + println "jaccard:"+CosineSimilarAlgorithm.jaccardSimilarity2(address1, address2); + +// def customTokenizer = { text -> text.split(" ").toSet() } +// +// def score2 = jaccardSimilarity(address1, address2, customTokenizer) +// println "按词语分割的Jaccard相似度: ${(score2 * 100).round(2)}%" } @@ -160,7 +176,73 @@ class CosineSimilarAlgorithm { public static float getSimilarityRatio(String str, String target) { return 1 - (float)compare(str, target)/Math.max(str.length(), target.length()); } - - + // 计算 Levenshtein 相似度 (基于编辑距离) + static def levenshteinSimilarity(String s1, String s2) { + def maxLength = Math.max(s1.size(), s2.size()) + if (maxLength == 0) return 1.0 + def lev = new LevenshteinDistance() + return 1 - (lev.apply(s1, s2) / maxLength) + } + + // 计算 Jaro-Winkler 相似度 + static def jaroWinklerSimilarity(String s1, String s2) { + def jw = new JaroWinklerSimilarity() + jw.apply(s1, s2) + } + + static def jaccardSimilarity(String str1, String str2, Closure tokenizer = null) { + // 默认分词逻辑:按字符分割为集合 + if (tokenizer == null) { + tokenizer = { text -> text.chars.collect { it as String } as Set } + } + + def set1 = tokenizer(str1) + def set2 = tokenizer(str2) + + // 处理空集合情况 + if (set1.isEmpty() && set2.isEmpty()) return 1.0 + if (set1.isEmpty() || set2.isEmpty()) return 0.0 + + def intersection = set1.intersect(set2).size() + def union = set1.size() + set2.size() - intersection + intersection / union as Double + } + + +// 综合相似度 (可调整权重) + static def calculateSimilarity(String s1, String s2) { + def levScore = levenshteinSimilarity(s1, s2) + def jwScore = jaroWinklerSimilarity(s1, s2) + // 加权平均 (Levenshtein 占40%, Jaro-Winkler 占60%) + (levScore * 0.4 + jwScore * 0.6).round(2) + } + + + static def jaccardSimilarity2(str1, str2) { + // 将字符串转换为字符集合 + def set1 = str1.chars.toSet() + def set2 = str2.chars.toSet() + + // 计算交集和并集 + def intersection = set1.intersect(set2).size() + def union = set1.size() + set2.size() - intersection + + // 计算Jaccard相似度 + def similarity = (double) intersection / union + + return similarity + } + + static def jaccardByChineseSegmentation(String str1, String str2) { + // 中文分词(需要HanLP依赖) + HanLPClient HanLP = new HanLPClient("https://www.hanlp.com/api", null); + def seg1 = HanLP.segment(str1).collect { it.word }.toSet() + def seg2 = HanLP.segment(str2).collect { it.word }.toSet() + + def intersection = seg1.intersect(seg2).size() + def union = seg1.size() + seg2.size() - intersection + + return union == 0 ? 0 : (double) intersection / union + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20181123.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20181123.groovy index 0519c71eb..6012d1cb0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20181123.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20181123.groovy @@ -8,7 +8,7 @@ import com.mongodb.BasicDBObject import com.mongodb.Bytes import com.mongodb.DBCollection -DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia", "district_stat", "192.168.0.43") +DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia", "district_stat", "mongo.db.fangjia.com") def query =new BasicDBObject(); query.put('weekend', DateUtils.parseFromTightYYYYMMDD("2018-11-18")); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190115.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190115.groovy index a77707ae6..2a6223d63 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190115.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190115.groovy @@ -11,7 +11,7 @@ import com.mongodb.DBCursor import com.mongodb.DBObject import org.apache.commons.lang.StringUtils -DBCollection DIST_SELL_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "192.168.0.43", 28017); +DBCollection DIST_SELL_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com", 28017); DBObject q = new BasicDBObject("city": "西宁"); q.put("date", 201812); //q.put("date", new BasicDBObject('gt', 201806).append('lte', 201812)); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190121.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190121.groovy index 8c8aa0990..6158704c7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190121.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Daily/20190121.groovy @@ -13,7 +13,7 @@ import org.apache.commons.lang.StringUtils List> detailRows = new ArrayList>(); detailRows.add(["城市", "区域", "小区名", "可性度"]); -DBCollection DIST_SELL_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 28017); +DBCollection DIST_SELL_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 28017); DBObject q = new BasicDBObject(); //new BasicDBObject('city', new BasicDBObject('$in', ["常州", "苏州", "淮安"])) q.put("city", "淮安"); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Test.groovy index 772e91d06..050ba67fb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/weilei/Test.groovy @@ -27,7 +27,7 @@ for (int i = 0; i < FangGuGuCrawl.accountUsers.size(); i++) { } return 1; -DBCollection col_district_stat_1 = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43"); +DBCollection col_district_stat_1 = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com"); DBCollection col_district_stat_2 = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.136", 27018); DBCollection col_district_stat_18 = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.18", 28018); DBCursor cursor = col_district_stat_1.find().sort(new BasicDBObject("weekend", -1)).batchSize(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT); @@ -76,7 +76,7 @@ println "End - " + count; //return; // // -//DBCollection col_guiding_price = MongoUtils.getCollectionByName("fangjia", "guiding_price", "192.168.0.43", 27017); +//DBCollection col_guiding_price = MongoUtils.getCollectionByName("fangjia", "guiding_price", "mongo.db.fangjia.com", 27017); // //DBCursor cursor = col_guiding_price.find(new BasicDBObject('$where' , "this.name == this.guiding_person")); //while(cursor.hasNext()){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/address/Test1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/address/Test1.groovy index e67e057e5..47325a59c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/address/Test1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/address/Test1.groovy @@ -12,7 +12,7 @@ import java.sql.Connection import java.sql.ResultSet import java.sql.Statement -//final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") +//final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") //def key = [] //int i =0 //DIST_STAT_COLL.find(new BasicDBObject("weekend", DateUtil.parseDate("20180826", "yyyyMMdd"))).batchSize(1000).each {def dbo-> diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/CityHousePrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/CityHousePrice.groovy index b260aa415..f1563a0bb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/CityHousePrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/CityHousePrice.groovy @@ -4,7 +4,7 @@ import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection -DBCollection GUIDING_PRICE = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") +DBCollection GUIDING_PRICE = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com") def data = ExcelUtils.read("D:\\Users\\wenyan\\Desktop\\城市评估均价对比.xlsx", 1) long total = 0 int count = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DealPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DealPrice.groovy index d2ba9610a..9ee9d0379 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DealPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DealPrice.groovy @@ -20,7 +20,7 @@ import java.sql.Statement //Class.forName("ru.yandex.clickhouse.ClickHouseDriver"); //Connection connection = DriverManager.getConnection("jdbc:clickhouse://192.168.0.19:8123?max_memory_usage=50000000000") -//DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") +//DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") //DbUtils.multiThreadingExecuteQueryOnSeaweed(DbUtils.buildSeaweedQuery("上海"),{BasicDBObject district-> // def estate_type = "小区" // if(district.estate_type2.toString().contains("别墅")){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DistrictStatRepeatRemover.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DistrictStatRepeatRemover.groovy index 75b6728d1..f86633ef6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DistrictStatRepeatRemover.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/DistrictStatRepeatRemover.groovy @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicLong // //def removeRepeatDistrictStat(city, region, name, estate_type){ -// DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") +// DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") // List stats = DISTRICT_STAT.find(new BasicDBObject("city", city).append("region", region).append("district_name", name).append("estate_type",estate_type)).toList() // def map = [:] // stats.each {BasicDBObject stat-> @@ -60,7 +60,7 @@ import java.util.concurrent.atomic.AtomicLong //}) -DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43") +DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com") def keys = new BasicDBObject() keys.city = 1 keys.region = 1 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test13.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test13.groovy index 7961e4d15..4ac5450d7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test13.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test13.groovy @@ -12,7 +12,7 @@ import com.mongodb.DBCollection import net.sf.json.JSONArray import net.sf.json.JSONObject -DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat_new", "192.168.0.43") +DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat_new", "mongo.db.fangjia.com") def trend(city, region, name, weekend, estate_type) { def cmd = new BasicDBObject() cmd.city = city diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test14.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test14.groovy index 1c7fa0a2c..bcfff62f7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test14.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Test14.groovy @@ -11,7 +11,7 @@ import com.mongodb.Bytes import com.mongodb.DBCollection import net.sf.json.JSONObject -//DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "192.168.0.43", 27017) +//DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com", 27017) //def int count =0 //ExcelUtils.multiThreadingModify("D:\\涨跌幅较大小区.xlsx",{ List item-> // def query = new BasicDBObject() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Trend.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Trend.groovy index 016d99b3d..af9993be3 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Trend.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/Trend.groovy @@ -10,7 +10,7 @@ import com.mongodb.Bytes import com.mongodb.DBCollection //def cities = ["北京", "上海", "广州","深圳","杭州","南京","武汉","成都","西安","长沙","南昌","贵阳","三亚"] -//DBCollection GUIDING_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43") +//DBCollection GUIDING_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com") //cities.each {def city-> // def one = GUIDING_PRICE.find(new BasicDBObject("city", city)).sort(new BasicDBObject("trade_date", 1)).limit(0)[0] // println(city + "\t" + ((Date)one.trade_date).format("yyyy")) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/XingYe.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/XingYe.groovy index 2ebfa4262..41c5483ab 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/XingYe.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/wenyan/temp/XingYe.groovy @@ -12,7 +12,7 @@ import java.sql.Connection import java.sql.ResultSet import java.sql.Statement -DBCollection DIST_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_grade", "192.168.0.43") +DBCollection DIST_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_grade", "mongo.db.fangjia.com") def String hasElevator(BasicDBObject seaweed){ EsDataSource dataSource = new EsDataSource() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/DealPriceStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/DealPriceStat.groovy index e53eec2b6..d0a3a74c2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/DealPriceStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/DealPriceStat.groovy @@ -14,7 +14,7 @@ import com.mongodb.DBCollection */ class DealPriceStat { - public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; + public static final def lineUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; public static final DBCollection deal_price_coll = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) static main(args) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/DistrictRateStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/DistrictRateStat.groovy index 5236cc675..db03ae997 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/DistrictRateStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/DistrictRateStat.groovy @@ -330,7 +330,7 @@ def findDistrictPrice(def city, def region){ q.put("region", region); } //districtStatConn.addOption(Bytes.QUERYOPTION_SLAVEOK); - final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@192.168.0.43:28017","fangjia_stat", "district_stat"); + final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017","fangjia_stat", "district_stat"); def count = districtStatConn.count(q) return count; } \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/QinLingStat1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/QinLingStat1.groovy index 8b49db263..7e9558e4a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/QinLingStat1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/price/QinLingStat1.groovy @@ -344,7 +344,7 @@ def findDistrictPrice(def city, def region){ q.put("region", region); } //districtStatConn.addOption(Bytes.QUERYOPTION_SLAVEOK); - final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@192.168.0.43:28017","fangjia_stat", "district_stat"); + final def districtStatConn = Mongo3Utils.getDbCollection("mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017","fangjia_stat", "district_stat"); def count = districtStatConn.count(q) return count; } \ No newline at end of file From 1c61cc3b76e988e6163eb63517d4fc53e2ba4db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Mon, 14 Apr 2025 16:05:41 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E9=93=BA?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/dal/mongo/model/ShopSellStat.java | 6 +- .../open/controllers/ShopSellController.java | 614 ++++++++++++++++++ .../service/datastore/AiShopServiceImpl.java | 69 +- 3 files changed, 648 insertions(+), 41 deletions(-) create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopSellController.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java index 8745031ce..97c6c4623 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/ShopSellStat.java @@ -14,7 +14,7 @@ public class ShopSellStat implements MongoEntity { private String city; private String district; private Integer date; - private Double avgPrice; + private Integer avgPrice; private String name; @Id @@ -65,11 +65,11 @@ public class ShopSellStat implements MongoEntity { } @Column(name = "avg_price") - public Double getAvgPrice() { + public Integer getAvgPrice() { return avgPrice; } - public void setAvgPrice(Double avgPrice) { + public void setAvgPrice(Integer avgPrice) { this.avgPrice = avgPrice; } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopSellController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopSellController.java new file mode 100644 index 000000000..9aae9fb84 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ShopSellController.java @@ -0,0 +1,614 @@ +package com.fangjia.open.controllers; + +import com.fangjia.core.RegionData; +import com.fangjia.core.util.AnalyticsUtil; +import com.fangjia.core.util.DataUtil; +import com.fangjia.core.util.HttpRequest; +import com.fangjia.core.util.LoggerFactory; +import com.fangjia.dal.common.ServerAreaData; +import com.fangjia.dal.mongo.fangjia.model.ServerArea; +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.ShopSellStat; +import com.fangjia.open.HttpCode; +import com.fangjia.open.OpenHttpCodeEnum; +import com.fangjia.open.interceptors.AuthenticationBean; +import com.fangjia.open.interceptors.Authority; +import com.fangjia.open.interceptors.Role; +import com.fangjia.open.model.BasicModel; +import com.fangjia.open.model.PropertyEvaluationModel; +import com.fangjia.open.model.ReportApplyModel; +import com.fangjia.open.model.RestfulModelAndView; +import com.fangjia.open.util.CommonUtils; +import com.fangjia.open.util.FangJiaTongUrl; +import com.fangjia.service.address.AddressParser; +import com.fangjia.service.datastore.AiShopService; +import com.fangjia.service.datastore.FieldFilterService; +import com.fangjia.service.datastore.OpenApiLogService; +import com.fangjia.service.datastore.dto.ShopEvaluationDto; +import net.sf.json.JSONObject; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.sothis.web.mvc.ActionContext; +import org.sothis.web.mvc.annotation.Param; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.fangjia.open.util.CommonUtils.convertToString; +import static com.fangjia.open.util.EvaluationFactorUtil.*; + +/** + * 商铺出售服务类 + * + * @author shenjian + * @since 2025/4/14 + */ +@Authority(role = Role.USER) +public class ShopSellController { + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class); + + private AiShopService aiShopService; + + private OpenApiLogService openApiLogService; + + private AddressParser addressParser; + private FieldFilterService fieldFilterService; + + /** + * 城市出租均价 + * + * @return + */ + public Object citySellAction(@Param(name = "city") String city, @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopSellStat(city, null, null, "city", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 区域出租均价 + * + * @return + */ + public Object districtSellAction(@Param(name = "city") String city, @Param(name = "district") String district, + @Param(name = "startDate") Integer startDate, @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (StringUtils.isBlank(district)) { + mav.setModel(BasicModel.buildBadRequestModel("district不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + String region = RegionData.formatRegion(city, district); + if (!RegionData.isRegion(city, region)) { + mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopSellStat(city, region, null, "district", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该区域没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 写字楼均价走势 + * + * @return + */ + public Object shopSellAction(@Param(name = "city") String city, @Param(name = "district") String district, + @Param(name = "name") String name, @Param(name = "startDate") Integer startDate, + @Param(name = "endDate") Integer endDate) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(city)) { + mav.setModel(BasicModel.buildBadRequestModel("city不能为null")); + return mav; + } + if (StringUtils.isBlank(district)) { + mav.setModel(BasicModel.buildBadRequestModel("district不能为null")); + return mav; + } + if (!RegionData.isCity(city)) { + String formatCity = RegionData.formatCity(city); + if (StringUtils.isNotBlank(formatCity)) { + city = formatCity; + } else { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + } + ServerArea serverArea = ServerAreaData.getServerAreaByCity(city); + if (null == serverArea) { + mav.setModel(BasicModel.buildBadRequestModel("city非法")); + return mav; + } + String region = RegionData.formatRegion(city, district); + if (!RegionData.isRegion(city, region)) { + mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域")); + return mav; + } + + if (startDate == null || endDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null")); + return mav; + } + if (startDate > endDate) { + mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate")); + return mav; + } + + List regionStats = aiShopService.findShopSellStat(city, region, name, "shop", startDate, endDate); + + if (CollectionUtils.isEmpty(regionStats)) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该写字楼没有均价数据")); + return mav; + } + mav.setModel(BasicModel.buildOKModel().setResult(regionStats)); + return mav; + } + + /** + * 写字楼楼租金地址估值 + * + * @param model + * @param request + * @return + */ + public Object addressEvaluateSellAction(PropertyEvaluationModel model, HttpServletRequest request) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getAddress()) || model.getSize() <= 0) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,地址,面积(size)为必填项")); + return mav; + } + if (model.getCity().endsWith("市")) { + model.setCity(model.getCity().replaceAll("市$", "")); + } + + if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) { + mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法")); + return mav; + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)")); + return mav; + } + + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层")); + return mav; + } + + ShopEvaluationDto evaluation = aiShopService.addressEvaluateSell(buildEvaluation(model, request)); + + if (evaluation.getUnitPrice() != null && evaluation.getUnitPrice() != 0) { + Map districtPriceMap = new HashMap(); + districtPriceMap.put("unitPrice", evaluation.getUnitPrice()); + districtPriceMap.put("city", evaluation.getCity()); + districtPriceMap.put("district", evaluation.getDistrict()); + districtPriceMap.put("name", evaluation.getName()); + districtPriceMap.put("samples", evaluation.getSeawater()); + districtPriceMap.put("location", evaluation.getLocation()); + + mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); + try { + if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { + openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/shop/addressEvaluateSell"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return mav; + } else { + mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该地址写字楼的评估").markNoData()); + return mav; + } + } + + /** + * 申请估值报告 + * + * @param model 申请报告请求参数 + * @return + */ + public Object assessPriceReportApplyAction(ReportApplyModel model) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getClient())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:委托机构为必填项")); + return mav; + } + if (StringUtils.isBlank(model.getSubjectMatter())) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:标的物为必填项")); + return mav; + } + if (StringUtils.isBlank(model.getCity()) || model.getCity().contains("全国")) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市为必填项且不能为全国")); + return mav; + } + if (StringUtils.isBlank(model.getDistrict()) || model.getDistrict().contains("全国")) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:区域为必填项且不能为全国")); + return mav; + } + if (model.getSize() == null || model.getSize() <= 0 ) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:面积(size)为必填项且大于0")); + return mav; + } + if (model.getCity().endsWith("市")) { + model.setCity(model.getCity().replaceAll("市$", "")); + } + if (model.getDistrict().endsWith("区")) { + model.setDistrict(model.getDistrict().replaceAll("区$", "")); + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层")); + return mav; + } + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("client", model.getClient()); + params.put("subjectMatter", model.getSubjectMatter()); + params.put("city", model.getCity()); + params.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : null); + params.put("district", model.getDistrict()); + params.put("name", StringUtils.isNotBlank(model.getName()) ? model.getName() : null); + params.put("houseNum", StringUtils.isNotBlank(model.getBuildingNumber()) ? model.getBuildingNumber() : null); + params.put("roomNum", StringUtils.isNotBlank(model.getUnitNumber()) ? model.getUnitNumber() : null); + params.put("size", String.valueOf(model.getSize())); + params.put("houseFloor", model.getFloor() != null ? String.valueOf(model.getFloor()) : null); + params.put("houseHeight", model.getMaxFloor() != null ? String.valueOf(model.getMaxFloor()) : null); + params.put("buildType", StringUtils.isNotBlank(model.getPropertyType()) ? model.getPropertyType() : "0"); + params.put("direction", StringUtils.isNotBlank(model.getDirection()) ? model.getDirection() : "3"); + params.put("fitment", StringUtils.isNotBlank(model.getDecoration()) ? model.getDecoration() : "2"); + JSONObject jsonObject = JSONObject.fromObject(params); + Map headers = new HashMap(); + headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN); + headers.put("Content-Type", "application/json"); + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception e) { + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_APPLY, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (json != null) { + if (json.getInt("code") == 200 && json.containsKey("data")) { + HashMap result = new HashMap(); + result.put("caseId", String.valueOf(json.get("data"))); + mav.setModel(BasicModel.buildOKModel().setResult(result)); + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:" + json.getString("message"))); + } + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请估值报告失败:调用申请报告接口返回为空")); + } + return mav; + } + + /** + * 获取估值报告 + * + * @param caseId 估值报告ID + * @return + */ + public Object assessPriceReportFetchAction(@Param(name = "caseId") String caseId) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(caseId)) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:估值报告业务编号为必填项")); + return mav; + } + HttpRequest request = new HttpRequest(); + JSONObject json = null; + Map params = new HashMap(); + params.put("caseId", caseId); + JSONObject jsonObject = JSONObject.fromObject(params); + Map headers = new HashMap(); + headers.put("Authorization", "Bearer " + FangJiaTongUrl.FANG_JIA_TONG_TOKEN); + headers.put("Content-Type", "application/json"); + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception e) { + try { + String ret = request.postWithBody(FangJiaTongUrl.FANG_JIA_TONG_URL_UAT + FangJiaTongUrl.ASSESS_PRICE_REPORT_FETCH, jsonObject, headers, "UTF-8"); + json = JSONObject.fromObject(FangJiaTongUrl.replaceAll(ret)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (json != null) { + if (json.getInt("code") == 200 && json.containsKey("data")) { + JSONObject resultJson = json.getJSONObject("data"); + mav.setModel(BasicModel.buildOKModel().setResult(resultJson)); + } else { + mav.setModel(BasicModel.buildBadRequestModel("获取估值报告失败:" + json.getString("message"))); + } + } else { + mav.setModel(BasicModel.buildBadRequestModel("申请报告失败:调用获取估值报告接口返回为空")); + } + return mav; + } + + private Integer getFloor(String roomNumber) { + if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) { + if (roomNumber.length() == 3) { + return Integer.valueOf(roomNumber.substring(0, 1)); + } else if (roomNumber.length() == 4) { + return Integer.valueOf(roomNumber.substring(0, 2)); + } else { + return null; + } + } + return null; + } + + /** + * 通过EvaluationModel组装Evaluation实体 + * + * @param model + * @param request + * @return + */ + private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) { + Evaluation evaluation = new Evaluation(); + evaluation.setLevel(model.getLevel()); + evaluation.setFitment(model.getFitment()); + evaluation.setType(model.getType()); + + evaluation.setCity(model.getCity()); + evaluation.setRegion(model.getRegion()); + evaluation.setDistrictName(model.getName()); + evaluation.setAddress(model.getAddress()); + evaluation.setDirection(model.getDirection()); + evaluation.setNoise(NOISE.get(model.getNoise())); + evaluation.setType(model.getType()); + evaluation.setSight(SIGHT.get(model.getView())); + evaluation.setAtticArea(model.getAtticSize()); + evaluation.setTerraceArea(model.getOuterSize()); + evaluation.setBasementArea(model.getBasementSize()); + evaluation.setGardenArea(model.getGardenSize()); + String worryFacility = model.getNegativeFactor(); + evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility)); + evaluation.setCreationDate(new Date()); + evaluation.setModificationDate(new Date()); + evaluation.setClientNo(model.getClientNo()); + if (0 != model.getAge()) { + evaluation.setAge(model.getAge()); + } + evaluation.setArea(model.getSize()); + if (ArrayUtils.isNotEmpty(model.getBuildQuality())) { + evaluation.setBuildQuality(convertToString(model.getBuildQuality())); + } + if (StringUtils.isNotBlank(model.getBuildType())) { + evaluation.setBuildType(model.getBuildType()); + } + if (StringUtils.isNotBlank(model.getCarport())) { + evaluation.setCarport(model.getCarport()); + } + if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) { + evaluation.setFitmentAge(model.getDecorationAge()); + } + evaluation.setCarportPrice(model.getCarportPrice()); + evaluation.setCity(model.getCity()); + evaluation.setDistrictName(model.getName()); + if (model.getDecorationCost() != null && model.getDecorationCost() > 0) { + evaluation.setFitmentCharge(model.getDecorationCost()); + } + if (0 != model.getHall()) { + evaluation.setHall(model.getHall()); + } + if (null != model.getFloor()) { + evaluation.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) { + evaluation.setHeight(model.getMaxFloor()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + evaluation.setHouseNum(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getHouseProperty())) { + evaluation.setHouseProperty(model.getHouseProperty()); + } + if (StringUtils.isNotBlank(model.getInsidepos())) { + evaluation.setInsidepos(model.getInsidepos()); + } + if (StringUtils.isNotBlank(model.getLightingVentilation())) { + evaluation.setLightingVentilation(model.getLightingVentilation()); + } + + if (StringUtils.isNotBlank(model.getOtherFactor())) { + evaluation.setOtherFactor(model.getOtherFactor()); + } + evaluation.setRegion(model.getDistrict()); + if (null != model.getRoom()) { + evaluation.setRoom(model.getRoom()); + } + if (StringUtils.isNotBlank(model.getRoomNumber())) { + evaluation.setRoomNum(model.getRoomNumber()); + } + if (StringUtils.isNotBlank(model.getSideset())) { + evaluation.setSideset(model.getSideset()); + } + if (0 != model.getToilet()) { + evaluation.setToilet(model.getToilet()); + } + if (model.getFacilities() != null) { + String facilities = model.getFacilities(); + String[] fs = facilities.split(","); + for (int i = 0; i < fs.length; i++) { + fs[i] = FACILITIES.get(fs[i]); + } + evaluation.setFacilities(convertToString(fs)); + } + + if (StringUtils.isNotBlank(model.getFacade())) { + evaluation.setFacade(model.getFacade()); + } + if (StringUtils.isNotBlank(model.getTraffice())) { + evaluation.setTraffice(model.getTraffice()); + } + if (StringUtils.isNotBlank(model.getShape())) { + evaluation.setShape(model.getShape()); + } + if (StringUtils.isNotBlank(model.getObstacle())) { + evaluation.setObstacle(model.getObstacle()); + } + if (StringUtils.isNotBlank(model.getIndustry())) { + evaluation.setIndustry(model.getIndustry()); + } + if (StringUtils.isNotBlank(model.getSupportDevice())) { + evaluation.setSupportDevice(model.getSupportDevice()); + } + if (StringUtils.isNotBlank(model.getLeftPosition())) { + evaluation.setLeftPosition(model.getLeftPosition()); + } + if (StringUtils.isNotBlank(model.getShopType())) { + evaluation.setShopType(model.getShopType()); + } + if (StringUtils.isNotBlank(model.getShopUnique())) { + evaluation.setShopUnique(model.getShopUnique()); + } + if (StringUtils.isNotBlank(model.getLocation())) { + evaluation.setLocation(model.getLocation()); + } + if (model.isNewDistrict()) { + evaluation.setNewDistrict(model.isNewDistrict()); + } + String floorDesc = "中"; + if (evaluation.getFloor() != null && evaluation.getHeight() != null) { + Double floorInfo = evaluation.getFloor() * 1.0 / evaluation.getHeight(); + if (floorInfo <= 0.33) { + floorDesc = "低"; + } else if (floorInfo > 0.66) { + floorDesc = "高"; + } + evaluation.setFloorDesc(floorDesc); + } + String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest()); + evaluation.setIp(ip); + AuthenticationBean authenticationBean = (AuthenticationBean) request + .getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId())); + } + evaluation.setSource("api_shop_evaluateRent"); + return evaluation; + } + + private static final Map FACILITIES = new HashMap() { + { + put("0", "健身房"); + put("1", "游泳池"); + put("2", "会所"); + put("3", "网球场"); + put("4", "球场"); + put("5", "棋牌室"); + put("6", "停车场"); + put("7", "图书馆"); + put("8", "活动中心"); + } + }; + + public void setOpenApiLogService(OpenApiLogService openApiLogService) { + this.openApiLogService = openApiLogService; + } + + public void setFieldFilterService(FieldFilterService fieldFilterService) { + this.fieldFilterService = fieldFilterService; + } + + public void setAiShopService(AiShopService aiShopService) { + this.aiShopService = aiShopService; + } +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java index 5c7edbcff..6b65b649a 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/AiShopServiceImpl.java @@ -17,7 +17,6 @@ import com.fangjia.service.datastore.dto.ShopEvaluationDto; import com.fangjia.service.mongo.fangjia.SeawaterService; import com.fangjia.service.util.GeoUtils; import com.fangjia.service.util.dto.GaodeDto; -import com.mongodb.BasicDBObject; import org.apache.commons.collections.CollectionUtils; import org.sothis.core.util.Closure; import org.sothis.core.util.Pager; @@ -322,8 +321,13 @@ public class AiShopServiceImpl implements AiShopService { } @Override - public List findShopSellStat(String city, String region, String name, String cat, Integer startDate, Integer endDate) { - return Collections.emptyList(); + public List findShopSellStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) { + return CacheUtils.getValue(this.getClass(), "findShopRentStat", city + region + name + startDate + endDate, + CacheUtils.CachePolicyEnum.MIDDLE, new Closure, String>() { + public List execute(String input) { + return doFindShopSellStat(city, region, name, cat, startDate, endDate); + } + }); } private ShopEvaluationDto rentEvaluateByLocation(Evaluation evaluation) { @@ -382,40 +386,28 @@ public class AiShopServiceImpl implements AiShopService { shopEvaluationDto.setLocation(evaluation.getLocation()); Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]); Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]); - // 查询附近5个写字楼基准价 - BasicDBObject geo = new BasicDBObject(); - BasicDBObject nearQuery = new BasicDBObject(); - nearQuery.append("$geometry", new BasicDBObject("type", "Point").append("coordinates", new double[]{lng, lat})); - nearQuery.append("$maxDistance", 3000); - geo.append("$near", nearQuery); - - List params = new ArrayList(5); - params.add(new QueryParam("cat", "shop")); - params.add(new QueryParam("location", geo)); - - String date = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -2), "yyyyMM"); - params.add(new QueryParam("date", Integer.parseInt(date))); - - // 按日期降序排序,取最新的数据,可能上月还未更新,则取上上个月的数据 - List sortParams = new ArrayList(); - sortParams.add(new SortParam("date", false)); - - List infos = shopSellStatDao.findAllByParams(params, sortParams, 5); - if (CollectionUtils.isEmpty(infos)) { - // 去掉类型,重新查找 - params = new ArrayList(5); - params.add(new QueryParam("cat", "shop")); - params.add(new QueryParam("location", geo)); - params.add(new QueryParam("date", Integer.parseInt(date))); - infos = shopSellStatDao.findAllByParams(params, sortParams); - } - if (CollectionUtils.isNotEmpty(infos)) { + SeawaterQuery query = new SeawaterQuery(); + query.setLat(lat); + query.setLng(lng); + query.setCat("shop_sell"); + query.setRadius(1000); + // 查询近一年样本 + query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"))); + query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd"))); + query.setCityDisplay(evaluation.getCity()); + Pager pager = new Pager(); + pager.setStartRow(0); + pager.setPageSize(5); + query.setPager(pager); + query.setTable("latest_seawater"); + List shops = seawaterService.findSeawatersByQuery(query); + if (CollectionUtils.isNotEmpty(shops)) { // 求均值 Double totalPrice = 0D; int count = 0; - for (ShopSellStat shopSellStat : infos) { - if (shopSellStat.getAvgPrice() != null) { - totalPrice += shopSellStat.getAvgPrice(); + for (Seawater seawater : shops) { + if (seawater.getAvgPrice() != null) { + totalPrice += seawater.getAvgPrice(); count += 1; } } @@ -426,8 +418,9 @@ public class AiShopServiceImpl implements AiShopService { if (evaluation.getDirection() != null) { factor *= DIRECTION_FACTOR.get(DIRECTION_MAP.get(evaluation.getDirection())); } - Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2); - shopEvaluationDto.setUnitPrice(avgPrice); + int avgPrice = (int) (totalPrice / count * factor); + shopEvaluationDto.setUnitPrice((double) avgPrice); + shopEvaluationDto.setSeawater(shops); shopEvaluationDto.setCity(evaluation.getCity()); shopEvaluationDto.setDistrict(evaluation.getRegion()); shopEvaluationDto.setName(evaluation.getDistrictName()); @@ -454,12 +447,12 @@ public class AiShopServiceImpl implements AiShopService { return CacheUtils.getValue(this.getClass(), "findShopRentStat", city + region + name + startDate + endDate, CacheUtils.CachePolicyEnum.MIDDLE, new Closure, String>() { public List execute(String input) { - return doFindRegionBlockStat(city, region, name, cat, startDate, endDate); + return doFindShopRentStat(city, region, name, cat, startDate, endDate); } }); } - public List doFindRegionBlockStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) { + public List doFindShopRentStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) { if (startDate == null) { throw new IllegalArgumentException("开始日期不能为空"); } From 8c1195ecf31f42ffd084f5518f5b2ee190736a7c Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 17:22:23 +0800 Subject: [PATCH 10/13] update bug --- .../fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy index 5338abf79..929913e95 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy @@ -361,7 +361,7 @@ class AutoAddOfficeBatch extends BaseBatch { }else{ str = o2.name.replace(o1.name, "") } - if (nameScore > 0.6 && ["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { + if (nameScore > 0.6 && !["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { o2.nameScore = nameScore o2.addrScore = addrScore o2.score = nameScore @@ -412,7 +412,7 @@ class AutoAddOfficeBatch extends BaseBatch { }else{ str = o2.name.replace(o1.name, "") } - if (nameScore > 0.6 && nameScore>maxScore && ["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { + if (nameScore > 0.6 && nameScore>maxScore && !["一期","二期","三期","四期","五期","六期","七期","八期","九期","十期","东区","西区","南区","北区","A区","B区","C区","D区"].contains(str)) { maxObj = o2 o2.nameScore = nameScore o2.addrScore = addrScore From e3439517f0a1fad1f3e0f3b6aa5865d2022db12c Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 17:30:00 +0800 Subject: [PATCH 11/13] update --- .../com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy index 929913e95..2875529ba 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy @@ -371,7 +371,7 @@ class AutoAddOfficeBatch extends BaseBatch { while(maxObj){ maxObj.nameScore = CosineSimilarAlgorithm.levenshteinSimilarity(maxObj.name, o1.name); if(o1.address && maxObj.address){ - maxObj.addrScore = CosineSimilarAlgorithm.levenshteinSimilarity(o1.address, o2.address); + maxObj.addrScore = CosineSimilarAlgorithm.levenshteinSimilarity(o1.address, maxObj.address); } maxObj.score = maxObj.nameScore rets << maxObj From ac344c87666b2e03f358d1e6f6217277f1c599a8 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 14 Apr 2025 18:17:35 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E6=A8=A1=E7=89=88code=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../groovy/com/fangjia/script/jms/SMSOutgoingListener.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/SMSOutgoingListener.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/SMSOutgoingListener.groovy index 2009547e1..b6418a792 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/SMSOutgoingListener.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jms/SMSOutgoingListener.groovy @@ -310,7 +310,7 @@ class SMSOutgoingListener extends BaseBatch { if(StringUtils.isNotBlank(checkCode)){ JSONObject con = new JSONObject() con.put("code", checkCode); - return AliyunSmsClient.sendSms(mobile, "SMS_482955117", con.toString()) + return AliyunSmsClient.sendSms(mobile, "SMS_483345375", con.toString()) } } int resCode = SingletonClient.getClient().sendSMS([mobile] as String[],content, 5) From 02928401be1c5330d357548e75be4aeb84123d0e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 15 Apr 2025 08:55:24 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/gj/data_handle/AutoAddOfficeBatch.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy index 2875529ba..90b4020e0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddOfficeBatch.groovy @@ -228,12 +228,17 @@ class AutoAddOfficeBatch extends BaseBatch { def citys = CommonDatautils.findAllCity() def allrets = [] allrets << [ "城市", "区域", "名称", "别名","计算方式","地址","名称相似度","地址相似度","总相似度"] + def index = 0 for (def c : citys) { + index++ + if(index>4){ + continue + } def districts = CommonDatautils.findAllDistricts(c, "district", ["city", "region", "name", "address", "alias"]) def rets = checkRepeatDistrictBatch(c, districts) println c + " " + districts.size() allrets.addAll(rets) - println c +" 支行完成 "+rets.size() + println "${index}"+ c +" 运A行完成 "+rets.size() } ExcelUtils.write("/home/goojia/gj/重复可疑小区1.xlsx", allrets, "数据") }