|
@@ -0,0 +1,181 @@
|
|
|
+package kd.cosmic.jkjt.tmc.cfm.report.data;
|
|
|
+
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
|
|
+import kd.bos.dataentity.resource.ResManager;
|
|
|
+import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
+import kd.bos.entity.report.FilterInfo;
|
|
|
+import kd.bos.entity.report.ReportQueryParam;
|
|
|
+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.servicehelper.BusinessDataServiceHelper;
|
|
|
+import kd.tmc.cfm.report.form.RepaymentFormListPlugin;
|
|
|
+import kd.tmc.cfm.report.helper.ReportCommonHelper;
|
|
|
+import kd.tmc.fbp.common.util.EmptyUtil;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 插件说明:报表插件,扩展标准报表,增加字段
|
|
|
+ * 表单标识:融资动态查询明细表(nckd_cfm_tradefinanc_ext1)
|
|
|
+ * @author wanghaiwu_kd
|
|
|
+ * @date 2024/01/04
|
|
|
+ */
|
|
|
+public class RepaymentFormExtListPlugin extends RepaymentFormListPlugin {
|
|
|
+ public void processRowData(String gridPK, DynamicObjectCollection rowData, ReportQueryParam queryParam) {
|
|
|
+ super.processRowData(gridPK, rowData, queryParam);
|
|
|
+
|
|
|
+ if(rowData != null && rowData.size() > 0) {
|
|
|
+
|
|
|
+ List<String> loanNos = (List) rowData.stream().map((s) -> {
|
|
|
+ return s.getString("billno");
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, DynamicObject> mapLoan = new HashMap<>();
|
|
|
+
|
|
|
+ QFilter qFilter = new QFilter("billno", QCP.in, loanNos);
|
|
|
+ DynamicObject[] loanArray = BusinessDataServiceHelper.load("cfm_loanbill", "id, billno, nckd_provitype", qFilter.toArray());
|
|
|
+ for (DynamicObject loan : loanArray) {
|
|
|
+ mapLoan.put(loan.getString("billno"), loan);
|
|
|
+ }
|
|
|
+
|
|
|
+ Iterator<DynamicObject> iterator = rowData.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ DynamicObject row = iterator.next();
|
|
|
+
|
|
|
+ //调配类型
|
|
|
+ String billno = row.getString("billno");
|
|
|
+ if (mapLoan.get(billno) != null) {
|
|
|
+ row.set("nckd_provitype", mapLoan.get(billno).getString("nckd_provitype"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeQuery(ReportQueryParam param) {
|
|
|
+ ReportShowParameter formShowParameter = (ReportShowParameter)this.getView().getFormShowParameter();
|
|
|
+ Map<String, Object> customParams = formShowParameter.getCustomParams();
|
|
|
+ Map<String, QFilter> commFilters = null;
|
|
|
+ if (!EmptyUtil.isEmpty(customParams.get("commFilters"))) {
|
|
|
+ commFilters = (Map) SerializationUtils.deSerializeFromBase64((String)customParams.get("commFilters"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != commFilters) {
|
|
|
+ param.getFilter().setCommFilter(commFilters);
|
|
|
+ }
|
|
|
+
|
|
|
+ FilterInfo filter = param.getFilter();
|
|
|
+ String statdim = (String)this.getModel().getValue("filter_statdim");
|
|
|
+ param.getFilter().addFilterItem("statdim", statdim);
|
|
|
+ this.initQueryColumn(statdim);
|
|
|
+ if ("bdim_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ param.getCustomParam().put("isloanbillbondonly", true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("fl_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ param.getCustomParam().put("isloanbillflonly", true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("homelink".equals(customParams.get("showtype"))) {
|
|
|
+ param.getFilter().addFilterItem("accountbank", customParams.get("accountbank"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initQueryColumn(String statdim) {
|
|
|
+ String[] fields = null;
|
|
|
+ String currency = ResManager.loadKDString("借款币别", "RepaymentFormListPlugin_7", "tmc-cfm-report", new Object[0]);
|
|
|
+ String bizDate = ResManager.loadKDString("放款日期", "RepaymentFormListPlugin_10", "tmc-cfm-report", new Object[0]);
|
|
|
+ if ("bdim_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ currency = ResManager.loadKDString("发行币别", "RepaymentFormListPlugin_24", "tmc-cfm-report", new Object[0]);
|
|
|
+ bizDate = ResManager.loadKDString("发行日期", "RepaymentFormListPlugin_25", "tmc-cfm-report", new Object[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ String finproduct = ResManager.loadKDString("债券类型", "RepaymentFormListPlugin_0", "tmc-cfm-report", new Object[0]);
|
|
|
+ if (!"bdim_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ finproduct = ResManager.loadKDString("融资品种", "RepaymentFormListPlugin_33", "tmc-cfm-report", new Object[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ String finorginfo = ResManager.loadKDString("债权人", "RepaymentFormListPlugin_1", "tmc-cfm-report", new Object[0]);
|
|
|
+ String paymenttype = ResManager.loadKDString("付款类型", "RepaymentFormListPlugin_2", "tmc-cfm-report", new Object[0]);
|
|
|
+ String exrepaydate = ResManager.loadKDString("预计付款日期", "RepaymentFormListPlugin_3", "tmc-cfm-report", new Object[0]);
|
|
|
+ String cny_original = ResManager.loadKDString("业务币别", "RepaymentFormListPlugin_23", "tmc-cfm-report", new Object[0]);
|
|
|
+ String examount_original = ResManager.loadKDString("预计付款金额(原币)", "RepaymentFormListPlugin_4", "tmc-cfm-report", new Object[0]);
|
|
|
+ String examount = ResManager.loadKDString("预计付款金额(统计币)", "RepaymentFormListPlugin_22", "tmc-cfm-report", new Object[0]);
|
|
|
+ String notrepayamt_original = ResManager.loadKDString("未还本金(原币)", "RepaymentFormListPlugin_30", "tmc-cfm-report", new Object[0]);
|
|
|
+ String notrepayamt = ResManager.loadKDString("未还本金(统计币)", "RepaymentFormListPlugin_31", "tmc-cfm-report", new Object[0]);
|
|
|
+ String company = ResManager.loadKDString("借款人", "RepaymentFormListPlugin_5", "tmc-cfm-report", new Object[0]);
|
|
|
+ String project = ResManager.loadKDString("项目", "RepaymentFormListPlugin_6", "tmc-cfm-report", new Object[0]);
|
|
|
+ String contractbillno = ResManager.loadKDString("合同编号", "RepaymentFormListPlugin_42", "tmc-cfm-report", new Object[0]);
|
|
|
+ String contractno = ResManager.loadKDString("合同号", "RepaymentFormListPlugin_43", "tmc-cfm-report", new Object[0]);
|
|
|
+ String billno = String.format(ResManager.loadKDString("%s单", "RepaymentFormListPlugin_8", "tmc-cfm-report", new Object[0]), this.getString());
|
|
|
+ String drawamount_original = String.format(ResManager.loadKDString("%s金额(原币)", "RepaymentFormListPlugin_26", "tmc-cfm-report", new Object[0]), this.getString());
|
|
|
+ String drawamount = String.format(ResManager.loadKDString("%s金额(统计币)", "RepaymentFormListPlugin_9", "tmc-cfm-report", new Object[0]), this.getString());
|
|
|
+ String expiredate = ResManager.loadKDString("到期日期", "RepaymentFormListPlugin_11", "tmc-cfm-report", new Object[0]);
|
|
|
+ String sumlevel = ResManager.loadKDString("排序", "RepaymentFormListPlugin_12", "tmc-cfm-report", new Object[0]);
|
|
|
+ String cny = ResManager.loadKDString("币别", "RepaymentFormListPlugin_13", "tmc-cfm-report", new Object[0]);
|
|
|
+ if ("fl_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ currency = ResManager.loadKDString("币别", "RepaymentFormListPlugin_13", "tmc-cfm-report", new Object[0]);
|
|
|
+ cny = ResManager.loadKDString("折算币别", "RepaymentFormListPlugin_37", "tmc-cfm-report", new Object[0]);
|
|
|
+ bizDate = ResManager.loadKDString("回款日期", "RepaymentFormListPlugin_38", "tmc-cfm-report", new Object[0]);
|
|
|
+ finorginfo = ResManager.loadKDString("出租人", "RepaymentFormListPlugin_39", "tmc-cfm-report", new Object[0]);
|
|
|
+ company = ResManager.loadKDString("承租人", "RepaymentFormListPlugin_40", "tmc-cfm-report", new Object[0]);
|
|
|
+ contractbillno = ResManager.loadKDString("融资租赁合同单号", "RepaymentFormListPlugin_44", "tmc-cfm-report", new Object[0]);
|
|
|
+ contractno = ResManager.loadKDString("融资合同号", "RepaymentFormListPlugin_45", "tmc-cfm-report", new Object[0]);
|
|
|
+ billno = ResManager.loadKDString("售后租回回款单", "RepaymentFormListPlugin_34", "tmc-cfm-report", new Object[0]);
|
|
|
+ drawamount_original = ResManager.loadKDString("金额(原币)", "RepaymentFormListPlugin_35", "tmc-cfm-report", new Object[0]);
|
|
|
+ drawamount = ResManager.loadKDString("金额(统计币)", "RepaymentFormListPlugin_36", "tmc-cfm-report", new Object[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //二开字段,调配类型
|
|
|
+ String nckd_provitype = ResManager.loadKDString("调配类型", "RepaymentFormListPlugin_39", "tmc-cfm-report", new Object[0]);
|
|
|
+
|
|
|
+ switch (statdim) {
|
|
|
+ case "finproductfinorginfo":
|
|
|
+ fields = new String[]{finproduct, finorginfo, paymenttype, "season", "year", "month", exrepaydate, cny_original, examount_original, examount, notrepayamt_original, notrepayamt, company, project, currency, contractbillno, contractno, billno, nckd_provitype, drawamount_original, drawamount, bizDate, expiredate, sumlevel, "seasonSort", "monthSort", cny, "finproductid"};
|
|
|
+ this.rebuildColumn(fields);
|
|
|
+ break;
|
|
|
+ case "finproductfinorgcomp":
|
|
|
+ fields = new String[]{finproduct, finorginfo, company, paymenttype, "season", "year", "month", exrepaydate, cny_original, examount_original, examount, notrepayamt_original, notrepayamt, project, currency, contractbillno, contractno, billno, nckd_provitype, drawamount_original, drawamount, bizDate, expiredate, sumlevel, "seasonSort", "monthSort", cny, "finproductid"};
|
|
|
+ this.rebuildColumn(fields);
|
|
|
+ break;
|
|
|
+ case "company":
|
|
|
+ fields = new String[]{company, paymenttype, "season", "year", "month", exrepaydate, cny_original, examount_original, examount, notrepayamt_original, notrepayamt, finorginfo, finproduct, project, currency, contractbillno, contractno, billno, nckd_provitype, drawamount_original, drawamount, bizDate, expiredate, sumlevel, "seasonSort", "monthSort", cny, "finproductid"};
|
|
|
+ this.rebuildColumn(fields);
|
|
|
+ break;
|
|
|
+ case "finorginfo":
|
|
|
+ fields = new String[]{finorginfo, paymenttype, "season", "year", "month", exrepaydate, cny_original, examount_original, examount, notrepayamt_original, notrepayamt, company, finproduct, project, currency, contractbillno, contractno, billno, nckd_provitype, drawamount_original, drawamount, bizDate, expiredate, sumlevel, "seasonSort", "monthSort", cny, "finproductid"};
|
|
|
+ this.rebuildColumn(fields);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void rebuildColumn(String[] fields) {
|
|
|
+ if (!EmptyUtil.isEmpty(fields)) {
|
|
|
+ String monthSort = ResManager.loadKDString("月排序", "RepaymentFormListPlugin_18", "tmc-cfm-report", new Object[0]);
|
|
|
+ String seasonSort = ResManager.loadKDString("季排序", "RepaymentFormListPlugin_19", "tmc-cfm-report", new Object[0]);
|
|
|
+ List<String> fieIdList = new ArrayList(Arrays.asList(fields));
|
|
|
+ fieIdList.add(monthSort);
|
|
|
+ fieIdList.add(seasonSort);
|
|
|
+ ReportList listTable = (ReportList)this.getView().getControl("reportlistap");
|
|
|
+ ReportCommonHelper.rebuildColumn((String[])fieIdList.toArray(new String[fieIdList.size()]), listTable);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getString() {
|
|
|
+ String drowAmountColumnName = ResManager.loadKDString("提款", "RepaymentFormListPlugin_27", "tmc-cfm-report", new Object[0]);
|
|
|
+ if ("bdim_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ drowAmountColumnName = ResManager.loadKDString("发行", "RepaymentFormListPlugin_28", "tmc-cfm-report", new Object[0]);
|
|
|
+ } else if ("fl_repaymentwarnrpt".equals(this.getView().getFormShowParameter().getFormId())) {
|
|
|
+ drowAmountColumnName = ResManager.loadKDString("回款", "RepaymentFormListPlugin_41", "tmc-cfm-report", new Object[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return drowAmountColumnName;
|
|
|
+ }
|
|
|
+}
|