From 2fcf73e5783a7a06dd4d4e6f412b9f759a7230c1 Mon Sep 17 00:00:00 2001
From: jiazx0107 <jiazx0107@163.com>
Date: 星期一, 05 一月 2026 21:22:06 +0800
Subject: [PATCH] 调整出入库配置

---
 fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java |   80 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
index 3e6650b..bc1f867 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
@@ -3,14 +3,20 @@
 import com.bstek.dorado.annotation.DataProvider;
 import com.bstek.dorado.annotation.DataResolver;
 import com.bstek.dorado.annotation.Expose;
+import com.fzzy.igds.data.IgdsBaseParam;
 import com.fzzy.igds.domain.Depot;
+import com.fzzy.igds.domain.PledgeContract;
 import com.fzzy.igds.service.DepotService;
+import com.fzzy.igds.service.PledgeContractService;
 import com.fzzy.igds.utils.ContextUtil;
+import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -25,17 +31,71 @@
     @Resource
     private DepotService depotService;
 
+    @Resource
+    private PledgeContractService pledgeContractService;
+
     /**
      * depotPR#getData
+     *
      * @return
      */
     @DataProvider
-    public List<Depot> getData(){
-        return depotService.getData(null, null);
+    public List<Depot> getData(String parentId) {
+        if (StringUtils.isNotEmpty(parentId)) {
+            return depotService.getData(null, parentId, false);
+        }
+        return depotService.getData(null, ContextUtil.subDeptId(null), false);
+    }
+
+    /**
+     *
+     * TODO 褰撳墠鏂规硶鍙栨秷锛岄�昏緫璋冩暣涓哄湪鎻愪氦鏃跺�欓獙璇佹槸鍚︽槸閾惰鐩戠浠擄紝榛樿鑾峰彇鐩稿簲鐨勫垪琛�
+     * depotPR#getDataByBankId
+     *
+     * @return
+     */
+    @DataProvider
+    public List<Depot> getDataByBankId(String bankId) {
+        if (StringUtils.isNotEmpty(bankId)) {
+            //鏌ヨ閾惰瀵瑰簲鐨勭洃绠′粨搴�
+            IgdsBaseParam baseParam = new IgdsBaseParam();
+            baseParam.setBankId(bankId);
+            List<PledgeContract> pledgeContracts = pledgeContractService.listAll(baseParam);
+
+            // 鎻愬彇鎵�鏈� PledgeContract 涓� depot_ids 瀛楁鍖呭惈鐨� depot ID
+            List<String> validDepotIds = new ArrayList<>();
+            for (PledgeContract contract : pledgeContracts) {
+                if (StringUtils.isNotEmpty(contract.getDepotIds())) {
+                    // 灏嗛�楀彿鍒嗛殧鐨� depot_ids 杞崲涓� Set
+                    String[] ids = contract.getDepotIds().split(",");
+                    for (String id : ids) {
+                        if (StringUtils.isNotEmpty(id.trim())) {
+                            validDepotIds.add(id.trim());
+                        }
+                    }
+                }
+            }
+            List<Depot> allData = depotService.getData(null, ContextUtil.subDeptId(null), false);
+            if (!validDepotIds.isEmpty()) {
+                // 杩囨护鍑哄湪 PledgeContract.depot_ids 涓嚭鐜扮殑 depot
+                List<Depot> filteredData = new ArrayList<>();
+
+                for (Depot allDatum : allData) {
+                    if (validDepotIds.contains(allDatum.getId())) {
+                        filteredData.add(allDatum);
+                    }
+                }
+                return filteredData;
+            }
+            return new ArrayList<>();
+
+        }
+        return depotService.getData(null, ContextUtil.subDeptId(null), false);
     }
 
     /**
      * depotPR#saveOrUpdate
+     *
      * @param data
      * @return
      */
@@ -46,17 +106,17 @@
         Depot depot = new Depot();
         BeanUtils.copyProperties(data, depot);
         depotService.saveDepot(depot);
-        depotService.flushCache(null);
         return null;
     }
 
     /**
      * depotPR#deleteDepot
+     *
      * @param data
      */
     @Expose
     @Transactional
-    public void deleteDepot(Depot data)  {
+    public void deleteDepot(Depot data) {
         Depot depot = new Depot();
         BeanUtils.copyProperties(data, depot);
         depotService.deleteDepot(depot);
@@ -72,6 +132,7 @@
 
     /**
      * ${dorado.getDataProvider("depotPR#getAllCache").getResult()}
+     *
      * @return
      */
     @DataProvider
@@ -81,6 +142,7 @@
 
     /**
      * depotPR#ajaxGetAllCache
+     *
      * @return
      */
     @Expose
@@ -89,6 +151,16 @@
     }
 
     /**
+     * depotPR#getDataByCompanyId
+     *
+     * @return
+     */
+    @DataProvider
+    public List<Depot> getDataByCompanyId() {
+        return depotService.getData(null, null, false);
+    }
+
+    /**
      * depotPR#getDepot 鑾峰彇浠撳簱淇℃伅
      *
      * @param depotId

--
Gitblit v1.9.3