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