From e33bca52d26faa836a4db7436e85eb3a0a08adff Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 19 八月 2025 17:26:02 +0800
Subject: [PATCH] 1、增加查询所有作物昨日蒸腾量功能; 2、增加查询一个作物一段时间内容所有蒸腾量功能。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/modelCalculate/ModelCalculatorSv.java |   83 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/modelCalculate/ModelCalculatorSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/modelCalculate/ModelCalculatorSv.java
new file mode 100644
index 0000000..d35bc1b
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/modelCalculate/ModelCalculatorSv.java
@@ -0,0 +1,83 @@
+package com.dy.pipIrrModel.modelCalculate;
+
+import com.dy.common.util.DateTime;
+import com.dy.common.util.IDLongGenerator;
+import com.dy.pipIrrGlobal.daoMd.MdCropsMapper;
+import com.dy.pipIrrGlobal.daoMd.MdEt0Mapper;
+import com.dy.pipIrrGlobal.daoPr.PrStWeatherMapper;
+import com.dy.pipIrrGlobal.daoRm.RmWeatherHistoryMapper;
+import com.dy.pipIrrGlobal.pojoMd.MdEt0;
+import com.dy.pipIrrGlobal.voMd.VoCrops;
+import com.dy.pipIrrGlobal.voPr.VoWeather;
+import com.dy.pipIrrGlobal.voRm.VoWeatherMaxMinTmp;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/8/18 16:34
+ * @Description
+ */
+@Slf4j
+@Service
+public class ModelCalculatorSv {
+    private MdCropsMapper mdCropsDao ;
+    private PrStWeatherMapper prWeatherDao ;
+    private RmWeatherHistoryMapper rmWeatherHistoryDao;
+    private MdEt0Mapper mdEt0Dao;
+
+    @Autowired
+    private void setDao(MdCropsMapper mdCropsDao,
+                        PrStWeatherMapper prWeatherDao,
+                        RmWeatherHistoryMapper rmWeatherHistoryDao,
+                        MdEt0Mapper mdEt0Dao) {
+        this.mdCropsDao = mdCropsDao;
+        this.prWeatherDao = prWeatherDao;
+        this.rmWeatherHistoryDao = rmWeatherHistoryDao;
+        this.mdEt0Dao = mdEt0Dao;
+    }
+    /**
+     * 鏌ヨ鎵�鏈変綔鐗�
+     * @return 鍖呭惈瀹炰綋闆嗗悎鐨勭粨鏋滃璞�
+     */
+    @SuppressWarnings("unchecked")
+    public List<VoCrops> selectAllCrops(){
+        return this.mdCropsDao.selectAll() ;
+    }
+
+    public VoWeather getWeather(Long weatherId) throws Exception{
+        return this.prWeatherDao.selectOne(weatherId) ;
+    }
+
+    public List<VoWeatherMaxMinTmp> selectYesterdayMaxMinTemperature(Long weatherId) throws Exception{
+        String ymd = DateTime.yesterday_yyyy_MM_dd(Integer.parseInt(DateTime.yyyy()), Integer.parseInt(DateTime.MM()), Integer.parseInt(DateTime.dd())) ; //鏄ㄥぉ
+        int[] ymdGrp = DateTime.yyyy_MM_dd_2_ymdGroup(ymd) ;
+        Long startId = IDLongGenerator.generateOneDayStartId(ymdGrp[0], ymdGrp[1], ymdGrp[2]) ;
+        Long endId = IDLongGenerator.generateOneDayEndId(ymdGrp[0], ymdGrp[1], ymdGrp[2]) ;
+        return this.rmWeatherHistoryDao.selectMaxMinTemperature(weatherId, startId, endId);
+    }
+
+    public MdEt0 selectByCropWeatherDt(Long cropId, Long weatherId, String yesterday) throws Exception{
+        return this.mdEt0Dao.selectByCropWeatherDt(cropId, weatherId, yesterday) ;
+    }
+
+    @Transactional(rollbackFor=Exception.class)
+    public int saveEt0(Long cropId, Long weatherId, Date yesterday, Double maxAirTemperature, Double minAirTemperature, Double factor, Double et0){
+        MdEt0 po = new MdEt0();
+        po.cropId = cropId ;
+        po.weatherId = weatherId ;
+        po.dt = yesterday ;
+        po.maxTmp = maxAirTemperature ;
+        po.minTmp = minAirTemperature ;
+        po.factor = factor ;
+        po.et0 = et0 ;
+        this.mdEt0Dao.insert(po) ;
+        return 0 ;
+    }
+}

--
Gitblit v1.8.0