|
@@ -3,11 +3,9 @@ package com.fs.app.taskService.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.app.taskService.SopLogsTaskService;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.base.BaseException;
|
|
|
-import com.fs.common.utils.BatchUtils;
|
|
|
import com.fs.common.utils.PubFun;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
@@ -705,19 +703,8 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
ruleTimeVO.setType(2);
|
|
|
if (content.getIndex() == 0) {
|
|
|
QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, 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){
|
|
|
- addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, vo.getId().toString(), logVo);
|
|
|
- }
|
|
|
- });
|
|
|
- }catch (Exception e){
|
|
|
- log.error("群聊创建看课记录失败!", e);
|
|
|
- }
|
|
|
handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
|
|
|
- type, qwUserId, companyUserId, companyId, groupChat.getChatId(), welcomeText, qwUserName, null, true, miniAppId);
|
|
|
+ type, qwUserId, companyUserId, companyId, groupChat.getChatId(), welcomeText, qwUserName, null, true, miniAppId, groupChat);
|
|
|
} else {
|
|
|
if(groupChat.getChatUserList() != null && !groupChat.getChatUserList().isEmpty()){
|
|
|
groupChat.getChatUserList().forEach(user -> {
|
|
@@ -725,7 +712,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
ruleTimeVO.setRemark("客户群催课");
|
|
|
QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, user.getUserId(), user.getName(), null, isOfficial, null);
|
|
|
handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
|
|
|
- type, qwUserId, companyUserId, companyId, user.getId().toString(), welcomeText, qwUserName, null, false, miniAppId);
|
|
|
+ type, qwUserId, companyUserId, companyId, user.getId().toString(), welcomeText, qwUserName, null, false, miniAppId, groupChat);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -738,7 +725,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
Long fsUserId = contactId.getFsUserId();
|
|
|
QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, contactId.getExternalContactId(), externalUserName, fsUserId, isOfficial, contactId.getExternalId());
|
|
|
handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
|
|
|
- type, qwUserId, companyUserId, companyId, externalId, welcomeText, qwUserName, fsUserId, false, miniAppId);
|
|
|
+ type, qwUserId, companyUserId, companyId, externalId, welcomeText, qwUserName, fsUserId, false, miniAppId, null);
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理 externalContactId {} 时发生异常: {}", contactId, e.getMessage(), e);
|
|
|
}
|
|
@@ -826,15 +813,15 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
private void handleLogBasedOnType(QwSopLogs sopLogs, QwSopTempSetting.Content content,
|
|
|
SopUserLogsVo logVo, Date sendTime, Long courseId,
|
|
|
Long videoId, int type, String qwUserId,
|
|
|
- String companyUserId, String companyId, String externalId,String welcomeText,
|
|
|
- String qwUserName, Long fsUserId, boolean isGroupChat,String miniAppId) {
|
|
|
+ String companyUserId, String companyId, String externalId, String welcomeText,
|
|
|
+ String qwUserName, Long fsUserId, boolean isGroupChat, String miniAppId, QwGroupChat groupChat) {
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
handleNormalMessage(sopLogs, content,companyUserId);
|
|
|
break;
|
|
|
case 2:
|
|
|
handleCourseMessage(sopLogs, content, logVo, sendTime, courseId, videoId,
|
|
|
- qwUserId, companyUserId, companyId, externalId, welcomeText,qwUserName, fsUserId, isGroupChat, miniAppId);
|
|
|
+ qwUserId, companyUserId, companyId, externalId, welcomeText,qwUserName, fsUserId, isGroupChat, miniAppId, groupChat);
|
|
|
break;
|
|
|
case 3:
|
|
|
handleOrderMessage(sopLogs, content);
|
|
@@ -866,8 +853,8 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
private void handleCourseMessage(QwSopLogs sopLogs, QwSopTempSetting.Content content,
|
|
|
SopUserLogsVo logVo, Date sendTime, Long courseId,
|
|
|
Long videoId, String qwUserId, String companyUserId,
|
|
|
- String companyId, String externalId,String welcomeText,String qwUserName,
|
|
|
- Long fsUserId, boolean isGroupChat,String miniAppId) {
|
|
|
+ String companyId, String externalId, String welcomeText, String qwUserName,
|
|
|
+ Long fsUserId, boolean isGroupChat, String miniAppId, QwGroupChat groupChat) {
|
|
|
// 深拷贝 Content 对象,避免使用 JSON
|
|
|
QwSopTempSetting.Content clonedContent = deepCopyContent(content);
|
|
|
if (clonedContent == null) {
|
|
@@ -908,6 +895,18 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
if (createLink.get("code").equals(500)) {
|
|
|
throw new BaseException("链接生成失败!");
|
|
|
}
|
|
|
+ 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());
|
|
|
+ addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, vo.getId().toString(), logVo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("群聊创建看课记录失败!", e);
|
|
|
+ }
|
|
|
link = (String) createLink.get("url");
|
|
|
} else {
|
|
|
addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, externalId, logVo);
|