diff --git a/src/com/engine/salary/entity/datacollection/po/OtherDeductionPO.java b/src/com/engine/salary/entity/datacollection/po/OtherDeductionPO.java index bea18e842..02426212a 100644 --- a/src/com/engine/salary/entity/datacollection/po/OtherDeductionPO.java +++ b/src/com/engine/salary/entity/datacollection/po/OtherDeductionPO.java @@ -135,6 +135,7 @@ public class OtherDeductionPO { private List employeeIds; private Collection taxAgentIds; + private Integer incomeCategory; private List freeIncomeList; diff --git a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.java b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.java index bfdcf2ecc..073363001 100644 --- a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.java +++ b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.java @@ -72,4 +72,6 @@ public interface OtherDeductionMapper { int delete(OtherDeductionPO otherDeduction); OtherDeductionPO getByTaxAgentIdAndEmployeeIdAndDeclareMonth(@Param("taxAgentId") Long taxAgentId, @Param("employeeId") Long employeeId, @Param("declareMonth") Date declareMonth); + + List listDetails(@Param("param") OtherDeductionPO param); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml index 6d8496521..c3fd0e391 100644 --- a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml @@ -732,5 +732,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/OtherDeductionService.java b/src/com/engine/salary/service/OtherDeductionService.java index c02d4a948..bbebf8c9b 100644 --- a/src/com/engine/salary/service/OtherDeductionService.java +++ b/src/com/engine/salary/service/OtherDeductionService.java @@ -98,6 +98,16 @@ public interface OtherDeductionService { */ List getOtherDeductionList(YearMonth declareMonth, List employeeIds, Long taxAgentId); + /** + * 按照申报表类型,获取其他免税扣除数据 + * @param declareMonth + * @param employeeIds + * @param taxAgentId + * @param incomeCategory + * @return + */ + List getOtherDeductionList(YearMonth declareMonth, List employeeIds, Long taxAgentId, Integer incomeCategory); + /** * 编辑数据 */ diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index b44b1ad3b..65495a2b5 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -1910,6 +1911,42 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction return OtherDeductionBiz.listSome(OtherDeductionPO.builder().declareMonth(SalaryDateUtil.toDateStartOfMonth(declareMonth)).employeeIds(employeeIds).taxAgentId(taxAgentId).build()); } + @Override + public List getOtherDeductionList(YearMonth declareMonth, List employeeIds, Long taxAgentId, Integer incomeCategory) { + if (declareMonth == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:申报月份必传")); + } + if (taxAgentId == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:扣缴义务人必传")); + } + if (incomeCategory == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:所得项目必传")); + } + + List otherDeductionPOS = listDetails(OtherDeductionPO.builder().incomeCategory(incomeCategory).declareMonth(SalaryDateUtil.toDateStartOfMonth(declareMonth)).employeeIds(employeeIds).taxAgentId(taxAgentId).build()); + if (CollUtil.isEmpty(otherDeductionPOS)) { + return new ArrayList<>(); + } + otherDeductionPOS.forEach(OtherDeductionPO::handleList); + return otherDeductionPOS; + } + + private List listDetails(OtherDeductionPO param) { + if (CollectionUtils.isNotEmpty(param.getEmployeeIds())) { + List> partition = Lists.partition(param.getEmployeeIds(), 500); + List otherDeductionPOS = new ArrayList<>(); + partition.forEach(l -> { + param.setEmployeeIds(l); + otherDeductionPOS.addAll(getOtherDeductionMapper().listDetails(param)); + }); + return encryptUtil.decryptList(otherDeductionPOS, OtherDeductionPO.class); + } else { + List otherDeductionPOS = getOtherDeductionMapper().listDetails(param); + return encryptUtil.decryptList(otherDeductionPOS, OtherDeductionPO.class); + } + } + + @Override public void editData(OtherDeductionParam otherDeductionParam) { String declareMonthStr = otherDeductionParam.getDeclareMonth(); @@ -2388,7 +2425,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction List> endowmentInsuranceRowList = new ArrayList<>(); - List endowmentInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "所得项目","申报扣除月份", "税延养老账户编号", "报税校验码", "年度保费", "月度保费", "本期扣除金额"); + List endowmentInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "所得项目", "申报扣除月份", "税延养老账户编号", "报税校验码", "年度保费", "月度保费", "本期扣除金额"); endowmentInsuranceRowList.add(endowmentInsuranceTitle); endowmentInsuranceList.forEach(dto -> { List row = new ArrayList<>(); diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java index 16ab88f30..f3bd61e79 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java @@ -23,6 +23,7 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; +import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum; import com.engine.salary.formlua.entity.standard.ExcelResult; import com.engine.salary.service.*; @@ -125,7 +126,8 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc List employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO(); - Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId(); + SalarySobPO salarySobPO = salaryAcctCalculateBO.getSalarySobPO(); + Long taxAgentId = salarySobPO.getTaxAgentId(); sw.stop(); // 2、查询薪资档案的数据 sw.start("查询薪资档案的数据"); @@ -147,7 +149,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc sw.stop(); // 5、查询其他免税扣除 sw.start("查询其他免税扣除"); - List otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); + List otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId,salarySobPO.getIncomeCategory()); sw.stop(); //6、查询社保福利 sw.start("查询社保福利");