zx 1 周之前
父节点
当前提交
7f132b0181

+ 21 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwExternalContactController.java

@@ -230,7 +230,25 @@ public class QwExternalContactController extends BaseController
         if (qwExternalContact.getCorpId()==null){
             return AjaxResult.success();
         }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        qwExternalContact.setCompanyId(loginUser.getCompany().getCompanyId());
         List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
+        list.forEach(item->{
+
+            if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds()!=null) {
+                QwTagSearchParam param = new QwTagSearchParam();
+                Gson gson = new Gson();
+                List<String> tagIds = gson.fromJson(
+                        item.getTagIds(),
+                        new TypeToken<List<String>>() {
+                        }.getType()
+                );
+
+                param.setTagIds(tagIds);
+
+                item.setTagIdsName(iQwTagService.selectQwTagListByTagIds(param));
+            }
+        });
         ExcelUtil<QwExternalContactVO> util = new ExcelUtil<QwExternalContactVO>(QwExternalContactVO.class);
         return util.exportExcel(list, "企业微信客户数据");
     }
@@ -244,6 +262,9 @@ public class QwExternalContactController extends BaseController
         if (qwExternalContact.getQwUserId()==null){
             return AjaxResult.success();
         }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        qwExternalContact.setCompanyId(loginUser.getCompany().getCompanyId());
+
         List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
 
         list.forEach(item->{

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

@@ -462,82 +462,82 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             }
         }
 
-        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" +
                 "\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
-        System.out.println("企微传参:"+courseLink.getChatId()+"corpId:"+param.getCorpId());
-        QwGroupChatDetailsResult result = qwApiService.groupChatDetails(courseLink.getChatId(), param.getCorpId());
-        if(result.getErrCode() != 0){
-            log.info("企微接口请求失败,请联系管理员:" +result.getErrMsg());
-            return R.error("不是此群成员");
-        }
-        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();
-        log.info("外部联系人数据:{}", qwExternalContact);
-//        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);
-            }
-
-            //看课记录中userId为0绑定userId
-            if (log.getUserId()==null||log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())){
-                log.setUserId(param.getUserId());
-            }
 
-            log.setUpdateTime(new Date());
-            courseWatchLogMapper.updateFsCourseWatchLog(log);
+        return addCustomerService(param.getQwUserId(),msg);
 
-            iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
-        }else {
-            //没绑定fsUser直接绑定fsUser
-            QwExternalContact contact = new QwExternalContact();
-            contact.setId(qwExternalId);
-            contact.setFsUserId(param.getUserId());
-            qwExternalContactMapper.updateQwExternalContact(contact);
-            FsUser fsUser = new FsUser();
-            fsUser.setUserId(user.getUserId());
-            fsUser.setIsAddQw(1);
-            fsUserMapper.updateFsUser(fsUser);
-            //绑定上之后 更新观看记录
-            //看课记录中userId为0绑定userId
-            log.setUserId(param.getUserId());
-            log.setUpdateTime(new Date());
-            courseWatchLogMapper.updateFsCourseWatchLog(log);
-        }
-
-        return R.error(567,"群聊通用链接").put("qwExternalId", qwExternalContact.getId());
+//        QwGroupChatDetailsResult result = qwApiService.groupChatDetails(courseLink.getChatId(), param.getCorpId());
+//        if(result.getErrCode() != 0){
+//            log.info("企微接口请求失败,请联系管理员:" +result.getErrMsg());
+//            return R.error("不是此群成员");
+//        }
+//        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();
+//        log.info("外部联系人数据:{}", qwExternalContact);
+////        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);
+//            }
+//
+//            //看课记录中userId为0绑定userId
+//            if (log.getUserId()==null||log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())){
+//                log.setUserId(param.getUserId());
+//            }
+//
+//            log.setUpdateTime(new Date());
+//            courseWatchLogMapper.updateFsCourseWatchLog(log);
+//
+//            iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
+//        }else {
+//            //没绑定fsUser直接绑定fsUser
+//            QwExternalContact contact = new QwExternalContact();
+//            contact.setId(qwExternalId);
+//            contact.setFsUserId(param.getUserId());
+//            qwExternalContactMapper.updateQwExternalContact(contact);
+//            FsUser fsUser = new FsUser();
+//            fsUser.setUserId(user.getUserId());
+//            fsUser.setIsAddQw(1);
+//            fsUserMapper.updateFsUser(fsUser);
+//            //绑定上之后 更新观看记录
+//            //看课记录中userId为0绑定userId
+//            log.setUserId(param.getUserId());
+//            log.setUpdateTime(new Date());
+//            courseWatchLogMapper.updateFsCourseWatchLog(log);
+//        }
+//
+//        return R.error(567,"群聊通用链接").put("qwExternalId", qwExternalContact.getId());
     }
 
     private void createWatchLog(FsUserCourseVideoAddKfUParam param) {