薪酬系统-福利台账,线下对比(列表、导入、导出)福利项字段根据正常缴纳中的核算字段获得

This commit is contained in:
sy 2023-04-18 14:21:05 +08:00
parent f68981baac
commit 62af02522c
5 changed files with 140 additions and 33 deletions

View File

@ -18,10 +18,7 @@ import com.engine.salary.util.page.Column;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -44,13 +41,20 @@ public class InsuranceComparisonResultBO {
* 构建福利核算结果列表的表头线下对比
*
*/
public static List<Column> buildTableColumns4ComparisonResult() {
public static List<Column> buildTableColumns4ComparisonResult(Set<Long> insuranceBaseSet, Set<Long> insurancePerPaySet, Set<Long> insuranceComPaySet) {
List<ICategoryPO> listAll = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll();
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList());
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList());
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList());
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<Column> columns = Lists.newArrayList();
// 员工信息字段
columns.add(new Column("姓名", "userName", "userName"));
@ -80,33 +84,33 @@ public class InsuranceComparisonResultBO {
}
//社保个人生育保险个人工伤保险个人失业保险个人养老保险个人医疗保险个人
for (ICategoryPO po : socialWelfareList) {
for (ICategoryPO po : socialWelPerList) {
columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "socialPer", po.getId() + "socialPer"));
}
columns.add(new Column("社保个人合计", "socialPerSum", "socialPerSum"));
//住房公积金个人补充住房公积金个人
for (ICategoryPO po : fundWelfareList) {
for (ICategoryPO po : fundWelPerList) {
columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "fundPer", po.getId() + "fundPer"));
}
columns.add(new Column("公积金个人合计", "fundPerSum", "fundPerSum"));
//其他个人比如企业年金个人
for (ICategoryPO po : otherWelfareList) {
for (ICategoryPO po : otherWelPerList) {
columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "otherPer", po.getId() + "otherPer"));
}
columns.add(new Column("其他福利个人合计", "otherPerSum", "otherPerSum"));
columns.add(new Column("个人合计", "perSum", "perSum"));
//社保单位生育保险单位工伤保险单位失业保险单位养老保险单位医疗保险单位
for (ICategoryPO po : socialWelfareList) {
for (ICategoryPO po : socialWelComList) {
columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "socialCom", po.getId() + "socialCom"));
}
columns.add(new Column("社保单位合计", "socialComSum", "socialComSum"));
//住房公积金单位补充住房公积金单位
for (ICategoryPO po : fundWelfareList) {
for (ICategoryPO po : fundWelComList) {
columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "fundCom", po.getId() + "fundCom"));
}
columns.add(new Column("公积金单位合计", "fundComSum", "fundComSum"));
//其他单位比如企业年金单位
for (ICategoryPO po : otherWelfareList) {
for (ICategoryPO po : otherWelComList) {
columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "otherCom", po.getId() + "otherCom"));
}
columns.add(new Column("其他福利单位合计", "otherComSum", "otherComSum"));
@ -123,7 +127,7 @@ public class InsuranceComparisonResultBO {
* 构建福利核算线下对比结果
*
*/
public static List<Map<String, Object>> buildComparisonTableData(List<AccountExportPO> accountExportPOS, List<ExcelAccountExportPO> excelAccountExportPOS) {
public static List<Map<String, Object>> buildComparisonTableData(List<AccountExportPO> accountExportPOS, List<ExcelAccountExportPO> excelAccountExportPOS, Map<Long, String> schemeIdNameMap) {
Map<String, List<ExcelAccountExportPO>> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getWorkcode);
// Map<String, List<AccountExportPO>> acctResultMap = SalaryEntityUtil.group2Map(accountExportPOS, AccountExportPO::getWorkcode);
@ -162,6 +166,11 @@ public class InsuranceComparisonResultBO {
map.put("supplementFundAccount", accountExportPO.getSupplementFundAccount());
map.put("supplementFundAccount" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue());
//福利方案名称
map.put("socialSchemeName", schemeIdNameMap.get(accountExportPO.getSocialSchemeId()));
map.put("fundSchemeName", schemeIdNameMap.get(accountExportPO.getFundSchemeId()));
map.put("otherSchemeName", schemeIdNameMap.get(accountExportPO.getOtherSchemeId()));
//线下值
List<ExcelAccountExportPO> excelResultValueList = excelResultMap.get(accountExportPO.getWorkcode());
ExcelAccountExportPO excelAccountExportPO = new ExcelAccountExportPO();

View File

@ -244,7 +244,7 @@ public interface SIAccountService {
/**
* 导出福利核算-线下对比导入模板
*/
XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAcctDetailImportTemplateParam param);
XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param);
/**
* 将通过福利核算-线下对比导入模板导入的数据更新到hrsa_excel_bill_detail表中

View File

@ -11,11 +11,14 @@ import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.siexport.po.ExcelAccountExportPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.InsuranceExportMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.service.SIAComparisonResultService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
@ -26,6 +29,7 @@ import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import com.wbi.util.Util;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
@ -57,6 +61,14 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class, user);
}
/**
* 根据列表查询条件查询线下对比结果分页
*/
@ -155,10 +167,35 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
//2-查询线下对比数据
List<ExcelAccountExportPO> excelAccountExportPOS = getInsuranceExportMapper().exportExcelAccount(queryParam);
encryptUtil.decryptList(excelAccountExportPOS, ExcelAccountExportPO.class);
//整理线上核算记录相关的福利方案并以此整理需要对比的福利项类别数据
Set<Long> welfareSchemeIds = new HashSet<>();
accountExportPOS.forEach(f -> {
welfareSchemeIds.add(f.getSocialSchemeId());
welfareSchemeIds.add(f.getFundSchemeId());
welfareSchemeIds.add(f.getOtherSchemeId());
});
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
List<Long> insuranceBaseIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insurancePerPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insuranceComPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
Set<Long> insuranceBaseSet = new HashSet<>(insuranceBaseIds);
Set<Long> insurancePerPaySet = new HashSet<>(insurancePerPayIds);
Set<Long> insuranceComPaySet = new HashSet<>(insuranceComPayIds);
//3-构建福利核算对比结果列表表头
List<Column> weaTableColumns = InsuranceComparisonResultBO.buildTableColumns4ComparisonResult();
List<Column> weaTableColumns = InsuranceComparisonResultBO.buildTableColumns4ComparisonResult(insuranceBaseSet, insurancePerPaySet, insuranceComPaySet);
//4-通过线上线下两份数据获得对比结果
List<Map<String, Object>> resultMapList = InsuranceComparisonResultBO.buildComparisonTableData(accountExportPOS, excelAccountExportPOS);
Map<Long, String> schemeIdNameMap = getSISchemeService(user).getSchemeIdNameMap();
List<Map<String, Object>> resultMapList = InsuranceComparisonResultBO.buildComparisonTableData(accountExportPOS, excelAccountExportPOS, schemeIdNameMap);
// 系统值和线下值一致的人员
if (queryParam.isOnlyDiffEmployee()) {

View File

@ -28,6 +28,9 @@ 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 com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
@ -35,6 +38,7 @@ import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.InsuranceExportMapper;
import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
@ -43,6 +47,7 @@ import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
@ -183,6 +188,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
}
private InsuranceExportMapper getInsuranceExportMapper() {
return MapperProxyFactory.getProxy(InsuranceExportMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long) user.getUID();
@ -1824,12 +1837,51 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
* 导出福利核算-线下对比导入模板
*/
@Override
public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAcctDetailImportTemplateParam param) {
public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param) {
//查询线上福利核算记录
InsuranceExportParam insuranceExportParam = new InsuranceExportParam();
insuranceExportParam.setBillMonth(param.getBillMonth());
insuranceExportParam.setPaymentOrganization(param.getPaymentOrganization());
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(param.getPaymentStatus(), insuranceExportParam);
//整理线上核算记录相关的福利方案并以此整理需要对比的福利项类别数据
Set<Long> welfareSchemeIds = new HashSet<>();
accountExportPOS.forEach(f -> {
welfareSchemeIds.add(f.getSocialSchemeId());
welfareSchemeIds.add(f.getFundSchemeId());
welfareSchemeIds.add(f.getOtherSchemeId());
});
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
List<Long> insuranceBaseIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insurancePerPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insuranceComPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
Set<Long> insuranceBaseSet = new HashSet<>(insuranceBaseIds);
Set<Long> insurancePerPaySet = new HashSet<>(insurancePerPayIds);
Set<Long> insuranceComPaySet = new HashSet<>(insuranceComPayIds);
List<ICategoryPO> listAll = getICategoryMapper().listAll();
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList());
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList());
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList());
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
SalaryI18nUtil.getI18nLabel(86185, "部门"),
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
@ -1860,33 +1912,33 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
headerList.add(po.getInsuranceName() + "申报基数");
}
//社保个人生育保险个人工伤保险个人失业保险个人养老保险个人医疗保险个人
for (ICategoryPO po : socialWelfareList) {
for (ICategoryPO po : socialWelPerList) {
headerList.add(po.getInsuranceName() + "个人");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"));
//住房公积金个人补充住房公积金个人
for (ICategoryPO po : fundWelfareList) {
for (ICategoryPO po : fundWelPerList) {
headerList.add(po.getInsuranceName() + "个人");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"));
//其他个人比如企业年金个人
for (ICategoryPO po : otherWelfareList) {
for (ICategoryPO po : otherWelPerList) {
headerList.add(po.getInsuranceName() + "个人");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计"));
headerList.add(SalaryI18nUtil.getI18nLabel(100393, "个人合计"));
//社保单位生育保险单位工伤保险单位失业保险单位养老保险单位医疗保险单位
for (ICategoryPO po : socialWelfareList) {
for (ICategoryPO po : socialWelComList) {
headerList.add(po.getInsuranceName() + "单位");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"));
//住房公积金单位补充住房公积金单位
for (ICategoryPO po : fundWelfareList) {
for (ICategoryPO po : fundWelComList) {
headerList.add(po.getInsuranceName() + "单位");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"));
//其他单位比如企业年金单位
for (ICategoryPO po : otherWelfareList) {
for (ICategoryPO po : otherWelComList) {
headerList.add(po.getInsuranceName() + "单位");
}
headerList.add(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"));

View File

@ -559,12 +559,21 @@ public class SIAccountController {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportComparisonWelfareTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam();
InsuranceAccountDetailParam param = new InsuranceAccountDetailParam();
// String welfareNames = request.getParameter("welfareNames");
// if (StringUtils.isNotBlank(welfareNames)) {
// param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList()));
// }
String billMonth = request.getParameter("billMonth");
if (StringUtils.isNotBlank(billMonth)) {
param.setBillMonth(billMonth);
}
String paymentOrganization = request.getParameter("paymentOrganization");
if (StringUtils.isNotBlank(paymentOrganization)) {
param.setPaymentOrganization(paymentOrganization);
}
String paymentStatus = request.getParameter("paymentStatus");
if (StringUtils.isNotBlank(paymentStatus)) {
param.setPaymentStatus(Integer.valueOf(paymentStatus));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getService(user).exportComparisonWelfareTemplate(param);