xiewj 2 vuotta sitten
vanhempi
commit
2f23ca9a57

+ 2 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java

@@ -51,4 +51,6 @@ public interface WorkService extends IBaseService<WorkEntity, String> {
     Result uploadHot(FileSceneDto file);
 
     Result delOss(String ossPath);
+
+    void fixSomeData(String workId,String active);
 }

+ 120 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -3,8 +3,11 @@ package com.gis.service.impl;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.amazonaws.services.dynamodbv2.xspec.S;
 import com.gis.common.constant.ConfigConstant;
 import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.RedisConstant;
@@ -893,7 +896,124 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         return entityMapper.likeSceneCode(sceneCode, getUserNameForToken());
     }
 
+    @Override
+    public void fixSomeData(String workId,String active) {
+        String URL="";
+        if (active.equalsIgnoreCase("sit")){
+            URL ="https://ossxiaoan.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
+
+        }else    if (active.equalsIgnoreCase("prod")){
+            URL ="https://4dkk.4dage.com/720yun_fd_manage/"+workId+"/someData.json?_= "+System.currentTimeMillis() ;
+        }
+        if (StrUtil.isEmpty(URL)){
+            return;
+        }
+        cn.hutool.http.HttpResponse execute = HttpRequest.get(URL)
+                .timeout(20000)//超时,毫秒
+                .execute();
+        if (execute.getStatus()==200){
+            JSONObject res=JSONObject.parseObject(execute.body());
+           log.info("成功+---"+res);
+           if (res.containsKey("openingAnimationType")){
+               String openingAnimationType = res.getString("openingAnimationType");
+               if (StrUtil.isNotEmpty(openingAnimationType)){
+                   switch (openingAnimationType){
+                       case "小行星开场":
+                           res.put("openingAnimationType",1);
+                           break;
+                       case "小行星巡游开场":
+                           res.put("openingAnimationType",2);
+                           break;
+                       case "小行星缩放开场":
+                           res.put("openingAnimationType",3);
+                           break;
+                       case "水平巡游开场":
+                           res.put("openingAnimationType",4);
+                           break;
+                       case "水晶球开场":
+                           res.put("openingAnimationType",5);
+                           break;
+                   }
+                   res.put("isShowOpeningAnimation",1);
+               }else {
+                   res.put("isShowOpeningAnimation",0);
+               }
+
+           }else if (!res.containsKey("openingAnimationType") &&! res.containsKey("isShowOpeningAnimation")){
+               res.put("isShowOpeningAnimation",0);
+           }
+            if (res.containsKey("customButton")) {
+                JSONArray customButton = res.getJSONArray("customButton");
+                JSONArray newCustomButton =new JSONArray();
+                for (Object o : customButton) {
+                    JSONObject button = JSONObject.parseObject(String.valueOf(o));
+                    if (button.containsKey("type")){
+                        switch (button.getString("type")){
+                            case "电话":
+                                button.put("type","phone");
+                                break;
+                            case "链接":
+                                button.put("type","link");
+                                break;
+
+                        }
+                    }
+                    if (button.containsKey("openMethod")){
+                        switch (button.getString("openMethod")){
+                            case "弹出层打开":
+                                button.put("openMethod","_self");
+                                break;
+                            case "新窗口打开":
+                                button.put("openMethod","_blank");
+                                break;
+
+                        }
+                    }else {
+                        button.put("openMethod","_self");
+                    }
+                    newCustomButton.add(button);
+                }
+                res.put("customButton",newCustomButton);
+            }
+            if (res.containsKey("scenes")) {
+                JSONArray scenes = res.getJSONArray("scenes");
+                JSONArray newScenes = new JSONArray();
+                for (Object o : scenes) {
+                    JSONObject parse = JSONObject.parseObject(o.toString());
+                    if (parse.containsKey("someData")) {
+                        JSONObject someData = parse.getJSONObject("someData");
+                        if (someData.containsKey("hotspots")) {
+                            JSONArray hotspots = someData.getJSONArray("hotspots");
+                            JSONArray newHotspots = new JSONArray();
+                            for (Object hotspot : hotspots) {
+                                JSONObject hotspotJson = JSONObject.parseObject(hotspot.toString());
+                                if (hotspotJson.containsKey("visible")){
+                                    if (hotspotJson.getBoolean("visible")){
+                                        hotspotJson.put("titleDisplayMode","always");
+                                    }else {
+                                        hotspotJson.put("titleDisplayMode","never");
+                                    }
+                                }
+                                if (!hotspotJson.containsKey("titlePosition")){
+                                    hotspotJson.put("titlePosition","top");
+                                }
+                                newHotspots.add(hotspotJson);
+                            }
+                            someData.put("hotspots",newHotspots);
+                        }
+                        parse.put("someData",someData);
+                    }
+                    newScenes.add(parse);
+                }
+                res.put("scenes",newScenes);
+            }
 
+            log.info("修改完成--{}",res);
+            editSomeData(res, workId);
+        }else {
+            log.info("失败+---"+execute.getStatus());
+        }
+    }
 
 
 }

+ 23 - 0
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/TestController.java

@@ -5,10 +5,12 @@ import com.gis.common.constant.ConfigConstant;
 import com.gis.common.config.RabbitConfig;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.TestShDto;
+import com.gis.domain.entity.WorkEntity;
 import com.gis.oss.util.AliYunOssUtil;
 import com.gis.oss.util.FileUtils;
 import com.gis.service.FodderService;
 import com.gis.service.TestService;
+import com.gis.service.WorkService;
 import com.gis.task.VisitTask;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -26,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.*;
 import java.util.Date;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -63,6 +66,8 @@ public class TestController extends BaseController {
     FodderService fodderService;
 
 
+    @Autowired
+    WorkService workService;
 
 
 
@@ -303,7 +308,25 @@ public class TestController extends BaseController {
         return Result.success();
     }
 
+    /**
+     修复1.4.0版本somedata.json
+     * @return
+     */
+    @ApiOperation(value = "修复1.4.0版本somedata.json", notes = "修复1.4.0版本somedata.json")
+    @GetMapping("/fixSomeData")
+    public Result fixSomeData(String workId,String active) {
+        if (workId.equalsIgnoreCase("all")){
+            List<WorkEntity> all = workService.findAll();
+            for (WorkEntity workEntity : all) {
+                workService.fixSomeData(workEntity.getId(),active);
 
+            }
+        }else {
+            workService.fixSomeData(workId,active);
+
+        }
+        return Result.success();
+    }
 
 
 

+ 18 - 0
720yun_fd_manage/gis_web/src/test/java/demo/SceneTest.java

@@ -1,7 +1,12 @@
 package demo;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.lang.Console;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.Header;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -39,7 +44,20 @@ public class SceneTest {
         log.warn("场景数量:{}", jsonArray.size());
         log.warn("场景: {}", jsonArray);
     }
+    @Test
+    public void testJsonGet(){
+        String URL ="https://4dkk.4dage.com/720yun_fd_manage/WK1651829499072921600/someData.json?_= "+System.currentTimeMillis() ;
+        //链式构建请求
+        HttpResponse execute = HttpRequest.get(URL)
+                .timeout(20000)//超时,毫秒
+                .execute();
+        if (execute.getStatus()==200){
+            System.out.println("成功+---"+execute.body());
+        }else {
+            System.out.println("失败+---"+execute.getStatus());
+        }
 
+    }
     /**
      * 合并tour.xml
      * 以第一个场景码为主, 将其他场景的tour.xml里的<scene></scene>标签负责到第一个的tour.xml里去