|
@@ -28,9 +28,13 @@ import com.fs.erp.dto.ErpOrderResponse;
|
|
|
import com.fs.erp.mapper.FsErpFinishPushMapper;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.fastGpt.domain.FastGptEventTokenLog;
|
|
|
+import com.fs.fastGpt.domain.FastgptChatVoiceHomo;
|
|
|
import com.fs.fastGpt.domain.FastgptEventLogTotal;
|
|
|
import com.fs.fastGpt.mapper.FastGptChatSessionMapper;
|
|
|
+import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
|
|
|
import com.fs.fastGpt.service.IFastgptEventLogTotalService;
|
|
|
+import com.fs.fastgptApi.util.AudioUtils;
|
|
|
+import com.fs.fastgptApi.vo.AudioVO;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.config.StoreConfig;
|
|
|
import com.fs.his.domain.FsInquiryOrder;
|
|
@@ -51,6 +55,8 @@ import com.fs.im.service.IImService;
|
|
|
import com.fs.qw.domain.QwCompany;
|
|
|
import com.fs.qw.service.*;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
+import com.fs.sop.domain.QwSopTempVoice;
|
|
|
+import com.fs.sop.service.IQwSopTempVoiceService;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.mapper.SysConfigMapper;
|
|
|
import com.google.gson.Gson;
|
|
@@ -63,6 +69,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@Component("task")
|
|
@@ -165,6 +172,51 @@ public class Task {
|
|
|
@Autowired
|
|
|
private IFastgptEventLogTotalService fastgptEventLogTotalService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FastgptChatVoiceHomoMapper fastgptChatVoiceHomoMapper;
|
|
|
+ @Autowired
|
|
|
+ private IQwSopTempVoiceService qwSopTempVoiceService;
|
|
|
+
|
|
|
+ public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键生成语音定时任务
|
|
|
+ */
|
|
|
+ public void ConsumerSopTempVoice() {
|
|
|
+ try {
|
|
|
+ Long newCompanyUserId = redisCache.popVoiceKey(SOP_TEMP_VOICE_KEY);
|
|
|
+ if(newCompanyUserId != null){
|
|
|
+ List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" +newCompanyUserId);
|
|
|
+ if(sopTempVoices != null && !sopTempVoices.isEmpty()) {
|
|
|
+ try {
|
|
|
+ for (QwSopTempVoice qwSopTempVoice : sopTempVoices) {
|
|
|
+ try {
|
|
|
+ AudioVO audioVO = new AudioVO();
|
|
|
+ List<FastgptChatVoiceHomo> homos = fastgptChatVoiceHomoMapper.selectFastgptChatVoiceHomoList(new FastgptChatVoiceHomo());
|
|
|
+ audioVO = AudioUtils.createUserUrlAndUrl(homos,qwSopTempVoice.getCompanyUserId(), qwSopTempVoice.getVoiceTxt());
|
|
|
+ if (audioVO != null && audioVO.getWavUrl() != null && audioVO.getUrl() != null) {
|
|
|
+ qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
|
+ qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl());
|
|
|
+ qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
|
+ qwSopTempVoice.setRecordType(1);
|
|
|
+ qwSopTempVoiceService.updateQwSopTempVoice(qwSopTempVoice);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ redisCache.deleteObject(SOP_TEMP_VOICE_KEY + ":" + newCompanyUserId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ log.info("没有需要生成的语音");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("生成语音定时任务执行异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//统计ai事件埋点
|
|
|
public void eventLogTotals() {
|
|
|
// 判断是否是凌晨 00:00 - 00:59
|