feat: 往期累计一键清空校验bug修复

This commit is contained in:
fcli 2023-01-05 09:40:43 +08:00
parent 8e0bf2b693
commit eb3c75197b
2 changed files with 25 additions and 2 deletions

View File

@ -109,6 +109,8 @@ public interface AddUpDeductionService {
*/
List<SalaryAcctEmployeePO> getAccountedEmployeeData(String yearMonth);
List<SalaryAcctEmployeePO> getAccountedEmployeeDataByTaxYearMonth(String yearMonth);
/**
* @description 编辑累计专项附加扣除
* @return void

View File

@ -546,7 +546,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
List<Long> deleteIds = deleteParam.getIds();
// 已经核算过的不可操作
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr);
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr);
// 判断是否有核算过
List<Long> deleteList = new ArrayList<>();
for (int i = 0; i < deleteIds.size(); i++) {
@ -604,7 +604,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
// 获取所有想要删除的数据
List<AddUpDeductionDTO> list = addUpDeductionBiz.list(queryParam);
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr);
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr);
for (AddUpDeductionDTO item : list) {
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst();
@ -1176,4 +1176,25 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
return list;
}
@Override
public List<SalaryAcctEmployeePO> getAccountedEmployeeDataByTaxYearMonth(String yearMonth) {
List<SalaryAcctEmployeePO> list = Lists.newArrayList();
YearMonth month = YearMonth.parse(yearMonth);
LocalDate salaryMonthDate = month.atDay(1);
LocalDate salaryMonthEndDate = month.atEndOfMonth();
List<SalaryAcctRecordPO> salaryAcctRecords = getSalaryAcctRecordService(user).listByTaxCycle(
LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate))
.endDate(SalaryDateUtil.localDateToDate(salaryMonthEndDate)).build(),
null);
salaryAcctRecords.forEach(e -> {
boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue();
if (isAccounted) {
// list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(e.getId())));
}
});
return list;
}
}