|
@@ -617,10 +617,40 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
info.stream().forEach(i -> {
|
|
|
//判断消息类型
|
|
|
Integer type = i.getTargetType();
|
|
|
-
|
|
|
if (type == 1) {
|
|
|
//单聊会话
|
|
|
- //todo
|
|
|
+
|
|
|
+ MessageWrapper.PrivateImportMessage privateImportMessage = new MessageWrapper.PrivateImportMessage();
|
|
|
+ //2:表示历史消息导入,消息不计入未读计数,且消息不会推送到终端
|
|
|
+ privateImportMessage.setSyncFromOldSystem(2);
|
|
|
+ //设置发送人
|
|
|
+ privateImportMessage.setFromAccount(i.getFromUserId());
|
|
|
+ //设置接收人
|
|
|
+ privateImportMessage.setToAccount(i.getTargetId());
|
|
|
+ //设置随机数
|
|
|
+ privateImportMessage.setMsgRandom(new Random().nextInt());
|
|
|
+ //设置body
|
|
|
+
|
|
|
+ List<TencentRequest.MessageBody> list = new ArrayList<>();
|
|
|
+ list.stream().forEach(item->{
|
|
|
+ item.setMsgContent(i.getContent());
|
|
|
+ item.setMsgType(i.getClassname());
|
|
|
+ });
|
|
|
+ if (list.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:TxtMsg")){
|
|
|
+ //文本对象
|
|
|
+ list.stream().forEach(item -> item.setMsgType("TIMTextElem"));
|
|
|
+ } else if (list.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:ImgMsg")){
|
|
|
+ //图文对象
|
|
|
+ list.stream().forEach(item -> item.setMsgType("TIMImageElem"));
|
|
|
+ }
|
|
|
+ privateImportMessage.setTencentMessageBody(list);
|
|
|
+ try {
|
|
|
+ imPluginContext.getPluginService().importPrivateMessage(privateImportMessage);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else if (type == 3) {
|
|
|
//群组会话
|
|
|
MessageWrapper.GroupImportMessage groupImportMessage = new MessageWrapper.GroupImportMessage();
|