二开,自离账套不参与申报

This commit is contained in:
钱涛 2025-05-09 17:59:40 +08:00
parent 223049c9c5
commit df093e606c
3 changed files with 31 additions and 12 deletions

View File

@ -116,14 +116,6 @@ public class TaxDeclarationPO {
//结束日期
private Date taxCycleEndDate;
/**
* 税款所属期
*/
LocalDateRange taxMonths;
private Collection<Long> taxAgentIds;
private Set<String> opts;
}

View File

@ -3,6 +3,8 @@ package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.kq.service.KQGroupService;
import com.engine.kq.service.impl.KQGroupServiceImpl;
import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.biz.SalarySobItemBiz;
import com.engine.salary.biz.SalarySobItemGroupBiz;
@ -42,7 +44,6 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
import com.engine.salary.exception.SalaryRunTimeException;
@ -188,6 +189,12 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
}
private KQGroupService getKQGroupService() {
User user = new User();
user.setUid(1);
user.setLoginid("sysadmin");
return (KQGroupService) ServiceUtil.getService(KQGroupServiceImpl.class, user);
}
@Override
public List<SalarySobItemPO> list() {
@ -1012,7 +1019,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
List<SalaryAcctResultPO> lastMonthResultPOS = getSalaryAcctResultService(user).listBySobSalaryMonth(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1), salaryAcctCalculateBO.getSalarySobPO().getId(), employeeIds);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList, lastMonthResultPOS);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
KQGroupService kqGroupService = getKQGroupService();
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO, kqGroupService, null);
Map<String, String> resultMap = new HashMap<>();
formulaVarMap.entrySet().forEach(e -> {

View File

@ -54,6 +54,8 @@ import com.engine.salary.remote.tax.response.declare.GetCompanyIncomesResponse;
import com.engine.salary.remote.tax.response.declare.GetDeclareTaxResultFeedbackResponse;
import com.engine.salary.service.*;
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.*;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
@ -181,6 +183,10 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
return ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private TaxPaymentServiceFactory taxPaymentServiceFactory = new TaxPaymentServiceFactory(user);
@ -283,12 +289,19 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
salaryAcctTaxAgents = salaryAcctTaxAgents.stream().filter(e -> taxAgentIds.contains(e.getTaxAgentId())).collect(Collectors.toList());
List<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getSalaryAcctRecordId, Collectors.toList());
salaryAcctRecords = salaryAcctRecords.stream().filter(e -> salaryAcctRecordIds.contains(e.getId())).collect(Collectors.toList());
//二开自离账套不参与申报
String notaxsobids = getSalarySysConfService(user).getValueByCode("notaxsobids");
List<Long> noTaxSobIds = Arrays.stream(notaxsobids.split(",")).map(Long::valueOf).collect(Collectors.toList());
salaryAcctRecords = salaryAcctRecords.stream().filter(e -> !noTaxSobIds.contains(e.getSalarySobId())).collect(Collectors.toList());
List<Long> finalSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecords, SalaryAcctRecordPO::getId, Collectors.toList());
// 校验是否可以生成个税申报表
// 返回目前已经生成的个税申报表
List<TaxDeclareRecordPO> taxDeclareRecords = checkBeforeSave(saveParam, taxAgentNameMap, salaryAcctRecords, salaryAcctTaxAgents);
Map<String, TaxDeclareRecordPO> taxDeclareRecordMap = SalaryEntityUtil.convert2Map(taxDeclareRecords, e -> e.getTaxCycle() + "-" + e.getTaxAgentId());
// 查询薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, null, taxAgents.stream().findFirst().orElse(new TaxAgentPO()).getId());
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(finalSalaryAcctRecordIds, null, taxAgents.stream().findFirst().orElse(new TaxAgentPO()).getId());
// 薪资核算人员按照税款所属期聚合分类
Map<Date, List<SalaryAcctEmployeePO>> taxCycleKeyEmployeeMap = SalaryEntityUtil.group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getTaxCycle);
for (Map.Entry<Date, List<SalaryAcctEmployeePO>> taxCycleEntry : taxCycleKeyEmployeeMap.entrySet()) {
@ -378,6 +391,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
.taxCycle(taxDeclareRecord.getTaxCycle())
.build();
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listByTaxCycleAndTaxAgentId(salaryAcctEmployeeQueryParam);
//二开自离账套不参与申报
String notaxsobids = getSalarySysConfService(user).getValueByCode("notaxsobids");
List<Long> noTaxSobIds = Arrays.stream(notaxsobids.split(",")).map(Long::valueOf).collect(Collectors.toList());
salaryAcctEmployees = salaryAcctEmployees.stream().filter(e -> !noTaxSobIds.contains(e.getSalarySobId())).collect(Collectors.toList());
// 查询薪资核算记录
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getSalaryAcctRecordId);
List<SalaryAcctRecordPO> salaryAcctRecords = getSalaryAcctRecordService(user).listByIds(salaryAcctRecordIds);