From 9dcc346205e2c96b28f2f561f439a29bc6c2a6dc Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期四, 16 四月 2026 15:34:06 +0800
Subject: [PATCH] 仅七天玉米价格,添加默认从粮食单价获取

---
 fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 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 bc79e57..c8460e6 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
@@ -61,6 +61,9 @@
     @Resource
     private GatewaySerService gatewaySerService;
 
+    @Resource
+    private FoodPriceService foodPriceService;
+
     /**
      * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯缃戝叧淇℃伅
      *
@@ -306,6 +309,27 @@
         }
         //杩戜竷澶╃帀绫冲嚭搴撲环鏍肩粺璁�
 
+        //1.榛樿浠庣伯椋熷崟浠蜂腑鑾峰彇
+        IgdsBaseParam paramOfFoodPrice = new IgdsBaseParam();
+        //绮鍝佺鐜夌背
+        paramOfFoodPrice.setKey("1120000");
+        paramOfFoodPrice.setStart(DateUtil.getNewByDay(new Date(), -6));
+        paramOfFoodPrice.setEnd(new Date());
+        List<FoodPrice> foodPrices = foodPriceService.listData(paramOfFoodPrice);
+        if (null != foodPrices && !foodPrices.isEmpty()) {
+            for (FoodPrice record : foodPrices) {
+                key = DateFormatUtils.format(record.getCreateTime(), "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);
+                }
+            }
+        }
+        //2.鏌ヨ鍑哄叆搴撶殑鍗曚环锛屾湁鍑哄簱鐨勮瘽锛岀敤鍑哄簱鍗曚环鏇挎崲绮鍗曚环
         InoutParam inoutParamOfMaize = new InoutParam();
         inoutParamOfMaize.setDeptId(user.getDeptId() + "");
         //绮鍝佺鐜夌背
@@ -324,7 +348,6 @@
                         nowPrice = newPrice;
                     }
                     mapWeekMaizeNum.put(key, nowPrice);
-
                 }
             }
         }

--
Gitblit v1.9.3