From c4de48a3867e4a591ce5bccf28ac19e3541edcb4 Mon Sep 17 00:00:00 2001
From: joylink_zhangsai <1021828630@qq.com>
Date: Mon, 12 Apr 2021 11:21:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=8E=E4=B8=BA=E8=AF=AD=E9=9F=B3=E8=AF=86?=
=?UTF-8?q?=E5=88=AB=E5=9B=9E=E6=BB=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 36 ++---
.../voice/huawei/HuaweiVoiceServiceImpl.java | 142 +++++++++---------
2 files changed, 89 insertions(+), 89 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8d357e4a2..0e2488f30 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,27 +108,27 @@
0.2.1
-
- com.huawei.sis
- huaweicloud-java-sdk-sis
- 1.3.2
-
+
+
+
+
+
-
-
- sis-repo
- Sis Release Repository
- https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk
-
- true
-
-
- false
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java
index f250fe44e..a04f5301d 100644
--- a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java
+++ b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java
@@ -1,71 +1,71 @@
-package club.joylink.rtss.services.voice.huawei;
-
-import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
-import club.joylink.rtss.services.IVoiceService;
-import club.joylink.rtss.services.voice.baidu.AsrService;
-import club.joylink.rtss.services.voice.baidu.TokenHolder;
-import club.joylink.rtss.services.voice.baidu.TtsService;
-import club.joylink.rtss.services.voice.baidu.VoiceAsrResult;
-import club.joylink.rtss.vo.client.VoiceRecognitionResult;
-import com.huawei.sis.bean.AuthInfo;
-import com.huawei.sis.bean.SisConfig;
-import com.huawei.sis.bean.request.AsrCustomShortRequest;
-import com.huawei.sis.bean.response.AsrCustomShortResponse;
-import com.huawei.sis.client.AsrCustomizationClient;
-import com.huawei.sis.exception.SisException;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Base64;
-
-@Slf4j
-@Service("HuaweiVoiceService")
-public class HuaweiVoiceServiceImpl implements IVoiceService {
-
- /**
- * 华为语音识别配置
- */
- private final String ak = "YDUXTXRYGAHGPHAIXZCU";
- private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
- private final String region = "cn-north-4";
- private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
-
-
- @Override
- public String synthesis(String message, String per) {
- throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
- }
-
- @Override
- public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
- String filePath;
- try {
- filePath = IVoiceService.handleAndSaveFile(file);
- } catch (IOException e) {
- throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
- }
- AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
- SisConfig sisConfig = new SisConfig();
- AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
- String data;
- try {
- data = Base64.getEncoder().encodeToString(file.getBytes());
- } catch (IOException e) {
- throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件编码失败", e);
- }
- try {
- AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
- AsrCustomShortResponse response = client.getAsrShortResponse(request);
- return new VoiceRecognitionResult(filePath, response.getResult().getText());
- } catch (SisException e) {
- throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
- }
- }
-
-}
+//package club.joylink.rtss.services.voice.huawei;
+//
+//import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
+//import club.joylink.rtss.services.IVoiceService;
+//import club.joylink.rtss.services.voice.baidu.AsrService;
+//import club.joylink.rtss.services.voice.baidu.TokenHolder;
+//import club.joylink.rtss.services.voice.baidu.TtsService;
+//import club.joylink.rtss.services.voice.baidu.VoiceAsrResult;
+//import club.joylink.rtss.vo.client.VoiceRecognitionResult;
+//import com.huawei.sis.bean.AuthInfo;
+//import com.huawei.sis.bean.SisConfig;
+//import com.huawei.sis.bean.request.AsrCustomShortRequest;
+//import com.huawei.sis.bean.response.AsrCustomShortResponse;
+//import com.huawei.sis.client.AsrCustomizationClient;
+//import com.huawei.sis.exception.SisException;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//import org.springframework.web.client.RestTemplate;
+//import org.springframework.web.multipart.MultipartFile;
+//
+//import java.io.ByteArrayInputStream;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.util.Base64;
+//
+//@Slf4j
+//@Service("HuaweiVoiceService")
+//public class HuaweiVoiceServiceImpl implements IVoiceService {
+//
+// /**
+// * 华为语音识别配置
+// */
+// private final String ak = "YDUXTXRYGAHGPHAIXZCU";
+// private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
+// private final String region = "cn-north-4";
+// private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
+//
+//
+// @Override
+// public String synthesis(String message, String per) {
+// throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
+// }
+//
+// @Override
+// public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
+// String filePath;
+// try {
+// filePath = IVoiceService.handleAndSaveFile(file);
+// } catch (IOException e) {
+// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
+// }
+// AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
+// SisConfig sisConfig = new SisConfig();
+// AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
+// String data;
+// try {
+// data = Base64.getEncoder().encodeToString(file.getBytes());
+// } catch (IOException e) {
+// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件编码失败", e);
+// }
+// try {
+// AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
+// AsrCustomShortResponse response = client.getAsrShortResponse(request);
+// return new VoiceRecognitionResult(filePath, response.getResult().getText());
+// } catch (SisException e) {
+// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
+// }
+// }
+//
+//}