|
@@ -71,6 +71,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.*;
|
|
import java.util.concurrent.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import static com.fs.course.utils.LinkUtil.generateRandomNumberWithLock;
|
|
|
|
|
|
|
|
import static com.fs.course.utils.LinkUtil.generateRandomStringWithLock;
|
|
import static com.fs.course.utils.LinkUtil.generateRandomStringWithLock;
|
|
|
|
|
|
|
@@ -87,6 +88,8 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
private static final String h5miniappLink = "/pages_course/shortLink.html?s=";
|
|
private static final String h5miniappLink = "/pages_course/shortLink.html?s=";
|
|
|
private static final String appActivitlLink = "/pages_course/activity.html?link=";
|
|
private static final String appActivitlLink = "/pages_course/activity.html?link=";
|
|
|
private static final String registeredRealLink = "/pages_course/register.html?link=";
|
|
private static final String registeredRealLink = "/pages_course/register.html?link=";
|
|
|
|
|
+ private static final String h5LiveShortLink = "/pages_course/livingInvite.html?s=";
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// private static final String miniappRealLink = "/pages/index/index?course=";
|
|
// private static final String miniappRealLink = "/pages/index/index?course=";
|
|
|
|
|
|
|
@@ -765,6 +768,10 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(logVo.getChatId())) {
|
|
if (StringUtils.isNotEmpty(logVo.getChatId())) {
|
|
|
QwGroupChat groupChat = groupChatMap.get(logVo.getChatId());
|
|
QwGroupChat groupChat = groupChatMap.get(logVo.getChatId());
|
|
|
|
|
+ if (groupChat == null) {
|
|
|
|
|
+ log.warn("群聊 {} 不存在,跳过处理。", logVo.getChatId());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (groupChat.getChatUserList() != null && !groupChat.getChatUserList().isEmpty()) {
|
|
if (groupChat.getChatUserList() != null && !groupChat.getChatUserList().isEmpty()) {
|
|
|
QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, null,null);
|
|
QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, null,null);
|
|
|
ruleTimeVO.setSendType(6);
|
|
ruleTimeVO.setSendType(6);
|
|
@@ -971,7 +978,6 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}
|
|
}
|
|
|
// 顺序处理每个 Setting,避免过多的并行导致线程开销
|
|
// 顺序处理每个 Setting,避免过多的并行导致线程开销
|
|
|
String json = configService.selectConfigByKey("his.config");
|
|
String json = configService.selectConfigByKey("his.config");
|
|
|
- FSSysConfig sysConfig = JSON.parseObject(json, FSSysConfig.class);
|
|
|
|
|
for (QwSopTempSetting.Content.Setting setting : settings) {
|
|
for (QwSopTempSetting.Content.Setting setting : settings) {
|
|
|
switch (setting.getContentType()) {
|
|
switch (setting.getContentType()) {
|
|
|
//直播小程序单独
|
|
//直播小程序单独
|
|
@@ -980,8 +986,9 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
sopLogs.setSendType(20);
|
|
sopLogs.setSendType(20);
|
|
|
clonedContent.setLiveId(setting.getLiveId());
|
|
clonedContent.setLiveId(setting.getLiveId());
|
|
|
String sortLiveLink;
|
|
String sortLiveLink;
|
|
|
- sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId() + "&corpId=" + logVo.getCorpId()+"&qwUserId=" + qwUserId;
|
|
|
|
|
- if (isGroupChat) {
|
|
|
|
|
|
|
+ sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId() + "&corpId=" + logVo.getCorpId() + "&qwUserId=" + qwUserId;
|
|
|
|
|
+ FSSysConfig sysConfig = JSON.parseObject(json, FSSysConfig.class);
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
try {
|
|
try {
|
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
@@ -1111,11 +1118,12 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
// 8. 获取小程序ID
|
|
// 8. 获取小程序ID
|
|
|
String finalAppId = null;
|
|
String finalAppId = null;
|
|
|
Company company = companyMapper.selectCompanyById(Long.valueOf(companyId));
|
|
Company company = companyMapper.selectCompanyById(Long.valueOf(companyId));
|
|
|
- List<String> miniAppMaster = company.getMiniAppMaster();
|
|
|
|
|
|
|
+ List<String> miniAppMaster = company != null ? company.getMiniAppMaster() : null;
|
|
|
if (ObjectUtil.isNotEmpty(miniAppMaster)) {
|
|
if (ObjectUtil.isNotEmpty(miniAppMaster)) {
|
|
|
finalAppId = miniAppMaster.get(0);
|
|
finalAppId = miniAppMaster.get(0);
|
|
|
} else {
|
|
} else {
|
|
|
- finalAppId = sysConfig.getAppId();
|
|
|
|
|
|
|
+ FSSysConfig luckyBagSysConfig = JSON.parseObject(json, FSSysConfig.class);
|
|
|
|
|
+ finalAppId = luckyBagSysConfig != null ? luckyBagSysConfig.getAppId() : null;
|
|
|
}
|
|
}
|
|
|
// try {
|
|
// try {
|
|
|
// finalAppId = getAppIdFromMiniMap(miniMap, companyId, sendMsgType, grade);
|
|
// finalAppId = getAppIdFromMiniMap(miniMap, companyId, sendMsgType, grade);
|
|
@@ -1148,6 +1156,69 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
+ //直播h5跳转卡片
|
|
|
|
|
+ case "18":
|
|
|
|
|
+ //直播h5跳转短链
|
|
|
|
|
+ case "19": {
|
|
|
|
|
+ String corpId = logVo.getCorpId();
|
|
|
|
|
+ String shortH5Link = createH5LiveShortLink(setting, corpId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId);
|
|
|
|
|
+ shortH5Link = shortH5Link.substring(0, shortH5Link.length() - 1);
|
|
|
|
|
+
|
|
|
|
|
+ sopLogs.setSendType(Integer.valueOf(setting.getContentType()));
|
|
|
|
|
+ clonedContent.setLiveId(setting.getLiveId());
|
|
|
|
|
+ FSSysConfig h5LiveSysConfig = JSON.parseObject(configService.selectConfigByKey("his.config"), FSSysConfig.class);
|
|
|
|
|
+
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
|
|
+ Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
|
|
|
+ GroupUserExternalVo vo = userMap.get(groupChat.getOwner());
|
|
|
|
|
+ if (vo != null && vo.getId() != null) {
|
|
|
|
|
+ sopLogs.setFsUserId(vo.getFsUserId());
|
|
|
|
|
+ //写入直播待看课记录
|
|
|
|
|
+ createLiveWatchLogAndEnQueue(companyId, companyUserId, vo.getId().toString(), setting.getLiveId(), h5LiveSysConfig.getAppId(), 2, qwUserId, logVo.getCorpId());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ shortH5Link += ",\"chatId\":\"" + groupChat.getChatId() + "\"";
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("直播H5群聊新增报错,{}", e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ try {
|
|
|
|
|
+ createLiveWatchLogAndEnQueue(companyId, companyUserId, externalId, setting.getLiveId(), h5LiveSysConfig.getAppId(), 1, qwUserId, logVo.getCorpId());
|
|
|
|
|
+ shortH5Link += ",\"externalId\":\"" + externalId + "\"";
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("直播H5个人新增报错,{}", e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ shortH5Link += "}";
|
|
|
|
|
+ String h5LiveTitle = setting.getMiniprogramTitle();
|
|
|
|
|
+ int h5LiveTitleMaxLength = 17;
|
|
|
|
|
+ setting.setMiniprogramTitle(h5LiveTitle.length() > h5LiveTitleMaxLength ? h5LiveTitle.substring(0, h5LiveTitleMaxLength) + "..." : h5LiveTitle);
|
|
|
|
|
+ setting.setMiniprogramAppid(h5LiveSysConfig.getAppId());
|
|
|
|
|
+ setting.setMiniprogramPage(shortH5Link);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ setting.setMiniprogramPicUrl(StringUtil.strIsNullOrEmpty(setting.getMiniprogramPicUrl()) ? "https://cos.his.cdwjyyh.com/fs/20250331/ec2b4e73be8048afbd526124a655ad56.png" : setting.getMiniprogramPicUrl());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("赋值-小程序封面地址失败-" + e);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ //录播
|
|
|
|
|
+ case "24": {
|
|
|
|
|
+ String recordCorpId = logVo.getCorpId();
|
|
|
|
|
+ String recordShortH5Link = createH5LiveShortLink(setting, recordCorpId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId);
|
|
|
|
|
+
|
|
|
|
|
+ sopLogs.setSendType(Integer.valueOf(setting.getContentType()));
|
|
|
|
|
+ clonedContent.setLiveId(setting.getLiveId());
|
|
|
|
|
+
|
|
|
|
|
+ setting.setMiniprogramPage(recordShortH5Link);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -1157,6 +1228,126 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
enqueueQwSopLogs(sopLogs);
|
|
enqueueQwSopLogs(sopLogs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String createRegisteredLinkByMiniApp(QwSopTempSetting.Content.Setting setting, SopUserLogsVo logVo, Date sendTime,
|
|
|
|
|
+ String qwUserId,
|
|
|
|
|
+ String companyUserId, String companyId, String externalId, Long fsUserId) {
|
|
|
|
|
+ // 获取缓存的配置
|
|
|
|
|
+ CourseConfig config;
|
|
|
|
|
+ synchronized (configLock) {
|
|
|
|
|
+ config = cachedCourseConfig;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (config == null) {
|
|
|
|
|
+ log.error("CourseConfig is not loaded.");
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+// if (StringUtils.isEmpty(config.getMiniprogramPage())){
|
|
|
|
|
+// log.error("miniprogramPage is not loaded.");
|
|
|
|
|
+// return "";
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ // 手动创建 FsCourseLink 对象,避免使用 BeanUtils.copyProperties
|
|
|
|
|
+ FsCourseLink link = new FsCourseLink();
|
|
|
|
|
+ link.setCompanyId(Long.parseLong(companyId));
|
|
|
|
|
+ link.setQwUserId(qwUserId!=null?Long.parseLong(qwUserId):null);
|
|
|
|
|
+ link.setCompanyUserId(Long.parseLong(companyUserId));
|
|
|
|
|
+ link.setCorpId(logVo.getCorpId());
|
|
|
|
|
+ link.setQwExternalId(Long.parseLong(externalId));
|
|
|
|
|
+ link.setUNo(UUID.randomUUID().toString());
|
|
|
|
|
+ link.setLinkType(3);
|
|
|
|
|
+
|
|
|
|
|
+ String randomString = generateRandomStringWithLock();
|
|
|
|
|
+ if (StringUtil.strIsNullOrEmpty(randomString)) {
|
|
|
|
|
+ link.setLink(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ link.setLink(randomString);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ link.setCreateTime(sendTime);
|
|
|
|
|
+
|
|
|
|
|
+ FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
|
|
+ BeanUtils.copyProperties(link, courseMap);
|
|
|
|
|
+
|
|
|
|
|
+ String courseJson = JSON.toJSONString(courseMap);
|
|
|
|
|
+ String realLinkFull = registeredRealLink + courseJson;
|
|
|
|
|
+ link.setRealLink(realLinkFull);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Integer expireDays = (setting.getExpiresDays() == null || setting.getExpiresDays() == 0)
|
|
|
|
|
+ ? config.getVideoLinkExpireDate()
|
|
|
|
|
+ : setting.getExpiresDays();
|
|
|
|
|
+
|
|
|
|
|
+ // 使用 Java 8 时间 API 计算过期时间
|
|
|
|
|
+ LocalDateTime sendDateTime = sendTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
|
|
+ LocalDateTime expireDateTime = sendDateTime.plusDays(expireDays - 1);
|
|
|
|
|
+ expireDateTime = expireDateTime.toLocalDate().atTime(23, 59, 59);
|
|
|
|
|
+ Date updateTime = Date.from(expireDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+ link.setUpdateTime(updateTime);
|
|
|
|
|
+
|
|
|
|
|
+ //存短链-
|
|
|
|
|
+ enqueueCourseLink(link);
|
|
|
|
|
+ return link.getRealLink();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public String createRegisteredGroupLinkByMiniApp(QwSopTempSetting.Content.Setting setting, SopUserLogsVo logVo, Date sendTime,
|
|
|
|
|
+ String qwUserId,
|
|
|
|
|
+ Long companyUserId, String companyId, String chatId) {
|
|
|
|
|
+ // 获取缓存的配置
|
|
|
|
|
+ CourseConfig config;
|
|
|
|
|
+ synchronized (configLock) {
|
|
|
|
|
+ config = cachedCourseConfig;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (config == null) {
|
|
|
|
|
+// log.error("CourseConfig is not loaded.");
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCourseLink link = new FsCourseLink();
|
|
|
|
|
+ link.setCompanyId(Long.parseLong(companyId));
|
|
|
|
|
+ link.setQwUserId(qwUserId!=null?Long.parseLong(qwUserId): null);
|
|
|
|
|
+ link.setCompanyUserId(companyUserId);
|
|
|
|
|
+// link.setVideoId(null);
|
|
|
|
|
+ link.setCorpId(logVo.getCorpId());
|
|
|
|
|
+// link.setCourseId(null);
|
|
|
|
|
+ link.setChatId(chatId);
|
|
|
|
|
+ link.setIsRoom(1);
|
|
|
|
|
+ link.setLinkType(3);
|
|
|
|
|
+ link.setUNo(UUID.randomUUID().toString());
|
|
|
|
|
+
|
|
|
|
|
+ String randomString = generateRandomStringWithLock();
|
|
|
|
|
+ if (StringUtil.strIsNullOrEmpty(randomString)) {
|
|
|
|
|
+ link.setLink(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ link.setLink(randomString);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ link.setCreateTime(sendTime);
|
|
|
|
|
+
|
|
|
|
|
+ FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
|
|
+ BeanUtils.copyProperties(link, courseMap);
|
|
|
|
|
+
|
|
|
|
|
+ String courseJson = JSON.toJSONString(courseMap);
|
|
|
|
|
+ String realLinkFull = registeredRealLink + courseJson;
|
|
|
|
|
+ link.setRealLink(realLinkFull);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Integer expireDays = (setting.getExpiresDays() == null || setting.getExpiresDays() == 0)
|
|
|
|
|
+ ? config.getVideoLinkExpireDate()
|
|
|
|
|
+ : setting.getExpiresDays();
|
|
|
|
|
+
|
|
|
|
|
+ // 使用 Java 8 时间 API 计算过期时间
|
|
|
|
|
+ LocalDateTime sendDateTime = sendTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
|
|
+ LocalDateTime expireDateTime = sendDateTime.plusDays(expireDays - 1);
|
|
|
|
|
+ expireDateTime = expireDateTime.toLocalDate().atTime(23, 59, 59);
|
|
|
|
|
+ Date updateTime = Date.from(expireDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+ link.setUpdateTime(updateTime);
|
|
|
|
|
+
|
|
|
|
|
+ //存短链-
|
|
|
|
|
+ enqueueCourseLink(link);
|
|
|
|
|
+ return link.getRealLink();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 处理直播消息
|
|
* 处理直播消息
|
|
|
*/
|
|
*/
|
|
@@ -1188,7 +1379,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId() + "&corpId=" + logVo.getCorpId()+"&qwUserId=" + qwUserId;
|
|
sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId() + "&corpId=" + logVo.getCorpId()+"&qwUserId=" + qwUserId;
|
|
|
String json = configService.selectConfigByKey("his.config");
|
|
String json = configService.selectConfigByKey("his.config");
|
|
|
FSSysConfig sysConfig = JSON.parseObject(json, FSSysConfig.class);
|
|
FSSysConfig sysConfig = JSON.parseObject(json, FSSysConfig.class);
|
|
|
- if (isGroupChat) {
|
|
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
try {
|
|
try {
|
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
@@ -1225,6 +1416,67 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
+ //直播h5跳转卡片
|
|
|
|
|
+ case "18":
|
|
|
|
|
+ //直播h5跳转短链
|
|
|
|
|
+ case "19": {
|
|
|
|
|
+ String corpId = logVo.getCorpId();
|
|
|
|
|
+ String shortH5Link = createH5LiveShortLink(setting, corpId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId);
|
|
|
|
|
+
|
|
|
|
|
+ sopLogs.setSendType(Integer.valueOf(setting.getContentType()));
|
|
|
|
|
+ clonedContent.setLiveId(setting.getLiveId());
|
|
|
|
|
+ FSSysConfig h5LiveSysConfig = JSON.parseObject(configService.selectConfigByKey("his.config"), FSSysConfig.class);
|
|
|
|
|
+
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
|
|
+ Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
|
|
|
+ GroupUserExternalVo vo = userMap.get(groupChat.getOwner());
|
|
|
|
|
+ if (vo != null && vo.getId() != null) {
|
|
|
|
|
+ sopLogs.setFsUserId(vo.getFsUserId());
|
|
|
|
|
+ //写入直播待看课记录
|
|
|
|
|
+ createLiveWatchLogAndEnQueue(companyId, companyUserId, vo.getId().toString(), setting.getLiveId(), h5LiveSysConfig.getAppId(), 2, qwUserId, logVo.getCorpId());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ shortH5Link += "&chatId=" + groupChat.getChatId();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("直播H5群聊新增报错,{}", e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ try {
|
|
|
|
|
+ createLiveWatchLogAndEnQueue(companyId, companyUserId, externalId, setting.getLiveId(), h5LiveSysConfig.getAppId(), 1, qwUserId, logVo.getCorpId());
|
|
|
|
|
+ shortH5Link += "&externalId=" + externalId;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("直播H5个人新增报错,{}", e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String h5LiveTitle = setting.getMiniprogramTitle();
|
|
|
|
|
+ int h5LiveTitleMaxLength = 17;
|
|
|
|
|
+ setting.setMiniprogramTitle(h5LiveTitle.length() > h5LiveTitleMaxLength ? h5LiveTitle.substring(0, h5LiveTitleMaxLength) + "..." : h5LiveTitle);
|
|
|
|
|
+ setting.setMiniprogramAppid(h5LiveSysConfig.getAppId());
|
|
|
|
|
+ setting.setMiniprogramPage(shortH5Link);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ setting.setMiniprogramPicUrl(StringUtil.strIsNullOrEmpty(setting.getMiniprogramPicUrl()) ? "https://cos.his.cdwjyyh.com/fs/20250331/ec2b4e73be8048afbd526124a655ad56.png" : setting.getMiniprogramPicUrl());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("赋值-小程序封面地址失败-" + e);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ //跳转app直播
|
|
|
|
|
+ case "24": {
|
|
|
|
|
+ String liveCorpId = logVo.getCorpId();
|
|
|
|
|
+ String liveShortH5Link = createH5LiveShortLink(setting, liveCorpId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId);
|
|
|
|
|
+
|
|
|
|
|
+ sopLogs.setSendType(Integer.valueOf(setting.getContentType()));
|
|
|
|
|
+ clonedContent.setLiveId(setting.getLiveId());
|
|
|
|
|
+
|
|
|
|
|
+ setting.setMiniprogramPage(liveShortH5Link);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -1257,11 +1509,16 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//
|
|
|
|
|
-// Integer courseType = clonedContent.getCourseType();
|
|
|
|
|
|
|
|
|
|
String isOfficial = clonedContent.getIsOfficial();
|
|
String isOfficial = clonedContent.getIsOfficial();
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Long msgNum = Long.valueOf(generateRandomNumberWithLock());
|
|
|
|
|
+ sopLogs.setSmsLogsId(msgNum);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ AtomicInteger index = new AtomicInteger(0);
|
|
|
|
|
+
|
|
|
List<QwSopTempSetting.Content.Setting> settings = clonedContent.getSetting();
|
|
List<QwSopTempSetting.Content.Setting> settings = clonedContent.getSetting();
|
|
|
if (settings == null || settings.isEmpty()) {
|
|
if (settings == null || settings.isEmpty()) {
|
|
|
log.error("Cloned content settings are empty, skipping.");
|
|
log.error("Cloned content settings are empty, skipping.");
|
|
@@ -1275,6 +1532,9 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}
|
|
}
|
|
|
// 顺序处理每个 Setting,避免过多的并行导致线程开销
|
|
// 顺序处理每个 Setting,避免过多的并行导致线程开销
|
|
|
for (QwSopTempSetting.Content.Setting setting : settings) {
|
|
for (QwSopTempSetting.Content.Setting setting : settings) {
|
|
|
|
|
+
|
|
|
|
|
+ Integer currentIndex = index.getAndIncrement();
|
|
|
|
|
+
|
|
|
switch (setting.getContentType()) {
|
|
switch (setting.getContentType()) {
|
|
|
//文字和短链一起
|
|
//文字和短链一起
|
|
|
case "1":
|
|
case "1":
|
|
@@ -1347,7 +1607,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
break;
|
|
break;
|
|
|
//小程序单独
|
|
//小程序单独
|
|
|
case "4":
|
|
case "4":
|
|
|
- if (isGroupChat) {
|
|
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
try {
|
|
try {
|
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
@@ -1441,7 +1701,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId()+"&corpId=" +logVo.getCorpId()+"&qwUserId=" + qwUserId;
|
|
sortLiveLink = "/pages_course/living.html?companyId=" + companyId + "&companyUserId=" + companyUserId + "&liveId=" + setting.getLiveId()+"&corpId=" +logVo.getCorpId()+"&qwUserId=" + qwUserId;
|
|
|
String json = configService.selectConfigByKey("his.config");
|
|
String json = configService.selectConfigByKey("his.config");
|
|
|
FSSysConfig sysConfig= JSON.parseObject(json,FSSysConfig.class);
|
|
FSSysConfig sysConfig= JSON.parseObject(json,FSSysConfig.class);
|
|
|
- if(isGroupChat){
|
|
|
|
|
|
|
+ if (isGroupChat && groupChat != null) {
|
|
|
try{
|
|
try{
|
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
groupChat.getChatUserList().stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
@@ -1550,6 +1810,33 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
log.error("浏览器看课模板解析失败:" + e);
|
|
log.error("浏览器看课模板解析失败:" + e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
+ //跳转app看课
|
|
|
|
|
+ case "23":
|
|
|
|
|
+ try {
|
|
|
|
|
+ addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, externalId, logVo,2);
|
|
|
|
|
+
|
|
|
|
|
+ String shortH5link = createH5LinkByMiniApp(setting, logVo, sendTime, courseId, videoId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId, externalId, isOfficial, sopLogs.getFsUserId());
|
|
|
|
|
+
|
|
|
|
|
+ setting.setMiniprogramTitle("邀请链接");
|
|
|
|
|
+ setting.setMiniprogramPage(shortH5link);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("app看课模板解析失败:" + e);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ //app直播跳转
|
|
|
|
|
+ case "24":
|
|
|
|
|
+ String corpId = logVo.getCorpId();
|
|
|
|
|
+ String shortH5Link = createH5LiveShortLink(setting, corpId,
|
|
|
|
|
+ qwUserId, companyUserId, companyId);
|
|
|
|
|
+
|
|
|
|
|
+ sopLogs.setSendType(Integer.valueOf(setting.getContentType()));
|
|
|
|
|
+ clonedContent.setLiveId(setting.getLiveId());
|
|
|
|
|
+
|
|
|
|
|
+ setting.setMiniprogramPage(shortH5Link);
|
|
|
|
|
+
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
@@ -1566,7 +1853,36 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
log.info("sopLogs加入队列,ExternalId:{}",externalId);
|
|
log.info("sopLogs加入队列,ExternalId:{}",externalId);
|
|
|
enqueueQwSopLogs(sopLogs);
|
|
enqueueQwSopLogs(sopLogs);
|
|
|
}
|
|
}
|
|
|
|
|
+ private String createH5LiveShortLink(QwSopTempSetting.Content.Setting setting, String corpId, String qwUserId, String companyUserId, String companyId) {
|
|
|
|
|
+
|
|
|
|
|
+ // 手动创建 FsCourseLink 对象,避免使用 BeanUtils.copyProperties
|
|
|
|
|
+ FsCourseLink link = new FsCourseLink();
|
|
|
|
|
+ link.setCompanyId(Long.parseLong(companyId));
|
|
|
|
|
+ link.setQwUserId(Long.valueOf(qwUserId));
|
|
|
|
|
+ link.setCompanyUserId(Long.parseLong(companyUserId));
|
|
|
|
|
+ link.setLiveId(setting.getLiveId());
|
|
|
|
|
+ link.setCorpId(corpId);
|
|
|
|
|
+ link.setUNo(UUID.randomUUID().toString());
|
|
|
|
|
|
|
|
|
|
+ String randomString = generateRandomStringWithLock();
|
|
|
|
|
+ if (StringUtil.strIsNullOrEmpty(randomString)) {
|
|
|
|
|
+ link.setLink(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ link.setLink(randomString);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
|
|
+ BeanUtils.copyProperties(link, courseMap);*/
|
|
|
|
|
+
|
|
|
|
|
+ String courseJson = JSON.toJSONString(link);
|
|
|
|
|
+ String realLinkFull = h5LiveShortLink + courseJson;
|
|
|
|
|
+ link.setRealLink(realLinkFull);
|
|
|
|
|
+
|
|
|
|
|
+ //存短链-
|
|
|
|
|
+ enqueueCourseLink(link);
|
|
|
|
|
+ return link.getRealLink();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
private String getAppIdFromMiniMap(Map<Long, Map<Integer, List<CompanyMiniapp>>> miniMap,
|
|
private String getAppIdFromMiniMap(Map<Long, Map<Integer, List<CompanyMiniapp>>> miniMap,
|
|
|
String companyId,
|
|
String companyId,
|
|
|
int sendMsgType,
|
|
int sendMsgType,
|
|
@@ -1943,7 +2259,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
* @param qwUserId
|
|
* @param qwUserId
|
|
|
* @param corpId
|
|
* @param corpId
|
|
|
*/
|
|
*/
|
|
|
- public void createLiveWatchLogAndEnQueue(String companyId,String companyUserId,String externalId,Long liveId,String appId,Integer logSource,String qwUserId,String corpId){
|
|
|
|
|
|
|
+ public void createLiveWatchLogAndEnQueue(String companyId, String companyUserId, String externalId, Long liveId, String appId, Integer logSource, String qwUserId, String corpId) {
|
|
|
// 写入对应数据源的记录表
|
|
// 写入对应数据源的记录表
|
|
|
LiveWatchLog itemLiveWatchLog = new LiveWatchLog();
|
|
LiveWatchLog itemLiveWatchLog = new LiveWatchLog();
|
|
|
itemLiveWatchLog.setLiveId(liveId);
|
|
itemLiveWatchLog.setLiveId(liveId);
|