From f1f8ae53af335bbe0ab1d928239cbafb40cab2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 3 Nov 2022 19:32:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=A1=B9=E7=9B=AE=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=94=9F=E6=95=88=E6=97=B6=E9=97=B4=E5=8F=96=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E7=BC=B4=E7=BA=B3=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/EmployBiz.java | 8 +++- .../bo/SalaryArchiveExcelBO.java | 12 ++++++ .../impl/SalaryAcctEmployeeServiceImpl.java | 4 +- .../impl/SalaryArchiveServiceImpl.java | 43 +++++++++++++------ 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/src/com/engine/salary/biz/EmployBiz.java b/src/com/engine/salary/biz/EmployBiz.java index 3cd5c6dfe..5b2e288ba 100644 --- a/src/com/engine/salary/biz/EmployBiz.java +++ b/src/com/engine/salary/biz/EmployBiz.java @@ -7,7 +7,6 @@ import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.mapper.datacollection.EmployMapper; import com.google.common.collect.Lists; -import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -113,7 +112,12 @@ public class EmployBiz extends BaseBean { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { EmployMapper mapper = sqlSession.getMapper(EmployMapper.class); - return mapper.listByParams(includeQueryParams); + List emps = new ArrayList<>(); + List> partition = Lists.partition(includeQueryParams, 100); + partition.forEach(list->{ + emps.addAll(mapper.listByParams(list)); + }); + return emps; } finally { sqlSession.close(); } diff --git a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java index 9e7d2f1e3..4e8062365 100644 --- a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java +++ b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java @@ -396,6 +396,14 @@ public class SalaryArchiveExcelBO extends Service { Long taxAgentId = optionalTaxAgent.map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).orElse(null); List finalEmployeeSameIds = employeeSameIds; + if (!optionalTaxAgent.isPresent()) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在"); + excelComments.add(errorMessageMap); +// SalaryArchiveExcelBO.createExcelComment(excelComments, taxAgentRangeMsg, errorCount + 1, errorCount + 1, 0, 0); + isError = true; + return isError; + } Optional optionalTaxAgentEmp = optionalTaxAgent.get().getEmployeeList().stream().filter(f -> finalEmployeeSameIds.contains(f.getEmployeeId())).findFirst(); if (!optionalTaxAgentEmp.isPresent()) { Map errorMessageMap = Maps.newHashMap(); @@ -428,6 +436,10 @@ public class SalaryArchiveExcelBO extends Service { map.put(payStartDateI18n, payStartDateCellVal); map.put("payStartDate", payStartDateCellVal); Date payStartDate = SalaryDateUtil.checkDay(payStartDateCellVal) ? SalaryDateUtil.dateStrToLocalDate(payStartDateCellVal) : null; + //生效日期默认取起始发薪日期 + if (effectiveTime == null) { + effectiveTime = payStartDate; + } // 6.最后发薪日期 String payEndDateCellVal = Optional.ofNullable(map.get(payEndDateI18n)).orElse("").toString().replaceAll(" 00:00:00", ""); // 免得失败后,会追加 00:00:00 diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 37d3632d5..df9666c18 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -486,7 +486,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct // salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList()); // 查询薪资档案,获取人员的个税扣缴义务人 - Set employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId); + List employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId,Collectors.toList()); List salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); // 转换成薪资核算人员po List salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2EmployeePO(employeeIds, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID()); @@ -507,7 +507,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) { return; } - Set employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId); + List employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId,Collectors.toList()); // 查询薪资核算记录 SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId); if (Objects.isNull(salaryAcctRecordPO)) { diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index c44c5e8ae..30d2d2d85 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -130,6 +130,28 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe @Override public List listSome(SalaryArchivePO po) { + Collection ids = po.getIds(); + if(CollectionUtils.isNotEmpty(ids)){ + List list = new ArrayList<>(); + List> partition = Lists.partition((List) ids, 1000); + partition.forEach(idss->{ + po.setIds(idss); + list.addAll(getSalaryArchiveMapper().listSome(po)); + }); + return list; + } + + Collection employeeIds = po.getEmployeeIds(); + if(CollectionUtils.isNotEmpty(employeeIds)){ + List list = new ArrayList<>(); + List> partition = Lists.partition((List) employeeIds, 1000); + partition.forEach(emps->{ + po.setEmployeeIds(emps); + list.addAll(getSalaryArchiveMapper().listSome(po)); + }); + return list; + } + // 获取薪资档案数据 return getSalaryArchiveMapper().listSome(po); } @@ -698,7 +720,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe */ private List getSalaryArchiveData(LocalDateRange localDateRange, Collection employeeIds, Long taxAgentId, boolean isOnlyTaxAgent) { // 获取薪资档案数据 - List salaryArchiveList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue(), SalaryArchiveStatusEnum.SUSPEND.getValue())).employeeIds(employeeIds).taxAgentId(taxAgentId).build()); + List salaryArchiveList = listSome(SalaryArchivePO.builder().runStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue(), SalaryArchiveStatusEnum.SUSPEND.getValue())).employeeIds(employeeIds).taxAgentId(taxAgentId).build()); List allEmployeeIds = salaryArchiveList.stream().map(SalaryArchivePO::getEmployeeId).distinct().collect(Collectors.toList()); // 获取所有可被引用的薪资项目 @@ -1084,8 +1106,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - List oldList = getSalaryArchiveMapper() - .listSome(SalaryArchivePO.builder() + List oldList = listSome(SalaryArchivePO.builder() .ids(ids) .runStatus(SalaryArchiveStatusEnum.PENDING.getValue()) .build()); @@ -1107,12 +1128,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录")); } - List salaryArchiveList = new ArrayList<>(); - List salaryArchivesIds = (List) ids; - List> partition = Lists.partition(salaryArchivesIds, 1000); - partition.forEach(list -> { - salaryArchiveList.addAll(getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(list).runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build())); - }); + List salaryArchiveList = listSome(SalaryArchivePO.builder().ids(ids).runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build()); if (CollectionUtils.isEmpty(salaryArchiveList)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "档案不存在!")); @@ -1128,6 +1144,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } // 从待定薪到定薪 + List> partition = Lists.partition((List) ids, 1000); partition.forEach(getSalaryArchiveMapper()::gotoFixed); // 获取所有可被引用的薪资项目 @@ -1174,8 +1191,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe if (CollectionUtils.isEmpty(ids)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录")); } - List oldList = getSalaryArchiveMapper() - .listSome(SalaryArchivePO.builder() + List oldList = listSome(SalaryArchivePO.builder() .ids(ids) .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) .build()); @@ -1224,8 +1240,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - List oldList = getSalaryArchiveMapper() - .listSome(SalaryArchivePO.builder() + List oldList = listSome(SalaryArchivePO.builder() .ids(ids) .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) .build()); @@ -1245,7 +1260,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - List oldList = getSalaryArchiveMapper().listSome( + List oldList = listSome( SalaryArchivePO.builder() .ids(ids) .runStatusList(Arrays.asList(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue(), SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()))