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

This commit is contained in:
fcli 2023-01-05 09:25:07 +08:00
parent 4726b9560c
commit 8e0bf2b693
1 changed files with 9 additions and 3 deletions

View File

@ -56,6 +56,7 @@ import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -1026,7 +1027,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
List<Long> deleteIds = deleteParam.getIds();
// 已经核算过的不可操作
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER);
salaryMonthDate = salaryMonthDate.plusMonths(1);
String format = salaryMonthDate.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM"));
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(format);
// 判断是否有核算过
List<Long> deleteList = new ArrayList<>();
for(int i=0; i<deleteIds.size(); i++){
@ -1069,7 +1073,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
AddUpSituation queryParam = null;
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
if(deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()){
// 设置了个税扣缴义务人
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId));
@ -1085,8 +1089,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
// 获取所有想要删除的数据
List<AddUpSituation> list = biz.listSome(queryParam);
LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER);
String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM"));
// 获取已经核算的数据
List<SalaryAcctEmployeePO> employees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
List<SalaryAcctEmployeePO> employees = getAddUpDeductionService(user).getAccountedEmployeeData(format);
for(AddUpSituation item : list){
if (CollectionUtils.isNotEmpty(employees)) {
Optional<SalaryAcctEmployeePO> optionalAcctEmp = employees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst();