|
|
@@ -1,9 +1,15 @@
|
|
|
package com.fdkankan.scene.controller;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.lang.UUID;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.SceneInfoReqType;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.scene.annotation.CheckPermit;
|
|
|
+import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
+import com.fdkankan.scene.entity.ScenePlus;
|
|
|
import com.fdkankan.scene.service.ISceneDynamicPanelService;
|
|
|
import com.fdkankan.scene.service.ISceneService;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
@@ -20,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.websocket.server.PathParam;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -138,10 +145,24 @@ public class SceneController extends BaseController {
|
|
|
|
|
|
@GetMapping("copyBoxModel/{num}/{count}")
|
|
|
public ResultData copyBoxModel(@PathParam("num") String num, @PathParam("count") int count){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ ScenePlus scenePlusByNum = scenePlusService.getScenePlusByNum(num);
|
|
|
+ SceneEditInfo byScenePlusId = sceneEditInfoService.getByScenePlusId(scenePlusByNum.getId());
|
|
|
+ String boxModels = byScenePlusId.getBoxModels();
|
|
|
+ List<JSONObject> boxModelList = JSON.parseObject(boxModels, List.class);
|
|
|
+ JSONObject jsonObject = boxModelList.get(0);
|
|
|
+ String sid= jsonObject.getString("sid");
|
|
|
+ String glbKYE = String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb";
|
|
|
+ for (int i = 0; i < count; i++){
|
|
|
+ String newSid = UUID.randomUUID().toString().replace("-","");
|
|
|
+ String newglbKYE = String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + newSid.concat(".glb");
|
|
|
+ fYunFileService.copyFileInBucket(glbKYE, newglbKYE);
|
|
|
+ String jsonString = JSON.toJSONString(jsonObject).replace(sid, newSid);
|
|
|
+ JSONObject jsonObject1 = JSON.parseObject(jsonString);
|
|
|
+ boxModelList.add(jsonObject1);
|
|
|
+ }
|
|
|
+ byScenePlusId.setBoxModels(JSON.toJSONString(boxModelList));
|
|
|
+ sceneEditInfoService.updateById(byScenePlusId);
|
|
|
+ return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
|