diff --git a/fw-morax-service/src/main/java/cn/fw/morax/service/biz/salary/SalaryReportService.java b/fw-morax-service/src/main/java/cn/fw/morax/service/biz/salary/SalaryReportService.java index 7321e72..7a86e60 100644 --- a/fw-morax-service/src/main/java/cn/fw/morax/service/biz/salary/SalaryReportService.java +++ b/fw-morax-service/src/main/java/cn/fw/morax/service/biz/salary/SalaryReportService.java @@ -2,6 +2,7 @@ package cn.fw.morax.service.biz.salary; import cn.fw.common.exception.BusinessException; import cn.fw.ehr.sdk.api.enums.StaffShopTypeEnum; +import cn.fw.morax.common.constant.Constant; import cn.fw.morax.common.utils.DateUtil; import cn.fw.morax.common.utils.PublicUtil; import cn.fw.morax.domain.db.PayrollRecord; @@ -37,7 +38,6 @@ import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.YearMonth; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -272,11 +272,15 @@ public class SalaryReportService { if (! ExtraSalaryTypeEnum.SUBSIDY.equals(extraDTO.getSalaryType())) { return; } + LocalDate dataDate = DateUtil.date2LocalDate(extraDTO.getDataDate()); LocalDate firstDay = DateUtil.date2LocalDate(extraDTO.getDataDate()).with(TemporalAdjusters.firstDayOfMonth()); + //如果是第一天 清除结束日期也是第一天, 否则是前一天 + LocalDate cleanEndDay = (firstDay.compareTo(dataDate) == 0) ? firstDay : dataDate.minusDays(1); salaryExtraProjectService.remove(Wrappers.lambdaQuery() .eq(SalaryExtraProject::getUserId, extraDTO.getUserId()) .eq(SalaryExtraProject::getSalaryType, ExtraSalaryTypeEnum.SUBSIDY) .ge(SalaryExtraProject::getDataDate, firstDay) + .le(SalaryExtraProject::getDataDate, cleanEndDay) ); } @@ -351,6 +355,12 @@ public class SalaryReportService { if (PublicUtil.isNotEmpty(dto.getTypeId())) { dto.setTypeId(dto.getTypeId()); } + if (PublicUtil.isEmpty(dto.getDataId())) { + salaryExtraProject.setDataId(""); + } + if (PublicUtil.isEmpty(dto.getDataName())) { + salaryExtraProject.setDataName(""); + } if (PublicUtil.isNotEmpty(dto.getTypeName())) { dto.setTypeName(dto.getTypeName()); }