From ed8c7a5effd0d423ce1118b680ecdca6fe732609 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 02 七月 2025 16:43:13 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.11.205:9000/r/P2022036_Service

---
 src/main/java/com/lf/server/service/show/InquiryService.java |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/lf/server/service/show/InquiryService.java b/src/main/java/com/lf/server/service/show/InquiryService.java
index 207e3ba..0d310f1 100644
--- a/src/main/java/com/lf/server/service/show/InquiryService.java
+++ b/src/main/java/com/lf/server/service/show/InquiryService.java
@@ -12,6 +12,8 @@
 import com.lf.server.service.data.PublishService;
 import net.lingala.zip4j.ZipFile;
 import net.lingala.zip4j.model.ZipParameters;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -35,6 +37,8 @@
 
     @Resource
     DownloadService downloadService;
+
+    private final static Log log = LogFactory.getLog(InquiryService.class);
 
     /**
      * 璇诲彇Shp绗竴鏉¤褰曠殑WKT
@@ -91,7 +95,7 @@
      * 鐡︾墖璺緞鏄惁瀛樺湪
      */
     private boolean isTilePathExist(PublishEntity pub) {
-        String tilePath = pathHelper.getConfig().getTilePath().replace("2d\\tiles", "") + File.separator + pub.getPath();
+        String tilePath = pathHelper.getConfig().getTilePath() + pub.getPath();
 
         File f = new File(tilePath);
         if (!f.exists() || !f.isDirectory()) {
@@ -108,8 +112,17 @@
      */
     private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) {
         List<File> list = new ArrayList<>();
+
+        File view = new File(pub.getPath() + File.separator + "view.htm");
+        if (view.exists() && !view.isDirectory()) {
+            list.add(view);
+        }
+
         for (int i = 0; i < StaticData.I23; i++) {
-            findTilesByZoom(dt, pub, i, list);
+            List<File> files = findTilesByZoom(dt, pub, i);
+            if (files.size() > 0) {
+                list.addAll(files);
+            }
         }
 
         return list;
@@ -118,10 +131,11 @@
     /**
      * 鏍规嵁灞傛鏌ユ壘鐡︾墖
      */
-    private void findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom, List<File> list) {
+    private List<File> findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom) {
+        List<File> list = new ArrayList<>();
         File f = new File(pub.getPath() + File.separator + zoom);
         if (!f.exists() || !f.isDirectory()) {
-            return;
+            return list;
         }
 
         int[] leftTop = deg2num(zoom, dt.getXmin(), dt.getYmax());
@@ -129,7 +143,7 @@
 
         for (int x = leftTop[0]; x <= rightBottom[0]; x++) {
             for (int y = leftTop[1]; y <= rightBottom[1]; y++) {
-                String pngPath = String.format("%s\\%d\\%d.png", pub.getPath(), x, y);
+                String pngPath = String.format("%s\\%d\\%d\\%d.png", pub.getPath(), zoom, x, y);
 
                 File pngFile = new File(pngPath);
                 if (pngFile.exists()) {
@@ -137,6 +151,8 @@
                 }
             }
         }
+
+        return list;
     }
 
     /**
@@ -160,8 +176,8 @@
             try {
                 params.setFileNameInZip(f.getPath().replace(basePath, ""));
                 zip.addStream(new FileInputStream(f), params);
-            } catch (Exception e) {
-                //
+            } catch (Exception ex) {
+                log.error(ex.getMessage(), ex);
             }
         }
     }

--
Gitblit v1.9.3