|
@@ -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());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|