diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 73445ee72..e6ad762f4 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -210,7 +210,14 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration .replace("{1}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth()))); } // 查询薪资所属月的薪资核算记录 - salaryAcctRecordPOS = listBySalaryMonth(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).taxAgentId(taxAgentId).build()); + salaryAcctRecordPOS = listBySalaryMonth(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).build()); + List salarySobPOS = getSalarySobService(user).listByTaxAgentId(saveParam.getTaxAgentId()); + if (CollectionUtils.isEmpty(salarySobPOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}该义务人下无账套数据").replace("{0}", saveParam.getSalaryMonth().toString())); + } + List salarySobIds = salarySobPOS.stream().map(SalarySobPO::getId).collect(Collectors.toList()); + + salaryAcctRecordPOS.stream().filter(record -> salarySobIds.contains(record.getSalarySobId())).collect(Collectors.toList()); // 无薪资核算记录,不允许生成个税申报表 if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {