zx 1 gün önce
ebeveyn
işleme
4256524596

+ 23 - 27
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -438,35 +438,24 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
     }
 
     private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
-//        //查询客户列表
+        //查询客户列表
 //        List<QwExternalContact> contacts = qwExternalContactMapper.selectQwExternalContactListVOByfsUserId(user.getUserId());
-//        if (contacts.isEmpty()){
-//            return R.error("未注册");
-//        }
-//        //找出对应销售匹配的客户
-//        QwExternalContact matchedContact = contacts.stream()
-//                .filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
-//                .findFirst()
-//                .orElse(null);
-//
-//        if (matchedContact==null){
-//            return R.error("无权限观看,未添加本群主");
-//        }
-//
-//        param.setQwExternalId(matchedContact.getId());
-////        //查询是否有添加客服
-////        QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(param.getQwExternalId());
-////        if (externalContact==null){
-////            return R.error("客户不存在!");
-////        }
-////        if (!externalContact.getQwUserId().equals(param.getUserId())){
-////            return R.error("无权限观看,添加群主非本群主");
-////        }
-//        FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId());
-//        if (log==null){
-//            createWatchLog(param);
+//        if (!contacts.isEmpty()){
+//            //找出对应销售匹配的客户
+//            QwExternalContact matchedContact = contacts.stream()
+//                    .filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
+//                    .findFirst()
+//                    .orElse(null);
+//            if (matchedContact!=null){
+//                param.setQwExternalId(matchedContact.getId());
+//                FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId());
+//                if (log==null){
+//                    createWatchLog(param);
+//                }
+//                return R.ok().put("qwExternalId",matchedContact.getId());
+//            }
 //        }
-//        return R.ok().put("qwExternalId",matchedContact.getId());
+
         FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
         System.out.println("查询的链接参数"+courseLink);
         String msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为群会员独享<br>请长按二维码</div>\n" +
@@ -479,15 +468,19 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         }
         List<QwGroupChatDetailsResult.Member> collect = result.getGroupChat().getMemberList().stream().filter(e -> e.getType() == 2).collect(Collectors.toList());
         if(collect.isEmpty()){
+            logger.info("群聊里面为空弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId());
             return addCustomerService(param.getQwUserId(),msg);
         }
         Optional<QwGroupChatDetailsResult.Member> optional = collect.stream().filter(e -> e.getName().equals(user.getNickName()) || e.getName().equals(param.getNickName())).findFirst();
         if(!optional.isPresent()){
+            logger.info("昵称未匹配上弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId());
+
             return addCustomerService(param.getQwUserId(),msg);
         }
         QwGroupChatDetailsResult.Member member = optional.get();
         QwExternalContact qwExternalContact = qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>().eq("user_id", result.getGroupChat().getOwner()).eq("external_user_id", member.getUserId()));
         if(qwExternalContact==null){
+            logger.info("外部联系人为空弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId()+":"+member.getUserId()+param.getNickName());
             return addCustomerService(param.getQwUserId(),msg);
         }
         Long qwExternalId = qwExternalContact.getId();
@@ -495,17 +488,20 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 //        addCompanyCompanyFsUser(param);
         FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(),param.getQwUserId());
         if (log==null ){
+            logger.info("看课记录为空弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId()+qwExternalId+":"+param.getVideoId()+":"+param.getQwUserId());
             return addCustomerService(param.getQwUserId(),msg);
         }
         //判断外部联系人有没有绑定userId
         if (qwExternalContact.getFsUserId()!=null){
             //有客户有小程序id  但 登录的小程序id和根据外部联系人id查出来的小程序id不一致
             if (!qwExternalContact.getFsUserId().equals(param.getUserId())) {
+                logger.info("小程序id不一致空弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId());
                 return addCustomerService(param.getQwUserId(),msg);
             }
             List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactByMiniUserId(param.getUserId());
             //匹配客户公司id
             if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))){
+                logger.info("未匹配上公司空弹二维码:"+param.getCorpId()+":"+param.getQwUserId()+":"+param.getChatId()+":"+param.getUserId());
                 return addCustomerService(param.getQwUserId(),msg);
             }