diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java index d736bf37f..392ac81e6 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java @@ -23,6 +23,7 @@ import com.engine.salary.enums.salaryaccounting.LockStatusEnum; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; @@ -85,7 +86,6 @@ public class SalaryAcctResultBO { // } - /** * 构建薪资核算结果列表的表头(线下对比) * @@ -170,7 +170,7 @@ public class SalaryAcctResultBO { List columns = Lists.newArrayList(); // 员工信息字段 for (SalarySobEmpFieldDTO salarySobEmpFieldDTO : salarySobItemAggregateDTO.getEmpFields()) { - columns.add(new WeaTableColumnGroup("150", salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId())); + columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobEmpFieldDTO.getFieldName()), salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId())); } // 薪资项目分组下的薪资项目 for (SalarySobItemGroupDTO salarySobItemGroupDTO : salarySobItemAggregateDTO.getItemGroups()) { @@ -180,29 +180,29 @@ public class SalaryAcctResultBO { List childrenColumns = Lists.newArrayList(); for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) { if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) { - childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); + childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); } else { - childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); + childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); } } - WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns); + WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemGroupDTO.getName()), salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns); columns.add(weaTableColumnWapper); } // 没有分类的薪资项目 for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) { if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) { - columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); + columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); } else { - columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); + columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); } } // 回算的薪资项目 for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getBackCalcItems()) { if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) { - columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); + columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern())); } else { - columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); + columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern())); } } @@ -442,9 +442,9 @@ public class SalaryAcctResultBO { sortItem(salarySobItemPOMap); // 根据账套分组封装薪资项目的值 List itemsByGroup = new ArrayList<>(); - for(SalarySobItemGroupPO groupPO : salarySobItemGroupPOS){ - List groupItems = salarySobItemPOMap.getOrDefault(groupPO.getId(),Collections.emptyList()); - if(CollectionUtils.isNotEmpty(groupItems)){ + for (SalarySobItemGroupPO groupPO : salarySobItemGroupPOS) { + List groupItems = salarySobItemPOMap.getOrDefault(groupPO.getId(), Collections.emptyList()); + if (CollectionUtils.isNotEmpty(groupItems)) { List items = groupItems.stream() .map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap)) .collect(Collectors.toList()); @@ -452,12 +452,12 @@ public class SalaryAcctResultBO { .salarySobItemGroupId(groupPO.getId()) .salarySobItemGroupName(groupPO.getName()) .salaryItems(items) - .sortedIndex(groupPO.getSortedIndex()).build() ); + .sortedIndex(groupPO.getSortedIndex()).build()); } } // 未分类 List noGroupItems = salarySobItemPOMap.getOrDefault(0L, Collections.emptyList()); - if(CollectionUtils.isNotEmpty(noGroupItems)){ + if (CollectionUtils.isNotEmpty(noGroupItems)) { List items = noGroupItems.stream() .map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap)) .collect(Collectors.toList()); @@ -469,7 +469,6 @@ public class SalaryAcctResultBO { } - // // 公式项的值(不根据salaryItemPO的valueType判断是因为薪资项目的valueType属性改变后并不会同步更新薪资账套中的薪资项目的formulaId字段) // List formulaItems = salarySobItemPOS.stream() // .filter(salarySobItemPO -> salarySobItemPO.getFormulaId() > 0) @@ -500,7 +499,7 @@ public class SalaryAcctResultBO { } public static List sortGroup(List salarySobItemGroupPOS) { - if(CollectionUtils.isEmpty(salarySobItemGroupPOS)){ + if (CollectionUtils.isEmpty(salarySobItemGroupPOS)) { return Collections.emptyList(); } return salarySobItemGroupPOS.stream().sorted(Comparator.comparingInt(SalarySobItemGroupPO::getSortedIndex)).collect(Collectors.toList()); @@ -508,10 +507,9 @@ public class SalaryAcctResultBO { /** * 薪资账套的薪资项目按照sortedIndex排序 - * */ public static void sortItem(Map> salarySobItemPOMap) { - for(Map.Entry> entry : salarySobItemPOMap.entrySet()){ + for (Map.Entry> entry : salarySobItemPOMap.entrySet()) { List items = entry.getValue(); if (CollectionUtils.isNotEmpty(items)) { List sortedValue = items.stream().sorted(Comparator.comparingInt(SalarySobItemPO::getSortedIndex)).collect(Collectors.toList()); @@ -535,9 +533,9 @@ public class SalaryAcctResultBO { SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(Optional.ofNullable(salarySobItemPO).map(SalarySobItemPO::getValueType).orElse(0)); String itemFormulaContent; - if(Objects.equals(salaryValueTypeEnum.getValue(),SalaryValueTypeEnum.FORMULA.getValue())){ + if (Objects.equals(salaryValueTypeEnum.getValue(), SalaryValueTypeEnum.FORMULA.getValue())) { itemFormulaContent = Optional.ofNullable(formulaContentMap.get(salarySobItemPO.getSalaryItemId().toString())).map(SalaryAcctResultListColumnDTO::getFormulaContent).orElse(""); - }else{ + } else { itemFormulaContent = salaryValueTypeEnum == null ? "" : salaryValueTypeEnum.getDefaultLabel(); } diff --git a/src/com/engine/salary/util/page/SalaryPageUtil.java b/src/com/engine/salary/util/page/SalaryPageUtil.java index 062b5408f..4a39874cb 100644 --- a/src/com/engine/salary/util/page/SalaryPageUtil.java +++ b/src/com/engine/salary/util/page/SalaryPageUtil.java @@ -2,6 +2,7 @@ package com.engine.salary.util.page; import com.github.pagehelper.PageHelper; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.Collections; @@ -37,8 +38,8 @@ public class SalaryPageUtil { return pageInfo; } - public static PageInfo buildPage(Integer pageNo, Integer pageSize,List totalCollection) { - PageInfo pageInfo = new PageInfo<>(); + public static PageInfo buildPage(Integer pageNo, Integer pageSize, List totalCollection) { + PageInfo pageInfo = new PageInfo<>(); pageInfo.setTotal(totalCollection.size()); totalCollection = subList(pageNo, pageSize, totalCollection); pageInfo.setPageNum(pageNo); @@ -90,4 +91,11 @@ public class SalaryPageUtil { return source.subList(startIndex > source.size() ? source.size() : startIndex, endIndex > source.size() ? source.size() : endIndex); } + + public static String selfAdaption(String chars) { + if (StringUtils.isNotEmpty(chars)) { + return chars.length() * 12+40 + ""; + } + return "150"; + } }