Bläddra i källkod

删除没用的代码

gushoubang 3 månader sedan
förälder
incheckning
313a9e4517

+ 0 - 187
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/ImageRotationCorrector.java

@@ -1,187 +0,0 @@
-package com.onemap.analyse;
-
-import com.drew.imaging.ImageMetadataReader;
-import com.drew.metadata.Metadata;
-import com.drew.metadata.exif.ExifDirectoryBase;
-
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import javax.imageio.ImageIO;
-
-public class ImageRotationCorrector {
-
-    public static BufferedImage correctImageOrientation(BufferedImage image, int orientation) {
-        switch (orientation) {
-            case 1:
-                return image; // 无需旋转
-            case 3:
-                return rotate180(image);
-            case 6:
-                return rotate90(image);
-            case 8:
-                return rotate270(image);
-            default:
-                return image; // 未知方向,保持原样
-        }
-    }
-
-    private static BufferedImage rotate90(BufferedImage image) {
-        int width = image.getWidth();
-        int height = image.getHeight();
-        BufferedImage rotated = new BufferedImage(height, width, image.getType());
-
-        for (int y = 0; y < height; y++) {
-            for (int x = 0; x < width; x++) {
-                rotated.setRGB(height - 1 - y, x, image.getRGB(x, y));
-            }
-        }
-
-        return rotated;
-    }
-
-    private static BufferedImage rotate180(BufferedImage image) {
-        int width = image.getWidth();
-        int height = image.getHeight();
-        BufferedImage rotated = new BufferedImage(width, height, image.getType());
-
-        for (int y = 0; y < height; y++) {
-            for (int x = 0; x < width; x++) {
-                rotated.setRGB(width - 1 - x, height - 1 - y, image.getRGB(x, y));
-            }
-        }
-
-        return rotated;
-    }
-
-    private static BufferedImage rotate270(BufferedImage image) {
-        int width = image.getWidth();
-        int height = image.getHeight();
-        BufferedImage rotated = new BufferedImage(height, width, image.getType());
-
-        for (int y = 0; y < height; y++) {
-            for (int x = 0; x < width; x++) {
-                rotated.setRGB(y, width - 1 - x, image.getRGB(x, y));
-            }
-        }
-
-        return rotated;
-    }
-
-    /**
-     * 旋转图像
-     *
-     * @param image   原始图像
-     * @param degrees 旋转角度(0-360)
-     * @return 旋转后的图像
-     */
-    public static BufferedImage rotateImage(BufferedImage image, double degrees) {
-        // 将角度转换为弧度
-        double radians = Math.toRadians(degrees);
-
-        // 计算旋转后的图像尺寸
-        double sin = Math.abs(Math.sin(radians));
-        double cos = Math.abs(Math.cos(radians));
-        int newWidth = (int) Math.round(image.getWidth() * cos + image.getHeight() * sin);
-        int newHeight = (int) Math.round(image.getWidth() * sin + image.getHeight() * cos);
-
-        // 创建新的BufferedImage
-        BufferedImage rotatedImage = new BufferedImage(newWidth, newHeight, image.getType());
-        Graphics2D g2d = rotatedImage.createGraphics();
-
-        // 设置旋转中心并旋转
-        AffineTransform transform = new AffineTransform();
-        transform.translate(newWidth / 2, newHeight / 2);
-        transform.rotate(radians);
-        transform.translate(-image.getWidth() / 2, -image.getHeight() / 2);
-
-        // 应用变换
-        g2d.setTransform(transform);
-        g2d.drawImage(image, 0, 0, null);
-        g2d.dispose();
-
-        return rotatedImage;
-    }
-
-    public static int getImageOrientation(File imageFile) throws Exception {
-        Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
-        for (ExifDirectoryBase directory : metadata.getDirectoriesOfType(ExifDirectoryBase.class)) {
-            if (directory.containsTag(ExifDirectoryBase.TAG_ORIENTATION)) {
-                return directory.getInt(ExifDirectoryBase.TAG_ORIENTATION);
-            }
-        }
-        return 1; // 默认方向
-    }
-
-    public static void main(String[] args) {
-        try {
-            File fileDir = new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\下");
-            File[] files = fileDir.listFiles();
-            for (File imageFile : files) {
-                String name = imageFile.getName();
-                System.out.println(name);
-//                File imageFile = file;
-                BufferedImage image = ImageIO.read(imageFile);
-                // 获取EXIF方向信息
-                int orientation = getImageOrientation(imageFile);
-                if (1 != orientation) {
-                    double dushu = 0;
-                    if (orientation == 6) {
-                        dushu = 270;
-                    } else if (orientation == 3) {
-                        dushu = 180;
-                    } else if (orientation == 8) {
-                        dushu = 90;
-                    }
-
-//                    System.out.println(orientation);
-
-                    // 校正图像方向
-                    BufferedImage correctedImage = correctImageOrientation(image, orientation);
-
-                    // 旋转270度(逆时针90度)
-                    BufferedImage rotatedImage = rotateImage(correctedImage, dushu);
-                    ImageIO.write(rotatedImage, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\上\\" + name));
-                } else {
-                    ImageIO.write(image, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\上\\" + name));
-                }
-            }
-            System.out.println("图像方向已校正并保存");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void main1(String[] args) {
-        try {
-            File fileDir = new File("D:\\02DATA\\三亚\\甲方数据\\飞行\\三亚无人机数据\\24001120450\\下");
-            File[] files = fileDir.listFiles();
-            for (File file : files) {
-                File imageFile = new File("D:\\02DATA\\三亚\\甲方数据\\飞行\\三亚无人机数据\\24001120450\\下\\240011204500004.JPG");
-                BufferedImage image = ImageIO.read(imageFile);
-            }
-
-
-            File imageFile = new File("D:\\02DATA\\三亚\\甲方数据\\飞行\\三亚无人机数据\\24001120450\\下\\240011204500004.JPG");
-            BufferedImage image = ImageIO.read(imageFile);
-
-            // 获取EXIF方向信息
-            int orientation = getImageOrientation(imageFile);
-
-            if (1 != orientation) {
-                // 校正图像方向
-                BufferedImage correctedImage = correctImageOrientation(image, orientation);
-                // 保存校正后的图像
-                ImageIO.write(correctedImage, "jpg", new File("D:\\02DATA\\三亚\\甲方数据\\飞行\\三亚无人机数据\\24001120450\\下\\corrected_photo.jpg"));
-
-            }
-
-
-            System.out.println("图像方向已校正并保存");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 11 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/TGdbhJctbController.java

@@ -2,6 +2,7 @@ package com.onemap.apply.controller.gdbh;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
 import com.onemap.common.core.utils.poi.ExcelUtil;
@@ -37,6 +38,16 @@ public class TGdbhJctbController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询耕地保护-检测图标数据空间表列表
+     */
+    @GetMapping("/geom/list")
+    public AjaxResult geomList(TGdbhJctb tGdbhJctb) {
+        List<Map<String, Object>> list = tGdbhJctbService.selectTGdbhJctbGeomList(tGdbhJctb);
+        return success(list);
+    }
+
+
     /**
      * 导出耕地保护-检测图标数据详情表列表
      */

+ 9 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhJctbMapper.java

@@ -1,6 +1,8 @@
 package com.onemap.apply.mapper.gdbh;
 
 import java.util.List;
+import java.util.Map;
+
 import com.onemap.apply.domain.gdbh.TGdbhJctb;
 
 /**
@@ -27,6 +29,13 @@ public interface TGdbhJctbMapper
      */
     public List<TGdbhJctb> selectTGdbhJctbList(TGdbhJctb tGdbhJctb);
 
+    /**
+     * 查询耕地保护-检测图标数据空间列表
+     * @param tGdbhJctb
+     * @return
+     */
+    public List<Map<String,Object>> selectTGdbhJctbGeomList(TGdbhJctb tGdbhJctb);
+
     /**
      * 新增耕地保护-检测图标数据详情表
      * 

+ 7 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/ITGdbhJctbService.java

@@ -29,6 +29,13 @@ public interface ITGdbhJctbService {
      */
     public List<TGdbhJctb> selectTGdbhJctbList(TGdbhJctb tGdbhJctb);
 
+    /**
+     * 查询耕地保护-检测图标数据空间列表
+     * @param tGdbhJctb
+     * @return
+     */
+    public List<Map<String,Object>> selectTGdbhJctbGeomList(TGdbhJctb tGdbhJctb);
+
     /**
      * 新增耕地保护-检测图标数据详情表
      *

+ 11 - 4
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhJctbServiceImpl.java

@@ -4,10 +4,7 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
@@ -68,6 +65,16 @@ public class TGdbhJctbServiceImpl implements ITGdbhJctbService {
         return tGdbhJctbMapper.selectTGdbhJctbList(tGdbhJctb);
     }
 
+    /**
+     * 查询耕地保护-检测图标数据空间列表
+     * @param tGdbhJctb
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> selectTGdbhJctbGeomList(TGdbhJctb tGdbhJctb) {
+        return tGdbhJctbMapper.selectTGdbhJctbGeomList(tGdbhJctb);
+    }
+
     /**
      * 新增耕地保护-检测图标数据详情表
      *

+ 12 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhJctbMapper.xml

@@ -79,6 +79,18 @@
         </where>
     </select>
 
+    <select id="selectTGdbhJctbGeomList" parameterType="TGdbhJctb" resultType="map">
+        select id,public.st_asewkt(geom) geom from t_gdbh_jctb
+        <where>
+            <if test="jcbh != null  and jcbh != ''">and jcbh like concat('%',#{jcbh},'%')</if>
+            <if test="regioncode != null  and regioncode != ''">and regioncode like concat(#{regioncode},'%')</if>
+            <if test="hlx != null  and hlx != ''">and hlx = #{hlx}</if>
+            <if test="startTime != null ">and to_date(hsx , 'YYYYMMDD') &gt;= #{startTime}</if>
+            <if test="endTime != null ">and to_date(hsx , 'YYYYMMDD') &lt;= #{endTime}</if>
+        </where>
+
+    </select>
+
     <select id="selectTGdbhJctbById" parameterType="String" resultMap="TGdbhJctbResult">
         <include refid="selectTGdbhJctbVo"/>
         where id = #{id}