2022-04-07 16:54:10 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.biz.EmployBiz;
|
|
|
|
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|
|
|
|
import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO;
|
|
|
|
|
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
|
|
|
|
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
2022-06-10 13:33:48 +08:00
|
|
|
import com.engine.salary.mapper.datacollection.EmployMapper;
|
2022-04-07 16:54:10 +08:00
|
|
|
import com.engine.salary.service.SalaryEmployeeService;
|
|
|
|
|
import com.engine.salary.service.SalarySobRangeService;
|
|
|
|
|
import com.engine.salary.util.SalaryEntityUtil;
|
2022-06-10 13:33:48 +08:00
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-04-07 16:54:10 +08:00
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
2022-06-10 13:33:48 +08:00
|
|
|
import java.util.ArrayList;
|
2022-04-07 16:54:10 +08:00
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人员信息
|
|
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
|
|
|
|
public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployeeService {
|
|
|
|
|
|
|
|
|
|
private EmployBiz employBiz = new EmployBiz();
|
|
|
|
|
|
|
|
|
|
private SalarySobRangeService getSalarySobRangeService(User user) {
|
|
|
|
|
return (SalarySobRangeService) ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-10 13:33:48 +08:00
|
|
|
private EmployMapper getEmployMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(EmployMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 16:54:10 +08:00
|
|
|
@Override
|
|
|
|
|
public List<DataCollectionEmployee> listAll() {
|
|
|
|
|
return employBiz.listEmployee();
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-11 17:31:33 +08:00
|
|
|
@Override
|
|
|
|
|
public List<DataCollectionEmployee> listAllForReport() {
|
|
|
|
|
return getEmployMapper().listAllForReport();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 16:54:10 +08:00
|
|
|
@Override
|
|
|
|
|
public List<DataCollectionEmployee> listBySalarySobId(Long salarySobId) {
|
|
|
|
|
// 查询薪资账套的人员范围
|
|
|
|
|
List<SalarySobRangePO> includeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ONE);
|
|
|
|
|
if (CollectionUtils.isEmpty(includeSalarySobRangePOS)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
// 将薪资账套的人员范围转换成人员查询参数
|
|
|
|
|
List<SalarySobRangeEmpQueryParam> includeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(includeSalarySobRangePOS);
|
|
|
|
|
// 根据上一步的查询参数查询人员
|
|
|
|
|
List<DataCollectionEmployee> includeSalaryEmployees = employBiz.listByParams(includeQueryParams);
|
|
|
|
|
if (CollectionUtils.isEmpty(includeSalaryEmployees)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
// 查询薪资账套的人员范围(从范围中排除)
|
|
|
|
|
List<SalarySobRangePO> excludeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ZERO);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(excludeSalarySobRangePOS)) {
|
|
|
|
|
// 将薪资账套的人员范围转换成人员查询参数
|
|
|
|
|
List<SalarySobRangeEmpQueryParam> excludeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(excludeSalarySobRangePOS);
|
|
|
|
|
// 根据上一步的查询参数查询人员
|
|
|
|
|
List<DataCollectionEmployee> excludeSalaryEmployees = employBiz.listByParams(excludeQueryParams);
|
|
|
|
|
// 需要排除的人员范围
|
|
|
|
|
Set<Long> excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId);
|
|
|
|
|
// 过滤人员
|
|
|
|
|
includeSalaryEmployees = includeSalaryEmployees.stream()
|
|
|
|
|
.filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
return includeSalaryEmployees;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DataCollectionEmployee> listByIds(List<Long> ids) {
|
|
|
|
|
return employBiz.getEmployeeByIdsAll(ids);
|
|
|
|
|
}
|
2022-04-08 19:08:59 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public DataCollectionEmployee getEmployeeById(Long employeeId) {
|
|
|
|
|
return employBiz.getEmployeeById(employeeId);
|
|
|
|
|
}
|
2022-06-10 13:33:48 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DataCollectionEmployee> getEmployeeByIds(List<Long> simpleEmployeeIds) {
|
|
|
|
|
if(CollectionUtils.isEmpty(simpleEmployeeIds)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
return getEmployMapper().getEmployeeByIds(simpleEmployeeIds);
|
|
|
|
|
|
|
|
|
|
}
|
2022-04-07 16:54:10 +08:00
|
|
|
}
|