Merge remote-tracking branch 'remotes/origin/develop' into feature/checkImport

This commit is contained in:
sy 2022-10-08 09:14:54 +08:00
commit 7ffd295be0
3 changed files with 34 additions and 3 deletions

View File

@ -39,7 +39,7 @@
</resultMap>
<select id="listPage4EmployeeId" resultMap="resultMap">
SELECT DISTINCT employee_type, employee_id
SELECT employee_type, employee_id
FROM hrsa_tax_declaration_detail t
LEFT JOIN hrmresource e ON e.id = t.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID

View File

@ -85,9 +85,16 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
// SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<TaxDeclarationEmployeeDTO> taxDeclarationEmployeeDTOS = getTaxDeclarationDetailMapper().listPage4EmployeeId(queryParam);
return new PageInfo<>(taxDeclarationEmployeeDTOS, TaxDeclarationEmployeeDTO.class);
taxDeclarationEmployeeDTOS = taxDeclarationEmployeeDTOS.stream().filter(SalaryEntityUtil.distinctByKey(TaxDeclarationEmployeeDTO::getEmployeeId)).collect(Collectors.toList());
List<TaxDeclarationEmployeeDTO> list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationEmployeeDTOS);
PageInfo<TaxDeclarationEmployeeDTO> pageInfo = new PageInfo<>(list, TaxDeclarationEmployeeDTO.class);
pageInfo.setPageNum(queryParam.getCurrent());
pageInfo.setPageSize(queryParam.getPageSize());
pageInfo.setTotal(taxDeclarationEmployeeDTOS.size());
return pageInfo;
}
@Override

View File

@ -12,7 +12,9 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@ -152,6 +154,28 @@ public class SalaryEntityUtil {
Collectors.collectingAndThen(Collectors.toList(), e -> e.stream().map(valueMapper).collect(Collectors.toList()))));
}
/**
* LinkedHashMap有序去重
* @param keyExtractor
* @param <T>
* @return
*/
public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) {
LinkedHashMap<Object, Boolean> map = new LinkedHashMap<>();
return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
/**
* ConcurrentHashMap无序去重
* @param keyExtractor
* @param <T>
* @return
*/
public static <T> Predicate<T> distinctByKeyMap(Function<? super T, Object> keyExtractor) {
ConcurrentHashMap<Object, Boolean> map = new ConcurrentHashMap<>();
return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
public static <T> BigDecimal reduce(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollectionUtils.isEmpty(objs)) {
return BigDecimal.ZERO;