diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index b81d66d74..9c6791098 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -252,18 +252,24 @@ public class SIAccountBiz extends Service { // empIds = empIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList()); List socials = siArchivesBiz.getSocialByEmployeeIds(empIds); + //过滤出目标个税扣缴义务人相关信息 + socials = socials.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList()); List emp1 = socials.stream() .filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01")))) .map(InsuranceArchivesSocialSchemePO::getEmployeeId) .collect(Collectors.toList()); List funds = siArchivesBiz.getFundByEmployeeIds(empIds); + //过滤出目标个税扣缴义务人相关信息 + funds = funds.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList()); List emp2 = funds.stream() .filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01")))) .map(InsuranceArchivesFundSchemePO::getEmployeeId) .collect(Collectors.toList()); List others = siArchivesBiz.getOtherByEmployeeIds(empIds); + //过滤出目标个税扣缴义务人相关信息 + others = others.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList()); List emp3 = others.stream() .filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))) .map(InsuranceArchivesOtherSchemePO::getEmployeeId) @@ -323,7 +329,7 @@ public class SIAccountBiz extends Service { public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque results,*/ String billMonth, List ids, Long employeeId, String tenantKey, Long paymentOrganization) { /* try {*/ SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); - Map insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids); + Map insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization); List list = new ArrayList<>(); int count = 0; for (Map.Entry entry : insuranceArchivesAccountPOS.entrySet()) { @@ -943,7 +949,7 @@ public class SIAccountBiz extends Service { }); }); //核算开始 - accountSupplement(baseList, employeeIds, param.getBillMonth(), employeeId); + accountSupplement(baseList, employeeIds, param.getBillMonth(), employeeId, param.getPaymentOrganization()); updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } @@ -953,9 +959,9 @@ public class SIAccountBiz extends Service { * @param employeeIds 需要补缴的员工id * @return */ - public String accountSupplement(List baseList, List employeeIds, String billMonth, Long employeeId) { + public String accountSupplement(List baseList, List employeeIds, String billMonth, Long employeeId, Long paymentOrganization) { //(k,v) k-员工id v-员工对应的福利档案数据 - Map longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); + Map longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization); //核算结果集 List pos = new ArrayList<>(); baseList.forEach(baseParam -> { @@ -1499,7 +1505,7 @@ public class SIAccountBiz extends Service { } - public void accountInspect(Collection ids, String billMonth, Long employeeId, String currentUserName) { + public void accountInspect(Collection ids, String billMonth, Long employeeId, String currentUserName, Long paymentOrganization) { List insuranceAccountInspectPOS = allInspects(ids, billMonth); SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(100515, "无核算数据")); List commonInspects = insuranceAccountInspectPOS.stream() @@ -1527,7 +1533,7 @@ public class SIAccountBiz extends Service { base.setSupplementaryMonth(e.getSupplementaryMonth()); baseList.add(base); }); - accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth, employeeId); + accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth, employeeId, paymentOrganization); } } diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index f31ec6133..84c939c7e 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -1282,23 +1282,32 @@ public class SIArchivesBiz { * @param ids 员工id集合 * @return map */ - public Map buildBatchAccount(List ids) { + public Map buildBatchAccount(List ids, Long paymentOrganization) { if (CollectionUtils.isEmpty(ids)) { return new HashMap<>(); } + //设置获取社保/公积金/其他福利档案方法的入参 + List insuranceArchivesEmployeePOS = new ArrayList<>(); + for (Long employeeId : ids) { + insuranceArchivesEmployeePOS.add(InsuranceArchivesEmployeePO.builder() + .employeeId(employeeId) + .paymentOrganization(paymentOrganization) + .build()); + } + Map result = new HashMap<>(); Map socialMap = new HashMap<>(); Map funMap = new HashMap<>(); Map otherMap = new HashMap<>(); - List socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(ids)); + List socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS)); if (CollectionUtils.isNotEmpty(socialPOS)) { socialMap = socialPOS.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); } - List fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(ids)); + List fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS)); if (CollectionUtils.isNotEmpty(fundPOS)) { funMap = fundPOS.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); } - List otherPOS = this.getOtherByEmployeeIds(ids); + List otherPOS = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS); InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherPOS); if (CollectionUtils.isNotEmpty(otherPOS)) { otherMap = otherPOS.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity())); diff --git a/src/com/engine/salary/entity/siaccount/param/InspectAccountParam.java b/src/com/engine/salary/entity/siaccount/param/InspectAccountParam.java index 933625609..d52bcd056 100644 --- a/src/com/engine/salary/entity/siaccount/param/InspectAccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/InspectAccountParam.java @@ -27,4 +27,6 @@ public class InspectAccountParam { //账单月份") private String billMonth; + + private Long paymentOrganization; } diff --git a/src/com/engine/salary/service/ColumnBuildService.java b/src/com/engine/salary/service/ColumnBuildService.java index c4ef41907..87836b44b 100644 --- a/src/com/engine/salary/service/ColumnBuildService.java +++ b/src/com/engine/salary/service/ColumnBuildService.java @@ -25,6 +25,6 @@ public interface ColumnBuildService { List buildCommonColumns(List pos); - List buildInspectColumns(List pos); + List buildInspectColumns(List pos, Long paymentOrganization); } diff --git a/src/com/engine/salary/service/RecordsBuildService.java b/src/com/engine/salary/service/RecordsBuildService.java index 5e3e767c3..ab3c105a6 100644 --- a/src/com/engine/salary/service/RecordsBuildService.java +++ b/src/com/engine/salary/service/RecordsBuildService.java @@ -18,5 +18,5 @@ public interface RecordsBuildService { List> buildCommonRecordsWithStyle(List list, Long employeeId); - List> buildInspectRecords(List list); + List> buildInspectRecords(List list, Long paymentOrganization); } diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index 95874ec22..b66f347bc 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -289,11 +289,11 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic } @Override - public List buildInspectColumns(List pos) { + public List buildInspectColumns(List pos, Long paymentOrganization) { List list = new ArrayList<>(); SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); List employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList()); - Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); + Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization); Map categoryIdNameMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName)); Map> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap); WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName"); diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index 37002e54d..b1d5958b0 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -185,7 +185,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ } @Override - public List> buildInspectRecords(List list) { + public List> buildInspectRecords(List list, Long paymentOrganization) { List> result = new ArrayList<>(); SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); if (CollectionUtils.isEmpty(list)) { @@ -201,7 +201,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ return result; } Map collect = employeeByIds.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity())); - Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); + Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization); list.forEach(item -> { Map record = new HashMap<>(); DataCollectionEmployee simpleEmployee = collect.get(item.getEmployeeId()) == null ? new DataCollectionEmployee() : collect.get(item.getEmployeeId()); diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index c5277288b..bc2a18a49 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -576,7 +576,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long) user.getUID(); ValidUtil.doValidator(param); String currentUserName = user.getLastname(); - getSiAccountBiz(user).accountInspect(param.getIds(), param.getBillMonth(), employeeId, currentUserName); + getSiAccountBiz(user).accountInspect(param.getIds(), param.getBillMonth(), employeeId, currentUserName, param.getPaymentOrganization()); } @Override @@ -585,14 +585,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { SalaryPageUtil.start(param.getCurrent(), param.getPageSize()); List insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByBillMonth(param.getBillMonth()); - List> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS); + List> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization())); PageInfo> pageInfos = new PageInfo<>(records); pageInfos.setTotal(records.size()); pageInfos.setPageNum(param.getCurrent()); pageInfos.setPageSize(param.getPageSize()); - List weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS); + List weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization())); WeaTable table = new WeaTable(); table.setPageUID(UUID.randomUUID().toString()); table.setColumns(weaTableColumns);