|
@@ -1,26 +1,23 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
-import cn.hutool.core.util.ObjUtil;
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.SceneConstant;
|
|
|
-import com.fdkankan.common.constant.SceneVersionType;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.DateExtUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.common.util.SnowflakeIdGenerator;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
@@ -31,14 +28,10 @@ import com.fdkankan.scene.entity.*;
|
|
|
import com.fdkankan.scene.mapper.ISceneMapper;
|
|
|
import com.fdkankan.scene.oss.OssUtil;
|
|
|
import com.fdkankan.scene.service.*;
|
|
|
-import com.fdkankan.scene.entity.ScenePlus;
|
|
|
-import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
-import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
-import com.fdkankan.scene.service.IScenePlusService;
|
|
|
-import com.fdkankan.scene.service.ISceneService;
|
|
|
import com.fdkankan.scene.util.OssBodySegmentUtil;
|
|
|
import com.fdkankan.scene.vo.SceneParamVO;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
+import com.sun.xml.bind.v2.TODO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -53,9 +46,8 @@ import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.nio.file.FileSystemException;
|
|
|
-import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
@Slf4j
|
|
@@ -357,4 +349,249 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
|
|
|
wrapper.set(Scene::getStatus, status);
|
|
|
return update(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JSONObject sceneDataExport(String num) {
|
|
|
+
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ JSONObject mysql = new JSONObject();
|
|
|
+ JSONObject redis = new JSONObject();
|
|
|
+ result.put("mysql", mysql);
|
|
|
+ result.put("redis", redis);
|
|
|
+
|
|
|
+ //t_scene_plus
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ if(Objects.isNull(scenePlus)){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ mysql.put("scenePlus", scenePlus);
|
|
|
+
|
|
|
+ //t_scene_plus_ext
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+ mysql.put("scenePlusExt", scenePlusExt);
|
|
|
+
|
|
|
+ //t_scene_edit_info
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+ mysql.put("sceneEditInfo", sceneEditInfo);
|
|
|
+
|
|
|
+ //t_scene_edit_info_ext
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
+ mysql.put("sceneEditInfoExt", sceneEditInfoExt);
|
|
|
+
|
|
|
+ //t_scene_edit_controls
|
|
|
+ SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
+ mysql.put("sceneEditControls", sceneEditControls);
|
|
|
+
|
|
|
+ //马赛克
|
|
|
+ String mosaicKey = String.format(RedisKey.SCENE_MOSAIC_DATA, num);
|
|
|
+ Map<String, String> mosaicMap = redisUtil.hmget(mosaicKey);
|
|
|
+ if(CollUtil.isNotEmpty(mosaicMap)){
|
|
|
+ JSONObject mosaic = new JSONObject();
|
|
|
+ mosaic.put("key", mosaicKey);
|
|
|
+ mosaic.put("value", mosaicMap);
|
|
|
+ redis.put("mosaic", mosaic);
|
|
|
+ }
|
|
|
+
|
|
|
+ //热点
|
|
|
+ String hotDataKey = String.format(RedisKey.SCENE_HOT_DATA, num);
|
|
|
+ Map<String, String> hotMap = redisUtil.hmget(hotDataKey);
|
|
|
+ if(CollUtil.isNotEmpty(hotMap)){
|
|
|
+ JSONObject hot = new JSONObject();
|
|
|
+ hot.put("key", hotDataKey);
|
|
|
+ hot.put("value", hotMap);
|
|
|
+ redis.put("hot", hot);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //热点图标
|
|
|
+ String hotIconKey = String.format(RedisKey.SCENE_HOT_ICONS, num);
|
|
|
+ Set<String> set = redisUtil.sGet(hotIconKey);
|
|
|
+ if(CollUtil.isNotEmpty(set)){
|
|
|
+ JSONObject hotIcon = new JSONObject();
|
|
|
+ hotIcon.put("key", hotIconKey);
|
|
|
+ hotIcon.put("value", set);
|
|
|
+ redis.put("hotIcon", hotIcon);
|
|
|
+ }
|
|
|
+
|
|
|
+ //场景关联
|
|
|
+ String linkPanKey = String.format(RedisKey.SCENE_LINKPAN_DATA, num);
|
|
|
+ Map<String, String> linkPanMap = redisUtil.hmget(linkPanKey);
|
|
|
+ if(CollUtil.isNotEmpty(linkPanMap)){
|
|
|
+ JSONObject linkPan = new JSONObject();
|
|
|
+ linkPan.put("key", linkPanKey);
|
|
|
+ linkPan.put("value", linkPanMap);
|
|
|
+ redis.put("linkPan", linkPan);
|
|
|
+ }
|
|
|
+
|
|
|
+ //滤镜
|
|
|
+ String filterKey = String.format(RedisKey.SCENE_filter_DATA, num);
|
|
|
+ List<String> filterList = redisUtil.lGet(filterKey, 0, -1);
|
|
|
+ if(CollUtil.isNotEmpty(filterList)){
|
|
|
+ JSONObject filter = new JSONObject();
|
|
|
+ filter.put("key", filterKey);
|
|
|
+ filter.put("value", filterList);
|
|
|
+ redis.put("filter", filter);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //指示牌
|
|
|
+ String billboardKey = String.format(RedisKey.SCENE_BILLBOARDS, num);
|
|
|
+ Map<String, String> billboardKeyMap = redisUtil.hmget(billboardKey);
|
|
|
+ if(CollUtil.isNotEmpty(billboardKeyMap)){
|
|
|
+ JSONObject billboard = new JSONObject();
|
|
|
+ billboard.put("key", billboardKey);
|
|
|
+ billboard.put("value", billboardKeyMap);
|
|
|
+ redis.put("billboard", billboard);
|
|
|
+ }
|
|
|
+
|
|
|
+ //指示牌风格
|
|
|
+ String billboardStylesKey = String.format(RedisKey.SCENE_BILLBOARDS_STYLES, num);
|
|
|
+ Map<String, String> billboardStylesMap = redisUtil.hmget(billboardStylesKey);
|
|
|
+ if(CollUtil.isNotEmpty(billboardStylesMap)){
|
|
|
+ JSONObject billboardStyles = new JSONObject();
|
|
|
+ billboardStyles.put("key", billboardStylesKey);
|
|
|
+ billboardStyles.put("value", billboardStylesMap);
|
|
|
+ redis.put("billboardStyles", billboardStyles);
|
|
|
+ }
|
|
|
+
|
|
|
+ //模型裁剪
|
|
|
+ String cutModelKey = String.format(RedisKey.SCENE_CUT_MODEL, num);
|
|
|
+ Map<String, String> cutModelMap = redisUtil.hmget(cutModelKey);
|
|
|
+ if(CollUtil.isNotEmpty(cutModelMap)){
|
|
|
+ JSONObject cutModel = new JSONObject();
|
|
|
+ cutModel.put("key", cutModelKey);
|
|
|
+ cutModel.put("value", cutModelMap);
|
|
|
+ redis.put("cutModel", cutModel);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //空间绘制
|
|
|
+ String sceneDrawKey = String.format(RedisKey.SCENE_DRAW, num);
|
|
|
+ Map<String, String> sceneDrawMap = redisUtil.hmget(sceneDrawKey);
|
|
|
+ if(CollUtil.isNotEmpty(sceneDrawMap)){
|
|
|
+ JSONObject sceneDraw = new JSONObject();
|
|
|
+ sceneDraw.put("key", sceneDrawKey);
|
|
|
+ sceneDraw.put("value", sceneDrawMap);
|
|
|
+ redis.put("sceneDraw", sceneDraw);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void sceneDataImport(JSONObject params) {
|
|
|
+ if(Objects.isNull(params)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject mysql = params.getJSONObject("mysql");
|
|
|
+ if(Objects.isNull(mysql)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!mysql.containsKey("scenePlus")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ScenePlus scenePlus = mysql.getObject("scenePlus", ScenePlus.class);
|
|
|
+ scenePlus.setId(null);
|
|
|
+ scenePlusService.save(scenePlus);
|
|
|
+
|
|
|
+ ScenePlusExt scenePlusExt = mysql.getObject("scenePlusExt", ScenePlusExt.class);
|
|
|
+ scenePlusExt.setId(null);
|
|
|
+ scenePlusExt.setPlusId(scenePlus.getId());
|
|
|
+ scenePlusExt.setDataSource(params.getString("dataSource"));
|
|
|
+ scenePlusExt.setYunFileBucket(params.getString("yunFileBucket"));
|
|
|
+ scenePlusExtService.save(scenePlusExt);
|
|
|
+
|
|
|
+ SceneEditInfo sceneEditInfo = mysql.getObject("sceneEditInfo", SceneEditInfo.class);
|
|
|
+ sceneEditInfo.setId(null);
|
|
|
+ sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
+ sceneEditInfoService.save(sceneEditInfo);
|
|
|
+
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = mysql.getObject("sceneEditInfoExt", SceneEditInfoExt.class);
|
|
|
+ sceneEditInfoExt.setId(null);
|
|
|
+ sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
+ sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
+ sceneEditInfoExtService.save(sceneEditInfoExt);
|
|
|
+
|
|
|
+ SceneEditControls sceneEditControls = mysql.getObject("sceneEditControls", SceneEditControls.class);
|
|
|
+ sceneEditControls.setId(null);
|
|
|
+ sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
+ sceneEditControlsService.save(sceneEditControls);
|
|
|
+
|
|
|
+ JSONObject redis = params.getJSONObject("redis");
|
|
|
+ if(Objects.nonNull(redis)){
|
|
|
+ //马赛克
|
|
|
+ if(redis.containsKey("mosaic")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("mosaic");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //热点
|
|
|
+ if(redis.containsKey("hot")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("hot");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //热点图标
|
|
|
+ if(redis.containsKey("hotIcon")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("hotIcon");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Set<String> value = jsonObject.getObject("value", Set.class);
|
|
|
+ redisUtil.sSet(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //场景关联
|
|
|
+ if(redis.containsKey("linkPan")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("linkPan");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //滤镜
|
|
|
+ if(redis.containsKey("filter")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("filter");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ List<String> value = jsonObject.getObject("value", List.class);
|
|
|
+ redisUtil.lRightPushAll(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //指示牌
|
|
|
+ if(redis.containsKey("billboard")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("billboard");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //指示牌风格
|
|
|
+ if(redis.containsKey("billboardStyles")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("billboardStyles");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //模型裁剪
|
|
|
+ if(redis.containsKey("cutModel")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("cutModel");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //空间绘制
|
|
|
+ if(redis.containsKey("sceneDraw")){
|
|
|
+ JSONObject jsonObject = redis.getJSONObject("sceneDraw");
|
|
|
+ String key = jsonObject.getString("key");
|
|
|
+ Map<String, String> value = jsonObject.getObject("value", Map.class);
|
|
|
+ redisUtil.hmset(key, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|