diff --git a/src/com/engine/salary/biz/SalarySendRangeObjBiz.java b/src/com/engine/salary/biz/SalarySendRangeObjBiz.java index 05ccaaadb..53633dce6 100644 --- a/src/com/engine/salary/biz/SalarySendRangeObjBiz.java +++ b/src/com/engine/salary/biz/SalarySendRangeObjBiz.java @@ -7,6 +7,8 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper; import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.util.db.MapperProxyFactory; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -23,6 +25,10 @@ public class SalarySendRangeObjBiz { return ServiceUtil.getService(TaxAgentServiceImpl.class); } + private SalarySendRangeObjMapper getSalarySendRangeObjMapper() { + return MapperProxyFactory.getProxy(SalarySendRangeObjMapper.class); + } + public R applyMapper(Function mapper) { try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) { final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class); @@ -41,7 +47,13 @@ public class SalarySendRangeObjBiz { } public List getSalarySendUserInfoDTOs(List employees) { - List userDTOs = applyMapper(mapper -> mapper.getUserInfoByEmployeeIds(employees)); + List userDTOs = new ArrayList<>(); + List> partition = Lists.partition(employees, 500); + partition.forEach(l->{ + List userInfos = getSalarySendRangeObjMapper().getUserInfoByEmployeeIds(l); + userDTOs.addAll(userInfos); + }); + Map userMap = userDTOs.stream() .collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity())); diff --git a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java index b737f857e..8424aa765 100644 --- a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java +++ b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.time.YearMonth; +import java.util.List; /** * 薪资核算列表查询参数 @@ -31,6 +32,11 @@ public class SalaryAcctRecordQueryParam extends BaseQueryParam { //账套名称") private String name; + /** + * 扣缴义务人id集合 + */ + private List taxAgentIds; + private String startMonthStr; private String endMonthStr; } diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index c451f0f67..ffab3136b 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollUtil; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; @@ -187,6 +188,21 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); po.setSalarySobIds(salarySobIds); } + if (CollUtil.isNotEmpty(queryParam.getTaxAgentIds())) { + List salarySobPOS = getSalarySobService(user).listByTaxAgentIds(queryParam.getTaxAgentIds()); + if (CollectionUtils.isEmpty(salarySobPOS)) { + return page; + } + Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); + + Collection existIds = po.getSalarySobIds(); + if (CollectionUtils.isNotEmpty(existIds)) { + existIds = SalaryEntityUtil.intersectionForList(existIds, salarySobIds); + po.setSalarySobIds(existIds); + } else { + po.setSalarySobIds(salarySobIds); + } + } LocalDateRange localDateRange = new LocalDateRange(); if (Objects.nonNull(queryParam.getStartMonth())) { localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getStartMonth().atDay(1))); @@ -804,6 +820,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe @Override public void updateDate(Long id, Date updateTime) { - getSalaryAcctRecordMapper().updateDate(id,updateTime); + getSalaryAcctRecordMapper().updateDate(id, updateTime); } } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 65c200b7b..1c11ad7f4 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1357,7 +1357,12 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe if (CollectionUtils.isEmpty(employeeIds)) { return Collections.emptyList(); } - return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds); + List> partition = Lists.partition(employeeIds, 500); + List resultList = new ArrayList<>(); + partition.forEach(part -> { + resultList.addAll(getSalaryArchiveMapper().listPayEndDateIsNull(part)); + }); + return resultList; } @Override diff --git a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java index 41bec2448..e51b45513 100644 --- a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java @@ -166,16 +166,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService && Optional.ofNullable(salaryBillProgress.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(136104, "有其他人员正在发送中,请等待其他人员发送结束后再操作")); } - // 初始化进度 - ProgressDTO initProgress = ProgressDTO.builder() - .title(SalaryI18nUtil.getI18nLabel(136097, "发送中")) - .totalQuantity(NumberUtils.INTEGER_ZERO) - .calculatedQuantity(NumberUtils.INTEGER_ZERO) - .progress(BigDecimal.ZERO) - .status(true) - .message("") - .build(); - getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress); List ids = param.getIds(); @@ -187,6 +177,17 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService throw new SalaryRunTimeException("工资发放范围内没有匹配员工"); } } + // 初始化进度 + ProgressDTO initProgress = ProgressDTO.builder() + .title(SalaryI18nUtil.getI18nLabel(136097, "发送中")) + .totalQuantity(NumberUtils.INTEGER_ZERO) + .calculatedQuantity(NumberUtils.INTEGER_ZERO) + .progress(BigDecimal.ZERO) + .status(true) + .message("") + .build(); + getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress); + // 异步执行 List finalIds = ids; LocalRunnable localRunnable = new LocalRunnable() {