薪酬系统-福利台账核算一对多改造,在正常缴纳和补缴核算功能中,获取带核算数据增加筛选项(个税扣缴义务人)

This commit is contained in:
sy 2022-10-28 15:25:58 +08:00
parent ab6811b818
commit d6ec6ca25d
8 changed files with 36 additions and 19 deletions

View File

@ -252,18 +252,24 @@ public class SIAccountBiz extends Service {
// empIds = empIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList());
List<InsuranceArchivesSocialSchemePO> socials = siArchivesBiz.getSocialByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
socials = socials.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> 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<InsuranceArchivesFundSchemePO> funds = siArchivesBiz.getFundByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
funds = funds.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> 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<InsuranceArchivesOtherSchemePO> others = siArchivesBiz.getOtherByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
others = others.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> 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<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey, Long paymentOrganization) {
/* try {*/
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization);
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
int count = 0;
for (Map.Entry<Long, InsuranceArchivesAccountPO> 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<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId) {
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId, Long paymentOrganization) {
//(k,v) k-员工id v-员工对应的福利档案数据
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
//核算结果集
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
baseList.forEach(baseParam -> {
@ -1499,7 +1505,7 @@ public class SIAccountBiz extends Service {
}
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId, String currentUserName) {
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId, String currentUserName, Long paymentOrganization) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = allInspects(ids, billMonth);
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(100515, "无核算数据"));
List<InsuranceAccountInspectPO> 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);
}
}

View File

@ -1282,23 +1282,32 @@ public class SIArchivesBiz {
* @param ids 员工id集合
* @return map
*/
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids) {
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids, Long paymentOrganization) {
if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>();
}
//设置获取社保/公积金/其他福利档案方法的入参
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = new ArrayList<>();
for (Long employeeId : ids) {
insuranceArchivesEmployeePOS.add(InsuranceArchivesEmployeePO.builder()
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.build());
}
Map<Long, InsuranceArchivesAccountPO> result = new HashMap<>();
Map<Long, InsuranceArchivesSocialSchemePO> socialMap = new HashMap<>();
Map<Long, InsuranceArchivesFundSchemePO> funMap = new HashMap<>();
Map<Long, InsuranceArchivesOtherSchemePO> otherMap = new HashMap<>();
List<InsuranceArchivesSocialSchemePO> socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(ids));
List<InsuranceArchivesSocialSchemePO> socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS));
if (CollectionUtils.isNotEmpty(socialPOS)) {
socialMap = socialPOS.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
}
List<InsuranceArchivesFundSchemePO> fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(ids));
List<InsuranceArchivesFundSchemePO> fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS));
if (CollectionUtils.isNotEmpty(fundPOS)) {
funMap = fundPOS.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
}
List<InsuranceArchivesOtherSchemePO> otherPOS = this.getOtherByEmployeeIds(ids);
List<InsuranceArchivesOtherSchemePO> otherPOS = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS);
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherPOS);
if (CollectionUtils.isNotEmpty(otherPOS)) {
otherMap = otherPOS.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));

View File

@ -27,4 +27,6 @@ public class InspectAccountParam {
//账单月份")
private String billMonth;
private Long paymentOrganization;
}

View File

@ -25,6 +25,6 @@ public interface ColumnBuildService {
List<WeaTableColumn> buildCommonColumns(List<InsuranceAccountDetailPO> pos);
List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos);
List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos, Long paymentOrganization);
}

View File

@ -18,5 +18,5 @@ public interface RecordsBuildService {
List<Map<String, Object>> buildCommonRecordsWithStyle(List<InsuranceAccountDetailPO> list, Long employeeId);
List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list);
List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list, Long paymentOrganization);
}

View File

@ -289,11 +289,11 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
}
@Override
public List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos) {
public List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos, Long paymentOrganization) {
List<WeaTableColumn> list = new ArrayList<>();
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
List<Long> employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList());
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
Map<String, String> categoryIdNameMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
Map<Integer, Map<String, String>> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap);
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");

View File

@ -185,7 +185,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
}
@Override
public List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list) {
public List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list, Long paymentOrganization) {
List<Map<String, Object>> 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<Long, DataCollectionEmployee> collect = employeeByIds.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity()));
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
list.forEach(item -> {
Map<String, Object> record = new HashMap<>();
DataCollectionEmployee simpleEmployee = collect.get(item.getEmployeeId()) == null ? new DataCollectionEmployee() : collect.get(item.getEmployeeId());

View File

@ -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<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByBillMonth(param.getBillMonth());
List<Map<String, Object>> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS);
List<Map<String, Object>> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
pageInfos.setTotal(records.size());
pageInfos.setPageNum(param.getCurrent());
pageInfos.setPageSize(param.getPageSize());
List<WeaTableColumn> weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS);
List<WeaTableColumn> weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
WeaTable table = new WeaTable();
table.setPageUID(UUID.randomUUID().toString());
table.setColumns(weaTableColumns);