Pārlūkot izejas kodu

1.提交sop模板创建语音报错问题

jzp 1 nedēļu atpakaļ
vecāks
revīzija
f59f864961

+ 45 - 4
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempServiceImpl.java

@@ -17,12 +17,11 @@ import com.fs.course.service.IFsUserCourseVideoRedPackageService;
 import com.fs.course.utils.TimeCalculator;
 import com.fs.fastGpt.domain.FastGptChatReplaceWords;
 import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
+import com.fs.qw.service.IQwUserService;
 import com.fs.qw.vo.QwSopTempSetting2;
+import com.fs.qw.vo.QwUserVO;
 import com.fs.qw.vo.SortDayVo;
-import com.fs.sop.domain.QwSopTemp;
-import com.fs.sop.domain.QwSopTempContent;
-import com.fs.sop.domain.QwSopTempDay;
-import com.fs.sop.domain.QwSopTempRules;
+import com.fs.sop.domain.*;
 import com.fs.sop.mapper.QwSopTempMapper;
 import com.fs.sop.params.QwSopShareTempParam;
 import com.fs.sop.service.*;
@@ -32,6 +31,7 @@ import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
 import io.netty.util.internal.StringUtil;
 import lombok.AllArgsConstructor;
+import org.apache.commons.beanutils.ConvertUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.stereotype.Service;
@@ -66,6 +66,8 @@ public class QwSopTempServiceImpl implements IQwSopTempService
     private final IFsUserCourseVideoRedPackageService fsUserCourseVideoRedPackageService;
     private final FsUserCourseVideoMapper fsUserCourseVideoMapper;
     private final FsUserCourseMapper fsUserCourseMapper;
+    private final IQwSopService qwSopService;
+    private final IQwUserService qwUserService;
 
 
     /**
@@ -236,6 +238,45 @@ public class QwSopTempServiceImpl implements IQwSopTempService
         reorder(day.getTempId());
         Map<String, Object> map = new HashMap<>();
         map.put("id", day.getId());
+        if(!voiceList.isEmpty()){
+            for (QwSopTempContent qwSopTempContent : voiceList) {
+                String content = qwSopTempContent.getContent();
+                JSONObject jsonObject = JSONObject.parseObject(content);
+                String text = jsonObject.getString("value");
+                List<QwSop> qwSopList = qwSopService.selectQwSopByTempId(tempId);//通过tempId查询出所有sop
+                if(qwSopList != null && !qwSopList.isEmpty()){
+                    for (QwSop qwSop : qwSopList) {
+                        if(qwSop != null && qwSop.getQwUserIds() != null){
+                            //查询出所有的tempContent来筛选文字
+                            List<QwSopTempContent> qwSopTempContentList = qwSopTempContentService.selectQwSopTempContentByTempId(tempId);
+                            if(qwSopTempContentList != null && !qwSopTempContentList.isEmpty()){
+                                for (QwSopTempContent qwSopTemp : qwSopTempContentList) {
+                                    if(qwSopTemp != null && qwSopTemp.getContentType() == 7){
+                                        String[] split = qwSop.getQwUserIds().split(",");
+                                        Long[] qwUserIds = (Long[]) ConvertUtils.convert(split, Long.class);
+                                        List<QwUserVO> qwUserVOS = qwUserService.selectQwUserVOByIds(qwUserIds);
+                                        if(qwUserVOS != null){
+                                            for (QwUserVO qwUserVO : qwUserVOS) {
+                                                Long companyUserId = qwUserVO.getCompanyUserId();
+                                                QwSopTempVoice qwSopTempVoice = qwSopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(companyUserId,text);
+                                                if(qwSopTempVoice == null){
+                                                    QwSopTempVoice sopTempVoice = new QwSopTempVoice();
+                                                    sopTempVoice.setCompanyUserId(companyUserId);
+                                                    sopTempVoice.setVoiceTxt(text);
+                                                    sopTempVoice.setTempId(tempId);
+                                                    sopTempVoice.setRecordType(0);
+                                                    qwSopTempVoiceService.insertQwSopTempVoice(sopTempVoice);
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
         if(!voiceList.isEmpty()){
             rocketMQTemplate.syncSend("voice-generation", JSON.toJSONString(VoiceVo.builder().type(0).id(day.getId().toString()).build()));
         }