Ver código fonte

新客对话

三七 1 semana atrás
pai
commit
238d893714

+ 52 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -104,6 +104,9 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 
     private static final String miniappRealLink = "/pages_course/video.html?course=";
 
+    @Autowired
+    private AsyncQwAiChatSopService asyncQwAiChatSopService;
+
     @Autowired
     private QwExternalContactMapper qwExternalContactMapper;
     @Autowired
@@ -2793,6 +2796,14 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                     //SOP规则
                     qwSopRuleTimeTools(qwSopRuleTimeVOS,userID,qwUser,corpId,externalUserID,externalContact.getName(),contact,currentDate,localTime,combinedTagsList);
                 }
+
+                //新客对话任务
+                Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                if (!sopAiChatByRedis){
+                    asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags,userID,qwUser,externalUserID
+                            ,externalContact.getName(),contact.getId(),contact.getFsUserId(),currentDate,localTime);
+                }
+
                 //aiSop任务
 //                List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()){
@@ -3242,6 +3253,13 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                     //SOP规则
                     qwSopRuleTimeTools(qwSopRuleTimeVOS,contact.getUserId(),qwUser,contact.getCorpId(),contact.getExternalUserId(),contact.getName(),contact,currentDate,localTime,combinedTagsList);
                 }
+
+                //新客对话任务
+                Boolean sopAiChatByRedis = getSopAiChatByRedis(qwUser.getQwUserId(), qwUser.getCorpId(), contact.getExternalUserId());
+                if (!sopAiChatByRedis) {
+                    asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, qwUser.getQwUserId(), qwUser, contact.getExternalUserId(), contact.getName(), contact.getId(), contact.getFsUserId(), currentDate, localTime);
+                }
+
 //                //aiSop任务
 //                List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()){
@@ -5023,6 +5041,11 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                 //SOP规则
                                                 qwSopRuleTimeTools(qwSopRuleTimeVOS, qwUserId, qwUser, corpId, ext, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                             }
+
+                                            Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                            if (!sopAiChatByRedis) {
+                                                asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                            }
                                             //aiSop任务
 //                                            List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                                            if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()) {
@@ -5061,6 +5084,12 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                 //SOP规则
                                                 qwSopRuleTimeTools(qwSopRuleTimeVOS, userID, qwUser, corpId, externalUserID, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                             }
+
+                                            Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                            if (!sopAiChatByRedis) {
+                                                asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                            }
+
 //                                            //aiSop任务
 //                                            logger.info("/n 传参:" + qwSopAutoByTags);
 //                                            List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
@@ -5095,6 +5124,12 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                 //SOP规则
                                                 qwSopRuleTimeTools(qwSopRuleTimeVOS, userID, qwUser, corpId, externalUserID, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                             }
+
+                                            Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                            if (!sopAiChatByRedis) {
+                                                asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                            }
+
 //                                            //aiSop任务
 //                                            List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                                            if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()) {
@@ -5312,6 +5347,12 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                         //SOP规则
                                                         qwSopRuleTimeTools(qwSopRuleTimeVOS, qwUserId, qwUser, corpId, ext, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                                     }
+
+                                                    Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                                    if (!sopAiChatByRedis) {
+                                                        asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                                    }
+
                                                     //aiSop任务
 //                                                    List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                                                    if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()) {
@@ -5343,6 +5384,11 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                         //SOP规则
                                                         qwSopRuleTimeTools(qwSopRuleTimeVOS, userID, qwUser, corpId, externalUserID, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                                     }
+
+                                                    Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                                    if (!sopAiChatByRedis) {
+                                                        asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                                    }
                                                     //aiSop任务
 //                                                    List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                                                    if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()) {
@@ -5370,6 +5416,12 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                                         //SOP规则
                                                         qwSopRuleTimeTools(qwSopRuleTimeVOS, userID, qwUser, corpId, externalUserID, externalContact.getName(), contact, currentDate, localTime, combinedTagsList);
                                                     }
+
+                                                    Boolean sopAiChatByRedis = getSopAiChatByRedis(userID, corpId, externalUserID);
+                                                    if (!sopAiChatByRedis) {
+                                                        asyncQwAiChatSopService.executeQwAiChatSop(qwSopAutoByTags, userID, qwUser, externalUserID, externalContact.getName(), qwExternalContact.getId(), qwExternalContact.getFsUserId(), currentDate, localTime);
+                                                    }
+
                                                     //aiSop任务
 //                                                    List<QwSopRuleTimeVO> qwSopAiRuleTimeVOS = qwSopMapper.selectQwAiSopAutoByTagsByForeach(qwSopAutoByTags);
 //                                                    if (qwSopAiRuleTimeVOS != null && !qwSopAiRuleTimeVOS.isEmpty()) {