|
|
@@ -62,45 +62,34 @@ import com.fs.qw.mapper.*;
|
|
|
import com.fs.qw.param.FsUserCourseRedPageParam;
|
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
|
-import com.fs.qw.vo.SortDayVo;
|
|
|
import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
|
-import com.fs.qwApi.Result.QwGroupChatDetailsResult;
|
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
-import com.fs.sop.domain.QwSopTempDay;
|
|
|
import com.fs.sop.domain.SopUserLogsInfo;
|
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
|
-import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.mapper.SysDictDataMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult;
|
|
|
-import com.google.common.collect.Sets;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
-import org.jetbrains.annotations.NotNull;
|
|
|
import org.redisson.api.RLock;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
-import org.redisson.client.RedisClient;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -140,8 +129,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
ICompanyService companyService;
|
|
|
@Autowired
|
|
|
- private CompanyMoneyLogsMapper moneyLogsMapper;
|
|
|
- @Autowired
|
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
@Autowired
|
|
|
private QwGroupChatMapper qwGroupChatMapper;
|
|
|
@@ -152,8 +139,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
private FsUserCourseCompanyUserTimeMapper companyUserTimeMapper;
|
|
|
@Autowired
|
|
|
- private RocketMQTemplate rocketMQTemplate;
|
|
|
- @Autowired
|
|
|
private FsUserCourseStudyLogMapper courseStudyLogMapper;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -168,9 +153,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
private FsCourseLinkMapper fsCourseLinkMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private AsyncIsAddKfXfkService xfkService;
|
|
|
-
|
|
|
|
|
|
@Autowired
|
|
|
private RedissonClient redissonClient;
|
|
|
@@ -179,8 +161,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
@Autowired
|
|
|
- private FsCourseSopLogsMapper courseSopLogsMapper;
|
|
|
- @Autowired
|
|
|
private QwApiService qwApiService;
|
|
|
@Autowired
|
|
|
private QwUserMapper qwUserMapper;
|
|
|
@@ -196,11 +176,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
private IFsStorePaymentService paymentService;
|
|
|
@Autowired
|
|
|
private FsCourseRedPacketLogMapper redPacketLogMapper;
|
|
|
- @Autowired
|
|
|
- private FsCourseFinishTempMapper fsCourseFinishTempMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private QwSopLogsMapper qwSopLogsMapper;
|
|
|
@Autowired
|
|
|
private FsCourseLinkMapper courseLinkMapper;
|
|
|
@Autowired
|
|
|
@@ -211,8 +187,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
private CompanyUserMapper companyUserMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IFsVideoResourceService fsVideoResourceService;
|
|
|
@Autowired
|
|
|
private FsVideoResourceMapper fsVideoResourceMapper;
|
|
|
|
|
|
@@ -225,8 +199,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
|
private FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private FsUserCompanyUserMapper fsUserCompanyUserMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private IQwExternalContactService qwExternalContactService;
|
|
|
@@ -251,6 +223,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
|
|
|
@Autowired
|
|
|
ConfigUtil configUtil;
|
|
|
+
|
|
|
@Autowired
|
|
|
private FsUserCoursePeriodCompanyMapper periodCompanyMapper;
|
|
|
|
|
|
@@ -492,7 +465,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
//用户不存在唤起重新授权
|
|
|
if (fsUser == null) {
|
|
|
- return R.error(504, "未授权");
|
|
|
+ return R.error(401, "未授权");
|
|
|
}
|
|
|
|
|
|
if (fsUser.getStatus() == 0) {
|
|
|
@@ -513,12 +486,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
// }
|
|
|
// return R.ok();
|
|
|
// }
|
|
|
- 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>";
|
|
|
- //济南联志隐藏二维码
|
|
|
- if ("济南联志健康".equals(signProjectName)) {
|
|
|
- msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为会员独享<br></div>";
|
|
|
- }
|
|
|
+ //未注册提示
|
|
|
+ String noRegisterMsg = "由于您还未完成注册,请联系伴学助手完成注册即可观看!";
|
|
|
+ //非独属链接提示
|
|
|
+ String noMemberMsg = "此链接已被绑定,请联系伴学助手领取您的专属链接,专属链接请勿分享哦!";
|
|
|
// try {
|
|
|
// new Thread(() -> {
|
|
|
// try {
|
|
|
@@ -535,10 +506,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
|
|
|
|
- //服务号授权的,缺mpOpenId的重新登录
|
|
|
- if (config.getMiniAppAuthType() == 2 && StringUtil.strIsNullOrEmpty(fsUser.getMpOpenId())) {
|
|
|
- return R.error(401, "授权后可继续!");
|
|
|
- }
|
|
|
+// //服务号授权的,缺mpOpenId的重新登录 linkType = 4为app看课 不需要mp
|
|
|
+// if (param.getLinkType() != 4 && config.getMiniAppAuthType()==2 && StringUtil.strIsNullOrEmpty(fsUser.getMpOpenId())){
|
|
|
+// return R.error(401,"授权后可继续!");
|
|
|
+// }
|
|
|
|
|
|
boolean oneCompanyCourse = config.isOneCompanyCourse();
|
|
|
if (oneCompanyCourse && fsUser.getQwExtId() != null) {
|
|
|
@@ -563,15 +534,15 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
Integer isRoom = param.getIsRoom();
|
|
|
|
|
|
// 处理逻辑
|
|
|
- if (StringUtils.isNotEmpty(param.getChatId())) {
|
|
|
- return handleQwRoom(param, fsUser);
|
|
|
+ if(StringUtils.isNotEmpty(param.getChatId())){
|
|
|
+ return handleQwRoom(param, fsUser,noRegisterMsg);
|
|
|
}
|
|
|
if (isRoom == null || isRoom == 0) {
|
|
|
// 当 isRoom 为 null 或 0 时走 handleExt
|
|
|
- return handleExt(param, msg, oneCompanyCourse);
|
|
|
+ return handleExt(param,noMemberMsg, oneCompanyCourse);
|
|
|
} else if (isRoom == 1) {
|
|
|
// 当 isRoom 为 1 时走 handleRoom
|
|
|
- return handleRoom(param, fsUser);
|
|
|
+ return handleRoom(param,fsUser,noRegisterMsg);
|
|
|
} else {
|
|
|
// 非法参数
|
|
|
logger.warn("非法参数 isRoom: {}", isRoom);
|
|
|
@@ -579,11 +550,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- private R handleQwRoom(FsUserCourseVideoAddKfUParam param, FsUser user) {
|
|
|
+ private R handleQwRoom(FsUserCourseVideoAddKfUParam param,FsUser user,String noRegisterMsg) {
|
|
|
FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
|
|
|
- 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>";
|
|
|
+// 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>";
|
|
|
QwGroupChat qwGroupChat = qwGroupChatMapper.selectQwGroupChatByChatId(courseLink.getChatId());
|
|
|
if (qwGroupChat == null) {
|
|
|
return R.error("群参数异常");
|
|
|
@@ -594,36 +564,94 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
if (qwGroupChatUsers == null || qwGroupChatUsers.isEmpty()) {
|
|
|
return R.error("群参数异常");
|
|
|
}
|
|
|
- //修改成通过昵称匹配
|
|
|
- QwExternalContact qwExternalContact =
|
|
|
- qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
+ //群聊寻找用户新逻辑
|
|
|
+ QwExternalContact qwExternalContact = null;
|
|
|
+ if (null != param.getUserId() && null == qwExternalContact) {
|
|
|
+ try {
|
|
|
+ qwExternalContact = qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
.eq("user_id", qwGroupChat.getOwner())
|
|
|
- .eq("name", user.getNickName())
|
|
|
+ .eq("fs_user_id", param.getUserId())
|
|
|
.eq("corp_id", param.getCorpId())
|
|
|
.eq("status", 0));
|
|
|
- if (qwExternalContact == null) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("群聊用户id匹配异常,参数user_id:{},fs_user_id:{},corp_id:{}", qwGroupChat.getOwner(), param.getUserId(), param.getCorpId(), e);
|
|
|
+ }
|
|
|
}
|
|
|
- if (qwGroupChatUsers.stream().noneMatch(e -> e.getUserId().equals(qwExternalContact.getExternalUserId()))) {
|
|
|
+ //找当前群中的用户匹配
|
|
|
+ if (StringUtils.isNotBlank(param.getChatId()) && null == qwExternalContact) {
|
|
|
+ List<QwExternalContact> groupChatUserByChatIdAndUserName = qwExternalContactMapper.getGroupChatUserByChatIdAndUserName(qwGroupChat.getOwner(), user.getNickName(), param.getCorpId(), param.getChatId());
|
|
|
+ log.info("群聊用户查询结果,参数user_id:{},name:{},corp_id:{},chatId:{},groupChatUserByChatIdAndUserName:{}", qwGroupChat.getOwner(), user.getNickName(), param.getCorpId(), param.getChatId(), groupChatUserByChatIdAndUserName);
|
|
|
+ //没找到用户 || 找到的用户数量大于1 使用userid查询匹配
|
|
|
+ if (null == groupChatUserByChatIdAndUserName || groupChatUserByChatIdAndUserName.isEmpty() || groupChatUserByChatIdAndUserName.size() > 1) {
|
|
|
+ log.error("群聊用户昵称匹配异常,参数user_id:{},name:{},corp_id:{},chatId:{}", qwGroupChat.getOwner(), user.getNickName(), param.getCorpId(), param.getChatId());
|
|
|
+ } else {
|
|
|
+ qwExternalContact = groupChatUserByChatIdAndUserName.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// QwExternalContact qwExternalContact = qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
+// .eq("user_id", qwGroupChat.getOwner())
|
|
|
+// .eq("fs_user_id", param.getUserId())
|
|
|
+// .eq("corp_id", param.getCorpId())
|
|
|
+// .eq("status",0));
|
|
|
+//
|
|
|
+// if(null == qwExternalContact){
|
|
|
+// try{
|
|
|
+// //修改成通过昵称匹配
|
|
|
+// qwExternalContact =
|
|
|
+// qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
+// .eq("user_id", qwGroupChat.getOwner())
|
|
|
+// .eq("name", user.getNickName())
|
|
|
+// .eq("corp_id", param.getCorpId())
|
|
|
+// .eq("status",0));
|
|
|
+// } catch(Exception e){
|
|
|
+// log.error("群聊用户昵称匹配异常,参数user_id:{},name:{},corp_id:{}",qwGroupChat.getOwner(),user.getNickName(),param.getCorpId(),e);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// QwExternalContact qwExternalContact =
|
|
|
+// qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
+// .eq("user_id", qwGroupChat.getOwner())
|
|
|
+// .eq("fs_user_id", param.getUserId())
|
|
|
+// .eq("corp_id", param.getCorpId())
|
|
|
+// .eq("status",0));
|
|
|
+// if(null == qwExternalContact){
|
|
|
+// try{
|
|
|
+// //修改成通过昵称匹配
|
|
|
+// qwExternalContact =
|
|
|
+// qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
+// .eq("user_id", qwGroupChat.getOwner())
|
|
|
+// .eq("name", user.getNickName())
|
|
|
+// .eq("corp_id", param.getCorpId())
|
|
|
+// .eq("status",0));
|
|
|
+// } catch(Exception e){
|
|
|
+// log.error("群聊用户昵称匹配异常,参数user_id:{},name:{},corp_id:{}",qwGroupChat.getOwner(),user.getNickName(),param.getCorpId(),e);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+ if(qwExternalContact==null){
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
+ }
|
|
|
+ QwExternalContact finalQwExternalContact = qwExternalContact;
|
|
|
+ if (qwGroupChatUsers.stream().noneMatch(e -> e.getUserId().equals(finalQwExternalContact.getExternalUserId()))) {
|
|
|
log.error("客户不在群:{},里面:{}", qwGroupChat.getChatId(), qwExternalContact.getExternalUserId());
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
}
|
|
|
Long qwExternalId = qwExternalContact.getId();
|
|
|
// addCompanyCompanyFsUser(param);
|
|
|
- FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(), param.getQwUserId());
|
|
|
- if (log == null) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(),param.getQwUserId());
|
|
|
+ if (log==null ){
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
}
|
|
|
//判断外部联系人有没有绑定userId
|
|
|
if (qwExternalContact.getFsUserId() != null) {
|
|
|
//有客户有小程序id 但 登录的小程序id和根据外部联系人id查出来的小程序id不一致
|
|
|
if (!qwExternalContact.getFsUserId().equals(param.getUserId())) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
}
|
|
|
List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactByMiniUserId(param.getUserId());
|
|
|
//匹配客户公司id
|
|
|
- if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))){
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
}
|
|
|
|
|
|
//看课记录中userId为0绑定userId
|
|
|
@@ -660,14 +688,16 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
return R.error(567, "群聊通用链接").put("qwExternalId", qwExternalContact.getId());
|
|
|
}
|
|
|
-
|
|
|
- private R handleRoom(FsUserCourseVideoAddKfUParam param, FsUser user) {
|
|
|
+ private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user,String noRegisterMsg) {
|
|
|
//查询客户列表
|
|
|
List<QwExternalContact> contacts = qwExternalContactMapper.selectQwExternalContactListVOByfsUserId(user.getUserId());
|
|
|
- log.info("查出来的企微客户数量:" + contacts.size());
|
|
|
- if (!contacts.isEmpty()) {
|
|
|
+ List<QwExternalContact> nonNullContacts = contacts.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ log.info("查出来的企微客户数量:" + nonNullContacts.size());
|
|
|
+ if (!nonNullContacts.isEmpty()) {
|
|
|
//找出对应销售匹配的客户
|
|
|
- QwExternalContact matchedContact = contacts.stream()
|
|
|
+ QwExternalContact matchedContact = nonNullContacts.stream()
|
|
|
.filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
|
|
|
.findFirst()
|
|
|
.orElse(null);
|
|
|
@@ -683,85 +713,50 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
createWatchLog(param);
|
|
|
}
|
|
|
return R.error(567, "群聊通用链接").put("qwExternalId", matchedContact.getId());
|
|
|
+ } else {
|
|
|
+ QwExternalContact contact = nonNullContacts.get(0);
|
|
|
+ log.info("匹配到的第一个企微用户:" + contact.getUserId());
|
|
|
+ log.info("企微id:" + contact.getId());
|
|
|
+ log.info("用户:" + param.getVideoId());
|
|
|
+ log.info("企微用户:" + param.getQwUserId());
|
|
|
+ param.setQwExternalId(contact.getId());
|
|
|
+ FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(contact.getId(), param.getVideoId(), param.getQwUserId());
|
|
|
+ if (log == null) {
|
|
|
+ createWatchLog(param);
|
|
|
+ }
|
|
|
+ return R.error(567, "群聊通用链接").put("qwExternalId", contact.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("今正科技".equals(cloudHostProper.getCompanyName())) {
|
|
|
+ QwExternalContact UnionEXt = qwExternalContactMapper.selectQwExternalByUnionID(user.getUnionId());
|
|
|
+ if (UnionEXt != null) {
|
|
|
+ log.info("匹配到的第一个企微用户:" + UnionEXt.getUserId());
|
|
|
+ log.info("企微id:" + UnionEXt.getId());
|
|
|
+ log.info("用户:" + param.getVideoId());
|
|
|
+ log.info("企微用户:" + param.getQwUserId());
|
|
|
+ param.setQwExternalId(UnionEXt.getId());
|
|
|
+ FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(UnionEXt.getId(), param.getVideoId(), param.getQwUserId());
|
|
|
+ if (log == null) {
|
|
|
+ param.setUserId(user.getUserId());
|
|
|
+ createWatchLog(param);
|
|
|
+ } else {
|
|
|
+ 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 R.error(567, "群聊通用链接").put("qwExternalId", UnionEXt.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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>";
|
|
|
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ /* 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>";*/
|
|
|
+
|
|
|
+ return R.error(noRegisterMsg);
|
|
|
+
|
|
|
|
|
|
-// 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) {
|
|
|
@@ -811,15 +806,15 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
if (param.getLinkType() != null && param.getLinkType() == 5) {
|
|
|
log = courseWatchLogMapper.selectFsCourseWatchLogByCourseSopIdAndVideoId(param.getUserId(), param.getVideoId(), param.getQwUserId());
|
|
|
if (log == null) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
- } else {
|
|
|
- qwExternalId = log.getQwExternalContactId();
|
|
|
+ return R.error(msg);
|
|
|
+ }else {
|
|
|
+ qwExternalId=log.getQwExternalContactId();
|
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
- log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(), param.getQwUserId());
|
|
|
- if (log == null) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ }else {
|
|
|
+ log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(),param.getQwUserId());
|
|
|
+ if (log==null ){
|
|
|
+ return R.error(msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -836,19 +831,19 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
|
|
|
|
|
|
//如果查不出来客户信息,加好友
|
|
|
- if (externalContact == null) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ if(externalContact==null){
|
|
|
+ return R.error(msg);
|
|
|
}
|
|
|
|
|
|
//判断外部联系人有没有绑定userId
|
|
|
if (externalContact.getFsUserId() != null) {
|
|
|
//有客户有小程序id 但 登录的小程序id和根据外部联系人id查出来的小程序id不一致
|
|
|
if (!externalContact.getFsUserId().equals(param.getUserId())) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ return R.error(msg);
|
|
|
}
|
|
|
//匹配客户公司id
|
|
|
- if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))) {
|
|
|
- return addCustomerService(param.getQwUserId(), msg);
|
|
|
+ if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))){
|
|
|
+ return R.error(msg);
|
|
|
}
|
|
|
|
|
|
//看课记录中userId为0绑定userId
|
|
|
@@ -935,7 +930,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
qwAddContactWayParam.setType(1);
|
|
|
qwAddContactWayParam.setScene(2);
|
|
|
qwAddContactWayParam.setUser(users);
|
|
|
- qwAddContactWayParam.setSkip_verify(true);
|
|
|
+ qwAddContactWayParam.setSkip_verify(false);
|
|
|
QwAddContactWayResult qwAddContactWayResult = qwApiService.addContactWay(qwAddContactWayParam, qwUser.getCorpId());
|
|
|
if (qwAddContactWayResult.getErrcode() == 0) {
|
|
|
qwUser.setContactWay(qwAddContactWayResult.getQr_code());
|
|
|
@@ -1363,10 +1358,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
|
// 判断来源是否是app,如是app,则发放积分奖励
|
|
|
- int sourceApp = 3;
|
|
|
- if (sourceApp == param.getSource()) {
|
|
|
- return sendIntegralReward(param, user, log, config);
|
|
|
- }
|
|
|
+// int sourceApp = 3;
|
|
|
+// if (sourceApp == param.getSource()) {
|
|
|
+// return sendIntegralReward(param, user, log, config);
|
|
|
+// }
|
|
|
|
|
|
// 根据奖励类型发放不同奖励
|
|
|
switch (config.getRewardType()) {
|