110 lines
5.3 KiB
Java
110 lines
5.3 KiB
Java
package com.engine.salary.service.impl;
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
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.TaxDeclarationValueMapper;
|
|
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;
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
|
import com.engine.salary.util.page.PageInfo;
|
|
import com.engine.salary.util.page.SalaryPageUtil;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import weaver.hrm.User;
|
|
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 个税申报表明细中的人员
|
|
* <p>Copyright: Copyright (c) 2023</p>
|
|
* <p>Company: 泛微软件</p>
|
|
*
|
|
* @author qiantao
|
|
* @version 1.0
|
|
**/
|
|
public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclareEmployeeService {
|
|
|
|
|
|
private TaxDeclarationValueMapper getTaxDeclarationValueMapper() {
|
|
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
|
|
}
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
|
}
|
|
|
|
private ExtEmpService getExtEmpService(User user) {
|
|
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
|
|
}
|
|
|
|
private EmployeeDeclareService getEmployeeDeclareService(User user) {
|
|
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
|
|
}
|
|
|
|
@Override
|
|
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
|
|
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NotDeclareByParam(queryParam);
|
|
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
|
|
}
|
|
|
|
@Override
|
|
public List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
|
|
return getTaxDeclarationValueMapper().list4NotDeclareByParam(queryParam);
|
|
}
|
|
|
|
@Override
|
|
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
|
|
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NoValueByParam(queryParam);
|
|
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
|
|
}
|
|
|
|
@Override
|
|
public List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
|
|
return getTaxDeclarationValueMapper().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 = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(
|
|
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 = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
|
|
// 查询人员薪资(身份证号码等)
|
|
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).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 = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
|
|
|
|
return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
|
|
}
|
|
}
|