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 9202a2d..73c1e2f 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 @@ -675,7 +675,18 @@ public class InvoiceController { useAisino = true; } - HXResponse result = preHandleDecryptResult(decryptResult, "printer", companyservice); +// HXResponse result = preHandleDecryptResult(decryptResult, "printer", companyservice); + QueryPrinterDTO billInfo = decryptResult.toJavaObject(QueryPrinterDTO.class); + if (billInfo == 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); + HXResponse result = invoiceService.queryPrinter(billInfo, companyservice); String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); IInvoiceResponseService invoiceResponseService = null; 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 765515c..c0dde99 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 @@ -123,7 +123,7 @@ public class ElephantConstantsV6 { // 批量打印 public static String BATCH_PRINT = ""; - public static String BATCH_PRINT_LOCALHOST = "/invoice/api/v6/PrintInvoice"; + public static String BATCH_PRINT_LOCALHOST = "/invoice/api/v5/PrintInvoice"; public static String BATCH_PRINT_METHOD = "PrintInvoice"; 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 4670b99..c07d290 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 @@ -1531,6 +1531,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { */ @Override public HXResponse queryPrinter(QueryPrinterDTO queryPrinterDTO, Companyservice companyservice) { + JSONObject query = new JSONObject(); query.put("NSRSBH", companyservice.getSellertax()); query.put("DYJMC", queryPrinterDTO.getPrinterName()); @@ -1599,6 +1600,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { */ @Override public HXResponse batchPrint(PrintDTO printDTO, Companyservice companyservice) { + JSONObject query = new JSONObject(); query.put("NSRSBH", companyservice.getSellertax()); // "纳税人识别号", query.put("FJH", printDTO.getFjh()); // "分机号", @@ -1623,11 +1625,11 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { try { 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)); + log.error("【销项发票】【大象接口】【批量打印V5】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(query).toString(), JSONObject.toJSONString(companyservice)); e.printStackTrace(); throw new JianshuiServiceException("系统异常!"); } - log.info("【销项发票】【大象发票】打印机查询请求结果{}", queryResult.toString()); + log.info("【销项发票】【大象发票】批量打印V5请求结果{}", queryResult.toString()); // 判断外层报文是否成功