diff --git a/src/com/engine/salary/entity/datacollection/param/AddDeductionAutoAddParam.java b/src/com/engine/salary/entity/datacollection/param/AddDeductionAutoAddParam.java index ba14a6f02..5a3c11b47 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddDeductionAutoAddParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddDeductionAutoAddParam.java @@ -5,6 +5,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Date; +import java.util.List; + /** * @description 数据采集-专项附加扣除一键累计参数 **/ @@ -14,4 +17,8 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class AddDeductionAutoAddParam { String yearMonth = ""; + + Date yearMonthDate; + + List taxAgentIds; } diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 29d3d58a9..e80a3e53d 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -155,5 +155,5 @@ public interface AddUpDeductionService { * @return void * @author lfc */ - String autoAddAll(Date yearMonth, Boolean isAdmin); + String autoAddAll(Date yearMonth, Boolean isAdmin, List taxAgentIds); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index f2bf7b9d8..51360a7f3 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -733,7 +733,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } @Override - public String autoAddAll(Date yearMonth, Boolean isAdmin) { + public String autoAddAll(Date yearMonth, Boolean isAdmin, List taxAgentIds) { String cacheKey = "addUpDeduction_autoAddAll_processing"; Object objVal = Util_DataCache.getObjVal(cacheKey); if (objVal != null) { @@ -750,6 +750,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } else { taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); } + + if (CollectionUtils.isNotEmpty(taxAgentIds)) { + taxAgents = taxAgents.stream().filter(taxAgent -> taxAgentIds.contains(taxAgent.getId())).collect(Collectors.toList()); + } LocalDateTime yearMonthTime = DateUtil.toLocalDateTime(yearMonth); //设置时间到下一年1月1号 Instant instant = yearMonthTime.plusYears(1L) @@ -978,6 +982,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { return new PageInfo<>(AddUpDeductionDTO.class); } + // 过滤义务人筛选框 + if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) { + taxAgentIdsAsAdmin = taxAgentIdsAsAdmin.stream().filter(id -> queryParam.getTaxAgentIds().contains(id)).collect(Collectors.toList()); + } queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } diff --git a/src/com/engine/salary/timer/AutoAddAllSpecialAddDeductionJob.java b/src/com/engine/salary/timer/AutoAddAllSpecialAddDeductionJob.java index 656db3943..694660651 100644 --- a/src/com/engine/salary/timer/AutoAddAllSpecialAddDeductionJob.java +++ b/src/com/engine/salary/timer/AutoAddAllSpecialAddDeductionJob.java @@ -11,6 +11,7 @@ import weaver.hrm.User; import weaver.interfaces.schedule.BaseCronJob; import java.time.LocalDate; +import java.util.Collections; import java.util.Date; /** @@ -31,6 +32,6 @@ public class AutoAddAllSpecialAddDeductionJob extends BaseCronJob { if(StringUtils.isNotBlank(salaryTaxMonth)){ localDate = localDate.plusMonths(Integer.valueOf(salaryTaxMonth.trim())); } - getAddUpDeductionService(null).autoAddAll(DateUtil.beginOfMonth(SalaryDateUtil.localDateToDate(localDate)), Boolean.TRUE); + getAddUpDeductionService(null).autoAddAll(DateUtil.beginOfMonth(SalaryDateUtil.localDateToDate(localDate)), Boolean.TRUE, Collections.emptyList()); } } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index f5c4e0d6b..74d934add 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -375,7 +375,8 @@ public class AddUpDeductionController { } else { date = DateUtil.beginOfMonth(new Date()); } + param.setYearMonthDate(date); User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date); + return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::autoAddAll, param); } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index 9d0229528..68c8e6c4d 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -5,10 +5,7 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -169,13 +166,14 @@ public class AddUpDeductionWrapper extends Service { return getAddUpDeductionService(user).getAddUpDeduction(param); } - public String autoAddAll(Date yearMonth) { + public String autoAddAll(AddDeductionAutoAddParam param) { + Date yearMonth = param.getYearMonthDate(); if (isLog) { log.info("一键累计, 操作人 「{}」", user.getUsername()); } if (yearMonth == null) { throw new SalaryRunTimeException("一键累计传入日期格式错误"); } - return getAddUpDeductionService(user).autoAddAll(yearMonth, null); + return getAddUpDeductionService(user).autoAddAll(yearMonth, null, param.getTaxAgentIds()); } }