From fe7ee05732e56ab830f1a1f1228a69899e609999 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期一, 25 十二月 2023 17:00:58 +0800
Subject: [PATCH] 融云
---
ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java | 116 +++++++++++++++++++++++++-------------
ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java | 3 +
ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java | 14 ++++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 2
4 files changed, 93 insertions(+), 42 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java b/ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java
index 7bbc974..74371c3 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java
@@ -103,4 +103,18 @@
{
return rongCloudService.groupSync(syncParam);
}
+
+ @GetMapping("/groupInfo")
+ @ApiOperation("缇ょ粍绠$悊-鏌ヨ缇ょ粍璇︽儏")
+ public AjaxResult groupInfo(String groupId)
+ {
+ return rongCloudService.groupInfo(groupId);
+ }
+
+ @GetMapping("/groupUserAll")
+ @ApiOperation("缇ょ粍绠$悊-鏌ヨ缇ょ粍璇︽儏")
+ public AjaxResult groupUserAll(String groupId)
+ {
+ return rongCloudService.groupUserAll(groupId);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java b/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
index 525c632..d892d16 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
@@ -58,7 +58,7 @@
RongCloudParam param = new RongCloudParam();
param.setUserId(userId);
param.setName(name);
- Map<String,Object> map = rongCloudClient.getToken(getRongCloudHead(), param);
+ Map<String, Object> map = rongCloudClient.getToken(getRongCloudHead(), param);
token = (String) map.get("token");
log.debug("鐢ㄦ埛" + userId + "鑾峰彇鍒拌瀺浜憈oken:" + token);
} catch (Exception ex) {
@@ -68,12 +68,12 @@
}
@Override
- public Map<String,Object> checkOnline(List<String> userIds) {
+ public Map<String, Object> checkOnline(List<String> userIds) {
Map<String, Object> onlineMap = new HashMap<>();
for (String userId : userIds) {
RongCloudParam param = new RongCloudParam();
param.setUserId(userId);
- Map<String,Object> isOnline = rongCloudClient.checkOnline(getRongCloudHead(), param);
+ Map<String, Object> isOnline = rongCloudClient.checkOnline(getRongCloudHead(), param);
onlineMap.put(userId, isOnline.get("status"));
}
return onlineMap;
@@ -83,16 +83,16 @@
public Boolean checkOnline(String userId) {
RongCloudParam param = new RongCloudParam();
param.setUserId(userId);
- Map<String,Object> isOnline = rongCloudClient.checkOnline(getRongCloudHead(), param);
+ Map<String, Object> isOnline = rongCloudClient.checkOnline(getRongCloudHead(), param);
return isOnline.get("status").equals("1");
}
@Override
public AjaxResult groupCreate(RongCloudGroupParam group) {
group.setGroupId(String.valueOf(UUID.randomUUID()));
- Map<String, Object> groupMap = rongCloudClient.groupCreate(getRongCloudHead(),group);
+ Map<String, Object> groupMap = rongCloudClient.groupCreate(getRongCloudHead(), group);
Integer code = (Integer) groupMap.get("code");
- if(code.equals(200)){
+ if (code.equals(200)) {
ArdRongGroup ardRongGroup = new ArdRongGroup();
ardRongGroup.setGroupId(group.getGroupId());
ardRongGroup.setGroupName(group.getGroupName());
@@ -108,33 +108,33 @@
ardRongGroupUserMapper.insert(ardRongGroupUser);
}
}
- groupMap.put("userId",group.getUserId());
- groupMap.put("groupId",group.getGroupId());
- groupMap.put("group",group.getGroupName());
+ groupMap.put("userId", group.getUserId());
+ groupMap.put("groupId", group.getGroupId());
+ groupMap.put("group", group.getGroupName());
return AjaxResult.success(groupMap);
}
@Override
public AjaxResult groupDismiss(RongCloudGroupDisParam groupDis) {
- Map<String, Object> groupMap = rongCloudClient.groupDismiss(getRongCloudHead(),groupDis);
+ Map<String, Object> groupMap = rongCloudClient.groupDismiss(getRongCloudHead(), groupDis);
Integer code = (Integer) groupMap.get("code");
- if(code.equals(200)){
+ if (code.equals(200)) {
ardRongGroupMapper.deleteById(groupDis.getGroupId());
QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("group_id",groupDis.getGroupId());
+ queryWrapper.eq("group_id", groupDis.getGroupId());
ardRongGroupUserMapper.delete(queryWrapper);
}
- groupMap.put("groupId",groupDis.getGroupId());
- groupMap.put("userId",groupDis.getUserId());
+ groupMap.put("groupId", groupDis.getGroupId());
+ groupMap.put("userId", groupDis.getUserId());
return AjaxResult.success(groupMap);
}
@Override
public AjaxResult groupJoin(RongCloudGroupParam groupParam) {
- Map<String, Object> groupMap = rongCloudClient.groupJoin(getRongCloudHead(),groupParam);
+ Map<String, Object> groupMap = rongCloudClient.groupJoin(getRongCloudHead(), groupParam);
Integer code = (Integer) groupMap.get("code");
- if(code.equals(200)){
- if(groupParam.getGroupName()!=null){
+ if (code.equals(200)) {
+ if (groupParam.getGroupName() != null) {
ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupParam.getGroupId());
ardRongGroup.setGroupName(groupParam.getGroupName());
ardRongGroupMapper.updateById(ardRongGroup);
@@ -148,38 +148,38 @@
ardRongGroupUserMapper.insert(ardRongGroupUser);
}
}
- groupMap.put("groupId",groupParam.getGroupId());
- if(groupParam.getGroupName()!=null){
- groupMap.put("groupName",groupParam.getGroupId());
- }else {
+ groupMap.put("groupId", groupParam.getGroupId());
+ if (groupParam.getGroupName() != null) {
+ groupMap.put("groupName", groupParam.getGroupId());
+ } else {
ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupParam.getGroupId());
- groupMap.put("groupName",ardRongGroup.getGroupName());
+ groupMap.put("groupName", ardRongGroup.getGroupName());
}
- groupMap.put("userId",groupParam.getUserId());
+ groupMap.put("userId", groupParam.getUserId());
return AjaxResult.success(groupMap);
}
@Override
public AjaxResult groupQuit(RongCloudGroupParam groupParam) {
- Map<String, Object> groupMap = rongCloudClient.groupQuit(getRongCloudHead(),groupParam);
+ Map<String, Object> groupMap = rongCloudClient.groupQuit(getRongCloudHead(), groupParam);
Integer code = (Integer) groupMap.get("code");
- if(code.equals(200)){
+ if (code.equals(200)) {
ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupParam.getGroupId());
ardRongGroup.setGroupName(groupParam.getGroupName());
ardRongGroupMapper.updateById(ardRongGroup);
}
- groupMap.put("groupId",groupParam.getGroupId());
- groupMap.put("groupName",groupParam.getGroupName());
+ groupMap.put("groupId", groupParam.getGroupId());
+ groupMap.put("groupName", groupParam.getGroupName());
return AjaxResult.success(groupMap);
}
@Override
public AjaxResult groupUserQuery(RongCloudGroupParam groupId) {
- Map<String, Object> groupMap = rongCloudClient.groupUserQuery(getRongCloudHead(),groupId);
+ Map<String, Object> groupMap = rongCloudClient.groupUserQuery(getRongCloudHead(), groupId);
Integer code = (Integer) groupMap.get("code");
List<SysUser> sysUsers = new ArrayList<>();
- if(code.equals(200)){
- List<Map<String,String>> list = (List<Map<String, String>>) groupMap.get("users");
+ if (code.equals(200)) {
+ List<Map<String, String>> list = (List<Map<String, String>>) groupMap.get("users");
for (int i = 0; i < list.size(); i++) {
String id = list.get(i).get("id");
SysUser sysUser = sysUserMapper.selectUserById(id);
@@ -191,25 +191,25 @@
@Override
public AjaxResult groupRefresh(RongCloudGroupParam groupParam) {
- Map<String, Object> groupMap = rongCloudClient.groupRefresh(getRongCloudHead(),groupParam);
+ Map<String, Object> groupMap = rongCloudClient.groupRefresh(getRongCloudHead(), groupParam);
Integer code = (Integer) groupMap.get("code");
- if(code.equals(200)){
+ 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());
+ queryWrapper.eq("user_id", groupParam.getGroupId())
+ .eq("group_id", groupParam.getUserId());
ardRongGroupUserMapper.delete(queryWrapper);
}
}
- groupMap.put("groupId",groupParam.getGroupId());
- groupMap.put("userId",groupParam.getUserId());
+ groupMap.put("groupId", groupParam.getGroupId());
+ groupMap.put("userId", groupParam.getUserId());
return AjaxResult.success(groupMap);
}
@Override
public AjaxResult userGroupQuery(RongCloudGroupUserParam userParam) {
- return AjaxResult.success(rongCloudClient.userGroupQuery(getRongCloudHead(),userParam));
+ return AjaxResult.success(rongCloudClient.userGroupQuery(getRongCloudHead(), userParam));
}
@Override
@@ -218,23 +218,57 @@
endParam.setUserId(syncParam.getUserId());
List<RongCloudGroupSyncTwoParam> twoParams = syncParam.getList();
for (int i = 0; i < twoParams.size(); i++) {
- RongCloudGroupSyncTwoParam syncTwoParam= twoParams.get(i);
+ RongCloudGroupSyncTwoParam syncTwoParam = twoParams.get(i);
String groupId = syncTwoParam.getGroupId();
String groupName = syncTwoParam.getGroupName();
try {
Class clazz = endParam.getClass();
// 鍔ㄦ�佹坊鍔犲睘鎬�
- Field ageField = clazz.getDeclaredField("group["+groupId+"]");
+ Field ageField = clazz.getDeclaredField("group[" + groupId + "]");
ageField.setAccessible(true); // 璁剧疆绉佹湁灞炴�у彲璁块棶
ageField.set(endParam, groupName);
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
}
- Map<String, Object> groupMap = rongCloudClient.groupSync(getRongCloudHead(),endParam);
+ Map<String, Object> groupMap = rongCloudClient.groupSync(getRongCloudHead(), endParam);
return AjaxResult.success(groupMap);
}
+ @Override
+ public AjaxResult groupInfo(String groupId) {
+ Map<String,Object> map = new HashMap<>();
+ ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupId);
+ map.put("group",ardRongGroup);
+ QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("group_id",groupId);
+ List<ArdRongGroupUser> list = ardRongGroupUserMapper.selectList(queryWrapper);
+ List<SysUser> sysUsers = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ String userId = list.get(i).getUserId();
+ SysUser sysUser = sysUserMapper.selectUserById(userId);
+ sysUsers.add(sysUser);
+ }
+ map.put("user",sysUsers);
+ return AjaxResult.success(map);
+ }
+
+ @Override
+ public AjaxResult groupUserAll(String groupId) {
+ ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupId);
+ QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("group_id",groupId);
+ 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);
+ List<SysUser> sysUsers = sysUserMapper.selectList(queryWrapper1);
+ return AjaxResult.success(sysUsers);
+ }
+
/**
* 鑾峰彇铻嶄簯绛惧悕淇℃伅
*/
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java b/ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java
index 8b00899..d5fb97a 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java
@@ -30,4 +30,7 @@
AjaxResult groupRefresh(RongCloudGroupParam groupParam);
AjaxResult userGroupQuery(RongCloudGroupUserParam userParam);
AjaxResult groupSync(RongCloudGroupSyncParam syncParam);
+
+ AjaxResult groupInfo(String groupId);
+ AjaxResult groupUserAll(String groupId);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index 63b1505..bb69bbe 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -63,7 +63,7 @@
* 鑾峰彇鐢ㄦ埛鍒楄〃
*/
@ApiOperation("鑾峰彇鐢ㄦ埛鍒楄〃")
- @PreAuthorize("@ss.hasPermi('system:user:list')")
+// @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(SysUser user) {
startPage();
--
Gitblit v1.9.3