diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 7d6f1c316..e31703c4a 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -520,6 +520,55 @@ public class SIArchivesBiz { } } + /** + * 根据人员id和个税扣缴人id获取记录 + */ + public List getSocialByEmployeeIdAndPayOrg(List insuranceArchivesEmployeePOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class); + List allList = new ArrayList<>(); + for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) { + List socialList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(po); + allList.addAll(socialList); + } + return allList; + } finally { + sqlSession.close(); + } + } + + + public List getFundByEmployeeIdAndPayOrg(List insuranceArchivesEmployeePOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class); + List allList = new ArrayList<>(); + for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) { + List fundList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(po); + allList.addAll(fundList); + } + return allList; + } finally { + sqlSession.close(); + } + } + + public List getOtherByEmployeeIdAndPayOrg(List insuranceArchivesEmployeePOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class); + List allList = new ArrayList<>(); + for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) { + List otherList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(po); + allList.addAll(otherList); + } + return allList; + } finally { + sqlSession.close(); + } + } + /** * 新增 @@ -979,20 +1028,20 @@ public class SIArchivesBiz { OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class); InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class); - List employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList()); - Map socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(employeeIds)) - .stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); +// List employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList()); + Map socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS)) + .stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getId, Function.identity())); - Map fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(employeeIds)) - .stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); - List otherByEmployeeList = this.getOtherByEmployeeIds(employeeIds); + Map fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS)) + .stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getId, Function.identity())); + List otherByEmployeeList = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeList); Map otherSchemePOMap = otherByEmployeeList - .stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity())); + .stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getId, Function.identity())); insuranceArchivesEmployeePOS.forEach(item -> { - InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getEmployeeId()); - InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getEmployeeId()); - InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId()); + InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getSocialId()); + InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getFundId()); + InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getOtherId()); Map map = new HashMap<>(); map.put("employeeName", item.getUserName()); map.put("paymentOrganizationName", longTaxAgentPOMap.get(item.getPaymentOrganization()) != null ? longTaxAgentPOMap.get(item.getPaymentOrganization()).getName() : ""); diff --git a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java index 170e41bde..42e58dfc9 100644 --- a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java +++ b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java @@ -53,4 +53,12 @@ public class InsuranceArchivesEmployeePO { private Long otherSchemeId; private Long baseInfoId; + /** + * 社保、公积金、其他福利档案id + */ + private Long socialId; + + private Long fundId; + + private Long otherId; } diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java index f530b8645..cfee53a1c 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java @@ -1,5 +1,6 @@ package com.engine.salary.mapper.siarchives; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO; import org.apache.ibatis.annotations.Param; @@ -22,6 +23,14 @@ public interface FundSchemeMapper { */ List getFundByEmployeeId(@Param("employeeIds")List employeeId); + /** + * 根据人员id和个税扣缴人id获取记录 + * @param insuranceArchivesEmployeePO + * @return + */ + List getFundByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesEmployeePO insuranceArchivesEmployeePO); + + /** * 根据id获取 * @param ids diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml index f0f908872..00d4e32f9 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml @@ -58,6 +58,16 @@ + + + + + + + + +