weaver-hrm-salary/src/com/engine/salary/service/impl/TaxDeclareEmployeeServiceIm...

110 lines
5.3 KiB
Java
Raw Normal View History

2023-08-11 14:20:14 +08:00
package com.engine.salary.service.impl;
2023-08-20 14:03:43 +08:00
import com.engine.common.util.ServiceUtil;
2023-08-11 14:20:14 +08:00
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclareEmployeeBO;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
2023-08-20 14:03:43 +08:00
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
2023-08-11 14:20:14 +08:00
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.ExtEmpService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxDeclareEmployeeService;
import com.engine.salary.util.SalaryEntityUtil;
2023-08-20 14:03:43 +08:00
import com.engine.salary.util.db.MapperProxyFactory;
2023-08-11 14:20:14 +08:00
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
2023-08-20 14:03:43 +08:00
import weaver.hrm.User;
2023-08-11 14:20:14 +08:00
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
2023-08-23 16:49:45 +08:00
* 个税申报表明细中的人员
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
2023-08-11 14:20:14 +08:00
public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclareEmployeeService {
2023-08-20 14:03:43 +08:00
private TaxDeclarationValueMapper getTaxDeclarationValueMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
2023-08-11 14:20:14 +08:00
2023-08-20 14:03:43 +08:00
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
2023-08-11 14:20:14 +08:00
2023-08-20 14:03:43 +08:00
private ExtEmpService getExtEmpService(User user) {
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
}
2023-08-11 14:20:14 +08:00
2023-08-20 14:03:43 +08:00
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
2023-08-11 14:20:14 +08:00
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
2023-08-20 14:03:43 +08:00
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NotDeclareByParam(queryParam);
2023-08-11 14:20:14 +08:00
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
2023-08-20 14:03:43 +08:00
return getTaxDeclarationValueMapper().list4NotDeclareByParam(queryParam);
2023-08-11 14:20:14 +08:00
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
2023-08-20 14:03:43 +08:00
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NoValueByParam(queryParam);
2023-08-11 14:20:14 +08:00
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
2023-08-20 14:03:43 +08:00
return getTaxDeclarationValueMapper().list4NoValueByParam(queryParam);
2023-08-11 14:20:14 +08:00
}
@Override
public List<AbnormalEmployeeListDTO> convert2AbnormalEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List<TaxDeclareEmployeePO> taxDeclareEmployees) {
if (CollectionUtils.isEmpty(taxDeclareEmployees)) {
return Collections.emptyList();
}
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclareEmployees, TaxDeclareEmployeePO::getEmployeeId);
// 查询报送的人员
2023-08-20 14:03:43 +08:00
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(
2023-08-14 20:07:29 +08:00
taxDeclareRecord.getTaxCycle(), taxDeclareRecord.getTaxAgentId(), employeeIds);
2023-08-11 14:20:14 +08:00
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
2023-08-20 14:03:43 +08:00
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
2023-08-11 14:20:14 +08:00
// 查询人员薪资(身份证号码等)
2023-08-20 14:03:43 +08:00
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(simpleEmployeeIds);
2023-08-11 14:20:14 +08:00
// 查询外部人员
List<Long> extEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.collect(Collectors.toList());
2023-08-20 14:03:43 +08:00
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
2023-08-11 14:20:14 +08:00
return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
}
}