diff --git a/src/com/engine/salary/annotation/TaxField.java b/src/com/engine/salary/annotation/TaxField.java new file mode 100644 index 000000000..57495febf --- /dev/null +++ b/src/com/engine/salary/annotation/TaxField.java @@ -0,0 +1,12 @@ +package com.engine.salary.annotation; + +import java.lang.annotation.*; + +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface TaxField { + String name(); + + String taxIndex(); +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobTaxRuleDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobTaxRuleDTO.java new file mode 100644 index 000000000..a39c1abbf --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobTaxRuleDTO.java @@ -0,0 +1,55 @@ +package com.engine.salary.entity.salarysob.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Map; + +/** + * 薪资账套的个税规则 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SalarySobTaxRuleDTO { + + //所得项目的id + private String incomeCategoryId; + + //所得项目的名称 + private String incomeCategoryName; + + //个税的对应关系 + private List taxRules; + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Builder + public static class TaxRuleDTO { + + //个税字段 + private String name; + + //个税索引 + private String taxIndex; + + //个税字段和薪资项目的对应关系 + private Map salaryItem; + + //个税字段的值 + private String value; + + //对应关系是否可以编辑 + private boolean canEdit; + } +} diff --git a/src/com/engine/salary/entity/salarysob/param/SalarySobTaxRuleSaveParam.java b/src/com/engine/salary/entity/salarysob/param/SalarySobTaxRuleSaveParam.java new file mode 100644 index 000000000..bf3be6fc6 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/param/SalarySobTaxRuleSaveParam.java @@ -0,0 +1,43 @@ +package com.engine.salary.entity.salarysob.param; + +import lombok.Data; + +import java.util.List; + +/** + * 薪资账套的个税规则 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +public class SalarySobTaxRuleSaveParam { + + //薪资账套的id + private Long salarySobId; + + //不同所得项目的个税的对应关系 + private List incomeCategoryParams; + + @Data + public static class TaxReportRuleIncomeCategoryParam { + + //所得项目 + private String incomeCategory; + + //个税的对应关系 + private List taxRuleParams; + } + + @Data + public static class TaxRuleParam { + + //个税的列索引 + private String taxIndex; + + //薪资项目的id + private Long salaryItemId; + } +} diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobTaxRulePO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobTaxRulePO.java new file mode 100644 index 000000000..4bd4c0613 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobTaxRulePO.java @@ -0,0 +1,60 @@ +package com.engine.salary.entity.salarysob.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SalarySobTaxRulePO { + /** + * ID + */ + private Long id; + /** + * 创建时间 + */ + private Date createTime; + /** + * 修改时间 + */ + private Date updateTime; + /** + * 创建人id + */ + private Long creator; + /** + * 是否删除 + */ + private Integer deleteType; + /** + * 租户KEY + */ + private String tenantKey; + /** + * 薪资账套的id + */ + private Long salarySobId; + /** + * 所得项目 + */ + private String incomeCategory; + /** + * 个税列索引 + */ + private String taxIndex; + /** + * 薪资项目id + */ + private Long salaryItemId; + + //主键id集合 + private Collection ids; + +} \ No newline at end of file diff --git a/src/com/engine/salary/enums/salarysob/DeclareReportTypeEnum.java b/src/com/engine/salary/enums/salarysob/DeclareReportTypeEnum.java index 2d99b4ebc..f54e7bc86 100644 --- a/src/com/engine/salary/enums/salarysob/DeclareReportTypeEnum.java +++ b/src/com/engine/salary/enums/salarysob/DeclareReportTypeEnum.java @@ -1,8 +1,14 @@ package com.engine.salary.enums.salarysob; +import com.engine.salary.annotation.TaxField; +import com.engine.salary.entity.salarysob.dto.SalarySobTaxRuleDTO; import com.engine.salary.enums.BaseEnum; +import com.engine.salary.remote.tax.response.calculate.GetASynIndividualIncomeTaxFeedbackResponse; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; /** @@ -14,10 +20,30 @@ import java.util.Objects; * @version 1.0 **/ public enum DeclareReportTypeEnum implements BaseEnum { - COMPREHENSIVE_INCOME(1, "综合所得", 100133), - CLASSIFIED_INCOME(2, "分类所得", 86185), - NONRESIDENT_INCOME(3, "非居民所得", 107369), - RESTRICTED_SHARES_INCOME(4, "限售股所得", 90633); + COMPREHENSIVE_INCOME(1, "综合所得", 100133) { + @Override + public List getTaxRules() { + return buildRules(GetASynIndividualIncomeTaxFeedbackResponse.Body.zhsd.ssjgdx.result.class); + } + }, + CLASSIFIED_INCOME(2, "分类所得", 86185) { + @Override + public List getTaxRules() { + return buildRules(null); + } + }, + NONRESIDENT_INCOME(3, "非居民所得", 107369) { + @Override + public List getTaxRules() { + return buildRules(GetASynIndividualIncomeTaxFeedbackResponse.Body.fjmsd.ssjgdx.result.class); + } + }, + RESTRICTED_SHARES_INCOME(4, "限售股所得", 90633) { + @Override + public List getTaxRules() { + return buildRules(null); + } + }; private int value; @@ -47,6 +73,28 @@ public enum DeclareReportTypeEnum implements BaseEnum { return defaultLabel; } + public abstract List getTaxRules(); + + public static List buildRules(Class clazz) { + if (clazz == null) { + return new ArrayList<>(); + } + List rules = new ArrayList<>(); + Field[] fields = clazz.getDeclaredFields(); + for (Field f : fields) { + boolean isanno = f.isAnnotationPresent(TaxField.class); + if (isanno) { + TaxField annotation = f.getAnnotation(TaxField.class); + String name = annotation.name(); + String taxIndex = annotation.taxIndex(); + SalarySobTaxRuleDTO.TaxRuleDTO taxRuleDTO = SalarySobTaxRuleDTO.TaxRuleDTO.builder().name(name).taxIndex(taxIndex).build(); + rules.add(taxRuleDTO); + } + } + return rules; + } + + public static DeclareReportTypeEnum parseByValue(Integer value) { for (DeclareReportTypeEnum targetTypeEnum : DeclareReportTypeEnum.values()) { if (Objects.equals(targetTypeEnum.getValue(), value)) { diff --git a/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java b/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java index 9d7c9c427..4eed6daa9 100644 --- a/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java +++ b/src/com/engine/salary/enums/salarysob/IncomeCategoryEnum.java @@ -1,14 +1,19 @@ package com.engine.salary.enums.salarysob; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; +import com.engine.salary.entity.salarysob.dto.SalarySobTaxRuleDTO; import com.engine.salary.enums.BaseEnum; import com.engine.salary.remote.tax.response.calculate.GetASynIndividualIncomeTaxFeedbackResponse; import com.engine.salary.remote.tax.response.declare.GetDeclareTaxResultFeedbackResponse; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.excel.ExcelUtil; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import weaver.general.Util; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.*; /** @@ -19,6 +24,7 @@ import java.util.*; * @author qiantao * @version 1.0 **/ +@Slf4j public enum IncomeCategoryEnum implements BaseEnum { // todo 多语言 @@ -31,12 +37,27 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getZcgzxj().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + SalarySobTaxRuleDTO salarySobTaxRuleDTO = SalarySobTaxRuleDTO.builder().incomeCategoryId(this.getValue().toString()).incomeCategoryName(this.getDefaultLabel()).build(); + List taxRules = this.getReportType().getTaxRules(); + + List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getZcgzxj().getSscglb(); + Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.zhsd.ssjgdx.result::getZzhm); + Map resultMap = new HashMap<>(); for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); + GetASynIndividualIncomeTaxFeedbackResponse.Body.zhsd.ssjgdx.result result = idNoResultMap.get(employeeDeclare.getCardNum()); + taxRules.forEach(rule->{ + String getter = "get" + rule.getTaxIndex().substring(0, 1).toUpperCase() + rule.getTaxIndex().substring(1); + try { + Method method = rule.getClass().getMethod(getter); + Object invoke = method.invoke(rule); + rule.setValue(Util.null2String(invoke)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { + log.error("no such method", ex); + } + }); + salarySobTaxRuleDTO.setTaxRules(taxRules); + resultMap.put(employeeDeclare.getEmployeeId(),salarySobTaxRuleDTO ); } return resultMap; } @@ -50,15 +71,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getLwbclb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, ONETIME_ANNUAL_BONUS(2, "0103", "全年一次性奖金收入", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 160489) { @Override @@ -69,15 +85,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getQnycxjjsslb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, COMPENSATION_FOR_RETIRE(107, "0107", "内退一次性补偿金", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181936) { @Override @@ -88,15 +99,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getNtycxbcjlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, COMPENSATION_FOR_DISMISS(108, "0108", "解除劳动合同一次性补偿金", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181937) { @Override @@ -107,15 +113,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getJcldhtycxbcjlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE(109, "0109", "个人股权激励收入", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181938) { @Override @@ -126,15 +127,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getGrgqjl().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, ANNUITY_RECEIPT(110, "0110", "年金领取", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181939) { @Override @@ -145,15 +141,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getQynj().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, INCOME_FOR_INSURANCE_SALESMAN(402, "0402", "保险营销员佣金收入", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181940) { @Override @@ -164,15 +155,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getBxyxy().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, INCOME_FOR_SECURITIES_BROKER(403, "0403", "证券经纪人佣金收入", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181942) { @Override @@ -183,15 +169,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getZqjjr().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, REMUNERATION_FOR_OTHER_CONTINUOUS_LABOR(489, "0489", "其他连续劳务报酬所得", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181943) { @Override @@ -202,15 +183,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getQtlxlwbc().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, REMUNERATION_FOR_OTHER_LABOR(499, "0499", "其他非连续劳务报酬所得", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 175330) { @Override @@ -221,15 +197,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getQtflxlwbc().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, REMUNERATION_FOR_AUTHOR(500, "0500", "稿酬所得", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181944) { @Override @@ -240,15 +211,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getGcsdlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, ROYALTIES(600, "0600", "特许权使用费所得", DeclareReportTypeEnum.COMPREHENSIVE_INCOME, 181945) { @Override @@ -259,15 +225,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getTxq().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, NON_RESIDENT_INCOME_WAGES_AND_SALARIES(700, "0700", "无住所个人正常工资薪金", DeclareReportTypeEnum.NONRESIDENT_INCOME, 181945) { @Override @@ -278,15 +239,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getFjmsd().getWjgzxjlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, NON_RESIDENT_INCOME_MONTHLY_BONUS(710, "0710", "无住所个人数月奖金", DeclareReportTypeEnum.NONRESIDENT_INCOME, 181945) { @Override @@ -297,15 +253,10 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getFjmsd().getWjrysyjjlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } + }, NON_RESIDENT_INCOME_REMUNERATION_FOR_LABOR(720, "0720", "一般劳务报酬所得", DeclareReportTypeEnum.NONRESIDENT_INCOME, 181945) { @Override @@ -314,17 +265,11 @@ public enum IncomeCategoryEnum implements BaseEnum { List> sheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.fjmsd.fjmsdssjgdx.fjmsdscbw.class, fjmsd); result.put(this.getDefaultLabel(), sheetData); } - @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getFjmsd().getLwbclb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; - } + @Override + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; + } }, NON_RESIDENT_INCOME_COMPENSATION_FOR_DISMISS(730, "0730", "解除劳动合同一次性补偿金", DeclareReportTypeEnum.NONRESIDENT_INCOME, 181945) { @Override @@ -335,14 +280,8 @@ public enum IncomeCategoryEnum implements BaseEnum { } @Override - public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { - List sscglb = declareTaxResultFeedbackResponse.getBody().getFjmsd().getJcldhtycxbcjlb().getSscglb(); - Map idNoResultMap = SalaryEntityUtil.convert2Map(sscglb, GetASynIndividualIncomeTaxFeedbackResponse.Body.result::getZzhm); - Map resultMap = new HashMap<>(); - for (EmployeeDeclarePO employeeDeclare : employeeDeclares) { - resultMap.put(employeeDeclare.getEmployeeId(), idNoResultMap.get(employeeDeclare.getCardNum())); - } - return resultMap; + public Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares) { + return null; } }; @@ -368,7 +307,7 @@ public enum IncomeCategoryEnum implements BaseEnum { public abstract void parseGetDeclareTaxResultFeedbackResponse(Map>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse); - public abstract Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares); + public abstract Map parseGetASynIndividualIncomeTaxFeedbackResponse(GetASynIndividualIncomeTaxFeedbackResponse declareTaxResultFeedbackResponse, List employeeDeclares); @Override diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.java new file mode 100644 index 000000000..cd2db6677 --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.java @@ -0,0 +1,73 @@ +package com.engine.salary.mapper.salarysob; + +import com.engine.salary.entity.salarysob.po.SalarySobTaxRulePO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface SalarySobTaxRuleMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(SalarySobTaxRulePO sobTaxRule); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + SalarySobTaxRulePO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param sobTaxRule 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(SalarySobTaxRulePO sobTaxRule); + + /** + * 修改,修改所有字段 + * + * @param sobTaxRule 修改的记录 + * @return 返回影响行数 + */ + int update(SalarySobTaxRulePO sobTaxRule); + + /** + * 修改,忽略null字段 + * + * @param sobTaxRule 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(SalarySobTaxRulePO sobTaxRule); + + /** + * 删除记录 + * + * @param sobTaxRule 待删除的记录 + * @return 返回影响行数 + */ + int delete(SalarySobTaxRulePO sobTaxRule); + + /** + * 批量删除记录 + * @param ids 主键id集合 + */ + void deleteByIds(@Param("ids") Collection ids); + + void deleteBySalarySobIds(@Param("salarySobIds") Collection salarySobIds); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.xml new file mode 100644 index 000000000..53277c457 --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobTaxRuleMapper.xml @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + t + . + id + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + , t.salary_sob_id + , t.income_category + , t.tax_index + , t.salary_item_id + + + + + + + + + + + + + + + INSERT INTO hrsa_sob_tax_rule + + + + id, + + + create_time, + + + update_time, + + + creator, + + + delete_type, + + + tenant_key, + + + salary_sob_id, + + + income_category, + + + tax_index, + + + salary_item_id, + + + + + #{id}, + + + #{createTime}, + + + #{updateTime}, + + + #{creator}, + + + #{deleteType}, + + + #{tenantKey}, + + + #{salarySobId}, + + + #{incomeCategory}, + + + #{taxIndex}, + + + #{salaryItemId}, + + + + + + + UPDATE hrsa_sob_tax_rule + + create_time=#{createTime}, + update_time=#{updateTime}, + creator=#{creator}, + delete_type=#{deleteType}, + tenant_key=#{tenantKey}, + salary_sob_id=#{salarySobId}, + income_category=#{incomeCategory}, + tax_index=#{taxIndex}, + salary_item_id=#{salaryItemId}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_sob_tax_rule + + + create_time=#{createTime}, + + + update_time=#{updateTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + tenant_key=#{tenantKey}, + + + salary_sob_id=#{salarySobId}, + + + income_category=#{incomeCategory}, + + + tax_index=#{taxIndex}, + + + salary_item_id=#{salaryItemId}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_sob_tax_rule + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_sob_tax_rule + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + + UPDATE hrsa_sob_tax_rule + SET delete_type = 1 + WHERE delete_type = 0 + AND salary_sob_id IN + + #{salarySobId} + + + + \ No newline at end of file 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 7c1e13b6d..6801b8767 100644 --- a/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java +++ b/src/com/engine/salary/remote/tax/response/calculate/GetASynIndividualIncomeTaxFeedbackResponse.java @@ -1,6 +1,7 @@ package com.engine.salary.remote.tax.response.calculate; import com.engine.salary.annotation.TableTitle; +import com.engine.salary.annotation.TaxField; import com.engine.salary.entity.taxpayment.response.BaseResponse; import lombok.Data; import lombok.EqualsAndHashCode; @@ -210,6 +211,291 @@ public class GetASynIndividualIncomeTaxFeedbackResponse extends BaseResponse { * 企业上月是否已申报 0:上月未申报 1:上月已申报 2:上上月未申报 */ private String qysysfysb; + + + @Data + public static class result { + /** + * 是否明细申报 必填:否 是或者否 + */ + private String sfmxsb; + /** + * 姓名 必填:否 如果是汇总申报返回空 + */ + private String xm; + /** + * 证件类型 必填:否 见证件类型字典 如果是汇总申报返回空 + */ + private String zzlx; + /** + * 证件号码 必填:否 如果是汇总申报返回空 + */ + private String zzhm; + /** + * 任职受雇日期 必填:是 格式YYYY-MM-DD + */ + private String rzsgrq; + /** + * 离职日期 必填:否 格式YYYY-MM-DD + */ + private String lzrq; + /** + * 当期收入额 必填:是 不填写默认为0 + */ + private BigDecimal sre; + /** + * 当期免税收入 必填:否 + */ + private BigDecimal mssd; + /** + * 基本养老保险 必填:否 + */ + private BigDecimal jbylaobxf; + /** + * 基本医疗保险 必填:否 + */ + private BigDecimal jbylbxf; + /** + * 失业保险 必填:否 + */ + private BigDecimal sybxf; + /** + * 住房公积金 必填:否 + */ + private BigDecimal zfgjj; + /** + * 子女教育支出 必填:否 + */ + private BigDecimal znjyzc; + /** + * 赡养老人支出 必填:否 + */ + private BigDecimal sylrzc; + /** + * 住房贷款利息支出 必填:否 + */ + private BigDecimal zfdklxzc; + /** + * 住房租金支出 必填:否 + */ + private BigDecimal zfzjzc; + /** + * 继续教育支出 必填:否 + */ + private BigDecimal jxjyzc; + /** + * 非学历继续教育支出 必填:否 + */ + private BigDecimal fxljxjyzc; + /** + * 3岁以下婴幼儿照护支出 必填:否 + */ + private BigDecimal yyezhzc; + /** + * 年金 必填:否 + */ + private BigDecimal nj; + /** + * 商业健康保险 必填:否 + */ + private BigDecimal syjkbx; + /** + * 税延养老保险 必填:否 + */ + private BigDecimal syylbx; + /** + * 其他 必填:否 按法律规定可以在税前扣除的项目 + */ + private BigDecimal qt; + /** + * 准予扣除的捐赠额 必填:否 + */ + private BigDecimal zykcjze; + /** + * 减免税额 必填:否 + */ + private BigDecimal jmse; + /** + * 备注 必填:否 + */ + private String bz; + /** + * 减除费用 必填:否 正常工资薪金的减除费用。 对应保险营销员、证券经纪人的费用 + */ + private BigDecimal jcfy; + /** + * 其他扣除合计 必填:否 + */ + private BigDecimal qtckhj; + /** + * 应纳税所得额 必填:否 正常工资薪金返回否 + */ + private BigDecimal ynssde; + /** + * 应纳税额 必填:否 正常工资薪金返回否 + */ + private BigDecimal ynse; + /** + * 已缴税额 必填:否 正常工资薪金返回否 + */ + private BigDecimal ykjse; + /** + * 应扣缴税额 必填:否 正常工资薪金返回否 + */ + private BigDecimal yingkjse; + /** + * 税率 必填:否 + */ + private BigDecimal sl; + /** + * 速算扣除数 必填:否 + */ + private BigDecimal sskcs; + /** + * 所得项目名称 必填:是 正常工资薪金;全年一次性奖金收入;稿酬所得;劳务报酬 + */ + private String sdxm; + /** + * 应补退税额 必填:否 应补退税额=累计应扣缴税额-累计已缴税额 + */ + @TaxField(name = "应补退税额", taxIndex = "ybtse") + private BigDecimal ybtse; + /** + * 累计收入额 必填:否 + */ + private BigDecimal ljsre; + /** + * 累计免税收入额 必填:否 + */ + private BigDecimal ljmssd; + /** + * 累计专项扣除额 必填:否 三险一金合计 + */ + private BigDecimal ljzxkce; + /** + * 累计专项附加扣除额 必填:否 专项附加合计 + */ + private BigDecimal ljzxfjkce; + /** + * 累计其他扣除额 必填:否 + */ + private BigDecimal ljqtkce; + /** + * 累计减免税额 必填:否 + */ + private BigDecimal ljjmse; + /** + * 累计减除费用额 必填:否 正常工资薪金累计减除费用 必填:否 对应保险营销员、证券经纪人累计费用 + */ + private BigDecimal ljjcfye; + /** + * 累计月减除费用 必填:否 保险营销员、证券经纪人,其他连续劳务报酬的减除费用 + */ + private BigDecimal ljyjcfy; + /** + * 允许扣除税费 必填:否 保险营销员、证券经纪人 + */ + private BigDecimal yxkcsf; + /** + * 展业成本 必填:否 保险营销员、证券经纪人 + */ + private BigDecimal zycb; + /** + * 月减除费用 必填:否 保险营销员、证券经纪人,其他连续劳务报酬的减除费用 + */ + private BigDecimal yjcfy; + /** + * 累计应纳税所得额 必填:否 + */ + @TableTitle(title = "累计应纳税所得额", dataIndex = "ljynssde", key = "ljynssde") + private BigDecimal ljynssde; + /** + * 累计应纳税额 必填:否 + */ + private BigDecimal ljynse; + /** + * 累计应扣缴税额 必填:否 累计应扣缴税额 = 累计应纳税额 - 累计减免税额 + */ + private BigDecimal ljyingkjse; + /** + * 累计已缴税额 必填:否 + */ + private BigDecimal ljykjse; + /** + * 累计子女教育支出 必填:否 + */ + private BigDecimal ljznjyzc; + /** + * 累计继续教育支出 必填:否 + */ + private BigDecimal ljjxjyzc; + /** + * 累计非学历继续教育支持 必填:否 + */ + private BigDecimal ljfxljxjyzc; + /** + * 累计学历继续教育支持 必填:否 + */ + private BigDecimal ljxljxjyzc; + /** + * 累计住房租金支出 必填:否 + */ + private BigDecimal ljzfzjzc; + /** + * 累计房屋贷款支出 必填:否 + */ + private BigDecimal ljzfdklxzc; + /** + * 累计赡养老人支出 必填:否 + */ + private BigDecimal ljsylrzc; + /** + * 累计3岁以下婴幼儿照护支出 必填:否 + */ + private BigDecimal ljyyezhzc; + /** + * 累计准予扣除的捐赠额 必填:否 + */ + private BigDecimal ljzykcjze; + /** + * 累计个人养老金 必填:否 + */ + private BigDecimal ljgrylj; + /** + * 累计个人养老金校验码 必填:否 + */ + private String ljgryljjym; + /** + * 仅在两个月算税场景时使用,当前月分为N月: + * 0表示N-1月(上月)未申报 + * 1表示N-1月(上月)已申报 + * 2表示N-2月(上上个月)未申报 + */ + private String qysysfysb; + + /** + * 当前月分为N,如果N-1(上月)已申报,则返回N-1月员工在税局累计已扣缴的税额; + * 如果N-1月未申报,则返回N-2月工在税局累计已扣缴的税额; + */ + private BigDecimal ygzsjljykjse; + /** + * 本月已累计扣除税额 必填:否 针对一月多次算税的场景字段 + */ + private BigDecimal byyljkjse; + /** + * 本次应扣缴税额 必填:否 针对一月多次算税的场景字段,本次应扣缴税额=本月应扣缴税额-本月已累计税额 + */ + private BigDecimal bcykjse; + /** + * 分摊年度数 必填:否 + */ + private Integer ftnds; + /** + * 年减除费用 必填:否 默认为60000 + */ + private BigDecimal njcfy; + + } } } @@ -296,410 +582,122 @@ public class GetASynIndividualIncomeTaxFeedbackResponse extends BaseResponse { * 非居民算税失败总人数 */ private int sssbrs; + + @Data + public static class result { + + /** + * 姓名 必填:是 + */ + private String xm; + /** + * 证件类型名称 必填:是 + */ + private String zzlx; + /** + * 证件号码 必填:是 + */ + private String zzhm; + /** + * 收入额 必填:是 + */ + private String sre; + /** + * 累计收入(不含本次) 必填:是 + */ + private String ljsre; + /** + * 免税收入 必填:是 + */ + private String mssd; + /** + * 财产原值 必填:是 + */ + private String ccyz; + /** + * 允许扣除的税费 必填:是 + */ + private String yxkcsf; + /** + * 投资抵扣 必填:是 + */ + private String tzdk; + /** + * 其他 必填:是 + */ + private String qt; + /** + * 备注 必填:是 + */ + private String bz; + /** + * 实际工作年限 必填:是 + */ + private String sjgznxs; + /** + * 减除费用 必填:是 + */ + private String jcfy; + /** + * 准予扣除的捐赠额 必填:是 + */ + private String zykcjze; + /** + * 税前扣除项目合计 必填:是 + */ + private String sqkcxmhj; + /** + * 应纳税额所得额 必填:是 + */ + private String ynssde; + /** + * 应纳税额 必填:是 + */ + private String ynse; + /** + * 减免税额 必填:是 + */ + private String jmse; + /** + * 应扣缴税额 必填:是 + */ + private String yingkjse; + /** + * 已扣缴税额 必填:是 无需填写该值,按0处理 + */ + private String ykjse; + /** + * 税率 必填:是 + */ + private String sl; + /** + * 速算扣除数 必填:是 + */ + private String sskcs; + /** + * 代报方式 必填:是 + */ + private String sbfs; + /** + * 应补退税额 必填:是 + */ + private String ybtse; + /** + * 非居民所得项目名字 必填:是  非居民所得薪金类别-无住所个人正常工资薪金、全年一次性奖金收入 + */ + private String sdxm; + /** + * 所得期间起 必填:是 YYYY-MM + */ + private String sdqjq; + /** + * 所得期间止 必填:是 YYYY-MM + */ + private String sdqjz; + } } } - @Data - public static class result { - - //--------------综合所得输出结果报文------------------------------ - - /** - * 是否明细申报 必填:否 是或者否 - */ - private String sfmxsb; - /** - * 姓名 必填:否 如果是汇总申报返回空 - */ - @TableTitle(title = "姓名", dataIndex = "xm",key = "xm") - private String xm; - /** - * 证件类型 必填:否 见证件类型字典 如果是汇总申报返回空 - */ - private String zzlx; - /** - * 证件号码 必填:否 如果是汇总申报返回空 - */ - private String zzhm; - /** - * 任职受雇日期 必填:是 格式YYYY-MM-DD - */ - private String rzsgrq; - /** - * 离职日期 必填:否 格式YYYY-MM-DD - */ - private String lzrq; - /** - * 当期收入额 必填:是 不填写默认为0 - */ - @TableTitle(title = "当期收入额", dataIndex = "sre",key = "sre") - private BigDecimal sre; - /** - * 当期免税收入 必填:否 - */ - private BigDecimal mssd; - /** - * 基本养老保险 必填:否 - */ - private BigDecimal jbylaobxf; - /** - * 基本医疗保险 必填:否 - */ - private BigDecimal jbylbxf; - /** - * 失业保险 必填:否 - */ - private BigDecimal sybxf; - /** - * 住房公积金 必填:否 - */ - private BigDecimal zfgjj; - /** - * 子女教育支出 必填:否 - */ - private BigDecimal znjyzc; - /** - * 赡养老人支出 必填:否 - */ - private BigDecimal sylrzc; - /** - * 住房贷款利息支出 必填:否 - */ - private BigDecimal zfdklxzc; - /** - * 住房租金支出 必填:否 - */ - private BigDecimal zfzjzc; - /** - * 继续教育支出 必填:否 - */ - private BigDecimal jxjyzc; - /** - * 非学历继续教育支出 必填:否 - */ - private BigDecimal fxljxjyzc; - /** - * 3岁以下婴幼儿照护支出 必填:否 - */ - private BigDecimal yyezhzc; - /** - * 年金 必填:否 - */ - private BigDecimal nj; - /** - * 商业健康保险 必填:否 - */ - private BigDecimal syjkbx; - /** - * 税延养老保险 必填:否 - */ - private BigDecimal syylbx; - /** - * 其他 必填:否 按法律规定可以在税前扣除的项目 - */ - private BigDecimal qt; - /** - * 准予扣除的捐赠额 必填:否 - */ - private BigDecimal zykcjze; - /** - * 减免税额 必填:否 - */ - private BigDecimal jmse; - /** - * 备注 必填:否 - */ - private String bz; - /** - * 减除费用 必填:否 正常工资薪金的减除费用。 对应保险营销员、证券经纪人的费用 - */ - private BigDecimal jcfy; - /** - * 其他扣除合计 必填:否 - */ - private BigDecimal qtckhj; - /** - * 应纳税所得额 必填:否 正常工资薪金返回否 - */ - @TableTitle(title = "应纳税所得额", dataIndex = "ynssde",key = "ynssde") - private BigDecimal ynssde; - /** - * 应纳税额 必填:否 正常工资薪金返回否 - */ - private BigDecimal ynse; - /** - * 已缴税额 必填:否 正常工资薪金返回否 - */ - private BigDecimal ykjse; - /** - * 应扣缴税额 必填:否 正常工资薪金返回否 - */ - private BigDecimal yingkjse; - /** - * 税率 必填:否 - */ - private BigDecimal sl; - /** - * 速算扣除数 必填:否 - */ - private BigDecimal sskcs; - /** - * 所得项目名称 必填:是 正常工资薪金;全年一次性奖金收入;稿酬所得;劳务报酬 - */ - private String sdxm; - /** - * 应补退税额 必填:否 应补退税额=累计应扣缴税额-累计已缴税额 - */ - @TableTitle(title = "应补退税额", dataIndex = "ybtse",key = "ybtse") - private BigDecimal ybtse; - /** - * 累计收入额 必填:否 - */ - private BigDecimal ljsre; - /** - * 累计免税收入额 必填:否 - */ - private BigDecimal ljmssd; - /** - * 累计专项扣除额 必填:否 三险一金合计 - */ - private BigDecimal ljzxkce; - /** - * 累计专项附加扣除额 必填:否 专项附加合计 - */ - private BigDecimal ljzxfjkce; - /** - * 累计其他扣除额 必填:否 - */ - private BigDecimal ljqtkce; - /** - * 累计减免税额 必填:否 - */ - private BigDecimal ljjmse; - /** - * 累计减除费用额 必填:否 正常工资薪金累计减除费用 必填:否 对应保险营销员、证券经纪人累计费用 - */ - private BigDecimal ljjcfye; - /** - * 累计月减除费用 必填:否 保险营销员、证券经纪人,其他连续劳务报酬的减除费用 - */ - private BigDecimal ljyjcfy; - /** - * 允许扣除税费 必填:否 保险营销员、证券经纪人 - */ - private BigDecimal yxkcsf; - /** - * 展业成本 必填:否 保险营销员、证券经纪人 - */ - private BigDecimal zycb; - /** - * 月减除费用 必填:否 保险营销员、证券经纪人,其他连续劳务报酬的减除费用 - */ - private BigDecimal yjcfy; - /** - * 累计应纳税所得额 必填:否 - */ - @TableTitle(title = "累计应纳税所得额", dataIndex = "ljynssde",key = "ljynssde") - private BigDecimal ljynssde; - /** - * 累计应纳税额 必填:否 - */ - private BigDecimal ljynse; - /** - * 累计应扣缴税额 必填:否 累计应扣缴税额 = 累计应纳税额 - 累计减免税额 - */ - private BigDecimal ljyingkjse; - /** - * 累计已缴税额 必填:否 - */ - private BigDecimal ljykjse; - /** - * 累计子女教育支出 必填:否 - */ - private BigDecimal ljznjyzc; - /** - * 累计继续教育支出 必填:否 - */ - private BigDecimal ljjxjyzc; - /** - * 累计非学历继续教育支持 必填:否 - */ - private BigDecimal ljfxljxjyzc; - /** - * 累计学历继续教育支持 必填:否 - */ - private BigDecimal ljxljxjyzc; - /** - * 累计住房租金支出 必填:否 - */ - private BigDecimal ljzfzjzc; - /** - * 累计房屋贷款支出 必填:否 - */ - private BigDecimal ljzfdklxzc; - /** - * 累计赡养老人支出 必填:否 - */ - private BigDecimal ljsylrzc; - /** - * 累计3岁以下婴幼儿照护支出 必填:否 - */ - private BigDecimal ljyyezhzc; - /** - * 累计准予扣除的捐赠额 必填:否 - */ - private BigDecimal ljzykcjze; - /** - * 累计个人养老金 必填:否 - */ - private BigDecimal ljgrylj; - /** - * 累计个人养老金校验码 必填:否 - */ - private String ljgryljjym; - /** - * 仅在两个月算税场景时使用,当前月分为N月: - * 0表示N-1月(上月)未申报 - * 1表示N-1月(上月)已申报 - * 2表示N-2月(上上个月)未申报 - */ - private String qysysfysb; - - /** - * 当前月分为N,如果N-1(上月)已申报,则返回N-1月员工在税局累计已扣缴的税额; - * 如果N-1月未申报,则返回N-2月工在税局累计已扣缴的税额; - */ - private BigDecimal ygzsjljykjse; - /** - * 本月已累计扣除税额 必填:否 针对一月多次算税的场景字段 - */ - private BigDecimal byyljkjse; - /** - * 本次应扣缴税额 必填:否 针对一月多次算税的场景字段,本次应扣缴税额=本月应扣缴税额-本月已累计税额 - */ - private BigDecimal bcykjse; - /** - * 分摊年度数 必填:否 - */ - private Integer ftnds; - /** - * 年减除费用 必填:否 默认为60000 - */ - private BigDecimal njcfy; - - - //----------非居民所得输出结果报文------------------------------- - - /* - * 姓名 必填:是 - */ -// private String xm; - /* - * 证件类型名称 必填:是 - */ -// private String zzlx; - /* - * 证件号码 必填:是 - */ -// private String zzhm; - /* - * 收入额 必填:是 - */ -// private String sre; - /* - * 累计收入(不含本次) 必填:是 - */ -// private String ljsre; - /* - * 免税收入 必填:是 - */ -// private String mssd; - /** - * 财产原值 必填:是 - */ - private String ccyz; - /* - * 允许扣除的税费 必填:是 - */ -// private String yxkcsf; - /** - * 投资抵扣 必填:是 - */ - private String tzdk; - /* - * 其他 必填:是 - */ -// private String qt; - /* - * 备注 必填:是 - */ -// private String bz; - /** - * 实际工作年限 必填:是 - */ - private String sjgznxs; - /* - * 减除费用 必填:是 - */ -// private String jcfy; - /* - * 准予扣除的捐赠额 必填:是 - */ -// private String zykcjze; - /* - * 税前扣除项目合计 必填:是 - */ -// private String sqkcxmhj; - /* - * 应纳税额所得额 必填:是 - */ -// private String ynssde; - /* - * 应纳税额 必填:是 - */ -// private String ynse; - /* - * 减免税额 必填:是 - */ -// private String jmse; - /* - * 应扣缴税额 必填:是 - */ -// private String yingkjse; - /* - * 已扣缴税额 必填:是 无需填写该值,按0处理 - */ -// private String ykjse; - /* - * 税率 必填:是 - */ -// private String sl; - /* - * 速算扣除数 必填:是 - */ - // private String sskcs; - /** - * 代报方式 必填:是 - */ - private String sbfs; - /* - * 应补退税额 必填:是 - */ - // private String ybtse; - /* - * 非居民所得项目名字 必填:是  非居民所得薪金类别-无住所个人正常工资薪金、全年一次性奖金收入 - */ - // private String sdxm; - /** - * 所得期间起 必填:是 YYYY-MM - */ - private String sdqjq; - /** - * 所得期间止 必填:是 YYYY-MM - */ - private String sdqjz; - - } /** * 算税失败原因对象 diff --git a/src/com/engine/salary/service/SalarySobTaxRuleService.java b/src/com/engine/salary/service/SalarySobTaxRuleService.java new file mode 100644 index 000000000..b4d15c58b --- /dev/null +++ b/src/com/engine/salary/service/SalarySobTaxRuleService.java @@ -0,0 +1,51 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.salarysob.dto.SalarySobTaxRuleDTO; +import com.engine.salary.entity.salarysob.param.SalarySobTaxRuleSaveParam; +import com.engine.salary.entity.salarysob.po.SalarySobTaxRulePO; + +import java.util.Collection; +import java.util.List; + +/** + * 薪资账套的个税规则 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface SalarySobTaxRuleService { + + /** + * 根据薪资账套id查询薪资账套的个税规则 + * + * @param salarySobIds + * @return + */ + List listBySalarySobId(Long salarySobIds); + + /** + * 根据薪资账套id查询薪资账套的个税规则 + * + * @param salarySobId + * @return + */ + List getSalarySobTaxRuleDTO(Long salarySobId); + + /** + * 保存 + * + * @param saveParam + */ + void saveByParam(SalarySobTaxRuleSaveParam saveParam); + + /** + * 按薪资账套id删除 + * + * @param salarySobIds + */ + void deleteBySalarySobIds(Collection salarySobIds); + + void saveBatch(List salarySobTaxReportRules); +} diff --git a/src/com/engine/salary/service/impl/SalaryCalcTaxServiceImpl.java b/src/com/engine/salary/service/impl/SalaryCalcTaxServiceImpl.java index 4edb5b06a..9134fd988 100644 --- a/src/com/engine/salary/service/impl/SalaryCalcTaxServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryCalcTaxServiceImpl.java @@ -230,7 +230,7 @@ public class SalaryCalcTaxServiceImpl extends Service implements SalaryCalcTaxSe continue; } - Map empIdResult = incomeCategoryEnum.parseGetASynIndividualIncomeTaxFeedbackResponse(feedbackResponse, subEmployeeDeclares); +// Map empIdResult = incomeCategoryEnum.parseGetASynIndividualIncomeTaxFeedbackResponse(feedbackResponse, subEmployeeDeclares); Map dataMap = null; diff --git a/src/com/engine/salary/service/impl/SalarySobTaxRuleServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobTaxRuleServiceImpl.java new file mode 100644 index 000000000..59a390f1a --- /dev/null +++ b/src/com/engine/salary/service/impl/SalarySobTaxRuleServiceImpl.java @@ -0,0 +1,160 @@ +package com.engine.salary.service.impl; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.dto.SalarySobTaxRuleDTO; +import com.engine.salary.entity.salarysob.param.SalarySobTaxRuleSaveParam; +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.entity.salarysob.po.SalarySobTaxRulePO; +import com.engine.salary.enums.salarysob.IncomeCategoryEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.mapper.salarysob.SalarySobTaxRuleMapper; +import com.engine.salary.service.*; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.IdGenerator; +import com.engine.salary.util.db.MapperProxyFactory; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import org.apache.commons.collections4.CollectionUtils; +import weaver.hrm.User; + +import java.util.*; + +/** + * 薪资账套的个税申报表规则 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalarySobTaxRuleServiceImpl extends Service implements SalarySobTaxRuleService { + + + private SalarySobTaxRuleMapper salarySobTaxRuleMapper() { + return MapperProxyFactory.getProxy(SalarySobTaxRuleMapper.class); + } + + private SalarySobService getSalarySobService(User user) { + return ServiceUtil.getService(SalarySobServiceImpl.class, user); + } + + private TaxReportColumnService getTaxReportColumnService(User user) { + return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user); + } + + private SalaryItemService getSalaryItemService(User user) { + return ServiceUtil.getService(SalaryItemServiceImpl.class, user); + } + + private SalarySobItemService getSalarySobItemService(User user) { + return ServiceUtil.getService(SalarySobItemServiceImpl.class, user); + } + + private SalarySobBackItemService getSalarySobBackItemService(User user) { + return ServiceUtil.getService(SalarySobBackItemServiceImpl.class, user); + } + + @Override + public List listBySalarySobId(Long salarySobId) { + if (salarySobId == null) { + return Collections.emptyList(); + } + return salarySobTaxRuleMapper().listSome(SalarySobTaxRulePO.builder().salarySobId(salarySobId).build()); + } + + @Override + public List getSalarySobTaxRuleDTO(Long salarySobId) { + List resultList = Lists.newArrayList(); + // 查询薪资账套 + SalarySobPO salarySob = getSalarySobService(user).getById(salarySobId); + Integer incomeCategory = salarySob.getIncomeCategory(); + List incomeCategoryIds = Collections.singletonList(incomeCategory); + // 薪资账套的薪资项目 + List salarySobItems = getSalarySobItemService(user).listBySalarySobId(salarySobId); + // 薪资账套的回算薪资项目 + List salarySobBackItems = getSalarySobBackItemService(user).listBySalarySobId(salarySobId); + // 薪资项目 + Set salaryItemIds = Sets.newHashSet(); + salaryItemIds.addAll(SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId)); + salaryItemIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId)); + List salaryItems = getSalaryItemService(user).listByIds(salaryItemIds); + Map idKeySalaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId); + // 薪资账套中已经存在的对应关系 + List salarySobTaxReportRules = listBySalarySobId(salarySobId); + Map salarySobTaxReportRuleMap = SalaryEntityUtil.convert2Map(salarySobTaxReportRules, + e -> e.getIncomeCategory() + "-" + e.getTaxIndex(), SalarySobTaxRulePO::getSalaryItemId); + + for (Integer incomeCategoryId : incomeCategoryIds) { + IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(incomeCategoryId); + List taxRules = incomeCategoryEnum.getReportType().getTaxRules(); + for (SalarySobTaxRuleDTO.TaxRuleDTO taxRule : taxRules) { + Long salaryItemId = salarySobTaxReportRuleMap.get(incomeCategoryId + "-" + taxRule.getTaxIndex()); + SalaryItemPO salaryItem = idKeySalaryItemMap.get(salaryItemId); + if (Objects.nonNull(salaryItem)) { + Map dataMap = Maps.newHashMap(); + dataMap.put("id", salaryItem.getId().toString()); + dataMap.put("name", salaryItem.getName()); + taxRule.setSalaryItem(dataMap); + } + } + + SalarySobTaxRuleDTO salarySobTaxReportRuleDTO = new SalarySobTaxRuleDTO(); + salarySobTaxReportRuleDTO.setIncomeCategoryId(incomeCategoryId.toString()); + salarySobTaxReportRuleDTO.setIncomeCategoryName(SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel())); + salarySobTaxReportRuleDTO.setTaxRules(taxRules); + resultList.add(salarySobTaxReportRuleDTO); + } + return resultList; + } + + @Override + public void saveByParam(SalarySobTaxRuleSaveParam saveParam) { + // 校验参数是否合法 + // 构建po + Date now = new Date(); + List salarySobTaxReportRules = Lists.newArrayList(); + for (SalarySobTaxRuleSaveParam.TaxReportRuleIncomeCategoryParam incomeCategoryParam : saveParam.getIncomeCategoryParams()) { + for (SalarySobTaxRuleSaveParam.TaxRuleParam taxReportRuleParam : incomeCategoryParam.getTaxRuleParams()) { + SalarySobTaxRulePO salarySobTaxRule = new SalarySobTaxRulePO(); + salarySobTaxRule.setId(IdGenerator.generate()); + salarySobTaxRule.setSalarySobId(saveParam.getSalarySobId()); + salarySobTaxRule.setIncomeCategory(incomeCategoryParam.getIncomeCategory()); + salarySobTaxRule.setTaxIndex(taxReportRuleParam.getTaxIndex()); + salarySobTaxRule.setSalaryItemId(taxReportRuleParam.getSalaryItemId()); + salarySobTaxRule.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + salarySobTaxRule.setCreator((long) user.getUID()); + salarySobTaxRule.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + salarySobTaxRule.setCreateTime(now); + salarySobTaxRule.setUpdateTime(now); + salarySobTaxReportRules.add(salarySobTaxRule); + } + } + deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); + if (CollectionUtils.isNotEmpty(salarySobTaxReportRules)) { + salarySobTaxReportRules.forEach(salarySobTaxRuleMapper()::insertIgnoreNull); + } + } + + @Override + public void deleteBySalarySobIds(Collection salarySobIds) { + if (CollectionUtils.isEmpty(salarySobIds)) { + return; + } + salarySobTaxRuleMapper().deleteBySalarySobIds(salarySobIds); + } + + @Override + public void saveBatch(List salarySobTaxReportRules) { + if (CollectionUtils.isEmpty(salarySobTaxReportRules)) { + return; + } +// salarySobTaxReportRules.forEach(salarySobTaxReportRuleMapper()::insertIgnoreNull); + } +} diff --git a/src/com/engine/salary/web/SalarySobController.java b/src/com/engine/salary/web/SalarySobController.java index 904d1a472..7bdd6a0ea 100644 --- a/src/com/engine/salary/web/SalarySobController.java +++ b/src/com/engine/salary/web/SalarySobController.java @@ -81,6 +81,11 @@ public class SalarySobController { private SalarySobAddUpRuleWrapper getSalarySobAddUpRuleWrapper(User user) { return ServiceUtil.getService(SalarySobAddUpRuleWrapper.class, user); } + + private SalarySobTaxRuleWrapper getSalarySobTaxRuleWrapper(User user) { + return ServiceUtil.getService(SalarySobTaxRuleWrapper.class, user); + } + /**********************************薪资账套 start*********************************/ /** @@ -548,6 +553,40 @@ public class SalarySobController { /**********************************薪资账套的个税申报表规则 end*********************************/ + /**********************************薪资账套的个税申报表规则 start*********************************/ + + /** + * 薪资账套下的个税规则的详情 + * + * @param id 薪资账套id + * @return + */ + @GET + @Path("/taxrule/getForm") + @ApiOperation("薪资账套下的个税规则的详情") + @Produces(MediaType.APPLICATION_JSON) + public String getSalarySobTaxRuleForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSalarySobTaxRuleWrapper(user)::getForm, id); + } + + /** + * 保存薪资账套下的个税规则 + * + * @param saveParam 保存参数 + * @return + */ + @POST + @Path("/taxrule/save") + @ApiOperation("保存薪资账套下的个税规则的") + @Produces(MediaType.APPLICATION_JSON) + public String saveSalarySobTaxRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobTaxRuleSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSalarySobTaxRuleWrapper(user)::save, saveParam); + } + + /**********************************薪资账套的个税申报表规则 end*********************************/ + /**********************************调薪计薪规则 start*********************************/ diff --git a/src/com/engine/salary/wrapper/SalarySobTaxRuleWrapper.java b/src/com/engine/salary/wrapper/SalarySobTaxRuleWrapper.java new file mode 100644 index 000000000..493b2ed36 --- /dev/null +++ b/src/com/engine/salary/wrapper/SalarySobTaxRuleWrapper.java @@ -0,0 +1,45 @@ +package com.engine.salary.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.entity.salarysob.dto.SalarySobTaxRuleDTO; +import com.engine.salary.entity.salarysob.param.SalarySobTaxRuleSaveParam; +import com.engine.salary.service.SalarySobTaxRuleService; +import com.engine.salary.service.impl.SalarySobTaxRuleServiceImpl; +import weaver.hrm.User; + +import java.util.List; + +/** + * 薪资账套的个税规则 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalarySobTaxRuleWrapper extends Service { + + private SalarySobTaxRuleService getSalarySobTaxRuleService(User user) { + return ServiceUtil.getService(SalarySobTaxRuleServiceImpl.class, user); + } + + /** + * 薪资账套的个税规则 + * + * @param salarySobId + * @return + */ + public List getForm(Long salarySobId) { + return getSalarySobTaxRuleService(user).getSalarySobTaxRuleDTO(salarySobId); + } + + /** + * 保存薪资账套的个税规则 + * + * @param saveParam + */ + public void save(SalarySobTaxRuleSaveParam saveParam) { + getSalarySobTaxRuleService(user).saveByParam(saveParam); + } +}