|
@@ -3854,7 +3854,7 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
scenejson = JSONObject.parseObject(strsceneInfos);
|
|
|
}
|
|
|
log.info("转换前-scene.json文件转换json-{}", scenejson);
|
|
|
- putVideoDataToAllSceneJson(operaVideoDTO, scenejson);
|
|
|
+ String videos = putVideoDataToAllSceneJson(operaVideoDTO, scenejson);
|
|
|
log.info("转换后-scene.json文件转换json-{}", scenejson);
|
|
|
FileUtils.writeFile(dataBuffer + "scene.json", scenejson.toString());
|
|
|
|
|
@@ -3862,7 +3862,7 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
uploadMap.put(dataBuffer + "scene.json", dataBuf + "scene.json");
|
|
|
uploadToOssUtil.uploadMulFiles(uploadMap);
|
|
|
|
|
|
- sceneProEntity.setVideos(scenejson.get("videos").toString());
|
|
|
+ sceneProEntity.setVideos(videos);
|
|
|
update(sceneProEntity);
|
|
|
}
|
|
|
|
|
@@ -3882,7 +3882,7 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
}
|
|
|
|
|
|
log.info("转换前-scene.json文件转换json-{}", scenejson);
|
|
|
- putVideoDataToSceneJson(operaVideoDTO, scenejson);
|
|
|
+ String videos = putVideoDataToSceneJson(operaVideoDTO, scenejson);
|
|
|
log.info("转换后-scene.json文件转换json-{}", scenejson);
|
|
|
FileUtils.writeFile(dataBuffer + "scene.json", scenejson.toString());
|
|
|
|
|
@@ -3890,45 +3890,43 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
uploadMap.put(dataBuffer + "scene.json", dataBuf + "scene.json");
|
|
|
uploadToOssUtil.uploadMulFiles(uploadMap);
|
|
|
|
|
|
- sceneProEntity.setVideos(scenejson.get("videos").toString());
|
|
|
+ sceneProEntity.setVideos(videos);
|
|
|
update(sceneProEntity);
|
|
|
}
|
|
|
|
|
|
- private void putVideoDataToAllSceneJson(OperaVideoParam operaVideoDTO, JSONObject scenejson) {
|
|
|
+ private String putVideoDataToAllSceneJson(OperaVideoParam operaVideoDTO, JSONObject scenejson) {
|
|
|
Object videos = scenejson.get("videos");
|
|
|
- Object data;
|
|
|
if (videos == null) {
|
|
|
throw new BaseRuntimeException("json数据异常");
|
|
|
}
|
|
|
- JSONObject vo = (JSONObject) videos;
|
|
|
- data = vo.get("data");
|
|
|
- if (data == null || data instanceof JSONArray == false) {
|
|
|
- throw new BaseRuntimeException("json-data数据异常");
|
|
|
- }
|
|
|
- JSONArray jsonArray = (JSONArray) data;
|
|
|
- for (Object o : jsonArray) {
|
|
|
- ((JSONObject)o).put("show", operaVideoDTO.getShow());
|
|
|
- }
|
|
|
+ JSONObject vo = JSONObject.parseObject(videos.toString());
|
|
|
+ vo.put("show", operaVideoDTO.getShow());
|
|
|
+ scenejson.put("videos", vo.toString());
|
|
|
+ return vo.toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
// todo
|
|
|
- private void putVideoDataToSceneJson(OperaVideoParam operaVideoDTO, JSONObject scenejson) {
|
|
|
+ private String putVideoDataToSceneJson(OperaVideoParam operaVideoDTO, JSONObject scenejson) {
|
|
|
Object videos = scenejson.get("videos");
|
|
|
Object data;
|
|
|
if (videos == null) {
|
|
|
throw new BaseRuntimeException("json数据异常");
|
|
|
}
|
|
|
- JSONObject vo = (JSONObject) videos;
|
|
|
+ JSONObject vo = JSONObject.parseObject(videos.toString());
|
|
|
data = vo.get("data");
|
|
|
if (data == null || data instanceof JSONArray == false) {
|
|
|
throw new BaseRuntimeException("json-data数据异常");
|
|
|
}
|
|
|
JSONArray jsonArray = (JSONArray) data;
|
|
|
- Object jsonObj = jsonArray.stream().filter(j -> operaVideoDTO.getId().equals(((JSONObject)j).get("id")))
|
|
|
+ Object jsonObj = jsonArray.stream().filter(j -> operaVideoDTO.getId().equals(((JSONObject)j).get("id").toString()))
|
|
|
.findAny().orElseThrow(() -> new BaseRuntimeException("json数据data里找不到对应记录"));
|
|
|
|
|
|
((JSONObject)jsonObj).put("show", operaVideoDTO.getShow());
|
|
|
+ vo.put("data", data);
|
|
|
+ scenejson.put("videos", vo.toString());
|
|
|
+
|
|
|
+ return vo.toString();
|
|
|
}
|
|
|
|
|
|
}
|