联特调整

This commit is contained in:
Harryxzy 2025-07-21 16:13:59 +08:00
parent 61af1d5c09
commit dd53bd861c
2 changed files with 45 additions and 9 deletions

View File

@ -22,13 +22,14 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.IdGenerator;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
* 通用一般劳务报酬所得全年一次性奖金
@ -42,6 +43,13 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
@Override
public TaxDeclarationGenerateResult generate(TaxDeclareContext taxDeclareContext, Long employeeId) {
// 获取联特绩效账套
BaseBean baseBean = new BaseBean();
String jxSobIdStr = baseBean.getPropValue("ltSalary", "tax_declare_jx_sob_ids");
List<Long> jxSobIdList = new ArrayList<>();
if (StringUtils.isNotBlank(jxSobIdStr)) {
jxSobIdList = Arrays.stream(jxSobIdStr.split(",")).filter(id -> NumberUtils.isCreatable(id)).map(Long::valueOf).collect(Collectors.toList());
}
Date now = new Date();
// 薪资核算结果按照薪资核算人员id聚合分类
Map<Long, List<SalaryAcctResultPO>> salaryAcctResultValueMap = SalaryEntityUtil.group2Map(taxDeclareContext.getSalaryAcctResultValues(), SalaryAcctResultPO::getSalaryAcctEmpId);
@ -122,6 +130,10 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
List<SalaryAcctEmployeePO> employeePOS = employeeIdEntry.getValue();
BigDecimal income = new BigDecimal("0.00");
for (SalaryAcctEmployeePO salaryAcctEmployeePO : employeePOS) {
// 跳过绩效账套
if (jxSobIdList.contains(salaryAcctEmployeePO.getSalarySobId())) {
continue;
}
SalarySobTaxReportRulePO incomeRule = taxDeclareContext.getSalarySobTaxReportRuleMap()
.get(salaryAcctEmployeePO.getSalarySobId() + "-" + taxReportColumn.getReportColumnDataIndex());
List<SalaryAcctResultPO> salaryAcctResultValue = salaryAcctResultValueMap.get(salaryAcctEmployeePO.getId());
@ -160,6 +172,29 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
}
value = StrUtil.isNotBlank(value) ? value : Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0.00" : "";
}
if (new String("income").equals(taxReportColumn.getReportColumnDataIndex()) && Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue())) {
// 还需要取联特绩效本期收入
List<SalaryAcctEmployeePO> employeePOS = employeeIdEntry.getValue();
BigDecimal income = new BigDecimal("0.00");
for (SalaryAcctEmployeePO salaryAcctEmployeePO : employeePOS) {
SalarySobTaxReportRulePO incomeRule = taxDeclareContext.getSalarySobTaxReportRuleMap()
.get(salaryAcctEmployeePO.getSalarySobId() + "-ltjxincome" );
List<SalaryAcctResultPO> salaryAcctResultValue = salaryAcctResultValueMap.get(salaryAcctEmployeePO.getId());
if (incomeRule != null && salaryAcctResultValue != null) {
String incomeValue = salaryAcctResultValue.stream()
.filter(result -> result.getSalaryItemId().equals(incomeRule.getSalaryItemId()))
.findFirst()
.orElse(new SalaryAcctResultPO())
.getResultValue();
if (StrUtil.isNotBlank(incomeValue) && NumberUtil.isNumber(incomeValue)) {
income = income.add(new BigDecimal(incomeValue));
}
}
}
BigDecimal valueBigDecimal = NumberUtils.isCreatable(value) ? new BigDecimal(value) : new BigDecimal("0.00");
value = valueBigDecimal.add(income).toPlainString();
}
valueMap.put(taxReportColumn.getReportColumnDataIndex(), value);
}
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder()

View File

@ -302,11 +302,12 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
String key = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY);
}
// 处理合并计税
if (!taxIds.contains(salaryItemId)) {
//个税项目默认只能从税局取
resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()));
}
// 联特 取消合并计税
// // 处理合并计税
// if (!taxIds.contains(salaryItemId)) {
// //个税项目默认只能从税局取
// resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()));
// }
// 处理小数点
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap);