From 6482335baf447da4faf65fd26e6155cef1c0b05f Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期六, 23 十二月 2023 10:10:19 +0800
Subject: [PATCH] 融云
---
ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java | 58 ++++++++++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java | 7 ++-
ard-work/src/main/java/com/ruoyi/utils/forest/RongCloudClient.java | 15 ++++++-
ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java | 25 +++++++++++-
ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudParam.java | 2
ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupDisParam.java | 2
ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupParam.java | 2
7 files changed, 100 insertions(+), 11 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 1fe7b25..2b88f32 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
@@ -2,8 +2,8 @@
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.rongcloud.domain.RongCloudGroupDisParam;
-import com.ruoyi.rongcloud.domain.RongCloudGroupParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupDisParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupParam;
import com.ruoyi.rongcloud.service.RongCloudService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -59,4 +59,25 @@
{
return rongCloudService.groupDismiss(groupDis);
}
+
+ @PostMapping("/groupJoin")
+ @ApiOperation("缇ょ粍绠$悊-鍔犲叆缇ょ粍")
+ public AjaxResult groupJoin(@RequestBody RongCloudGroupParam groupParam)
+ {
+ return rongCloudService.groupJoin(groupParam);
+ }
+
+ @PostMapping("/groupQuit")
+ @ApiOperation("缇ょ粍绠$悊-閫�鍑虹兢缁�")
+ public AjaxResult groupQuit(@RequestBody RongCloudGroupParam groupParam)
+ {
+ return rongCloudService.groupQuit(groupParam);
+ }
+
+ @PostMapping("/groupUserQuery")
+ @ApiOperation("缇ょ粍绠$悊-鏌ヨ缇ょ粍鎴愬憳")
+ public AjaxResult groupUserQuery(@RequestBody RongCloudGroupParam groupId)
+ {
+ return rongCloudService.groupUserQuery(groupId);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupDisParam.java b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupDisParam.java
similarity index 81%
rename from ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupDisParam.java
rename to ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupDisParam.java
index f0d766b..68fc844 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupDisParam.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupDisParam.java
@@ -1,4 +1,4 @@
-package com.ruoyi.rongcloud.domain;
+package com.ruoyi.rongcloud.param;
import lombok.Data;
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupParam.java b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupParam.java
similarity index 83%
rename from ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupParam.java
rename to ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupParam.java
index 3f381cf..e892e4d 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudGroupParam.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudGroupParam.java
@@ -1,4 +1,4 @@
-package com.ruoyi.rongcloud.domain;
+package com.ruoyi.rongcloud.param;
import lombok.Data;
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudParam.java b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudParam.java
similarity index 86%
rename from ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudParam.java
rename to ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudParam.java
index 5d0c41e..c059861 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/RongCloudParam.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/param/RongCloudParam.java
@@ -1,4 +1,4 @@
-package com.ruoyi.rongcloud.domain;
+package com.ruoyi.rongcloud.param;
import lombok.Data;
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 de5e963..eb3484d 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
@@ -7,6 +7,9 @@
import com.ruoyi.rongcloud.mapper.ArdRongGroupMapper;
import com.ruoyi.rongcloud.mapper.ArdRongGroupUserMapper;
import com.ruoyi.rongcloud.domain.*;
+import com.ruoyi.rongcloud.param.RongCloudGroupDisParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupParam;
+import com.ruoyi.rongcloud.param.RongCloudParam;
import com.ruoyi.rongcloud.service.RongCloudService;
import com.ruoyi.utils.forest.RongCloudClient;
import lombok.extern.slf4j.Slf4j;
@@ -123,6 +126,59 @@
return AjaxResult.success(groupMap);
}
+ @Override
+ public AjaxResult groupJoin(RongCloudGroupParam groupParam) {
+ Map<String, Object> groupMap = rongCloudClient.groupJoin(getRongCloudHead(),groupParam);
+ Integer code = (Integer) groupMap.get("code");
+ if(code.equals(200)){
+ if(groupParam.getGroupName()!=null){
+ ArdRongGroup ardRongGroup = ardRongGroupMapper.selectById(groupParam.getGroupId());
+ ardRongGroup.setGroupName(groupParam.getGroupName());
+ ardRongGroupMapper.updateById(ardRongGroup);
+ }
+ List<String> userList = groupParam.getUserId();
+ for (int i = 0; i < userList.size(); i++) {
+ ArdRongGroupUser ardRongGroupUser = new ArdRongGroupUser();
+ ardRongGroupUser.setId(String.valueOf(UUID.randomUUID()));
+ ardRongGroupUser.setGroupId(groupParam.getGroupId());
+ ardRongGroupUser.setUserId(userList.get(i));
+ ardRongGroupUserMapper.insert(ardRongGroupUser);
+ }
+ }
+ 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("userId",groupParam.getUserId());
+ return AjaxResult.success(groupMap);
+ }
+
+ @Override
+ public AjaxResult groupQuit(RongCloudGroupParam groupParam) {
+ Map<String, Object> groupMap = rongCloudClient.groupQuit(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);
+ }
+ }
+ groupMap.put("groupId",groupParam.getGroupId());
+ groupMap.put("userId",groupParam.getUserId());
+ return AjaxResult.success(groupMap);
+ }
+
+ @Override
+ public AjaxResult groupUserQuery(RongCloudGroupParam groupId) {
+ return AjaxResult.success(rongCloudClient.groupUserQuery(getRongCloudHead(),groupId));
+ }
+
/**
* 鑾峰彇铻嶄簯绛惧悕淇℃伅
*/
@@ -130,7 +186,7 @@
String appKey = redisCache.getCacheObject("sys_config:RongCloudAppKey");
String appSecret = redisCache.getCacheObject("sys_config:RongCloudAppSecret");
String nonce = RandomStringUtils.randomNumeric(18);
- String timestamp = String.valueOf(new Date().getTime());
+ String timestamp = String.valueOf(System.currentTimeMillis());
String signature = DigestUtils.sha1Hex(appSecret + nonce + timestamp);//App Secret + Nonce + T
Map<String, Object> headerMap = new HashMap<>();
headerMap.put("App-Key", appKey);
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 36dbc1b..1227f0e 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
@@ -1,8 +1,8 @@
package com.ruoyi.rongcloud.service;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.rongcloud.domain.RongCloudGroupDisParam;
-import com.ruoyi.rongcloud.domain.RongCloudGroupParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupDisParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupParam;
import java.util.List;
import java.util.Map;
@@ -22,4 +22,7 @@
AjaxResult groupCreate(RongCloudGroupParam group);
AjaxResult groupDismiss(RongCloudGroupDisParam groupDis);
+ AjaxResult groupJoin(RongCloudGroupParam groupParam);
+ AjaxResult groupQuit(RongCloudGroupParam groupParam);
+ AjaxResult groupUserQuery(RongCloudGroupParam groupId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/forest/RongCloudClient.java b/ard-work/src/main/java/com/ruoyi/utils/forest/RongCloudClient.java
index e3f4ad4..95f8313 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/forest/RongCloudClient.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/forest/RongCloudClient.java
@@ -1,9 +1,9 @@
package com.ruoyi.utils.forest;
import com.dtflys.forest.annotation.*;
-import com.ruoyi.rongcloud.domain.RongCloudGroupDisParam;
-import com.ruoyi.rongcloud.domain.RongCloudGroupParam;
-import com.ruoyi.rongcloud.domain.RongCloudParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupDisParam;
+import com.ruoyi.rongcloud.param.RongCloudGroupParam;
+import com.ruoyi.rongcloud.param.RongCloudParam;
import com.ruoyi.rongcloud.service.MyAddressSource;
import java.util.Map;
@@ -25,4 +25,13 @@
@Post(url = "/group/dismiss.json")
Map<String,Object> groupDismiss(@Header Map<String, Object> headerMap, @Body RongCloudGroupDisParam groupDis);
+
+ @Post(url = "/group/join.json")
+ Map<String,Object> groupJoin(@Header Map<String, Object> headerMap, @Body RongCloudGroupParam groupParam);
+
+ @Post(url = "/group/quit.json")
+ Map<String,Object> groupQuit(@Header Map<String, Object> headerMap, @Body RongCloudGroupParam groupParam);
+
+ @Post(url = "/group/user/query.json")
+ Map<String,Object> groupUserQuery(@Header Map<String, Object> headerMap, @Body RongCloudGroupParam groupParam);
}
--
Gitblit v1.9.3