|
@@ -37,7 +37,6 @@ import com.fdkankan.scene.entity.SceneEditInfoExt;
|
|
|
import com.fdkankan.scene.entity.ScenePlus;
|
|
|
import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
import com.fdkankan.scene.entity.ScenePro;
|
|
|
-import com.fdkankan.scene.entity.SceneProExt;
|
|
|
import com.fdkankan.scene.factory.FloorLogoHandlerFactory;
|
|
|
import com.fdkankan.scene.factory.MusicHandlerFactory;
|
|
|
import com.fdkankan.scene.factory.ScreenshotHandlerFactory;
|
|
@@ -50,12 +49,10 @@ import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
import com.fdkankan.scene.service.IScenePlusService;
|
|
|
import com.fdkankan.scene.service.ISceneProExtService;
|
|
|
import com.fdkankan.scene.service.ISceneProService;
|
|
|
-import com.fdkankan.scene.service.impl.IFdkkLaserServiceImpl.Result;
|
|
|
import com.fdkankan.scene.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.errorprone.annotations.Var;
|
|
|
import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -64,7 +61,6 @@ import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.UUID;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import javax.sound.sampled.AudioSystem;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -1069,24 +1065,50 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData saveBoxPhoto(BaseDataParamVO param){
|
|
|
+ public ResultData deleteVideoBox(DeleteSidParamVO param) throws Exception {
|
|
|
+
|
|
|
+// ScenePro scenePro = sceneProService.findBySceneNum(param.getNum());
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
- if(Objects.isNull(scenePlus)){
|
|
|
+ if(Objects.isNull(scenePlus))
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+
|
|
|
+ SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
+
|
|
|
+ //根据sid移除json
|
|
|
+ String boxVideos = this.createBoxVideos(param.getSid(), null, sceneEditInfo, OperationType.DELETE.code());
|
|
|
+
|
|
|
+ //写数据库
|
|
|
+ this.updateBoxVideos(sceneEditInfo,scenePlus.getId(),boxVideos);
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData saveBoxPhoto(BaseDataParamVO param){
|
|
|
+
|
|
|
+ JSONObject boxPhoto = JSONObject.parseObject(param.getData());
|
|
|
+ String sid = boxPhoto.getString("sid");
|
|
|
+ if(StrUtil.isEmpty(sid)){
|
|
|
+ throw new BusinessException(ServerCode.PARAM_REQUIRED, sid);
|
|
|
}
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
+ if(Objects.isNull(scenePlus))
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
- this.update(new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
- .set(SceneEditInfo::getBoxPhotos, param.getData())
|
|
|
- .setSql("version = version + 1")
|
|
|
- .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
|
|
|
+
|
|
|
+ //生成boxVideos数据
|
|
|
+ String boxPhotos = this.createBoxPhotos(sid, boxPhoto, sceneEditInfo, OperationType.ADDORUPDATE.code());
|
|
|
+
|
|
|
+ //更新数据库
|
|
|
+ this.updateBoxPhotos(sceneEditInfo, boxPhotos);
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData deleteVideoBox(DeleteVidoeBoxParamVO param) throws Exception {
|
|
|
+ public ResultData deleteBoxPhoto(DeleteSidParamVO param){
|
|
|
|
|
|
-// ScenePro scenePro = sceneProService.findBySceneNum(param.getNum());
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
if(Objects.isNull(scenePlus))
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
@@ -1094,10 +1116,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
|
|
|
//根据sid移除json
|
|
|
- String boxVideos = this.createBoxVideos(param.getSid(), null, sceneEditInfo, OperationType.DELETE.code());
|
|
|
+ String boxPhotos = this.createBoxPhotos(param.getSid(), null, sceneEditInfo, OperationType.DELETE.code());
|
|
|
|
|
|
//写数据库
|
|
|
- this.updateBoxVideos(sceneEditInfo,scenePlus.getId(),boxVideos);
|
|
|
+ this.updateBoxPhotos(sceneEditInfo, boxPhotos);
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -1401,6 +1423,13 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void updateBoxPhotos(SceneEditInfo sceneEditInfo, String boxPhotos){
|
|
|
+ this.update(new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
+ .set(SceneEditInfo::getBoxPhotos, boxPhotos)
|
|
|
+ .setSql("version = version + 1")
|
|
|
+ .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
private String createBoxVideos(String sid, JSONObject boxVideo, SceneEditInfo sceneEditInfo, int type){
|
|
|
|
|
|
String boxVideos = null;
|
|
@@ -1454,6 +1483,54 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private String createBoxPhotos(String sid, JSONObject boxPhoto, SceneEditInfo sceneEditInfo, int type){
|
|
|
+
|
|
|
+ String boxPhotos = null;
|
|
|
+ if(sceneEditInfo != null){
|
|
|
+ boxPhotos = sceneEditInfo.getBoxPhotos();
|
|
|
+ }
|
|
|
+ JSONArray boxPhotosJson = null;
|
|
|
+ if (StrUtil.isNotEmpty(boxPhotos)) {
|
|
|
+ boxPhotosJson = JSONArray.parseArray(boxPhotos);
|
|
|
+ }else {
|
|
|
+ boxPhotosJson = new JSONArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ String result = null;
|
|
|
+ //删除
|
|
|
+ if(type == OperationType.DELETE.code()){
|
|
|
+ if(boxPhotosJson.size() == 0)
|
|
|
+ return null;
|
|
|
+ for(int i=0;i<boxPhotosJson.size();++i){
|
|
|
+ JSONObject ele = boxPhotosJson.getJSONObject(i);
|
|
|
+ if(ele.getString("sid").equals(sid)){
|
|
|
+ boxPhotosJson.remove(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //更新
|
|
|
+ boolean exist = false;
|
|
|
+ for(int i=0;i<boxPhotosJson.size();++i){
|
|
|
+ JSONObject ele = boxPhotosJson.getJSONObject(i);
|
|
|
+ if(ele.getString("sid").equals(sid)){
|
|
|
+ boxPhotosJson.set(i, boxPhoto);
|
|
|
+ exist = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ if(!exist){
|
|
|
+ boxPhotosJson.add(boxPhoto);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if(boxPhotosJson.size() != 0){
|
|
|
+ result = boxPhotosJson.toJSONString();
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
private void transferToFlv(String num, String fileName) throws Exception {
|
|
|
|
|
|
String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|