管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-25 c3a768581480c1c800e39cea941eee228bc3127a
1
已修改2个文件
42 ■■■■■ 文件已修改
src/main/java/com/lf/server/helper/GdbHelper.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/ZipHelper.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/GdbHelper.java
@@ -127,7 +127,7 @@
     */
    private static Field getGeomField(Class clazz) {
        try {
            Field gField = clazz.getDeclaredField("geom");
            Field gField = clazz.getSuperclass().getDeclaredField("geom");
            gField.setAccessible(true);
            return gField;
@@ -229,10 +229,10 @@
     * wkbLinearRing = 101
     */
    private static <T> void setGeom(T t, Feature f, Field gField) throws Exception {
        Geometry geometry = f.GetGeometryRef();
        if (null != geometry) {
            String wkt = geometry.ExportToWkt();
            switch (geometry.GetGeometryType()) {
        String geo = "null";
        if (null != f.GetGeometryRef()) {
            String wkt = f.GetGeometryRef().ExportToWkt();
            switch (f.GetGeometryRef().GetGeometryType()) {
                case 2:
                    wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")";
                    break;
@@ -242,9 +242,10 @@
                default:
                    break;
            }
            gField.set(t, String.format("ST_GeomFromText('%s')", wkt));
            geo = String.format("ST_GeomFromText('%s')", wkt);
        }
        gField.set(t, geo);
    }
    /**
src/main/java/com/lf/server/helper/ZipHelper.java
@@ -28,11 +28,12 @@
     * @return 成功是/否
     */
    public static boolean unzip(String filePath, String zipDir) {
        ZipFile zipFile = null;
        try {
            int count;
            ZipFile zipfile = new ZipFile(filePath);
            zipFile = new ZipFile(filePath);
            Enumeration e = zipfile.entries();
            Enumeration e = zipFile.entries();
            while (e.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) e.nextElement();
                if (entry.isDirectory()) {
@@ -43,15 +44,17 @@
                    continue;
                }
                BufferedInputStream is = new BufferedInputStream(zipfile.getInputStream(entry));
                BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry));
                FileOutputStream fos = new FileOutputStream(zipDir + File.separator + entry.getName());
                BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE);
                while ((count = is.read(BUFFER, 0, BUFFER_SIZE)) != -1) {
                    dest.write(BUFFER, 0, count);
                }
                dest.flush();
                dest.close();
                fos.close();
                is.close();
            }
@@ -59,6 +62,14 @@
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return false;
        } finally {
            try {
                if (null != zipFile) {
                    zipFile.close();
                }
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
    }
@@ -70,10 +81,11 @@
     * @return 成功是/否
     */
    public static boolean zip(String zipFile, String sourceDir) {
        FileOutputStream fos = null;
        ZipOutputStream zos = null;
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(zipFile);
            zos = new ZipOutputStream(fileOutputStream);
            fos = new FileOutputStream(zipFile);
            zos = new ZipOutputStream(fos);
            File sourceFile = new File(sourceDir);
            compress(sourceFile, zos, sourceFile.getName());
@@ -84,9 +96,12 @@
            return false;
        } finally {
            try {
                if (zos != null) {
                if (null != zos) {
                    zos.close();
                }
                if (null != fos) {
                    fos.close();
                }
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }