瀏覽代碼

更新打包数据

wuweihao 3 年之前
父節點
當前提交
1dc7989982
共有 1 個文件被更改,包括 23 次插入5 次删除
  1. 23 5
      720yun_local_manage/gis_pano/src/main/java/com/gis/cms/service/impl/OpsServiceImpl.java

+ 23 - 5
720yun_local_manage/gis_pano/src/main/java/com/gis/cms/service/impl/OpsServiceImpl.java

@@ -120,7 +120,7 @@ public class OpsServiceImpl  implements OpsService {
             String tourPath;
             for (String sceneCode : split) {
                 tourPath = basePath + File.separator + sceneCode + "/vtour/tour.xml";
-                String scene = getSceneLabel(tourPath);
+                String scene = getSceneLabel(tourPath, sceneCode);
                 sceneLabels.append(scene).append("\r\n");
                 i++;
             }
@@ -187,12 +187,23 @@ public class OpsServiceImpl  implements OpsService {
         }
         String[] split = sceneCodes.split(",");
         log.info("场景数量 : {}", split.length);
-        String outPath = configConstant.serverBasePath + "/download/" + workId;
+        String outBasePath = configConstant.serverBasePath + "/download/" + workId + "/pano";
         String inPath;
+        String inTourPath;
+        String outPath;
         for (String sceneCode : split) {
-            inPath = configConstant.serverBasePath + "/pano/" + sceneCode + "/vtour/panos/" + sceneCode + ".tiles";
+//            inPath = configConstant.serverBasePath + "/pano/" + sceneCode + "/vtour/panos/" + sceneCode + ".tiles";
+            inPath = configConstant.serverBasePath + "/pano/" + sceneCode + "/vtour/panos";
+            outPath = outBasePath + "/" + sceneCode;
+            // 复制全景图
             String cmd = StrUtil.format("cp -r {} {} ", inPath,  outPath);
             CmdUtils.callCmd(cmd);
+
+            // 复制tour.xml
+            inTourPath = configConstant.serverBasePath + "/pano/" + sceneCode + "/vtour/tour.xml";
+            String cmdTour = StrUtil.format("cp -r {} {} ", inTourPath,  outPath);
+            CmdUtils.callCmd(cmdTour);
+
         }
 
     }
@@ -231,7 +242,7 @@ public class OpsServiceImpl  implements OpsService {
             String tourPath;
             for (String sceneCode : split) {
                 tourPath = basePath + "/pano/" + sceneCode + "/vtour/tour.xml";
-                String scene = getSceneLabel(tourPath);
+                String scene = getSceneLabel(tourPath, sceneCode);
                 sceneLabels.append(scene).append("\r\n");
                 i++;
             }
@@ -274,12 +285,19 @@ public class OpsServiceImpl  implements OpsService {
      * @param filePath tour.xml路径
      * @return
      */
-    private static String getSceneLabel(String filePath){
+    private static String getSceneLabel(String filePath, String sceneCode){
         String s = FileUtil.readString(filePath, "UTF-8");
         // 截取</action>之后的
         s = StrUtil.subAfter(s, "</action>", true);
         // 截取</krpano>之前的
         s = StrUtil.subBefore(s, "</krpano>", true);
+
+        // 修改url路径
+        String basePath = "panos/" + sceneCode +".tiles";
+        String regex = "url=\"panos/" + basePath;
+        String replacement = "url=\"/pano/" + sceneCode + "/" + basePath;
+        s.replaceAll(regex, replacement);
+
         return s;
 
     }