From eb3c75197b858465a0e6fe2fc37a1a32cbbd7171 Mon Sep 17 00:00:00 2001 From: fcli Date: Thu, 5 Jan 2023 09:40:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=80=E6=9C=9F=E7=B4=AF=E8=AE=A1?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=B8=85=E7=A9=BA=E6=A0=A1=E9=AA=8Cbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/AddUpDeductionService.java | 2 ++ .../impl/AddUpDeductionServiceImpl.java | 25 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 88f7c3898..51498f653 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -109,6 +109,8 @@ public interface AddUpDeductionService { */ List getAccountedEmployeeData(String yearMonth); + List getAccountedEmployeeDataByTaxYearMonth(String yearMonth); + /** * @description 编辑累计专项附加扣除 * @return void diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 97b8afa01..9d0de576c 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -546,7 +546,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List deleteIds = deleteParam.getIds(); // 已经核算过的不可操作 // 获取已经核算的数据 - List salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr); + List salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr); // 判断是否有核算过 List deleteList = new ArrayList<>(); for (int i = 0; i < deleteIds.size(); i++) { @@ -604,7 +604,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 获取所有想要删除的数据 List list = addUpDeductionBiz.list(queryParam); // 获取已经核算的数据 - List salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr); + List salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr); for (AddUpDeductionDTO item : list) { if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { Optional 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 getAccountedEmployeeDataByTaxYearMonth(String yearMonth) { + List list = Lists.newArrayList(); + YearMonth month = YearMonth.parse(yearMonth); + LocalDate salaryMonthDate = month.atDay(1); + LocalDate salaryMonthEndDate = month.atEndOfMonth(); + List 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; + } + }