|
@@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -45,6 +46,7 @@ import java.nio.file.FileSystemException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -286,6 +288,13 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
if(Objects.nonNull(scenePlusByNum))
|
|
if(Objects.nonNull(scenePlusByNum))
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
|
|
|
|
|
|
+ JSONObject fdageData = getFdageData(dataSource + File.separator + "capture" +File.separator+"data.fdage");
|
|
|
|
+ Integer videoVersion = fdageData.getInteger("videoVersion");
|
|
|
|
+ int cameraType = 10;//默认看看相机
|
|
|
|
+ if(sceneSource == 4 || sceneSource == 5){
|
|
|
|
+ cameraType = 14;
|
|
|
|
+ }
|
|
|
|
+
|
|
//生成场景主表
|
|
//生成场景主表
|
|
ScenePlus scenePlus = new ScenePlus();
|
|
ScenePlus scenePlus = new ScenePlus();
|
|
scenePlus.setNum(num);
|
|
scenePlus.setNum(num);
|
|
@@ -307,6 +316,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
scenePlusExt.setYunFileBucket(bucket);
|
|
scenePlusExt.setYunFileBucket(bucket);
|
|
scenePlusExt.setAlgorithmTime(Calendar.getInstance().getTime());
|
|
scenePlusExt.setAlgorithmTime(Calendar.getInstance().getTime());
|
|
|
|
+ scenePlusExt.setVideos(this.getVideosJson(dataSource, videoVersion, num, cameraType).toJSONString());
|
|
scenePlusExtService.save(scenePlusExt);
|
|
scenePlusExtService.save(scenePlusExt);
|
|
|
|
|
|
//生成编辑主表
|
|
//生成编辑主表
|
|
@@ -367,6 +377,99 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private JSONObject getFdageData(String dataFdagePath) {
|
|
|
|
+ log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
|
|
+ String data = FileUtils.readFile(dataFdagePath);
|
|
|
|
+ //获取data.fdage的内容
|
|
|
|
+ JSONObject dataJson = new JSONObject();
|
|
|
|
+ if(data!=null){
|
|
|
|
+ dataJson = JSONObject.parseObject(data);
|
|
|
|
+ }
|
|
|
|
+ return dataJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType){
|
|
|
|
+ //读取videos_hdr_param.json, 保存点位视频的value
|
|
|
|
+ Map<String, Object> videoMap = new HashMap<>();
|
|
|
|
+ String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
|
|
|
|
+ JSONArray videoArray = null;
|
|
|
|
+ if(StringUtils.isNotEmpty(videosHdr)){
|
|
|
|
+ videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
|
|
|
|
+ }
|
|
|
|
+ if(videoArray != null){
|
|
|
|
+ for(int i = 0, len = videoArray.size(); i < len; i++) {
|
|
|
|
+ videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
|
|
|
|
+ if(videoArray.getJSONObject(i).containsKey("fov")){
|
|
|
|
+ videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取upload中的video视频名称
|
|
|
|
+ String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
|
|
|
|
+ JSONObject uploadJson = null;
|
|
|
|
+ JSONArray array = null;
|
|
|
|
+ if(uploadData!=null) {
|
|
|
|
+ uploadJson = JSONObject.parseObject(uploadData);
|
|
|
|
+ array = uploadJson.getJSONArray("upload");
|
|
|
|
+ }
|
|
|
|
+ JSONObject fileJson = null;
|
|
|
|
+ String fileName = "";
|
|
|
|
+
|
|
|
|
+ //计算ts文件的大小,并拼接成json格式
|
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
|
+ JSONObject videoJson = null;
|
|
|
|
+ JSONObject videosJson = new JSONObject();
|
|
|
|
+ long videoSize = 0L;
|
|
|
|
+ for(int i = 0, len = array.size(); i < len; i++) {
|
|
|
|
+ fileJson = array.getJSONObject(i);
|
|
|
|
+ fileName = fileJson.getString("file");
|
|
|
|
+ if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
|
|
|
|
+ videoJson = new JSONObject();
|
|
|
|
+ videoJson.put("id", fileName.substring(
|
|
|
|
+ 0, fileName.lastIndexOf(".")).replace("videos/", ""));
|
|
|
|
+
|
|
|
|
+ //如果ts文件存在,就计算ts大小
|
|
|
|
+ if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
|
|
|
|
+ videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
|
|
|
|
+ videoJson.put("tsSize", videoSize);
|
|
|
|
+ }
|
|
|
|
+ if(videoMap.containsKey(videoJson.get("id"))){
|
|
|
|
+ videoJson.put("value", videoMap.get(videoJson.get("id")));
|
|
|
|
+ }
|
|
|
|
+ if(videoMap.containsKey(videoJson.get("id") + "_fov")){
|
|
|
|
+ videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
|
|
|
|
+ }else {
|
|
|
|
+ videoJson.put("blend_fov", 7);
|
|
|
|
+ }
|
|
|
|
+ jsonArray.add(videoJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ videosJson.put("data", jsonArray);
|
|
|
|
+ if(Objects.nonNull(videoVersion) && videoVersion >= 4){
|
|
|
|
+ videosJson.put("version", 3);
|
|
|
|
+ videosJson.put("upPath", String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
|
|
|
|
+ if(cameraType == 13){
|
|
|
|
+ //转台相机
|
|
|
|
+ videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ videosJson.put("version", 1);
|
|
|
|
+ videosJson.put("upPath", String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
|
|
|
|
+ if(cameraType == 13){
|
|
|
|
+ //转台相机
|
|
|
|
+ videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(cameraType == 5 || cameraType == 6){
|
|
|
|
+ videosJson.put("version", 1);
|
|
|
|
+ videosJson.put("upPath", String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
|
|
|
|
+ }
|
|
|
|
+ return videosJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ResultData editScene(LaserSceneBean param) {
|
|
public ResultData editScene(LaserSceneBean param) {
|
|
|
|
|