|
@@ -15,6 +15,13 @@ import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
+import com.fs.course.domain.FsCourseWatchLog;
|
|
|
+import com.fs.course.domain.FsUserCompanyUser;
|
|
|
+import com.fs.course.domain.FsUserCourse;
|
|
|
+import com.fs.course.dto.BatchSendCourseDTO;
|
|
|
+import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
|
+import com.fs.course.mapper.FsUserCompanyUserMapper;
|
|
|
+import com.fs.course.mapper.FsUserCourseMapper;
|
|
|
import com.fs.fastGpt.service.AiHookService;
|
|
|
import com.fs.his.domain.FsDoctor;
|
|
|
import com.fs.his.domain.FsFollow;
|
|
@@ -24,10 +31,9 @@ import com.fs.his.mapper.FsDoctorMapper;
|
|
|
import com.fs.his.mapper.FsFollowMapper;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
import com.fs.im.config.IMConfig;
|
|
|
-import com.fs.im.dto.OpenImConversationDTO;
|
|
|
-import com.fs.im.dto.OpenImEditConversationDTO;
|
|
|
-import com.fs.im.dto.OpenImMsgDTO;
|
|
|
-import com.fs.im.dto.OpenImResponseDTO;
|
|
|
+import com.fs.im.domain.ImSendLog;
|
|
|
+import com.fs.im.dto.*;
|
|
|
+import com.fs.im.mapper.ImSendLogMapper;
|
|
|
import com.fs.im.service.OpenIMService;
|
|
|
import com.fs.im.vo.OpenImMsgCallBackVO;
|
|
|
import com.fs.im.vo.OpenImResponseDTOTest;
|
|
@@ -35,15 +41,17 @@ import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -70,9 +78,17 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
@Autowired
|
|
|
@Lazy
|
|
|
private AiHookService aiHookService;
|
|
|
+ @Autowired
|
|
|
+ private FsUserCourseMapper fsUserCourseMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsUserCompanyUserMapper fsUserCompanyUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsCourseWatchLogMapper courseWatchLogMapper;
|
|
|
+ @Autowired
|
|
|
+ private ImSendLogMapper imSendLogMapper;
|
|
|
|
|
|
- @Value("${openIM.prefix}")
|
|
|
- private String openImPrefix;
|
|
|
+// @Value("${openIM.prefix}")
|
|
|
+// private String openImPrefix;
|
|
|
/*@Autowired
|
|
|
private IFsUserService fsUserService;*/
|
|
|
@Override
|
|
@@ -338,7 +354,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
|
|
|
// 过滤出以C开头的用户ID
|
|
|
List<String> userIds = userIDs.stream()
|
|
|
- .filter(uid -> uid.startsWith(IMConfig.PREFIX+"C"))
|
|
|
+ .filter(uid -> uid.startsWith("C"))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(userIds)) {
|
|
@@ -404,7 +420,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
OpenImResponseDTO responseDTO = null;
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
ArrayList<String> userIDs = new ArrayList<>();
|
|
|
- userIDs.add(IMConfig.PREFIX+"C"+companyUser.getUserId());
|
|
|
+ userIDs.add("C"+companyUser.getUserId());
|
|
|
paramMap.put("userIDs", userIDs);
|
|
|
|
|
|
String jsonBody = JSONUtil.toJsonStr(paramMap);
|
|
@@ -487,7 +503,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
//userId = 61l;
|
|
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略null字段
|
|
|
- checkAndImportFriendByDianBo(companyUserId,userId.toString(),cropId);
|
|
|
+ checkAndImportFriendByDianBo(companyUserId,userId.toString(),cropId,true);
|
|
|
OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
OpenImMsgDTO.ImData imData = new OpenImMsgDTO.ImData();
|
|
|
PayloadDTO payload = new PayloadDTO();
|
|
@@ -513,8 +529,8 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
openImMsgDTO.setOfflinePushInfo(offlinePushInfo);
|
|
|
openImMsgDTO.setContent(content);
|
|
|
|
|
|
- openImMsgDTO.setSendID(IMConfig.PREFIX+"C"+companyUserId);
|
|
|
- openImMsgDTO.setRecvID(IMConfig.PREFIX+"U"+userId);
|
|
|
+ openImMsgDTO.setSendID("C"+companyUserId);
|
|
|
+ openImMsgDTO.setRecvID("U"+userId);
|
|
|
openImMsgDTO.setContentType(110);
|
|
|
openImMsgDTO.setSessionType(1);
|
|
|
// 输出格式化JSON日志
|
|
@@ -530,8 +546,8 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
OpenImMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImMsgDTO.OfflinePushInfo();
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
- if (sendID.startsWith(IMConfig.PREFIX+"C")){
|
|
|
- CompanyUser company = companyUserMapper.selectCompanyUserByUserId(Long.parseLong(sendID.replace(IMConfig.PREFIX+"C", "")));
|
|
|
+ if (sendID.startsWith("C")){
|
|
|
+ CompanyUser company = companyUserMapper.selectCompanyUserByUserId(Long.parseLong(sendID.replace("C", "")));
|
|
|
if (null!=company){
|
|
|
offlinePushInfo.setTitle(company.getNickName());
|
|
|
openImMsgDTO.setSenderFaceURL(company.getAvatar());
|
|
@@ -583,21 +599,22 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public OpenImResponseDTO sendUtil(String sendID, String recvID, Integer contentType, String payloadData, String diagnose,String title,String followId,String orderId,String ex) throws JsonProcessingException {
|
|
|
try {
|
|
|
OpenImMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImMsgDTO.OfflinePushInfo();
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
- if (sendID.startsWith(IMConfig.PREFIX+"D")){
|
|
|
- FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(Long.parseLong(sendID.replace(IMConfig.PREFIX+"D","")));
|
|
|
+ if (sendID.startsWith("D")){
|
|
|
+ FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(Long.parseLong(sendID.replace("D","")));
|
|
|
//FsUser fsUser = fsUserService.selectFsUserByUserId(sendID);
|
|
|
if (null!=fsDoctor&&StringUtils.isNotEmpty(fsDoctor.getAvatar())){
|
|
|
offlinePushInfo.setTitle(fsDoctor.getDoctorName());
|
|
|
openImMsgDTO.setSenderFaceURL(fsDoctor.getAvatar());
|
|
|
}
|
|
|
- }else if (sendID.startsWith(IMConfig.PREFIX+"C")){
|
|
|
- CompanyUser company = companyUserMapper.selectCompanyUserByUserId(Long.parseLong(sendID.replace(IMConfig.PREFIX+"C", "")));
|
|
|
+ }else if (sendID.startsWith("C")){
|
|
|
+ CompanyUser company = companyUserMapper.selectCompanyUserByUserId(Long.parseLong(sendID.replace("C", "")));
|
|
|
if (null!=company&&StringUtils.isNotEmpty(company.getAvatar())){
|
|
|
offlinePushInfo.setTitle(company.getNickName());
|
|
|
openImMsgDTO.setSenderFaceURL(company.getAvatar());
|
|
@@ -684,9 +701,9 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
try {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
- if (sendID.startsWith(IMConfig.PREFIX+"U")){
|
|
|
+ if (sendID.startsWith("U")){
|
|
|
//FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(Long.parseLong(sendID.replace("D","")));
|
|
|
- FsUser fsUser = fsUserMapper.selectFsUserByUserId(Long.parseLong(sendID.replace(IMConfig.PREFIX+"U","")));
|
|
|
+ FsUser fsUser = fsUserMapper.selectFsUserByUserId(Long.parseLong(sendID.replace("U","")));
|
|
|
if (null!=fsUser&&StringUtils.isNotEmpty(fsUser.getAvatar())){
|
|
|
openImMsgDTO.setSenderFaceURL(fsUser.getAvatar());
|
|
|
}
|
|
@@ -908,7 +925,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
String s = "";
|
|
|
switch (type){
|
|
|
case "2":
|
|
|
- s = userId.replaceFirst("^"+openImPrefix+"C", "");
|
|
|
+ s = userId.replaceFirst("^"+"C", "");
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(Long.parseLong(s));
|
|
|
if (null==companyUser){
|
|
|
// return R.error("用户不存在");
|
|
@@ -922,7 +939,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
map.put("faceURL",companyUser.getAvatar());
|
|
|
break;
|
|
|
case "1":
|
|
|
- s = userId.replaceFirst("^"+openImPrefix+"U", "");
|
|
|
+ s = userId.replaceFirst("^"+"U", "");
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(Long.parseLong(s));
|
|
|
if (null==fsUser){
|
|
|
// return R.error("用户不存在");
|
|
@@ -934,7 +951,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
map.put("faceURL",fsUser.getAvatar());
|
|
|
break;
|
|
|
case "3":
|
|
|
- s = userId.replaceFirst("^"+openImPrefix+"D", "");
|
|
|
+ s = userId.replaceFirst("^"+"D", "");
|
|
|
FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(Long.parseLong(s));
|
|
|
if (null==fsDoctor){
|
|
|
// return R.error("用户不存在");
|
|
@@ -991,13 +1008,13 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
public void checkAndImportFriend(Long companyUserId,String fsUserId) {
|
|
|
// try {
|
|
|
// 注册账号
|
|
|
- accountCheck(IMConfig.PREFIX + "C" + companyUserId, "2");
|
|
|
- accountCheck(IMConfig.PREFIX + "U" + fsUserId, "1");
|
|
|
+ accountCheck( "C" + companyUserId, "2");
|
|
|
+ accountCheck( "U" + fsUserId, "1");
|
|
|
|
|
|
// 导入好友关系
|
|
|
ArrayList<String> userIds = new ArrayList<>();
|
|
|
- userIds.add(IMConfig.PREFIX+"U" + fsUserId);
|
|
|
- importFriend(IMConfig.PREFIX+"C" + companyUserId, userIds);
|
|
|
+ userIds.add("U" + fsUserId);
|
|
|
+ importFriend("C" + companyUserId, userIds);
|
|
|
// } catch (Exception e) {
|
|
|
// log.error("异步执行IM注册/添加好友失败:", e);
|
|
|
// }
|
|
@@ -1005,22 +1022,184 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
|
|
|
@Async
|
|
|
@Override
|
|
|
- public void checkAndImportFriendByDianBo(Long companyUserId,String fsUserId,String cropId) {
|
|
|
+ public void checkAndImportFriendByDianBo(Long companyUserId,String fsUserId,String cropId, boolean isUpdate) {
|
|
|
try {
|
|
|
// 注册账号
|
|
|
- accountCheck(IMConfig.PREFIX+"C" + companyUserId, "2");
|
|
|
- accountCheck(IMConfig.PREFIX+"U"+fsUserId, "1");
|
|
|
+ accountCheck("C" + companyUserId, "2");
|
|
|
+ accountCheck("U"+fsUserId, "1");
|
|
|
|
|
|
// 导入好友关系
|
|
|
ArrayList<String> userIds = new ArrayList<>();
|
|
|
- userIds.add(IMConfig.PREFIX+"U" + fsUserId);
|
|
|
- importFriend(IMConfig.PREFIX+"C" + companyUserId, userIds);
|
|
|
- updateFriendByDianBo(IMConfig.PREFIX+"C" + companyUserId, userIds,cropId);
|
|
|
+ userIds.add("U" + fsUserId);
|
|
|
+ importFriend("C" + companyUserId, userIds);
|
|
|
+ if(isUpdate){
|
|
|
+ updateFriendByDianBo("C" + companyUserId, userIds,cropId);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.error("异步执行IM注册/添加好友失败:", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public OpenImResponseDTO openIMBatchSendMsg(OpenImBatchMsgDTO openImBatchMsgDTO) {
|
|
|
+ log.info("========================== 批量发送消息 ==========================");
|
|
|
+ String adminToken = getAdminToken();
|
|
|
+ JSONObject jsonObject = new JSONObject(openImBatchMsgDTO);
|
|
|
+ String url = IMConfig.URL+"/msg/batch_send_msg";
|
|
|
+ log.info("请求url: {},\n请求参数:{}", url, jsonObject);
|
|
|
+ long timestamp = System.currentTimeMillis();
|
|
|
+ log.info("请求header,operationID:{},token:{}", timestamp, adminToken);
|
|
|
+
|
|
|
+ String result = HttpRequest.post(url)
|
|
|
+ .header("operationID", timestamp + "")
|
|
|
+ .header("token",adminToken)
|
|
|
+ .body(jsonObject.toString())
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ log.info("批量发送消息返回内容:\n{}", result);
|
|
|
+ OpenImResponseDTO responseDTO= JSONUtil.toBean(result, OpenImResponseDTO.class);
|
|
|
+ return responseDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public OpenImResponseDTO batchSendCourse(BatchSendCourseDTO batchSendCourseDTO) throws JsonProcessingException {
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略null字段
|
|
|
+
|
|
|
+ //查询需要发送的人
|
|
|
+ List<String> userIds = this.getRecvIds(batchSendCourseDTO);
|
|
|
+ //注册和添加好友
|
|
|
+ for (String userId : userIds) {
|
|
|
+ String uId = userId.substring(1);
|
|
|
+ checkAndImportFriendByDianBo(batchSendCourseDTO.getCompanyUserId(), uId,null,false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //组装消息数据
|
|
|
+ PayloadDTO.Extension extension = new PayloadDTO.Extension();
|
|
|
+ extension.setTitle(batchSendCourseDTO.getTitle());
|
|
|
+ extension.setAppRealLink(batchSendCourseDTO.getUrl());
|
|
|
+ extension.setSendTime(new Date());
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(batchSendCourseDTO.getCourseId());
|
|
|
+ extension.setCourseUrl(fsUserCourse != null ? fsUserCourse.getImgUrl() : null);
|
|
|
+
|
|
|
+ PayloadDTO payload = new PayloadDTO();
|
|
|
+ payload.setData("course");
|
|
|
+ payload.setExtension(extension);
|
|
|
+
|
|
|
+ OpenImBatchMsgDTO.ImData imData = new OpenImBatchMsgDTO.ImData();
|
|
|
+ OpenImBatchMsgDTO.Content content = new OpenImBatchMsgDTO.Content();
|
|
|
+ imData.setPayload(payload);
|
|
|
+ String imJson = objectMapper.writeValueAsString(imData);
|
|
|
+ content.setData(imJson);
|
|
|
+
|
|
|
+ OpenImBatchMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImBatchMsgDTO.OfflinePushInfo();
|
|
|
+ offlinePushInfo.setDesc(batchSendCourseDTO.getTitle());
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserById(batchSendCourseDTO.getCompanyUserId());
|
|
|
+ offlinePushInfo.setTitle(companyUser != null ? companyUser.getNickName(): null);
|
|
|
+ offlinePushInfo.setIOSBadgeCount(true);
|
|
|
+ offlinePushInfo.setIOSPushSound("");
|
|
|
+
|
|
|
+ // 设置发送的消息
|
|
|
+ OpenImBatchMsgDTO openImBatchMsgDTO = new OpenImBatchMsgDTO();
|
|
|
+ openImBatchMsgDTO.setSendID("C" + batchSendCourseDTO.getCompanyUserId());
|
|
|
+ openImBatchMsgDTO.setRecvIDs(userIds);
|
|
|
+ openImBatchMsgDTO.setContent(content);
|
|
|
+ openImBatchMsgDTO.setContentType(110);
|
|
|
+ openImBatchMsgDTO.setSessionType(1);
|
|
|
+ openImBatchMsgDTO.setIsOnlineOnly(false);
|
|
|
+ openImBatchMsgDTO.setNotOfflinePush(false);
|
|
|
+ long planSendTimeStamp;
|
|
|
+ if(batchSendCourseDTO.getSendTime() != null){
|
|
|
+ planSendTimeStamp = batchSendCourseDTO.getSendTime().getTime();
|
|
|
+ } else {
|
|
|
+ planSendTimeStamp = System.currentTimeMillis();
|
|
|
+ }
|
|
|
+ openImBatchMsgDTO.setSendTime(planSendTimeStamp);
|
|
|
+ openImBatchMsgDTO.setOfflinePushInfo(offlinePushInfo);
|
|
|
+ openImBatchMsgDTO.setIsSendAll(false);
|
|
|
+
|
|
|
+ log.info("批量发送课程消息: \n{}", JSON.toJSONString(openImBatchMsgDTO));
|
|
|
+ OpenImResponseDTO openImResponseDTO = openIMBatchSendMsg(openImBatchMsgDTO);
|
|
|
+// openImBatchMsgDTO = null;
|
|
|
+// content = null;
|
|
|
+
|
|
|
+ //获取发送消息结果,成功后再生成看课记录和发送记录
|
|
|
+ if(openImResponseDTO.getErrCode() == 0 && openImResponseDTO.getData() != null){
|
|
|
+ Object data = openImResponseDTO.getData();
|
|
|
+ OpenImBatchResponseDataDTO openImBatchResponseDataDTO = JSON.parseObject(JSON.toJSONString(data), OpenImBatchResponseDataDTO.class);
|
|
|
+ List<OpenImBatchResponseDataDTO.Results> results = openImBatchResponseDataDTO.getResults();
|
|
|
+
|
|
|
+ // 生成看课记录
|
|
|
+ this.batchInsertWatchLogs(batchSendCourseDTO, results, fsUserCourse);
|
|
|
+
|
|
|
+ // 生成发送记录
|
|
|
+ this.batchInsertSendLogs(openImBatchMsgDTO, results, planSendTimeStamp);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ log.error("发送消息失败,结果:{}", openImResponseDTO);
|
|
|
+ throw new ServiceException("发送消息失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ return openImResponseDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<String> getRecvIds(BatchSendCourseDTO batchSendCourseDTO) {
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("tagIds", batchSendCourseDTO.getTagIds());
|
|
|
+ param.put("companyUserId", batchSendCourseDTO.getCompanyUserId());
|
|
|
+ List<FsUserCompanyUser> fsUserCompanyUsers = fsUserCompanyUserMapper.selectFsUserCompanyUserByIds(param);
|
|
|
+ if(fsUserCompanyUsers.isEmpty()){
|
|
|
+ log.error("没有消息接收人,参数:{}", batchSendCourseDTO);
|
|
|
+ throw new ServiceException("没有消息接收人");
|
|
|
+ }
|
|
|
+ return fsUserCompanyUsers.stream().map(v -> "U" + v.getUserId()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void batchInsertSendLogs(OpenImBatchMsgDTO openImBatchMsgDTO, List<OpenImBatchResponseDataDTO.Results> results, long planSendTimeStamp) {
|
|
|
+ List<ImSendLog> list = new LinkedList<>();
|
|
|
+ for (OpenImBatchResponseDataDTO.Results result : results) {
|
|
|
+ ImSendLog imSendLog = new ImSendLog();
|
|
|
+ imSendLog.setSendId(openImBatchMsgDTO.getSendID());
|
|
|
+ imSendLog.setRecvId(result.getRecvID());
|
|
|
+ imSendLog.setSendTitle(openImBatchMsgDTO.getOfflinePushInfo() != null ? openImBatchMsgDTO.getOfflinePushInfo().getTitle() : null);
|
|
|
+ imSendLog.setPlanSendTime(new Date(planSendTimeStamp));
|
|
|
+ imSendLog.setActualSendTime(new Date(result.getSendTime()));
|
|
|
+ if(planSendTimeStamp == result.getSendTime()){
|
|
|
+ imSendLog.setSendType(2);
|
|
|
+ } else {
|
|
|
+ imSendLog.setSendType(1);
|
|
|
+ }
|
|
|
+ imSendLog.setParamJson(JSON.toJSONString(openImBatchMsgDTO));
|
|
|
+ imSendLog.setStatus(0);
|
|
|
+ imSendLog.setResultMessage(JSON.toJSONString(results));
|
|
|
+// imSendLog.setExceptionInfo();
|
|
|
+ list.add(imSendLog);
|
|
|
+ }
|
|
|
+ imSendLogMapper.insertImSendLogBatch(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ public void batchInsertWatchLogs(BatchSendCourseDTO batchSendCourseDTO, List<OpenImBatchResponseDataDTO.Results> results, FsUserCourse fsUserCourse) {
|
|
|
+ List<FsCourseWatchLog> watchLogsInsertList = new LinkedList<>();
|
|
|
+ for (OpenImBatchResponseDataDTO.Results result : results) {
|
|
|
+ FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
|
|
|
+ BeanUtils.copyProperties(batchSendCourseDTO, fsCourseWatchLog);
|
|
|
+ String userId = result.getRecvID().replaceFirst("^"+"U", "");
|
|
|
+ fsCourseWatchLog.setUserId(Long.parseLong(userId));
|
|
|
+ fsCourseWatchLog.setSendType(1);
|
|
|
+ fsCourseWatchLog.setDuration(0L);
|
|
|
+ fsCourseWatchLog.setCreateTime(new Date());
|
|
|
+ fsCourseWatchLog.setLogType(3);
|
|
|
+ fsCourseWatchLog.setProject(fsUserCourse != null ? fsUserCourse.getProject() : null);
|
|
|
+ watchLogsInsertList.add(fsCourseWatchLog);
|
|
|
+ }
|
|
|
+ courseWatchLogMapper.insertFsCourseWatchLogBatch(watchLogsInsertList);
|
|
|
+ log.info("批量插入FsCourseWatchLog表完成,共插入 {} 条记录", watchLogsInsertList.size());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改好友信息
|
|
|
* @param ownerUserID
|