From f2bc86464dadee17027873d8cc96f27988ee9084 Mon Sep 17 00:00:00 2001 From: kk <1910333201@qq.com> Date: Wed, 20 Sep 2023 09:47:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?V6=E6=8E=A5=E5=8F=A3=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elephant/ElephantConstantsV6.java | 99 +++++++++++++++++++ .../api/ElephantInvoiceApiV6ServiceImpl.java | 46 ++++----- 2 files changed, 122 insertions(+), 23 deletions(-) create mode 100644 jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java 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 new file mode 100644 index 0000000..ccb12d6 --- /dev/null +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/constant/elephant/ElephantConstantsV6.java @@ -0,0 +1,99 @@ +package com.jianshui.invoice.constant.elephant; + +/** + * @Description 大象常量 + * @Author 巩权林 + * @Date 2022-03-24 11:33 + **/ +public class ElephantConstantsV6 { + + // token redis key + public static String TOKEN_REDIS_KEY = "elephant_invoice_token"; + + // 测试的域名 + public static String DEV_HOST = "https://sandbox.zncspt.com/api/"; + public static String DEV_ELECLOUD_HOST = "https://sandbox.ele-cloud.com/api/"; + public static String DEV_HOST_LOCAL = "http://140.143.226.17:8087/order-api"; + public static String DEV_HOST_LOCAL_V6_JingDongYun = "https://js.ele12.com/order-api"; + + // 生产的域名 + public static String PROD_HOST = "https://openapi.zncspt.com/api/"; + + public static String PROD_ELECLOUD_HOST = "https://openapi.ele-cloud.com/api/"; + + public static String PROD_HOST_LOCAL = "http://140.143.226.17:8087/order-api"; + public static String PROD_HOST_LOCAL_V6_JingDongYun = "https://js.ele12.com/order-api"; + + // 测试的获取token的域名 + public static String DEV_TOKEN_HOST = "https://sandbox.zncspt.com/api/authen/token"; + // 生产的获取token的域名 + public static String PROD_TOKEN_HOST = "https://openapi.zncspt.com/api/authen/token"; + + // 发票开具冲红 + public static String ADD_INVOICE = "order-api/order-api/V6/AllocateInvoices"; + public static String ADD_INVOICE_LOCALHOST = "/invoice/api/V6/AllocateInvoices"; + public static String ADD_INVOICE_METHOD = "AllocateInvoices"; + + // 发票开票结果拉取 + public static String ADD_INVOICE_RESULT = "order-api/order-api/V6/GetAllocatedInvoices"; + public static String ADD_INVOICE_RESULT_LOCALHOST = "/invoice/api/V6/GetAllocatedInvoices"; + public static String ADD_INVOICE_RESULT_METHOD = "GetAllocatedInvoices"; + + // 发票详情拉取 + public static String QUERY_INVOICE = "order-api/order-api/V6/GetOrderInfoAndInvoiceInfo"; + public static String QUERY_INVOICE_LOCALHOST = "/invoice/api/V6/GetOrderInfoAndInvoiceInfo"; + public static String QUERY_INVOICE_METHOD = "GetOrderInfoAndInvoiceInfo"; + + + // 红字信息表上传 + public static String REDINFO_UPLOAD = "order-api/order-api/V6/AllocateRedInvoiceApplication"; + public static String REDINFO_UPLOAD_LOCALHOST = "/invoice/api/V6/AllocateRedInvoiceApplication"; + public static String REDINFO_UPLOAD_METHOD = "AllocateRedInvoiceApplication"; + + public static String REDINFO_DOWNLOAD = "order-api/order-api/V6/DownloadRedInvoiceApplicationResult"; + public static String REDINFO_DOWNLOAD_LOCALHOST = "/invoice/api/V6/DownloadRedInvoiceApplicationResult"; + public static String REDINFO_DOWNLOAD_METHOD = "DownloadRedInvoiceApplicationResult"; + public static String REDINFO_FIND_LOCALHOST = "/invoice/api/v6/GetRedInvoiceApplication"; + 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_METHOD = "DeprecateInvoices"; + + // 发票作废结果查询 + public static String DEPRECATE_INVOICE_RESULT = "order-api/order-api/V6//QueryInvalidInvoice"; + public static String DEPRECATE_INVOICE_RESULT_LOCALHOST = "/invoice/api/V6//QueryInvalidInvoice"; + public static String DEPRECATE_INVOICE_RESULT_METHOD = "order-api/order-api/V6//QueryInvalidInvoice"; + + // 打印机查询 + public static String QUERY_PRINTER = ""; + public static String QUERY_PRINTER_LOCALHOST = "/invoice/api/V6/QueryPrinter"; + public static String QUERY_PRINTER_METHOD = "QueryPrinter"; + + // 批量打印 + public static String BATCH_PRINT = ""; + public static String BATCH_PRINT_LOCALHOST = "/invoice/api/V6/PrintInvoice"; + public static String BATCH_PRINT_METHOD = "PrintInvoice"; + + + // 发票余量查询接口 + public static String QUERY_INVOICE_STORE = "order-api/order-api/V6/QueryInvoiceStore"; + + + /** + * 发票专用章生成 + */ + public static String SIGN_CREATE = "eseal/v1/create"; + + /** + * 发票专用章导入注册 + */ + public static String SIGN_REGISTER = "eseal/v1/register"; + + /** + * 发票签章 + */ + public static String SIGN = "eseal/v1/sign"; + +} diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java index 45bba75..d45af4d 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java @@ -21,7 +21,7 @@ import com.jianshui.common.utils.TimeUtil; import com.jianshui.common.utils.http.HttpHelper; import com.jianshui.common.utils.uuid.IdUtils; import com.jianshui.framework.manager.AsyncManager; -import com.jianshui.invoice.constant.elephant.ElephantConstants; +import com.jianshui.invoice.constant.elephant.ElephantConstantsV6; import com.jianshui.invoice.domain.*; import com.jianshui.invoice.domain.dto.*; import com.jianshui.invoice.domain.dto.adapter.response.RedInfoDTO; @@ -189,12 +189,12 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { // JSONObject result = JSONObject.parseObject("{\"zipCode\":\"0\",\"entCode\":\"91370102MA3UD2FG21\",\"dataExchangeId\":\"20220328140706911955546286280593\",\"encryptCode\":\"0\",\"returnStateInfo\":{\"returnCode\":\"0000\",\"returnMessage\":\"5aSE55CG5oiQ5YqfIQ==\"},\"content\":\"eyJERFFRUENIIjoiODgyOWNmNWUtNDAyYS00NWZkLWFiYmEtMzlkMjlhOWMzMjMzIiwiWlRETSI6IjAwOTk5OSIsIlpUWFgiOiLkvIHkuJrmnKrphY3nva7nqI7mjqforr7lpIcifQ==\"}"); // if (!CommonUtils.isDevMode()) { - // result = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE, (JSONObject) JSONObject.toJSON(elephantInvoiceAddDTO)); + // result = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE, (JSONObject) JSONObject.toJSON(elephantInvoiceAddDTO)); // } - // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE, JSONUtil.parse(elephantInvoiceAddDTO)); + // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE, JSONUtil.parse(elephantInvoiceAddDTO)); AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstants.ADD_INVOICE_LOCALHOST, ElephantConstants.ADD_INVOICE_METHOD, JSONUtil.parse(elephantInvoiceAddDTO), companyservice); + queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_METHOD, JSONUtil.parse(elephantInvoiceAddDTO), companyservice); } catch (UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException e) { log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -227,9 +227,9 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { queryBody.put("DDQQPCH", billInfo.getSystemOrderno()); queryBody.put("FPLXDM", fplxdm); queryBody.put("SFFHSBSJ", "0"); - // queryResult = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); + // queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstants.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -350,11 +350,11 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { queryBody.put("BSWJ", "0"); debugLog("断点4", uuid, timestamp); - // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.QUERY_INVOICE, JSONUtil.parse(queryBody)); - // queryResult = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); + // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.QUERY_INVOICE, JSONUtil.parse(queryBody)); + // queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.QUERY_INVOICE_LOCALHOST, ElephantConstants.QUERY_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.QUERY_INVOICE_LOCALHOST, ElephantConstantsV6.QUERY_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryBody).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -763,7 +763,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { } DxhyInterfaceResponse dxhyInterfaceResponse = null; try { - dxhyInterfaceResponse = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstants.REDINFO_FIND_LOCALHOST, ElephantConstants.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice); + dxhyInterfaceResponse = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstantsV6.REDINFO_FIND_LOCALHOST, ElephantConstantsV6.REDINFO_FIND_METHOD, JSONUtil.parse(findRedInfo), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【红字信息表查询】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(findRedInfo).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -914,10 +914,10 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { HZSQDSCZXXList.add(HZSQDSCZXX); elephatRedInfoDTO.setHZSQDSCZXX(HZSQDSCZXXList); - // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.REDINFO_UPLOAD, JSONUtil.parse(elephatRedInfoDTO)); + // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.REDINFO_UPLOAD, JSONUtil.parse(elephatRedInfoDTO)); AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.REDINFO_UPLOAD_LOCALHOST, ElephantConstants.REDINFO_UPLOAD_METHOD, JSONUtil.parse(elephatRedInfoDTO), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.REDINFO_UPLOAD_LOCALHOST, ElephantConstantsV6.REDINFO_UPLOAD_METHOD, JSONUtil.parse(elephatRedInfoDTO), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【红字信息表上传】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephatRedInfoDTO).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -1100,11 +1100,11 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { for (; page < 11; page++) { queryJson.put("YS", page); // 页数", - // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.DEPRECATE_INVOICE, JSONUtil.parse(queryJson)); + // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.DEPRECATE_INVOICE, JSONUtil.parse(queryJson)); AjaxResult queryResult = null; try { // System.out.println(JSONUtil.parse(queryJson)); - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.REDINFO_DOWNLOAD_LOCALHOST, ElephantConstants.REDINFO_DOWNLOAD_METHOD, JSONUtil.parse(queryJson), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.REDINFO_DOWNLOAD_LOCALHOST, ElephantConstantsV6.REDINFO_DOWNLOAD_METHOD, JSONUtil.parse(queryJson), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【红字信息表下载】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryJson).toString(), JSONObject.toJSONString(companyservice)); break; @@ -1332,10 +1332,10 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { queryBody.put("FPZH", invoice.getFphm()); queryBody.put("ZFLX", "1"); queryBody.put("ZFPCH", IdUtils.randomSystemOrderno()); - // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.DEPRECATE_INVOICE, JSONUtil.parse(queryBody)); + // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.DEPRECATE_INVOICE, JSONUtil.parse(queryBody)); AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.DEPRECATE_INVOICE_LOCALHOST, ElephantConstants.DEPRECATE_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.DEPRECATE_INVOICE_LOCALHOST, ElephantConstantsV6.DEPRECATE_INVOICE_METHOD, JSONUtil.parse(queryBody), companyservice); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { log.error("【销项发票】【大象接口】【发票作废】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryBody).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -1360,9 +1360,9 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { // queryBody.put("XHFSBH", companyservice.getSellertax()); // 销货方纳税人识别号 // queryBody.put("FPDM", invoice.getFpdm()); // queryBody.put("FPHM", invoice.getFphm()); - // // queryResult = ElephantUtils.sendRequest(ElephantConstants.DEPRECATE_INVOICE_RESULT, JSONUtil.parse(queryBody)); + // // queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.DEPRECATE_INVOICE_RESULT, JSONUtil.parse(queryBody)); // try { - // queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.DEPRECATE_INVOICE_RESULT_LOCALHOST, ElephantConstants.DEPRECATE_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); + // queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.DEPRECATE_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.DEPRECATE_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); // } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { // log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryBody).toString(), JSONObject.toJSONString(companyservice)); // e.printStackTrace(); @@ -1451,7 +1451,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { query.put("DYJMC", queryPrinterDTO.getPrinterName()); AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.QUERY_PRINTER_LOCALHOST, ElephantConstants.QUERY_PRINTER, JSONUtil.parse(query), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.QUERY_PRINTER_LOCALHOST, ElephantConstantsV6.QUERY_PRINTER, JSONUtil.parse(query), companyservice); } catch (UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException e) { log.error("【销项发票】【大象接口】【打印机查询】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(query).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -1536,7 +1536,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.BATCH_PRINT_LOCALHOST, ElephantConstants.BATCH_PRINT, JSONUtil.parse(query), companyservice); + queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstantsV6.BATCH_PRINT_LOCALHOST, ElephantConstantsV6.BATCH_PRINT, JSONUtil.parse(query), companyservice); } catch (UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException e) { log.error("【销项发票】【大象接口】【打印机查询】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(query).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); @@ -1593,7 +1593,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { AjaxResult queryResult = null; System.out.println(JSONUtil.parse(signESealDTO).toString()); try { - queryResult = ElephantUtils.sendRequest(ElephantConstants.SIGN + queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.SIGN , JSONUtil.parse(signESealDTO), companyservice, true); } catch (Exception e) { log.error("【销项发票】【大象接口】【发票签章】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(signESealDTO).toString() @@ -1626,7 +1626,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequest(ElephantConstants.SIGN_CREATE + queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.SIGN_CREATE , JSONUtil.parse(createESealDTO), companyservice, true); } catch (Exception e) { log.error("【销项发票】【大象接口】【发票专用章图片生成】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(createESealDTO).toString() @@ -1661,7 +1661,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { AjaxResult queryResult = null; try { - queryResult = ElephantUtils.sendRequest(ElephantConstants.SIGN_REGISTER + queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.SIGN_REGISTER , JSONUtil.parse(createESealDTO), companyservice, true); } catch (Exception e) { log.error("【销项发票】【大象接口】【发票专用章导入】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(createESealDTO).toString() From a52e30f0b568e2f260086dee469bfcf70cdb405a Mon Sep 17 00:00:00 2001 From: kk <1910333201@qq.com> Date: Wed, 20 Sep 2023 11:15:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?V6=E6=8E=A5=E5=8F=A3=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../http/invoice/v1/InvoiceController.java | 40 +++++++++++++++++-- .../elephant/ElephantConstantsV6.java | 4 +- 2 files changed, 39 insertions(+), 5 deletions(-) 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"; // 发票作废结果查询 From 33ac26d80d635cb1fa38edcb1901f8f4d95bb1f8 Mon Sep 17 00:00:00 2001 From: kk <1910333201@qq.com> Date: Wed, 20 Sep 2023 18:10:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../http/invoice/v1/InvoiceController.java | 39 +++++++++++++++++++ .../elephant/ElephantConstantsV6.java | 6 +++ .../invoice/service/IInvoiceApiService.java | 3 ++ .../AisinoInvoiceRequestAdapterImpl.java | 3 +- .../AisinoConsoleInvoiceApiServiceImpl.java | 5 +++ .../api/ElephantInvoiceApiServiceImpl.java | 5 +++ .../api/ElephantInvoiceApiV6ServiceImpl.java | 28 +++++++++++++ .../impl/api/JcskInvoiceApiServiceImpl.java | 5 +++ 8 files changed, 93 insertions(+), 1 deletion(-) 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 0c90291..7a41169 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 @@ -1450,5 +1450,44 @@ public class InvoiceController { } + /** 大象数电V6 */ + /** 生成动态二维码接口 */ + @ApiImplicitParams({ + @ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true), + @ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)}) + @PostMapping({"/api/invoice/v1/generateDynamicCode/{identity}", "/api/invoice/v1/generateDynamicCode"}) + public Object generateDynamicCode(HttpServletRequest request, String identity) throws Exception { + if (StringUtils.isEmpty(identity)) { + return AjaxResult.error(ErrorCode.EMPTY_IDENTITY); + } + Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity); + if (companyservice == null) { + return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND); + } + // 获得入口报文适配器 + String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid()); + IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); + JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, ""); + + // 获得请求实例,并且进行扣费 + String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); + serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); + + IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); + HXResponse result = invoiceService.generateDynamicCode(decryptResult, companyservice); + + String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); + IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey); + + return invoiceResponseService.response(result, companyservice, ""); + + } + + + + + + + } 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 efa0814..5dfa561 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 @@ -56,6 +56,12 @@ public class ElephantConstantsV6 { public static String REDINFO_FIND_LOCALHOST = "/invoice/api/v6/GetRedInvoiceApplication"; public static String REDINFO_FIND_METHOD = "GetRedInvoiceApplication"; + + // 生成动态二维码 + public static String GEN_DYNAMIC_CODE_LOCALHOST = "/invoice/api/v6/GenerateDynamicCode"; + public static String GEN_DYNAMIC_CODE_METHOD = "GenerateDynamicCode"; + + // 发票作废 public static String DEPRECATE_INVOICE = "order-api/order-api/V5/DeprecateInvoices"; public static String DEPRECATE_INVOICE_LOCALHOST = "/invoice/api/V5/DeprecateInvoices"; diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java index 53ee459..f78814f 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java @@ -279,4 +279,7 @@ public interface IInvoiceApiService { * @return : java.lang.Object */ EleNewMessage findRedInfo(FindRedInfo findRedInfo, Companyservice companyservice); + + /** 生成动态二维码接口*/ + HXResponse generateDynamicCode(JSONObject decryptResult, Companyservice companyservice); } \ No newline at end of file diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java index c49ea86..846281f 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java @@ -102,7 +102,8 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService { // 平台解密 try { - order = AisinoInvoiceDecryptUtil.decrypt(order, JKey); + // TODO: 2023/9/20 开发暂时关掉 +// order = AisinoInvoiceDecryptUtil.decrypt(order, JKey); } catch (Exception e) { e.printStackTrace(); throw new JianshuiParamErrorException(ErrorCode.DECRYPT_ERROR, companyservice, "invoice"); diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java index 0c3a227..53d39e6 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java @@ -1024,4 +1024,9 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { return null; } + @Override + public HXResponse generateDynamicCode(JSONObject decryptResult, Companyservice companyservice) { + return null; + } + } diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java index a3d5ee4..4b4e8d8 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java @@ -812,6 +812,11 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService { } + @Override + public HXResponse generateDynamicCode(JSONObject decryptResult, Companyservice companyservice) { + return null; + } + /** * 申请/上传 红字发票 diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java index d45af4d..1bb6fc6 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java @@ -2,6 +2,7 @@ package com.jianshui.invoice.service.impl.api; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.codec.Base64; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dxhy.order.protocol.invoke.DxhyInterfaceResponse; import com.google.gson.Gson; import com.jianshui.common.constant.Constants; +import com.jianshui.common.constant.WebServiceConstant; import com.jianshui.common.core.domain.AjaxResult; import com.jianshui.common.core.domain.entity.Companyservice; import com.jianshui.common.enums.ErrorCode; @@ -19,6 +21,7 @@ import com.jianshui.common.utils.DateUtils; import com.jianshui.common.utils.StringUtils; import com.jianshui.common.utils.TimeUtil; import com.jianshui.common.utils.http.HttpHelper; +import com.jianshui.common.utils.jcsk.ApiHttp; import com.jianshui.common.utils.uuid.IdUtils; import com.jianshui.framework.manager.AsyncManager; import com.jianshui.invoice.constant.elephant.ElephantConstantsV6; @@ -43,6 +46,7 @@ import com.jianshui.queue.utils.RedisQueueUtil; import com.jianshui.storage.domain.StorageUrlDTO; import com.jianshui.storage.factory.StorageFactory; import com.jianshui.storage.service.IStorageService; +import com.jianshui.system.domain.InvoiceAllApiLog; import com.jianshui.system.mapper.CompanyserviceMapper; import com.jianshui.system.service.ISysConfigService; import lombok.extern.slf4j.Slf4j; @@ -806,6 +810,30 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { + } + + /** + * 生成动态二维码接口 + * @param decryptResult + * @param companyservice + * @return + */ + @Override + public HXResponse generateDynamicCode(JSONObject decryptResult, Companyservice companyservice) { + + DxhyInterfaceResponse dxhyInterfaceResponse = null; + try { + dxhyInterfaceResponse = ElephantUtils.sendRequestWithoutTokenV6(ElephantConstantsV6.GEN_DYNAMIC_CODE_LOCALHOST, ElephantConstantsV6.GEN_DYNAMIC_CODE_METHOD, JSONUtil.parse(decryptResult), companyservice); + } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { + log.error("【销项发票】【大象接口】【生成动态二维码】发票请求异常,请求报文{},销方信息{}", decryptResult, JSONObject.toJSONString(companyservice)); + e.printStackTrace(); + return new HXResponse("9999","系统异常!"); + } + String data = dxhyInterfaceResponse.getData(); + String code = dxhyInterfaceResponse.getCode(); + + return new HXResponse(code,data); + } diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java index 535eac5..027d702 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java @@ -1573,6 +1573,11 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { return null; } + @Override + public HXResponse generateDynamicCode(JSONObject decryptResult, Companyservice companyservice) { + return null; + } + /** * 简税和金财数科 发票类型互换 *