From b5497d4cd3b5829978f9b071ea3e9eae91db662d Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Tue, 27 Sep 2022 14:47:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=90=86=E8=AE=BA=E8=AF=95=E9=A2=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/client/voice/VoiceRecognitionVO.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/main/java/club/joylink/rtss/vo/client/voice/VoiceRecognitionVO.java diff --git a/src/main/java/club/joylink/rtss/vo/client/voice/VoiceRecognitionVO.java b/src/main/java/club/joylink/rtss/vo/client/voice/VoiceRecognitionVO.java new file mode 100644 index 000000000..a2b50787e --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/voice/VoiceRecognitionVO.java @@ -0,0 +1,45 @@ +package club.joylink.rtss.vo.client.voice; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.Base64; + +@Data +@Slf4j +public class VoiceRecognitionVO { + private byte[] data; + private String filePath; + + public VoiceRecognitionVO(String filePath){ + this.filePath = filePath; + } + public VoiceRecognitionVO(String filePath,MultipartFile file){ + this(filePath); + this.load(file); + } + public VoiceRecognitionVO(String filePath,String base64Str){ + this(filePath); + this.load(base64Str); + } + public VoiceRecognitionVO(String filePath,byte[] bb){ + this(filePath); + this.data = bb; + } + private void load(MultipartFile file){ + try { + this.data = file.getBytes(); + } catch (IOException e) { + log.error("加载数据失败 file{}",file.getOriginalFilename() + " errMsg:{}",e.getMessage(),e); + this.data = new byte[0]; + } + } + + private void load(String base64Str){ + String base64 = base64Str.substring(base64Str.indexOf("base64,") + "base64,".length()); + byte[] bytes = Base64.getDecoder().decode(base64.trim()); + this.data = bytes; + } +} From cbc12523bcc467f75d5bb9b565b37a68f6a34aa0 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Tue, 27 Sep 2022 14:51:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=90=86=E8=AE=BA=E8=AF=95=E9=A2=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/PaperQuestionWithBLOBs.java | 20 ------------------- .../mybatis/mapper/PaperQuestionDAO.xml | 17 ++++++---------- 2 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 src/main/java/club/joylink/rtss/entity/paper/question/PaperQuestionWithBLOBs.java diff --git a/src/main/java/club/joylink/rtss/entity/paper/question/PaperQuestionWithBLOBs.java b/src/main/java/club/joylink/rtss/entity/paper/question/PaperQuestionWithBLOBs.java deleted file mode 100644 index 48eade013..000000000 --- a/src/main/java/club/joylink/rtss/entity/paper/question/PaperQuestionWithBLOBs.java +++ /dev/null @@ -1,20 +0,0 @@ -package club.joylink.rtss.entity.paper.question; - -import java.io.Serializable; -import lombok.Data; - -/** - * @author - * - */ -@Data -public class PaperQuestionWithBLOBs extends PaperQuestion implements Serializable { - /** - * 问题内容 - */ - private String topic; - - private String questions; - - private static final long serialVersionUID = 1L; -} diff --git a/src/main/resources/mybatis/mapper/PaperQuestionDAO.xml b/src/main/resources/mybatis/mapper/PaperQuestionDAO.xml index 1d44ca1f7..7add0a3ed 100644 --- a/src/main/resources/mybatis/mapper/PaperQuestionDAO.xml +++ b/src/main/resources/mybatis/mapper/PaperQuestionDAO.xml @@ -77,10 +77,7 @@ - id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del,question_answer - - - question, question_option + id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del,question_answer,question, question_option