薪酬系统-福利台账,导入模板带出核算数据

This commit is contained in:
sy 2023-09-12 11:05:46 +08:00
parent 3e7180a25e
commit b276066b52
6 changed files with 74 additions and 23 deletions

View File

@ -694,7 +694,7 @@ public class SIArchivesBiz {
otherSchemeMapper.updateById(updateOtherInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
@ -738,7 +738,7 @@ public class SIArchivesBiz {
.build());
baseInfoPO.setOtherArchivesId(otherInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
@ -804,7 +804,7 @@ public class SIArchivesBiz {
fundSchemeMapper.updateById(updateFundInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
@ -850,7 +850,7 @@ public class SIArchivesBiz {
.build());
baseInfoPO.setFundArchivesId(fundInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
@ -923,7 +923,7 @@ public class SIArchivesBiz {
socialSchemeMapper.updateById(updateSocialInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
@ -969,7 +969,7 @@ public class SIArchivesBiz {
.build());
baseInfoPO.setSocialArchivesId(socialInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);

View File

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class InsuranceAcctDetailImportFieldDTO {
//字段id
// private String fieldId;
private String fieldId;
//薪资项目名称
private String salaryItemName;

View File

@ -1,8 +1,12 @@
package com.engine.salary.service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.List;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
@ -25,4 +29,6 @@ public interface SIExportService {
* @return
*/
XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param);
List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list);
}

View File

@ -18,6 +18,7 @@ import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAcctDetailImportFieldDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
@ -71,8 +72,10 @@ import com.engine.salary.util.page.Column;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.wrapper.SalaryFormulaWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mzlion.core.utils.BeanUtils;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -197,6 +200,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) {
return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user);
}
public SIExportService getSIExportService(User user) {
return ServiceUtil.getService(SIExportServiceImpl.class, user);
}
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long) user.getUID();
@ -1475,7 +1486,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public XSSFWorkbook exportImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
ValidUtil.doValidator(param);
Long employeeId = (long) user.getUID();
// 必须选择导入模板所需的薪资项目(福利项)
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
@ -1488,18 +1499,52 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
SalaryI18nUtil.getI18nLabel(86317, "工号"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
"账单月份");
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth");
// List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth");
List<String> dataIndexList = Lists.newArrayList("userName", "department", "mobile", "workcode", "socialPayOrg", "billMonth");
// 查询福利核算项目
List<String> welfareNames = (List<String>) param.getWelfareNames();
headerList.addAll(welfareNames);
//匹配welfareName对应的id
List<InsuranceAcctDetailImportFieldDTO> welfareList = getSalaryFormulaWrapper(user).welfareList();
Map<String, String> welfareNameMap = welfareList.stream().collect(Collectors.toMap(InsuranceAcctDetailImportFieldDTO::getSalaryItemName, InsuranceAcctDetailImportFieldDTO::getFieldId, (key1, key2) -> key2));
welfareNames.forEach(f -> {
if (StringUtils.isNotBlank(welfareNameMap.get(f))) {
dataIndexList.add(welfareNameMap.get(f));
}
});
// excel导出的数据
// //查询当前已有的正常缴纳数据
// List<Map<String, Object>> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
// // excel导出的数据
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
// rows.add(headerList);
// for (Map<String, Object> map : resultMapList) {
// List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
// for (String dataIndex : dataIndexList) {
// row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
// }
// rows.add(row);
// }
InsuranceExportParam exportParam = new InsuranceExportParam();
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
exportParam.setOrderRule(orderRule);
exportParam.setBillMonth(param.getBillMonth());
exportParam.setPaymentOrganization(param.getPaymentOrganization().toString());
List<AccountExportPO> accountExportPOS = new ArrayList<>();
accountExportPOS = getInsuranceExportMapper().exportAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
accountExportPOS.addAll(extAccountExportPOS);
encryptUtil.decryptList(accountExportPOS, AccountExportPO.class);
// 数据组装
List<Map<String, Object>> records = getSIExportService(user).buildCommonRecords(accountExportPOS);
// excel导出的数据
//查询当前已有的正常缴纳数据
List<Map<String, Object>> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
// excel导出的数据
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(records.size());
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
for (Map<String, Object> map : records) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
for (String dataIndex : dataIndexList) {
row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));

View File

@ -207,7 +207,7 @@ public class SIExportServiceImpl extends Service implements SIExportService {
records = buildCommonRecords(accountExportPOS);
List<List<Object>> excelSheetData = new ArrayList<>();
//工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
String sheetName = SalaryI18nUtil.getI18nLabel(0, "社保福利台账");
excelSheetData.add(Arrays.asList(columns.stream().map(WeaTableColumn::getText).toArray(String[]::new)));
//合计
boolean total = false;
@ -245,8 +245,8 @@ public class SIExportServiceImpl extends Service implements SIExportService {
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName, total);
}
private List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
@Override
public List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
List<Map<String, Object>> result = new ArrayList<>();
List<TaxAgentPO> paymentList = getTaxAgentMapper().listAll();

View File

@ -111,20 +111,20 @@ public class SalaryFormulaWrapper extends Service {
param.setSourceId("welfare");
//获取福利类薪资项目
List<FormulaVar> list = getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差"))).collect(Collectors.toList());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数"))).collect(Collectors.toList());
//提取出福利类项目名称
for (FormulaVar formulaVar : list) {
InsuranceAcctDetailImportFieldDTO insuranceAcctDetailImportFieldDTO = new InsuranceAcctDetailImportFieldDTO();
// insuranceAcctDetailImportFieldDTO.setFieldId(formulaVar.getFieldId());
insuranceAcctDetailImportFieldDTO.setFieldId(formulaVar.getFieldId().contains("welfare_") ? formulaVar.getFieldId().substring(8) : formulaVar.getFieldId());
insuranceAcctDetailImportFieldDTO.setSalaryItemName(formulaVar.getName());
welfareList.add(insuranceAcctDetailImportFieldDTO);
}
welfareList.add(new InsuranceAcctDetailImportFieldDTO("社保合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("公积金合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("其他福利合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("socialSum","社保合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("fundSum","公积金合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("otherSum","其他福利合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("total","合计"));
return welfareList;
}