From 84043dad83ea5193179e82227b191e522496bae5 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 09 一月 2026 15:43:47 +0800
Subject: [PATCH] 料位总览提交2-IOT协议

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java |   62 ++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
index 7ff3a60..c31f47b 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
@@ -3,12 +3,12 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fzzy.igds.constant.Constant;
 import com.fzzy.igds.domain.Dept;
+import com.fzzy.igds.domain.PledgeContract;
 import com.fzzy.igds.mapper.CoreDeptMapper;
 import com.fzzy.igds.utils.ContextUtil;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.system.service.ISysDeptService;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.Date;
@@ -23,11 +23,61 @@
 public class CoreDeptService {
 
     @Resource
-    private ISysDeptService iSysDeptService;
-    @Resource
     private CoreDeptMapper coreDeptMapper;
     @Resource
     private InoutConfService inoutConfService;
+
+    /**
+     * 鏍规嵁鐢ㄦ埛绫诲瀷鑾峰彇瀵瑰簲搴撳尯鍒楄〃淇℃伅
+     *
+     * @param parentId
+     * @return
+     */
+    public List<Dept> getDeptByUserType(String parentId) {
+
+        if(StringUtils.isNotBlank(parentId)){
+            //鏌ュ叕鍙镐笅鎵�鏈夊簱鍖�
+            return this.listDept(null,null, parentId);
+        }
+        //鑾峰彇褰撳墠鐧诲綍浜�
+        SysUser user = ContextUtil.getLoginUser();
+
+        if (Constant.USER_TYPE_10.equals(user.getUserType())) {
+            //鐩戠鐢ㄦ埛锛岀洿鎺ユ煡璇㈢粍缁囦笅鎵�鏈夊簱鍖�
+            return this.listDept(null,user.getCompanyId(),null);
+        }
+        if (Constant.USER_TYPE_20.equals(user.getUserType())) {
+            //閾惰鐢ㄦ埛锛屾牴鎹悎鍚屾煡璇㈤摱琛屼笅鎵�鏈夊簱鍖�
+            return this.getDeptByBank(user.getUserData());
+        }
+        if (Constant.USER_TYPE_30.equals(user.getUserType())) {
+            //搴撳尯鐢ㄦ埛
+            String deptId = user.getDeptId() + "";
+            if(ContextUtil.isDepotUser(deptId)){
+                //鏌ヨ鐢ㄦ埛鎵�灞炲簱鍖�
+                return this.listDept(deptId,null,null);
+            }else {
+                //鏌ヨ鐢ㄦ埛鎵�灞炲叕鍙镐笅鎵�鏈夊簱鍖�
+                return this.listDept(null,null, deptId);
+            }
+        }
+        return this.listDept(null,user.getCompanyId(),null);
+    }
+
+    /**
+     * 鏍规嵁閾惰id锛屽叧鑱斿悎鍚岃〃鏌ヨ搴撳尯鍒楄〃
+     * @param bankId 閾惰鍙�
+     * @return
+     */
+    public List<Dept> getDeptByBank(String bankId) {
+        if (StringUtils.isBlank(bankId)){
+            return null;
+        }
+        QueryWrapper<PledgeContract> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("c.pledge_bank", bankId);
+
+        return coreDeptMapper.selectDeptByBankId(queryWrapper);
+    }
 
     /**
      * 鏍规嵁鏉′欢鏌ヨ搴撳尯淇℃伅
@@ -62,7 +112,7 @@
         if (Constant.USER_TYPE_30.equals(user.getUserType())) {
             return this.listDept(ContextUtil.subDeptId(user),null,null);
         }else {
-            return this.listDept(null,null,user.getDeptId() + "%");
+            return this.listDept(null,null,user.getDeptId()+"");
         }
     }
 
@@ -87,7 +137,9 @@
             return;
         }
         Dept dept = new Dept();
-        dept.setId(sysDept.getDeptId() + "");
+        String deptId = sysDept.getDeptId() + "";
+        dept.setId(deptId);
+        dept.setParentId(deptId.substring(0, deptId.length() - 3));
         dept.setKqmc(sysDept.getDeptName());
         dept.setCompanyId(sysDept.getCompanyId());
 

--
Gitblit v1.9.3