|
@@ -6,6 +6,9 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fdkankan.common.constant.ModelKind;
|
|
|
+import com.fdkankan.common.constant.SceneKind;
|
|
|
+import com.fdkankan.common.constant.SceneScheme;
|
|
|
import com.fdkankan.common.util.CmdUtils;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.download.constant.ScrbCanstant;
|
|
@@ -14,7 +17,10 @@ import com.fdkankan.download.entity.*;
|
|
|
import com.fdkankan.download.factory.UserEditData.UserEditDataHandler;
|
|
|
import com.fdkankan.download.factory.UserEditData.UserEditDataHandlerFactory;
|
|
|
import com.fdkankan.download.service.*;
|
|
|
+import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -30,6 +36,8 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
@Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
|
+ private FYunFileConfig fYunFileConfig;
|
|
|
+ @Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
private IScenePlusExtService scenePlusExtService;
|
|
@@ -39,6 +47,9 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
@Autowired
|
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void syncScene(JSONObject param) throws Exception {
|
|
@@ -46,12 +57,12 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
String num = param.getString("num");
|
|
|
String basePath = "/mnt/scrb/";
|
|
|
String zipPath = basePath + num + ".zip";
|
|
|
- String scenePath = basePath + "num/";
|
|
|
+ String scenePath = basePath + num + "/";
|
|
|
|
|
|
//下载zip包、解压
|
|
|
String key = param.getString("key");
|
|
|
fYunFileService.downloadFile(key, zipPath);
|
|
|
- ZipUtil.unzip(zipPath, basePath);
|
|
|
+ ZipUtil.unzip(zipPath, scenePath);
|
|
|
|
|
|
//切图
|
|
|
String tilesPath = scenePath + "scene_view_data/" + num + "/images/tiles/";
|
|
@@ -63,7 +74,18 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
//上传文件
|
|
|
List<File> files = FileUtil.loopFiles(scenePath + "scene_view_data/");
|
|
|
files.stream().forEach(file -> {
|
|
|
- fYunFileService.uploadFile(file.getAbsolutePath(), file.getAbsolutePath().replace(scenePath, ""));
|
|
|
+ if(file.getAbsolutePath().endsWith("scene.json")){
|
|
|
+ String s = FileUtil.readUtf8String(file.getAbsolutePath());
|
|
|
+ JSONObject jsonObject = JSON.parseObject(s);
|
|
|
+ jsonObject.replace("sceneKind", SceneKind.FACE.code());
|
|
|
+ FileUtil.writeUtf8String(jsonObject.toJSONString(), file.getAbsolutePath());
|
|
|
+ }
|
|
|
+ Map<String, String> headers = null;
|
|
|
+ if(file.getAbsolutePath().endsWith("dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam")){
|
|
|
+ headers = new HashMap<>();
|
|
|
+ headers.put("Content-Encoding", "gzip");
|
|
|
+ }
|
|
|
+ fYunFileService.uploadFile(file.getAbsolutePath(), file.getAbsolutePath().replace(scenePath, ""), headers);
|
|
|
});
|
|
|
|
|
|
files = FileUtil.loopFiles(scenePath + "scene_result_data/");
|
|
@@ -82,7 +104,11 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
String scenePlusExtStr = FileUtil.readUtf8String(scenePath + "scenePlusExt.txt");
|
|
|
ScenePlusExt scenePlusExt = JSON.parseObject(scenePlusExtStr, ScenePlusExt.class);
|
|
|
scenePlusExt.setId(null);
|
|
|
+ scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
|
+ scenePlusExt.setSceneScheme(SceneScheme.TWO_K.code());
|
|
|
scenePlusExt.setPlusId(scenePlus.getId());
|
|
|
+ scenePlusExt.setYunFileBucket(null);
|
|
|
+ scenePlusExt.getVideos().replaceAll("https://4dkk.4dage.com/", fYunFileConfig.getHost());
|
|
|
scenePlusExtService.save(scenePlusExt);
|
|
|
|
|
|
String sceneEditInfoStr = FileUtil.readUtf8String(scenePath + "sceneEditInfo.txt");
|
|
@@ -111,6 +137,9 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
bizs.add(UserEditDataType.FLOORPLAN.message());
|
|
|
bizs.add(UserEditDataType.FILTERS.message());
|
|
|
this.initUserEditData(num, bizs, null);
|
|
|
+
|
|
|
+ redisUtil.del(String.format(RedisKey.SCENE_JSON, num));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|