From b8e8195a9cae963e6f59fcd5208698098e03aba8 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期二, 24 三月 2026 15:00:05 +0800
Subject: [PATCH] 主页,近7天抓拍统计改为近7天玉米出库价格统计

---
 fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java |   88 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 78 insertions(+), 10 deletions(-)

diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
index d3253f8..bc79e57 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
@@ -9,7 +9,6 @@
 import com.fzzy.igds.service.*;
 import com.fzzy.igds.utils.ContextUtil;
 import com.fzzy.igds.utils.DateUtil;
-import com.fzzy.work.data.OrderStatus;
 import com.fzzy.work.service.WorkOrderService;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -21,6 +20,7 @@
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -58,6 +58,22 @@
     private EventInfoService eventInfoService;
     @Resource
     private SnapRecordService snapRecordService;
+    @Resource
+    private GatewaySerService gatewaySerService;
+
+    /**
+     * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯缃戝叧淇℃伅
+     *
+     * @param deptId
+     * @return
+     */
+    public GatewaySer getGatewaySerByDeptId(String deptId) {
+        if (StringUtils.isBlank(deptId)) {
+            deptId = ContextUtil.subDeptId(null);
+        }
+
+        return gatewaySerService.getCacheSerByDeptId(deptId);
+    }
 
     /**
      * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯涓嬫墍鏈変粨搴撳垪琛�
@@ -126,6 +142,29 @@
     }
 
     /**
+     * 鏍规嵁浠撳簱绫诲瀷鑾峰彇搴撳尯涓嬩粨搴撳垪琛�
+     *
+     * @param deptId
+     * @param depotTypes 绫诲瀷澶氫釜锛岀敤閫楀彿闅斿紑
+     * @return
+     */
+    public List<Depot> listAllDepot(String deptId, String depotTypes) {
+
+        List<Depot> depots = this.listDepotByDeptId(deptId);
+        if (null == depots || depots.isEmpty()) {
+            return null;
+        }
+
+        List<Depot> result = new ArrayList<>();
+        for (Depot depot : depots) {
+            if (depotTypes.contains(depot.getDepotType())) {
+                result.add(depot);
+            }
+        }
+        return result;
+    }
+
+    /**
      * @return
      */
     public List<SysDictData> getInoutType() {
@@ -134,13 +173,13 @@
 
 
     /**
-     * 鑾峰彇鍒嗗簱鍒楄〃
+     * 鏍规嵁鍏徃ID鑾峰彇鍏徃涓嬬殑鍒嗗簱鍒楄〃
      *
      * @author sgj
      * @date 2025/12/12
      */
-    public List<Dept> listDeptData() {
-        return coreDeptService.getDeptData();
+    public List<Dept> listDeptData(String parentId) {
+        return coreDeptService.getDeptByUserType(parentId);
     }
 
     /**
@@ -177,8 +216,7 @@
      * @date 2025/12/17
      */
     public List<Company> listCompanyData() {
-        SysUser user = ContextUtil.getLoginUser();
-        return coreCompanyService.listCompany(null, null, user.getDeptId() + "");
+        return coreCompanyService.getCompanyByUserType();
     }
 
 
@@ -206,7 +244,7 @@
         MainData mainData = new MainData();
 
         //寰呭姙宸ュ崟鏁�
-        Integer orderNum = workOrderService.getNumByUser(OrderStatus.STATUS_30.getCode(), user.getLoginName());
+        Integer orderNum = workOrderService.getTodoNumByUser(user);
         mainData.setOrderNum(orderNum);
 
         //缁熻鍑哄叆搴撲俊鎭�
@@ -218,6 +256,7 @@
         LinkedHashMap<String, Integer> mapMonthOutNum = new LinkedHashMap<>();
         LinkedHashMap<String, Integer> mapWeekAiNum = new LinkedHashMap<>();
         LinkedHashMap<String, Integer> mapWeekSnapNum = new LinkedHashMap<>();
+        LinkedHashMap<String, Double> mapWeekMaizeNum = new LinkedHashMap<>();
         String key;
         for (int i = -29; i <= 0; i++) {
             mapMonthInNum.put(DateFormatUtils.format(DateUtil.getNewByDay(new Date(), i), "MM-dd"), 0);
@@ -227,6 +266,7 @@
                 mapWeekOutNum.put(DateFormatUtils.format(DateUtil.getNewByDay(new Date(), i), "MM-dd"), 0);
                 mapWeekAiNum.put(DateFormatUtils.format(DateUtil.getNewByDay(new Date(), i), "MM-dd"), 0);
                 mapWeekSnapNum.put(DateFormatUtils.format(DateUtil.getNewByDay(new Date(), i), "MM-dd"), 0);
+                mapWeekMaizeNum.put(DateFormatUtils.format(DateUtil.getNewByDay(new Date(), i), "MM-dd"), 0.0);
             }
         }
 
@@ -264,12 +304,40 @@
             mainData.getWeekSnapDateList().add(mapKey);
             mainData.getWeekSnapNumList().add(mapWeekSnapNum.get(mapKey));
         }
+        //杩戜竷澶╃帀绫冲嚭搴撲环鏍肩粺璁�
+
+        InoutParam inoutParamOfMaize = new InoutParam();
+        inoutParamOfMaize.setDeptId(user.getDeptId() + "");
+        //绮鍝佺鐜夌背
+        inoutParamOfMaize.setFoodVariety("1120000");
+        inoutParamOfMaize.setType(Constant.TYPE_OUT);
+        inoutParamOfMaize.setStart(DateUtil.getNewByDay(new Date(), -6));
+        inoutParamOfMaize.setEnd(new Date());
+        List<InoutRecord> inoutRecordsOfMaize = inoutRecordService.listInout(inoutParamOfMaize);
+        if (null != inoutRecordsOfMaize && !inoutRecordsOfMaize.isEmpty()) {
+            for (InoutRecord record : inoutRecordsOfMaize) {
+                key = DateFormatUtils.format(record.getRegisterTime(), "MM-dd");
+                if (null != mapWeekMaizeNum.get(key)) {
+                    Double nowPrice = mapWeekMaizeNum.get(key);
+                    Double newPrice = record.getPrice();
+                    if (nowPrice > newPrice || nowPrice == 0) {
+                        nowPrice = newPrice;
+                    }
+                    mapWeekMaizeNum.put(key, nowPrice);
+
+                }
+            }
+        }
+        for (String mapKey : mapWeekMaizeNum.keySet()) {
+            mainData.getWeekMaizeDateList().add(mapKey);
+            mainData.getWeekMaizeNumList().add(mapWeekMaizeNum.get(mapKey));
+        }
 
         //鏌ヨ杩�30澶╂墍鏈夊嚭鍏ュ簱淇℃伅
         InoutParam inoutParam = new InoutParam();
-        param.setDeptId(user.getDeptId() + "");
-        param.setStart(DateUtil.getNewByDay(new Date(), -29));
-        param.setEnd(new Date());
+        inoutParam.setDeptId(user.getDeptId() + "");
+        inoutParam.setStart(DateUtil.getNewByDay(new Date(), -29));
+        inoutParam.setEnd(new Date());
         List<InoutRecord> inoutRecords = inoutRecordService.listInout(inoutParam);
         if (null != inoutRecords && !inoutRecords.isEmpty()) {
             for (InoutRecord record : inoutRecords) {

--
Gitblit v1.9.3