From b276066b520de7e30fcc762714c7d6bf42e09dd7 Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 12 Sep 2023 11:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E5=AF=BC=E5=85=A5=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=B8=A6=E5=87=BA=E6=A0=B8=E7=AE=97=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIArchivesBiz.java | 12 ++-- .../InsuranceAcctDetailImportFieldDTO.java | 2 +- .../salary/service/SIExportService.java | 6 ++ .../service/impl/SIAccountServiceImpl.java | 59 ++++++++++++++++--- .../service/impl/SIExportServiceImpl.java | 6 +- .../salary/wrapper/SalaryFormulaWrapper.java | 12 ++-- 6 files changed, 74 insertions(+), 23 deletions(-) diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 07a965ef7..c03ef2a39 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -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); diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceAcctDetailImportFieldDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceAcctDetailImportFieldDTO.java index b7e99b168..1f3cc912c 100644 --- a/src/com/engine/salary/entity/siaccount/dto/InsuranceAcctDetailImportFieldDTO.java +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceAcctDetailImportFieldDTO.java @@ -16,7 +16,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class InsuranceAcctDetailImportFieldDTO { //字段id -// private String fieldId; + private String fieldId; //薪资项目名称 private String salaryItemName; diff --git a/src/com/engine/salary/service/SIExportService.java b/src/com/engine/salary/service/SIExportService.java index 0fd3152dd..045ea5f1e 100644 --- a/src/com/engine/salary/service/SIExportService.java +++ b/src/com/engine/salary/service/SIExportService.java @@ -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> buildCommonRecords(List list); } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 95042d4c6..bd23de75d 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -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 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 dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth"); +// List dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth"); + List dataIndexList = Lists.newArrayList("userName", "department", "mobile", "workcode", "socialPayOrg", "billMonth"); // 查询福利核算项目 List welfareNames = (List) param.getWelfareNames(); headerList.addAll(welfareNames); + //匹配welfareName对应的id + List welfareList = getSalaryFormulaWrapper(user).welfareList(); + Map 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> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); +// // excel导出的数据 +// List> rows = Lists.newArrayListWithExpectedSize(resultMapList.size()); +// rows.add(headerList); +// for (Map map : resultMapList) { +// List 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 accountExportPOS = new ArrayList<>(); + accountExportPOS = getInsuranceExportMapper().exportAccount(PaymentStatusEnum.COMMON.getValue(), exportParam); + //非系统人员核算明细 + List extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(PaymentStatusEnum.COMMON.getValue(), exportParam); + accountExportPOS.addAll(extAccountExportPOS); + encryptUtil.decryptList(accountExportPOS, AccountExportPO.class); + // 数据组装 + List> records = getSIExportService(user).buildCommonRecords(accountExportPOS); // excel导出的数据 - //查询当前已有的正常缴纳数据 - List> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); - // excel导出的数据 - List> rows = Lists.newArrayListWithExpectedSize(resultMapList.size()); + List> rows = Lists.newArrayListWithExpectedSize(records.size()); rows.add(headerList); - for (Map map : resultMapList) { + for (Map map : records) { List row = Lists.newArrayListWithExpectedSize(headerList.size()); for (String dataIndex : dataIndexList) { row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY)); diff --git a/src/com/engine/salary/service/impl/SIExportServiceImpl.java b/src/com/engine/salary/service/impl/SIExportServiceImpl.java index adcdbc8f7..1c351dfac 100644 --- a/src/com/engine/salary/service/impl/SIExportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIExportServiceImpl.java @@ -207,7 +207,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { records = buildCommonRecords(accountExportPOS); List> 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> buildCommonRecords(List list) { + @Override + public List> buildCommonRecords(List list) { List> result = new ArrayList<>(); List paymentList = getTaxAgentMapper().listAll(); diff --git a/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java b/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java index 7822f4404..ba43a041c 100644 --- a/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java @@ -111,20 +111,20 @@ public class SalaryFormulaWrapper extends Service { param.setSourceId("welfare"); //获取福利类薪资项目 List 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; }