From 260fb1525beb1862d8276feeb406f2ea7d727219 Mon Sep 17 00:00:00 2001 From: zhangzhiguo Date: Tue, 24 Dec 2024 17:03:06 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E5=AE=A1=E6=89=B9=E4=BA=BA?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=98=AF=E6=8F=90=E4=BA=A4=E4=BA=BA=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=202.=E4=BF=AE=E6=94=B9=E5=8F=B0=E8=B4=A6=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/operate/ApprovalCheckFlowOp.java | 72 +++++++++++ .../report/BudgetActuRptListPlugin.java | 54 +++----- .../report/FeeDeductionRptListPlugin.java | 27 +++- .../report/FeeDeductionRptQueryPlugin.java | 104 +++++++++++----- .../report/PositionFeesRptListPlugin.java | 35 +++--- .../fs/plugin/report/VisitRptListPlugin.java | 115 ++++++++++++++++++ .../fs/plugin/report/VisitRptQueryPlugin.java | 11 +- .../workflow/ApprovalCheckFlowPlugin.java | 27 ++++ 8 files changed, 350 insertions(+), 95 deletions(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptListPlugin.java create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/workflow/ApprovalCheckFlowPlugin.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java new file mode 100644 index 0000000..b45c5eb --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java @@ -0,0 +1,72 @@ +package zcgj.zcdev.zcdev.fs.plugin.operate; + +import kd.bos.algo.DataSet; +import kd.bos.algo.Row; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; +import kd.bos.servicehelper.workflow.WorkflowServiceHelper; +import kd.bos.workflow.api.AgentExecution; +import kd.bos.workflow.component.approvalrecord.IApprovalRecordGroup; +import kd.bos.workflow.engine.extitf.IWorkflowPlugin; + +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.*; + +/** + * 判断当前审批人是否为提交人 + * 综合岗和项目经理发起的报销,本人点提交提示必须执行转交 + */ +public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { + + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.getValidators().add(new ApprovalCheckFlowOp.ValidatorExt()); + } + + class ValidatorExt extends AbstractValidator { + @Override + public void validate() { + ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + + //当前提交的探亲单据id集合 + for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + String billId = dataEntity.getString("id"); + String formid = dataEntity.getString("formid"); + //获取报销人 + //DynamicObject applier = dataEntity.getDynamicObject("applier"); + //long applierId = applier.getLong("id"); + boolean isOk = true; + //所有审批记录,从审批记录中获取已经审批过的人 + List allApprovalRecords = WorkflowServiceHelper.getApprovalRecords(formid, billId, true); + for (IApprovalRecordGroup allApprovalRecord : allApprovalRecords) { + String groupDecisionType = allApprovalRecord.getGroupDecisionType(); + //过滤提交的和待分配的任务 + if("submit".equals(groupDecisionType)){ //获取每个节点的审批类型 提交:submit + Long userId = allApprovalRecord.getChildren().get(0).getUserId();//获取每个节点的审批人 + if(currentUserId.equals(userId) ){//如果审批不是提交人,则可以进行审批操作 + isOk = false; + } + } + } + if(!isOk){ + this.addFatalErrorMessage(extendedDataEntity, "当前操作人为单据提交人,无法进行审批操作,请转给他人进行审批!"); + return; + } + + } + } + } + +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptListPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptListPlugin.java index 314f123..07bdb65 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptListPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptListPlugin.java @@ -8,6 +8,7 @@ import kd.bos.entity.report.FilterInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.form.MessageTypes; import kd.bos.report.events.CellStyleRule; +import kd.bos.report.events.SortAndFilterEvent; import kd.bos.report.plugin.AbstractReportFormPlugin; import kd.sdk.plugin.Plugin; @@ -70,45 +71,20 @@ public class BudgetActuRptListPlugin extends AbstractReportFormPlugin implements cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 cellStyleRules.add(cellStyleRule); } - - - - /* cellStyleRule = new CellStyleRule(); - cellStyleRule.setFieldKey(DEV_KEY+"_year");// 字段标识 - cellStyleRule.setForeColor("#666666");// 前景色 - cellStyleRule.setBackgroundColor("#ffc000");// 背景色 - cellStyleRule.setDegree(100);// 透明度 - //cellStyleRule1.setCondition("_year = '2021年预算'");// 前置条件,值与表达式计算器一致 - cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 - cellStyleRules.add(cellStyleRule); - - cellStyleRule = new CellStyleRule(); - cellStyleRule.setFieldKey(DEV_KEY+"_travel");// 字段标识 - cellStyleRule.setForeColor("#666666");// 前景色 - cellStyleRule.setBackgroundColor("#ffc000");// 背景色 - cellStyleRule.setDegree(100);// 透明度 - //cellStyleRule1.setCondition("_year = '2021年预算'");// 前置条件,值与表达式计算器一致 - cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 - cellStyleRules.add(cellStyleRule); - - cellStyleRule = new CellStyleRule(); - cellStyleRule.setFieldKey(DEV_KEY+"_health");// 字段标识 - cellStyleRule.setForeColor("#666666");// 前景色 - cellStyleRule.setBackgroundColor("#ffc000");// 背景色 - cellStyleRule.setDegree(100);// 透明度 - //cellStyleRule1.setCondition("_year = '2021年预算'");// 前置条件,值与表达式计算器一致 - cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 - cellStyleRules.add(cellStyleRule); - - cellStyleRule = new CellStyleRule(); - cellStyleRule.setFieldKey(DEV_KEY+"_amounttotal");// 字段标识 - cellStyleRule.setForeColor("#666666");// 前景色 - cellStyleRule.setBackgroundColor("#ffc000");// 背景色 - cellStyleRule.setDegree(100);// 透明度 - //cellStyleRule1.setCondition("_year = '2021年预算'");// 前置条件,值与表达式计算器一致 - cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 - cellStyleRules.add(cellStyleRule);*/ - super.setCellStyleRules(cellStyleRules); } + + /** + * 设置过滤排序列 + * + * @param allColumns 报表列 + */ + /*@Override + public void setSortAndFilter(List allColumns) { + super.setSortAndFilter(allColumns); + for (SortAndFilterEvent ent : allColumns) { + ent.setFilter(true); + ent.setSort(true); + } + }*/ } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptListPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptListPlugin.java index b37f8a7..e48ff45 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptListPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptListPlugin.java @@ -6,6 +6,7 @@ import kd.bos.entity.datamodel.events.PackageDataEvent; import kd.bos.entity.report.FilterInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.report.events.CellStyleRule; +import kd.bos.report.events.SortAndFilterEvent; import kd.bos.report.plugin.AbstractReportFormPlugin; import kd.sdk.plugin.Plugin; @@ -21,13 +22,16 @@ public class FeeDeductionRptListPlugin extends AbstractReportFormPlugin implemen private static final String DEV_KEY="zcgj"; // 报表字段及数据类型 private static final String[] FIELDS = { - DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_car_fee", DEV_KEY+"_air_trains_fee", - DEV_KEY+"_car_amount", DEV_KEY+"_car_tax", DEV_KEY+"_air_trains_amount", - DEV_KEY+"_air_trains_tax", DEV_KEY+"_total_amount", DEV_KEY+"_total_fee", DEV_KEY+"_month" + DEV_KEY+"_user", DEV_KEY+"_month", DEV_KEY+"_username", + DEV_KEY+"_car_fee",DEV_KEY+"_car_amount", DEV_KEY+"_car_tax",//汽车 + DEV_KEY+"_trains_fee",DEV_KEY+"_trains_amount",DEV_KEY+"_trains_tax",//火车 + DEV_KEY+"_air_fee", DEV_KEY+"_air_amount",DEV_KEY+"_air_tax",//飞机 + DEV_KEY+"_total_amount", DEV_KEY+"_total_tax",DEV_KEY+"_total_all" }; @Override public void setMergeColums(List columns) { + columns.add(DEV_KEY+"_month"); columns.add(MERGECOLUM); super.setMergeColums(columns); } @@ -66,10 +70,25 @@ public class FeeDeductionRptListPlugin extends AbstractReportFormPlugin implemen cellStyleRule.setForeColor("#666666");// 前景色 cellStyleRule.setBackgroundColor("#ffc000");// 背景色 cellStyleRule.setDegree(100);// 透明度 - cellStyleRule.setCondition(DEV_KEY+"_username = '合计'");// 前置条件,值与表达式计算器一致 + cellStyleRule.setCondition(DEV_KEY+"_month = '合计'");// 前置条件,值与表达式计算器一致 cellStyleRules.add(cellStyleRule); } super.setCellStyleRules(cellStyleRules); } + + /** + * 设置过滤排序列 + * + * @param allColumns 报表列 + */ + /*@Override + public void setSortAndFilter(List allColumns) { + super.setSortAndFilter(allColumns); + for (SortAndFilterEvent ent : allColumns) { + ent.setFilter(true); + ent.setSort(true); + } + }*/ + } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptQueryPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptQueryPlugin.java index cb15ed0..7bfa9f5 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptQueryPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/FeeDeductionRptQueryPlugin.java @@ -57,15 +57,18 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { } // 报表字段及数据类型 String[] FIELDS = { - DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_car_fee", DEV_KEY+"_air_trains_fee", - DEV_KEY+"_car_amount", DEV_KEY+"_car_tax", DEV_KEY+"_air_trains_amount", - DEV_KEY+"_air_trains_tax", DEV_KEY+"_total_amount", DEV_KEY+"_total_fee", DEV_KEY+"_month" + DEV_KEY+"_user", DEV_KEY+"_month", DEV_KEY+"_username", + DEV_KEY+"_car_fee",DEV_KEY+"_car_amount", DEV_KEY+"_car_tax",//汽车 + DEV_KEY+"_trains_fee",DEV_KEY+"_trains_amount",DEV_KEY+"_trains_tax",//火车 + DEV_KEY+"_air_fee", DEV_KEY+"_air_amount",DEV_KEY+"_air_tax",//飞机 + DEV_KEY+"_total_amount", DEV_KEY+"_total_tax",DEV_KEY+"_total_all" }; DataType[] DATATYPES = { - DataType.LongType, DataType.StringType, DataType.BigDecimalType, - DataType.BigDecimalType, DataType.BigDecimalType, DataType.BigDecimalType, - DataType.BigDecimalType, DataType.BigDecimalType, DataType.BigDecimalType, - DataType.BigDecimalType, DataType.StringType + DataType.LongType, DataType.StringType, DataType.StringType, + DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType, + DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType, + DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType, + DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType }; // 初始化 DataSet @@ -144,11 +147,16 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { // 底层合计 BigDecimal totalCarFee = BigDecimal.ZERO; - BigDecimal totalAirTrainsFee = BigDecimal.ZERO; BigDecimal totalCarAmount = BigDecimal.ZERO; BigDecimal totalCarTax = BigDecimal.ZERO; - BigDecimal totalAirTrainsAmount = BigDecimal.ZERO; - BigDecimal totalAirTrainsTax = BigDecimal.ZERO; + + BigDecimal totalTrainsFee = BigDecimal.ZERO; + BigDecimal totalTrainsAmount = BigDecimal.ZERO; + BigDecimal totalTrainsTax = BigDecimal.ZERO; + + BigDecimal totalAirFee = BigDecimal.ZERO; + BigDecimal totalAirAmount = BigDecimal.ZERO; + BigDecimal totalAirTax = BigDecimal.ZERO; // 填充结果 List sortedAppliers = new ArrayList<>(allData.keySet()); @@ -165,12 +173,18 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { Object[] rowData = assembleRowData(FIELDS, applier, userName, month, expenseData); // 累加合计值 - totalCarFee = totalCarFee.add((BigDecimal) rowData[2]); - totalAirTrainsFee = totalAirTrainsFee.add((BigDecimal) rowData[3]); + //汽车 + totalCarFee = totalCarFee.add((BigDecimal) rowData[3]); totalCarAmount = totalCarAmount.add((BigDecimal) rowData[4]); totalCarTax = totalCarTax.add((BigDecimal) rowData[5]); - totalAirTrainsAmount = totalAirTrainsAmount.add((BigDecimal) rowData[6]); - totalAirTrainsTax = totalAirTrainsTax.add((BigDecimal) rowData[7]); + //火车 + totalTrainsFee = totalTrainsFee.add((BigDecimal) rowData[6]); + totalTrainsAmount = totalTrainsAmount.add((BigDecimal) rowData[7]); + totalTrainsTax = totalTrainsTax.add((BigDecimal) rowData[8]); + //飞机 + totalAirFee = totalAirFee.add((BigDecimal) rowData[9]); + totalAirAmount = totalAirAmount.add((BigDecimal) rowData[10]); + totalAirTax = totalAirTax.add((BigDecimal) rowData[11]); coll.add(rowData); } @@ -180,15 +194,25 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { Object[] totalRow = new Object[FIELDS.length]; totalRow[0] = null; // 用户ID为空 totalRow[1] = "合计"; // 用户名显示为"合计" - totalRow[2] = totalCarFee; - totalRow[3] = totalAirTrainsFee; + totalRow[2] = null; // 月份为空 + + totalRow[3] = totalCarFee; totalRow[4] = totalCarAmount; totalRow[5] = totalCarTax; - totalRow[6] = totalAirTrainsAmount; - totalRow[7] = totalAirTrainsTax; - totalRow[8] = totalCarAmount.add(totalAirTrainsAmount); // 合计金额(不含税) - totalRow[9] = totalCarFee.add(totalAirTrainsFee); // 合计金额(含税) - totalRow[10] = null; // 月份为空 + + totalRow[6] = totalTrainsFee; + totalRow[7] = totalTrainsAmount; + totalRow[8] = totalTrainsTax; + + totalRow[9] = totalAirFee; + totalRow[10] = totalAirAmount; + totalRow[11] = totalAirTax; + + + totalRow[12] = totalCarAmount.add(totalTrainsAmount).add(totalAirAmount); // 合计不含税金额 + totalRow[13] = totalCarTax.add(totalTrainsTax).add(totalAirTax); // 合计税额 + totalRow[14] = totalCarFee.add(totalTrainsFee).add(totalAirFee); // 合计含税金额(含税) + coll.add(totalRow); return resultDataSet; @@ -199,11 +223,14 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { */ private void updateExpenseData(Map dataMap, String attribute, BigDecimal orientryamount, BigDecimal notaxamount, BigDecimal taxamount) { + //飞机2,汽车3,火车4 String[] keys; - if ("2".equals(attribute) || "4".equals(attribute)) { - keys = new String[]{"air_trains_fee", "air_trains_amount", "air_trains_tax"}; + if ("2".equals(attribute) ) { + keys = new String[]{"air_fee", "air_amount", "air_tax"}; } else if ("3".equals(attribute)) { keys = new String[]{"car_fee", "car_amount", "car_tax"}; + }else if ("4".equals(attribute)) { + keys = new String[]{"trains_fee", "trains_amount", "trains_tax"}; } else { return; } @@ -219,16 +246,27 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin { String month, Map expenseData) { Object[] rowData = new Object[fields.length]; rowData[0] = userId; - rowData[1] = userName; - rowData[2] = expenseData.getOrDefault("car_fee", BigDecimal.ZERO); - rowData[3] = expenseData.getOrDefault("air_trains_fee", BigDecimal.ZERO); - rowData[4] = expenseData.getOrDefault("car_amount", BigDecimal.ZERO); - rowData[5] = expenseData.getOrDefault("car_tax", BigDecimal.ZERO); - rowData[6] = expenseData.getOrDefault("air_trains_amount", BigDecimal.ZERO); - rowData[7] = expenseData.getOrDefault("air_trains_tax", BigDecimal.ZERO); - rowData[8] = ((BigDecimal) rowData[4]).add((BigDecimal) rowData[6]); // 合计不含税金额 - rowData[9] = ((BigDecimal) rowData[2]).add((BigDecimal) rowData[3]); // 合计报销金额 - rowData[10] = month; + rowData[1] = month; + rowData[2] = userName; + + rowData[3] = expenseData.getOrDefault("car_fee", BigDecimal.ZERO);//汽车含税金额 + rowData[4] = expenseData.getOrDefault("car_amount", BigDecimal.ZERO);//汽车不含税金额 + rowData[5] = expenseData.getOrDefault("car_tax", BigDecimal.ZERO);//汽车税额 + + rowData[6] = expenseData.getOrDefault("trains_fee", BigDecimal.ZERO);//火车含税金额 + rowData[7] = expenseData.getOrDefault("trains_amount", BigDecimal.ZERO);//火车不含税金额 + rowData[8] = expenseData.getOrDefault("trains_tax", BigDecimal.ZERO);//火车税额 + + rowData[9] = expenseData.getOrDefault("air_fee", BigDecimal.ZERO);//飞机含税金额 + rowData[10] = expenseData.getOrDefault("air_amount", BigDecimal.ZERO);//飞机不含税金额 + rowData[11] = expenseData.getOrDefault("air_tax", BigDecimal.ZERO);//飞机税额 + + + + rowData[12] = ((BigDecimal) rowData[4]).add((BigDecimal) rowData[7]).add((BigDecimal) rowData[10]); // 合计不含税金额 + rowData[13] = ((BigDecimal) rowData[5]).add((BigDecimal) rowData[8]).add((BigDecimal) rowData[11]); // 合计税额 + rowData[14] = ((BigDecimal) rowData[3]).add((BigDecimal) rowData[6]).add((BigDecimal) rowData[9]); // 合计含税金额 + return rowData; } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java index 7a2f271..1038911 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java @@ -6,6 +6,7 @@ import kd.bos.entity.datamodel.events.PackageDataEvent; import kd.bos.entity.report.FilterInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.report.events.CellStyleRule; +import kd.bos.report.events.SortAndFilterEvent; import kd.bos.report.plugin.AbstractReportFormPlugin; import kd.sdk.plugin.Plugin; @@ -23,10 +24,11 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen private static final String DEV_KEY="zcgj"; private static final String[] FIELDS = { - DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date", - DEV_KEY+"_billno",DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside", - DEV_KEY+"_serve_significant",DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_souvenir", - DEV_KEY+"_serve_total",DEV_KEY+"_travel",DEV_KEY+"_abroad_travel", + DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date",DEV_KEY+"_bill_number", + DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside",DEV_KEY+"_serve_significant", + DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_lodging", + DEV_KEY+"_serve_souvenir",DEV_KEY+"_serve_total", + DEV_KEY+"_travel",DEV_KEY+"_abroad_travel", DEV_KEY+"_health",DEV_KEY+"_correspondence",DEV_KEY+"_training", DEV_KEY+"_total" }; @@ -68,17 +70,6 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen @Override public void setCellStyleRules(List cellStyleRules) { - - String[] FIELDS = { - DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date",DEV_KEY+"_bill_number", - DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside",DEV_KEY+"_serve_significant", - DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_lodging", - DEV_KEY+"_serve_souvenir",DEV_KEY+"_serve_total", - DEV_KEY+"_travel",DEV_KEY+"_abroad_travel", - DEV_KEY+"_health",DEV_KEY+"_correspondence",DEV_KEY+"_training", - DEV_KEY+"_total" - }; - for (String field : FIELDS) { CellStyleRule cellStyleRuleUser = new CellStyleRule(); cellStyleRuleUser.setFieldKey(field);// 字段标识 @@ -99,4 +90,18 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen super.setCellStyleRules(cellStyleRules); } + + /** + * 设置过滤排序列 + * + * @param allColumns 报表列 + */ + /*@Override + public void setSortAndFilter(List allColumns) { + super.setSortAndFilter(allColumns); + for (SortAndFilterEvent ent : allColumns) { + ent.setFilter(true); + ent.setSort(true); + } + }*/ } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptListPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptListPlugin.java new file mode 100644 index 0000000..e7b0f79 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptListPlugin.java @@ -0,0 +1,115 @@ +package zcgj.zcdev.zcdev.fs.plugin.report; + +import kd.bos.context.RequestContext; +import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.datamodel.events.PackageDataEvent; +import kd.bos.entity.report.FilterInfo; +import kd.bos.entity.report.ReportQueryParam; +import kd.bos.report.events.CellStyleRule; +import kd.bos.report.events.SortAndFilterEvent; +import kd.bos.report.plugin.AbstractReportFormPlugin; +import kd.sdk.plugin.Plugin; + +import java.util.Date; +import java.util.List; + +/** + * 职务消费台账 + * 报表格式化插件 + */ +public class VisitRptListPlugin extends AbstractReportFormPlugin implements Plugin { + + private static final String MERGECOLUM= "shxr_username";//合并单元格字段 + private static final String CONDITION_FIELD="shxr_username";//条件字段 + private static final String DEV_KEY="zcgj"; + + private static final String[] FIELDS = { + DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_department",DEV_KEY+"_holiday_date_start", + DEV_KEY+"_holiday_date_end",DEV_KEY+"_holiday_days", + DEV_KEY+"_holiday_type", DEV_KEY+"_holiday_addr", DEV_KEY+"_phone", + DEV_KEY+"_reason" + }; + @Override + public void setMergeColums(List columns) { + columns.add(MERGECOLUM); + super.setMergeColums(columns); + } + + @Override + public void initDefaultQueryParam(ReportQueryParam queryParam) { + super.initDefaultQueryParam(queryParam); + IDataModel model = this.getModel(); + //获取当前登陆人所在组织 + long orgId = RequestContext.get().getOrgId(); + model.setValue("zcgj_query_org",orgId); + model.setValue("zcgj_query_year",new Date()); + } + + @Override + public boolean verifyQuery(ReportQueryParam queryParam) { + FilterInfo filter = queryParam.getFilter(); + StringBuilder sb = new StringBuilder(); + if (filter.getValue("zcgj_query_org") == null){ + this.getView().showTipNotification("请选择查询组织!"); + return false; + } + /*if (filter.getValue("zcgj_query_year") == null){ + this.getView().showTipNotification("请选择查询年度!"); + return false; + }*/ + return true; + } + + @Override + public void packageData(PackageDataEvent packageDataEvent) { + super.packageData(packageDataEvent); + } + + @Override + public void setCellStyleRules(List cellStyleRules) { + super.setCellStyleRules(cellStyleRules); + } + + /** + * 设置过滤排序列 + * + * @param allColumns 报表列 + */ + /*@Override + public void setSortAndFilter(List allColumns) { + super.setSortAndFilter(allColumns); + for (SortAndFilterEvent ent : allColumns) { + ent.setFilter(true); + ent.setSort(true); + } + }*/ + + /** + * 表格列创建完成后事件 + * + * @param event 报表列 + */ + /* @Override + public void afterCreateColumn(CreateColumnEvent event) { + super.afterCreateColumn(event); + List columns = event.getColumns(); + for (AbstractReportColumn column : columns) { + if (column instanceof ReportColumn) { + ReportColumn reportColumn = (ReportColumn) column; + if (reportColumn.getFieldKey().equals("textareafield1")) { + reportColumn.setHide(false); + } + } + } + }*/ + + /** + * 重设前端展示的数据行数 + */ + /*@Override + public Integer resetDataCount(){ + super.resetDataCount(); + return 500; + }*/ + +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptQueryPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptQueryPlugin.java index 78b4567..3eb77e7 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptQueryPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/VisitRptQueryPlugin.java @@ -44,9 +44,9 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin { } } break; - /*case DEV_KEY+"_query_org": + case DEV_KEY+"_query_org": orgId = (filterItem.getValue() == null) ? null :Long.valueOf(String.valueOf(((DynamicObject) filterItem.getValue()).getPkValue())); - break;*/ + break; case DEV_KEY+"_query_year": queryYear = filterItem.getDate(); break; @@ -78,9 +78,9 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin { // 日期格式化 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - /*if(orgId==null ){ + if(orgId==null ){ return resultDataSet; - }*/ + } // 查询条件 List searchFilterList = new ArrayList<>(); @@ -98,6 +98,9 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin { searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.large_equals, firstDay)); searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.less_equals, lastDay)); } + if(orgId!=null){ + searchFilterList.add(new QFilter("company", QCP.equals, orgId)); + } List billStatuslist = new ArrayList<>(); //billStatuslist.add("A"); //暂存 //billStatuslist.add("B"); //已提交 diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/workflow/ApprovalCheckFlowPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/workflow/ApprovalCheckFlowPlugin.java new file mode 100644 index 0000000..0c99f9c --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/workflow/ApprovalCheckFlowPlugin.java @@ -0,0 +1,27 @@ +package zcgj.zcdev.zcdev.fs.plugin.workflow; + +import kd.bos.servicehelper.user.UserServiceHelper; +import kd.bos.workflow.api.AgentExecution; +import kd.bos.workflow.engine.extitf.IWorkflowPlugin; + +import java.util.List; +import java.util.Map; + +/** + * 判断当前审批人是否为提交人 + * 综合岗和项目经理发起的报销,本人点提交提示必须执行转交 + */ +public class ApprovalCheckFlowPlugin implements IWorkflowPlugin { + + + @Override + public void notify(AgentExecution execution) { + IWorkflowPlugin.super.notify(execution); + List allApprover = execution.getAllApprover(); // 获取审批人id + List> userInfo = UserServiceHelper.get(allApprover); // 审批人信息 + System.out.println(); + + } + + +}