From 935fda56e95270493d9e3e46d28b29125d330ca3 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: 星期一, 29 七月 2024 16:31:02 +0800
Subject: [PATCH] 修改:流媒体转码使用ffmpeg绝对路径,配置文件中增加ffmpegPath 增加:部门列表查询和部门详情查询无数据权限

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java |  103 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
index e0a4d85..efd07f5 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
@@ -4,12 +4,10 @@
 import java.util.stream.Collectors;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ruoyi.common.core.domain.TreeDeptWell;
-import com.ruoyi.common.core.domain.TreeSelectWell;
+import com.ruoyi.common.core.domain.*;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.constant.UserConstants;
-import com.ruoyi.common.core.domain.TreeSelect;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
@@ -61,6 +59,12 @@
     public List<TreeSelect> selectDeptTreeList(SysDept dept)
     {
         List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
+        return buildDeptTreeSelect(depts);
+    }
+
+    @Override
+    public List<TreeSelect> selectDeptTreeListNoDataScope(SysDept dept) {
+        List<SysDept> depts = deptMapper.selectDeptListNoDataScope(dept);
         return buildDeptTreeSelect(depts);
     }
 
@@ -361,14 +365,15 @@
     @Override
     public List<SysDept> allByUser(List<Long> deptList) {
         QueryWrapper<SysDept> queryWrapper = new QueryWrapper();
-        queryWrapper.in("dept_id",deptList);
+        queryWrapper.in("dept_id",deptList).eq("del_flag","0");
         return deptMapper.selectList(queryWrapper);
     }
 
     @Override
-    public List<TreeSelectWell> wellTree(List<TreeDeptWell> depts) {
+    public List<TreeDeptWell> wellTree(List<TreeDeptWell> depts) {
         List<TreeDeptWell> deptTrees = buildDeptWellTree(depts);
-        return deptTrees.stream().map(TreeSelectWell::new).collect(Collectors.toList());
+        return deptTrees;
+//        return deptTrees.stream().map(TreeSelectWell::new).collect(Collectors.toList());
     }
 
     @Override
@@ -395,13 +400,15 @@
     private void recursionFnWell(List<TreeDeptWell> list, TreeDeptWell t)
     {
         // 寰楀埌瀛愯妭鐐瑰垪琛�
-        List<TreeDeptWell> childList = getChildListWell(list, t);
-        t.setChildren(childList);
-        for (TreeDeptWell tChild : childList)
-        {
-            if (hasChildWell(list, tChild))
+        if(t.getId() == null){
+            List<TreeDeptWell> childList = getChildListWell(list, t);
+            t.setChildren(childList);
+            for (TreeDeptWell tChild : childList)
             {
-                recursionFnWell(list, tChild);
+                if (hasChildWell(list, tChild))
+                {
+                    recursionFnWell(list, tChild);
+                }
             }
         }
     }
@@ -425,4 +432,76 @@
     {
         return getChildListWell(list, t).size() > 0;
     }
+
+
+
+    @Override
+    public List<DeptUserTree> deptUserTree(List<DeptUserTree> depts)
+    {
+        List<DeptUserTree> returnList = new ArrayList<>();
+        List<Long> tempList = depts.stream().map(DeptUserTree::getDeptId).collect(Collectors.toList());
+        for (DeptUserTree dept : depts)
+        {
+            // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣
+            if (!tempList.contains(dept.getParentId()))
+            {
+                recursionFnDeptUserTree(depts, dept);
+                returnList.add(dept);
+            }
+        }
+        if (returnList.isEmpty())
+        {
+            returnList = depts;
+        }
+        return returnList;
+    }
+
+    @Override
+    public List<Long> selectDeptIdBySubAndUserId(Long deptId, String usersId) {
+        List<Long> deptIdList = new ArrayList();
+        //鏈骇鍙婁笅灞為儴闂�
+        List<Long> ownAndSubDeptIdList = deptMapper.selectDeptIdBySub(deptId);
+        //鑷畾涔�
+        List<Long> roleDeptIdList = deptMapper.selectRoleDeptIdByUsersId(usersId);
+        //鍘婚噸
+        Set<Long> deptIdSet = new HashSet();
+        deptIdSet.addAll(ownAndSubDeptIdList);
+        deptIdSet.addAll(roleDeptIdList);
+        deptIdList.addAll(deptIdSet);
+        return deptIdList;
+    }
+
+    private void recursionFnDeptUserTree(List<DeptUserTree> list, DeptUserTree t)
+    {
+        // 寰楀埌瀛愯妭鐐瑰垪琛�
+        if(t.getUserId()==null){
+            List<DeptUserTree> childList = getChildListDeptUserTree(list, t);
+            t.setChildren(childList);
+            for (DeptUserTree tChild : childList) {
+                if (hasChildDeptUserTree(list, tChild)) {
+                    recursionFnDeptUserTree(list, tChild);
+                }
+            }
+        }
+    }
+
+    private List<DeptUserTree> getChildListDeptUserTree(List<DeptUserTree> list, DeptUserTree t)
+    {
+        List<DeptUserTree> tlist = new ArrayList<>();
+        Iterator<DeptUserTree> it = list.iterator();
+        while (it.hasNext())
+        {
+            DeptUserTree n = (DeptUserTree) it.next();
+            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
+            {
+                tlist.add(n);
+            }
+        }
+        return tlist;
+    }
+
+    private boolean hasChildDeptUserTree(List<DeptUserTree> list, DeptUserTree t)
+    {
+        return getChildListDeptUserTree(list, t).size() > 0;
+    }
 }

--
Gitblit v1.9.3