|
@@ -9,6 +9,7 @@ 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;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
@@ -943,19 +944,16 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
}
|
|
}
|
|
|
|
|
|
private void updateBoxVideos(SceneEditInfo sceneEditInfo, Long sceneProId, String boxVideos){
|
|
private void updateBoxVideos(SceneEditInfo sceneEditInfo, Long sceneProId, String boxVideos){
|
|
- if(StrUtil.isEmpty(boxVideos)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
if(Objects.isNull(sceneEditInfo)){
|
|
if(Objects.isNull(sceneEditInfo)){
|
|
sceneEditInfo = new SceneEditInfo();
|
|
sceneEditInfo = new SceneEditInfo();
|
|
sceneEditInfo.setSceneProId(sceneProId);
|
|
sceneEditInfo.setSceneProId(sceneProId);
|
|
sceneEditInfo.setBoxVideos(boxVideos);
|
|
sceneEditInfo.setBoxVideos(boxVideos);
|
|
this.save(sceneEditInfo);
|
|
this.save(sceneEditInfo);
|
|
}else{
|
|
}else{
|
|
- this.update(new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
|
|
|
+ this.update(new UpdateWrapper<SceneEditInfo>()
|
|
.setSql("version = version + 1")
|
|
.setSql("version = version + 1")
|
|
- .set(SceneEditInfo::getBoxVideos, boxVideos)
|
|
|
|
- .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
|
|
|
|
|
|
+ .set("box_videos", boxVideos)
|
|
|
|
+ .eq("id", sceneEditInfo.getId()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -972,6 +970,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
boxVideosJson = new JSONArray();
|
|
boxVideosJson = new JSONArray();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ String result = null;
|
|
//删除
|
|
//删除
|
|
if(type == OperationType.DELETE.code()){
|
|
if(type == OperationType.DELETE.code()){
|
|
if(boxVideosJson.size() == 0)
|
|
if(boxVideosJson.size() == 0)
|
|
@@ -982,25 +981,33 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
boxVideosJson.remove(i);
|
|
boxVideosJson.remove(i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return boxVideosJson.toJSONString();
|
|
|
|
- }
|
|
|
|
|
|
|
|
- //更新
|
|
|
|
- boolean exist = false;
|
|
|
|
- for(int i=0;i<boxVideosJson.size();++i){
|
|
|
|
- JSONObject ele = boxVideosJson.getJSONObject(i);
|
|
|
|
- if(ele.getString("sid").equals(sid)){
|
|
|
|
- boxVideosJson.set(i, boxVideo);
|
|
|
|
- exist = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ }else{
|
|
|
|
|
|
- //新增
|
|
|
|
- if(!exist){
|
|
|
|
|
|
+ // TODO: 2022/3/1 目前需求只保留一个,所以这里先注释掉,sid不同时,不追加
|
|
|
|
+ //更新
|
|
|
|
+// boolean exist = false;
|
|
|
|
+// for(int i=0;i<boxVideosJson.size();++i){
|
|
|
|
+// JSONObject ele = boxVideosJson.getJSONObject(i);
|
|
|
|
+// if(ele.getString("sid").equals(sid)){
|
|
|
|
+// boxVideosJson.set(i, boxVideo);
|
|
|
|
+// exist = true;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// //新增
|
|
|
|
+// if(!exist){
|
|
|
|
+// boxVideosJson.add(boxVideo);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ boxVideosJson.clear();
|
|
boxVideosJson.add(boxVideo);
|
|
boxVideosJson.add(boxVideo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(boxVideosJson.size() != 0){
|
|
|
|
+ result = boxVideosJson.toJSONString();
|
|
}
|
|
}
|
|
|
|
|
|
- return boxVideosJson.toJSONString();
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
private void transferToFlv(String num, String fileName) throws Exception {
|
|
private void transferToFlv(String num, String fileName) throws Exception {
|