From 6ee8b5f044f711ff75eb92c48c4171810cb460d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 22 Jan 2024 15:41:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E4=B8=8D=E6=8D=A2=E8=A1=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/entity/salaryBill/bo/SalaryBillBO.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java b/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java index 6075a27f7..8f016b34f 100644 --- a/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java +++ b/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java @@ -368,7 +368,8 @@ public class SalaryBillBO { return; } - content = content.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate())); + content = content.replace("\n", "\r\n") + .replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate())); for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) { content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue()); @@ -644,7 +645,7 @@ public class SalaryBillBO { boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString())) || (isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString()) - && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString()))==0); + && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0); if (!isHide) { // 4.2.薪资项目 emailContent.append(""); @@ -724,7 +725,7 @@ public class SalaryBillBO { boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString())) || (isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString()) - && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString()))==0); + && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0); if (!isHide) { // 4.2.薪资项目 emailContent.append(""); From a3e281b3fe2fe929448b21ed4949f24709268efd Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Tue, 23 Jan 2024 10:00:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=9E=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=BA=BA=E5=91=98=E6=90=9C=E7=B4=A2=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/impl/TaxAgentManageRangeServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index 6e19d15a5..2c1a38017 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -566,6 +566,9 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } List taxAgentExtRangePOS = getTaxAgentExtRangeMapper().list(TaxAgentExtRangePO.builder().taxAgentId(param.getTaxAgentId()).build()); + if(StringUtils.isNotBlank(param.getTargetName())) { + taxAgentExtRangePOS = taxAgentExtRangePOS.stream().filter(po -> po.getTargetName().contains(param.getTargetName())).collect(Collectors.toList()); + } return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), taxAgentExtRangePOS, TaxAgentExtRangePO.class); } From 887ec2084a32aec3dfdfd2ef5bcd1c9c92efb3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 23 Jan 2024 14:06:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=BC=E5=87=BAexcel=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/util/excel/ExcelUtil.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/com/engine/salary/util/excel/ExcelUtil.java b/src/com/engine/salary/util/excel/ExcelUtil.java index 877714295..2a482e42d 100644 --- a/src/com/engine/salary/util/excel/ExcelUtil.java +++ b/src/com/engine/salary/util/excel/ExcelUtil.java @@ -1,7 +1,9 @@ package com.engine.salary.util.excel; +import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.FillPatternType; @@ -10,7 +12,12 @@ import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.xssf.usermodel.*; import java.awt.*; +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -69,6 +76,41 @@ public class ExcelUtil { return workbook; } + public static XSSFWorkbook genWorkbook(String sheetName, List rowList) { + List headerList = Lists.newArrayList(); + List dataIndexList = Lists.newArrayList(); + // 解析表头 + ExcelUtil.parseHeader(TaxDeclarationLaborListDTO.class, headerList, dataIndexList); + + List> rows = new ArrayList<>(); + rows.add(headerList); + for (int i = 0; i < rowList.size(); i++) { + List row = Lists.newArrayListWithExpectedSize(dataIndexList.size()); + for (int j = 0; j < dataIndexList.size(); j++) { + Object value = getValue(rowList.get(i), dataIndexList.get(j)); + row.add(value); + } + rows.add(row); + } + return genWorkbookV2(rows, sheetName); + } + + private static Object getValue(T t, String fieldName) { + Object value = null; + try { + BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass()); + PropertyDescriptor[] props = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : props) { + if (fieldName.equals(property.getName())) { + Method method = property.getReadMethod(); + value = method.invoke(t, new Object[]{}); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return value; + } public static XSSFWorkbook genWorkbookV2(List> rowList, String sheetName) { XSSFWorkbook workbook = new XSSFWorkbook();