核算精准使用附表

This commit is contained in:
钱涛 2025-07-02 20:02:05 +08:00
parent b2507306e5
commit fe7481d753
6 changed files with 145 additions and 3 deletions

View File

@ -135,6 +135,7 @@ public class OtherDeductionPO {
private List<Long> employeeIds;
private Collection<Long> taxAgentIds;
private Integer incomeCategory;
private List<FreeIncomePO> freeIncomeList;

View File

@ -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<OtherDeductionPO> listDetails(@Param("param") OtherDeductionPO param);
}

View File

@ -732,5 +732,95 @@
</trim>
</insert>
<resultMap id="listDetailsResultMap" type="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
<result column="id" property="id"/>
<result column="employee_id" property="employeeId"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="declare_month" property="declareMonth"/>
<result column="business_healthy_insurance" property="businessHealthyInsurance"/>
<result column="tax_delay_endowment_insurance" property="taxDelayEndowmentInsurance"/>
<result column="other_deduction" property="otherDeduction"/>
<result column="deduction_allowed_donation" property="deductionAllowedDonation"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="private_pension" property="privatePension"/>
<result column="free_income" property="freeIncome"/>
<result column="derate_deduction" property="derateDeduction"/>
<collection property="freeIncomeList" ofType="com.engine.salary.entity.datacollection.po.FreeIncomePO">
<id property="id" column="free_id"/>
<result property="freeAmount" column="free_amount"></result>
</collection>
<collection property="derateDeductionList" ofType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
<id property="id" column="derate_id"/>
<result property="derateAmount" column="derate_amount"></result>
</collection>
<collection property="endowmentInsuranceList" ofType="com.engine.salary.entity.datacollection.po.EndowmentInsurancePO">
<id property="id" column="endowment_id"/>
<result property="currentDeduction" column="endowment_current_deduction"></result>
</collection>
<collection property="grantDonationList" ofType="com.engine.salary.entity.datacollection.po.GrantDonationPO">
<id property="id" column="grant_id"/>
<result property="actualDeduction" column="actual_deduction"></result>
</collection>
<collection property="healthInsuranceList" ofType="com.engine.salary.entity.datacollection.po.HealthInsurancePO">
<id property="id" column="health_id"/>
<result property="currentDeduction" column="health_current_deduction"></result>
</collection>
<collection property="otherDerateDeductionList" ofType="com.engine.salary.entity.datacollection.po.OtherDerateDeductionPO">
<id property="id" column="other_id"/>
<result property="otherDeduction" column="other_deduction"></result>
</collection>
<collection property="personalPensionList" ofType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
<id property="id" column="personal_id"/>
<result property="payAmount" column="pay_amount"></result>
</collection>
</resultMap>
<select id="listDetails" resultMap="listDetailsResultMap">
SELECT t.id
, t.employee_id
, t.tax_agent_id
, t.declare_month
, t.business_healthy_insurance
, t.tax_delay_endowment_insurance
, t.other_deduction
, t.deduction_allowed_donation
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.private_pension
, t.free_income
, t.derate_deduction
,a.id as free_id, a.free_amount
,b.id as derate_id, b.derate_amount
,c.id as endowment_id, c.current_deduction as endowment_current_deduction
,d.id as grant_id, d.actual_deduction
,e.id as health_id, e.current_deduction as health_current_deduction
,f.id as other_id, f.other_deduction
,g.id as personal_id, g.pay_amount
FROM hrsa_other_deduction t
left join hrsa_free_income a on t.id=a.main_id and a.delete_type=0 and a.income_category=#{param.incomeCategory}
left join hrsa_derate_deduction b on t.id=b.main_id and b.delete_type=0 and b.income_category=#{param.incomeCategory}
left join hrsa_endowment_insurance c on t.id=c.main_id and c.delete_type=0 and c.income_category=#{param.incomeCategory}
left join hrsa_grant_donation d on t.id=d.main_id and d.delete_type=0 and d.income_category=#{param.incomeCategory}
left join hrsa_health_insurance e on t.id=e.main_id and e.delete_type=0 and e.income_category=#{param.incomeCategory}
left join hrsa_other_derate_deduction f on t.id=f.main_id and f.delete_type=0 and f.income_category=#{param.incomeCategory}
left join hrsa_personal_pension g on t.id=g.main_id and g.delete_type=0 and g.income_category=#{param.incomeCategory}
where t.delete_type=0
and t.tax_agent_id = #{param.taxAgentId}
and t.declare_month = #{param.declareMonth}
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
</mapper>

View File

@ -98,6 +98,16 @@ public interface OtherDeductionService {
*/
List<OtherDeductionPO> getOtherDeductionList(YearMonth declareMonth, List<Long> employeeIds, Long taxAgentId);
/**
* 按照申报表类型获取其他免税扣除数据
* @param declareMonth
* @param employeeIds
* @param taxAgentId
* @param incomeCategory
* @return
*/
List<OtherDeductionPO> getOtherDeductionList(YearMonth declareMonth, List<Long> employeeIds, Long taxAgentId, Integer incomeCategory);
/**
* 编辑数据
*/

View File

@ -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<OtherDeductionPO> getOtherDeductionList(YearMonth declareMonth, List<Long> 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<OtherDeductionPO> 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<OtherDeductionPO> listDetails(OtherDeductionPO param) {
if (CollectionUtils.isNotEmpty(param.getEmployeeIds())) {
List<List<Long>> partition = Lists.partition(param.getEmployeeIds(), 500);
List<OtherDeductionPO> otherDeductionPOS = new ArrayList<>();
partition.forEach(l -> {
param.setEmployeeIds(l);
otherDeductionPOS.addAll(getOtherDeductionMapper().listDetails(param));
});
return encryptUtil.decryptList(otherDeductionPOS, OtherDeductionPO.class);
} else {
List<OtherDeductionPO> 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<List<Object>> endowmentInsuranceRowList = new ArrayList<>();
List<Object> endowmentInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "所得项目","申报扣除月份", "税延养老账户编号", "报税校验码", "年度保费", "月度保费", "本期扣除金额");
List<Object> endowmentInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "所得项目", "申报扣除月份", "税延养老账户编号", "报税校验码", "年度保费", "月度保费", "本期扣除金额");
endowmentInsuranceRowList.add(endowmentInsuranceTitle);
endowmentInsuranceList.forEach(dto -> {
List<Object> row = new ArrayList<>();

View File

@ -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<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> 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<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId,salarySobPO.getIncomeCategory());
sw.stop();
//6查询社保福利
sw.start("查询社保福利");