From 7d2c3b480f4a3fd0a1e686940992eb53753aaf48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Tue, 28 Dec 2021 15:15:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E6=B8=85=E7=90=86=E9=9D=9E=E5=BD=93=E6=9C=88?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../batch/RemoveOldIndexOfEs86Batch.groovy | 91 +++++++++++++++++++ .../poi/SeaweedAroundCommittee.groovy | 2 +- .../temp/shenjian/poi/SeaweedAroundPoi.groovy | 2 +- .../poi/SeaweedAroundPoiSingal.groovy | 2 +- .../poi/YinlianLngLatAndAround.groovy | 2 +- 5 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/batch/RemoveOldIndexOfEs86Batch.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/batch/RemoveOldIndexOfEs86Batch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/batch/RemoveOldIndexOfEs86Batch.groovy new file mode 100644 index 000000000..076b33977 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/batch/RemoveOldIndexOfEs86Batch.groovy @@ -0,0 +1,91 @@ +package com.fangjia.script.temp.shenjian.batch + +import com.fangjia.script.BaseBatch +import com.fangjia.script.BatchOwner +import com.fangjia.script.Watcher +import org.apache.http.client.utils.DateUtils + +import java.util.regex.Matcher +import java.util.regex.Pattern + +/** + * 只保留86机器最近一个月索引 + */ +@BatchOwner(Watcher.ShenJian) +class RemoveOldIndexOfEs86 extends BaseBatch { + + static void main(String[] args) { + runBatch(new RemoveOldIndexOfEs86(), args) + } + + @Override + void process(Object args) { + String url = "http://192.168.0.86:9200/_cat/indices" + + // 必须分开写,不能有空格 + String[] cmds = ["curl", "-XGET", url, "--user", "elastic:goojia123456"] + List> indices = execCurl(cmds) + Pattern yearMonthPattern = Pattern.compile("\\d{6}") + Pattern yearMonthPattern1 = Pattern.compile("\\d{4}\\.\\d{2}") + List indexNeedDel = new ArrayList<>() + for (List index : indices) { + String name = index.get(2) + // 忽略系统索引 + if (name.startsWith(".")) { + continue + } + // 匹配含有年月的索引 + Matcher matcher = yearMonthPattern.matcher(name) + if (matcher.find()) { + String date = matcher.group() + if (dateBeforeCurrMonth(date)) { + indexNeedDel.add(name) + } + continue + } + matcher = yearMonthPattern1.matcher(name) + if (matcher.find()) { + String date = matcher.group() + if (dateBeforeCurrMonth(date)) { + indexNeedDel.add(name) + } + } + } + for (String index : indexNeedDel) { + println "删除索引" + index + String urlPrefix = "http://192.168.0.86:9200/" + cmds = ["curl", "-XDELETE", urlPrefix + index, "--user", "elastic:goojia123456"] + execCurl(cmds) + } + } + + static List> execCurl(String[] cmds) { + ProcessBuilder process = new ProcessBuilder(cmds) + Process p + try { + List result = new ArrayList<>() + p = process.start() + BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())) + String line = null + while ((line = reader.readLine()) != null) { + result.add(line.split("{1} +")) + } + return result + } catch (IOException e) { + e.printStackTrace() + } + return null + } + + def boolean dateBeforeCurrMonth(String date) { + String dateCurr = DateUtils.formatDate(new Date(), "yyyyMM"); + if (date.contains(dateCurr)) { + return false + } + dateCurr = DateUtils.formatDate(new Date(), "yyyy.MM"); + if (date.contains(dateCurr)) { + return false + } + return true + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundCommittee.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundCommittee.groovy index d8edf839d..fc4fecc64 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundCommittee.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundCommittee.groovy @@ -22,7 +22,7 @@ import java.util.concurrent.Executors class SeaweedAroundCommittee { static DBCollection conn136 = MongoUtils.getCollectionByName("fangjia", "seaweed_poi_sync", "192.168.0.136", 27017) - static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi" + static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi" 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/SeaweedAroundPoi.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy index 7dcd06e51..f3c36ebd8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy @@ -28,7 +28,7 @@ import java.util.concurrent.Executors class SeaweedAroundPoi extends BaseBatch { static DBCollection conn136 = MongoUtils.getCollectionByName("fangjia", "seaweed_poi_sync", "192.168.0.136", 27017) - static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi" + static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi" 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/SeaweedAroundPoiSingal.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoiSingal.groovy index be70b79e5..1a620af34 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoiSingal.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoiSingal.groovy @@ -28,7 +28,7 @@ import java.util.concurrent.Executors class SeaweedAroundPoiSingal { static DBCollection conn136 = MongoUtils.getCollectionByName("fangjia", "seaweed_poi_sync", "192.168.0.136", 27017) - static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi" + static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi" static void main(String[] args) { def types = listAllType() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/YinlianLngLatAndAround.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/YinlianLngLatAndAround.groovy index 9cc7ab29d..4764ce68e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/YinlianLngLatAndAround.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/YinlianLngLatAndAround.groovy @@ -14,7 +14,7 @@ import org.apache.commons.collections.CollectionUtils */ class YinlianLngLatAndAround { - static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi" + static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi" static void main(String[] args) { this.getAround() From d7f3c0401acde805863cabf71a3d1f65fe76ee47 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Tue, 28 Dec 2021 17:49:56 +0800 Subject: [PATCH 2/2] update --- .../ccbevaluation/BigdataBuildingBatch.groovy | 4 +- .../ronghe/ExportDistrictRongHe.groovy | 217 ++++++++++-------- .../script/gj/UpdateStatWeekend.groovy | 114 +++++++++ 3 files changed, 232 insertions(+), 103 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateStatWeekend.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataBuildingBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataBuildingBatch.groovy index 2fa1ecd76..42c580735 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataBuildingBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataBuildingBatch.groovy @@ -36,9 +36,9 @@ class BigdataBuildingBatch extends BaseBatch{ def distMap = getDistrictMap(city) def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, buildingMap) println city + " " + rets.size() - def fileName = "/home/goojia/ccb/BIGDATA_COMMUNITY_GJ.dat" + def fileName = "/home/goojia/ccb/bigdata_building_fjw.dat" if(CommonDatautils.isWindow()){ - fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_COMMUNITY_GJ.dat" + fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_building_fjw.dat" } FileUtils.batchCreateFile(rets, fileName, headers, "utf-8", true); } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy index ec499879a..c7847b806 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy @@ -24,30 +24,29 @@ class ExportDistrictRongHe extends BaseBatch{ @Override void process(Object args) { -// def citys = CcbCommonUtils.citys; - def citys = ["苏州","北京","广州","杭州","合肥","深圳","石家庄","武汉","西安","重庆"] + def citys = CcbCommonUtils.citys; def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() // exportAllBigdataDealFJW() for(def city : citys) { def cityCode = cityCodeDataMap.get(city) -// exportBigdataCommunityGJRH(cityCode) -// exportBigdataBuildingFJW(cityCode) -// exportBigdataCommfeeGj(cityCode) -// - exportBigdataDealFJW(cityCode) -// exportBigdataCommbuildstruGJ(cityCode) -// exportBigdataCommhousetypeGJ(cityCode) -// exportBigdataCommbuildyearGj(cityCode) -// exportBigdataCommhouseuseGJ(cityCode) -// exportBigdataPositionGJ(cityCode) -// exportBigdataDistrictFJW(cityCode) + exportBigdataCommunityGJRH(cityCode) + exportBigdataBuildingFJW(cityCode) + exportBigdataCommfeeGj(cityCode) + + exportBigdataDealFJW(cityCode, '2021-11-01') + exportBigdataCommbuildstruGJ(cityCode) + exportBigdataCommhousetypeGJ(cityCode) + exportBigdataCommbuildyearGj(cityCode) + exportBigdataCommhouseuseGJ(cityCode) + exportBigdataPositionGJ(cityCode) + exportBigdataDistrictFJW(cityCode) exportBigdataAliasFJW(cityCode) -// -// exportBigdataBuildprojFjw(cityCode) -// exportBigdataCommlayoutpicFjw(cityCode) + + exportBigdataBuildprojFjw(cityCode) + exportBigdataCommlayoutpicFjw(cityCode) } -// exportEvaluateRate() + exportEvaluateRate() } @@ -311,94 +310,110 @@ class ExportDistrictRongHe extends BaseBatch{ println "ADDRESS_ALIAS_FJW 上传Ftp完成......" } - def exportBigdataDealFJW(cityCode){ - def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where CITYID='${cityCode}' and dealdate>=to_date('2021-06-01','yyyy-MM-dd')"; - def allRows = [] - sqlInstance.eachRow(sql,{r-> - def data = [] - data << r.CITYID - data << r.DEALID - data << r.CITYNAME - data << r.DISTID - data << r.DISTNAME - data << r.STREET - data << r.STREETNO - data << r.COMMID - data << r.COMMNAME - data << r.BUILDID - data << r.BUILDNO - data << r.BUILDNAME - data << r.UNITID - data << r.UNITNO - data << r.UNITNAME - data << r.HOUSEID - data << r.ADDRESS - data << r.BUILDYEAR - data << r.PROPTYPE - data << r.PROPYEARS - data << r.PERIODNUM - data << r.FLOORNUM - data << r.FLOORTYPE - data << r.FLOORCNT - if(r.BUILDTYPE){ - def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",") - data << arrs[0].trim() - }else{ - data << '' - } - data << r.BUILDSTRU - data << r.BUILDAREA - data << r.LIVINGAREA - data << r.HOUSESTYLE - data << r.ROOMCNT - data << r.LIVINGROOMCNT - data << r.KITCHENCNT - data << r.BATHROOMCNT - data << r.HOUSEUSE - data << r.HOUSESTRU - data << r.HOUSEASPECT - data << r.FITMENT - data << r.EVALUATENO - data << r.DEALUNITPRICE - data << r.DEALTOTALPRICE - data << r.DECLAREPRICE - data << r.EVALUATEPRICE - data << r.CONTRACTNO - data << r.DEALDATE - data << r.DEALTYPE - data << r.PAYTYPE - data << r.DEALPERIOD - data << r.IFELEVATOR - data << r.COMPAREAGARDEN - data << r.COMPAREATERRACE - data << r.COMPAREABALCONY - data << r.COMPAREABAYWINDOW - data << r.COMPAREAATTIC - data << r.COMPAREAGARAGE - data << r.COMPAREABASEMENT - data << r.COMPAREAOTHER - data << r.DATASOURCE - data << r.AGENCYID - data << r.AGENCYNAME - data << r.REMARK - data << r.CREATETIME1 - data << r.UPDATETIME1 - data << r.SOURCECODE - data << r.WORKDATE - allRows << data - }); + def exportBigdataDealFJW(cityCode, dealdate){ + + def startDateStr = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd") + def endDateStr = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD(dealdate)), "yyyy-MM-dd") + def stop = false def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" - def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat" - if(CommonDatautils.isWindow()){ - fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${curDate}_0001.dat" + def index = 0 + while(!stop){ + index++ + def dealStartStr = startDateStr + + def fileName = "/ccb_rh/${curDate}/${cityCode}/FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${dealStartStr.replace("-","")}_0001.dat" + if(CommonDatautils.isWindow()){ + fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_rh\\${curDate}\\${cityCode}\\FJW_000000_${cityCode}_BIGDATA_DEAL_FJW_ADD_${dealStartStr.replace("-","")}_0001.dat" + } + + + def dealEndStr = DateUtils.add(startDateStr, 1) + def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ where CITYID='${cityCode}' and dealdate>=to_date('${dealStartStr}','yyyy-MM-dd') and dealdate + def data = [] + data << r.CITYID + data << r.DEALID + data << r.CITYNAME + data << r.DISTID + data << r.DISTNAME + data << r.STREET + data << r.STREETNO + data << r.COMMID + data << r.COMMNAME + data << r.BUILDID + data << r.BUILDNO + data << r.BUILDNAME + data << r.UNITID + data << r.UNITNO + data << r.UNITNAME + data << r.HOUSEID + data << r.ADDRESS + data << r.BUILDYEAR + data << r.PROPTYPE + data << r.PROPYEARS + data << r.PERIODNUM + data << r.FLOORNUM + data << r.FLOORTYPE + data << r.FLOORCNT + if(r.BUILDTYPE){ + def arrs = r.BUILDTYPE.replace("[","").replace("]","").split(",") + data << arrs[0].trim() + }else{ + data << '' + } + data << r.BUILDSTRU + data << r.BUILDAREA + data << r.LIVINGAREA + data << r.HOUSESTYLE + data << r.ROOMCNT + data << r.LIVINGROOMCNT + data << r.KITCHENCNT + data << r.BATHROOMCNT + data << r.HOUSEUSE + data << r.HOUSESTRU + data << r.HOUSEASPECT + data << r.FITMENT + data << r.EVALUATENO + data << r.DEALUNITPRICE + data << r.DEALTOTALPRICE + data << r.DECLAREPRICE + data << r.EVALUATEPRICE + data << r.CONTRACTNO + data << r.DEALDATE + data << r.DEALTYPE + data << r.PAYTYPE + data << r.DEALPERIOD + data << r.IFELEVATOR + data << r.COMPAREAGARDEN + data << r.COMPAREATERRACE + data << r.COMPAREABALCONY + data << r.COMPAREABAYWINDOW + data << r.COMPAREAATTIC + data << r.COMPAREAGARAGE + data << r.COMPAREABASEMENT + data << r.COMPAREAOTHER + data << r.DATASOURCE + data << r.AGENCYID + data << r.AGENCYNAME + data << r.REMARK + data << r.CREATETIME1 + data << r.UPDATETIME1 + data << r.SOURCECODE + data << r.WORKDATE + allRows << data + }); + + if(dealStartStr == endDateStr){ + stop = true + } + FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false); + CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}") + println "BIGDATA_DEAL_FJW 上传Ftp完成......${dealStartStr}" + startDateStr = dealEndStr } - FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false); - CcbFtpUtils.ftpUpload(fileName, curDate+"/${cityCode}") - println "BIGDATA_DEAL_FJW 上传Ftp完成......" } - - def exportAllBigdataDealFJW(){ def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, CREATETIME, UPDATETIME, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME1,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME1,SOURCECODE,WORKDATE from BIGDATA_DEAL_GJ"; def allRows = [] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateStatWeekend.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateStatWeekend.groovy new file mode 100644 index 000000000..e231a8d7e --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/UpdateStatWeekend.groovy @@ -0,0 +1,114 @@ +package com.fangjia.script.gj + +import com.fangjia.core.util.DataUtil +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.Bytes +import com.mongodb.DBCollection +import com.mongodb.DBObject + +import java.text.ParseException +import java.text.SimpleDateFormat +import java.util.concurrent.CountDownLatch +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicLong + +class UpdateStatWeekend { + + public static final def mongoDbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017"; + public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName2("fangjia_stat", "district_stat", mongoDbUrl) + + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80) + + static main(args) { + def task = new UpdateStatWeekend() + task.run() + } + + def run(){ + //"合肥","上海","北京","广州","杭州","深圳","石家庄","天津","武汉","西安","重庆", + def citys = ["苏州"] + for(def city : citys){ + def rets = findAddData(city) + process(city, rets) + } + } + + def process(def city, def rets){ + + def index = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(rets.size()) + + for(def i=0;i