diff --git a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java index 050eec5..0c90291 100644 --- a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java +++ b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java @@ -415,7 +415,17 @@ public class InvoiceController { IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "deprecate"); - HXResponse result = preHandleDecryptResult(decryptResult, "deprecate", companyservice); +// HXResponse result = preHandleDecryptResult(decryptResult, "deprecate", companyservice); + // 调用预处理 + if (decryptResult == null) { + throw new JianshuiParamErrorException(ErrorCode.ERROR_PARAMS, companyservice, "invoice"); + } + // 获得请求实例,并且进行扣费 + String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); + serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); + IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); + decryptResult.put("service_supplier_key", serviceKey); + HXResponse result = invoiceService.deprecateInvoice(decryptResult, companyservice); String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey); @@ -445,7 +455,17 @@ public class InvoiceController { IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "deprecate_query"); - HXResponse result = preHandleDecryptResult(decryptResult, "deprecate_query", companyservice); +// HXResponse result = preHandleDecryptResult(decryptResult, "deprecate_query", companyservice); + if (decryptResult == null) { + throw new JianshuiParamErrorException(ErrorCode.ERROR_PARAMS, companyservice, "invoice"); + } + DeprecateQueryInvoiceDTO deprecateQueryInvoiceDTO = decryptResult.toJavaObject(DeprecateQueryInvoiceDTO.class); + // 获得请求实例,并且进行扣费 + String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); + serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); + IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); + HXResponse result = invoiceService.deprecateQueryInvoice(deprecateQueryInvoiceDTO, companyservice); + String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey); @@ -562,7 +582,21 @@ public class InvoiceController { IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "push"); - HXResponse result = preHandleDecryptResult(decryptResult, "push", companyservice); +// HXResponse result = preHandleDecryptResult(decryptResult, "push", companyservice); + + // 接口预处理 + BillInfo billInfo = decryptResult.toJavaObject(BillInfo.class); + if (billInfo == null) { + throw new JianshuiParamErrorException(ErrorCode.ERROR_PARAMS, companyservice, "invoice"); + } + billInfo.setSource("2"); + // 获得请求实例,并且进行扣费 + String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); + serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); + billInfo.setServiceSupplierKey(serviceKey); + IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); + HXResponse result = invoiceService.pushData(billInfo, companyservice); + String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey); diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java index ccb12d6..efa0814 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java @@ -57,8 +57,8 @@ public class ElephantConstantsV6 { public static String REDINFO_FIND_METHOD = "GetRedInvoiceApplication"; // 发票作废 - public static String DEPRECATE_INVOICE = "order-api/order-api/V6/DeprecateInvoices"; - public static String DEPRECATE_INVOICE_LOCALHOST = "/invoice/api/V6/DeprecateInvoices"; + public static String DEPRECATE_INVOICE = "order-api/order-api/V5/DeprecateInvoices"; + public static String DEPRECATE_INVOICE_LOCALHOST = "/invoice/api/V5/DeprecateInvoices"; public static String DEPRECATE_INVOICE_METHOD = "DeprecateInvoices"; // 发票作废结果查询