diff --git a/im-admin-ui/src/views/system/role/index.vue b/im-admin-ui/src/views/system/role/index.vue
index f2299d7..cd8d3fc 100644
--- a/im-admin-ui/src/views/system/role/index.vue
+++ b/im-admin-ui/src/views/system/role/index.vue
@@ -77,15 +77,15 @@
-
+
+
@@ -113,7 +113,7 @@
权限字符
-
+
diff --git a/im-admin-ui/src/views/system/user/index.vue b/im-admin-ui/src/views/system/user/index.vue
index 46bffd2..7defb6c 100644
--- a/im-admin-ui/src/views/system/user/index.vue
+++ b/im-admin-ui/src/views/system/user/index.vue
@@ -123,9 +123,9 @@
-
+
diff --git a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java
index 8bdbaa9..9b175e5 100644
--- a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java
+++ b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java
@@ -72,7 +72,7 @@ public class SysUserController extends BaseController {
*/
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
- @PostMapping("/export")
+ //@PostMapping("/export")
public void export(SysUserBo user, HttpServletResponse response) {
List list = userService.selectUserExportList(user);
ExcelUtil.exportExcel(list, "用户数据", SysUserExportVo.class, response);
@@ -208,7 +208,30 @@ public class SysUserController extends BaseController {
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
- return toAjax(userService.updateUser(user));
+
+ int update = userService.updateUser(user);
+
+ if(update > 0){
+ SysUser newUser = userService.getUserByUserName(user.getUserName());
+ //获取该用户权限,判断是否拥有agentAdmin权限
+ List permissions = userService.getPermissionsByUserId(newUser.getUserId());
+
+ //判断该用户是否拥有agentAdmin权限
+ if(permissions.contains("agentAdmin")){
+ //判断是否已经插入过代理端数据
+ if(imAgentService.isExistAgent(newUser.getUserId())){
+ //更新代理用户名
+ imAgentService.updateAgentName(newUser.getUserId(), newUser.getUserName());
+ return toAjax(update);
+ }
+
+ //插入代理端数据
+ int insertAgent = imAgentService.insertAgentData(newUser.getUserId(), newUser.getUserName());
+ return toAjax(insertAgent);
+ }
+ }
+
+ return toAjax(update);
}
/**
@@ -290,7 +313,7 @@ public class SysUserController extends BaseController {
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
- @PutMapping("/authRole")
+ //@PutMapping("/authRole")
public R insertAuthRole(Long userId, Long[] roleIds) {
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds);
diff --git a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IImAgentAdminService.java b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IImAgentAdminService.java
index 8ee3979..bf15f7b 100644
--- a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IImAgentAdminService.java
+++ b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IImAgentAdminService.java
@@ -82,5 +82,22 @@ public interface IImAgentAdminService {
String checkIsExpired(Long sysId);
+ /**
+ * 判断是否已经存在代理
+ *
+ * @param sysId 系统用户id
+ * @return 是否已经存在代理
+ */
+ boolean isExistAgent(Long sysId);
+
+ /**
+ * 更新代理名称
+ *
+ * @param sysId 系统用户id
+ * @param agentName 代理名称
+ */
+ void updateAgentName(Long sysId,String agentName);
+
+
}
diff --git a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/ImAgentAdminServiceImpl.java b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/ImAgentAdminServiceImpl.java
index 5284fa0..88d8c6e 100644
--- a/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/ImAgentAdminServiceImpl.java
+++ b/im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/ImAgentAdminServiceImpl.java
@@ -3,6 +3,7 @@ package org.dromara.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -189,5 +190,22 @@ public class ImAgentAdminServiceImpl implements IImAgentAdminService {
}
+ @Override
+ public boolean isExistAgent(Long sysId) {
+
+ LambdaQueryWrapper lqw = Wrappers.lambdaQuery();
+ lqw.eq(ImAgentAdmin::getSysId, sysId);
+ return baseMapper.selectCount(lqw) > 0;
+
+ }
+
+ @Override
+ public void updateAgentName(Long sysId, String agentName) {
+ LambdaUpdateWrapper luw = Wrappers.lambdaUpdate();
+ luw.set(ImAgentAdmin::getAgentName, agentName);
+ luw.eq(ImAgentAdmin::getSysId, sysId);
+ baseMapper.update(null, luw);
+ }
+
}