更正申报
This commit is contained in:
parent
de257568f1
commit
65fcfb8fac
|
|
@ -3,3 +3,59 @@ INSERT INTO hrsa_tax_report_column(id, create_time, update_time, creator, delete
|
|||
INSERT INTO hrsa_tax_report_column(id, create_time, update_time, creator, delete_type, tenant_key, tax_report_type, income_category, report_column_name, report_column_data_index, data_type, request_param_key, report_column_label, contrast_type) VALUES (700000000000000003, NULL, NULL, NULL, 0, 'all_teams', '1', '700', '其他', 'royaltiesOther', 'number', 'qt', NULL, 0);
|
||||
INSERT INTO hrsa_tax_report_column(id, create_time, update_time, creator, delete_type, tenant_key, tax_report_type, income_category, report_column_name, report_column_data_index, data_type, request_param_key, report_column_label, contrast_type) VALUES (700000000000000004, NULL, NULL, NULL, 0, 'all_teams', '1', '700', '备注', 'royaltiesRemark', 'string', 'bz', NULL, 0);
|
||||
INSERT INTO hrsa_tax_report_column(id, create_time, update_time, creator, delete_type, tenant_key, tax_report_type, income_category, report_column_name, report_column_data_index, data_type, request_param_key, report_column_label, contrast_type) VALUES (700000000000000005, NULL, NULL, NULL, 0, 'all_teams', '1', '700', '减免税额', 'royaltiesTaxDeduction', 'number', 'jmse', NULL, 0);
|
||||
|
||||
|
||||
CREATE TABLE hrsa_api_task_record (
|
||||
id bigint(0) NOT NULL ,
|
||||
source varchar(500) ,
|
||||
api varchar(500),
|
||||
param text ,
|
||||
response text,
|
||||
tenant_key varchar(255) ,
|
||||
delete_type int(0) ,
|
||||
create_time datetime(0),
|
||||
update_time datetime(0),
|
||||
PRIMARY KEY (id) USING BTREE
|
||||
);
|
||||
|
||||
create table hrsa_api_task_record
|
||||
(
|
||||
id number primary key ,
|
||||
source varchar2(500) ,
|
||||
api varchar2(500),
|
||||
param clob ,
|
||||
response clob,
|
||||
create_time date,
|
||||
update_time date,
|
||||
delete_type int default 0,
|
||||
tenant_key varchar2(10)
|
||||
)
|
||||
/
|
||||
|
||||
create table hrsa_api_task_record
|
||||
(
|
||||
id bigint primary key ,
|
||||
source varchar(500) ,
|
||||
api varchar(500),
|
||||
param ntext ,
|
||||
response ntext,
|
||||
create_time datetime,
|
||||
update_time datetime,
|
||||
delete_type int default 0,
|
||||
tenant_key nvarchar(10)
|
||||
)
|
||||
GO
|
||||
|
||||
create table hrsa_api_task_record
|
||||
(
|
||||
id bigint primary key ,
|
||||
source varchar(500) ,
|
||||
api varchar(500),
|
||||
param text ,
|
||||
response text,
|
||||
create_time timestamp,
|
||||
update_time timestamp,
|
||||
delete_type int default 0,
|
||||
tenant_key varchar(10)
|
||||
);
|
||||
/
|
||||
|
|
@ -139,7 +139,13 @@ public class SzyhApiConstant {
|
|||
/**
|
||||
* 缴款凭证作废
|
||||
*/
|
||||
public static final String CANCEL_WITHHOLDING_VOUCHER = "gateway/iit/payment/cancelWithholdingVoucher";
|
||||
// public static final String CANCEL_WITHHOLDING_VOUCHER = "gateway/iit/payment/cancelWithholdingVoucher";
|
||||
public static final String CANCEL_WITHHOLDING_VOUCHER = "gateway/iit/service/cancelWithholdingVoucher";
|
||||
|
||||
/**
|
||||
* 缴款凭证作废反馈
|
||||
*/
|
||||
public static final String CANCEL_WITHHOLDING_VOUCHER_FEEDBACK = "gateway/iit/service/getCancelWithholdingVoucher";
|
||||
/**
|
||||
* 完税证明
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.entity.taxdeclaration.response;
|
||||
|
||||
import com.engine.salary.entity.taxagent.response.SzyhResponseHead;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import com.engine.salary.entity.taxpayment.response.BaseResponse;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -13,9 +12,5 @@ import lombok.Data;
|
|||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@ApiModel("更正申报的返回数据")
|
||||
public class UpdateDeclareResponse {
|
||||
|
||||
//接口状态")
|
||||
private SzyhResponseHead head;
|
||||
public class UpdateDeclareResponse extends BaseResponse {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.engine.salary.constant.SzyhApiConstant;
|
|||
import com.engine.salary.entity.taxagent.response.CheckPasswordResponse;
|
||||
import com.engine.salary.entity.taxagent.response.CompanyRegisterInfoResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -13,8 +12,8 @@ import java.util.Map;
|
|||
public class CompanyClient extends TaxBaseClient {
|
||||
|
||||
|
||||
public CompanyClient(Long taxAgentId, User user) {
|
||||
super(taxAgentId, user);
|
||||
public CompanyClient(Long taxAgentId) {
|
||||
super(taxAgentId);
|
||||
}
|
||||
|
||||
public CompanyRegisterInfoResponse getCompanyRegisterInfo(Map<String, Object> requestParam) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
package com.engine.salary.remote.tax.client;
|
||||
|
||||
import com.engine.salary.constant.SzyhApiConstant;
|
||||
import com.engine.salary.entity.taxdeclaration.response.UpdateDeclareResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 个税申报客户端
|
||||
* <p>Copyright: Copyright (c) 2023</p>
|
||||
|
|
@ -17,4 +22,18 @@ public class DeclareClient extends TaxBaseClient{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更正申报
|
||||
* @param requestParam
|
||||
*/
|
||||
public UpdateDeclareResponse correct(Map<String, Object> requestParam){
|
||||
String url = apiConfig.getHost() + SzyhApiConstant.UPDATE_DECLARE;
|
||||
String requestId = request(url, requestParam);
|
||||
String feedbackUrl = apiConfig.getHost() + SzyhApiConstant.UPDATE_DECLARE_FEEDBACK;
|
||||
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
map.put("requestId", requestId);
|
||||
return response(feedbackUrl, map, UpdateDeclareResponse.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
package com.engine.salary.remote.tax.client;
|
||||
|
||||
import com.engine.salary.constant.SzyhApiConstant;
|
||||
import com.engine.salary.remote.tax.response.RequestIdResponse;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO;
|
||||
import com.engine.salary.entity.taxpayment.response.BaseResponse;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.taxagent.TaxAgentTaxReturnMapper;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclareApiConfigMapper;
|
||||
import com.engine.salary.remote.tax.response.RequestIdResponse;
|
||||
import com.engine.salary.util.*;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -23,16 +22,16 @@ public class TaxBaseClient {
|
|||
return MapperProxyFactory.getProxy(TaxDeclareApiConfigMapper.class);
|
||||
}
|
||||
|
||||
|
||||
private TaxAgentTaxReturnMapper getTaxAgentTaxReturnMapper() {
|
||||
return MapperProxyFactory.getProxy(TaxAgentTaxReturnMapper.class);
|
||||
}
|
||||
|
||||
public Long taxAgentId;
|
||||
public User user;
|
||||
public TaxDeclarationApiConfigPO apiConfig;
|
||||
public TaxAgentTaxReturnPO returnPO;
|
||||
|
||||
public static final int threshold = 600;
|
||||
|
||||
public TaxBaseClient(Long taxAgentId) {
|
||||
this.taxAgentId = taxAgentId;
|
||||
this.apiConfig = getTaxDeclareApiConfigMapper().getOne();
|
||||
|
|
@ -46,20 +45,6 @@ public class TaxBaseClient {
|
|||
this.returnPO = taxReturnPO;
|
||||
}
|
||||
|
||||
public TaxBaseClient(Long taxAgentId, User user) {
|
||||
this.taxAgentId = taxAgentId;
|
||||
this.apiConfig = getTaxDeclareApiConfigMapper().getOne();
|
||||
TaxAgentTaxReturnPO taxReturnPO = getTaxAgentTaxReturnMapper().selectOneByTaxAgentId(taxAgentId);
|
||||
try {
|
||||
// 密码解密
|
||||
taxReturnPO.setPwd(Sm4Utils.decryptEcb(apiConfig.getAppSecret(), taxReturnPO.getPwd()));
|
||||
} catch (Exception e) {
|
||||
log.error("Sm4Utils.decryptEcb ---- error: {}", e.getMessage());
|
||||
}
|
||||
this.returnPO = taxReturnPO;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String request(String url, Map<String, Object> requestParam) {
|
||||
String reqJson = JsonUtil.toJsonString(requestParam);
|
||||
Map<String, String> header = SingnatureData.initHeader(new HashMap<>(1), apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
|
|
@ -82,22 +67,33 @@ public class TaxBaseClient {
|
|||
public <T extends BaseResponse> T response(String url, Map<String, String> param, Class<T> clazz) {
|
||||
TaskUtil taskUtil = new TaskUtil();
|
||||
T response = null;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i <= threshold; ++i) {
|
||||
Map<String, String> header = SingnatureData.initHeader(new HashMap<>(1), apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
String res = HttpUtil.getRequest(url, header, param);
|
||||
response = JsonUtil.parseBean(res, clazz);
|
||||
//记录接口
|
||||
taskUtil.writeApiTaskRecord(Util.null2String(taxAgentId), url, JsonUtil.toJsonString(param), res);
|
||||
if (response == null || response.getHead() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试"));
|
||||
}
|
||||
// 如果税友返回错误信息
|
||||
String code = response.getHead().getCode();
|
||||
if (SzyhApiConstant.HANDLING_CODE.equals(code)) {
|
||||
//进行中的任务,重试
|
||||
try {
|
||||
Thread.sleep(5 * 1000);
|
||||
Thread.sleep(6 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
} else {
|
||||
if (threshold == i) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "未在预期时间内完成任务,请稍后重试!阀值:" + threshold));
|
||||
}
|
||||
} else if (SzyhApiConstant.SUCCESS_CODE.equals(response.getHead().getCode())) {
|
||||
//成功的任务,返回结果
|
||||
break;
|
||||
} else {
|
||||
//错误任务,提示
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, response.getHead().getMsg()));
|
||||
}
|
||||
}
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public abstract class AbstractTaxAgentTaxReturnCheckService extends Service impl
|
|||
requestParam.put("djxhid", saveParam.getTaxRegistrationNumber());
|
||||
}
|
||||
|
||||
return new CompanyClient(taxAgentId, user).getCompanyRegisterInfo(requestParam);
|
||||
return new CompanyClient(taxAgentId).getCompanyRegisterInfo(requestParam);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ public abstract class AbstractTaxAgentTaxReturnCheckService extends Service impl
|
|||
requestParam.put("bmmc", saveParam.getDepartmentName());
|
||||
}
|
||||
|
||||
return new CompanyClient(taxAgentId, user).checkPassword(requestParam);
|
||||
return new CompanyClient(taxAgentId).checkPassword(requestParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO;
|
|||
import com.engine.salary.entity.taxagent.bo.TaxAgentTaxReturnBO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO;
|
||||
import com.engine.salary.remote.tax.response.RequestIdResponse;
|
||||
import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
|
||||
import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
|
||||
import com.engine.salary.entity.taxdeclaration.bo.*;
|
||||
|
|
@ -46,6 +45,7 @@ import com.engine.salary.enums.taxdeclaration.*;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclareStatusMapper;
|
||||
import com.engine.salary.remote.tax.client.DeclareClient;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
|
||||
import com.engine.salary.util.*;
|
||||
|
|
@ -1009,41 +1009,8 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
|
|||
// 申报类型
|
||||
requestParam.put("sblx", reportType + "");
|
||||
|
||||
|
||||
|
||||
// 请求
|
||||
String reqJson = JsonUtil.toJsonString(requestParam);
|
||||
|
||||
String url = apiConfig.getHost() + SzyhApiConstant.UPDATE_DECLARE;
|
||||
Map<String, String> params = new HashMap<>(1);
|
||||
Map<String, String> header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE);
|
||||
RequestIdResponse getRequestIdResponse = JsonUtil.parseObject(res, RequestIdResponse.class);
|
||||
log.info("更正申报请求数据1:=== params:{} ,getRequestIdResponse:{}", res, getRequestIdResponse);
|
||||
|
||||
|
||||
if (Objects.isNull(getRequestIdResponse) || Objects.isNull(getRequestIdResponse.getHead())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "服务异常"));
|
||||
}
|
||||
if (!Objects.equals(getRequestIdResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE) || getRequestIdResponse.getBody() == null) {
|
||||
throw new SalaryRunTimeException(getRequestIdResponse.getHead().getMsg());
|
||||
}
|
||||
|
||||
String feedbackUrl = apiConfig.getHost() + SzyhApiConstant.UPDATE_DECLARE_FEEDBACK;
|
||||
Map<String, String> feedbackHeader = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
String requestId = getRequestIdResponse.getBody().getRequestId();
|
||||
map.put("requestId", requestId);
|
||||
res = HttpUtil.getRequest(feedbackUrl, feedbackHeader, map);
|
||||
log.info("更正申报请求数据2: === requestId :{} === res : {}", requestId, res);
|
||||
|
||||
UpdateDeclareResponse updateDeclareResponse = JsonUtil.parseObject(res, UpdateDeclareResponse.class);
|
||||
if (Objects.isNull(updateDeclareResponse) || Objects.isNull(updateDeclareResponse.getHead())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "服务异常"));
|
||||
}
|
||||
if (!Objects.equals(updateDeclareResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE)) {
|
||||
throw new SalaryRunTimeException(updateDeclareResponse.getHead().getMsg());
|
||||
}
|
||||
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
|
||||
declareClient.correct(requestParam);
|
||||
|
||||
//更新申报状态
|
||||
declareStatus.setTaxDeclareType(TaxDeclareTypeEnum.UPDATE_DECLARE.getValue());
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.taxpayment.dto.TaxAmountFormDTO;
|
||||
import com.engine.salary.entity.taxpayment.dto.TaxFeedbackResultDTO;
|
||||
import com.engine.salary.entity.taxpayment.dto.TaxWithheldVoucherResultDTO;
|
||||
import com.engine.salary.entity.taxpayment.param.TaxPaymentQueryParam;
|
||||
import com.engine.salary.enums.taxdeclaration.TaxPaymentServiceTypeEnum;
|
||||
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
|
||||
import com.engine.salary.service.impl.TaxPaymentAgreementServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxPaymentWithheldVoucherServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxPaymentWithholdingServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxPaymentWithholdingVoucherServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
|
|
@ -22,15 +26,15 @@ public class TaxPaymentWrapper extends Service {
|
|||
private final TaxPaymentServiceFactory taxPaymentServiceFactory = new TaxPaymentServiceFactory(user);
|
||||
|
||||
public TaxFeedbackResultDTO getAgreementFeedback(TaxPaymentQueryParam param) {
|
||||
return taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.QUERY_AGREEMENT.getValue()).getFeedback(param);
|
||||
return ServiceUtil.getService(TaxPaymentAgreementServiceImpl.class, user).getFeedback(param);
|
||||
}
|
||||
|
||||
public TaxFeedbackResultDTO payAgreementFeedback(TaxPaymentQueryParam param) {
|
||||
return taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_PAY.getValue()).getFeedback(param);
|
||||
return ServiceUtil.getService(TaxPaymentWithholdingServiceImpl.class, user).getFeedback(param);
|
||||
}
|
||||
|
||||
public TaxFeedbackResultDTO printVoucherFeedback(TaxPaymentQueryParam param) {
|
||||
return taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_VOUCHER.getValue()).getFeedback(param);
|
||||
return ServiceUtil.getService(TaxPaymentWithholdingVoucherServiceImpl.class, user).getFeedback(param);
|
||||
}
|
||||
|
||||
public String getRequestId(TaxPaymentQueryParam param) {
|
||||
|
|
@ -38,18 +42,18 @@ public class TaxPaymentWrapper extends Service {
|
|||
}
|
||||
|
||||
public TaxAmountFormDTO queryTaxAmount(TaxPaymentQueryParam param) {
|
||||
return taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.QUERY_AGREEMENT.getValue()).queryTaxAmount(param);
|
||||
return ServiceUtil.getService(TaxPaymentAgreementServiceImpl.class, user).queryTaxAmount(param);
|
||||
}
|
||||
|
||||
public TaxWithheldVoucherResultDTO getWithheldVoucher(TaxPaymentQueryParam param) {
|
||||
return taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHELD_VOUCHER.getValue()).getWithheldVoucher(param);
|
||||
return ServiceUtil.getService(TaxPaymentWithheldVoucherServiceImpl.class, user).getWithheldVoucher(param);
|
||||
}
|
||||
|
||||
public void getSyncWithholdingFeedback(TaxPaymentQueryParam param) {
|
||||
taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_VOUCHER.getValue()).syncWithholdingFeedback(param);
|
||||
ServiceUtil.getService(TaxPaymentWithholdingVoucherServiceImpl.class, user).syncWithholdingFeedback(param);
|
||||
}
|
||||
|
||||
public void cancelVoucher(TaxPaymentQueryParam param) {
|
||||
taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_VOUCHER.getValue()).cancelWithholdingVoucher(param);
|
||||
ServiceUtil.getService(TaxPaymentWithholdingVoucherServiceImpl.class, user).cancelWithholdingVoucher(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue