From cca73dcc7a54964ebc0e76135a6cd9bad0f2331a Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Wed, 13 Nov 2024 15:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E8=B4=B5=E6=8A=95=E8=B5=84=E4=BA=8C?= =?UTF-8?q?=E5=BC=80=20-=20=E5=AF=BC=E5=87=BA=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalaryStatisticsEmployeeService.java | 2 +- .../SalaryStatisticsEmployeeServiceImpl.java | 8 +++- .../SalaryStatisticsEmployeeWrapper.java | 43 ++++++++++++++++--- .../engine/salary/util/SalaryEntityUtil.java | 11 ++++- .../engine/salary/util/excel/ExcelUtil.java | 24 +++++------ .../salary/util/excel/ExcelUtilPlus.java | 28 ++++++------ 6 files changed, 80 insertions(+), 36 deletions(-) diff --git a/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java b/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java index 512e51d55..d3132b089 100644 --- a/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java +++ b/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java @@ -44,7 +44,7 @@ public interface SalaryStatisticsEmployeeService { * @param queryParam * @return */ - List> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam); + List> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam, List needAdjustItemIds); PageInfo listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam); diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java index 813b0e867..1062469ea 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java @@ -237,7 +237,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala } @Override - public List> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam) { + public List> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam, List needAdjustSalaryItemIds) { List taxAgentList = getTaxAgentService(user).listAll(); Map taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName); @@ -253,7 +253,11 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala acctResultValueList.forEach((k, v) -> { Map map = new HashMap(); v.forEach(l -> { - map.put(l.getSalaryItemId() + "", l.getResultValue()); + if (needAdjustSalaryItemIds.contains(l.getSalaryItemId())) { + map.put(l.getSalaryItemId() + "", SalaryEntityUtil.removeLastZero(l.getResultValue())); + } else { + map.put(l.getSalaryItemId() + "", l.getResultValue()); + } }); acctResultValueMap.put(k, map); }); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java index d939846aa..dae326c80 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java @@ -39,6 +39,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.general.BaseBean; import weaver.general.PageIdConst; import weaver.general.Util; import weaver.hrm.User; @@ -98,7 +99,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service { public Map detailList(SalaryStatisticsEmployeeDetailQueryParam queryParam) { // 获取核算数据 SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResult(queryParam); - List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, queryParam); + List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, queryParam, Collections.emptyList()); Map countResultMap = Maps.newHashMap(); if (CollectionUtils.isNotEmpty(records)) { @@ -173,9 +174,21 @@ public class SalaryStatisticsEmployeeWrapper extends Service { } // 获取发薪人员 PageInfo salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam); + // 获取需要调整格式的薪资项目信息 + BaseBean baseBean = new BaseBean(); + String itemNames = ""; + try { + itemNames = new String(baseBean.getPropValue("jgtzSalaryAcct", "need_adjust_salary_item").getBytes("ISO-8859-1"), "UTF-8"); + } catch (Exception e) { + baseBean.writeLog("need_adjust_salary_item转换失败"); + } + List itemNameList = Arrays.stream(itemNames.split(",")).collect(Collectors.toList()); + List needAdjustItemIds = getSalaryItemService(user).listAll().stream() + .filter(item -> itemNameList.contains(item.getName())) + .map(SalaryItemPO::getId).collect(Collectors.toList()); // 获取薪资核算结果 SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList()); - List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null); + List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null, needAdjustItemIds); PageInfo> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); pageInfo.setList(records); @@ -252,7 +265,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service { for (int i = 0; i < empParts.size(); i++) { // 获取薪资核算结果 SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(empParts.get(i)); - List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null); + List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null, Collections.emptyList()); if (CollectionUtils.isNotEmpty(records)) { List salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList(); @@ -304,6 +317,20 @@ public class SalaryStatisticsEmployeeWrapper extends Service { finalColumns.add(new WeaTableColumnGroup("100px", Util.formatMultiLang(column.getText()), column.getColumn(), "false", pattern, dataType)); } }); + // 京福二开 + BaseBean baseBean = new BaseBean(); + String itemNames = ""; + try { + itemNames = new String(baseBean.getPropValue("jgtzSalaryAcct", "need_adjust_salary_item").getBytes("ISO-8859-1"), "UTF-8"); + } catch (Exception e) { + baseBean.writeLog("need_adjust_salary_item转换失败"); + } + List itemNameList = Arrays.stream(itemNames.split(",")).collect(Collectors.toList()); + List needAdjustItems = getSalaryItemService(user).listAll().stream() + .filter(item -> itemNameList.contains(item.getName())) + .map(item -> item.getId() + SalaryConstant.DYNAMIC_SUFFIX) + .collect(Collectors.toList()); + List> rowList = new ArrayList<>(); // 表头 rowList.add(finalColumns); @@ -312,7 +339,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service { List list = new ArrayList<>(); for (Object column : finalColumns) { WeaTableColumnGroup col = (WeaTableColumnGroup) column; - if (col.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) { + if (col.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue()) && !needAdjustItems.contains(col.getColumn())) { try { list.add(new BigDecimal(Util.null2String(valueMap.get(col.getColumn())))); } catch (Exception e) { @@ -329,14 +356,18 @@ public class SalaryStatisticsEmployeeWrapper extends Service { sumRow.add("总计"); for (int i = 1; i < finalColumns.size(); i++) { WeaTableColumnGroup weaTableColumnGroup = (WeaTableColumnGroup) finalColumns.get(i); - if (weaTableColumnGroup.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) { + if (weaTableColumnGroup.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue()) && (!needAdjustItems.contains(weaTableColumnGroup.getColumn()))) { try { sumRow.add(new BigDecimal(Util.null2String(countResult.get(weaTableColumnGroup.getColumn())))); } catch (Exception e) { sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))); } } else { - sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))); + if (needAdjustItems.contains(weaTableColumnGroup.getColumn())) { + sumRow.add(SalaryEntityUtil.removeLastZero(Util.null2String(countResult.get(weaTableColumnGroup.getColumn())))); + } else { + sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))); + } } } rowList.add(sumRow); diff --git a/src/com/engine/salary/util/SalaryEntityUtil.java b/src/com/engine/salary/util/SalaryEntityUtil.java index 0b2a6d474..f303259f5 100644 --- a/src/com/engine/salary/util/SalaryEntityUtil.java +++ b/src/com/engine/salary/util/SalaryEntityUtil.java @@ -372,5 +372,14 @@ public class SalaryEntityUtil { return ""; } - + public static String removeLastZero(String value) { + if (StringUtils.isBlank(value)) { + return value; + } + String result = value.replaceAll("0*$", ""); + if (result.endsWith(".")) { + result = result.substring(0, result.length() - 1); + } + return result; + } } diff --git a/src/com/engine/salary/util/excel/ExcelUtil.java b/src/com/engine/salary/util/excel/ExcelUtil.java index 5b7410994..cdbcdfef6 100644 --- a/src/com/engine/salary/util/excel/ExcelUtil.java +++ b/src/com/engine/salary/util/excel/ExcelUtil.java @@ -39,8 +39,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -88,8 +88,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -199,8 +199,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -262,8 +262,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -341,8 +341,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -409,8 +409,8 @@ public class ExcelUtil { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 diff --git a/src/com/engine/salary/util/excel/ExcelUtilPlus.java b/src/com/engine/salary/util/excel/ExcelUtilPlus.java index 9da402ce7..a1261ec0d 100644 --- a/src/com/engine/salary/util/excel/ExcelUtilPlus.java +++ b/src/com/engine/salary/util/excel/ExcelUtilPlus.java @@ -29,8 +29,8 @@ public class ExcelUtilPlus { // 设置title样式 XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -79,8 +79,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -227,8 +227,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -313,8 +313,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -404,8 +404,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -509,8 +509,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色 @@ -712,8 +712,8 @@ public class ExcelUtilPlus { XSSFCellStyle titleCellStyle = workbook.createCellStyle(); XSSFFont titleFont = workbook.createFont(); titleFont.setBold(true); - titleFont.setFontName("仿宋"); - titleFont.setFontHeightInPoints((short) 15); + titleFont.setFontName("宋体"); + titleFont.setFontHeightInPoints((short) 10); titleCellStyle.setFont(titleFont); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色