diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingFromListPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingFromListPlugin.java index 2e5289e..7f8dafc 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingFromListPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingFromListPlugin.java @@ -1,17 +1,25 @@ package shkd.sys.sys.plugin.report; +import dm.jdbc.util.StringUtil; import kd.bos.algo.DataSet; +import kd.bos.algo.JoinDataSet; +import kd.bos.algo.JoinType; import kd.bos.bill.BillShowParameter; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.LocaleString; import kd.bos.db.DB; import kd.bos.db.DBRoute; +import kd.bos.entity.NumberFormatProvider; import kd.bos.entity.datamodel.events.PackageDataEvent; import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.entity.report.AbstractReportColumn; +import kd.bos.entity.report.IReportListModel; import kd.bos.entity.report.ReportColumn; import kd.bos.entity.report.ReportQueryParam; import kd.bos.form.ShowType; +import kd.bos.form.control.events.FilterContainerInitEvent; +import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.events.HyperLinkClickEvent; import kd.bos.form.events.HyperLinkClickListener; import kd.bos.orm.ORM; @@ -19,13 +27,18 @@ import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.report.ReportList; import kd.bos.report.ReportShowParameter; +import kd.bos.report.events.CreateColumnEvent; import kd.bos.report.filter.ReportFilter; import kd.bos.report.plugin.AbstractReportFormPlugin; +import kd.bos.report.proxy.ReportListProxy; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.EventObject; import java.util.List; @@ -40,24 +53,26 @@ public class InterestBearingFromListPlugin extends AbstractReportFormPlugin impl super.propertyChanged(e); if(e.getProperty().getName().equals("shkd_datasel")){ //是否是修改下拉框数据 if (e.getChangeSet()[0].getNewValue() != null) { - this.getView().getModel().setValue("shkd_bizdate", this.getModel().getValue("shkd_bizdate")); //日期 - this.getView().getModel().setValue("shkd_amtunit", this.getModel().getValue("shkd_amtunit")); //金额单位 - this.getView().getModel().setValue("shkd_datevar", this.getModel().getValue("shkd_datevar")); //期限数 - this.getView().getModel().setValue("shkd_datetype", this.getModel().getValue("shkd_datetype")); //期限类型 +// this.getView().getModel().setValue("shkd_bizdate", this.getModel().getValue("shkd_bizdate")); //日期 +// this.getView().getModel().setValue("shkd_amtunit", this.getModel().getValue("shkd_amtunit")); //金额单位 +// this.getView().getModel().setValue("shkd_datevar", this.getModel().getValue("shkd_datevar")); //期限数 +// this.getView().getModel().setValue("shkd_datetype", this.getModel().getValue("shkd_datetype")); //期限类型 this.getView().getModel().setValue("shkd_datasel", e.getChangeSet()[0].getNewValue()); //数据查询维度 - this.getView().getModel().setValue("shkd_startintdatecase", this.getModel().getValue("shkd_startintdatecase")); //借款时间开始 - this.getView().getModel().setValue("shkd_startintdateend", this.getModel().getValue("shkd_startintdateend")); //借款时间结束 - this.getView().getModel().setValue("shkd_expiredatecase", this.getModel().getValue("shkd_expiredatecase")); //到期时间开始 - this.getView().getModel().setValue("shkd_expiredateend", this.getModel().getValue("shkd_expiredateend")); //到期时间结束 +// this.getView().getModel().setValue("shkd_startintdatecase", this.getModel().getValue("shkd_startintdatecase")); //借款时间开始 +// this.getView().getModel().setValue("shkd_startintdateend", this.getModel().getValue("shkd_startintdateend")); //借款时间结束 +// this.getView().getModel().setValue("shkd_expiredatecase", this.getModel().getValue("shkd_expiredatecase")); //到期时间开始 +// this.getView().getModel().setValue("shkd_expiredateend", this.getModel().getValue("shkd_expiredateend")); //到期时间结束 if(e.getChangeSet()[0].getNewValue().equals("datagp8")){ //数据汇总 不显示其他日期 只显示日期字段 this.getView().setVisible(true,"shkd_bizdate"); - this.getView().setVisible(false,"shkd_startintdatecase","shkd_startintdateend","shkd_expiredatecase","shkd_expiredateend","shkd_datetype"); + this.getView().setVisible(false,"shkd_startintdatecase","shkd_startintdateend","shkd_expiredatecase","shkd_expiredateend","shkd_datetype" + ,"shkd_ejcompany","shkd_rzzt","shkd_zqrzh","shkd_rzpz","shkd_finproduct","shkd_mulcombofield","shkd_mulcombofield1","shkd_dybbkmmc","shkd_guaranteeway"); }else{ this.getView().setVisible(false,"shkd_bizdate"); - this.getView().setVisible(true,"shkd_startintdatecase","shkd_startintdateend","shkd_expiredatecase","shkd_expiredateend","shkd_datetype"); + this.getView().setVisible(true,"shkd_startintdatecase","shkd_startintdateend","shkd_expiredatecase","shkd_expiredateend","shkd_datetype" + ,"shkd_ejcompany","shkd_rzzt","shkd_zqrzh","shkd_rzpz","shkd_finproduct","shkd_mulcombofield","shkd_mulcombofield1","shkd_dybbkmmc","shkd_guaranteeway"); } - ReportFilter filter = this.getView().getControl("reportfilterap");//调用页面的自动查询 + ReportFilter filter = this.getView().getControl("reportfilterap");//调用页面的自动查询 filter.search(); } } @@ -71,25 +86,25 @@ public class InterestBearingFromListPlugin extends AbstractReportFormPlugin impl public void afterBindData(EventObject e) { super.afterBindData(e); ReportShowParameter formShowParameter = (ReportShowParameter) this.getView().getFormShowParameter(); - Object shkd_bizdate = formShowParameter.getCustomParam("shkd_bizdate"); //日期 - Object shkd_amtunit = formShowParameter.getCustomParam("shkd_amtunit"); //金额单位 - Object shkd_datevar = formShowParameter.getCustomParam("shkd_datevar"); //期限数 - Object shkd_datetype = formShowParameter.getCustomParam("shkd_datetype"); //期限类型 +// Object shkd_bizdate = formShowParameter.getCustomParam("shkd_bizdate"); //日期 +// Object shkd_amtunit = formShowParameter.getCustomParam("shkd_amtunit"); //金额单位 +// Object shkd_datevar = formShowParameter.getCustomParam("shkd_datevar"); //期限数 +// Object shkd_datetype = formShowParameter.getCustomParam("shkd_datetype"); //期限类型 Object shkd_datasel = formShowParameter.getCustomParam("shkd_datasel"); //数据查询维度 - Object shkd_startintdatecase = formShowParameter.getCustomParam("shkd_startintdatecase"); //借款时间开始 - Object shkd_startintdateend = formShowParameter.getCustomParam("shkd_startintdateend"); //借款时间结束 - Object shkd_expiredatecase = formShowParameter.getCustomParam("shkd_expiredatecase"); //到期时间开始 - Object shkd_expiredateend = formShowParameter.getCustomParam("shkd_expiredateend"); //到期时间结束 +// Object shkd_startintdatecase = formShowParameter.getCustomParam("shkd_startintdatecase"); //借款时间开始 +// Object shkd_startintdateend = formShowParameter.getCustomParam("shkd_startintdateend"); //借款时间结束 +// Object shkd_expiredatecase = formShowParameter.getCustomParam("shkd_expiredatecase"); //到期时间开始 +// Object shkd_expiredateend = formShowParameter.getCustomParam("shkd_expiredateend"); //到期时间结束 if (shkd_datasel != null) { - this.getView().getModel().setValue("shkd_bizdate", shkd_bizdate); - this.getView().getModel().setValue("shkd_amtunit", shkd_amtunit); - this.getView().getModel().setValue("shkd_datevar", shkd_datevar); - this.getView().getModel().setValue("shkd_datetype", shkd_datetype); +// this.getView().getModel().setValue("shkd_bizdate", shkd_bizdate); +// this.getView().getModel().setValue("shkd_amtunit", shkd_amtunit); +// this.getView().getModel().setValue("shkd_datevar", shkd_datevar); +// this.getView().getModel().setValue("shkd_datetype", shkd_datetype); this.getView().getModel().setValue("shkd_datasel", shkd_datasel); - this.getView().getModel().setValue("shkd_startintdatecase", shkd_startintdatecase); - this.getView().getModel().setValue("shkd_startintdateend", shkd_startintdateend); - this.getView().getModel().setValue("shkd_expiredatecase", shkd_expiredatecase); - this.getView().getModel().setValue("shkd_expiredateend", shkd_expiredateend); +// this.getView().getModel().setValue("shkd_startintdatecase", shkd_startintdatecase); +// this.getView().getModel().setValue("shkd_startintdateend", shkd_startintdateend); +// this.getView().getModel().setValue("shkd_expiredatecase", shkd_expiredatecase); +// this.getView().getModel().setValue("shkd_expiredateend", shkd_expiredateend); ReportFilter filter = this.getView().getControl("reportfilterap");//调用页面的自动查询 filter.search(); } @@ -121,7 +136,7 @@ public class InterestBearingFromListPlugin extends AbstractReportFormPlugin impl @Override public void registerListener(EventObject e) { super.registerListener(e); - this.addItemClickListeners("toolbarap"); + this.addItemClickListeners("toolbarap"); ReportList reportlistap = this.getView().getControl("reportlistap"); reportlistap.addHyperClickListener(this::hyperLinkClick); } @@ -138,17 +153,14 @@ public class InterestBearingFromListPlugin extends AbstractReportFormPlugin impl BigDecimal zhrzqxSum = BigDecimal.ZERO; //综合融资期限 if(dataSel == null || dataSel.toString().equals("data1")){ //计算综合融资成本(sum(单行本金*单行利率//总额))和综合融资期限 - for(int i = 0;i 0){ + DynamicObject infoData = rowData.get(0); //综合融资成本 - BigDecimal zhrzcb = infoData.getBigDecimal("zhrzcb"); - zhrzcbSum = zhrzcbSum.add(zhrzcb); + zhrzcbSum = infoData.getBigDecimal("sumzhrzcb"); //综合融资期限 - BigDecimal zhrzqx = infoData.getBigDecimal("zhrzqx"); - zhrzqxSum = zhrzqxSum.add(zhrzqx); + zhrzqxSum = infoData.getBigDecimal("sumzhrzqx"); //总金额 - BigDecimal drawamount = infoData.getBigDecimal("drawamount"); - drawamountSum = drawamountSum.add(drawamount); + drawamountSum = infoData.getBigDecimal("sumamt"); } }else if(!dataSel.toString().equals("datagp8") && !dataSel.toString().equals("data1")){ //不是数据汇总 且不是数据集 @@ -164,6 +176,39 @@ public class InterestBearingFromListPlugin extends AbstractReportFormPlugin impl this.getModel().setValue("shkd_sumamt",drawamountSum); } + @Override + public void itemClick(ItemClickEvent evt) { + super.itemClick(evt); + String itemKey = evt.getItemKey(); + if (StringUtil.equals("shkd_recalculatedamt", itemKey)) { //重算表头金额 + Object dataSel = this.getModel().getValue("shkd_datasel"); //数据查询维度 + BigDecimal drawamountSum = BigDecimal.ZERO; //金额汇总 + BigDecimal zhrzcbSum = BigDecimal.ZERO; //综合融资成本 + BigDecimal zhrzqxSum = BigDecimal.ZERO; //综合融资期限 + ReportList reportList= this.getView().getControl("reportlistap"); + int rowCount = reportList.getReportModel().getRowCount(); + //遍历所有行数据 + for (int index=1;index<=rowCount;index++) { + DynamicObject rowDataNew = reportList.getReportModel().getRowData(index); + if(dataSel == null || dataSel.toString().equals("data1")){ + //计算综合融资成本(sum(单行本金*单行利率//总额))和综合融资期限 + //综合融资成本 + zhrzcbSum = zhrzcbSum.add(rowDataNew.getBigDecimal("zhrzcb")); + //综合融资期限 + zhrzqxSum = zhrzqxSum.add(rowDataNew.getBigDecimal("zhrzqx")); + //总金额 + drawamountSum = drawamountSum.add(rowDataNew.getBigDecimal("drawamount")); + }else if(!dataSel.toString().equals("datagp8") && !dataSel.toString().equals("data1")){ + //总金额 + drawamountSum = drawamountSum.add(rowDataNew.getBigDecimal("sumamt")); + } + } + this.getModel().setValue("shkd_zhrzcb",zhrzcbSum); + this.getModel().setValue("shkd_zhrzqx",zhrzqxSum); + this.getModel().setValue("shkd_sumamt",drawamountSum); + } + } + @Override public void setMergeColums(List columns) { Object dataSel = this.getModel().getValue("shkd_datasel"); //数据查询维度 diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingRptListPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingRptListPlugin.java index 0014624..1c3e1da 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingRptListPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/report/InterestBearingRptListPlugin.java @@ -16,6 +16,7 @@ import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.util.StringUtils; import kd.tmc.fbp.common.constant.Constants; import kd.tmc.fbp.common.enums.BillStatusEnum; import kd.tmc.fbp.common.helper.GuaranteeUseHelper; @@ -57,6 +58,15 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { FilterItemInfo startDateEndFilter = filterInfo.getFilterItem("shkd_startintdateend"); //借款时间结束 FilterItemInfo expireDateCaseFilter = filterInfo.getFilterItem("shkd_expiredatecase"); //到期时间开始 FilterItemInfo expireDateEndFilter = filterInfo.getFilterItem("shkd_expiredateend"); //到期时间结束 + FilterItemInfo ejCompanyFilter = filterInfo.getFilterItem("shkd_ejcompany"); //二级公司 + FilterItemInfo rzztFilter = filterInfo.getFilterItem("shkd_rzzt"); //融资主体 + FilterItemInfo zqrzhFilter = filterInfo.getFilterItem("shkd_zqrzh"); //金融机构(债权人总行) + FilterItemInfo rzpzFilter = filterInfo.getFilterItem("shkd_rzpz"); //融资品种 + FilterItemInfo finproductFilter = filterInfo.getFilterItem("shkd_finproduct"); //融资品种明细 + FilterItemInfo rzqdFilter = filterInfo.getFilterItem("shkd_rzqd"); //融资渠道 + FilterItemInfo blxmFilter = filterInfo.getFilterItem("shkd_blxm"); //表列项目 + FilterItemInfo dybbkmmcFilter = filterInfo.getFilterItem("shkd_dybbkmmc"); //对应报表科目项目 + FilterItemInfo guaranteewayFilter = filterInfo.getFilterItem("shkd_guaranteeway"); //用信方式(担保) //下拉列表值查询不同类型数据 String amtUnit = null; //金额单位 yuan/qyuan/wyuan/bwyuan/yyuan @@ -68,6 +78,16 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { String startDateEnd = null; //借款时间结束 String expireDateCase = null; //到期时间开始 String expireDateEnd = null; //到期时间结束 + String whereEjCom = ""; //二级公司 + String whereRzzt = ""; //融资主体 + String whereZqrzh = ""; //金融机构(债权人总行) + String whereRzpz = ""; //融资品种 + String whereFinproduct = ""; //融资品种明细 + String whereRzqd = ""; //融资渠道 + String whereBlxm = ""; //表列项目 + String whereDybbkmmc = ""; //对应报表科目项目 + String whereGuaranteeway = ""; //用信方式(担保) + // 使用过滤条件创建QFilter if(bizDateFilter != null && bizDateFilter.getValue() != null){ bizDate = sdfDate.format(bizDateFilter.getValue()); //日期 @@ -98,6 +118,58 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { if(expireDateEndFilter != null && expireDateEndFilter.getValue() != null){ expireDateEnd = sdfDate.format(expireDateEndFilter.getValue()); //到期时间结束 } + //二级公司 + if(ejCompanyFilter != null && ejCompanyFilter.getValue() != null){ + DynamicObjectCollection erCom = (DynamicObjectCollection) ejCompanyFilter.getValue(); + for(int i = 0;i= '"+jdFirstDay+"'\n" + " AND to_char(t2.fstartintdate,'yyyy-MM-dd') <= '"+jdLastDay+"'\n" + " GROUP BY fk_shkd_blxm,t4.fname) s3 ON s1.shkd_blxm = s3.shkd_blxm AND s1.shkd_rzpzmx = s3.shkd_rzpzmx\n" + - " LEFT JOIN (\n" + + " LEFT JOIN (\n" + //本季度还款金额 " SELECT CASE \n" + " \tWHEN (t1.fk_shkd_blxm IS NULL OR t1.fk_shkd_blxm == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_blxm == '01') THEN '权益融资'\n" + " \tWHEN (t1.fk_shkd_blxm == '02') THEN '债务融资'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_blxm,ISNULL(t4.fname,'无') shkd_rzpzmx,sum(t5.frepayamount) sumamt\n" + " FROM t_cfm_loanbill t1 \n" + " INNER JOIN t_cfm_loanbill_e t2 ON t1.fid = t2.FID \n" + @@ -210,28 +285,30 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { " inner JOIN t_cfm_repaymentbill_loans t5 ON t1.fid = t5.floanbillid\n" + " inner JOIN t_cfm_repaymentbill t6 ON t5.fid = t6.fid\n" + " WHERE (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n" + + " AND (t1.fdrawtype = 'drawed' OR t1.fdrawtype = 'partpayment') \n"+ //业务状态取 已发行/已提款和已部分还款 " AND to_char(t6.fbizdate,'yyyy-MM-dd') >= '"+jdFirstDay+"'\n" + " AND to_char(t6.fbizdate,'yyyy-MM-dd') <= '"+jdLastDay+"'\n" + " GROUP BY fk_shkd_blxm,t4.fname) s4 ON s1.shkd_blxm = s4.shkd_blxm AND s1.shkd_rzpzmx = s4.shkd_rzpzmx\n" + - " LEFT JOIN (\n" + + " LEFT JOIN (\n" + //本年提款金额 " SELECT CASE \n" + " \tWHEN (t1.fk_shkd_blxm IS NULL OR t1.fk_shkd_blxm == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_blxm == '01') THEN '权益融资'\n" + " \tWHEN (t1.fk_shkd_blxm == '02') THEN '债务融资'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_blxm,ISNULL(t4.fname,'无') shkd_rzpzmx,sum(t1.fdrawamount) sumamt\n" + " FROM t_cfm_loanbill t1 \n" + " INNER JOIN t_cfm_loanbill_e t2 ON t1.fid = t2.FID \n" + " LEFT JOIN t_cfm_financingvarieties t4 ON t1.ffinproductid = t4.fid\n" + " WHERE (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n" + + " AND (t1.fdrawtype = 'drawed' OR t1.fdrawtype = 'partpayment') \n"+ //业务状态取 已发行/已提款和已部分还款 " AND to_char(t2.fstartintdate,'yyyy') = '"+year+"'\n" + " GROUP BY fk_shkd_blxm,t4.fname) s5 ON s1.shkd_blxm = s5.shkd_blxm AND s1.shkd_rzpzmx = s5.shkd_rzpzmx\n" + - " LEFT JOIN (\n" + + " LEFT JOIN (\n" + //本年还款金额 " SELECT CASE \n" + " \tWHEN (t1.fk_shkd_blxm IS NULL OR t1.fk_shkd_blxm == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_blxm == '01') THEN '权益融资'\n" + " \tWHEN (t1.fk_shkd_blxm == '02') THEN '债务融资'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_blxm,ISNULL(t4.fname,'无') shkd_rzpzmx,sum(t5.frepayamount) sumamt\n" + " FROM t_cfm_loanbill t1 \n" + " INNER JOIN t_cfm_loanbill_e t2 ON t1.fid = t2.FID \n" + @@ -239,20 +316,22 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { " inner JOIN t_cfm_repaymentbill_loans t5 ON t1.fid = t5.floanbillid\n" + " inner JOIN t_cfm_repaymentbill t6 ON t5.fid = t6.fid\n" + " WHERE (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n" + + " AND (t1.fdrawtype = 'drawed' OR t1.fdrawtype = 'partpayment') \n"+ //业务状态取 已发行/已提款和已部分还款 " AND to_char(t6.fbizdate,'yyyy') = '"+year+"'\n" + " GROUP BY fk_shkd_blxm,t4.fname) s6 ON s1.shkd_blxm = s6.shkd_blxm AND s1.shkd_rzpzmx = s6.shkd_rzpzmx\n" + - " LEFT JOIN (\n" + + " LEFT JOIN (\n" + //季度后未融资提款金额 " SELECT CASE \n" + " \tWHEN (t1.fk_shkd_blxm IS NULL OR t1.fk_shkd_blxm == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_blxm == '01') THEN '权益融资'\n" + " \tWHEN (t1.fk_shkd_blxm == '02') THEN '债务融资'\n" + - " \tELSE ''\n" + - " END shkd_blxm,ISNULL(t4.fname,'无') shkd_rzpzmx,sum(t1.fdrawamount) sumamt\n" + + " \tELSE ' '\n" + + " END shkd_blxm,ISNULL(t4.fname,'无') shkd_rzpzmx,sum(t1.fnotrepayamount) sumamt\n" + " FROM t_cfm_loanbill t1 \n" + " INNER JOIN t_cfm_loanbill_e t2 ON t1.fid = t2.FID \n" + " LEFT JOIN t_cfm_financingvarieties t4 ON t1.ffinproductid = t4.fid\n" + " WHERE (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n" + - " AND to_char(t2.fstartintdate,'yyyy-MM-dd') > '"+jdLastDay+"'\n" + + " AND (t1.fdrawtype = 'drawed' OR t1.fdrawtype = 'partpayment') \n"+ //业务状态取 已发行/已提款和已部分还款 + " AND to_char(t2.fstartintdate,'yyyy-MM-dd') <= '"+jdLastDay+"'\n" + " GROUP BY fk_shkd_blxm,t4.fname) s7 ON s1.shkd_blxm = s7.shkd_blxm AND s1.shkd_rzpzmx = s7.shkd_rzpzmx\n" + " ORDER BY s1.shkd_blxm,s1.shkd_rzpzmx"; DataSet dataSet = DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"), sql);//财务云 @@ -285,24 +364,29 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { * @param expireDateEnd 结束时间结束 * @return */ - private DataSet selDataRows(String amtUnit, String dateType, String dataSel, String startDateCase, String startDateEnd, String expireDateCase, String expireDateEnd) { + private DataSet selDataRows(String amtUnit, String dateType, String dataSel, String startDateCase, String startDateEnd, String expireDateCase, String expireDateEnd, + String whereEjCom,String whereRzzt,String whereZqrzh,String whereRzpz,String whereFinproduct,String whereRzqd,String whereBlxm,String whereDybbkmmc,String whereGuaranteeway) { DataSet selData = null; //业务单元数据集 DataSet orgDataSet = QueryServiceHelper.queryDataSet(this.getClass().getSimpleName(),"bos_org","id,number as orgnumber,name as orgname", null, null); // 查询提款处理和债券发行。这两PC布局属于一个单据 - String sql = "/*dialect*/ SELECT t1.FBILLNO shkd_billno,t1.fk_shkd_ejgs shkd_ejgs,t2.forgid orgid,t1.fk_shkd_zqrzh shkd_zqrzh,t2.ftextcreditor textcreditor,\n" + - " t5.fname shkd_rzpzmx,ISNULL(t7.fname,'无') shkd_rzpz,\n" + + String sql = "/*dialect*/ SELECT t1.FBILLNO shkd_billno,t1.fk_shkd_ejgs shkd_ejgs,t2.forgid orgid,\n" + + "CASE \n" + + " \tWHEN (t1.fk_shkd_zqrzh IS NULL OR t1.fk_shkd_rzqd == '') THEN ' '\n" + + " END shkd_zqrzh,\n" + + "t2.ftextcreditor textcreditor,\n" + + " ISNULL(t7.fname,'无') shkd_rzpz1,t5.fname shkd_rzpzmx,\n" + " CASE \n" + " \tWHEN (t1.fk_shkd_rzqd IS NULL OR t1.fk_shkd_rzqd == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_rzqd == '01') THEN '直接融资'\n" + " \tWHEN (t1.fk_shkd_rzqd == '02') THEN '间接融资'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_rzqd,\n" + " CASE \n" + " \tWHEN (t1.fk_shkd_blxm IS NULL OR t1.fk_shkd_blxm == ' ') THEN '无'\n" + " \tWHEN (t1.fk_shkd_blxm == '01') THEN '权益融资'\n" + " \tWHEN (t1.fk_shkd_blxm == '02') THEN '债务融资'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_blxm,\n" + " CASE \n" + " \tWHEN (t1.fk_shkd_dybbkmmc IS NULL OR t1.fk_shkd_dybbkmmc == ' ') THEN '无'\n" + @@ -318,7 +402,7 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { " \tWHEN (t1.fk_shkd_dybbkmmc == '10') THEN '其他应付款'\n" + " \tWHEN (t1.fk_shkd_dybbkmmc == '11') THEN '其他非流动负债'\n" + " \tWHEN (t1.fk_shkd_dybbkmmc == '12') THEN '租赁负债'\n" + - " \tELSE ''\n" + + " \tELSE ' '\n" + " END shkd_dybbkmmc,\n" + " t2.fterm term,\n" + " isnull(TIMESTAMPDIFF(day,t2.fstartintdate, t1.fexpiredate),0) xcday,\n" + @@ -341,6 +425,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { //亿元 sql +=" isnull(t1.fdrawamount,0)/100000000 drawamount,\n" ; } + sql +=" 0.01 sumamt,\n" ; + sql +=" 0.01 sumzhrzcb,\n" ; + sql +=" 0.01 sumzhrzqx,\n" ; sql +=" 0.01 zhrzcb,\n" ; sql +=" 0.01 zhrzqx,\n" ; sql +=" REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CASE \n" + @@ -382,7 +469,8 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { // " AND s1.fbillno = 'SIG5020000-DBHT-202502-0002'\n" + //---------------------担保合同编码条件 " GROUP BY s6.fgsrcbillno ) t6 ON t1.fbillno = t6.srcbillno\n" + " LEFT JOIN t_cfm_financingvarieties t7 ON t5.fparentid = t7.fid \n" + - " WHERE 1=1 AND (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n"; //贷款类型为 普通贷款,银团贷款,债券发行 + " WHERE 1=1 AND (t2.floantype = 'loan' OR t2.floantype = 'sl' OR t2.floantype = 'bond') \n"+ //贷款类型为 普通贷款,银团贷款,债券发行 + " AND (t1.fdrawtype = 'drawed' OR t1.fdrawtype = 'partpayment') \n"; //业务状态取 已发行/已提款和已部分还款 if(startDateCase != null){ sql += " and to_char(t2.fstartintdate,'yyyy-MM-dd') >= '"+ startDateCase +"'\n"; //起始时间大于等于选择的借款时间开始 } @@ -395,6 +483,33 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { if(expireDateEnd != null){ sql += " and to_char(t1.fexpiredate,'yyyy-MM-dd') <= '"+ expireDateEnd +"'\n"; //到期时间小于等于选择的到期时间结束 } + if(!StringUtils.isEmpty(whereEjCom)){ + sql += " and t1.fk_shkd_ejgs in ("+ whereEjCom.substring(1) +")\n"; //二级公司 + } + if(!StringUtils.isEmpty(whereRzzt)){ + sql += " and t2.forgid in ("+ whereRzzt.substring(1) +")\n"; //融资主体 + } + if(!StringUtils.isEmpty(whereZqrzh)){ + sql += " and t1.fk_shkd_zqrzh like '%"+ whereZqrzh +"%'\n"; //债权人总行 + } + if(!StringUtils.isEmpty(whereRzpz)){ + sql += " and t5.fparentid in ("+ whereRzpz.substring(1) +")\n"; //融资品种 + } + if(!StringUtils.isEmpty(whereFinproduct)){ + sql += " and t1.ffinproductid in ("+ whereFinproduct.substring(1) +")\n"; //融资品种明细 + } + if(!StringUtils.isEmpty(whereRzqd)){ + sql += " and t1.fk_shkd_rzqd in ("+ whereRzqd +")\n"; //融资渠道 + } + if(!StringUtils.isEmpty(whereBlxm)){ + sql += " and t1.fk_shkd_blxm in ("+ whereBlxm +")\n"; //表列项目 + } + if(!StringUtils.isEmpty(whereDybbkmmc)){ + sql += " and t1.fk_shkd_dybbkmmc in ("+ whereDybbkmmc +")\n"; //对应报表科目项目 + } + if(!StringUtils.isEmpty(whereGuaranteeway)){ + sql += " and t3.fguaranteeway in ("+ whereGuaranteeway +")\n"; //用信方式(担保) + } // if(bizDate != null){ // sql += " and to_char(t2.fstartintdate,'yyyy-MM-dd') <= '"+bizDate+"'\n"; //起始时间小于等于选择的时间 // sql += " and to_char(t1.fexpiredate,'yyyy-MM-dd') >= '"+bizDate+"'\n"; //到期时间大于等于选择的时间 @@ -419,14 +534,16 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { //数据表查询 DataSet dataRes = DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"), selSql);//财务云 JoinDataSet join1 = dataRes.join(orgDataSet, JoinType.LEFT);//连接二级组织 - DataSet dataRes1 = join1.on("shkd_ejgs","id").select(new String[]{"shkd_billno","orgname shkd_ejgs","orgid","shkd_zqrzh","textcreditor","shkd_rzpzmx","shkd_rzpz", - "shkd_rzqd","shkd_blxm","shkd_dybbkmmc","term","xcday","xcdate","startintdate","expiredate","drawamount","zhrzcb","zhrzqx","SubStr(guaranteeway, 1, LEN(guaranteeway)-2) guaranteeway", + DataSet dataRes1 = join1.on("shkd_ejgs","id").select(new String[]{"shkd_billno","orgname shkd_ejgs","orgid","shkd_zqrzh","textcreditor","shkd_rzpz1","shkd_rzpzmx", + "shkd_rzqd","shkd_blxm","shkd_dybbkmmc","term","xcday","xcdate","startintdate","expiredate","drawamount","sumamt","sumzhrzcb","sumzhrzqx","zhrzcb","zhrzqx","SubStr(guaranteeway, 1, LEN(guaranteeway)-2) guaranteeway", "dbwkm","dbwname","lilv","remark"}).finish(); JoinDataSet join2 = dataRes1.join(orgDataSet, JoinType.LEFT);//连接融资主体 - DataSet dataRes2 = join2.on("orgid","id").select(new String[]{"shkd_billno","shkd_ejgs","orgname orgid","shkd_zqrzh","textcreditor","shkd_rzpzmx","shkd_rzpz","shkd_rzqd", - "shkd_blxm","shkd_dybbkmmc","term","xcday","xcdate","startintdate","expiredate","drawamount","zhrzcb","zhrzqx","guaranteeway","dbwkm","dbwname","lilv","remark"}).finish(); + DataSet dataRes2 = join2.on("orgid","id").select(new String[]{"shkd_billno","shkd_ejgs","orgname orgid","shkd_zqrzh","textcreditor","shkd_rzpz1","shkd_rzpzmx","shkd_rzqd", + "shkd_blxm","shkd_dybbkmmc","term","xcday","xcdate","startintdate","expiredate","drawamount","sumamt","sumzhrzcb","sumzhrzqx","zhrzcb","zhrzqx","guaranteeway","dbwkm","dbwname","lilv","remark"}).finish(); //根据结果集重新计算两个日期相差的格式 DynamicObjectCollection srcCollection = ORM.create().toPlainDynamicObjectCollection(dataRes2.copy()); + BigDecimal sumCb = BigDecimal.ZERO; //综合融资成本 + BigDecimal sumQx = BigDecimal.ZERO; //综合融资期限 for(int i = 0;i 0){ selData = buildDataByObjCollection(srcCollection); @@ -507,23 +635,23 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { }else if(dataSel.equals("datagp6")){ //融资渠道汇总查询 (融资渠道+融资品种明细) String groupSql = "/*dialect*/ SELECT shkd_rzqd gpname,shkd_rzpzmx gpname1,sum(drawamount) sumamt,ROUND((sum(drawamount)/"+sumAmt+")*100,4) bili FROM ("+sql+") ss GROUP BY shkd_rzqd,shkd_rzpzmx order by shkd_rzqd,shkd_rzpzmx"; - //数据表查询 - DataSet dataSet = DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"), groupSql);//财务云 - // 分组后,进行合计(金额) - DataSet sumDataSet = dataSet.groupBy(new String[]{"gpname"}).sum("sumamt").sum("bili").finish(); - sumDataSet = sumDataSet.select("concat(gpname,'-金额合计') as gpname, sumamt,bili"); - // 由于分组计算之后,Dataset的字段少了一个,需要通过addField加回来,为之后union做准备 - sumDataSet = sumDataSet.addField("'-'", "gpname1"); - // 添加高亮字段,高亮字段将在界面规则里面生效 - dataSet = dataSet.addField("1", "shkd_light"); - sumDataSet = sumDataSet.addField("2", "shkd_light"); - // union前,需要保证两个dataSet的字段序列一致,因此这里对sumDataSet对象重新排列字段序列 - sumDataSet = sumDataSet.select("gpname,gpname1,sumamt,concat(bili,'%') bili,shkd_light"); - // union,此时sumDataSet会续在dataSet的底部 - dataSet = dataSet.select("gpname,gpname1,sumamt,concat(bili,'%') bili,shkd_light"); - DataSet unionDataSet = dataSet.union(sumDataSet); - // 按组织名称排序,这样,底部的合计数据,就会与上面的组织名称排在一起 - selData = unionDataSet.orderBy(new String[]{"gpname"}); + //数据表查询 + DataSet dataSet = DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"), groupSql);//财务云 + // 分组后,进行合计(金额) + DataSet sumDataSet = dataSet.groupBy(new String[]{"gpname"}).sum("sumamt").sum("bili").finish(); + sumDataSet = sumDataSet.select("concat(gpname,'-金额合计') as gpname, sumamt,bili"); + // 由于分组计算之后,Dataset的字段少了一个,需要通过addField加回来,为之后union做准备 + sumDataSet = sumDataSet.addField("'-'", "gpname1"); + // 添加高亮字段,高亮字段将在界面规则里面生效 + dataSet = dataSet.addField("1", "shkd_light"); + sumDataSet = sumDataSet.addField("2", "shkd_light"); + // union前,需要保证两个dataSet的字段序列一致,因此这里对sumDataSet对象重新排列字段序列 + sumDataSet = sumDataSet.select("gpname,gpname1,sumamt,concat(bili,'%') bili,shkd_light"); + // union,此时sumDataSet会续在dataSet的底部 + dataSet = dataSet.select("gpname,gpname1,sumamt,concat(bili,'%') bili,shkd_light"); + DataSet unionDataSet = dataSet.union(sumDataSet); + // 按组织名称排序,这样,底部的合计数据,就会与上面的组织名称排在一起 + selData = unionDataSet.orderBy(new String[]{"gpname"}); }else if(dataSel.equals("datagp7")){ //二级公司汇总查询 String groupSql = "/*dialect*/ SELECT shkd_ejgs,sum(drawamount) sumamt,concat(ROUND((sum(drawamount)/"+sumAmt+")*100,4) ,'%') bili FROM ("+sql+") ss GROUP BY shkd_ejgs"; @@ -584,7 +712,7 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { // } else if (field.equals("shkd_gdebtorg") || field.contains("gsrcbillid")) { // dataTypes.add(longType); // } else { - dataTypes.add(stringType); + dataTypes.add(stringType); // } } logger.info("dataTypes数据类型:{}", dataTypes); @@ -638,7 +766,7 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { columns.add(createReportColumn("orgid", "text", "融资主体名称")); columns.add(createReportColumn("shkd_zqrzh", "text", "金融机构")); columns.add(createReportColumn("textcreditor", "text", "金融机构支行")); - columns.add(createReportColumn("shkd_rzpz", "text", "融资品种")); + columns.add(createReportColumn("shkd_rzpz1", "text", "融资品种")); columns.add(createReportColumn("shkd_rzpzmx", "text", "融资品种明细")); columns.add(createReportColumn("shkd_rzqd", "text", "融资渠道")); columns.add(createReportColumn("shkd_blxm", "text", "表列项目")); @@ -677,6 +805,15 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin { columns.add(createReportColumn("dbwname", "text", "担保物名称")); columns.add(createReportColumn("lilv", "text", "利率")); columns.add(createReportColumn("remark", "text", "备注")); + ReportColumn sumamt = createReportColumn("sumamt", "text", "总金额"); + sumamt.setHide(true); //隐藏是否高亮字段 + columns.add(sumamt); + ReportColumn sumzhrzcb = createReportColumn("sumzhrzcb", "text", "总综合融资成本"); + sumzhrzcb.setHide(true); //隐藏是否高亮字段 + columns.add(sumzhrzcb); + ReportColumn sumzhrzqx = createReportColumn("sumzhrzqx", "text", "总综合融资期限"); + sumzhrzqx.setHide(true); //隐藏是否高亮字段 + columns.add(sumzhrzqx); }else if(dateSel.equals("datagp8")){ //数据汇总表查询 columns.add(createReportColumn("shkd_blxmgp", "text", "融资大类"));