From 605eecdcb3cbdca0ea17495df071995a11942ea3 Mon Sep 17 00:00:00 2001 From: zhangzhiguo Date: Fri, 20 Dec 2024 18:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8C=E5=8A=A1=E6=B6=88=E8=B4=B9=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/PositionFeesRptListPlugin.java | 21 ++- .../report/PositionFeesRptQueryPlugin.java | 162 ++++++++++++------ 2 files changed, 128 insertions(+), 55 deletions(-) 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 c83c9cb..7a2f271 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 @@ -68,13 +68,32 @@ 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);// 字段标识 + cellStyleRuleUser.setForeColor("#666666");// 前景色 + cellStyleRuleUser.setBackgroundColor("#FFE5CC");// 背景色 + cellStyleRuleUser.setDegree(100);// 透明度 + cellStyleRuleUser.setCondition("zcgj_username = '人员合计'");// 前置条件,值与表达式计算器一致 + cellStyleRules.add(cellStyleRuleUser); + CellStyleRule cellStyleRule = new CellStyleRule(); cellStyleRule.setFieldKey(field);// 字段标识 cellStyleRule.setForeColor("#666666");// 前景色 cellStyleRule.setBackgroundColor("#ffc000");// 背景色 cellStyleRule.setDegree(100);// 透明度 - cellStyleRule.setCondition("shxr_username = '合计'");// 前置条件,值与表达式计算器一致 + cellStyleRule.setCondition("zcgj_username = '合计'");// 前置条件,值与表达式计算器一致 cellStyleRules.add(cellStyleRule); } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java index 1cbf53c..5a38c09 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java @@ -90,7 +90,16 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType }; - + Set itemSet = new HashSet<>(); + itemSet.add(FYF); + itemSet.add(TXF); + itemSet.add(PXF); + itemSet.add(YWZD_SWZD); + itemSet.add(YWZD_WSZD); + itemSet.add(YWZD_ZYGW); + itemSet.add(YWZD_ZS); + itemSet.add(YWZD_JNP); + itemSet.add(YWZD_QT); // 初始化 DataSet RowMeta rowMeta = RowMetaFactory.createRowMeta(FIELDS, DATATYPES); Collection coll = new ArrayList<>(); @@ -130,6 +139,9 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { } Date happendate = entry.getDate("happendate");//费用发生日期 String itemNumber = expenseitemObj.getString("number");//费用项目编码 + if(!itemSet.contains(itemNumber)){ + continue; + } String happendateStr = dateFormat.format(happendate);//费用发生日期str BigDecimal expenseamount = BigDecimal.ZERO; if(istax){ @@ -247,65 +259,107 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { for (Long userId : userSet) { for (String string : strings) { if(string.startsWith(userId+"")){ - // userIdDataMap.put(userId,reportMap.get(string)); + if(userIdDataMap.containsKey(userId)){ + Map stringExpenseReportMap = userIdDataMap.get(userId); + stringExpenseReportMap.put(string,reportMap.get(string)); + //userIdDataMap.put(userId,stringExpenseReportMap); + }else{ + Map data= new HashMap<>(); + data.put(string,reportMap.get(string)); + userIdDataMap.put(userId,data); + } } } } - ArrayList reportsList = new ArrayList<>(reportMap.values()); - // 打印每一行报表 - for (ExpenseReport report : reportsList) { - Map userInfoByID = UserServiceHelper.getUserInfoByID(report.getReimburser()); - String username = String.valueOf(userInfoByID.get("name"));//报销人 + for (Long userId : userIdDataMap.keySet()) { + Map stringExpenseReportMap = userIdDataMap.get(userId); + ArrayList reportsList = new ArrayList<>(stringExpenseReportMap.values()); + ExpenseReport userTotalReport = new ExpenseReport(null, null, null); - Object [] tempData = new Object [FIELDS.length]; - coll.add(tempData); - tempData[0] = report.getReimburser(); - tempData[1] = username; - tempData[2] = report.getHappenDateStr(); - tempData[3] = report.getBillNumber(); - BigDecimal businessEntertainment = report.getBusinessEntertainment(); - totalReport.setBusinessEntertainment(totalReport.getBusinessEntertainment().add(businessEntertainment)); - tempData[4] = businessEntertainment; - BigDecimal foreignEntertainment = report.getForeignEntertainment(); - totalReport.setForeignEntertainment(totalReport.getForeignEntertainment().add(foreignEntertainment)); - tempData[5] = foreignEntertainment; - BigDecimal importantOfficial = report.getImportantOfficial(); - totalReport.setImportantOfficial(totalReport.getImportantOfficial().add(importantOfficial)); - tempData[6] = importantOfficial; - BigDecimal other = report.getOther(); - totalReport.setOther(totalReport.getOther().add(other)); - tempData[7] = other; - BigDecimal accommodation = report.getAccommodation(); - totalReport.setAccommodation(totalReport.getAccommodation().add(accommodation)); - tempData[8] = accommodation; - BigDecimal souvenirs = report.getSouvenirs(); - totalReport.setSouvenirs(totalReport.getSouvenirs().add(souvenirs)); - tempData[9] = souvenirs; - BigDecimal subtotal = businessEntertainment.add(foreignEntertainment) - .add(importantOfficial).add(other) - .add(accommodation).add(souvenirs); - totalReport.setSubtotal(totalReport.getSubtotal().add(subtotal)); - tempData[10] = subtotal; - BigDecimal travel = report.getTravel(); - totalReport.setTravel(totalReport.getTravel().add(travel)); - tempData[11] = travel;//travel - BigDecimal abroadTravel = report.getAbroadTravel(); - totalReport.setAbroadTravel(totalReport.getAbroadTravel().add(abroadTravel)); - tempData[12] = abroadTravel; - BigDecimal health = report.getHealth(); - totalReport.setHealth(totalReport.getHealth().add(health)); - tempData[13] = health; - BigDecimal correspondence = report.getCorrespondence(); - totalReport.setCorrespondence(totalReport.getCorrespondence().add(correspondence)); - tempData[14] = correspondence; - BigDecimal training = report.getTraining(); - totalReport.setTraining(totalReport.getTraining().add(training)); - tempData[15] = training; + // 打印每一行报表 + for (ExpenseReport report : reportsList) { + Map userInfoByID = UserServiceHelper.getUserInfoByID(report.getReimburser()); + String username = String.valueOf(userInfoByID.get("name"));//报销人 - BigDecimal total = subtotal.add(travel).add(abroadTravel).add(health).add(correspondence).add(training); - totalReport.setTotal(totalReport.getTotal().add(total)); - tempData[16] = total; + Object [] tempData = new Object [FIELDS.length]; + coll.add(tempData); + tempData[0] = report.getReimburser(); + tempData[1] = username; + tempData[2] = report.getHappenDateStr(); + tempData[3] = report.getBillNumber(); + BigDecimal businessEntertainment = report.getBusinessEntertainment(); + totalReport.setBusinessEntertainment(totalReport.getBusinessEntertainment().add(businessEntertainment)); + userTotalReport.setBusinessEntertainment(userTotalReport.getBusinessEntertainment().add(businessEntertainment)); + tempData[4] = businessEntertainment; + BigDecimal foreignEntertainment = report.getForeignEntertainment(); + totalReport.setForeignEntertainment(totalReport.getForeignEntertainment().add(foreignEntertainment)); + userTotalReport.setForeignEntertainment(userTotalReport.getForeignEntertainment().add(foreignEntertainment)); + tempData[5] = foreignEntertainment; + BigDecimal importantOfficial = report.getImportantOfficial(); + totalReport.setImportantOfficial(totalReport.getImportantOfficial().add(importantOfficial)); + userTotalReport.setImportantOfficial(userTotalReport.getImportantOfficial().add(importantOfficial)); + tempData[6] = importantOfficial; + BigDecimal other = report.getOther(); + totalReport.setOther(totalReport.getOther().add(other)); + userTotalReport.setOther(userTotalReport.getOther().add(other)); + tempData[7] = other; + BigDecimal accommodation = report.getAccommodation(); + totalReport.setAccommodation(totalReport.getAccommodation().add(accommodation)); + userTotalReport.setAccommodation(userTotalReport.getAccommodation().add(accommodation)); + tempData[8] = accommodation; + BigDecimal souvenirs = report.getSouvenirs(); + totalReport.setSouvenirs(totalReport.getSouvenirs().add(souvenirs)); + userTotalReport.setSouvenirs(userTotalReport.getSouvenirs().add(souvenirs)); + tempData[9] = souvenirs; + BigDecimal subtotal = businessEntertainment.add(foreignEntertainment) + .add(importantOfficial).add(other) + .add(accommodation).add(souvenirs); + totalReport.setSubtotal(totalReport.getSubtotal().add(subtotal)); + userTotalReport.setSubtotal(userTotalReport.getSubtotal().add(subtotal)); + tempData[10] = subtotal; + BigDecimal travel = report.getTravel(); + totalReport.setTravel(totalReport.getTravel().add(travel)); + userTotalReport.setTravel(userTotalReport.getTravel().add(travel)); + tempData[11] = travel;//travel + BigDecimal abroadTravel = report.getAbroadTravel(); + totalReport.setAbroadTravel(totalReport.getAbroadTravel().add(abroadTravel)); + userTotalReport.setAbroadTravel(userTotalReport.getAbroadTravel().add(abroadTravel)); + tempData[12] = abroadTravel; + BigDecimal health = report.getHealth(); + totalReport.setHealth(totalReport.getHealth().add(health)); + userTotalReport.setHealth(userTotalReport.getHealth().add(health)); + tempData[13] = health; + BigDecimal correspondence = report.getCorrespondence(); + totalReport.setCorrespondence(totalReport.getCorrespondence().add(correspondence)); + userTotalReport.setCorrespondence(userTotalReport.getCorrespondence().add(correspondence)); + tempData[14] = correspondence; + BigDecimal training = report.getTraining(); + totalReport.setTraining(totalReport.getTraining().add(training)); + userTotalReport.setTraining(userTotalReport.getTraining().add(training)); + tempData[15] = training; + + BigDecimal total = subtotal.add(travel).add(abroadTravel).add(health).add(correspondence).add(training); + totalReport.setTotal(totalReport.getTotal().add(total)); + userTotalReport.setTotal(userTotalReport.getTotal().add(total)); + tempData[16] = total; + } + Object [] tempDataUserTotal = new Object [FIELDS.length]; + coll.add(tempDataUserTotal); + tempDataUserTotal[1] = "人员合计"; + tempDataUserTotal[4] = userTotalReport.getBusinessEntertainment(); + tempDataUserTotal[5] = userTotalReport.getForeignEntertainment(); + tempDataUserTotal[6] = userTotalReport.getImportantOfficial(); + tempDataUserTotal[7] = userTotalReport.getOther(); + tempDataUserTotal[8] = userTotalReport.getAccommodation(); + tempDataUserTotal[9] = userTotalReport.getSouvenirs(); + tempDataUserTotal[10] = userTotalReport.getSubtotal(); + tempDataUserTotal[11] = userTotalReport.getTravel(); + tempDataUserTotal[12] = userTotalReport.getAbroadTravel(); + tempDataUserTotal[13] = userTotalReport.getHealth(); + tempDataUserTotal[14] = userTotalReport.getCorrespondence(); + tempDataUserTotal[15] = userTotalReport.getTraining(); + tempDataUserTotal[16] = userTotalReport.getTotal(); }