|
@@ -32,6 +32,7 @@ import com.fs.course.dto.CoursePackageDTO;
|
|
|
import com.fs.course.mapper.*;
|
|
import com.fs.course.mapper.*;
|
|
|
import com.fs.course.param.*;
|
|
import com.fs.course.param.*;
|
|
|
import com.fs.course.param.newfs.*;
|
|
import com.fs.course.param.newfs.*;
|
|
|
|
|
+import com.fs.course.service.IFsUserCompanyBindService;
|
|
|
import com.fs.course.service.IFsUserCompanyUserService;
|
|
import com.fs.course.service.IFsUserCompanyUserService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.service.IFsVideoResourceService;
|
|
import com.fs.course.service.IFsVideoResourceService;
|
|
@@ -48,10 +49,10 @@ import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.service.IFsUserWxService;
|
|
import com.fs.his.service.IFsUserWxService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
-import com.fs.qw.domain.QwCompany;
|
|
|
|
|
-import com.fs.qw.domain.QwExternalContact;
|
|
|
|
|
-import com.fs.qw.domain.QwUser;
|
|
|
|
|
|
|
+import com.fs.qw.domain.*;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
|
|
+import com.fs.qw.mapper.QwGroupChatMapper;
|
|
|
|
|
+import com.fs.qw.mapper.QwGroupChatUserMapper;
|
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
@@ -59,6 +60,7 @@ import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
|
import com.fs.qwApi.Result.QwGroupChatDetailsResult;
|
|
import com.fs.qwApi.Result.QwGroupChatDetailsResult;
|
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
|
|
+import com.fs.sop.domain.SopUserLogsInfo;
|
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
@@ -130,6 +132,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private QwGroupChatMapper qwGroupChatMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QwGroupChatUserMapper qwGroupChatUserMapper;
|
|
|
|
|
+ @Autowired
|
|
|
private IFsUserService fsUserService;
|
|
private IFsUserService fsUserService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsUserCourseCompanyUserTimeMapper companyUserTimeMapper;
|
|
private FsUserCourseCompanyUserTimeMapper companyUserTimeMapper;
|
|
@@ -236,6 +242,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
@Autowired
|
|
@Autowired
|
|
|
ConfigUtil configUtil;
|
|
ConfigUtil configUtil;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsUserCompanyBindService fsUserCompanyBindService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -505,36 +514,27 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
|
|
FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
|
|
|
String msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为群会员独享<br>请长按二维码</div>\n" +
|
|
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>";
|
|
"\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
|
|
|
- QwGroupChatDetailsResult result = qwApiService.groupChatDetails(courseLink.getChatId(), param.getCorpId());
|
|
|
|
|
- log.info("群聊参数:{},链接参数:{}, 企微返回:{}", JSON.toJSONString(param), JSON.toJSONString(courseLink), JSON.toJSONString(result));
|
|
|
|
|
- if(result.getErrCode() != 0){
|
|
|
|
|
- return R.error("企微接口请求失败,请联系管理员:" +result.getErrMsg());
|
|
|
|
|
|
|
+ QwGroupChat qwGroupChat = qwGroupChatMapper.selectQwGroupChatByChatId(courseLink.getChatId());
|
|
|
|
|
+ if(qwGroupChat == null){
|
|
|
|
|
+ return R.error("群参数异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ SopUserLogsInfo sopUserLogsInfo = new SopUserLogsInfo();
|
|
|
|
|
+ sopUserLogsInfo.setChatId(courseLink.getChatId());
|
|
|
|
|
+ List<QwGroupChatUser> qwGroupChatUsers = qwGroupChatUserMapper.selectByChatId(sopUserLogsInfo);
|
|
|
|
|
+ if(qwGroupChatUsers == null || qwGroupChatUsers.isEmpty()){
|
|
|
|
|
+ return R.error("群参数异常");
|
|
|
}
|
|
}
|
|
|
-// List<QwGroupChatDetailsResult.Member> collect = result.getGroupChat().getMemberList().stream().filter(e -> e.getType() == 2).collect(Collectors.toList());
|
|
|
|
|
-// if(collect.isEmpty()){
|
|
|
|
|
-// return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
|
-// }
|
|
|
|
|
-// Optional<QwGroupChatDetailsResult.Member> optional = collect.stream().filter(e -> e.getName().equals(fsUser.getNickName()) || e.getName().equals(param.getNickName())).findFirst();
|
|
|
|
|
-// if(!optional.isPresent()){
|
|
|
|
|
-// 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())
|
|
|
|
|
-// );
|
|
|
|
|
QwExternalContact qwExternalContact =
|
|
QwExternalContact qwExternalContact =
|
|
|
qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
- .eq("user_id", result.getGroupChat().getOwner())
|
|
|
|
|
|
|
+ .eq("user_id", qwGroupChat.getOwner())
|
|
|
.eq("fs_user_id", param.getUserId())
|
|
.eq("fs_user_id", param.getUserId())
|
|
|
.eq("corp_id", param.getCorpId())
|
|
.eq("corp_id", param.getCorpId())
|
|
|
.eq("status",0));
|
|
.eq("status",0));
|
|
|
if(qwExternalContact==null){
|
|
if(qwExternalContact==null){
|
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
|
}
|
|
}
|
|
|
- log.info("外部联系人数据:{}", qwExternalContact);
|
|
|
|
|
- if(result.getGroupChat().getMemberList().stream().noneMatch(e -> e.getUserId().equals(qwExternalContact.getExternalUserId()))){
|
|
|
|
|
|
|
+ if(qwGroupChatUsers.stream().noneMatch(e -> e.getUserId().equals(qwExternalContact.getExternalUserId()))){
|
|
|
|
|
+ log.error("客户不在群:{},里面:{}", qwGroupChat.getChatId(), qwExternalContact.getExternalUserId());
|
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
|
}
|
|
}
|
|
|
Long qwExternalId = qwExternalContact.getId();
|
|
Long qwExternalId = qwExternalContact.getId();
|
|
@@ -561,7 +561,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
log.setUpdateTime(new Date());
|
|
log.setUpdateTime(new Date());
|
|
|
-// fsUserCompanyBindService.bindFsUser(fsUser.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
|
|
|
|
}else {
|
|
}else {
|
|
@@ -580,7 +581,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
log.setUpdateTime(new Date());
|
|
log.setUpdateTime(new Date());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
}
|
|
}
|
|
|
-// fsUserCompanyBindService.bindFsUser(fsUser.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
return R.error(567,"群聊通用链接").put("qwExternalId", qwExternalContact.getId());
|
|
return R.error(567,"群聊通用链接").put("qwExternalId", qwExternalContact.getId());
|
|
|
}
|
|
}
|
|
|
private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
|
|
private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
|
|
@@ -702,27 +704,28 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private R handleExt(FsUserCourseVideoAddKfUParam param, String msg, boolean oneCompanyCourse){
|
|
private R handleExt(FsUserCourseVideoAddKfUParam param, String msg, boolean oneCompanyCourse){
|
|
|
- if (param.getLinkType()!=null&¶m.getLinkType()==1){
|
|
|
|
|
- if (param.getLinkId()!=null){
|
|
|
|
|
- // 从数据库中查找短链对应的真实链接
|
|
|
|
|
- FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLinkId(param.getLinkId());
|
|
|
|
|
- if (courseLink != null) {
|
|
|
|
|
- // 获取当前时间
|
|
|
|
|
- Date currentTime = new Date();
|
|
|
|
|
- // 获取链接的更新时间(假设这个字段代表过期时间)
|
|
|
|
|
- Date updateTime = courseLink.getUpdateTime();
|
|
|
|
|
-
|
|
|
|
|
- // 判断是否过期
|
|
|
|
|
- if (currentTime.after(updateTime)) {
|
|
|
|
|
- // 链接已过期
|
|
|
|
|
- return R.error("链接已过期");
|
|
|
|
|
- }else {
|
|
|
|
|
- return R.ok();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return R.error("链接过期");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //暂时注释应急短链逻辑
|
|
|
|
|
+// if (param.getLinkType()!=null&¶m.getLinkType()==1){
|
|
|
|
|
+// if (param.getLinkId()!=null){
|
|
|
|
|
+// // 从数据库中查找短链对应的真实链接
|
|
|
|
|
+// FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLinkId(param.getLinkId());
|
|
|
|
|
+// if (courseLink != null) {
|
|
|
|
|
+// // 获取当前时间
|
|
|
|
|
+// Date currentTime = new Date();
|
|
|
|
|
+// // 获取链接的更新时间(假设这个字段代表过期时间)
|
|
|
|
|
+// Date updateTime = courseLink.getUpdateTime();
|
|
|
|
|
+//
|
|
|
|
|
+// // 判断是否过期
|
|
|
|
|
+// if (currentTime.after(updateTime)) {
|
|
|
|
|
+// // 链接已过期
|
|
|
|
|
+// return R.error("链接已过期");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// return R.ok();
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return R.error("链接过期");
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
Long qwExternalId = param.getQwExternalId();
|
|
Long qwExternalId = param.getQwExternalId();
|
|
|
|
|
|
|
@@ -782,6 +785,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
|
|
iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
|
|
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if (param.getLinkType()!=null&¶m.getLinkType()==5){
|
|
if (param.getLinkType()!=null&¶m.getLinkType()==5){
|
|
|
FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId);
|
|
FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId);
|
|
@@ -806,25 +813,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
user.setQwExtId(param.getQwExternalId());
|
|
user.setQwExtId(param.getQwExternalId());
|
|
|
fsUserMapper.updateFsUser(user);
|
|
fsUserMapper.updateFsUser(user);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-// //小访客特有
|
|
|
|
|
-// SendXfkParam xfkParam=new SendXfkParam();
|
|
|
|
|
-// xfkParam.setCorpId(externalContact.getCorpId());
|
|
|
|
|
-// xfkParam.setUserId(externalContact.getUserId());
|
|
|
|
|
-// xfkParam.setName(externalContact.getName());
|
|
|
|
|
-// xfkParam.setAddWay(externalContact.getAddWay());
|
|
|
|
|
-// xfkParam.setState(externalContact.getState());
|
|
|
|
|
-// if (externalContact.getCreateTime()!=null){
|
|
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-// String formattedTime = sdf.format(externalContact.getCreateTime());
|
|
|
|
|
-// xfkParam.setCreateTime(formattedTime);
|
|
|
|
|
-// }else {
|
|
|
|
|
-// xfkParam.setCreateTime("");
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// xfkService.executeSopByIds(xfkParam);
|
|
|
|
|
-
|
|
|
|
|
iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
|
|
|
|
|
|
//绑定上之后 更新观看记录
|
|
//绑定上之后 更新观看记录
|
|
@@ -836,6 +824,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
log.setUpdateTime(new Date());
|
|
log.setUpdateTime(new Date());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (param.getLinkType()!=null&¶m.getLinkType()==5){
|
|
if (param.getLinkType()!=null&¶m.getLinkType()==5){
|
|
|
FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId);
|
|
FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId);
|
|
|
return R.error(566,"官方群发通用链接").put("courseLink",fsCourseLink);
|
|
return R.error(566,"官方群发通用链接").put("courseLink",fsCourseLink);
|