From 813b58967fc6a3006983369755dd044e2f29fdf1 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Thu, 15 Dec 2022 10:39:42 +0800 Subject: [PATCH] update --- .../ExportOracleAllDataTest.groovy | 72 ++++++++++++------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleAllDataTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleAllDataTest.groovy index a9b26861a..bbfa5d1de 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleAllDataTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ExportOracleAllDataTest.groovy @@ -70,17 +70,17 @@ class ExportOracleAllDataTest { // exportCityPrice()// // exportRegionPrice()// // - exportCommunityBasePriceGj()// +// exportCommunityBasePriceGj()// exportCommunityBasePrice()// -// +//// exportCommunityPdescribeGj()// exportCommCaseDetailGj()// - - def curDate = curMonth.toString()+"28" - // ok文件 - exportInOk() - SSHHelperTest jschCommand = new SSHHelperTest(); - System.out.println(jschCommand.executeCommand("sh /home/ccb_evaluation/output/eval_package.sh ${curDate}")); +// +// def curDate = curMonth.toString()+"28" +// // ok文件 +// exportInOk() +// SSHHelperTest jschCommand = new SSHHelperTest(); +// System.out.println(jschCommand.executeCommand("sh /home/ccb_evaluation/output/eval_package.sh ${curDate}")); } @@ -904,6 +904,15 @@ class ExportOracleAllDataTest { def exportCommunityBasePrice(){ def allRows = [] + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"; + def fileName = "/ccb_evaluation/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" + def fileName1 = "/ccb_evaluation/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" + if(CommonDatautils.isWindow()){ + fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" + fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" + } + def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"] + for(def city : citys) { def cityCode = cityCodeMap.get(city) def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where CITYID='${cityCode}' "; @@ -929,18 +938,19 @@ class ExportOracleAllDataTest { data << r.UPDATETIME data << r.SOURCECODE allRows << data + if(allRows.size()%200000==0){ + FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", true); + allRows.clear() + } }); } - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"; - def fileName = "/ccb_evaluation/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" - def fileName1 = "/ccb_evaluation/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" - if(CommonDatautils.isWindow()){ - fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" - fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" + + if(allRows.size()>0){ + FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", true); } - def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"] - FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false); - FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false); + println "COMMUNITY_BASE_PRICE_GJNB 数据文件输出完成......" CcbFtpTestUtils.ftpUpload(null, fileName, curDate) CcbFtpTestUtils.ftpUpload(null, fileName1, curDate) @@ -1120,11 +1130,19 @@ class ExportOracleAllDataTest { data << r.SATUR_RATIO data << r.NEIGHBOR_PRICE allRows << data + + if(allRows.size()%200000==0){ + FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + allRows.clear() + } }); } println allRows.size() - FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false); + if(allRows.size()%200000==0){ + FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + allRows.clear() + } println "community_p_describe_gj 数据文件输出完成......" CcbFtpTestUtils.ftpUpload(null, fileName, curDate) println "community_p_describe_gj 上传Ftp完成......" @@ -1138,12 +1156,11 @@ class ExportOracleAllDataTest { fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat" } def headers = [] - + def allRows = [] def index = 0 for(def city : citys) { def cityCode = cityCodeMap.get(city) def sql = "select ID, CITYID, COMMUNITY_ID, NETLISTING_ID, PRICE_DATE, to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE from comm_case_detail_gj where cityid='${cityCode}'"; - def allRows = [] sqlInstance.eachRow(sql, { r -> def data = [] data << r.ID @@ -1153,15 +1170,16 @@ class ExportOracleAllDataTest { data << r.PRICE_DATE data << r.CREATE_DATE allRows << data - }); - if (allRows && allRows.size() > 0) { - index = index + 1 - if (index == 1) { - FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false); - } else { + if(allRows.size()%200000==0){ FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + allRows.clear() } - } + }); + } + + if(allRows.size()>0){ + FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true); + allRows.clear() } println "comm_case_detail_gj 数据文件输出完成......" CcbFtpTestUtils.ftpUpload(null, fileName, curDate)