Browse Source

处理用户树接口,权限问题。

wukai 1 year ago
parent
commit
6a3f77556e

+ 1 - 1
doc-admin/src/main/java/com/doc/web/controller/system/SysUserController.java

@@ -83,7 +83,7 @@ public class SysUserController extends BaseController {
     @ApiOperation("获取用户树")
     @GetMapping("/tree")
     public UserTreeVO tree() {
-        List<SysDept> deptList = deptService.selectDeptList(new SysDept());
+        List<SysDept> deptList = deptService.selectAllDeptList();
         List<SysDept> list = deptService.buildDeptTree(deptList);
         SysDept tree = list.get(0);
         UserTreeVO vo = getChildren(tree);

+ 3 - 0
doc-biz/src/main/java/com/doc/biz/controller/DocMsgController.java

@@ -48,6 +48,9 @@ public class DocMsgController extends BaseController {
     @PostMapping("/send")
     public AjaxResult send(@RequestBody DocMsg msg) {
         msg.setFromUid(SecurityUtils.getUserId());
+        if (msg.getFromUid().equals(msg.getToUid())) {
+            return error("不允许给自己发送消息");
+        }
         msg.setCreateTime(new Date());
         try {
             stringRedisTemplate.convertAndSend(CacheConstants.CHANNEL, JSON.toJSONString(msg));

+ 24 - 17
doc-system/src/main/java/com/doc/system/service/ISysDeptService.java

@@ -1,27 +1,34 @@
 package com.doc.system.service;
 
 import java.util.List;
+
 import com.doc.common.core.domain.TreeSelect;
 import com.doc.common.core.domain.entity.SysDept;
 
 /**
  * 部门管理 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface ISysDeptService
-{
+public interface ISysDeptService {
     /**
      * 查询部门管理数据
-     * 
+     *
      * @param dept 部门信息
      * @return 部门信息集合
      */
     public List<SysDept> selectDeptList(SysDept dept);
 
     /**
+     * 查询所有部门
+     *
+     * @return
+     */
+    public List<SysDept> selectAllDeptList();
+
+    /**
      * 查询部门树结构信息
-     * 
+     *
      * @param dept 部门信息
      * @return 部门树信息集合
      */
@@ -29,7 +36,7 @@ public interface ISysDeptService
 
     /**
      * 构建前端所需要树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 树结构列表
      */
@@ -37,7 +44,7 @@ public interface ISysDeptService
 
     /**
      * 构建前端所需要下拉树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 下拉树结构列表
      */
@@ -45,7 +52,7 @@ public interface ISysDeptService
 
     /**
      * 根据角色ID查询部门树信息
-     * 
+     *
      * @param roleId 角色ID
      * @return 选中部门列表
      */
@@ -53,7 +60,7 @@ public interface ISysDeptService
 
     /**
      * 根据部门ID查询信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 部门信息
      */
@@ -61,7 +68,7 @@ public interface ISysDeptService
 
     /**
      * 根据ID查询所有子部门(正常状态)
-     * 
+     *
      * @param deptId 部门ID
      * @return 子部门数
      */
@@ -69,7 +76,7 @@ public interface ISysDeptService
 
     /**
      * 是否存在部门子节点
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
@@ -77,7 +84,7 @@ public interface ISysDeptService
 
     /**
      * 查询部门是否存在用户
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果 true 存在 false 不存在
      */
@@ -85,7 +92,7 @@ public interface ISysDeptService
 
     /**
      * 校验部门名称是否唯一
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -93,14 +100,14 @@ public interface ISysDeptService
 
     /**
      * 校验部门是否有数据权限
-     * 
+     *
      * @param deptId 部门id
      */
     public void checkDeptDataScope(Long deptId);
 
     /**
      * 新增保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -108,7 +115,7 @@ public interface ISysDeptService
 
     /**
      * 修改保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -116,7 +123,7 @@ public interface ISysDeptService
 
     /**
      * 删除部门管理信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */

+ 10 - 0
doc-system/src/main/java/com/doc/system/service/impl/SysDeptServiceImpl.java

@@ -48,6 +48,16 @@ public class SysDeptServiceImpl implements ISysDeptService {
     }
 
     /**
+     * 查询所有部门
+     *
+     * @return
+     */
+    @Override
+    public List<SysDept> selectAllDeptList() {
+        return deptMapper.selectDeptList(new SysDept());
+    }
+
+    /**
      * 查询部门树结构信息
      *
      * @param dept 部门信息