From 0d59d664b3b81e9264df6ad513d06b1b2c84c931 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期五, 27 三月 2026 11:43:34 +0800
Subject: [PATCH] 大屏首页储量数量展示,仅展示散粮;抓拍跟踪图片展示业务逻辑调整

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java |   97 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 89 insertions(+), 8 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 d95b23a..388987c 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,91 @@
 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);
+    }
+
+
+    /**
+     * 鏍规嵁鐢ㄦ埛绫诲瀷鑾峰彇瀵瑰簲搴撳尯鍒楄〃淇℃伅APP
+     *
+     * @param
+     * @return
+     */
+    public List<Dept> getDeptByUserTypeApp(String userType,String deptId) {
+
+
+        if (Constant.USER_TYPE_10.equals(userType)) {
+            //鐩戠鐢ㄦ埛锛岀洿鎺ユ煡璇㈢粍缁囦笅鎵�鏈夊簱鍖�
+            return this.listDept(null,userType,null);
+        }
+        if (Constant.USER_TYPE_20.equals(userType)) {
+            //閾惰鐢ㄦ埛锛屾牴鎹悎鍚屾煡璇㈤摱琛屼笅鎵�鏈夊簱鍖�
+            return this.getDeptByBank(userType);
+        }
+        if (Constant.USER_TYPE_30.equals(userType)) {
+            //搴撳尯鐢ㄦ埛
+            if(ContextUtil.isDepotUser(deptId)){
+                //鏌ヨ鐢ㄦ埛鎵�灞炲簱鍖�
+                return this.listDept(deptId,null,null);
+            }else {
+                //鏌ヨ鐢ㄦ埛鎵�灞炲叕鍙镐笅鎵�鏈夊簱鍖�
+                return this.listDept(null,null, deptId);
+            }
+        }
+        return this.listDept(null,ContextUtil.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);
+    }
 
     /**
      * 鏍规嵁鏉′欢鏌ヨ搴撳尯淇℃伅
@@ -49,7 +129,7 @@
         if(StringUtils.isNotBlank(parentId)){
             queryWrapper.likeRight("id", parentId);
         }
-
+        queryWrapper.orderByAsc("id");
         return coreDeptMapper.selectList(queryWrapper);
     }
 
@@ -59,11 +139,10 @@
      */
     public List<Dept> getDeptData() {
         SysUser user = ContextUtil.getLoginUser();
-        SysDept userDept = iSysDeptService.selectDeptById(user.getDeptId());
-        if (Constant.DEPT_TYPE_20.equals(userDept.getType())) {
+        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()+"");
         }
     }
 
@@ -88,7 +167,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