Merge branch 'release/个税版本' into custom/艾志工业
This commit is contained in:
commit
30c6caf0d3
|
|
@ -122,6 +122,9 @@ public class SalaryCalcTax {
|
|||
// 综合所得
|
||||
requestParam.put("zhsd", buildZHSDRequestParam(salaryAcctTaxAgents, salaryAcctEmployees,
|
||||
salaryAcctResultValueMap, taxReportColumnMap, salarySobTaxReportRuleMap, employeeDeclares));
|
||||
// 综合所得
|
||||
requestParam.put("flsd", buildFLSDRequestParam(salaryAcctTaxAgents, salaryAcctEmployees,
|
||||
salaryAcctResultValueMap, taxReportColumnMap, salarySobTaxReportRuleMap, employeeDeclares));
|
||||
|
||||
resultMap.put(taxAgent.getId(), requestParam);
|
||||
}
|
||||
|
|
@ -196,4 +199,43 @@ public class SalaryCalcTax {
|
|||
}
|
||||
return requestParam;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildFLSDRequestParam(List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents,
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees,
|
||||
Map<Long, List<SalaryAcctResultPO>> salaryAcctResultValueMap,
|
||||
Map<String, List<TaxReportColumnPO>> taxReportColumnMap,
|
||||
Map<String, SalarySobTaxReportRulePO> salarySobTaxReportRuleMap,
|
||||
List<EmployeeDeclarePO> employeeDeclares) {
|
||||
Map<String, List<SalaryAcctEmployeePO>> incomeCategoryKeySalaryAcctEmployeeMap = SalaryEntityUtil
|
||||
.group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getIncomeCategory);
|
||||
|
||||
Map<String, Object> requestParam = new HashMap<>();
|
||||
|
||||
for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) {
|
||||
IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum
|
||||
.parseByValue(salaryAcctTaxAgent.getIncomeCategory());
|
||||
List<TaxReportColumnPO> taxReportColumns = taxReportColumnMap.get(incomeCategoryEnum.getValue().toString());
|
||||
List<SalaryAcctEmployeePO> subSalaryAcctEmployees = incomeCategoryKeySalaryAcctEmployeeMap.get(incomeCategoryEnum.getValue().toString());
|
||||
Map<Long, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(subSalaryAcctEmployees, SalaryAcctEmployeePO::getEmployeeId);
|
||||
|
||||
SalaryCalcTaxRequest salaryCalcTaxRequest = new SalaryCalcTaxRequest(salaryAcctEmployeeMap,
|
||||
salaryAcctResultValueMap, taxReportColumns, salarySobTaxReportRuleMap, employeeDeclares);
|
||||
|
||||
switch (incomeCategoryEnum) {
|
||||
case CLASSIFIED_INCOME_LISTED_COMPANY_DIVIDENDS_BONUSES:
|
||||
List<Map<String, Object>> ssgsgxhllb = salaryCalcTaxRequest.buildRequestParams(IncomeCategoryEnum.CLASSIFIED_INCOME_LISTED_COMPANY_DIVIDENDS_BONUSES,
|
||||
employeeDeclares, salaryAcctEmployeeMap, salaryAcctResultValueMap);
|
||||
requestParam.put("ssgsgxhllb", ssgsgxhllb);
|
||||
break;
|
||||
case CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES:
|
||||
List<Map<String, Object>> lxgxhllb = salaryCalcTaxRequest.buildRequestParams(IncomeCategoryEnum.CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES,
|
||||
employeeDeclares, salaryAcctEmployeeMap, salaryAcctResultValueMap);
|
||||
requestParam.put("lxgxhllb", lxgxhllb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return requestParam;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class SalaryCalcTaxRequest {
|
|||
employeeDeclares, salaryAcctEmployeeMap, salaryAcctResultValueMap);
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> buildRequestParams(IncomeCategoryEnum incomeCategoryEnum,
|
||||
public List<Map<String, Object>> buildRequestParams(IncomeCategoryEnum incomeCategoryEnum,
|
||||
List<EmployeeDeclarePO> employeeDeclares,
|
||||
Map<Long, SalaryAcctEmployeePO> salaryAcctEmployeeMap,
|
||||
Map<Long, List<SalaryAcctResultPO>> salaryAcctResultValueMap) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.entity.taxdeclaration.bo;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.engine.salary.entity.datacollection.po.*;
|
||||
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
||||
|
|
@ -35,7 +36,7 @@ public class TaxDeclarationRequest {
|
|||
List<TaxDeclarationPO> taxDeclarations,
|
||||
List<TaxDeclarationValuePO> taxDeclarationValues,
|
||||
List<EmployeeDeclarePO> employeeDeclares,
|
||||
Map<TaxFreeTypeEnum, Map<String,? extends List>> taxFreeMap) {
|
||||
Map<TaxFreeTypeEnum, Map<String, ? extends List>> taxFreeMap) {
|
||||
Map<String, Map<String, Object>> objRequestParam = Maps.newHashMap();
|
||||
Map<String, List<Map<String, Object>>> listRequestParam = Maps.newHashMap();
|
||||
Map<String, List<TaxReportColumnPO>> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory);
|
||||
|
|
@ -75,7 +76,7 @@ public class TaxDeclarationRequest {
|
|||
} else if (incomeCategoryEnum == IncomeCategoryEnum.COMPENSATION_FOR_DISMISS) {
|
||||
// 解除劳动合同一次性补偿金
|
||||
List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("jcldhtycxbcjlb", k -> Lists.newArrayList());
|
||||
employeeRequestParam.put("sfzdscmsfb","是");
|
||||
employeeRequestParam.put("sfzdscmsfb", "是");
|
||||
employeeRequestParams.add(employeeRequestParam);
|
||||
} else if (incomeCategoryEnum == IncomeCategoryEnum.INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE) {
|
||||
// 个人股权激励收入
|
||||
|
|
@ -126,7 +127,7 @@ public class TaxDeclarationRequest {
|
|||
} else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_AUTHOR) {
|
||||
// 稿酬所得
|
||||
List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("gcsdlb", k -> Lists.newArrayList());
|
||||
employeeRequestParam.put("sfzdscmsfb","是");
|
||||
employeeRequestParam.put("sfzdscmsfb", "是");
|
||||
employeeRequestParams.add(employeeRequestParam);
|
||||
} else if (incomeCategoryEnum == IncomeCategoryEnum.ROYALTIES) {
|
||||
// 特许权使用费所得
|
||||
|
|
@ -145,7 +146,8 @@ public class TaxDeclarationRequest {
|
|||
}
|
||||
|
||||
private static void buildOtherDeductionDetailParams(Map<TaxFreeTypeEnum, Map<String, ? extends List>> taxFreeMap, Map<String, List<Map<String, Object>>> listRequestParam, EmployeeDeclarePO employeeDeclare, IncomeCategoryEnum incomeCategoryEnum, Map<String, Object> employeeRequestParam) {
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("mssd", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
String mssd = employeeRequestParam.getOrDefault("mssd", "0").toString();
|
||||
if (NumberUtil.isNumber(mssd) && new BigDecimal(mssd).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> freeIncomeMap = taxFreeMap.get(TaxFreeTypeEnum.FREE_INCOME);
|
||||
List<FreeIncomePO> poList = (List<FreeIncomePO>) freeIncomeMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(poList)) {
|
||||
|
|
@ -169,7 +171,8 @@ public class TaxDeclarationRequest {
|
|||
}
|
||||
}
|
||||
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("syjkbx", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
String syjkbx = employeeRequestParam.getOrDefault("syjkbx", "0").toString();
|
||||
if (NumberUtil.isNumber(syjkbx) && new BigDecimal(syjkbx).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> healthInsuranceMap = taxFreeMap.get(TaxFreeTypeEnum.HEALTH_INSURANCE);
|
||||
List<HealthInsurancePO> pos = (List<HealthInsurancePO>) healthInsuranceMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
|
|
@ -184,7 +187,7 @@ public class TaxDeclarationRequest {
|
|||
map.put("zzhm", employeeDeclare.getCardNum());
|
||||
// 所得项目
|
||||
map.put("sdxm", incomeCategoryEnum.getDefaultLabel());
|
||||
map.put("bdsxrq",SalaryDateUtil.getFormatLocalDate(healthInsurancePO.getEffectiveDate()) );
|
||||
map.put("bdsxrq", SalaryDateUtil.getFormatLocalDate(healthInsurancePO.getEffectiveDate()));
|
||||
map.put("sysbm", healthInsurancePO.getIdentificationNumber());
|
||||
map.put("ndbf", healthInsurancePO.getYearPremium());
|
||||
map.put("ydbf", healthInsurancePO.getMonthPremium());
|
||||
|
|
@ -194,7 +197,9 @@ public class TaxDeclarationRequest {
|
|||
listRequestParam.put("syjkbxfblb", paramMaps);
|
||||
}
|
||||
}
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("syylbx", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
|
||||
String syylbx = employeeRequestParam.getOrDefault("syylbx", "0").toString();
|
||||
if (NumberUtil.isNumber(syylbx) && new BigDecimal(syylbx).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> posMap = taxFreeMap.get(TaxFreeTypeEnum.ENDOWMENT_INSURANCE);
|
||||
List<EndowmentInsurancePO> pos = (List<EndowmentInsurancePO>) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
|
|
@ -220,7 +225,9 @@ public class TaxDeclarationRequest {
|
|||
listRequestParam.put("syjkbxfblb", paramMaps);
|
||||
}
|
||||
}
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("zykcjze", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
|
||||
String zykcjze = employeeRequestParam.getOrDefault("zykcjze", "0").toString();
|
||||
if (NumberUtil.isNumber(zykcjze) && new BigDecimal(zykcjze).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> posMap = taxFreeMap.get(TaxFreeTypeEnum.GRANT_DONATION);
|
||||
List<GrantDonationPO> pos = (List<GrantDonationPO>) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
|
|
@ -250,7 +257,8 @@ public class TaxDeclarationRequest {
|
|||
}
|
||||
}
|
||||
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("jmse", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
String jmse = employeeRequestParam.getOrDefault("jmse", "0").toString();
|
||||
if (NumberUtil.isNumber(jmse) && new BigDecimal(jmse).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> posMap = taxFreeMap.get(TaxFreeTypeEnum.DERATE_DEDUCTION);
|
||||
List<DerateDeductionPO> pos = (List<DerateDeductionPO>) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
|
|
@ -274,9 +282,10 @@ public class TaxDeclarationRequest {
|
|||
}
|
||||
}
|
||||
|
||||
if (new BigDecimal(employeeRequestParam.getOrDefault("qt", "0").toString()).compareTo(new BigDecimal("0")) > 0) {
|
||||
String qt = employeeRequestParam.getOrDefault("qt", "0").toString();
|
||||
if (NumberUtil.isNumber(qt) && new BigDecimal(qt).compareTo(new BigDecimal("0")) > 0) {
|
||||
Map<String, ? extends List> posMap = taxFreeMap.get(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION);
|
||||
List<OtherDerateDeductionPO> pos = (List<OtherDerateDeductionPO>) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
List<OtherDerateDeductionPO> pos = (List<OtherDerateDeductionPO>) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle()));
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
employeeRequestParam.put("bz", pos.get(0).getRemark());
|
||||
}
|
||||
|
|
@ -312,6 +321,40 @@ public class TaxDeclarationRequest {
|
|||
}
|
||||
|
||||
|
||||
public static Map<String, Object> convert2flsdRequestParam(List<TaxReportColumnPO> taxReportColumns,
|
||||
List<TaxDeclarationPO> taxDeclarations,
|
||||
List<TaxDeclarationValuePO> taxDeclarationValues,
|
||||
List<EmployeeDeclarePO> employeeDeclares) {
|
||||
Map<String, Map<String, Object>> objRequestParam = Maps.newHashMap();
|
||||
Map<String, List<Map<String, Object>>> listRequestParam = Maps.newHashMap();
|
||||
Map<String, List<TaxReportColumnPO>> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory);
|
||||
Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId);
|
||||
Map<Long, List<TaxDeclarationValuePO>> taxDeclarationValueMap = SalaryEntityUtil.group2Map(taxDeclarationValues, TaxDeclarationValuePO::getTaxDeclarationId);
|
||||
for (TaxDeclarationPO taxDeclaration : taxDeclarations) {
|
||||
List<TaxDeclarationValuePO> values = taxDeclarationValueMap.get(taxDeclaration.getId());
|
||||
for (TaxDeclarationValuePO taxDeclarationValue : values) {
|
||||
EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclarationValue.getEmployeeId());
|
||||
IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory());
|
||||
if (employeeDeclare == null || incomeCategoryEnum == null) {
|
||||
continue;
|
||||
}
|
||||
List<TaxReportColumnPO> taxReportColumnList = taxReportColumnMap.get(Util.null2String(incomeCategoryEnum.getValue()));
|
||||
Map<String, Object> employeeRequestParam = convert2RequestParam(incomeCategoryEnum, taxReportColumnList, taxDeclarationValue, employeeDeclare);
|
||||
if (incomeCategoryEnum == IncomeCategoryEnum.CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES) {
|
||||
// 其他利息股息红利所得
|
||||
List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("lxgxhllb", k -> Lists.newArrayList());
|
||||
employeeRequestParams.add(employeeRequestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> requestParam = Maps.newHashMap();
|
||||
requestParam.putAll(objRequestParam);
|
||||
requestParam.putAll(listRequestParam);
|
||||
return requestParam;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> convert2fjmsdRequestParam(List<TaxReportColumnPO> taxReportColumns,
|
||||
List<TaxDeclarationPO> taxDeclarations,
|
||||
List<TaxDeclarationValuePO> taxDeclarationValues,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.enums.salarysob;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.salary.constant.SzyhApiConstant;
|
||||
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
||||
|
|
@ -673,6 +674,88 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
|
|||
return resultMap;
|
||||
}
|
||||
|
||||
},
|
||||
CLASSIFIED_INCOME_LISTED_COMPANY_DIVIDENDS_BONUSES(810, "0810", "上市公司股息红利所得(沪市、深市、创业板)", DeclareReportTypeEnum.CLASSIFIED_INCOME, 181945) {
|
||||
@Override
|
||||
public void parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
|
||||
List<GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw> flsd = declareTaxResultFeedbackResponse.getBody().getFlsd().getSsgsgxhllb().getSscglb();
|
||||
List<List<Object>> sheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw.class, flsd);
|
||||
result.put(this.getDefaultLabel(), sheetData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, SalarySobTaxRuleDTO> parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List<EmployeeDeclarePO> employeeDeclares, SalarySobTaxRuleDTO taxRuleDTO) {
|
||||
checkGetASynIndividualIncomeTaxFeedbackResponse(declareTaxResultFeedbackResponse);
|
||||
GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx ssgsgxhllb = declareTaxResultFeedbackResponse.getBody().getFlsd().getSsgsgxhllb();
|
||||
checkSSSBYYLBResponse(ssgsgxhllb.getSssbyylb());
|
||||
|
||||
Gson gs = new Gson();
|
||||
List<SalarySobTaxRuleDTO.TaxRuleDTO> taxRules = taxRuleDTO.getTaxRules();
|
||||
|
||||
List<GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result> sscglb = ssgsgxhllb.getSscglb();
|
||||
Map<String, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result> idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result::getZzhm);
|
||||
Map<Long, SalarySobTaxRuleDTO> resultMap = new HashMap<>();
|
||||
for (EmployeeDeclarePO employeeDeclare : employeeDeclares) {
|
||||
GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result result = idNoResultMap.get(employeeDeclare.getCardNum());
|
||||
if (result == null) {
|
||||
continue;
|
||||
}
|
||||
taxRules.forEach(rule -> {
|
||||
String getter = "get" + rule.getTaxIndex().substring(0, 1).toUpperCase() + rule.getTaxIndex().substring(1);
|
||||
try {
|
||||
Method method = result.getClass().getMethod(getter);
|
||||
Object invoke = method.invoke(result);
|
||||
rule.setValue(Util.null2String(invoke));
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
|
||||
log.error("getTaxErr no such method {}", getter, ex);
|
||||
}
|
||||
});
|
||||
resultMap.put(employeeDeclare.getEmployeeId(), gs.fromJson(gs.toJson(taxRuleDTO), (Type) SalarySobTaxRuleDTO.class));
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
},
|
||||
CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES(800, "0800", "其他利息股息红利所得", DeclareReportTypeEnum.CLASSIFIED_INCOME, 181945) {
|
||||
@Override
|
||||
public void parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
|
||||
List<GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw> flsd = declareTaxResultFeedbackResponse.getBody().getFlsd().getLxgxhllb().getSscglb();
|
||||
List<List<Object>> sheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw.class, flsd);
|
||||
result.put(this.getDefaultLabel(), sheetData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, SalarySobTaxRuleDTO> parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List<EmployeeDeclarePO> employeeDeclares, SalarySobTaxRuleDTO taxRuleDTO) {
|
||||
checkGetASynIndividualIncomeTaxFeedbackResponse(declareTaxResultFeedbackResponse);
|
||||
GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx ssgsgxhllb = declareTaxResultFeedbackResponse.getBody().getFlsd().getLxgxhllb();
|
||||
checkSSSBYYLBResponse(ssgsgxhllb.getSssbyylb());
|
||||
|
||||
Gson gs = new Gson();
|
||||
List<SalarySobTaxRuleDTO.TaxRuleDTO> taxRules = taxRuleDTO.getTaxRules();
|
||||
|
||||
List<GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result> sscglb = ssgsgxhllb.getSscglb();
|
||||
Map<String, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result> idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result::getZzhm);
|
||||
Map<Long, SalarySobTaxRuleDTO> resultMap = new HashMap<>();
|
||||
for (EmployeeDeclarePO employeeDeclare : employeeDeclares) {
|
||||
GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result result = idNoResultMap.get(employeeDeclare.getCardNum());
|
||||
if (result == null) {
|
||||
continue;
|
||||
}
|
||||
taxRules.forEach(rule -> {
|
||||
String getter = "get" + rule.getTaxIndex().substring(0, 1).toUpperCase() + rule.getTaxIndex().substring(1);
|
||||
try {
|
||||
Method method = result.getClass().getMethod(getter);
|
||||
Object invoke = method.invoke(result);
|
||||
rule.setValue(Util.null2String(invoke));
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
|
||||
log.error("getTaxErr no such method {}", getter, ex);
|
||||
}
|
||||
});
|
||||
resultMap.put(employeeDeclare.getEmployeeId(), gs.fromJson(gs.toJson(taxRuleDTO), (Type) SalarySobTaxRuleDTO.class));
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -716,6 +799,14 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
private static void checkSSSBYYLBResponse(List<GetASynIndividualIncomeTaxFeedbackResponse.Body.sssbyy> sssbyylb) {
|
||||
if(CollUtil.isNotEmpty(sssbyylb)){
|
||||
String err = sssbyylb.stream().map(sssbyy -> sssbyy.getXm() + sssbyy.getCwxx()).collect(Collectors.joining(","));
|
||||
throw new OnlineCalculateTaxException(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Map<String, List<List<Object>>> parseGetCompanyIncomesResponse(Map<String, List<List<Object>>> result, GetCompanyIncomesResponse response) {
|
||||
List<GetCompanyIncomesResponse.sfmx> sfmx = Optional.ofNullable(response.getBody().getSfmx())
|
||||
.orElse(new ArrayList<>())
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ public class GetASynIndividualIncomeTaxFeedbackResponse extends BaseResponse {
|
|||
* 综合所得 必填:是 见综合所得计算结果
|
||||
*/
|
||||
private zhsd zhsd;
|
||||
// /**
|
||||
// * 分类所得 必填:是 见分类所得计算结果
|
||||
// */
|
||||
// private flsd flsd;
|
||||
/**
|
||||
* 分类所得 必填:是 见分类所得计算结果
|
||||
*/
|
||||
private flsd flsd;
|
||||
/**
|
||||
* 非居民所得 必填:是 见非居民所得计算结果
|
||||
*/
|
||||
|
|
@ -543,6 +543,193 @@ public class GetASynIndividualIncomeTaxFeedbackResponse extends BaseResponse {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类所得
|
||||
*/
|
||||
@Data
|
||||
public static class flsd {
|
||||
|
||||
/**
|
||||
* 利息股息红利所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx lxgxhllb;
|
||||
/**
|
||||
* 股权转让所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx ggzrlb;
|
||||
/**
|
||||
* 其他财产转让所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx qtcczrlb;
|
||||
/**
|
||||
* 偶然所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx orsdlb;
|
||||
/**
|
||||
* 其他财产租赁列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx qtcczllb;
|
||||
/**
|
||||
* 上市公司股息红利 必填:null
|
||||
*/
|
||||
private flsdssjgdx ssgsgxhllb;
|
||||
/**
|
||||
* 个人房屋出租所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx grfwczsdlb;
|
||||
/**
|
||||
* 随机赠送礼品列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx sjzslplb;
|
||||
/**
|
||||
* 三板市场股息红利所得 必填:null
|
||||
*/
|
||||
private flsdssjgdx sbscgxhllb;
|
||||
/**
|
||||
* 证劵资金利息所得 必填:null
|
||||
*/
|
||||
private flsdssjgdx zjzjlxlb;
|
||||
|
||||
|
||||
/**
|
||||
* 分类所得算税结果对象
|
||||
*/
|
||||
@Data
|
||||
public static class flsdssjgdx {
|
||||
/**
|
||||
* 算税成功列表 参考输入报文非居民所得输出结果报文
|
||||
*/
|
||||
private List<result> sscglb;
|
||||
/**
|
||||
* 算税失败列表 参考输入报文非居民所得输出结果报文
|
||||
*/
|
||||
private List<result> sssblb;
|
||||
/**
|
||||
* 算税失败原因列表 参考算税失败原因对象
|
||||
*/
|
||||
private List<sssbyy> sssbyylb;
|
||||
/**
|
||||
* 算税总人数
|
||||
*/
|
||||
private int sszrs;
|
||||
/**
|
||||
* 算税失败总人数
|
||||
*/
|
||||
private int sssbrs;
|
||||
|
||||
/**
|
||||
* 所得输出结果报文
|
||||
*/
|
||||
@Data
|
||||
public static class result {
|
||||
/**
|
||||
* 是否明细申报 必填:否 是或者否
|
||||
*/
|
||||
private String sfmxsb;
|
||||
/**
|
||||
* 姓名 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String xm;
|
||||
/**
|
||||
* 证件类型名称 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String zzlx;
|
||||
/**
|
||||
* 证件号码 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String zzhm;
|
||||
/**
|
||||
* 收入额 必填:是
|
||||
*/
|
||||
private String sre;
|
||||
/**
|
||||
* 免税收入 必填:是
|
||||
*/
|
||||
private String mssd;
|
||||
/**
|
||||
* 财产原值 必填:是
|
||||
*/
|
||||
private String ccyz;
|
||||
/**
|
||||
* 允许扣除的税费 必填:是
|
||||
*/
|
||||
private String yxkcsf;
|
||||
/**
|
||||
* 投资抵扣 必填:是
|
||||
*/
|
||||
private String tzdk;
|
||||
/**
|
||||
* 其他 必填:是
|
||||
*/
|
||||
private String qt;
|
||||
/**
|
||||
* 备注 必填:是
|
||||
*/
|
||||
private String bz;
|
||||
/**
|
||||
* 减除费用 必填:是
|
||||
*/
|
||||
private String jcfy;
|
||||
/**
|
||||
* 减计比例 必填:是
|
||||
*/
|
||||
private String jjbl;
|
||||
/**
|
||||
* 准予扣除的捐赠额 必填:是
|
||||
*/
|
||||
private String zykcjze;
|
||||
/**
|
||||
* 税前扣除项目合计 必填:是
|
||||
*/
|
||||
private String sqkcxmhj;
|
||||
/**
|
||||
* 应纳税所得额 必填:是
|
||||
*/
|
||||
private String ynssde;
|
||||
/**
|
||||
* 应纳税额 必填:是
|
||||
*/
|
||||
private String ynse;
|
||||
/**
|
||||
* 减免税额 必填:是
|
||||
*/
|
||||
private String jmse;
|
||||
/**
|
||||
* 已缴税额 必填:是 无需填写该值,按0处理
|
||||
*/
|
||||
private String ykjse;
|
||||
/**
|
||||
* 应扣缴税额 必填:是
|
||||
*/
|
||||
private String yingkjse;
|
||||
/**
|
||||
* 税率 必填:是
|
||||
*/
|
||||
private String sl;
|
||||
/**
|
||||
* 速算扣除数 必填:是
|
||||
*/
|
||||
private String sskcs;
|
||||
/**
|
||||
* 应补退税额 必填:是
|
||||
*/
|
||||
private String ybtse;
|
||||
/**
|
||||
* 分类所得名字 必填:是 分类所得薪金类别-利息股息红利所得,股权转让所得,其他财产转让所得,偶然所得,其他所得"
|
||||
*/
|
||||
private String sdxm;
|
||||
/**
|
||||
* 所得期间起 必填:是 YYYY-MM
|
||||
*/
|
||||
private String sdqjq;
|
||||
/**
|
||||
* 所得期间止 必填:是 YYYY-MM
|
||||
*/
|
||||
private String sdqjz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class fjmsd {
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
|
|||
* 综合所得 必填:是 见综合所得计算结果
|
||||
*/
|
||||
private zhsd zhsd;
|
||||
// /**
|
||||
// * 分类所得 必填:是 见分类所得计算结果
|
||||
// */
|
||||
// private 对象 flsd;
|
||||
/**
|
||||
* 分类所得 必填:是 见分类所得计算结果
|
||||
*/
|
||||
private flsd flsd;
|
||||
/**
|
||||
* 非居民所得 必填:是 见非居民所得计算结果
|
||||
*/
|
||||
|
|
@ -657,6 +657,192 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类所得
|
||||
*/
|
||||
@Data
|
||||
public static class flsd {
|
||||
|
||||
/**
|
||||
* 利息股息红利所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx lxgxhllb;
|
||||
/**
|
||||
* 股权转让所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx ggzrlb;
|
||||
/**
|
||||
* 其他财产转让所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx qtcczrlb;
|
||||
/**
|
||||
* 偶然所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx orsdlb;
|
||||
/**
|
||||
* 其他财产租赁列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx qtcczllb;
|
||||
/**
|
||||
* 上市公司股息红利 必填:null
|
||||
*/
|
||||
private flsdssjgdx ssgsgxhllb;
|
||||
/**
|
||||
* 个人房屋出租所得列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx grfwczsdlb;
|
||||
/**
|
||||
* 随机赠送礼品列表 必填:null
|
||||
*/
|
||||
private flsdssjgdx sjzslplb;
|
||||
/**
|
||||
* 三板市场股息红利所得 必填:null
|
||||
*/
|
||||
private flsdssjgdx sbscgxhllb;
|
||||
/**
|
||||
* 证劵资金利息所得 必填:null
|
||||
*/
|
||||
private flsdssjgdx zjzjlxlb;
|
||||
|
||||
|
||||
/**
|
||||
* 4.3.1.3.3.1分类所得算税结果对象
|
||||
*/
|
||||
@Data
|
||||
public static class flsdssjgdx {
|
||||
/**
|
||||
* 非算税成功列表 参考输入报文非居民所得输出结果报文
|
||||
*/
|
||||
private List<flsdscbw> sscglb;
|
||||
/**
|
||||
* 算税失败列表 参考输入报文非居民所得输出结果报文
|
||||
*/
|
||||
private List<flsdscbw> sssblb;
|
||||
/**
|
||||
* 失败原因列表 参考算税失败原因对象
|
||||
*/
|
||||
private List<rydbjgdx> sssbyylb;
|
||||
/**
|
||||
* 算税总人数
|
||||
*/
|
||||
private int sszrs;
|
||||
/**
|
||||
* 失败总人数
|
||||
*/
|
||||
private int sssbrs;
|
||||
|
||||
/**
|
||||
* 所得输出结果报文
|
||||
*/
|
||||
@Data
|
||||
public static class flsdscbw {
|
||||
/**
|
||||
* 是否明细申报 必填:否 是或者否
|
||||
*/
|
||||
private String sfmxsb;
|
||||
/**
|
||||
* 姓名 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String xm;
|
||||
/**
|
||||
* 证件类型名称 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String zzlx;
|
||||
/**
|
||||
* 证件号码 必填:null 汇总申报返回空
|
||||
*/
|
||||
private String zzhm;
|
||||
/**
|
||||
* 收入额 必填:是
|
||||
*/
|
||||
private String sre;
|
||||
/**
|
||||
* 免税收入 必填:是
|
||||
*/
|
||||
private String mssd;
|
||||
/**
|
||||
* 财产原值 必填:是
|
||||
*/
|
||||
private String ccyz;
|
||||
/**
|
||||
* 允许扣除的税费 必填:是
|
||||
*/
|
||||
private String yxkcsf;
|
||||
/**
|
||||
* 投资抵扣 必填:是
|
||||
*/
|
||||
private String tzdk;
|
||||
/**
|
||||
* 其他 必填:是
|
||||
*/
|
||||
private String qt;
|
||||
/**
|
||||
* 备注 必填:是
|
||||
*/
|
||||
private String bz;
|
||||
/**
|
||||
* 减除费用 必填:是
|
||||
*/
|
||||
private String jcfy;
|
||||
/**
|
||||
* 减计比例 必填:是
|
||||
*/
|
||||
private String jjbl;
|
||||
/**
|
||||
* 准予扣除的捐赠额 必填:是
|
||||
*/
|
||||
private String zykcjze;
|
||||
/**
|
||||
* 税前扣除项目合计 必填:是
|
||||
*/
|
||||
private String sqkcxmhj;
|
||||
/**
|
||||
* 应纳税所得额 必填:是
|
||||
*/
|
||||
private String ynssde;
|
||||
/**
|
||||
* 应纳税额 必填:是
|
||||
*/
|
||||
private String ynse;
|
||||
/**
|
||||
* 减免税额 必填:是
|
||||
*/
|
||||
private String jmse;
|
||||
/**
|
||||
* 已缴税额 必填:是 无需填写该值,按0处理
|
||||
*/
|
||||
private String ykjse;
|
||||
/**
|
||||
* 应扣缴税额 必填:是
|
||||
*/
|
||||
private String yingkjse;
|
||||
/**
|
||||
* 税率 必填:是
|
||||
*/
|
||||
private String sl;
|
||||
/**
|
||||
* 速算扣除数 必填:是
|
||||
*/
|
||||
private String sskcs;
|
||||
/**
|
||||
* 应补退税额 必填:是
|
||||
*/
|
||||
private String ybtse;
|
||||
/**
|
||||
* 分类所得名字 必填:是 分类所得薪金类别-利息股息红利所得,股权转让所得,其他财产转让所得,偶然所得,其他所得"
|
||||
*/
|
||||
private String sdxm;
|
||||
/**
|
||||
* 所得期间起 必填:是 YYYY-MM
|
||||
*/
|
||||
private String sdqjq;
|
||||
/**
|
||||
* 所得期间止 必填:是 YYYY-MM
|
||||
*/
|
||||
private String sdqjz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class fjmsd {
|
||||
|
|
|
|||
|
|
@ -725,6 +725,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
|
|||
requestParam.put("zhsd", taxDeclarationParam);
|
||||
}
|
||||
|
||||
if (declareReportType == DeclareReportTypeEnum.CLASSIFIED_INCOME) {
|
||||
//分类所得
|
||||
Map<String, Object> flsdRequestParam = TaxDeclarationRequest.convert2flsdRequestParam(taxReportColumns, taxDeclarations, taxDeclarationValues, employeeDeclares);
|
||||
requestParam.put("flsd", flsdRequestParam);
|
||||
}
|
||||
|
||||
if (declareReportType == DeclareReportTypeEnum.NONRESIDENT_INCOME) {
|
||||
//非居民所得代扣代缴 fjmsd
|
||||
Map<String, Object> fjmsdRequestParam = TaxDeclarationRequest.convert2fjmsdRequestParam(taxReportColumns, taxDeclarations, taxDeclarationValues, employeeDeclares);
|
||||
|
|
@ -736,7 +742,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
|
|||
Map<String, String> params = new HashMap<>(1);
|
||||
Map<String, String> header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE);
|
||||
log.info("个税申报返回数据: {} , taxDeclareRecord: {}", res, taxDeclareRecord);
|
||||
log.info("个税申报数据:params {} ,res {}, taxDeclareRecord: {}",params, res, taxDeclareRecord);
|
||||
DeclareTaxResponse declareTaxResponse = JsonUtil.parseObject(res, DeclareTaxResponse.class);
|
||||
if (Objects.isNull(declareTaxResponse) || Objects.isNull(declareTaxResponse.getHead())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "服务异常"));
|
||||
|
|
|
|||
|
|
@ -281,7 +281,8 @@ public class SalarySobWrapper extends Service {
|
|||
public List<Map<String, Object>> incomeCategoryList() {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
Arrays.stream(IncomeCategoryEnum.values())
|
||||
.filter(incomeCategory -> incomeCategory.getReportType() == DeclareReportTypeEnum.COMPREHENSIVE_INCOME)
|
||||
.filter(incomeCategory -> incomeCategory.getReportType() == DeclareReportTypeEnum.COMPREHENSIVE_INCOME
|
||||
|| incomeCategory.getReportType() == DeclareReportTypeEnum.CLASSIFIED_INCOME)
|
||||
.forEach(incomeCategory -> {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("enum", incomeCategory);
|
||||
|
|
|
|||
Loading…
Reference in New Issue