|
@@ -3811,4 +3811,65 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result deleteROIVideo(String sceneNum, String fileName, String planId) throws Exception {
|
|
|
+ if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(fileName) || StringUtils.isEmpty(planId)){
|
|
|
+ throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
+ }
|
|
|
+
|
|
|
+ SceneProEntity sceneProEntity = sceneProMapper.findByNum(sceneNum);
|
|
|
+ if(sceneProEntity == null){
|
|
|
+ throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer dataBuf = new StringBuffer()
|
|
|
+ .append("data").append(File.separator)
|
|
|
+ .append("data").append(sceneProEntity.getNum())
|
|
|
+ .append(File.separator);
|
|
|
+
|
|
|
+ StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
|
+
|
|
|
+ String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
|
+ JSONObject scenejson = new JSONObject();
|
|
|
+ if(strsceneInfos!=null) {
|
|
|
+ scenejson = JSONObject.parseObject(strsceneInfos);
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray newArray = new JSONArray();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+
|
|
|
+ if(scenejson.containsKey("videosUser")){
|
|
|
+ jsonArray = JSON.parseArray(scenejson.getString("videosUser"));
|
|
|
+ for(int i = 0, len = jsonArray.size(); i < len; i++){
|
|
|
+ jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ if(planId.equals(jsonObject.getString("panoId"))){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!newArray.contains(jsonObject)){
|
|
|
+ newArray.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ scenejson.put("videosUser", newArray.toJSONString());
|
|
|
+ scenejson.put("imagesVersion", scenejson.getIntValue("imagesVersion") + 1);
|
|
|
+
|
|
|
+ FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
+
|
|
|
+ SceneProEditEntity sceneProEditEntity = sceneProEditMapper.findByProId(sceneProEntity.getId());
|
|
|
+ if(sceneProEditEntity != null){
|
|
|
+ sceneProEditEntity.setImagesVersion(sceneProEditEntity.getImagesVersion() + 1);
|
|
|
+ sceneProEditMapper.updateByPrimaryKey(sceneProEditEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ uploadToOssUtil.delete("video/video"+ sceneProEntity.getNum() + File.separator +
|
|
|
+ fileName.substring(0, fileName.lastIndexOf(".")) + ".mp4");
|
|
|
+ uploadToOssUtil.delete("video/video"+ sceneProEntity.getNum() + File.separator +
|
|
|
+ fileName.substring(0, fileName.lastIndexOf(".")) + ".flv");
|
|
|
+
|
|
|
+ FileUtils.deleteFile(ConstantFilePath.SCENE_PATH + "video/video"+ sceneProEntity.getNum() + File.separator + fileName);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|