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()