Merge branch 'script_gj' into 'master'

临时导1月数据

See merge request !519
This commit is contained in:
2023-02-02 15:58:14 +08:00
@@ -29,6 +29,10 @@ class ExportDistrictRongHe extends BaseBatch{
@Override
void process(Object args) {
def queryDate = 202212//DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM").toInteger()
citys = CcbCommonUtils.getRunningCitys(args)
def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
def curDate = DateUtils.formatDateByPattern(new Date()+1, "yyyyMMdd")
@@ -36,7 +40,8 @@ class ExportDistrictRongHe extends BaseBatch{
//按天导(每天一个文件夹)
exportBigdataDealFJW2(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-2), "yyyy-MM-dd"), new_dists)
if(curDate.toString().endsWith("10")){
// if(curDate.toString().endsWith("10")){
exportBigdataCommunityGJRH()//
exportBigdataBuildingFJW()//
exportBigdataCommfeeGj()//
@@ -53,21 +58,26 @@ class ExportDistrictRongHe extends BaseBatch{
exportBigdataCommlayoutpicFjw()
exportEvaluateRate()
// //因为融合暂不切库,所以需要加传一张第三方均价表到融合中, 从1月10日开始传输
def thirdPartyMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"));
exportThirdPartyPrice2(thirdPartyMonth, new_dists)
// def queryDate = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM").toInteger()
exportBigdataCityPrice(queryDate)
exportBigdataDistPrice(queryDate)
exportBigdataCommPrice(queryDate)
//// //因为融合暂不切库,所以需要加传一张第三方均价表到融合中, 从1月10日开始传输,长期供
// def thirdPartyMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"));
// exportThirdPartyPrice2(thirdPartyMonth, new_dists)
//
//
// //1月10日 新增5张表,导92城,增量数据,2月10日导344城,其中252城所有历史数据,92城增量,3月后可能不用提供数据
// exportCommunityBasePrice(lastMonth)
// exportCommunityPdescribeGj(lastMonth)
// exportGuideStatistics(lastMonth)
// exportBigdataSupplierStatistics(lastMonth)
// exportBigdataModelingBase(lastMonth)
//1月10日 新增5张表,导92城,增量数据,2月10日导344城,其中252城所有历史数据,92城增量,3月后可能不用提供数据
exportCommunityBasePrice(lastMonth)
exportCommunityPdescribeGj(lastMonth)
exportGuideStatistics(lastMonth)
exportBigdataSupplierStatistics(lastMonth)
exportBigdataModelingBase(lastMonth)
}
SSHHelper jschCommand = new SSHHelper();
System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
// }
// SSHHelper jschCommand = new SSHHelper();
// System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}"));
exportOk(curDate)
@@ -1141,6 +1151,147 @@ class ExportDistrictRongHe extends BaseBatch{
println "bigdata_modeling_base 上传Ftp完成......"
}
def exportBigdataCityPrice(queryDate){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
def fileName = "/ccb_ronghe/${curDate}/FJW_000000_000000_BIGDATA_CITYPRICE_FJW_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_ronghe\\${curDate}\\FJW_000000_000000_BIGDATA_CITYPRICE_FJW_ADD_${curDate}_0001.dat"
}
def allRows = []
for(def city : citys) {
def cityCode = cityCodeMap.get(city)
// def sql = "select CITYID, YMID, SALEPRICE,RENTPRICE,SALECOUNT,RENTCOUNT, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, HOUSEUSE,SALEBLDGAREA,RENTBLDGAREA,SALETOTALPRICE,RENTTOTALPRICE,DATATYPE,SDATERANGE,RDATERANGE,SOURCECODE from BIGDATA_CITYPRICE where CITYID='${cityCode}' and YMID=${queryDate}";//
def sql = "select CITYID, YMID, SALEPRICE,RENTPRICE,SALECOUNT,RENTCOUNT, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, HOUSEUSE,SALEBLDGAREA,RENTBLDGAREA,SALETOTALPRICE,RENTTOTALPRICE,DATATYPE,SDATERANGE,RDATERANGE,SOURCECODE from BIGDATA_CITYPRICE where CITYID='${cityCode}'";//
sqlInstance.eachRow(sql,{r->
def data = []
data << r.CITYID
data << r.YMID
data << r.SALEPRICE?r.SALEPRICE:''
data << r.RENTPRICE?r.RENTPRICE:''
if(r.SALECOUNT>0) {
data << r.SALECOUNT
}else{
data << ''
}
if(r.RENTCOUNT>0){
data << r.RENTCOUNT
}else{
data << ''
}
data << r.UPDATETIME
data << r.HOUSEUSE
data << r.SALEBLDGAREA?r.SALEBLDGAREA:''
data << r.RENTBLDGAREA?r.RENTBLDGAREA:''
data << r.SALETOTALPRICE?r.SALETOTALPRICE:''
data << r.RENTTOTALPRICE?r.RENTTOTALPRICE:''
data << r.DATATYPE
data << r.SDATERANGE
data << r.RDATERANGE
data << r.SOURCECODE
allRows << data
});
}
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
println "BIGDATA_CITYPRICE 上传Ftp完成......"
}
def exportBigdataDistPrice(queryDate){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
def fileName = "/ccb_ronghe/${curDate}/FJW_000000_000000_BIGDATA_DISTPRICE_FJW_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_ronghe\\${curDate}\\FJW_000000_000000_BIGDATA_DISTPRICE_FJW_ADD_${curDate}_0001.dat"
}
def allRows = []
for(def city : citys) {
def cityCode = cityCodeMap.get(city)
def sql = "select CITYID,DISTID, YMID, SALEPRICE,RENTPRICE,SALECOUNT,RENTCOUNT, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, HOUSEUSE,SALEBLDGAREA,RENTBLDGAREA,SALETOTALPRICE,RENTTOTALPRICE,DATATYPE,SDATERANGE,RDATERANGE,SOURCECODE from BIGDATA_DISTPRICE where CITYID='${cityCode}'";// and YMID=${queryDate}
sqlInstance.eachRow(sql,{r->
def data = []
data << r.CITYID
data << r.YMID
data << r.DISTID
data << r.SALEPRICE?r.SALEPRICE:''
data << r.RENTPRICE?r.RENTPRICE:''
if(r.SALECOUNT>0) {
data << r.SALECOUNT
}else{
data << ''
}
if(r.RENTCOUNT>0){
data << r.RENTCOUNT
}else{
data << ''
}
data << r.UPDATETIME
data << r.HOUSEUSE
data << r.SALEBLDGAREA?r.SALEBLDGAREA:''
data << r.RENTBLDGAREA?r.RENTBLDGAREA:''
data << r.SALETOTALPRICE?r.SALETOTALPRICE:''
data << r.RENTTOTALPRICE?r.RENTTOTALPRICE:''
data << r.DATATYPE
data << r.SDATERANGE
data << r.RDATERANGE
data << r.SOURCECODE
allRows << data
});
}
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
println "BIGDATA_DISTPRICE 上传Ftp完成......"
}
def exportBigdataCommPrice(queryDate){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10"
def fileName = "/ccb_ronghe/${curDate}/FJW_000000_000000_BIGDATA_COMMPRICE_FJW_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\ccb_ronghe\\${curDate}\\FJW_000000_000000_BIGDATA_COMMPRICE_FJW_ADD_${curDate}_0001.dat"
}
def allRows = []
for(def city : citys) {
def cityCode = cityCodeMap.get(city)
def sql = "select CITYID, YMID,COMMID, SALEPRICE,RENTPRICE,SALECOUNT,RENTCOUNT, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, HOUSEUSE,SALEBLDGAREA,RENTBLDGAREA,SALETOTALPRICE,RENTTOTALPRICE,DATATYPE,SDATERANGE,RDATERANGE,SOURCECODE from BIGDATA_COMMPRICE where CITYID='${cityCode}' ";// and YMID=${queryDate}
sqlInstance.eachRow(sql,{r->
def data = []
data << r.CITYID
data << r.YMID
data << r.COMMID
data << r.SALEPRICE?r.SALEPRICE:''
if(r.SALECOUNT>0) {
data << r.SALECOUNT
}else{
data << ''
}
data << r.RENTPRICE?r.RENTPRICE:''
if(r.RENTCOUNT>0){
data << r.RENTCOUNT
}else{
data << ''
}
data << r.UPDATETIME
data << r.SALEBLDGAREA?r.SALEBLDGAREA:''
data << r.RENTBLDGAREA?r.RENTBLDGAREA:''
data << r.SALETOTALPRICE?r.SALETOTALPRICE:''
data << r.RENTTOTALPRICE?r.RENTTOTALPRICE:''
data << r.HOUSEUSE
data << r.SDATERANGE
data << r.RDATERANGE
data << r.DATATYPE
data << r.SOURCECODE
allRows << data
});
}
FileUtils.batchCreateFile(allRows, fileName, [], "utf-8", false);
CcbFtpTestUtils.ftpUpload("rh",fileName, curDate)
println "BIGDATA_COMMPRICE 上传Ftp完成......"
}
def exportBigdataCommlayoutpicFjw(){