From d4ff9af8b76428a687e1b4959238f64a01f9315d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 17 Jun 2025 11:23:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=89=80=E5=BE=97-=E4=B8=8A?= =?UTF-8?q?=E5=B8=82=E5=85=AC=E5=8F=B8=E8=82=A1=E6=81=AF=E7=BA=A2=E5=88=A9?= =?UTF-8?q?=E6=89=80=E5=BE=97(=E6=B2=AA=E5=B8=82=E3=80=81=E6=B7=B1?= =?UTF-8?q?=E5=B8=82=E3=80=81=E5=88=9B=E4=B8=9A=E6=9D=BF)=20=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=89=80=E5=BE=97-=E5=85=B6=E4=BB=96=E5=88=A9?= =?UTF-8?q?=E6=81=AF=E8=82=A1=E6=81=AF=E7=BA=A2=E5=88=A9=E6=89=80=E5=BE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/salaryacct/bo/SalaryCalcTax.java | 42 ++++ .../salaryacct/bo/SalaryCalcTaxRequest.java | 2 +- .../bo/TaxDeclarationRequest.java | 65 +++++- .../enums/salarysob/IncomeCategoryEnum.java | 91 ++++++++ ...ynIndividualIncomeTaxFeedbackResponse.java | 195 +++++++++++++++++- .../GetDeclareTaxResultFeedbackResponse.java | 194 ++++++++++++++++- .../impl/TaxDeclareRecordServiceImpl.java | 8 +- .../salary/wrapper/SalarySobWrapper.java | 3 +- 8 files changed, 578 insertions(+), 22 deletions(-) diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTax.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTax.java index 3dab288f0..8be3d2ed9 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTax.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTax.java @@ -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 buildFLSDRequestParam(List salaryAcctTaxAgents, + List salaryAcctEmployees, + Map> salaryAcctResultValueMap, + Map> taxReportColumnMap, + Map salarySobTaxReportRuleMap, + List employeeDeclares) { + Map> incomeCategoryKeySalaryAcctEmployeeMap = SalaryEntityUtil + .group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getIncomeCategory); + + Map requestParam = new HashMap<>(); + + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum + .parseByValue(salaryAcctTaxAgent.getIncomeCategory()); + List taxReportColumns = taxReportColumnMap.get(incomeCategoryEnum.getValue().toString()); + List subSalaryAcctEmployees = incomeCategoryKeySalaryAcctEmployeeMap.get(incomeCategoryEnum.getValue().toString()); + Map 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> 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> lxgxhllb = salaryCalcTaxRequest.buildRequestParams(IncomeCategoryEnum.CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES, + employeeDeclares, salaryAcctEmployeeMap, salaryAcctResultValueMap); + requestParam.put("lxgxhllb", lxgxhllb); + break; + default: + break; + } + } + return requestParam; + } } diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTaxRequest.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTaxRequest.java index 7e836152a..39eb225c0 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTaxRequest.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcTaxRequest.java @@ -200,7 +200,7 @@ public class SalaryCalcTaxRequest { employeeDeclares, salaryAcctEmployeeMap, salaryAcctResultValueMap); } - private List> buildRequestParams(IncomeCategoryEnum incomeCategoryEnum, + public List> buildRequestParams(IncomeCategoryEnum incomeCategoryEnum, List employeeDeclares, Map salaryAcctEmployeeMap, Map> salaryAcctResultValueMap) { diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationRequest.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationRequest.java index 495e4635b..cd4140605 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationRequest.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationRequest.java @@ -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 taxDeclarations, List taxDeclarationValues, List employeeDeclares, - Map> taxFreeMap) { + Map> taxFreeMap) { Map> objRequestParam = Maps.newHashMap(); Map>> listRequestParam = Maps.newHashMap(); Map> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory); @@ -75,7 +76,7 @@ public class TaxDeclarationRequest { } else if (incomeCategoryEnum == IncomeCategoryEnum.COMPENSATION_FOR_DISMISS) { // 解除劳动合同一次性补偿金 List> 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> 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> taxFreeMap, Map>> listRequestParam, EmployeeDeclarePO employeeDeclare, IncomeCategoryEnum incomeCategoryEnum, Map 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 freeIncomeMap = taxFreeMap.get(TaxFreeTypeEnum.FREE_INCOME); List poList = (List) 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 healthInsuranceMap = taxFreeMap.get(TaxFreeTypeEnum.HEALTH_INSURANCE); List pos = (List) 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 posMap = taxFreeMap.get(TaxFreeTypeEnum.ENDOWMENT_INSURANCE); List pos = (List) 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 posMap = taxFreeMap.get(TaxFreeTypeEnum.GRANT_DONATION); List pos = (List) 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 posMap = taxFreeMap.get(TaxFreeTypeEnum.DERATE_DEDUCTION); List pos = (List) 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 posMap = taxFreeMap.get(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION); - List pos = (List) posMap.get(employeeDeclare.getTaxAgentId() + "-" + employeeDeclare.getEmployeeId() + "-" + SalaryDateUtil.getFormatYearMonth(employeeDeclare.getTaxCycle())); + List pos = (List) 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 convert2flsdRequestParam(List taxReportColumns, + List taxDeclarations, + List taxDeclarationValues, + List employeeDeclares) { + Map> objRequestParam = Maps.newHashMap(); + Map>> listRequestParam = Maps.newHashMap(); + Map> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory); + Map employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId); + Map> taxDeclarationValueMap = SalaryEntityUtil.group2Map(taxDeclarationValues, TaxDeclarationValuePO::getTaxDeclarationId); + for (TaxDeclarationPO taxDeclaration : taxDeclarations) { + List 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 taxReportColumnList = taxReportColumnMap.get(Util.null2String(incomeCategoryEnum.getValue())); + Map employeeRequestParam = convert2RequestParam(incomeCategoryEnum, taxReportColumnList, taxDeclarationValue, employeeDeclare); + if (incomeCategoryEnum == IncomeCategoryEnum.CLASSIFIED_INCOME_OTHER_INTEREST_DIVIDENDS_BONUSES) { + // 其他利息股息红利所得 + List> employeeRequestParams = listRequestParam.computeIfAbsent("lxgxhllb", k -> Lists.newArrayList()); + employeeRequestParams.add(employeeRequestParam); + } + } + } + + Map requestParam = Maps.newHashMap(); + requestParam.putAll(objRequestParam); + requestParam.putAll(listRequestParam); + return requestParam; + } + + public static Map convert2fjmsdRequestParam(List taxReportColumns, List taxDeclarations, List taxDeclarationValues, diff --git a/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java b/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java index 504e7d3d7..b2476e6b8 100644 --- a/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java +++ b/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java @@ -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 { return resultMap; } + }, + CLASSIFIED_INCOME_LISTED_COMPANY_DIVIDENDS_BONUSES(810, "0810", "上市公司股息红利所得(沪市、深市、创业板)", DeclareReportTypeEnum.CLASSIFIED_INCOME, 181945) { + @Override + public void parseGetDeclareTaxResultFeedbackResponse(Map>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) { + List flsd = declareTaxResultFeedbackResponse.getBody().getFlsd().getSsgsgxhllb().getSscglb(); + List> sheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw.class, flsd); + result.put(this.getDefaultLabel(), sheetData); + } + + @Override + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares, SalarySobTaxRuleDTO taxRuleDTO) { + checkGetASynIndividualIncomeTaxFeedbackResponse(declareTaxResultFeedbackResponse); + GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx ssgsgxhllb = declareTaxResultFeedbackResponse.getBody().getFlsd().getSsgsgxhllb(); + checkSSSBYYLBResponse(ssgsgxhllb.getSssbyylb()); + + Gson gs = new Gson(); + List taxRules = taxRuleDTO.getTaxRules(); + + List sscglb = ssgsgxhllb.getSscglb(); + Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result::getZzhm); + Map 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>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) { + List flsd = declareTaxResultFeedbackResponse.getBody().getFlsd().getLxgxhllb().getSscglb(); + List> sheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.flsd.flsdssjgdx.flsdscbw.class, flsd); + result.put(this.getDefaultLabel(), sheetData); + } + + @Override + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares, SalarySobTaxRuleDTO taxRuleDTO) { + checkGetASynIndividualIncomeTaxFeedbackResponse(declareTaxResultFeedbackResponse); + GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx ssgsgxhllb = declareTaxResultFeedbackResponse.getBody().getFlsd().getLxgxhllb(); + checkSSSBYYLBResponse(ssgsgxhllb.getSssbyylb()); + + Gson gs = new Gson(); + List taxRules = taxRuleDTO.getTaxRules(); + + List sscglb = ssgsgxhllb.getSscglb(); + Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.flsd.flsdssjgdx.result::getZzhm); + Map 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 { } } + private static void checkSSSBYYLBResponse(List sssbyylb) { + if(CollUtil.isNotEmpty(sssbyylb)){ + String err = sssbyylb.stream().map(sssbyy -> sssbyy.getXm() + sssbyy.getCwxx()).collect(Collectors.joining(",")); + throw new OnlineCalculateTaxException(err); + } + } + + public Map>> parseGetCompanyIncomesResponse(Map>> result, GetCompanyIncomesResponse response) { List sfmx = Optional.ofNullable(response.getBody().getSfmx()) .orElse(new ArrayList<>()) diff --git a/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java b/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java index ff4fb6484..ad6d5ed8a 100644 --- a/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java +++ b/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java @@ -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 sscglb; + /** + * 算税失败列表 参考输入报文非居民所得输出结果报文 + */ + private List sssblb; + /** + * 算税失败原因列表 参考算税失败原因对象 + */ + private List 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 { diff --git a/src/com/engine/salary/remote/tax/response/declare/GetDeclareTaxResultFeedbackResponse.java b/src/com/engine/salary/remote/tax/response/declare/GetDeclareTaxResultFeedbackResponse.java index 6691cdb96..aec9cc394 100644 --- a/src/com/engine/salary/remote/tax/response/declare/GetDeclareTaxResultFeedbackResponse.java +++ b/src/com/engine/salary/remote/tax/response/declare/GetDeclareTaxResultFeedbackResponse.java @@ -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 sscglb; + /** + * 算税失败列表 参考输入报文非居民所得输出结果报文 + */ + private List sssblb; + /** + * 失败原因列表 参考算税失败原因对象 + */ + private List 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 { diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 334ea2f51..28914157d 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -717,6 +717,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe requestParam.put("zhsd", taxDeclarationParam); } + if (declareReportType == DeclareReportTypeEnum.CLASSIFIED_INCOME) { + //分类所得 + Map flsdRequestParam = TaxDeclarationRequest.convert2flsdRequestParam(taxReportColumns, taxDeclarations, taxDeclarationValues, employeeDeclares); + requestParam.put("flsd", flsdRequestParam); + } + if (declareReportType == DeclareReportTypeEnum.NONRESIDENT_INCOME) { //非居民所得代扣代缴 fjmsd Map fjmsdRequestParam = TaxDeclarationRequest.convert2fjmsdRequestParam(taxReportColumns, taxDeclarations, taxDeclarationValues, employeeDeclares); @@ -728,7 +734,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe Map params = new HashMap<>(1); Map 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, "服务异常")); diff --git a/src/com/engine/salary/wrapper/SalarySobWrapper.java b/src/com/engine/salary/wrapper/SalarySobWrapper.java index 3eea30516..97e7c99d0 100644 --- a/src/com/engine/salary/wrapper/SalarySobWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobWrapper.java @@ -281,7 +281,8 @@ public class SalarySobWrapper extends Service { public List> incomeCategoryList() { List> 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 map = new HashMap(); map.put("enum", incomeCategory);