This commit is contained in:
钱涛 2024-01-04 15:56:42 +08:00
parent f3fa6c6f32
commit be25234e0e
1 changed files with 32 additions and 12 deletions

View File

@ -41,8 +41,6 @@ import weaver.hrm.User;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static weaver.conn.ExternalDataSourceManager.list;
/** /**
* 个税申报表 * 个税申报表
* <p>Copyright: Copyright (c) 2023</p> * <p>Copyright: Copyright (c) 2023</p>
@ -332,20 +330,42 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
} }
public void contrast(Long taxDeclarationId) { public void contrast(Long taxDeclarationId) {
TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(taxDeclarationId); TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(taxDeclarationId);
if (declarationPO == null) { if (taxDeclaration == null) {
throw new SalaryRunTimeException("无申报表"); throw new SalaryRunTimeException("无申报表");
} }
TaxDeclarationPO taxDeclarationPO;
if (CollectionUtils.isNotEmpty(list)) { List<TaxDeclarationValuePO> taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId());
if (list.size() > 1) {
throw new SalaryRunTimeException("存在多条正常工资薪金申报表数据"); // 查询个税申报表表头
} IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
taxDeclarationPO = list.get(0); List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum, 0);
} else { // 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.collect(Collectors.toList());
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 列表表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
}
} }
} }