From d5228ff1bf59aa89e5a01ae82b69046a189748e5 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Wed, 15 Jun 2022 10:23:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIArchivesBiz.java | 60 +++++++++++++++++-- .../service/impl/SIImportServiceImpl.java | 9 ++- .../service/impl/SISchemeServiceImpl.java | 15 +++-- 3 files changed, 70 insertions(+), 14 deletions(-) diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 42ee91956..b57b8b0e8 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -45,6 +45,7 @@ import com.engine.salary.util.SalaryFormItemUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; +import com.google.common.collect.Lists; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; @@ -428,6 +429,55 @@ public class SIArchivesBiz { } } + public List getSocialByEmployeeIds(List employeeIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class); + List> partition = Lists.partition(employeeIds, 1000); + List allList = new ArrayList<>(); + for (List longs : partition) { + List socialList = socialSchemeMapper.getSocialByEmployeeId(longs); + allList.addAll(socialList); + } + return allList; + } finally { + sqlSession.close(); + } + } + + + public List getFundByEmployeeIds(List employeeIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class); + List> partition = Lists.partition(employeeIds, 1000); + List allList = new ArrayList<>(); + for (List longs : partition) { + List fundList = fundSchemeMapper.getFundByEmployeeId(longs); + allList.addAll(fundList); + } + return allList; + } finally { + sqlSession.close(); + } + } + + public List getOtherByEmployeeIds(List employeeIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class); + List> partition = Lists.partition(employeeIds, 1000); + List allList = new ArrayList<>(); + for (List longs : partition) { + List otherList = otherSchemeMapper.getOtherByEmployeeId(longs); + allList.addAll(otherList); + } + return allList; + } finally { + sqlSession.close(); + } + } + /** * 新增 @@ -846,12 +896,12 @@ public class SIArchivesBiz { InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class); List employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList()); - Map socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialSchemeMapper.getSocialByEmployeeId(employeeIds)) + Map socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(employeeIds)) .stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); Map fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(fundSchemeMapper.getFundByEmployeeId(employeeIds)) .stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); - List otherByEmployeeList = otherSchemeMapper.getOtherByEmployeeId(employeeIds); + List otherByEmployeeList = this.getOtherByEmployeeIds(employeeIds); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeList); Map otherSchemePOMap = otherByEmployeeList .stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity())); @@ -1080,15 +1130,15 @@ public class SIArchivesBiz { Map socialMap = new HashMap<>(); Map funMap = new HashMap<>(); Map otherMap = new HashMap<>(); - List socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(MapperProxyFactory.getProxy(SocialSchemeMapper.class).getSocialByEmployeeId(ids)); + List socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(ids)); if (CollectionUtils.isNotEmpty(socialPOS)) { socialMap = socialPOS.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); } - List fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(MapperProxyFactory.getProxy(FundSchemeMapper.class).getFundByEmployeeId(ids)); + List fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(ids)); if (CollectionUtils.isNotEmpty(fundPOS)) { funMap = fundPOS.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); } - List otherPOS = MapperProxyFactory.getProxy(OtherSchemeMapper.class).getOtherByEmployeeId(ids); + List otherPOS = this.getOtherByEmployeeIds(ids); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherPOS); if (CollectionUtils.isNotEmpty(otherPOS)) { otherMap = otherPOS.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity())); diff --git a/src/com/engine/salary/service/impl/SIImportServiceImpl.java b/src/com/engine/salary/service/impl/SIImportServiceImpl.java index ad88ba2f8..f8bc219a0 100644 --- a/src/com/engine/salary/service/impl/SIImportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIImportServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.biz.SIArchivesBiz; import com.engine.salary.encrypt.siarchives.InsuranceArchivesFundSchemePOEncrypt; import com.engine.salary.encrypt.siarchives.InsuranceArchivesOtherSchemePOEncrypt; import com.engine.salary.encrypt.siarchives.InsuranceArchivesSocialSchemePOEncrypt; @@ -45,6 +46,8 @@ import java.util.stream.Collectors; **/ public class SIImportServiceImpl extends Service implements SIImportService { + private SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); + public SIArchivesService getSIArchivesService(User user) { return ServiceUtil.getService(SIArchivesServiceImpl.class,user); } @@ -168,19 +171,19 @@ public class SIImportServiceImpl extends Service implements SIImportService { } List employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList()); Map socialSchemePOMap = new HashMap<>(); - List socialSchemePOList = MapperProxyFactory.getProxy(SocialSchemeMapper.class).getSocialByEmployeeId(employeeIds); + List socialSchemePOList = siArchivesBiz.getSocialByEmployeeIds(employeeIds); InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialSchemePOList); if (CollectionUtils.isNotEmpty(socialSchemePOList)) { socialSchemePOMap = socialSchemePOList.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); } - List fundSchemePOList = MapperProxyFactory.getProxy(FundSchemeMapper.class).getFundByEmployeeId(employeeIds); + List fundSchemePOList = siArchivesBiz.getFundByEmployeeIds(employeeIds); InsuranceArchivesFundSchemePOEncrypt.encryptList(fundSchemePOList); Map fundSchemePOMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(fundSchemePOList)) { fundSchemePOMap = fundSchemePOList.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); } Map otherSchemePOMap = new HashMap<>(); - List otherSchemePOList = MapperProxyFactory.getProxy(OtherSchemeMapper.class).getOtherByEmployeeId(employeeIds); + List otherSchemePOList = siArchivesBiz.getOtherByEmployeeIds(employeeIds); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherSchemePOList); if (CollectionUtils.isNotEmpty(otherSchemePOList)) { otherSchemePOMap = otherSchemePOList.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity())); diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 5bead0d55..ff3c1758e 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -6,6 +6,7 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; +import com.engine.salary.biz.SIArchivesBiz; import com.engine.salary.biz.SISchemeBiz; import com.engine.salary.cmd.sischeme.*; import com.engine.salary.encrypt.AESEncryptUtil; @@ -105,6 +106,8 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { private EmployBiz employeeBiz = new EmployBiz(); + private SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); + @Override public Map getForm(Map params) { return commandExecutor.execute(new SISchemeGetFormCmd(params, user)); @@ -208,9 +211,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { end = employeeIds.size(); } List ids = employeeIds.subList(i, end); - socialList.addAll(InsuranceArchivesSocialSchemePOEncrypt.decryptList(getSocialSchemeMapper().getSocialByEmployeeId(ids))); - fundList.addAll(InsuranceArchivesFundSchemePOEncrypt.decryptList(getFundSchemeMapper().getFundByEmployeeId(ids))); - otherList.addAll(InsuranceArchivesOtherSchemePOEncrypt.decryptList(getOtherSchemeMapper().getOtherByEmployeeId(ids))); + socialList.addAll(InsuranceArchivesSocialSchemePOEncrypt.decryptList(siArchivesBiz.getSocialByEmployeeIds(ids))); + fundList.addAll(InsuranceArchivesFundSchemePOEncrypt.decryptList(siArchivesBiz.getFundByEmployeeIds(ids))); + otherList.addAll(InsuranceArchivesOtherSchemePOEncrypt.decryptList(siArchivesBiz.getOtherByEmployeeIds(ids))); } Map socialSchemePOMap = @@ -417,7 +420,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { Set fundSet = new HashSet<>(); Set otherSet = new HashSet<>(); insuranceArchivesEmployeePOS.forEach(item -> { - List socialByEmployeeId = getSocialSchemeMapper().getSocialByEmployeeId(new ArrayList() {{ + List socialByEmployeeId = siArchivesBiz.getSocialByEmployeeIds(new ArrayList() {{ add(item.getEmployeeId()); }}); InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialByEmployeeId); @@ -427,7 +430,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { } InsuranceArchivesFundSchemePO fundItem = null; - List fundByEmployeeId = getFundSchemeMapper().getFundByEmployeeId(new ArrayList() {{ + List fundByEmployeeId = siArchivesBiz.getFundByEmployeeIds(new ArrayList() {{ add(item.getEmployeeId()); }}); InsuranceArchivesFundSchemePOEncrypt.decryptList(fundByEmployeeId); @@ -437,7 +440,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { } InsuranceArchivesOtherSchemePO otherItem = null; - List otherByEmployeeId = getOtherSchemeMapper().getOtherByEmployeeId(new ArrayList() {{ + List otherByEmployeeId = siArchivesBiz.getOtherByEmployeeIds(new ArrayList() {{ add(item.getEmployeeId()); }}); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeId);