增加搜索条件颗粒度

This commit is contained in:
钱涛 2023-11-24 16:49:54 +08:00
parent f77b4c063b
commit 3ab8840ccd
1 changed files with 19 additions and 22 deletions

View File

@ -2,7 +2,6 @@ package com.engine.salary.service.impl;
import cn.hutool.core.date.DateUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.api.formmode.page.util.Util;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
@ -39,8 +38,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import java.util.*;
import java.util.stream.Collectors;
@ -620,30 +617,30 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// 获取分部信息
List<Long> subCompanyIds = param.getSubCompany();
if (CollectionUtils.isNotEmpty(subCompanyIds)) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
List<String> allSubcompanyIds = new ArrayList<>();
for (Long subCompanyId : subCompanyIds) {
String organizationIds = Util.null2String(subCompanyId);
String allChildSubcompanyId = subCompanyComInfo.getAllChildSubcompanyId(subCompanyId.toString(), organizationIds);
allSubcompanyIds.addAll(Arrays.asList(allChildSubcompanyId.split(",")));
}
employeeList = employeeList.stream().filter(emp -> allSubcompanyIds.contains(emp.getSubcompanyid().toString())).collect(Collectors.toList());
// SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
// List<String> allSubcompanyIds = new ArrayList<>();
// for (Long subCompanyId : subCompanyIds) {
// String organizationIds = Util.null2String(subCompanyId);
// String allChildSubcompanyId = subCompanyComInfo.getAllChildSubcompanyId(subCompanyId.toString(), organizationIds);
// allSubcompanyIds.addAll(Arrays.asList(allChildSubcompanyId.split(",")));
// }
employeeList = employeeList.stream().filter(emp -> subCompanyIds.contains(emp.getSubcompanyid())).collect(Collectors.toList());
}
// 部门过滤
List<Long> depart = param.getDepart();
if (CollectionUtils.isNotEmpty(depart)) {
List<String> allDepartIds = new ArrayList<>();
for (Long subDepartId : depart) {
String ids = Util.null2String(subDepartId);
try {
String allDepartId = DepartmentComInfo.getAllChildDepartId(subDepartId.toString(), ids);
allDepartIds.addAll(Arrays.asList(allDepartId.toString().split(",")));
} catch (Exception e) {
log.error("获取子部门失败", e);
}
}
employeeList = employeeList.stream().filter(emp -> allDepartIds.contains(emp.getDepartmentId().toString())).collect(Collectors.toList());
// List<String> allDepartIds = new ArrayList<>();
// for (Long subDepartId : depart) {
// String ids = Util.null2String(subDepartId);
// try {
// String allDepartId = DepartmentComInfo.getAllChildDepartId(subDepartId.toString(), ids);
// allDepartIds.addAll(Arrays.asList(allDepartId.toString().split(",")));
// } catch (Exception e) {
// log.error("获取子部门失败", e);
// }
// }
employeeList = employeeList.stream().filter(emp -> depart.contains(emp.getDepartmentId())).collect(Collectors.toList());
}
// 职级过滤
// if (CollectionUtils.isNotEmpty(param.getGrade())) {