| | |
| | | package com.ruoyi.rongcloud.service.Impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dtflys.forest.exceptions.ForestRuntimeException; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | |
| | | Map<String, Object> map = rongCloudClient.getToken(getRongCloudHead(), param); |
| | | token = (String) map.get("token"); |
| | | log.debug("用户" + userId + "获取到融云token:" + token); |
| | | } catch (Exception ex) { |
| | | log.error("获取token异常:" + ex.getMessage()); |
| | | }catch(ForestRuntimeException ex) |
| | | { |
| | | log.error("获取融云token异常:" + ex.getMessage()); |
| | | } |
| | | return token; |
| | | } |
| | |
| | | Map<String, Object> groupMap = rongCloudClient.groupQuit(getRongCloudHead(), groupParam); |
| | | Integer code = (Integer) groupMap.get("code"); |
| | | if (code.equals(200)) { |
| | | ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupParam.getGroupId()); |
| | | ardRongGroup.setGroupName(groupParam.getGroupName()); |
| | | ardRongGroupMapper.updateById(ardRongGroup); |
| | | List<String> list = groupParam.getUserId(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | String userId = list.get(i); |
| | | QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("group_id",groupParam.getGroupId()) |
| | | .eq("user_id",userId); |
| | | ardRongGroupUserMapper.delete(queryWrapper); |
| | | } |
| | | } |
| | | groupMap.put("groupId", groupParam.getGroupId()); |
| | | groupMap.put("groupName", groupParam.getGroupName()); |
| | |
| | | Map<String, Object> groupMap = rongCloudClient.groupRefresh(getRongCloudHead(), groupParam); |
| | | Integer code = (Integer) groupMap.get("code"); |
| | | if (code.equals(200)) { |
| | | List<String> userList = groupParam.getUserId(); |
| | | for (int i = 0; i < userList.size(); i++) { |
| | | QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id", groupParam.getGroupId()) |
| | | .eq("group_id", groupParam.getUserId()); |
| | | ardRongGroupUserMapper.delete(queryWrapper); |
| | | } |
| | | String groupId = groupParam.getGroupId(); |
| | | String groupName = groupParam.getGroupName(); |
| | | QueryWrapper<ArdRongGroup> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("group_id",groupId); |
| | | ArdRongGroup ardRongGroup = ardRongGroupMapper.selectOne(queryWrapper); |
| | | ardRongGroup.setGroupName(groupName); |
| | | ardRongGroupMapper.updateById(ardRongGroup); |
| | | } |
| | | groupMap.put("groupId", groupParam.getGroupId()); |
| | | groupMap.put("userId", groupParam.getUserId()); |
| | | groupMap.put("groupName", groupParam.getGroupName()); |
| | | return AjaxResult.success(groupMap); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AjaxResult groupInfo(String groupId) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupId); |
| | | QueryWrapper<ArdRongGroup> ardRongGroupQueryWrapper = new QueryWrapper<>(); |
| | | ardRongGroupQueryWrapper.eq("group_id",groupId); |
| | | ArdRongGroup ardRongGroup = ardRongGroupMapper.selectOne(ardRongGroupQueryWrapper); |
| | | map.put("group",ardRongGroup); |
| | | QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("group_id",groupId); |
| | |
| | | public AjaxResult groupUserAll(String groupId) { |
| | | ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupId); |
| | | QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("group_id",groupId); |
| | | queryWrapper.eq("group_id",ardRongGroup.getGroupId()); |
| | | List<ArdRongGroupUser> list = ardRongGroupUserMapper.selectList(queryWrapper); |
| | | List<String> userList = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | userList.add(list.get(i).getUserId()); |
| | | } |
| | | QueryWrapper<SysUser> queryWrapper1 = new QueryWrapper<>(); |
| | | queryWrapper1.notIn("user_id",userList); |
| | | if(userList.size()>0){ |
| | | queryWrapper1.notIn("user_id",userList).eq("del_flag","0"); |
| | | }else { |
| | | queryWrapper1.eq("del_flag","0"); |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectList(queryWrapper1); |
| | | return AjaxResult.success(sysUsers); |
| | | } |