From aa107962bd84350eae1fa44dba9800f1c9875a57 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 1 Jul 2024 17:09:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=B0=8F=E5=8C=BA?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E9=87=8D=E6=96=B0?= =?UTF-8?q?master=E6=89=93=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/ana/FindStageDistrictBatch.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/FindStageDistrictBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/FindStageDistrictBatch.groovy index 8c6633b4d..a46baf30a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/FindStageDistrictBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ana/FindStageDistrictBatch.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.ana import com.fangjia.script.BaseBatch import com.fangjia.script.BatchOwner import com.fangjia.script.Watcher +import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.DbUtils import com.mongodb.BasicDBObject @@ -24,7 +25,7 @@ class FindStageDistrictBatch extends BaseBatch { @Override void process(Object args) { CommonUtils.findAllCity().each { def city -> - DbUtils.seaweed.find(DbUtils.buildSeaweedQuery(city), new BasicDBObject("region", 1).append("name", 1).append("master_district_name", 1).append("city", 1)).each { BasicDBObject dbo -> + CommonDatautils.SEAWEED_COLL.find(DbUtils.buildSeaweedQuery2(city), new BasicDBObject("region", 1).append("name", 1).append("master_district_name", 1).append("city", 1)).each { BasicDBObject dbo -> if (dbo.name =~ STAGE_PATTERN && StringUtils.isBlank(dbo.master_district_name)) { def mainName = dbo.name.toString().replaceAll("([一二三四五六七八九十百千\\d]+)期\$", "") def query = DbUtils.buildSeaweedQuery(city, dbo.region, mainName) @@ -40,7 +41,6 @@ class FindStageDistrictBatch extends BaseBatch { println(dbo) } } - } } } From c1857de354e78521eabba66142c955c54fdc5292 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 1 Jul 2024 17:10:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/util/DbUtils.groovy | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy index aeda5fc28..40e691bef 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/DbUtils.groovy @@ -186,6 +186,26 @@ public class DbUtils{ return query } + public static BasicDBObject buildSeaweedQuery2(def city = null, def region = null, def name = null, def cat = "district", def status = 0){ + BasicDBObject query = new BasicDBObject() + if(city){ + query.append("city", city) + } + if(region){ + query.append("region", region) + } + if(name){ + query.append("name", name) + } + if(cat != null){ + query.append("cat", cat) + } + if(status != null){ + query.append("status", status) + } + return query + } + /** * 把小区修改成删除状态 * @param id