yzx преди 2 седмици
родител
ревизия
a9c4c84499
променени са 2 файла, в които са добавени 126 реда и са изтрити 0 реда
  1. 89 0
      src/main/java/com/telerobot/fs/entity/po/CallRound.java
  2. 37 0
      src/main/java/com/telerobot/fs/service/CallRoundService.java

+ 89 - 0
src/main/java/com/telerobot/fs/entity/po/CallRound.java

@@ -0,0 +1,89 @@
+package com.telerobot.fs.entity.po;
+
+public class CallRound {
+
+    private String id;
+    private String uuid;
+    private int roundNo;
+    private String asrText;
+    private String llmText;
+    private long asrCostMs;
+    private long llmCostMs;
+    private long ttsCostMs;
+    private long createTime;
+
+    public CallRound() {
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public int getRoundNo() {
+        return roundNo;
+    }
+
+    public void setRoundNo(int roundNo) {
+        this.roundNo = roundNo;
+    }
+
+    public String getAsrText() {
+        return asrText;
+    }
+
+    public void setAsrText(String asrText) {
+        this.asrText = asrText;
+    }
+
+    public String getLlmText() {
+        return llmText;
+    }
+
+    public void setLlmText(String llmText) {
+        this.llmText = llmText;
+    }
+
+    public long getAsrCostMs() {
+        return asrCostMs;
+    }
+
+    public void setAsrCostMs(long asrCostMs) {
+        this.asrCostMs = asrCostMs;
+    }
+
+    public long getLlmCostMs() {
+        return llmCostMs;
+    }
+
+    public void setLlmCostMs(long llmCostMs) {
+        this.llmCostMs = llmCostMs;
+    }
+
+    public long getTtsCostMs() {
+        return ttsCostMs;
+    }
+
+    public void setTtsCostMs(long ttsCostMs) {
+        this.ttsCostMs = ttsCostMs;
+    }
+
+    public long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(long createTime) {
+        this.createTime = createTime;
+    }
+}

+ 37 - 0
src/main/java/com/telerobot/fs/service/CallRoundService.java

@@ -0,0 +1,37 @@
+package com.telerobot.fs.service;
+
+import com.telerobot.fs.entity.po.CallRound;
+import com.telerobot.fs.utils.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class CallRoundService {
+    @Resource
+    private JdbcTemplate jdbcTemplate;
+    private final static Logger logger = LoggerFactory.getLogger(CallRoundService.class);
+
+    public void insertCallRound(CallRound callRound) {
+        String sql = "INSERT INTO cc_call_round (id, uuid, round_no, asr_text, llm_text, asr_cost_ms, llm_cost_ms, tts_cost_ms, create_time) " +
+                "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+        try {
+            jdbcTemplate.update(sql,
+                    callRound.getId(),
+                    callRound.getUuid(),
+                    callRound.getRoundNo(),
+                    callRound.getAsrText(),
+                    callRound.getLlmText(),
+                    callRound.getAsrCostMs(),
+                    callRound.getLlmCostMs(),
+                    callRound.getTtsCostMs(),
+                    callRound.getCreateTime()
+            );
+        } catch (Throwable e) {
+            logger.error("insertCallRound error: {} {}", e.toString(), CommonUtils.getStackTraceString(e.getStackTrace()));
+        }
+    }
+}