From 3ab4cc480a362ae14e4f053ff4f91fa613b50d7e Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Wed, 22 Mar 2023 08:19:04 +0800 Subject: [PATCH] =?UTF-8?q?feature=201.=E5=A2=9E=E5=8A=A0OCR=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OpenServicePlatformController.java | 11 +++++++++++ .../openservice/IOpenServicePlatformService.java | 1 + .../impl/OpenServicePlatformServiceImpl.java | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/dxhy-core/src/main/java/com/dxhy/core/controller/OpenServicePlatformController.java b/dxhy-core/src/main/java/com/dxhy/core/controller/OpenServicePlatformController.java index 7df80e53..93e500ed 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/controller/OpenServicePlatformController.java +++ b/dxhy-core/src/main/java/com/dxhy/core/controller/OpenServicePlatformController.java @@ -45,4 +45,15 @@ public class OpenServicePlatformController { } } + + @PostMapping("/getInvoiceSnOcrResult") + public List getInvoiceSnOcrResult(@RequestBody Map params) { + try { + String picture = params.get("picture"); + return openServicePlatformService.ocrInvoice(picture); + } catch (Exception e) { + log.error("调用开放平台OCR接口失败,", e); + return null; + } + } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/openservice/IOpenServicePlatformService.java b/dxhy-core/src/main/java/com/dxhy/core/service/openservice/IOpenServicePlatformService.java index 7b63feb2..b594817d 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/service/openservice/IOpenServicePlatformService.java +++ b/dxhy-core/src/main/java/com/dxhy/core/service/openservice/IOpenServicePlatformService.java @@ -35,4 +35,5 @@ public interface IOpenServicePlatformService { List getCustomsOcrResult(String uuid, String picture) throws OpenServiceInvokeException; List ocrInvoice(String picture, String userName, String password, String taxno); + List ocrInvoice(String picture); } diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/openservice/impl/OpenServicePlatformServiceImpl.java b/dxhy-core/src/main/java/com/dxhy/core/service/openservice/impl/OpenServicePlatformServiceImpl.java index e64e1122..9cba6c39 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/service/openservice/impl/OpenServicePlatformServiceImpl.java +++ b/dxhy-core/src/main/java/com/dxhy/core/service/openservice/impl/OpenServicePlatformServiceImpl.java @@ -195,6 +195,11 @@ public class OpenServicePlatformServiceImpl implements IOpenServicePlatformServi // return JSONObject.parseArray(decodeStr, OpenServiceOcr.class); } + + @Override + public List ocrInvoice(String picture) { + return OcrToSn(picture); + } /** * Ocr识别使用山能 * @param picture 文件流