From bef247de72485381d57f9b38cf8996442f863db3 Mon Sep 17 00:00:00 2001 From: zengweihai Date: Wed, 7 Aug 2024 12:03:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AF=B9=E5=85=AC=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E5=86=B2=E9=94=80=E5=90=8E=E9=87=91=E9=A2=9D=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/GenerateSKClickPlugln.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/GenerateSKClickPlugln.java b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/GenerateSKClickPlugln.java index 8e2efae..21593cd 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/GenerateSKClickPlugln.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/GenerateSKClickPlugln.java @@ -9,6 +9,7 @@ import kd.bos.form.control.EntryGrid; import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.operate.FormOperate; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; @@ -91,6 +92,42 @@ public class GenerateSKClickPlugln extends AbstractBillPlugIn implements Plugin @Override public void beforeDoOperation(BeforeDoOperationEventArgs args) { super.beforeDoOperation(args); + FormOperate formOperate = (FormOperate)args.getSource(); + String operateKey = formOperate.getOperateKey(); + if ("save".equals(operateKey) || "submit".equals(operateKey)){ + DynamicObject shkd_billtypefield = this.getModel().getDataEntity().getDynamicObject("shkd_billtypefield"); + if (!"er_publicreimbursebill_BT_03".equals(shkd_billtypefield.getString("number"))){ + DynamicObjectCollection writeoffmoney = this.getModel().getEntryEntity("writeoffmoney"); + if (writeoffmoney.size() > 0){ + DynamicObject dynamicObject = writeoffmoney.get(0); + BigDecimal accloanamount = dynamicObject.getBigDecimal("accloanamount");//获取冲销金额 + if (accloanamount != null){ + DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity"); + if (expenseentryentity.size() > 0){ + DynamicObject dynamicObject1 = expenseentryentity.get(0); + BigDecimal expenseamount = dynamicObject1.getBigDecimal("expenseamount");//获取报销金额 + if (expenseamount != null){ + dynamicObject1.set("shkd_verification",expenseamount.subtract(accloanamount)); + this.getView().updateView("expenseentryentity"); + } + } + } + }else { + DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity"); + if (expenseentryentity.size() > 0){ + DynamicObject dynamicObject1 = expenseentryentity.get(0); + BigDecimal expenseamount = dynamicObject1.getBigDecimal("expenseamount");//获取报销金额 + if (expenseamount != null){ + dynamicObject1.set("shkd_verification",expenseamount); + this.getView().updateView("expenseentryentity"); + } + } + } + } + + } + + } @Override From 61dbe850d2798440976bbd4d8d517ef92b3f5e98 Mon Sep 17 00:00:00 2001 From: zengweihai Date: Thu, 8 Aug 2024 10:57:00 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B5=84=E9=87=91=E6=97=A5=E8=A1=A8?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/data/CapitalDayListDataPlugin.java | 80 +++++-------------- 1 file changed, 18 insertions(+), 62 deletions(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java index 0440040..6c26354 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java @@ -87,6 +87,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple BigDecimal recTotal = BigDecimal.ZERO; //总计 期间收入合计 BigDecimal payLB = BigDecimal.ZERO; //内部往来,支出合计 BigDecimal recLB = BigDecimal.ZERO; //内部往来 期间收入合计 + BigDecimal payNet = BigDecimal.ZERO;//支出净额 + BigDecimal recNet = BigDecimal.ZERO;//收入净额 for (int i = 0; i < cas_cashmgtinits.length; i++) { //若是集团,需要在第一行拼接第一行的数据 if("group".equals(shkd_queryorgtype)&&i == 0){ @@ -119,7 +121,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple //逻辑1:查询该公司到查询时间的所有付款单 QFilter bef_payQF = new QFilter("billstatus", QCP.equals, "D"); bef_payQF.and("org.id",QCP.equals,orgPkValue); - bef_payQF.and("paydate",QCP.large_equals,begindate); + bef_payQF.and("bizdate",QCP.large_equals,begindate);//付款日期paydate if (firstDate == null){//没有设置时间,则查询今日记账,即查询期间开始到今日之前的所有付款单据 firstDate = new Date(); } @@ -130,7 +132,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple bef_payQF.and("currency.id",QCP.equals,orgcurrencyId); } Date startDate = this.getStartDate(firstDate);//过滤条件-开始日期 - bef_payQF.and("paydate","<",startDate); + bef_payQF.and("bizdate","<",startDate); DynamicObject[] bef_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency", bef_payQF.toArray()); for (DynamicObject bef_cas_paybill : bef_cas_paybills) { String payNumber = bef_cas_paybill.getDynamicObject("org").getString("number"); @@ -151,8 +153,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple bef_recQF.and("currency.id",QCP.equals,orgcurrencyId); } bef_recQF.and("org.id",QCP.equals,orgPkValue); - bef_recQF.and("payeedate",QCP.large_equals,begindate); - bef_recQF.and("payeedate","<",startDate); + bef_recQF.and("bizdate",QCP.large_equals,begindate);//收款日期payeedate + bef_recQF.and("bizdate","<",startDate); DynamicObject[] cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency", bef_recQF.toArray()); for (DynamicObject cas_recbill : cas_recbills) { BigDecimal actrecamt = cas_recbill.getBigDecimal("actrecamt"); @@ -178,8 +180,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple if (orgcurrency != null){ per_recQF.and("currency.id",QCP.equals,orgcurrencyId); } - per_recQF.and("payeedate",QCP.large_equals,startDate); - per_recQF.and("payeedate",QCP.less_equals,overDate); + per_recQF.and("bizdate",QCP.large_equals,startDate);//收款日期payeedate + per_recQF.and("bizdate",QCP.less_equals,overDate); DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7", per_recQF.toArray()); BigDecimal transactions = this.getTransactions(per_cas_recbills); recLB =recLB.add(transactions); //内部往来收入合计 @@ -199,8 +201,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple per_payQF.and("currency.id",QCP.equals,orgcurrencyId); } per_payQF.and("org.id",QCP.equals,orgPkValue); - per_payQF.and("paydate",QCP.large_equals,startDate); - per_payQF.and("paydate",QCP.less_equals,overDate); + per_payQF.and("bizdate",QCP.large_equals,startDate);//付款日期paydate + per_payQF.and("bizdate",QCP.less_equals,overDate); DynamicObject[] per_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency,payeetype,payee", per_payQF.toArray()); BigDecimal transactionsByfk = this.getTransactionsByfk(per_cas_paybills); payLB =payLB.add(transactionsByfk); //内部往来收入合计 @@ -234,64 +236,18 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple firmParam[4] = payTotal; //今日收入合计 firmParams.add(firmParam); - Object[] firmParam2 = new Object[7];//存放公司数据 + Object[] firmParam2 = new Object[7];//存放内部往来数据 firmParam2[1] = "内部往来"; - firmParam2[3] = recLB; //今日收入合计 - firmParam2[4] = payLB; //今日收入合计 + firmParam2[3] = recLB; //收入(内部往来)合计 + firmParam2[4] = payLB; //支出(内部往来)合计 firmParams.add(firmParam2); //内部收支净额的组装 - + Object[] firmParam3 = new Object[7];//存放内部往来数据 + firmParam3[1] = "收支净额"; + firmParam3[3] = recTotal.subtract(recLB); //收入(内部往来)合计 + firmParam3[4] = payTotal.subtract(payLB); //支出(内部往来)合计 + firmParams.add(firmParam3); } - - - -// Map>> firm_accMap = new HashMap>>(cas_cashmgtinits.length);//总体公司银行账户集合数据 -// for (DynamicObject cas_cashmgtinit : cas_cashmgtinits) { -// DynamicObject org = cas_cashmgtinit.getDynamicObject("org"); -// String name = org.getString("name"); -// List> firm_banks = new ArrayList>();//银行账户集合 -// DynamicObjectCollection entrybank = cas_cashmgtinit.getDynamicObjectCollection("entrybank"); -// for (DynamicObject dynamicObject : entrybank) { -// Map bankInfo = new HashMap();//单个银行数据信息 -// bankInfo.put("bank_accountbank_id",dynamicObject.getDynamicObject("bank_accountbank").getLong("id")); -// bankInfo.put("bank_journalbalance",dynamicObject.getBigDecimal("bank_journalbalance")); -// bankInfo.put("bank_journalsumbalanceadj",dynamicObject.getBigDecimal("bank_journalsumbalanceadj")); -// firm_banks.add(bankInfo); -// } -// firm_accMap.put(name,firm_banks); -// } - - - //2、查询所有收款处理单据数据cas_recbill org收款人(公司) accountbank银行账号 actrecamt收款金额 - - - //3、查询所有付款处理单据数据 org付款人(公司) payeracctbank银行账号 payeename收款人名称 payeebanknum收款账号 actpayamt付款金额 -// QFilter payQF = new QFilter(); -// BusinessDataServiceHelper.load("cas_paybill",) - - -// Collection coll= new ArrayList(); -// for (int i = 0;i < 3 ;i++ ){ -// Object[] values = new Object[fileNames.length]; -// values[0] = i+1; -// values[1] = "公司"+i; -// values[2] = 10+(int)Math.floor(Math.random()*100); -// values[3] = 10+(int)Math.floor(Math.random()*100); -// values[4] = 10+(int)Math.floor(Math.random()*100); -// values[5] = 10+(int)Math.floor(Math.random()*100); -// coll.add(values); -// } -// BigDecimal sum1 = BigDecimal.ZERO; -// BigDecimal sum2 = BigDecimal.ZERO; -// for (Object[] objects : coll) { -// sum1 = sum1.add(new BigDecimal(objects[3].toString())); -// sum2 = sum2.add(new BigDecimal(objects[4].toString())); -// } -// Object[] obj = new Object[fileNames.length]; -// obj[1] = "期间汇总"; -// obj[3] = sum1; -// obj[4] = sum2; -// coll.add(obj); if (firmParams != null){ RowMeta row = RowMetaFactory.createRowMeta(fileNames, dataTypes); CollectionInput inputs = new CollectionInput(row, firmParams); From dc644ca9757ab17688c9d166ad6e70d7b20159a3 Mon Sep 17 00:00:00 2001 From: zengweihai Date: Fri, 9 Aug 2024 11:22:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B5=84=E9=87=91=E6=97=A5=E8=A1=A8?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/data/CapitalDayListDataPlugin.java | 341 ++++++++++-------- .../report/form/CapitalDayFormListPlugin.java | 40 ++ 2 files changed, 225 insertions(+), 156 deletions(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java index 6c26354..c2d5a76 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java @@ -9,6 +9,7 @@ import kd.bos.entity.report.FilterItemInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; +import kd.bos.orm.ORM; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; @@ -33,32 +34,169 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple @Override public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable { + String[] fileNames = {"shkd_ordinal","shkd_company","shkd_init_original","shkd_income_original","shkd_expend_original", + "shkd_period_original","shkd_currencyfield"};//字段标识数组 + DataType[] dataTypes = {DataType.StringType,DataType.StringType,DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType, + DataType.BigDecimalType,DataType.LongType};//字段类型数组 + //获取过滤条件集合 Map paramMap = this.transQueryParam(reportQueryParam); DynamicObjectCollection companys = (DynamicObjectCollection)paramMap.get("shkd_filter_company");//使用组织集合 DynamicObjectCollection groups = (DynamicObjectCollection)paramMap.get("shkd_filter_group");//使用组织集合 String shkd_queryorgtype = paramMap.get("shkd_queryorgtype").toString();//使用组织集合 - ArrayList longs = new ArrayList<>(); - String groupName = null; - //如果查询是查的集团,然后想要查询需查询下级及下级所有公司的id - if("group".equals(shkd_queryorgtype)){ - ArrayList grouplongs = new ArrayList<>(); - for (DynamicObject group : groups) { - groupName = group.getString("name"); - grouplongs.add(group.getLong("id")); - } - List allSubordinateOrgs = OrgUnitServiceHelper.getAllSubordinateOrgs(8L, grouplongs, true); - longs.addAll(allSubordinateOrgs); - }else{ - for (DynamicObject company : companys) { - longs.add(company.getLong("id")); - } - } - + Collection firmParams = null ; Date firstDate = (Date)paramMap.get("shkd_firstdate");//开始时间 Date endDate = (Date)paramMap.get("shkd_enddate");//结束时间 DynamicObject orgcurrency = (DynamicObject) paramMap.get("shkd_orgcurrency"); DynamicObject exratetable = (DynamicObject) paramMap.get("shkd_exratetable"); + ArrayList longs = new ArrayList<>(); + String groupName = null; + //如果查询是查的集团,然后想要查询需查询下级及下级所有公司的id + if("group".equals(shkd_queryorgtype)){ + for (DynamicObject group : groups) { + longs.clear();//清除数据 + ArrayList grouplongs = new ArrayList<>(); + groupName = group.getString("name"); + grouplongs.add(group.getLong("id")); + List allSubordinateOrgs = OrgUnitServiceHelper.getAllSubordinateOrgs(8L, grouplongs, true); + String shkd_iscontainyy = paramMap.get("shkd_iscontainyy").toString();//是否包含榆叶 + if ("0".equals(shkd_iscontainyy)){ + for (Long allSubordinateOrg : allSubordinateOrgs) { + DynamicObject bos_org = BusinessDataServiceHelper.loadSingle(allSubordinateOrg, "bos_org"); + String shkd_affiliation = bos_org.getString("shkd_affiliation"); + if ("1".equals(shkd_affiliation)){ + longs.add(allSubordinateOrg); + } + } + firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable); + }else { + longs.addAll(allSubordinateOrgs); + firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable); + } + } + }else{ + for (DynamicObject company : companys) { + longs.add(company.getLong("id")); + } + firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,null,longs,firstDate,endDate,orgcurrency,exratetable); + + } + + int i = 0; + if(firmParams != null && firmParams.size() > 0){ + for (Object[] firmParam : firmParams) { + firmParam[0] = i+1; + i++; + } + } + RowMeta row = RowMetaFactory.createRowMeta(fileNames, dataTypes); + CollectionInput inputs = new CollectionInput(row, firmParams); + DataSet resultDataSet = Algo.create(this.getClass().getName()).createDataSet(inputs); + return resultDataSet; + } + + protected Map transQueryParam(ReportQueryParam param) { + Map paramMap = new HashMap(param.getFilter().getFilterItems().size()); + Iterator var3 = param.getFilter().getFilterItems().iterator(); + + while(var3.hasNext()) { + FilterItemInfo filterItem = (FilterItemInfo)var3.next(); + paramMap.put(filterItem.getPropName(), filterItem.getValue()); + } + + return paramMap; + } + + public Date getStartDate (Date date){ + LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDateTime startOfDay = LocalDateTime.of(localDate, LocalTime.MIN); + Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); + return startDate; + } + + public Date getEndDate (Date date){ + LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDateTime startOfDay = LocalDateTime.of(localDate, LocalTime.MAX); + Date endOfDay = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); + return endOfDay; + } + //内部往来收款单组装 + public BigDecimal getTransactions(DynamicObject[] per_cas_recbills){ + BigDecimal recAmountTotal = BigDecimal.ZERO; + for (DynamicObject per_cas_recbill : per_cas_recbills) { + //查询收款单,为内部往来的公司 + String payertype = per_cas_recbill.getString("payertype");//付款人类型 + if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ + if("bd_supplier".equals(payertype)){ + DynamicObject f7_payer = per_cas_recbill.getDynamicObject("f7_payer");//供应商 + long id = f7_payer.getLong("id"); + QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); + per_recQF.and("org.id",QCP.equals,id); + DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if(internal_company==null){ + continue; + } + + } else if ("bd_customer".equals(payertype)) { + DynamicObject customerf7 = per_cas_recbill.getDynamicObject("customerf7");//供应商 + long id = customerf7.getLong("id"); + QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); + per_recQF.and("org.id",QCP.equals,id); + DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if(internal_company==null){ + continue; + } + } + BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt"); + recAmountTotal = recAmountTotal.add(actrecamt);//添加收入金额 + + } + } + return recAmountTotal; + } + + //内部往来付款合计 + public BigDecimal getTransactionsByfk(DynamicObject[] per_cas_paybills){ + BigDecimal perPayAmountTotal = BigDecimal.ZERO; + for (DynamicObject per_cas_paybill : per_cas_paybills) { + //查询收款单,为内部往来的公司 + String payertype = per_cas_paybill.getString("payeetype");//收款人款人类型 + Long payerid = per_cas_paybill.getLong("payee");//供应商 + + if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ + if("bd_supplier".equals(payertype)){ + QFilter per_recQF = new QFilter("id",QCP.equals,payerid); + DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if(internal_company==null){ + continue; + } + + } else if ("bd_customer".equals(payertype)) { + QFilter per_recQF = new QFilter("org.id",QCP.equals,payerid); + DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if(internal_company==null){ + continue; + } + } + String payNumber = per_cas_paybill.getDynamicObject("org").getString("number"); + String recNumber = per_cas_paybill.getString("payeenumber"); + BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt"); + perPayAmountTotal = perPayAmountTotal.add(actpayamt); + if (payNumber.equals(recNumber)){//当付款编码同收款编码时 + perPayAmountTotal = perPayAmountTotal.add(actpayamt);//补充收款数据 + } + + + } + } + return perPayAmountTotal; + } + + public Collection addFirmParams(String shkd_queryorgtype, Collection firmParams, String groupName, List longs, Date firstDate,Date endDate,DynamicObject orgcurrency, DynamicObject exratetable){ Long orgcurrencyId = null; Long exratetableId = null; if (orgcurrency != null){ @@ -69,18 +207,12 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple } // Long currency = ((DynamicObject)paramMap.get("orgcurrency")).getLong("id");//币别 // Long exchangeRateTableId = ((DynamicObject)paramMap.get("exratetable")).getLong("id");//汇率表 - - String[] fileNames = {"shkd_ordinal","shkd_company","shkd_init_original","shkd_income_original","shkd_expend_original", - "shkd_period_original","shkd_currencyfield"};//字段标识数组 - DataType[] dataTypes = {DataType.StringType,DataType.StringType,DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType, - DataType.BigDecimalType,DataType.LongType};//字段类型数组 //查询已出纳初始化的公司 QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户 accQF.and("org.id",QCP.in,longs); // accQF.and("org.name",QCP.equals,"上海挚新私募基金管理有限公司"); DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," + "entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray()); - Collection firmParams = null; if (cas_cashmgtinits != null){ firmParams = new ArrayList(cas_cashmgtinits.length);//多公司数据集合 BigDecimal payTotal = BigDecimal.ZERO; //总计 期间支出合计 @@ -89,14 +221,14 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple BigDecimal recLB = BigDecimal.ZERO; //内部往来 期间收入合计 BigDecimal payNet = BigDecimal.ZERO;//支出净额 BigDecimal recNet = BigDecimal.ZERO;//收入净额 + //若是集团,需要在第一行拼接第一行的数据 + if("group".equals(shkd_queryorgtype)&& cas_cashmgtinits.length > 0){ + Object[] firmParam = new Object[7];//存放公司数据 + firmParam[1] = groupName;//存放集团名称,先优先考虑单集团的凭借 + firmParams.add(firmParam); + } + for (int i = 0; i < cas_cashmgtinits.length; i++) { - //若是集团,需要在第一行拼接第一行的数据 - if("group".equals(shkd_queryorgtype)&&i == 0){ - Object[] firmParam = new Object[7];//存放公司数据 - firmParam[0] = i;//存放序号 - firmParam[1] = groupName;//存放集团名称,先优先考虑单集团的凭借 - firmParams.add(firmParam); - } DynamicObject startperiod = cas_cashmgtinits[i].getDynamicObject("startperiod"); if (startperiod != null){ Object pkValue = startperiod.getPkValue(); @@ -107,7 +239,6 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple Object[] firmParam = new Object[7];//存放公司数据 String name = org.getString("name"); Object orgPkValue = org.getPkValue(); - firmParam[0] = i+1;//存放序号 firmParam[1] = name;//存放公司名称 //获取初始金额之和及日记账余额之和 DynamicObjectCollection entrybank = cas_cashmgtinits[i].getDynamicObjectCollection("entrybank"); @@ -229,133 +360,31 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple } } - //总计行的组装 - Object[] firmParam = new Object[7];//存放公司数据 - firmParam[1] = "总计"; - firmParam[3] = recTotal; //今日收入合计 - firmParam[4] = payTotal; //今日收入合计 - firmParams.add(firmParam); + if ("group".equals(shkd_queryorgtype)&& cas_cashmgtinits.length > 0){ + //总计行的组装 + Object[] firmParam = new Object[7];//存放公司数据 + firmParam[1] = "总计"; + firmParam[3] = recTotal; //今日收入合计 + firmParam[4] = payTotal; //今日收入合计 + firmParams.add(firmParam); - Object[] firmParam2 = new Object[7];//存放内部往来数据 - firmParam2[1] = "内部往来"; - firmParam2[3] = recLB; //收入(内部往来)合计 - firmParam2[4] = payLB; //支出(内部往来)合计 - firmParams.add(firmParam2); - //内部收支净额的组装 - Object[] firmParam3 = new Object[7];//存放内部往来数据 - firmParam3[1] = "收支净额"; - firmParam3[3] = recTotal.subtract(recLB); //收入(内部往来)合计 - firmParam3[4] = payTotal.subtract(payLB); //支出(内部往来)合计 - firmParams.add(firmParam3); - } - if (firmParams != null){ - RowMeta row = RowMetaFactory.createRowMeta(fileNames, dataTypes); - CollectionInput inputs = new CollectionInput(row, firmParams); - DataSet resultDataSet = Algo.create(this.getClass().getName()).createDataSet(inputs); - return resultDataSet; + Object[] firmParam2 = new Object[7];//存放内部往来数据 + firmParam2[1] = "内部往来"; + firmParam2[3] = recLB; //收入(内部往来)合计 + firmParam2[4] = payLB; //支出(内部往来)合计 + firmParams.add(firmParam2); + //内部收支净额的组装 + Object[] firmParam3 = new Object[7];//存放内部往来数据 + firmParam3[1] = "收支净额"; + recNet = recTotal.subtract(recLB);//收入净额 + payNet = payTotal.subtract(payLB);//支出净额 + firmParam3[3] = recNet; //收入(内部往来)合计 + firmParam3[4] = payNet; //支出(内部往来)合计 + firmParams.add(firmParam3); + } + return firmParams; } + return null; - - } - - protected Map transQueryParam(ReportQueryParam param) { - Map paramMap = new HashMap(param.getFilter().getFilterItems().size()); - Iterator var3 = param.getFilter().getFilterItems().iterator(); - - while(var3.hasNext()) { - FilterItemInfo filterItem = (FilterItemInfo)var3.next(); - paramMap.put(filterItem.getPropName(), filterItem.getValue()); - } - - return paramMap; - } - - public Date getStartDate (Date date){ - LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); - LocalDateTime startOfDay = LocalDateTime.of(localDate, LocalTime.MIN); - Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); - return startDate; - } - - public Date getEndDate (Date date){ - LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); - LocalDateTime startOfDay = LocalDateTime.of(localDate, LocalTime.MAX); - Date endOfDay = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); - return endOfDay; - } - //内部往来收款单组装 - public BigDecimal getTransactions(DynamicObject[] per_cas_recbills){ - BigDecimal recAmountTotal = BigDecimal.ZERO; - for (DynamicObject per_cas_recbill : per_cas_recbills) { - //查询收款单,为内部往来的公司 - String payertype = per_cas_recbill.getString("payertype");//付款人类型 - if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ - if("bd_supplier".equals(payertype)){ - DynamicObject f7_payer = per_cas_recbill.getDynamicObject("f7_payer");//供应商 - long id = f7_payer.getLong("id"); - QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); - per_recQF.and("org.id",QCP.equals,id); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ - continue; - } - - } else if ("bd_customer".equals(payertype)) { - DynamicObject customerf7 = per_cas_recbill.getDynamicObject("customerf7");//供应商 - long id = customerf7.getLong("id"); - QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); - per_recQF.and("org.id",QCP.equals,id); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ - continue; - } - } - BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt"); - recAmountTotal = recAmountTotal.add(actrecamt);//添加收入金额 - - } - } - return recAmountTotal; - } - - //内部往来付款合计 - public BigDecimal getTransactionsByfk(DynamicObject[] per_cas_paybills){ - BigDecimal perPayAmountTotal = BigDecimal.ZERO; - for (DynamicObject per_cas_paybill : per_cas_paybills) { - //查询收款单,为内部往来的公司 - String payertype = per_cas_paybill.getString("payeetype");//收款人款人类型 - Long payerid = per_cas_paybill.getLong("payee");//供应商 - - if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ - if("bd_supplier".equals(payertype)){ - QFilter per_recQF = new QFilter("id",QCP.equals,payerid); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ - continue; - } - - } else if ("bd_customer".equals(payertype)) { - QFilter per_recQF = new QFilter("org.id",QCP.equals,payerid); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ - continue; - } - } - String payNumber = per_cas_paybill.getDynamicObject("org").getString("number"); - String recNumber = per_cas_paybill.getString("payeenumber"); - BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt"); - perPayAmountTotal = perPayAmountTotal.add(actpayamt); - if (payNumber.equals(recNumber)){//当付款编码同收款编码时 - perPayAmountTotal = perPayAmountTotal.add(actpayamt);//补充收款数据 - } - - - } - } - return perPayAmountTotal; } } diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java index 601d45f..336e20a 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java @@ -1,8 +1,11 @@ package shkd.fi.cas.report.form; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.resource.ResManager; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.entity.report.FilterInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.filter.FilterColumn; import kd.bos.form.control.events.FilterContainerInitEvent; @@ -52,6 +55,7 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement String shkd_queryorgtype = (String) this.getModel().getValue("shkd_queryorgtype"); if ("company".equals(shkd_queryorgtype)){ this.getView().setVisible(false,"shkd_filter_group"); + this.getView().setVisible(false,"shkd_iscontainyy"); }else if ("group".equals(shkd_queryorgtype)){ this.getView().setVisible(false,"shkd_filter_company"); } @@ -89,12 +93,48 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement if ("company".equals(newValue)){ this.getModel().setValue("shkd_filter_group",null); this.getView().setVisible(false,"shkd_filter_group"); + this.getView().setVisible(false,"shkd_iscontainyy"); this.getView().setVisible(true,"shkd_filter_company"); }else if ("group".equals(newValue)){ this.getModel().setValue("shkd_filter_company",null); this.getView().setVisible(false,"shkd_filter_company"); this.getView().setVisible(true,"shkd_filter_group"); + this.getView().setVisible(true,"shkd_iscontainyy"); } } } + + /** + * 校验过滤条件 + * @param queryParam + * @return + */ + @Override + public boolean verifyQuery(ReportQueryParam queryParam) { + FilterInfo filterInfo = queryParam.getFilter(); + String shkd_queryorgtype = (String)this.getModel().getValue("shkd_queryorgtype"); + if (filterInfo != null) { + // 判断集团或公司是否为空 + if("company".equals(shkd_queryorgtype)){//当类型为公司时,校验使用公司不为空 + DynamicObjectCollection company = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company"); + if (company == null || company.isEmpty()){ + this.getView().showTipNotification("使用公司条件不能为空!"); + return false; + } + }else if ("group".equals(shkd_queryorgtype)){//当类型为集团时,校验使用集团不为空 + DynamicObjectCollection group = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_group"); + if (group == null || group.isEmpty()){ + this.getView().showTipNotification("使用集团条件不能为空!"); + return false; + } + } + //判断币别不为空 +// DynamicObject shkd_orgcurrency = (DynamicObject)filterInfo.getValue("shkd_orgcurrency"); +// if (shkd_orgcurrency == null) { +// this.getView().showTipNotification("币别不能为空!"); +// return false; +// } + } + return super.verifyQuery(queryParam); + } } \ No newline at end of file From a9153d934271926dddb11a14d1f0f487923ca38b Mon Sep 17 00:00:00 2001 From: zengweihai Date: Thu, 15 Aug 2024 10:22:24 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B5=84=E9=87=91=E6=97=A5=E8=A1=A8?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/data/CapitalDayListDataPlugin.java | 186 +++++++++++------- .../report/form/CapitalDayFormListPlugin.java | 108 +++++----- 2 files changed, 179 insertions(+), 115 deletions(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java index c2d5a76..f0d5069 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java @@ -41,47 +41,39 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple //获取过滤条件集合 Map paramMap = this.transQueryParam(reportQueryParam); - DynamicObjectCollection companys = (DynamicObjectCollection)paramMap.get("shkd_filter_company");//使用组织集合 - DynamicObjectCollection groups = (DynamicObjectCollection)paramMap.get("shkd_filter_group");//使用组织集合 + DynamicObjectCollection companys = (DynamicObjectCollection)paramMap.get("shkd_filter_company");//使用=组织集合 +// DynamicObjectCollection groups = (DynamicObjectCollection)paramMap.get("shkd_filter_group");//使用组织集合 String shkd_queryorgtype = paramMap.get("shkd_queryorgtype").toString();//使用组织集合 Collection firmParams = null ; Date firstDate = (Date)paramMap.get("shkd_firstdate");//开始时间 Date endDate = (Date)paramMap.get("shkd_enddate");//结束时间 DynamicObject orgcurrency = (DynamicObject) paramMap.get("shkd_orgcurrency"); DynamicObject exratetable = (DynamicObject) paramMap.get("shkd_exratetable"); - ArrayList longs = new ArrayList<>(); String groupName = null; + + HashMap> groupMap = new HashMap<>();//集团id集合 + for (DynamicObject company : companys) { + long companyId = company.getLong("id"); + List supGroupIds = OrgUnitServiceHelper.getSuperiorOrgs("08", companyId); + Long aLong = supGroupIds.get(0); + ArrayList companyList = null; + if (groupMap.containsKey(aLong)){ + companyList = groupMap.get(aLong); + }else { + companyList = new ArrayList<>(); + } + companyList.add(companyId); + groupMap.put(aLong,companyList); + } //如果查询是查的集团,然后想要查询需查询下级及下级所有公司的id if("group".equals(shkd_queryorgtype)){ - for (DynamicObject group : groups) { - longs.clear();//清除数据 - ArrayList grouplongs = new ArrayList<>(); - groupName = group.getString("name"); - grouplongs.add(group.getLong("id")); - List allSubordinateOrgs = OrgUnitServiceHelper.getAllSubordinateOrgs(8L, grouplongs, true); - String shkd_iscontainyy = paramMap.get("shkd_iscontainyy").toString();//是否包含榆叶 - if ("0".equals(shkd_iscontainyy)){ - for (Long allSubordinateOrg : allSubordinateOrgs) { - DynamicObject bos_org = BusinessDataServiceHelper.loadSingle(allSubordinateOrg, "bos_org"); - String shkd_affiliation = bos_org.getString("shkd_affiliation"); - if ("1".equals(shkd_affiliation)){ - longs.add(allSubordinateOrg); - } - } - firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable); - }else { - longs.addAll(allSubordinateOrgs); - firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable); - } + for (Long key : groupMap.keySet()){ + DynamicObject bos_org_group = BusinessDataServiceHelper.loadSingle(key, "bos_org"); + groupName = bos_org_group.getString("name"); + ArrayList longs = groupMap.get(key); + firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable); } - }else{ - for (DynamicObject company : companys) { - longs.add(company.getLong("id")); - } - firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,null,longs,firstDate,endDate,orgcurrency,exratetable); - } - int i = 0; if(firmParams != null && firmParams.size() > 0){ for (Object[] firmParam : firmParams) { @@ -126,29 +118,45 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple for (DynamicObject per_cas_recbill : per_cas_recbills) { //查询收款单,为内部往来的公司 String payertype = per_cas_recbill.getString("payertype");//付款人类型 + Long payerid = per_cas_recbill.getLong("payer");//收款人id + //判断是否内部,不是则跳过该循环 if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ if("bd_supplier".equals(payertype)){ - DynamicObject f7_payer = per_cas_recbill.getDynamicObject("f7_payer");//供应商 - long id = f7_payer.getLong("id"); - QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); - per_recQF.and("org.id",QCP.equals,id); + QFilter per_recQF = new QFilter("id", QCP.equals, payerid); DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ + if(bd_supplier != null){ + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if (internal_company != null){ + if (isYuYe(internal_company.getLong("id"))){ + continue; + } + }else { + continue; + } + }else { continue; } - } else if ("bd_customer".equals(payertype)) { - DynamicObject customerf7 = per_cas_recbill.getDynamicObject("customerf7");//供应商 - long id = customerf7.getLong("id"); - QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D"); - per_recQF.and("org.id",QCP.equals,id); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ + QFilter per_recQF = new QFilter("id", QCP.equals, payerid); + DynamicObject bd_customer = BusinessDataServiceHelper.loadSingle("bd_customer", "id,number,internal_company", per_recQF.toArray()); + if (bd_customer != null){ + DynamicObject internal_company = bd_customer.getDynamicObject("internal_company"); + if (internal_company != null){ + if (isYuYe(internal_company.getLong("id"))){ + continue; + } + }else { + continue; + } + }else { + continue; + } + }else { + if (isYuYe(payerid)){ continue; } } + //是内部往来,累计金额 BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt"); recAmountTotal = recAmountTotal.add(actrecamt);//添加收入金额 @@ -158,42 +166,82 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple } //内部往来付款合计 - public BigDecimal getTransactionsByfk(DynamicObject[] per_cas_paybills){ + public HashMap getTransactionsByfk(DynamicObject[] per_cas_paybills){ + HashMap stringBigDecimalHashMap = new HashMap<>(); BigDecimal perPayAmountTotal = BigDecimal.ZERO; + BigDecimal addRecAmountTotal = BigDecimal.ZERO; for (DynamicObject per_cas_paybill : per_cas_paybills) { //查询收款单,为内部往来的公司 String payertype = per_cas_paybill.getString("payeetype");//收款人款人类型 - Long payerid = per_cas_paybill.getLong("payee");//供应商 - + Long payerid = per_cas_paybill.getLong("payee");//收款人id + //判断是否内部,不是则跳过该循环 if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){ if("bd_supplier".equals(payertype)){ QFilter per_recQF = new QFilter("id",QCP.equals,payerid); DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ + if (bd_supplier != null){ + DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); + if (internal_company != null){ + if (isYuYe(internal_company.getLong("id"))){ + continue; + } + }else { + continue; + } + }else { continue; } - } else if ("bd_customer".equals(payertype)) { - QFilter per_recQF = new QFilter("org.id",QCP.equals,payerid); - DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray()); - DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company"); - if(internal_company==null){ + QFilter per_recQF = new QFilter("id",QCP.equals,payerid); + DynamicObject bd_customer = BusinessDataServiceHelper.loadSingle("bd_customer", "id,number,internal_company", per_recQF.toArray()); + if (bd_customer != null){ + DynamicObject internal_company = bd_customer.getDynamicObject("internal_company"); + if (internal_company != null){ + if (isYuYe(internal_company.getLong("id"))){ + continue; + } + }else { + continue; + } + }else { + continue; + } + }else{ + if (isYuYe(payerid)){ continue; } } + //是内部往来,累计金额 String payNumber = per_cas_paybill.getDynamicObject("org").getString("number"); String recNumber = per_cas_paybill.getString("payeenumber"); BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt"); perPayAmountTotal = perPayAmountTotal.add(actpayamt); if (payNumber.equals(recNumber)){//当付款编码同收款编码时 - perPayAmountTotal = perPayAmountTotal.add(actpayamt);//补充收款数据 + addRecAmountTotal = addRecAmountTotal.add(actpayamt);//补充收款数据 } - - } } - return perPayAmountTotal; + stringBigDecimalHashMap.put("pay",perPayAmountTotal); + stringBigDecimalHashMap.put("rec",addRecAmountTotal); + return stringBigDecimalHashMap; + } + + /** + * 判断是否为榆叶系公司 + * @param id + * @return + */ + public boolean isYuYe(Long id){ + DynamicObject bos_org = BusinessDataServiceHelper.loadSingle(id, "bos_org"); + if (bos_org != null){ + String shkd_affiliation = bos_org.getString("shkd_affiliation"); + if ("0".equals(shkd_affiliation)){ + return true; + }else { + return false; + } + } + return false; } public Collection addFirmParams(String shkd_queryorgtype, Collection firmParams, String groupName, List longs, Date firstDate,Date endDate,DynamicObject orgcurrency, DynamicObject exratetable){ @@ -252,7 +300,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple //逻辑1:查询该公司到查询时间的所有付款单 QFilter bef_payQF = new QFilter("billstatus", QCP.equals, "D"); bef_payQF.and("org.id",QCP.equals,orgPkValue); - bef_payQF.and("bizdate",QCP.large_equals,begindate);//付款日期paydate + bef_payQF.and("paydate",QCP.large_equals,begindate);//付款日期paydate 业务日期bizdate if (firstDate == null){//没有设置时间,则查询今日记账,即查询期间开始到今日之前的所有付款单据 firstDate = new Date(); } @@ -263,7 +311,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple bef_payQF.and("currency.id",QCP.equals,orgcurrencyId); } Date startDate = this.getStartDate(firstDate);//过滤条件-开始日期 - bef_payQF.and("bizdate","<",startDate); + bef_payQF.and("paydate","<",startDate); DynamicObject[] bef_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency", bef_payQF.toArray()); for (DynamicObject bef_cas_paybill : bef_cas_paybills) { String payNumber = bef_cas_paybill.getDynamicObject("org").getString("number"); @@ -284,8 +332,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple bef_recQF.and("currency.id",QCP.equals,orgcurrencyId); } bef_recQF.and("org.id",QCP.equals,orgPkValue); - bef_recQF.and("bizdate",QCP.large_equals,begindate);//收款日期payeedate - bef_recQF.and("bizdate","<",startDate); + bef_recQF.and("payeedate",QCP.large_equals,begindate);//收款日期payeedate 业务日期bizdate + bef_recQF.and("payeedate","<",startDate); DynamicObject[] cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency", bef_recQF.toArray()); for (DynamicObject cas_recbill : cas_recbills) { BigDecimal actrecamt = cas_recbill.getBigDecimal("actrecamt"); @@ -311,8 +359,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple if (orgcurrency != null){ per_recQF.and("currency.id",QCP.equals,orgcurrencyId); } - per_recQF.and("bizdate",QCP.large_equals,startDate);//收款日期payeedate - per_recQF.and("bizdate",QCP.less_equals,overDate); + per_recQF.and("payeedate",QCP.large_equals,startDate);//收款日期payeedate 业务日期bizdate + per_recQF.and("payeedate",QCP.less_equals,overDate); DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7", per_recQF.toArray()); BigDecimal transactions = this.getTransactions(per_cas_recbills); recLB =recLB.add(transactions); //内部往来收入合计 @@ -332,12 +380,12 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple per_payQF.and("currency.id",QCP.equals,orgcurrencyId); } per_payQF.and("org.id",QCP.equals,orgPkValue); - per_payQF.and("bizdate",QCP.large_equals,startDate);//付款日期paydate - per_payQF.and("bizdate",QCP.less_equals,overDate); + per_payQF.and("paydate",QCP.large_equals,startDate);//付款日期paydate 业务日期bizdate + per_payQF.and("paydate",QCP.less_equals,overDate); DynamicObject[] per_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency,payeetype,payee", per_payQF.toArray()); - BigDecimal transactionsByfk = this.getTransactionsByfk(per_cas_paybills); - payLB =payLB.add(transactionsByfk); //内部往来收入合计 - + HashMap stringBigDecimalHashMap = this.getTransactionsByfk(per_cas_paybills); + payLB =payLB.add(stringBigDecimalHashMap.get("pay")); //内部往来支出合计 + recLB = recLB.add(stringBigDecimalHashMap.get("rec"));//内部往来收入合计(同公司收入补充) for (DynamicObject per_cas_paybill : per_cas_paybills) { String payNumber = per_cas_paybill.getDynamicObject("org").getString("number"); String recNumber = per_cas_paybill.getString("payeenumber"); diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java index 336e20a..3cf3fea 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/form/CapitalDayFormListPlugin.java @@ -19,12 +19,15 @@ import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.report.plugin.AbstractReportFormPlugin; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.sdk.plugin.Plugin; +import java.sql.Array; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.EventObject; +import java.util.List; /** * 报表界面插件 @@ -51,14 +54,14 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement //设置日期范围初始值 this.getModel().setValue("shkd_firstdate",new Date()); this.getModel().setValue("shkd_enddate",new Date()); - //始化公司集团字段显影控制 - String shkd_queryorgtype = (String) this.getModel().getValue("shkd_queryorgtype"); - if ("company".equals(shkd_queryorgtype)){ - this.getView().setVisible(false,"shkd_filter_group"); - this.getView().setVisible(false,"shkd_iscontainyy"); - }else if ("group".equals(shkd_queryorgtype)){ - this.getView().setVisible(false,"shkd_filter_company"); - } + //始化公司集团字段显影控制,逻辑变更代码取消 +// String shkd_queryorgtype = (String) this.getModel().getValue("shkd_queryorgtype"); +// if ("company".equals(shkd_queryorgtype)){ +// this.getView().setVisible(false,"shkd_filter_group"); +// this.getView().setVisible(false,"shkd_iscontainyy"); +// }else if ("group".equals(shkd_queryorgtype)){ +// this.getView().setVisible(false,"shkd_filter_company"); +// } } @@ -66,42 +69,54 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) { String name = beforeF7SelectEvent.getProperty().getName(); if ("shkd_filter_company".equals(name)){ - QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户 - DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," + - "entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray()); - ArrayList orgIds = new ArrayList<>(); - for (DynamicObject cas_cashmgtinit : cas_cashmgtinits) { - orgIds.add( cas_cashmgtinit.getLong("org.id")); + QFilter orgQF = new QFilter("orgpattern.number",QCP.equals,"Orgform02"); + DynamicObject[] loads = BusinessDataServiceHelper.load("bos_org", "id", orgQF.toArray()); + List longs = new ArrayList<>(); + for (DynamicObject load : loads) { + long id = load.getLong("id"); + longs.add(id); } - ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter(); - QFilter payment_qf= new QFilter("id",QCP.in,orgIds); - formShowParameter.getListFilterParameter().setFilter(payment_qf); - }else if ("shkd_filter_group".equals(name)){ - QFilter orgpattern_qf= new QFilter("orgpattern.number",QCP.equals, "Orgform01"); - ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter(); - formShowParameter.getListFilterParameter().setFilter(orgpattern_qf); + if (longs.size() > 0){ + QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户 + accQF.and("org.id",QCP.in,longs); + DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," + + "entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray()); + ArrayList orgIds = new ArrayList<>(); + for (DynamicObject cas_cashmgtinit : cas_cashmgtinits) { + orgIds.add( cas_cashmgtinit.getLong("org.id")); + } + ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter(); + QFilter payment_qf= new QFilter("id",QCP.in,orgIds); + formShowParameter.getListFilterParameter().setFilter(payment_qf); + } + } +// else if ("shkd_filter_group".equals(name)){ +// QFilter orgpattern_qf= new QFilter("orgpattern.number",QCP.equals, "Orgform01"); +// ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter(); +// formShowParameter.getListFilterParameter().setFilter(orgpattern_qf); +// } } @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); - String name = e.getProperty().getName(); - if ("shkd_queryorgtype".equals(name)){ - ChangeData[] changeSet = e.getChangeSet(); - Object newValue = changeSet[0].getNewValue(); - if ("company".equals(newValue)){ - this.getModel().setValue("shkd_filter_group",null); - this.getView().setVisible(false,"shkd_filter_group"); - this.getView().setVisible(false,"shkd_iscontainyy"); - this.getView().setVisible(true,"shkd_filter_company"); - }else if ("group".equals(newValue)){ - this.getModel().setValue("shkd_filter_company",null); - this.getView().setVisible(false,"shkd_filter_company"); - this.getView().setVisible(true,"shkd_filter_group"); - this.getView().setVisible(true,"shkd_iscontainyy"); - } - } +// String name = e.getProperty().getName(); +// if ("shkd_queryorgtype".equals(name)){ +// ChangeData[] changeSet = e.getChangeSet(); +// Object newValue = changeSet[0].getNewValue(); +// if ("company".equals(newValue)){ +// this.getModel().setValue("shkd_filter_group",null); +// this.getView().setVisible(false,"shkd_filter_group"); +// this.getView().setVisible(false,"shkd_iscontainyy"); +// this.getView().setVisible(true,"shkd_filter_company"); +// }else if ("group".equals(newValue)){ +// this.getModel().setValue("shkd_filter_company",null); +// this.getView().setVisible(false,"shkd_filter_company"); +// this.getView().setVisible(true,"shkd_filter_group"); +// this.getView().setVisible(true,"shkd_iscontainyy"); +// } +// } } /** @@ -115,16 +130,17 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement String shkd_queryorgtype = (String)this.getModel().getValue("shkd_queryorgtype"); if (filterInfo != null) { // 判断集团或公司是否为空 - if("company".equals(shkd_queryorgtype)){//当类型为公司时,校验使用公司不为空 - DynamicObjectCollection company = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company"); - if (company == null || company.isEmpty()){ - this.getView().showTipNotification("使用公司条件不能为空!"); - return false; - } - }else if ("group".equals(shkd_queryorgtype)){//当类型为集团时,校验使用集团不为空 - DynamicObjectCollection group = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_group"); +// if("company".equals(shkd_queryorgtype)){//当类型为公司时,校验使用公司不为空 +// DynamicObjectCollection company = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company"); +// if (company == null || company.isEmpty()){ +// this.getView().showTipNotification("使用公司条件不能为空!"); +// return false; +// } +// }else + if ("group".equals(shkd_queryorgtype)){//当类型为集团时,校验使用集团不为空 + DynamicObjectCollection group = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company"); if (group == null || group.isEmpty()){ - this.getView().showTipNotification("使用集团条件不能为空!"); + this.getView().showTipNotification("使用公司条件不能为空!"); return false; } } From 06de226f5931555fa25c6dffafb34c84099a45cb Mon Sep 17 00:00:00 2001 From: zengweihai Date: Thu, 15 Aug 2024 10:53:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B5=84=E9=87=91=E6=97=A5=E8=A1=A8?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java index f0d5069..6bfe319 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/cas/report/data/CapitalDayListDataPlugin.java @@ -361,7 +361,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple } per_recQF.and("payeedate",QCP.large_equals,startDate);//收款日期payeedate 业务日期bizdate per_recQF.and("payeedate",QCP.less_equals,overDate); - DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7", per_recQF.toArray()); + DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7,payer", per_recQF.toArray()); BigDecimal transactions = this.getTransactions(per_cas_recbills); recLB =recLB.add(transactions); //内部往来收入合计