From aa3706580edc249216c20db6992aaf5b249dd960 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 22 十二月 2023 17:00:58 +0800
Subject: [PATCH] 群组
---
ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupMapper.java | 8 ++++
ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java | 38 +++++++++++++++++--
ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroupUser.java | 10 +++++
ard-work/src/main/java/com/ruoyi/sy/param/LockPageParam.java | 13 ++++++
ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroup.java | 13 ++++++
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 25 +++++++++---
ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupUserMapper.java | 8 ++++
7 files changed, 105 insertions(+), 10 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroup.java b/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroup.java
new file mode 100644
index 0000000..b5d525d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroup.java
@@ -0,0 +1,13 @@
+package com.ruoyi.rongcloud.domain;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ArdRongGroup {
+ private String groupId;
+ private String groupName;
+ private String createName;
+ private Date createTime;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroupUser.java b/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroupUser.java
new file mode 100644
index 0000000..35a2803
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/domain/ArdRongGroupUser.java
@@ -0,0 +1,10 @@
+package com.ruoyi.rongcloud.domain;
+
+import lombok.Data;
+
+@Data
+public class ArdRongGroupUser {
+ private String id;
+ private String groupId;
+ private String userId;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupMapper.java b/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupMapper.java
new file mode 100644
index 0000000..e8474d5
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupMapper.java
@@ -0,0 +1,8 @@
+package com.ruoyi.rongcloud.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.rongcloud.domain.ArdRongGroup;
+
+
+public interface ArdRongGroupMapper extends BaseMapper<ArdRongGroup> {
+}
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupUserMapper.java b/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupUserMapper.java
new file mode 100644
index 0000000..5ab746c
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/mapper/ArdRongGroupUserMapper.java
@@ -0,0 +1,8 @@
+package com.ruoyi.rongcloud.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.rongcloud.domain.ArdRongGroupUser;
+
+public interface ArdRongGroupUserMapper extends BaseMapper<ArdRongGroupUser> {
+}
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 3d2c334..de5e963 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
@@ -1,11 +1,12 @@
package com.ruoyi.rongcloud.service.Impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.rongcloud.domain.RongCloudGroupDisParam;
-import com.ruoyi.rongcloud.domain.RongCloudGroupParam;
-import com.ruoyi.rongcloud.domain.RongCloudParam;
+import com.ruoyi.rongcloud.mapper.ArdRongGroupMapper;
+import com.ruoyi.rongcloud.mapper.ArdRongGroupUserMapper;
+import com.ruoyi.rongcloud.domain.*;
import com.ruoyi.rongcloud.service.RongCloudService;
import com.ruoyi.utils.forest.RongCloudClient;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +32,11 @@
RongCloudClient rongCloudClient;
@Resource
RedisCache redisCache;
+ @Resource
+ private ArdRongGroupMapper ardRongGroupMapper;
+ @Resource
+ private ArdRongGroupUserMapper ardRongGroupUserMapper;
+
/**
* 鑾峰彇铻嶄簯token
@@ -79,7 +85,24 @@
public AjaxResult groupCreate(RongCloudGroupParam group) {
group.setGroupId(String.valueOf(UUID.randomUUID()));
Map<String, Object> groupMap = rongCloudClient.groupCreate(getRongCloudHead(),group);
- groupMap.put("userId",group.getGroupId());
+ Integer code = (Integer) groupMap.get("code");
+ if(code.equals(200)){
+ ArdRongGroup ardRongGroup = new ArdRongGroup();
+ ardRongGroup.setGroupId(group.getGroupId());
+ ardRongGroup.setGroupName(group.getGroupName());
+ ardRongGroup.setCreateName(SecurityUtils.getUserId());
+ ardRongGroup.setCreateTime(new Date());
+ ardRongGroupMapper.insert(ardRongGroup);
+ List<String> userList = group.getUserId();
+ for (int i = 0; i < userList.size(); i++) {
+ ArdRongGroupUser ardRongGroupUser = new ArdRongGroupUser();
+ ardRongGroupUser.setId(String.valueOf(UUID.randomUUID()));
+ ardRongGroupUser.setGroupId(group.getGroupId());
+ ardRongGroupUser.setUserId(userList.get(i));
+ ardRongGroupUserMapper.insert(ardRongGroupUser);
+ }
+ }
+ groupMap.put("userId",group.getUserId());
groupMap.put("groupId",group.getGroupId());
groupMap.put("group",group.getGroupName());
return AjaxResult.success(groupMap);
@@ -88,6 +111,13 @@
@Override
public AjaxResult groupDismiss(RongCloudGroupDisParam groupDis) {
Map<String, Object> groupMap = rongCloudClient.groupDismiss(getRongCloudHead(),groupDis);
+ Integer code = (Integer) groupMap.get("code");
+ if(code.equals(200)){
+ ardRongGroupMapper.deleteById(groupDis.getGroupId());
+ QueryWrapper<ArdRongGroupUser> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("group_id",groupDis.getGroupId());
+ ardRongGroupUserMapper.delete(queryWrapper);
+ }
groupMap.put("groupId",groupDis.getGroupId());
groupMap.put("userId",groupDis.getUserId());
return AjaxResult.success(groupMap);
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
index 92d6ab4..a281656 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
@@ -1,6 +1,8 @@
package com.ruoyi.sy.controller;
import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
@@ -9,10 +11,7 @@
import com.ruoyi.sy.domain.ArdSyCarRtu;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.mapper.ArdAccessFenceMapper;
-import com.ruoyi.sy.param.AddCarParam;
-import com.ruoyi.sy.param.AddRtuParam;
-import com.ruoyi.sy.param.LockTypeParam;
-import com.ruoyi.sy.param.RtuTypeParam;
+import com.ruoyi.sy.param.*;
import com.ruoyi.sy.service.*;
import com.ruoyi.sy.service.impl.ArdSyCarRtuServiceImpl;
import com.ruoyi.sy.vo.CarLockVo;
@@ -106,10 +105,24 @@
@GetMapping("/query")
@ApiOperation("鏌ヨ鎵�鏈塺tu鎸傝浇鐨勮溅杈�")
- public Results query(){
+ public Results query(LockPageParam lockPageParam){
List<CarVo> list = ardSyCarLockService.carList();
analysis(list);
- return Results.succeed(list);
+ List<CarVo> newList = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ String plate = list.get(i).getCarPlate();
+ if(lockPageParam.getCarPlate()!=null){
+ if(plate.contains(lockPageParam.getCarPlate())){
+ newList.add(list.get(i));
+ }
+ }
+ }
+ PageHelper.startPage(lockPageParam.getPageNum(),lockPageParam.getPageSize());
+ if(lockPageParam.getCarPlate()!=null){
+ return Results.succeed(new PageInfo<>(newList));
+ }else {
+ return Results.succeed(new PageInfo<>(list));
+ }
}
@PostMapping("/addLock")
diff --git a/ard-work/src/main/java/com/ruoyi/sy/param/LockPageParam.java b/ard-work/src/main/java/com/ruoyi/sy/param/LockPageParam.java
new file mode 100644
index 0000000..bb80bdc
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/param/LockPageParam.java
@@ -0,0 +1,13 @@
+package com.ruoyi.sy.param;
+
+import lombok.Data;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class LockPageParam {
+ private String carPlate;
+ private Integer pageSize = 10;
+ private Integer pageNum = 1;
+}
--
Gitblit v1.9.3