From abf0b44fe291299f8440b84cc185a1205ece7096 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期四, 26 二月 2026 17:11:47 +0800
Subject: [PATCH] 出入库过磅单打印模板修改

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java |   88 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 84 insertions(+), 4 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 d218b7a..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);
+    }
 
     /**
      * 鏍规嵁鏉′欢鏌ヨ搴撳尯淇℃伅
@@ -62,7 +142,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()+"");
         }
     }
 

--
Gitblit v1.9.3