From 203223860baa19deb6860eb2ba3181910d662980 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 17 四月 2025 14:22:59 +0800
Subject: [PATCH] 1. 轮灌组被终止时灌溉时长为实际数值。2. 计划历史表按照创建时间倒排序。3. 发布计划时判断是否同项目下未完成计划,是否其他项目下使用了本计划的轮灌组且计划未完成。4. 根据计划ID获取计划最新状态。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java
index 180ca61..fecc46f 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java
@@ -18,8 +18,16 @@
         return zip(file, "jpg", xSize, ySize) ;
     }
 
+    public static InputStream zipToJpg(BufferedImage buf, int xSize, int ySize) throws Exception{
+        return zip(buf, "jpg", xSize, ySize) ;
+    }
+
     public static InputStream zipToPng(File file, int xSize, int ySize) throws Exception{
         return zip(file, "png", xSize, ySize) ;
+    }
+
+    public static InputStream zipToPng(BufferedImage buf, int xSize, int ySize) throws Exception{
+        return zip(buf, "png", xSize, ySize) ;
     }
 
     public static void zipToFile(File file, File toFile, int xSize, int ySize) throws Exception{
@@ -36,6 +44,16 @@
         os = null ;
         return in ;
     }
+
+    private static InputStream zip(BufferedImage buf, String type, int xSize, int ySize) throws Exception{
+        BufferedImage bi = Thumbnails.of(buf).size(xSize, ySize).outputQuality(1f).asBufferedImage();
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        ImageIO.write(bi, type, os);
+        InputStream in = new ByteArrayInputStream(os.toByteArray());
+        bi = null ;
+        os = null ;
+        return in ;
+    }
     
     public static void main(String[] args){
     	File f = new File("D:/test.jpg") ;

--
Gitblit v1.8.0