diff --git a/src/com/engine/salary/constant/SzyhApiConstant.java b/src/com/engine/salary/constant/SzyhApiConstant.java new file mode 100644 index 000000000..1559b25de --- /dev/null +++ b/src/com/engine/salary/constant/SzyhApiConstant.java @@ -0,0 +1,167 @@ +package com.engine.salary.constant; + +/** + * 神州云合api常量 + * + * @author chengliming + * @date 2022-10-18 11:05 AM + **/ +public class SzyhApiConstant { + + /** + * 接口HOST + */ + public static final String HOST_URL = "https://ddapi.bigfintax.com/"; + + /** + * 测试接口host + */ + public static final String TEST_HOST_URL = "https://ddapi-t.bigfintax.com/"; + + /** + * 企业注册接口 + */ + public static final String GET_REGISTER_INFO_URL = "gateway/iit/declare/getCompanyRegisterInfo"; + + /** + * 校验密码接口 + */ + public static final String CHECK_PASSWORD_URL = "gateway/iit/check/checkPassword"; + + /** + * 人员专项附加扣除信息查询 + */ + public static final String QUERY_SPECIAL_AMOUNT = "gateway/iit/special/querySpecialAmount"; + + /** + * 人员专项附加扣除信息查询反馈 + */ + public static final String GET_QUERY_SPECIAL_AMOUNT_FEEDBACK = "gateway/iit/special/getQuerySpecialAmountFeedback"; + + /** + * 报送人员接口 + */ + public static final String DECLARE_EMPLOYEE_INFO = "gateway/iit/declare/declareEmployeeInfo"; + + /** + * 报送人员获取反馈接口 + */ + public static final String DECLARE_EMPLOYEE_INFO_FEEDBACK = "gateway/iit/declare/getEmployeeInfoFeedback"; + + /** + * 个税申报 + */ + public static final String DECLARE_TAX = "gateway/iit/report/send"; + + /** + * 获取个税申报反馈 + */ + public static final String DECLARE_TAX_FEEDBACK = "gateway/iit/report/getFeedback"; + + /** + * 作废申报 + */ + public static final String CANCEL_DECLARE = "gateway/iit/report/cancel"; + + /** + * 获取作废申报反馈 + */ + public static final String CANCEL_DECLARE_FEEDBACK = "gateway/iit/report/getCancelFeedback"; + + /** + * 更正申报 + */ + public static final String UPDATE_DECLARE = "/gateway/iit/report/correct"; + + /** + * 税局端申报状态查询 + */ + public static final String QUERY_DECLARE_STATUS = "/gateway/iit/report/queryDeclarationRecord"; + + /** + * 企业申报数据明细查询 + */ + public static final String QUERY_COMPANY_INCOMES = "/gateway/iit/report/getCompanyIncomes"; + + /** + * 获取流量统计情况 + */ + public static final String QUERY_ACCOUNT_BALANCE = "gateway/iit/statistic/queryAccountBalance"; + + /** + * 查询税号流量明细 + */ + public static final String QUERY_DETAILS_BY_TAX_NUMBER = "gateway/iit/statistic/queryDetailsByTaxNumber"; + + /** + * 获取企业三方信息 + */ + public static final String QUERY_AGREEMENT = "gateway/iit/payment/queryAgreement"; + + /** + * 获取企业三方信息查询反馈 + */ + public static final String GET_AGREEMENT_QUERY_FEEDBACK = "gateway/iit/payment/getAgreementQueryFeedback"; + + /** + * 三方协议缴款 + */ + public static final String DECLARE_WITH_HOLDING = "gateway/iit/payment/declareWithholding"; + + /** + * 三方协议缴款反馈 + */ + public static final String DECLARE_WITH_HOLDING_FEEDBACK = "gateway/iit/payment/getWithholdingFeedback"; + + /** + * 缴款凭证 + */ + public static final String WITHHOLDING_VOUCHER = "gateway/iit/payment/withholdingVoucher"; + + /** + * 缴款凭证反馈 + */ + public static final String WITHHOLDING_VOUCHER_FEEDBACK = "gateway/iit/payment/getWithholdingVoucherFeedback"; + + /** + * 缴款凭证作废 + */ + public static final String CANCEL_WITHHOLDING_VOUCHER = "gateway/iit/payment/cancelWithholdingVoucher"; + /** + * 完税证明 + */ + public static final String GET_WITHHELD_VOUCHER = "gateway/iit/payment/getWithheldVoucher"; + /** + * 刷新缴款状态 + */ + public static final String GET_SYNC_WITHHOLDING_FEEDBACK = "gateway/iit/payment/getSyncWithholdingFeedback"; + + + /** + * 请求成功状态码 + */ + public static final String SUCCESS_CODE = "00000000"; + + /** + * 处理中状态码 + */ + public static final String HANDLING_CODE = "000004"; + + /** + * 企业服务不可用 + */ + public static final String APP_DISABLED_CODE = "990006"; + + /** + * 企业服务已停用 + */ + public static final String APP_PAUSED_CODE = "990007"; + /** + * 错误码 + */ + public static final String ERROR_CODE = "ITGCUS0002"; + /** + * 无缴款凭证 + */ + public static final String NONE_VOUCHER_CODE = "200028"; +} diff --git a/src/com/engine/salary/entity/taxagent/response/CheckPasswordResponse.java b/src/com/engine/salary/entity/taxagent/response/CheckPasswordResponse.java new file mode 100644 index 000000000..2078bfa08 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/response/CheckPasswordResponse.java @@ -0,0 +1,21 @@ +package com.engine.salary.entity.taxagent.response; + +import lombok.Data; + +/** + * 神州云合接口返回状态实体 + * + * @author chengliming + * @date 2022-10-18 10:39 AM + **/ +@Data +public class CheckPasswordResponse { + /** + * 接口状态 + */ + private SzyhResponseHead head; + /** + * 返回数据 + */ + private boolean body; +} diff --git a/src/com/engine/salary/entity/taxagent/response/CompanyRegisterInfoResponse.java b/src/com/engine/salary/entity/taxagent/response/CompanyRegisterInfoResponse.java new file mode 100644 index 000000000..b3a2557e3 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/response/CompanyRegisterInfoResponse.java @@ -0,0 +1,66 @@ +package com.engine.salary.entity.taxagent.response; + +import lombok.Data; + +import java.util.List; + +/** + * 神州云合接口返回状态实体 + * + * @author chengliming + * @date 2022-10-18 10:39 AM + **/ +@Data +public class CompanyRegisterInfoResponse { + /** + * 接口状态 + */ + private SzyhResponseHead head; + /** + * 返回数据 + */ + private List body; + + /** + * 神州云合接口返回状态实体类 + **/ + @Data + public static class CompanyRegisterInfo { + /** + * 登记序号 + */ + private String djxhid; + /** + * 企业名称 + */ + private String qymc; + /** + * 法人姓名 + */ + private String frxm; + /** + * 联系电话 + */ + private String lxdh; + /** + * 生产经营地址 + */ + private String scjydz; + /** + * 行业名称 + */ + private String hymc; + /** + * 主管税务机关名称 + */ + private String zgswjgmc; + /** + * 主管税务分局所科名称 + */ + private String zgswjgskmc; + /** + * 是否分部门备案 + */ + private String fbmba; + } +} diff --git a/src/com/engine/salary/entity/taxagent/response/SzyhResponseHead.java b/src/com/engine/salary/entity/taxagent/response/SzyhResponseHead.java new file mode 100644 index 000000000..11b1185a0 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/response/SzyhResponseHead.java @@ -0,0 +1,26 @@ +package com.engine.salary.entity.taxagent.response; + +import lombok.Data; + +/** + * 神州云合接口返回状态实体 + * + * @author chengliming + * @date 2022-10-18 10:39 AM + **/ +@Data +public class SzyhResponseHead { + private String code; + private String desc; + private String msg; + private String time; + private String status; + + public SzyhResponseHead() { + } + + public SzyhResponseHead(String code, String msg) { + this.code = code; + this.msg = msg; + } +} diff --git a/src/com/engine/salary/entity/taxpayment/bo/TaxPaymentBO.java b/src/com/engine/salary/entity/taxpayment/bo/TaxPaymentBO.java new file mode 100644 index 000000000..c1ac514d8 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/bo/TaxPaymentBO.java @@ -0,0 +1,28 @@ +package com.engine.salary.entity.taxpayment.bo; + +import com.engine.salary.entity.taxpayment.dto.TaxWithholdingVoucherFeedbackDTO; +import com.engine.salary.entity.taxpayment.response.WithholdingVoucherFeedbackResponse; + +/** + * @author chengliming + * @date 2022-12-07 2:16 PM + **/ +public class TaxPaymentBO { + public static TaxWithholdingVoucherFeedbackDTO buildTaxWithholdingVoucherFeedbackDTO(WithholdingVoucherFeedbackResponse.Feedback synthesize) { + return TaxWithholdingVoucherFeedbackDTO.builder() + .taxDeclareCode(synthesize.getSblxdm()) + .taxDeclareName(synthesize.getSblxmc()) + .voucherNo(synthesize.getJkpzxh()) + .firstPrintDate(synthesize.getDysj()) + .taxCode(synthesize.getNsrsbh()) + .taxAgentName(synthesize.getNsrxm()) + .taxAuthoritiesNo(synthesize.getSwjgdm()) + .taxAuthoritiesName(synthesize.getSwjgmc()) + .deadline(synthesize.getXjrq()) + .lowerFormatAmount(synthesize.getXxjehj()) + .upperFormatAmount(synthesize.getDxjehj()) + .remark(synthesize.getBz()) + .printNum(synthesize.getDycs()) + .build(); + } +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementBankFormDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementBankFormDTO.java new file mode 100644 index 000000000..d2cece365 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementBankFormDTO.java @@ -0,0 +1,29 @@ +package com.engine.salary.entity.taxpayment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 查询缴费信息 + * + * @author chengliming + * @date 2022-12-27 13:25:42 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询缴费信息") +public class TaxAgreementBankFormDTO { + + + @ApiModelProperty("开户行") + private String bank; + + @ApiModelProperty("开户账号") + private String bankNo; +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFeedbackResultDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFeedbackResultDTO.java new file mode 100644 index 000000000..f7ac03735 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFeedbackResultDTO.java @@ -0,0 +1,33 @@ +package com.engine.salary.entity.taxpayment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +/** + * 获取三方查询反馈结果 + * + * @author chengliming + * @date 2022-12-06 17:25:21 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("获取三方查询反馈结果") +public class TaxAgreementFeedbackResultDTO extends TaxFeedbackResultDTO { + @ApiModelProperty("实缴金额") + private String payAmount; + + @ApiModelProperty("滞纳金等金额") + private String otherAmount; + + @ApiModelProperty("申报人数") + private String personNum; +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFormDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFormDTO.java new file mode 100644 index 000000000..233313c66 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxAgreementFormDTO.java @@ -0,0 +1,28 @@ +package com.engine.salary.entity.taxpayment.dto; + +import com.weaver.common.component.form.WeaForm; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; + +/** + * 查询缴费信息 + * + * @author chengliming + * @date 2022-12-27 13:25:42 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询缴费信息") +public class TaxAgreementFormDTO extends TaxFeedbackResultDTO { + + private WeaForm form; + + private Map count; +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxAmountFormDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxAmountFormDTO.java new file mode 100644 index 000000000..fc1f777d4 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxAmountFormDTO.java @@ -0,0 +1,58 @@ +package com.engine.salary.entity.taxpayment.dto; + +import com.weaver.common.component.form.item.WeaFormItemType; +import com.weaver.hrm.salary.annotation.SalaryForm; +import com.weaver.hrm.salary.annotation.SalaryFormItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 查询缴费信息 + * + * @author chengliming + * @date 2022-12-27 13:25:42 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询缴费信息") +public class TaxAmountFormDTO { + + @SalaryForm( + label = "个税扣缴义务人", + labelId = 86184, + labelSpan = 8, + items = { + @SalaryFormItem(itemType = WeaFormItemType.INPUT, maxLength = "50", readOnly = true) + } + ) + @ApiModelProperty("个税扣缴义务人") + private String taxAgent; + + @SalaryForm( + label = "应缴金额", + labelId = 175126, + labelSpan = 8, + items = { + @SalaryFormItem(itemType = WeaFormItemType.INPUT, maxLength = "50", readOnly = true) + } + ) + @ApiModelProperty("应缴金额") + private String amount; + + @SalaryForm( + label = "申报人数", + labelId = 175128, + labelSpan = 8, + items = { + @SalaryFormItem(itemType = WeaFormItemType.INPUT, maxLength = "50", readOnly = true) + } + ) + @ApiModelProperty("申报人数") + private String personNum; +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxFeedbackResultDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxFeedbackResultDTO.java new file mode 100644 index 000000000..845e888a9 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxFeedbackResultDTO.java @@ -0,0 +1,34 @@ +package com.engine.salary.entity.taxpayment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +/** + * 获取三方查询反馈结果 + * + * @author chengliming + * @date 2022-12-06 17:25:21 + */ +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("获取反馈结果") +public class TaxFeedbackResultDTO { + @ApiModelProperty("请求id") + private String requestId; + + @ApiModelProperty("提示语") + private String msg; + + @ApiModelProperty("处理结果") + private String result; + + @ApiModelProperty("是否结束轮询") + private Boolean finish; +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxPayTypeFormDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxPayTypeFormDTO.java new file mode 100644 index 000000000..942ef4423 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxPayTypeFormDTO.java @@ -0,0 +1,38 @@ +package com.engine.salary.entity.taxpayment.dto; + +import com.weaver.common.component.form.item.WeaFormItemType; +import com.weaver.hrm.salary.annotation.SalaryForm; +import com.weaver.hrm.salary.annotation.SalaryFormItem; +import com.weaver.hrm.salary.enums.taxdeclaration.TaxPaymentTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 查询缴费信息 + * + * @author chengliming + * @date 2022-12-27 13:25:42 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询缴费信息") +public class TaxPayTypeFormDTO { + + @SalaryForm( + label = "缴款方式", + labelId = 175127, + labelSpan = 8, + items = { + @SalaryFormItem(itemType = WeaFormItemType.RADIO, required = true, optionsEnum = TaxPaymentTypeEnum.class) + } + ) + @ApiModelProperty("缴款方式") + private String type; + +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxWithheldVoucherResultDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxWithheldVoucherResultDTO.java new file mode 100644 index 000000000..fb6cdf770 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxWithheldVoucherResultDTO.java @@ -0,0 +1,39 @@ +package com.engine.salary.entity.taxpayment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.List; + + +/** + * 获取完税证明 + * + * @author chengliming + * @date 2022-12-06 17:25:21 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("获取完税证明") +public class TaxWithheldVoucherResultDTO extends TaxFeedbackResultDTO { + @ApiModelProperty("完税证明") + private List vouchers; + + @Data + @AllArgsConstructor + public static class Voucher { + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("内容") + private String content; + } +} diff --git a/src/com/engine/salary/entity/taxpayment/dto/TaxWithholdingVoucherFeedbackDTO.java b/src/com/engine/salary/entity/taxpayment/dto/TaxWithholdingVoucherFeedbackDTO.java new file mode 100644 index 000000000..e0b38be9f --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/dto/TaxWithholdingVoucherFeedbackDTO.java @@ -0,0 +1,89 @@ +package com.engine.salary.entity.taxpayment.dto; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询缴费凭证") +public class TaxWithholdingVoucherFeedbackDTO extends TaxFeedbackResultDTO{ + /** + * 申报类型代码 + */ + private String taxDeclareCode; + /** + * 申报类型名称 + */ + private String taxDeclareName; + /** + * 缴款凭证序号 + */ + private String voucherNo; + /** + * 首次打印时间 + */ + private String firstPrintDate; + /** + * 纳税人识别号 + */ + private String taxCode; + /** + * 纳税人名称 + */ + private String taxAgentName; + /** + * 税务机关代码 + */ + private String taxAuthoritiesNo; + /** + * 税务机关名称 + */ + private String taxAuthoritiesName; + /** + * 税款限缴日期 + */ + private String deadline; + /** + * 金额合计(小写) + */ + private String lowerFormatAmount; + /** + * 金额合计(大写) + */ + private String upperFormatAmount; + /** + * 备注 + */ + private String remark; + /** + * 打印次数 + */ + private String printNum; + /** + * 缴款凭证明细列表 + */ + private List details; + + @Data + public static class Detail { + /** + * 扣款反馈代码 + */ + private String paymentCode; + /** + * 扣款名称 + */ + private String paymentItem; + /** + * 实缴税额 + */ + private String payAmount; + } +} \ No newline at end of file diff --git a/src/com/engine/salary/entity/taxpayment/param/TaxPaymentQueryParam.java b/src/com/engine/salary/entity/taxpayment/param/TaxPaymentQueryParam.java new file mode 100644 index 000000000..2b57b8a1b --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/param/TaxPaymentQueryParam.java @@ -0,0 +1,47 @@ +package com.engine.salary.entity.taxpayment.param; + +import com.weaver.hrm.salary.enums.taxdeclaration.TaxPaymentServiceTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.YearMonth; + +/** + * 查询企业三方信息 + * + * @author chengliming + * @date: 2022-12-06 17:25:28 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("查询企业三方信息") +public class TaxPaymentQueryParam { + + @ApiModelProperty("个税扣缴义务人id") + private Long taxAgentId; + + @ApiModelProperty("税款所属期") + private YearMonth taxYearMonth; + + @ApiModelProperty("个税申报记录id") + private Long taxDeclareRecordId; + + /** + * @see TaxPaymentServiceTypeEnum + */ + @ApiModelProperty("业务类型") + private Integer type; + + @ApiModelProperty("三方协议号") + private String protocolNumber; + + @ApiModelProperty("应缴税额") + private String taxAmount; + + @ApiModelProperty("是否为反馈校验 0否 1是") + private Integer checkFeedback; +} diff --git a/src/com/engine/salary/entity/taxpayment/po/TaxPaymentRequestPO.java b/src/com/engine/salary/entity/taxpayment/po/TaxPaymentRequestPO.java new file mode 100644 index 000000000..246630568 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/po/TaxPaymentRequestPO.java @@ -0,0 +1,105 @@ +package com.engine.salary.entity.taxpayment.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.weaver.common.elog.annotation.ElogTransform; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 个税辅助缴款-三方缴款请求 + * + * @author chengliming + * @date 2022-12-07 13:41:30 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("hrsa_tax_payment_request") +@ElogTransform(name = "个税辅助缴款-请求信息") +public class TaxPaymentRequestPO implements Serializable { + + private static final long serialVersionUID = -203732044881927518L; + /** + * 主键id + */ + @ElogTransform(name = "主键id") + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + @ElogTransform(name = "个税扣缴义务人的主键id") + private Long taxAgentId; + + /** + * 个税申报记录ID + */ + @ElogTransform(name = "个税申报记录id") + private Long taxDeclareRecordId; + + /** + * 税款所属期 + */ + @ElogTransform(name = "税款所属期") + private LocalDate taxYearMonth; + + /** + * 异步请求ID + */ + @ElogTransform(name = "异步请求ID") + private String requestId; + + + /** + * 请求类型 + * + * @see com.weaver.hrm.salary.enums.taxdeclaration.TaxPaymentServiceTypeEnum + */ + @ElogTransform(name = "异步请求ID") + private Integer requestType; + + /** + * 是否已获取反馈 + * + * @see com.weaver.hrm.salary.enums.salaryitem.SalaryOnOffEnum + */ + @ElogTransform(name = "是否已获取反馈") + private Integer feedback; + + /** + * 租户key + */ + @ElogTransform(name = "租户key", ignore = true) + private String tenantKey; + + /** + * 创建人id + */ + @ElogTransform(name = "创建人id", ignore = true) + private Long creator; + + /** + * 是否删除 + */ + @ElogTransform(name = "是否删除", ignore = true) + private Integer deleteType; + + /** + * 创建时间 + */ + @ElogTransform(name = "创建时间", ignore = true) + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @ElogTransform(name = "更新时间", ignore = true) + private LocalDateTime updateTime; +} diff --git a/src/com/engine/salary/entity/taxpayment/response/AgreementQueryFeedbackResponse.java b/src/com/engine/salary/entity/taxpayment/response/AgreementQueryFeedbackResponse.java new file mode 100644 index 000000000..b1766074b --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/AgreementQueryFeedbackResponse.java @@ -0,0 +1,86 @@ +package com.engine.salary.entity.taxpayment.response; + +import lombok.Data; + +import java.util.List; + +/** + * 获取企业欠费信息查询反馈结果 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +public class AgreementQueryFeedbackResponse extends BaseResponse { + /** + * 返回数据 + */ + private Body body; + + + /** + * 反馈结果body + */ + @Data + public static class Body { + /** + * 三方查询状态 0: 请求成功;1: 校验失败;2:请求失败 + */ + private String sfzt; + /** + * 失败原因 + */ + private String sbyy; + /** + * 三方列表 + */ + private List sflb; + } + + /** + * 反馈结果 + **/ + @Data + public static class Feedback { + /** + * 三方协议号 + **/ + private String sfxyh; + /** + * 银行行别代码 + **/ + private String yhhbdm; + /** + * 银行行别名称 + **/ + private String yhhbmc; + /** + * 银行营业网点代码 + **/ + private String yywddm; + /** + * 银行营业网点名称 + **/ + private String yywdmc; + /** + * 清算行行号 + **/ + private String qshhh; + /** + * 开户行行号 + **/ + private String khhhh; + /** + * 缴款帐号 + **/ + private String jkzh; + /** + * 缴款账户名称 + **/ + private String jkmc; + /** + * 税款所属税务机构代码 + **/ + private String zgswjgdm; + } +} diff --git a/src/com/engine/salary/entity/taxpayment/response/BaseResponse.java b/src/com/engine/salary/entity/taxpayment/response/BaseResponse.java new file mode 100644 index 000000000..382c546c2 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/BaseResponse.java @@ -0,0 +1,18 @@ +package com.engine.salary.entity.taxpayment.response; + +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import lombok.Data; + +/** + * 接口响应值 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +public class BaseResponse { + /** + * 接口状态 + */ + private SzyhResponseHead head; +} diff --git a/src/com/engine/salary/entity/taxpayment/response/SyncWithholdingFeedbackResponse.java b/src/com/engine/salary/entity/taxpayment/response/SyncWithholdingFeedbackResponse.java new file mode 100644 index 000000000..de5d979ee --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/SyncWithholdingFeedbackResponse.java @@ -0,0 +1,19 @@ +package com.engine.salary.entity.taxpayment.response; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 完税证明 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class SyncWithholdingFeedbackResponse extends BaseResponse { + /** + * 返回数据 + */ + private WithholdingFeedbackResponse.Feedback body; +} diff --git a/src/com/engine/salary/entity/taxpayment/response/WithheldVoucherResponse.java b/src/com/engine/salary/entity/taxpayment/response/WithheldVoucherResponse.java new file mode 100644 index 000000000..98401e525 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/WithheldVoucherResponse.java @@ -0,0 +1,61 @@ +package com.engine.salary.entity.taxpayment.response; + +import lombok.Data; + +import java.util.List; + +/** + * 完税证明 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +public class WithheldVoucherResponse extends BaseResponse { + /** + * 返回数据 + */ + private Body body; + + /** + * 反馈结果body + */ + @Data + public static class Body { + /** + * 综合所得 + **/ + private Feedback zhsd; + /** + * 分类所得 + **/ + private Feedback flsd; + /** + * 非居民所得 + **/ + private Feedback fjmsd; + /** + * 限售股所得 + **/ + private Feedback xsgsd; + } + + /** + * 反馈结果 + **/ + @Data + public static class Feedback { + /** + * 缴款反馈状态 0成功 1失败 + */ + private String jkzt; + /** + * 扣款失败原因 + */ + private String jksbyy; + /** + * 完税证明列表 + */ + private List wszmlb; + } +} diff --git a/src/com/engine/salary/entity/taxpayment/response/WithholdingFeedbackResponse.java b/src/com/engine/salary/entity/taxpayment/response/WithholdingFeedbackResponse.java new file mode 100644 index 000000000..de1f72221 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/WithholdingFeedbackResponse.java @@ -0,0 +1,85 @@ +package com.engine.salary.entity.taxpayment.response; + +import lombok.Data; + +import java.util.List; + +/** + * 三方协议缴款反馈 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +public class WithholdingFeedbackResponse extends BaseResponse { + + /** + * 返回数据 + */ + private Body body; + + /** + * 反馈结果body + */ + @Data + public static class Body { + /** + * 综合所得 + **/ + private Feedback zhsdjk; + /** + * 分类所得 + **/ + private Feedback flsdjk; + /** + * 非居民所得 + **/ + private Feedback fjmsdjk; + /** + * 限售股所得 + **/ + private Feedback xsgsdjk; + } + + /** + * 反馈结果 + **/ + @Data + public static class Feedback { + /** + * 申报状态 + **/ + private String sbzt; + + /** + * 扣款状态 0:扣款成功:1:信息校验失败;2:无欠费记录;3:扣款失败 + **/ + private String jkzt; + + /** + * 扣款失败原因 + **/ + private String jksbyy; + + /** + * 扣款详情列表 + **/ + private List kkfhlb; + } + + @Data + public static class Detail { + /** + * 扣款反馈代码 + */ + private String kkfhDm; + /** + * 扣款名称 + */ + private String kkfhmc; + /** + * 实缴税额 + */ + private String sjse; + } +} diff --git a/src/com/engine/salary/entity/taxpayment/response/WithholdingVoucherFeedbackResponse.java b/src/com/engine/salary/entity/taxpayment/response/WithholdingVoucherFeedbackResponse.java new file mode 100644 index 000000000..e49c10f80 --- /dev/null +++ b/src/com/engine/salary/entity/taxpayment/response/WithholdingVoucherFeedbackResponse.java @@ -0,0 +1,129 @@ +package com.engine.salary.entity.taxpayment.response; + +import lombok.Data; + +import java.util.List; + +/** + * 缴款凭证反馈 + * + * @author chengliming + * @date 2022-12-06 17:25:32 + **/ +@Data +public class WithholdingVoucherFeedbackResponse extends BaseResponse { + /** + * 返回数据 + */ + private Body body; + + /** + * 反馈结果body + */ + @Data + public static class Body { + /** + * 综合所得 + **/ + private Feedback zhsd; + /** + * 分类所得 + **/ + private Feedback flsd; + /** + * 非居民所得 + **/ + private Feedback fjmsd; + /** + * 限售股所得 + **/ + private Feedback xsgsd; + } + + /** + * 反馈结果 + **/ + @Data + public static class Feedback { + /** + * 申报类型代码 + */ + private String sblxdm; + /** + * 申报类型名称 + */ + private String sblxmc; + /** + * 缴款凭证序号 + */ + private String jkpzxh; + /** + * 首次打印时间 + */ + private String dysj; + /** + * 纳税人识别号 + */ + private String nsrsbh; + /** + * 纳税人名称 + */ + private String nsrxm; + /** + * 税务机关代码 + */ + private String swjgdm; + /** + * 税务机关名称 + */ + private String swjgmc; + /** + * 税款限缴日期 + */ + private String xjrq; + /** + * 金额合计(小写) + */ + private String xxjehj; + /** + * 金额合计(大写) + */ + private String dxjehj; + /** + * 备注 + */ + private String bz; + /** + * 打印次数 + */ + private String dycs; + /** + * 缴款凭证明细列表 + */ + private List jkpzmxlb; + /** + * 反馈状态 0:成功 1:失败 + */ + private String fkzt; + /** + * 反馈描述 + */ + private String fkms; + } + + @Data + public static class Detail { + /** + * 扣款反馈代码 + */ + private String zsxmmc; + /** + * 扣款名称 + */ + private String zspmmc; + /** + * 实缴税额 + */ + private String yjse; + } +} diff --git a/src/com/engine/salary/util/HttpUtil.java b/src/com/engine/salary/util/HttpUtil.java new file mode 100644 index 000000000..6f99cf590 --- /dev/null +++ b/src/com/engine/salary/util/HttpUtil.java @@ -0,0 +1,249 @@ +package com.engine.salary.util; + + +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import com.engine.salary.entity.taxpayment.response.BaseResponse; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.AuthSchemes; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.util.EntityUtils; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +/** + * Http调用处理类 + * + * @author Terry + */ +@Slf4j +public class HttpUtil { + + public static final String TEXT_TYPE = "text/plain"; + public static final String JSON_TYPE = "application/json"; + public static final String XML_TYPE = "text/xml"; + public static final String HTML_TYPE = "text/html"; + + public static final String EXCEL_TYPE = "application/vnd.ms-excel"; + public static final String STREAM_TYPE = "application/octet-stream"; + public static final int SLEEP_TIME = 1000; + public static final int IAS_SUCCESS = 400; + + public static HttpClient httpsTrustClient() { + try { + // 在调用SSL之前需要重写验证方法,取消检测SSL + X509TrustManager trustManager = new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] xcs, String str) { + } + + @Override + public void checkServerTrusted(X509Certificate[] xcs, String str) { + } + }; + SSLContext ctx = SSLContext.getInstance(SSLConnectionSocketFactory.TLS); + ctx.init(null, new TrustManager[]{trustManager}, null); + SSLConnectionSocketFactory socketFactory = + new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE); + // 创建Registry + RequestConfig requestConfig = + RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD_STRICT).setExpectContinueEnabled(Boolean.TRUE) + .setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.NTLM, AuthSchemes.DIGEST)) + .setProxyPreferredAuthSchemes(Collections.singletonList(AuthSchemes.BASIC)).build(); + Registry socketFactoryRegistry = RegistryBuilder.create() + .register("http", PlainConnectionSocketFactory.INSTANCE).register("https", socketFactory).build(); + // 创建ConnectionManager,添加Connection配置信息 + PoolingHttpClientConnectionManager connectionManager = + new PoolingHttpClientConnectionManager(socketFactoryRegistry); + + return HttpClients.custom().setConnectionManager(connectionManager) + .setDefaultRequestConfig(requestConfig).build(); + } catch (KeyManagementException | NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } + + /** + * 获取 HttpClient + * + * @param path + * @return + */ + public static HttpClient wrapClient(String path) { + HttpClient httpClient = HttpClientBuilder.create().build(); + if (path != null && path.startsWith("https://")) { + return httpsTrustClient(); + } + return httpClient; + } + + /** + * 设置http超时时间 + * + * @param requestConfig + * @return + */ + private static RequestConfig setTimeOutConfig(RequestConfig requestConfig) { + if (requestConfig == null) { + requestConfig = RequestConfig.DEFAULT; + } + return RequestConfig.copy(requestConfig).setConnectionRequestTimeout(900000).setConnectTimeout(900000) + .setSocketTimeout(900000).build(); + } + + /** + * get 请求 + * + * @param url + * @param header + * @param params + * @return + */ + public static String getRequest(String url, Map header, Map params) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + String result = ""; + + StringBuilder urlStr = new StringBuilder(); + urlStr.append(url).append("?"); + + int i = params.size(); + for (Map.Entry map : params.entrySet()) { + urlStr.append(map.getKey()).append("=").append(map.getValue()); + if ((--i) == 0) { + continue; + } + urlStr.append("&"); + } + try { + httpClient = (CloseableHttpClient) wrapClient(url); + HttpGet httpGet = new HttpGet(urlStr.toString()); + if (null != header && !header.isEmpty()) { + for (String key : header.keySet()) { + httpGet.setHeader(key, header.get(key)); + } + } + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(20000) + .setConnectionRequestTimeout(20000).setSocketTimeout(40000).build(); + httpGet.setConfig(requestConfig); + response = httpClient.execute(httpGet); + HttpEntity entity = response.getEntity(); + result = EntityUtils.toString(entity); + httpGet.abort(); + EntityUtils.consume(entity); + } catch (IOException e) { + log.error("发起GET请求失败", e); + result = getTimeoutErrorResponse(result, e); + } finally { + if (null != response) { + try { + httpClient.close(); + response.close(); + } catch (IOException e) { + log.error("发起GET请求失败", e); + } + } + + if (null != httpClient) { + try { + httpClient.close(); + } catch (IOException e) { + log.error("发起GET请求失败", e); + } + } + } + return result; + } + + /** + * HTTP Post 获取内容 + * + * @param url 请求的url地址 ?之前的地址 + * @param params 请求的参数 + * @param header 编码格式 + * @return 页面内容 + */ + public static String doPost(String url, Map header, String params, String contentType) { + String result = null; + try { + HttpPost httpPost = new HttpPost(url); + httpPost.setHeader("Connection", "close"); + httpPost.setConfig(setTimeOutConfig(httpPost.getConfig())); + httpPost.setHeader("Content-Type", contentType); + if (null != header && !header.isEmpty()) { + for (String key : header.keySet()) { + httpPost.setHeader(key, header.get(key)); + } + } + if (null != params) { + httpPost.setEntity(new StringEntity(params, Consts.UTF_8)); + } + HttpClient httpClient = wrapClient(url); + HttpResponse response = httpClient.execute(httpPost); + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode != 200) { + httpPost.abort(); + throw new RuntimeException("HttpClient,error status code :" + statusCode); + } + HttpEntity entity = response.getEntity(); + if (entity != null) { + result = EntityUtils.toString(entity, Consts.UTF_8); + } + EntityUtils.consume(entity); + httpPost.abort(); + return result; + } catch (Exception e) { + log.error("发起POST请求失败", e); + result = getTimeoutErrorResponse(result, e); + } + return result; + } + + private static String getTimeoutErrorResponse(String result, Exception e) { + if (e instanceof ConnectTimeoutException) { + BaseResponse baseResponse = new BaseResponse(); + SzyhResponseHead head = new SzyhResponseHead(); + head.setCode("-1"); + head.setMsg(SalaryI18nUtil.getI18nLabel(184072, "抱歉,系统因网络原因无法访问税局个税系统,此功能暂时无法使用,请确保网络情况正常且允许访问外网")); + head.setDesc("失败"); + head.setStatus("N"); + baseResponse.setHead(head); + result = JsonUtil.toJsonString(baseResponse); + } + return result; + } +}