|
|
@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.fs.aiSoundReplication.param.TtsRequest;
|
|
|
+import com.fs.aiSoundReplication.service.impl.TtsServiceImpl;
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
@@ -16,8 +18,10 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.date.DateUtil;
|
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyMiniapp;
|
|
|
+import com.fs.company.mapper.CompanyFsUserMapper;
|
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
+import com.fs.company.param.VcCompanyUser;
|
|
|
import com.fs.company.service.ICompanyMiniappService;
|
|
|
import com.fs.config.cloud.CloudHostProper;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
@@ -30,6 +34,7 @@ import com.fs.course.service.IFsCourseLinkService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.fastGpt.domain.FastGptChatReplaceWords;
|
|
|
import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
|
|
|
+import com.fs.fastgptApi.vo.AudioVO;
|
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
import com.fs.live.domain.LiveWatchLog;
|
|
|
@@ -210,6 +215,12 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
@Autowired
|
|
|
private XiaoShouYiMaterialService xiaoShouYiMaterialService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TtsServiceImpl ttsServiceImpl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyFsUserMapper companyFsUserMapper;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -727,7 +738,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
|
|
|
//语音
|
|
|
case "7":
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
break;
|
|
|
//直播小程序单独
|
|
|
case "12":
|
|
|
@@ -825,7 +836,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramPage(linkByMiniApp);
|
|
|
break;
|
|
|
case "16":
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
sopLogs.setAppSendStatus(0);
|
|
|
break;
|
|
|
case "17": //h5看课
|
|
|
@@ -1084,8 +1095,13 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
break;
|
|
|
//语音
|
|
|
case "7":
|
|
|
- if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ if (qwUser.getCompanyUserId() != null ) {
|
|
|
+ if (CloudHostUtils.hasCloudHostName("今正科技")) {
|
|
|
+ createVoiceUrByAuto(st, String.valueOf(qwUser.getCompanyUserId()),qwUser);
|
|
|
+ }else {
|
|
|
+ createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
//直播小程序单独
|
|
|
@@ -1189,11 +1205,11 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
break;
|
|
|
case "16":
|
|
|
if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
}
|
|
|
try {
|
|
|
if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
@@ -1382,7 +1398,12 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
break;
|
|
|
//语音
|
|
|
case "7":
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ if (CloudHostUtils.hasCloudHostName("今正科技")) {
|
|
|
+ createVoiceUrByAuto(st, companyUserId,qwUser);
|
|
|
+ }else {
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
//app
|
|
|
case "9":
|
|
|
@@ -1585,10 +1606,10 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
sopLogs.setAppSendStatus(0);
|
|
|
break;
|
|
|
case "16":
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
try {
|
|
|
if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
@@ -1792,7 +1813,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void createVoiceUrl(QwSopCourseFinishTempSetting.Setting st, String companyUserId, QwSop qwSop) {
|
|
|
+ private void createVoiceUrl(QwSopCourseFinishTempSetting.Setting st, String companyUserId) {
|
|
|
QwSopTempVoice qwSopTempVoice = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(Long.valueOf(companyUserId), st.getValue());
|
|
|
if (qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null && qwSopTempVoice.getRecordType() == 1) {
|
|
|
st.setVoiceUrl(qwSopTempVoice.getVoiceUrl());
|
|
|
@@ -1807,6 +1828,33 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ private void createVoiceUrByAuto(QwSopCourseFinishTempSetting.Setting st, String companyUserId,QwUser user) {
|
|
|
+ QwSopTempVoice qwSopTempVoice = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(Long.valueOf(companyUserId), st.getValue());
|
|
|
+ if (qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null && qwSopTempVoice.getRecordType() == 1) {
|
|
|
+ st.setVoiceUrl(qwSopTempVoice.getVoiceUrl());
|
|
|
+ st.setVoiceDuration(String.valueOf(qwSopTempVoice.getDuration()));
|
|
|
+ } else if (qwSopTempVoice == null) {
|
|
|
+ if(st.getValue() != null){
|
|
|
+ VcCompanyUser vcCompanyUser = companyFsUserMapper.selectVcCompanyUser(companyUserId);
|
|
|
+ AudioVO audioVO = ttsServiceImpl.textToSpeech(new TtsRequest(null, null, vcCompanyUser.getSpeakerId(), st.getValue()));
|
|
|
+
|
|
|
+ ttsServiceImpl.ttsChargeByCount(vcCompanyUser,audioVO,user);
|
|
|
+
|
|
|
+ qwSopTempVoice = new QwSopTempVoice();
|
|
|
+ qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
|
+ qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
|
+ qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl());
|
|
|
+ qwSopTempVoice.setCompanyUserId(Long.valueOf(companyUserId));
|
|
|
+ qwSopTempVoice.setVoiceTxt(st.getValue());
|
|
|
+ qwSopTempVoice.setRecordType(1);
|
|
|
+ sopTempVoiceService.insertQwSopTempVoice(qwSopTempVoice);
|
|
|
+
|
|
|
+ st.setVoiceUrl(audioVO.getUrl());
|
|
|
+ st.setVoiceDuration(String.valueOf(audioVO.getDuration()));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -1861,7 +1909,6 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
|
|
|
private R processQwSopLogsBySendMsg(SendUserLogsInfoMsgParam param,Integer draftStrategy) {
|
|
|
|
|
|
-
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSON.parseObject(json, CourseConfig.class);
|
|
|
|
|
|
@@ -2302,8 +2349,13 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramPage(linkByMiniApp);
|
|
|
break;
|
|
|
case "7":
|
|
|
- QwSop qwSop = qwSopMapper.selectQwSopById(param.getSopId());
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ if (CloudHostUtils.hasCloudHostName("今正科技")) {
|
|
|
+ createVoiceUrByAuto(st, companyUserId,qwUser);
|
|
|
+ }else {
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
break;
|
|
|
//app
|
|
|
case "9":
|
|
|
@@ -2375,10 +2427,9 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
case "15":
|
|
|
//app文本
|
|
|
try {
|
|
|
- qwSop = qwSopMapper.selectQwSopById(param.getSopId());
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
@@ -2388,10 +2439,9 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
case "16":
|
|
|
//app语音
|
|
|
try {
|
|
|
- qwSop = qwSopMapper.selectQwSopById(param.getSopId());
|
|
|
- createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ createVoiceUrl(st, companyUserId);
|
|
|
if (qwUser.getCompanyUserId() != null) {
|
|
|
- createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
@@ -2933,7 +2983,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void createVoiceUrlToIm(QwSopCourseFinishTempSetting.Setting st, String companyUserId, QwSop qwSop) {
|
|
|
+ private void createVoiceUrlToIm(QwSopCourseFinishTempSetting.Setting st, String companyUserId) {
|
|
|
QwSopTempVoice qwSopTempVoice = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(Long.valueOf(companyUserId), st.getValue());
|
|
|
if (qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null && qwSopTempVoice.getRecordType() == 1) {
|
|
|
st.setVoiceUrl(qwSopTempVoice.getUserVoiceUrl());
|