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-core/src/main/java/com/fzzy/igds/data/MainData.java          |    6 +++
 fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java |   45 +++++++++++++++++++---
 fzzy-igdss-web/src/main/resources/templates/main.html                   |   63 ++++++++++++++++++++++++++-----
 3 files changed, 96 insertions(+), 18 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/MainData.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/MainData.java
index 6883a0b..9875e10 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/MainData.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/data/MainData.java
@@ -1,6 +1,7 @@
 package com.fzzy.igds.data;
 
 import lombok.Data;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
@@ -45,4 +46,9 @@
     private List<String> weekSnapDateList = new ArrayList<>();
     private List<Integer> weekSnapNumList = new ArrayList<>();
 
+
+    //鐜夌背鍑哄簱浠锋牸鍛ㄧ粺璁�
+    private List<String> weekMaizeDateList = new ArrayList<>();
+    private List<Double> weekMaizeNumList = new ArrayList<>();
+
 }
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 02c08f7..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.WorkStatus;
 import com.fzzy.work.service.WorkOrderService;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -64,11 +63,12 @@
 
     /**
      * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯缃戝叧淇℃伅
+     *
      * @param deptId
      * @return
      */
     public GatewaySer getGatewaySerByDeptId(String deptId) {
-        if(StringUtils.isBlank(deptId)){
+        if (StringUtils.isBlank(deptId)) {
             deptId = ContextUtil.subDeptId(null);
         }
 
@@ -143,14 +143,15 @@
 
     /**
      * 鏍规嵁浠撳簱绫诲瀷鑾峰彇搴撳尯涓嬩粨搴撳垪琛�
+     *
      * @param deptId
-     * @param depotTypes  绫诲瀷澶氫釜锛岀敤閫楀彿闅斿紑
+     * @param depotTypes 绫诲瀷澶氫釜锛岀敤閫楀彿闅斿紑
      * @return
      */
     public List<Depot> listAllDepot(String deptId, String depotTypes) {
 
         List<Depot> depots = this.listDepotByDeptId(deptId);
-        if(null == depots || depots.isEmpty()){
+        if (null == depots || depots.isEmpty()) {
             return null;
         }
 
@@ -255,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);
@@ -264,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);
             }
         }
 
@@ -301,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) {
diff --git a/fzzy-igdss-web/src/main/resources/templates/main.html b/fzzy-igdss-web/src/main/resources/templates/main.html
index d7b7225..6df4ffa 100644
--- a/fzzy-igdss-web/src/main/resources/templates/main.html
+++ b/fzzy-igdss-web/src/main/resources/templates/main.html
@@ -164,7 +164,8 @@
         </div>
         <div class="layui-col-md6">
             <div class="layui-card">
-                <div class="layui-card-header">杩�7澶╂姄鎷嶇粺璁�</div>
+<!--                <div class="layui-card-header">杩�7澶╂姄鎷嶇粺璁�</div>-->
+                <div class="layui-card-header">杩�7澶╃帀绫冲嚭搴撴渶浣庡崟浠风粺璁�</div>
                 <div class="layui-card-body">
                     <div id="snapChartsWeek" style="height: 300px;"></div>
                 </div>
@@ -342,26 +343,65 @@
         myCharts4.setOption({series: [{data: mainData.weekAiNumList}]});
 
         /** 娓叉煋鍛ㄧ粺璁″浘琛� */
-        var myCharts5 = echarts.init(document.getElementById('snapChartsWeek'));
-        var options5 = {
+        // var myCharts5 = echarts.init(document.getElementById('snapChartsWeek'));
+        // var options5 = {
+        //     tooltip: {trigger: 'axis', axisPointer: {lineStyle: {color: '#E0E0E0'}}},
+        //     color: ['#FFA800'],
+        //     legend: {
+        //         orient: 'vertical', right: '0px', top: '0px',
+        //         data: ['鎶撴媿鏁�'], textStyle: {color: '#595959'}
+        //     },
+        //     grid: {top: '75px', left: '35px', right: '55px', bottom: '40px'},
+        //     xAxis: {
+        //         name: '鏃ユ湡',
+        //         nameTextStyle: {color: '#595959'},
+        //         type: 'category',
+        //         data: mainData.weekSnapDateList,
+        //         axisLine: {lineStyle: {color: '#E0E0E0'}, symbol: ['none', 'arrow'], symbolOffset: [0, 10]},
+        //         axisLabel: {color: '#8c8c8c'},
+        //         axisTick: {alignWithLabel: true}
+        //     },
+        //     yAxis: {
+        //         name: '鏁伴噺',
+        //         nameTextStyle: {color: '#595959'},
+        //         type: 'value',
+        //         boundaryGap: ['0', '20%'],
+        //         axisTick: {show: false},
+        //         axisLine: {lineStyle: {color: '#E0E0E0'}, symbol: ['none', 'arrow'], symbolOffset: [0, 10]},
+        //         axisLabel: {color: '#8c8c8c'},
+        //         splitLine: {show: false},
+        //         splitArea: {show: false},
+        //         minInterval: 1
+        //     },
+        //     series: [{
+        //         name: '鎶撴媿淇℃伅', type: 'bar', stack: 'one', barMaxWidth: '30px',
+        //         label: {normal: {show: true, position: 'inside'}}
+        //     }]
+        // };
+        // myCharts5.setOption(options5);
+        // // 璧嬪��
+        // myCharts5.setOption({series: [{data: mainData.weekSnapNumList}]});
+         //娓叉煋鐜夌背7澶╁嚭搴撴渶浣庝环鏍�
+        var myCharts6 = echarts.init(document.getElementById('snapChartsWeek'));
+        var options6 = {
             tooltip: {trigger: 'axis', axisPointer: {lineStyle: {color: '#E0E0E0'}}},
             color: ['#FFA800'],
             legend: {
                 orient: 'vertical', right: '0px', top: '0px',
-                data: ['鎶撴媿鏁�'], textStyle: {color: '#595959'}
+                data: ['鍑哄簱鍗曚环'], textStyle: {color: '#595959'}
             },
-            grid: {top: '75px', left: '35px', right: '55px', bottom: '40px'},
+            grid: {top: '75px', left: '55px', right: '55px', bottom: '40px'},
             xAxis: {
                 name: '鏃ユ湡',
                 nameTextStyle: {color: '#595959'},
                 type: 'category',
-                data: mainData.weekSnapDateList,
+                data: mainData.weekMaizeDateList,
                 axisLine: {lineStyle: {color: '#E0E0E0'}, symbol: ['none', 'arrow'], symbolOffset: [0, 10]},
                 axisLabel: {color: '#8c8c8c'},
                 axisTick: {alignWithLabel: true}
             },
             yAxis: {
-                name: '鏁伴噺',
+                name: '浠锋牸锛堝厓/鍏枻锛�',
                 nameTextStyle: {color: '#595959'},
                 type: 'value',
                 boundaryGap: ['0', '20%'],
@@ -373,13 +413,13 @@
                 minInterval: 1
             },
             series: [{
-                name: '鎶撴媿淇℃伅', type: 'bar', stack: 'one', barMaxWidth: '30px',
+                name: '鏈�浣庡崟浠�', type: 'bar', stack: 'one', barMaxWidth: '30px',
                 label: {normal: {show: true, position: 'inside'}}
             }]
         };
-        myCharts5.setOption(options5);
+        myCharts6.setOption(options6);
         // 璧嬪��
-        myCharts5.setOption({series: [{data: mainData.weekSnapNumList}]});
+        myCharts6.setOption({series: [{data: mainData.weekMaizeNumList}]});
 
         /** 绐楀彛澶у皬鏀瑰彉浜嬩欢 */
         window.onresize = function () {
@@ -387,7 +427,8 @@
             myCharts2.resize();
             myCharts3.resize();
             myCharts4.resize();
-            myCharts5.resize();
+            // myCharts5.resize();
+            myCharts6.resize();
         };
 
     });

--
Gitblit v1.9.3