From 22765aab5af4c55e431dd8fd2ed19d9486b8a9b7 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Thu, 22 Apr 2021 13:36:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=93=E5=B0=8F=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/gj/GaoDeMapCrawl.groovy | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/GaoDeMapCrawl.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/GaoDeMapCrawl.groovy index 5bdf3d46f..9c85d6711 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/GaoDeMapCrawl.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/GaoDeMapCrawl.groovy @@ -42,10 +42,10 @@ class GaoDeMapCrawl { def updateErrorLists = [] def flagLists = [] def index = 0 - def prefix = "road_" + def prefix = "district_" // def categorys = ["141202", "141203"]//中学,小学 -// def categorys = ["120000", "120200","120203","120300","120301","120302","120303","120304"]//住宅相关 - def categorys = ["190301"]//道路相关 + def categorys = ["120000", "120200","120203","120300","120301","120302","120303","120304"]//住宅相关 +// def categorys = ["190301"]//道路相关 static main(args) { def task = new GaoDeMapCrawl(); @@ -109,8 +109,8 @@ class GaoDeMapCrawl { def run(){//,"西安","重庆" // def citys = [ "临沂","泰安","菏泽","东营","德州","济宁","日照","聊城","滨州","枣庄","莱芜","济南","青岛","威海","烟台","潍坊","淄博"] -// def citys = ["北京","广州","深圳","合肥","苏州","西安","重庆"] - def citys = CommonUtils.findAllCity() + def citys = ["重庆","哈尔滨","沈阳","东莞","南昌","昆明","金华","温州","淄博","湛江","肇庆","宜昌","岳阳","安庆","芜湖","西宁","日照","常德","张家口"] +// def citys = CommonUtils.findAllCity() def totalCount = 0; for(def city : citys){ def cityLations = findAllLation(city); @@ -198,9 +198,11 @@ class GaoDeMapCrawl { if(m.rets){ processData(m.rets); location.count = m.rets.size() + location.content = m.toString() flagLists.add(location) }else{ location.count = 0 + location.content = m.toString() flagLists.add(location) } @@ -336,7 +338,7 @@ class GaoDeMapCrawl { for(def location : updateLists){ if(location && location._id){ Document updateDocument = new Document(); - def doc = new Document(prefix+"status","完成").append("m_date", new Date()) + def doc = new Document(prefix+"status","完成").append("m_date", new Date()).append("content", location.content) updateDocument.append('$set', doc); Bson updateBson = Filters.eq("_id", location._id); UpdateOneModel updateOneModel = new UpdateOneModel(updateBson, updateDocument); @@ -358,7 +360,7 @@ class GaoDeMapCrawl { for(def location : flagLists){ if(location && location._id){ Document updateDocument = new Document(); - def doc = new Document(prefix+"gd_data_count",location.count).append("m_date", new Date()) + def doc = new Document(prefix+"gd_data_count",location.count).append("m_date", new Date()).append("content", location.content) updateDocument.append('$set', doc); Bson updateBson = Filters.eq("_id", location._id); UpdateOneModel updateOneModel = new UpdateOneModel(updateBson, updateDocument); @@ -382,7 +384,7 @@ class GaoDeMapCrawl { for(def location : updateErrorLists){ if(location && location._id){ Document updateDocument = new Document(); - def doc = new Document(prefix+"status","失败").append("m_date", new Date()) + def doc = new Document(prefix+"status","失败").append("m_date", new Date()).append("content", location.content) updateDocument.append('$set', doc); Bson updateBson = Filters.eq("_id", location._id); UpdateOneModel updateOneModel = new UpdateOneModel(updateBson, updateDocument);