|
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.CommonSuccessStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
@@ -134,20 +135,23 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
if(Objects.isNull(textVoiceTransfer)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
|
|
|
}
|
|
|
+ textVoiceTransfer.setUpdateTime(new Date());
|
|
|
+ textVoiceTransfer.setName(dto.getName());
|
|
|
if(!dto.getDocument().equals(textVoiceTransfer.getDocument())){
|
|
|
String taskId = ttsUtil.logTextToVoice(dto.getDocument(), dto.getVoiceType().longValue(), dto.getSpeed(), dto.getVolume());
|
|
|
textVoiceTransfer.setTaskId(taskId);
|
|
|
- textVoiceTransferService.updateById(textVoiceTransfer);
|
|
|
}
|
|
|
}else{
|
|
|
textVoiceTransfer = new TextVoiceTransfer();
|
|
|
textVoiceTransfer.setNum(dto.getNum());
|
|
|
+ textVoiceTransfer.setName(dto.getName());
|
|
|
textVoiceTransfer.setType("tts");
|
|
|
textVoiceTransfer.setDocument(dto.getDocument());
|
|
|
String taskId = ttsUtil.logTextToVoice(dto.getDocument(), dto.getVoiceType().longValue(), dto.getSpeed(), dto.getVolume());
|
|
|
textVoiceTransfer.setTaskId(taskId);
|
|
|
textVoiceTransferService.save(textVoiceTransfer);
|
|
|
}
|
|
|
+ textVoiceTransferService.saveOrUpdate(textVoiceTransfer);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -161,7 +165,7 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
textVoiceTransfer = new TextVoiceTransfer();
|
|
|
textVoiceTransfer.setNum(dto.getNum());
|
|
|
}
|
|
|
-
|
|
|
+ textVoiceTransfer.setName(dto.getName());
|
|
|
textVoiceTransfer.setDocument(dto.getDocument());
|
|
|
textVoiceTransfer.setType("tts");
|
|
|
if(StrUtil.isEmpty(dto.getVoicePath())){
|
|
@@ -177,7 +181,7 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData asrSave(String num, Long id, MultipartFile file) throws Exception {
|
|
|
+ public ResultData asrSave(String num, Long id, String name, MultipartFile file) throws Exception {
|
|
|
|
|
|
TextVoiceTransfer textVoiceTransfer = null;
|
|
|
if(Objects.nonNull(id)) {
|
|
@@ -187,6 +191,7 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
textVoiceTransfer = new TextVoiceTransfer();
|
|
|
textVoiceTransfer.setNum(num);
|
|
|
}
|
|
|
+ textVoiceTransfer.setName(name);
|
|
|
String filename = file.getOriginalFilename();
|
|
|
File localFile = FileUtil.createTempFile(UUID.randomUUID().toString(), "." + FileUtil.extName(filename), new File(String.format(ConstantFilePath.SCENE_USER_PATH_V4, num)), true);
|
|
|
file.transferTo(localFile);
|
|
@@ -261,12 +266,18 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
//生成留言json
|
|
|
List<LeaveWord> list = leaveWordService.list(new LambdaQueryWrapper<LeaveWord>().eq(LeaveWord::getNum, param.getNum()).eq(LeaveWord::getStatus, CommonSuccessStatus.SUCCESS.code()));
|
|
|
String leaveWordKey = String.format(FileYunPath.SCRB_PATH, param.getNum()) + "leaveWord.json";
|
|
|
+ Integer hasLeaveWord = CommonStatus.NO.code().intValue();
|
|
|
if(CollUtil.isNotEmpty(list)){
|
|
|
List<JSONObject> collect = list.stream().map(l -> JSON.parseObject(l.getContent())).collect(Collectors.toList());
|
|
|
fYunFileService.uploadFile(JSON.toJSONString(collect).getBytes(StandardCharsets.UTF_8), leaveWordKey);
|
|
|
+ hasLeaveWord = CommonStatus.YES.code().intValue();
|
|
|
}else{//没有留言直接删除
|
|
|
fYunFileService.deleteFile(leaveWordKey);
|
|
|
}
|
|
|
+ sceneEditInfoScrbService.update(
|
|
|
+ new LambdaUpdateWrapper<SceneEditInfoScrb>()
|
|
|
+ .eq(SceneEditInfoScrb::getNum, param.getNum())
|
|
|
+ .set(SceneEditInfoScrb::getHasLeaveWord, hasLeaveWord));
|
|
|
|
|
|
}
|
|
|
|