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

102 lines
5.0 KiB
Java
Raw Normal View History

2023-08-11 14:20:14 +08:00
package com.engine.salary.service.impl;
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;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
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.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @description: 个税申报表明细中的人员
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/10 4:12 PM
* @version:v1.0
*/
public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclareEmployeeService {
// private TaxDeclarationValueMapper taxDeclarationValueMapper;
private TaxDeclarationDetailMapper taxDeclarationValueMapper;
private SalaryEmployeeService hrmCommonEmployeeService;
private SalaryEmployeeService salaryEmployeeService;
private ExtEmpService extEmployeeService;
private EmployeeDeclareService employeeDeclareService;
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NotDeclareByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NotDeclareByParam(queryParam);
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NoValueByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NoValueByParam(queryParam);
}
@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);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds(
SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()), taxDeclareRecord.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资(身份证号码等)
List<DataCollectionEmployee> simpleUserInfos = salaryEmployeeService.listByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.collect(Collectors.toList());
List<ExtEmpPO> extEmployees = extEmployeeService.getExtEmpByIds(extEmployeeIds);
return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
}
}