Commit b1c2250d03ff6e8e2901c29a2e15b08538edc49c

Authored by 姜超
1 parent bc484bc4

feature(*): 补贴数据清除修改

补贴数据清除修改
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;
2 2  
3 3 import cn.fw.common.exception.BusinessException;
4 4 import cn.fw.ehr.sdk.api.enums.StaffShopTypeEnum;
  5 +import cn.fw.morax.common.constant.Constant;
5 6 import cn.fw.morax.common.utils.DateUtil;
6 7 import cn.fw.morax.common.utils.PublicUtil;
7 8 import cn.fw.morax.domain.db.PayrollRecord;
... ... @@ -37,7 +38,6 @@ import org.springframework.util.CollectionUtils;
37 38  
38 39 import java.text.SimpleDateFormat;
39 40 import java.time.LocalDate;
40   -import java.time.LocalDateTime;
41 41 import java.time.YearMonth;
42 42 import java.time.temporal.TemporalAdjusters;
43 43 import java.util.*;
... ... @@ -272,11 +272,15 @@ public class SalaryReportService {
272 272 if (! ExtraSalaryTypeEnum.SUBSIDY.equals(extraDTO.getSalaryType())) {
273 273 return;
274 274 }
  275 + LocalDate dataDate = DateUtil.date2LocalDate(extraDTO.getDataDate());
275 276 LocalDate firstDay = DateUtil.date2LocalDate(extraDTO.getDataDate()).with(TemporalAdjusters.firstDayOfMonth());
  277 + //如果是第一天 清除结束日期也是第一天, 否则是前一天
  278 + LocalDate cleanEndDay = (firstDay.compareTo(dataDate) == 0) ? firstDay : dataDate.minusDays(1);
276 279 salaryExtraProjectService.remove(Wrappers.<SalaryExtraProject>lambdaQuery()
277 280 .eq(SalaryExtraProject::getUserId, extraDTO.getUserId())
278 281 .eq(SalaryExtraProject::getSalaryType, ExtraSalaryTypeEnum.SUBSIDY)
279 282 .ge(SalaryExtraProject::getDataDate, firstDay)
  283 + .le(SalaryExtraProject::getDataDate, cleanEndDay)
280 284 );
281 285 }
282 286  
... ... @@ -351,6 +355,12 @@ public class SalaryReportService {
351 355 if (PublicUtil.isNotEmpty(dto.getTypeId())) {
352 356 dto.setTypeId(dto.getTypeId());
353 357 }
  358 + if (PublicUtil.isEmpty(dto.getDataId())) {
  359 + salaryExtraProject.setDataId("");
  360 + }
  361 + if (PublicUtil.isEmpty(dto.getDataName())) {
  362 + salaryExtraProject.setDataName("");
  363 + }
354 364 if (PublicUtil.isNotEmpty(dto.getTypeName())) {
355 365 dto.setTypeName(dto.getTypeName());
356 366 }
... ...