核算自定义其他搜索条件

This commit is contained in:
钱涛 2023-10-08 15:44:09 +08:00
parent 182e90676c
commit 5f152a991b
1 changed files with 32 additions and 4 deletions

View File

@ -45,6 +45,7 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@ -304,8 +305,35 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override
public PageInfo<Map<String, Object>> listPageByParam(SalaryAcctResultQueryParam queryParam) {
// 查询薪资核算人员分页
PageInfo<SalaryAcctEmployeePO> page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
PageInfo<SalaryAcctEmployeePO> page = null;
//其他条件
List<SalaryAcctResultQueryParam.OtherCondition> otherConditions = queryParam.getOtherConditions();
if (CollectionUtils.isNotEmpty(otherConditions)) {
List<Long> items = SalaryEntityUtil.properties(otherConditions, SalaryAcctResultQueryParam.OtherCondition::getItemId, Collectors.toList());
List<SalaryAcctResultPO> list = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singletonList(queryParam.getSalaryAcctRecordId()), items);
for (int i = 0; i < otherConditions.size(); i++) {
SalaryAcctResultQueryParam.OtherCondition otherCondition = otherConditions.get(i);
Long itemId = otherCondition.getItemId();
FilterEnum filter = otherCondition.getFilter();
List<String> params = otherCondition.getParams();
list = list.stream().filter(a -> Objects.equals(a.getSalaryItemId(), itemId)).filter(a -> filter.filter(params).test(a.getResultValue())).collect(Collectors.toList());
}
List<Long> salaryAcctEmpId = SalaryEntityUtil.properties(list, SalaryAcctResultPO::getSalaryAcctEmpId, Collectors.toList());
if (CollectionUtils.isEmpty(salaryAcctEmpId)) {
//条件不满足直接返回空列表
page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), new ArrayList<>(), SalaryAcctEmployeePO.class);
} else {
queryParam.setIds(salaryAcctEmpId);
// 查询薪资核算人员分页
page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
}
} else {
// 查询薪资核算人员分页
page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
}
// 查询薪资核算结果
List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam);
// 薪资核算结果的分页结果
@ -398,9 +426,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
simpleEmployees.forEach(e->{
simpleEmployees.forEach(e -> {
UserStatusEnum userStatusEnum = UserStatusEnum.parseByValue(Integer.parseInt(e.getStatus()));
if(userStatusEnum != null){
if (userStatusEnum != null) {
e.setStatusName(userStatusEnum.getDefaultLabel());
}
});