|  | @@ -719,9 +719,9 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void importInfo(List<ImHistoryMessage> info) throws Exception {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        info.forEach(i -> {
 | 
	
		
			
				|  |  | +        for (ImHistoryMessage i : info) {//判断消息类型
 | 
	
		
			
				|  |  | +            log.info("消息导入:{}",i);
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  | -                //判断消息类型
 | 
	
		
			
				|  |  |                  Integer type = i.getTargetType();
 | 
	
		
			
				|  |  |                  if (type == 1) {
 | 
	
		
			
				|  |  |                      //单聊会话
 | 
	
	
		
			
				|  | @@ -745,7 +745,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                      //设置接收人
 | 
	
		
			
				|  |  |                      privateImportMessage.setToAccount(i.getTargetId());
 | 
	
		
			
				|  |  |                      //设置随机数
 | 
	
		
			
				|  |  | -//                    privateImportMessage.setMsgRandom(new Random().nextInt());
 | 
	
		
			
				|  |  | +                    privateImportMessage.setMsgRandom(new Random().nextInt());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      //设置发送时间
 | 
	
		
			
				|  |  |                      String time = i.getDateTime();
 | 
	
	
		
			
				|  | @@ -778,23 +778,23 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          int gifDataSize = jsonObject.getInteger("gifDataSize");
 | 
	
		
			
				|  |  |                          int width = jsonObject.getInteger("width");
 | 
	
		
			
				|  |  |                          int height = jsonObject.getInteger("height");
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimGifElem(remoteUrl,gifDataSize,width,height);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimGifElem(remoteUrl, gifDataSize, width, height);
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  | -                    } else if (i.getClassname().equals("RC:HQVCMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:HQVCMsg")) {
 | 
	
		
			
				|  |  |                          //语音
 | 
	
		
			
				|  |  |                          String remoteUrl = jsonObject.getString("remoteUrl");
 | 
	
		
			
				|  |  |                          int duration = jsonObject.getInteger("duration");
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimSoundElem(remoteUrl,duration);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimSoundElem(remoteUrl, duration);
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:FileMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:FileMsg")) {
 | 
	
		
			
				|  |  |                          //文件
 | 
	
		
			
				|  |  |                          String fileUrl = jsonObject.getString("fileUrl");
 | 
	
		
			
				|  |  |                          String size = jsonObject.getString("size");
 | 
	
		
			
				|  |  |                          String name = jsonObject.getString("name");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimFileElem(fileUrl,size,name);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimFileElem(fileUrl, size, name);
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:SightMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:SightMsg")) {
 | 
	
		
			
				|  |  |                          //视频
 | 
	
		
			
				|  |  |                          String sightUrl = jsonObject.getString("sightUrl");
 | 
	
		
			
				|  |  |                          String size = jsonObject.getString("size");
 | 
	
	
		
			
				|  | @@ -802,26 +802,26 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          String content = jsonObject.getString("content");
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = null;
 | 
	
		
			
				|  |  |                          try {
 | 
	
		
			
				|  |  | -                            body1 = getTimVideoFileElem(sightUrl,size,duration,content);
 | 
	
		
			
				|  |  | +                            body1 = getTimVideoFileElem(sightUrl, size, duration, content);
 | 
	
		
			
				|  |  |                          } catch (IOException e) {
 | 
	
		
			
				|  |  |                              e.printStackTrace();
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:LBSMsg")) {
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:LBSMsg")) {
 | 
	
		
			
				|  |  |                          //位置
 | 
	
		
			
				|  |  |                          double latitude = jsonObject.getDouble("latitude");
 | 
	
		
			
				|  |  |                          double longitude = jsonObject.getDouble("longitude");
 | 
	
		
			
				|  |  |                          String poi = jsonObject.getString("poi");
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = getTimLocationElem(latitude, longitude, poi);
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  | -                    } else if (i.getClassname().equals("RC:ImgTextMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:ImgTextMsg")) {
 | 
	
		
			
				|  |  |                          //图文
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimTextElem(jsonObject.getString("content"));
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body2 = CustomerServiceBatchSendingServiceImpl.getTimImageElem(jsonObject.getString("imageUri"));
 | 
	
		
			
				|  |  |                          list.add(body1);
 | 
	
		
			
				|  |  |                          list.add(body2);
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                 /* body.setMsgType(i.getClassname());
 | 
	
	
		
			
				|  | @@ -846,7 +846,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          //为已导入数据更改标识
 | 
	
		
			
				|  |  |                          imGroupService.updateStatus(info);
 | 
	
		
			
				|  |  |                      } catch (Exception e) {
 | 
	
		
			
				|  |  | -                        log.error("导入私聊IM消息失败 msg:{}",list,e);
 | 
	
		
			
				|  |  | +                        log.error("导入私聊IM消息失败 msg:{},entity:{}", list,i, e);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } else if (type == 3) {
 | 
	
		
			
				|  |  |                      //群组会话
 | 
	
	
		
			
				|  | @@ -904,23 +904,23 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          int gifDataSize = jsonObject.getInteger("gifDataSize");
 | 
	
		
			
				|  |  |                          int width = jsonObject.getInteger("width");
 | 
	
		
			
				|  |  |                          int height = jsonObject.getInteger("height");
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimGifElem(remoteUrl,gifDataSize,width,height);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimGifElem(remoteUrl, gifDataSize, width, height);
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  | -                    } else if (i.getClassname().equals("RC:HQVCMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:HQVCMsg")) {
 | 
	
		
			
				|  |  |                          //语音
 | 
	
		
			
				|  |  |                          String remoteUrl = jsonObject.getString("remoteUrl");
 | 
	
		
			
				|  |  |                          int duration = jsonObject.getInteger("duration");
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimSoundElem(remoteUrl,duration);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimSoundElem(remoteUrl, duration);
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:FileMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:FileMsg")) {
 | 
	
		
			
				|  |  |                          //文件
 | 
	
		
			
				|  |  |                          String fileUrl = jsonObject.getString("fileUrl");
 | 
	
		
			
				|  |  |                          String size = jsonObject.getString("size");
 | 
	
		
			
				|  |  |                          String name = jsonObject.getString("name");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        TencentRequest.MessageBody body1 = getTimFileElem(fileUrl,size,name);
 | 
	
		
			
				|  |  | +                        TencentRequest.MessageBody body1 = getTimFileElem(fileUrl, size, name);
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:SightMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:SightMsg")) {
 | 
	
		
			
				|  |  |                          //视频
 | 
	
		
			
				|  |  |                          String sightUrl = jsonObject.getString("sightUrl");
 | 
	
		
			
				|  |  |                          String size = jsonObject.getString("size");
 | 
	
	
		
			
				|  | @@ -928,31 +928,31 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          String content = jsonObject.getString("content");
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = null;
 | 
	
		
			
				|  |  |                          try {
 | 
	
		
			
				|  |  | -                            body1 = getTimVideoFileElem(sightUrl,size,duration,content);
 | 
	
		
			
				|  |  | +                            body1 = getTimVideoFileElem(sightUrl, size, duration, content);
 | 
	
		
			
				|  |  |                          } catch (IOException e) {
 | 
	
		
			
				|  |  |                              e.printStackTrace();
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  | -                    } else if(i.getClassname().equals("RC:LBSMsg")) {
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:LBSMsg")) {
 | 
	
		
			
				|  |  |                          //位置
 | 
	
		
			
				|  |  |                          double latitude = jsonObject.getDouble("latitude");
 | 
	
		
			
				|  |  |                          double longitude = jsonObject.getDouble("longitude");
 | 
	
		
			
				|  |  |                          String poi = jsonObject.getString("poi");
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = getTimLocationElem(latitude, longitude, poi);
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  | -                    } else if (i.getClassname().equals("RC:ImgTextMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:ImgTextMsg")) {
 | 
	
		
			
				|  |  |                          //图文
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimTextElem(jsonObject.getString("content"));
 | 
	
		
			
				|  |  |                          TencentRequest.MessageBody body2 = CustomerServiceBatchSendingServiceImpl.getTimImageElem(jsonObject.getString("imageUri"));
 | 
	
		
			
				|  |  |                          bodyList.add(body1);
 | 
	
		
			
				|  |  |                          bodyList.add(body2);
 | 
	
		
			
				|  |  | -                    } else if (i.getClassname().equals("RC:CombineMsg")){
 | 
	
		
			
				|  |  | +                    } else if (i.getClassname().equals("RC:CombineMsg")) {
 | 
	
		
			
				|  |  |                          //合并转发
 | 
	
		
			
				|  |  |                          String remoteUrl = jsonObject.getString("remoteUrl");
 | 
	
		
			
				|  |  |                          int conversationType = jsonObject.getInteger("conversationType");
 | 
	
		
			
				|  |  |                          getTimRelayElem();
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  | -                        return;
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  /*body.setMsgContent(i.getContent());
 | 
	
		
			
				|  |  |                  body.setMsgType(i.getClassname());*/
 | 
	
	
		
			
				|  | @@ -975,14 +975,14 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                          //为已导入数据更改标识
 | 
	
		
			
				|  |  |                          imGroupService.updateStatus(info);
 | 
	
		
			
				|  |  |                      } catch (Exception e) {
 | 
	
		
			
				|  |  | -                        log.error("导入群组IM消息失败 msg:{}",list,e);
 | 
	
		
			
				|  |  | +                        log.error("导入群组IM消息失败 msg:{},entity:{}", list,i, e);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                log.info("导入消息成功:{}",i);
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  | -                log.error("导入失败,{}",i,e);
 | 
	
		
			
				|  |  | +                log.error("导入消息失败:",e);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private TencentRequest.MessageBody getTimGifElem(String remoteUr,int size,int width,int height) {
 | 
	
	
		
			
				|  | @@ -1159,12 +1159,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |       * 群迁移
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void groupTransfer(String groupId) {
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotBlank(groupId)) {
 | 
	
		
			
				|  |  | -            ImGroup byId = this.getById(groupId);
 | 
	
		
			
				|  |  | -            groupTransfer(Collections.singletonList(byId));
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +    public void groupTransfer() {
 | 
	
		
			
				|  |  |          int page = 1;
 | 
	
		
			
				|  |  |          int size = 100;
 | 
	
		
			
				|  |  |          List<ImGroup> imGroups = this.lambdaQuery().orderByDesc(ImGroup::getCreateTime)
 | 
	
	
		
			
				|  | @@ -1175,9 +1170,6 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |              page++;
 | 
	
		
			
				|  |  |              imGroups = this.lambdaQuery().orderByDesc(ImGroup::getCreateTime)
 | 
	
		
			
				|  |  |                      .last("limit " + ((page - 1) * size) + "," + size).list();
 | 
	
		
			
				|  |  | -            if (CollectionUtils.isNotEmpty(imGroups)) {
 | 
	
		
			
				|  |  | -                groupTransfer(imGroups);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1282,11 +1274,22 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |          String courseIcon = sysConfigService.findConfigValue(SysConfigConstant.ICON_COURSE_GROUP_DEFAULT);
 | 
	
		
			
				|  |  |          String defaultHeard = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD);
 | 
	
		
			
				|  |  |          for (ImGroup imGroup : records) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            log.info("群迁移开始:{}", imGroup.getId());
 | 
	
		
			
				|  |  | +            // 先删除群组
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                // 解散群
 | 
	
		
			
				|  |  | +                imPluginContext.getPluginService().groupDismiss(imGroup.getId(), new ArrayList<>());
 | 
	
		
			
				|  |  | +            } catch (Exception e) {
 | 
	
		
			
				|  |  | +                log.error(String.format("群迁移删除群聊失败:%s", e.getMessage()),e);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              List<ImGroupMember> memberList = imGroupMemberService.lambdaQuery()
 | 
	
		
			
				|  |  |                      .eq(ImGroupMember::getGroupId, imGroup.getId())
 | 
	
		
			
				|  |  |                      .list();
 | 
	
		
			
				|  |  |              ImGroupMember admin = memberList.stream().filter(ImGroupMember::getIsAdmin).findFirst().orElse(null);
 | 
	
		
			
				|  |  |              if (admin == null) {
 | 
	
		
			
				|  |  | +                log.info("群主不存在,groupId:{}",imGroup.getId());
 | 
	
		
			
				|  |  |                  continue;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              try {
 | 
	
	
		
			
				|  | @@ -1348,11 +1351,12 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 | 
	
		
			
				|  |  |                  log.error(String.format("群迁移加入群聊失败:%s", e.getMessage()));
 | 
	
		
			
				|  |  |                  log.error("群迁移加入群聊失败",e);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            log.info("群迁移成功:{}", imGroup.getId());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void register(Long userId, String imGroupId, String avatar, Boolean admin, ClientEnum clientType) {
 | 
	
		
			
				|  |  | -        SysUser user = sysUserService.findUserById(userId);
 | 
	
		
			
				|  |  | +        SysUser user = sysUserService.getByUserId(userId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 群组默认头象
 | 
	
		
			
				|  |  |          List<GroupMemberWrapper.ImGroupMember> groupMembers = Lists.newArrayList();
 |