|
|
@@ -42,6 +42,7 @@ import com.fs.course.param.newfs.FsUserCourseAddCompanyUserParam;
|
|
|
import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
|
|
|
import com.fs.course.param.newfs.FsUserCourseVideoUParam;
|
|
|
import com.fs.course.param.newfs.UserCourseVideoPageParam;
|
|
|
+import com.fs.course.service.IFsCourseLinkService;
|
|
|
import com.fs.course.service.IFsUserCompanyBindService;
|
|
|
import com.fs.course.service.IFsUserCompanyUserService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
@@ -259,6 +260,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFsCourseLinkService linkService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询课堂视频
|
|
|
@@ -977,26 +981,46 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
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());
|
|
|
+
|
|
|
+ boolean bool1 = "今正科技".equals(cloudHostProper.getCompanyName());
|
|
|
+ boolean bool2 = "弘珍医药".equals(cloudHostProper.getCompanyName());
|
|
|
+ if (bool1 || bool2) {
|
|
|
+ //一个都找不到
|
|
|
+ List<QwExternalContact> qwExternalContactList = qwExternalContactMapper.selectQwExternalByUnionID(user.getUnionId());
|
|
|
+
|
|
|
+ if (qwExternalContactList != null && !qwExternalContactList.isEmpty()) {
|
|
|
+ QwExternalContact UnionEXt = qwExternalContactList.get(0);
|
|
|
+ for (QwExternalContact qwExternalContact : qwExternalContactList) {
|
|
|
+ if (qwExternalContact.getFsUserId() == null || qwExternalContact.getFsUserId() != 0L) {
|
|
|
+ qwExternalContact.setFsUserId(user.getUserId());
|
|
|
+ qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
|
|
|
}
|
|
|
- log.setUpdateTime(new Date());
|
|
|
- courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
+ try {
|
|
|
+ if (qwExternalContact.getQwUserId().equals(Long.parseLong(param.getQwUserId()))) {
|
|
|
+ UnionEXt = qwExternalContact;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("群聊链接匹配销售失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ 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());
|
|
|
}
|
|
|
- return R.error(567, "群聊通用链接").put("qwExternalId", UnionEXt.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -4205,6 +4229,37 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R createRoomMiniLinkByCourse(FsCourseLinkRoomNewParam param) {
|
|
|
+
|
|
|
+ QwUser qwUser = qwUserMapper.selectQwUserById(param.getQwUserId());
|
|
|
+
|
|
|
+ if (qwUser == null || qwUser.getCompanyId() == null || qwUser.getCompanyUserId() == null) {
|
|
|
+ return R.error("员工未绑定 销售公司 或 销售 请先绑定");
|
|
|
+ }
|
|
|
+
|
|
|
+ QwCompany qwCompany = iQwCompanyService.getQwCompanyByRedis(param.getCorpId());
|
|
|
+
|
|
|
+ if (qwCompany == null) {
|
|
|
+ return R.error().put("msg", "企业不存在,请联系管理员");
|
|
|
+ }
|
|
|
+ if (qwCompany.getMiniAppId() == null) {
|
|
|
+ return R.error().put("msg", "当前企业未绑定小程序,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成小程序链接
|
|
|
+ String linkByMiniApp = createLinkByMiniApp(new Date(), param.getCourseId(), param.getVideoId(), qwUser, null, 2, null, 1);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(linkByMiniApp)){
|
|
|
+ linkByMiniApp = linkByMiniApp.replaceAll(".html", "");
|
|
|
+ }
|
|
|
+ String link = linkService.getGotoWxAppLink(linkByMiniApp, qwCompany.getMiniAppId());
|
|
|
+
|
|
|
+ System.out.println("生成课程通链: " + link + " :" + param);
|
|
|
+
|
|
|
+ return R.ok().put("link", link);
|
|
|
+ }
|
|
|
+
|
|
|
private final ExecutorService uploadExecutor = new ThreadPoolExecutor(
|
|
|
8, // core
|
|
|
16, // max
|