|
@@ -1,21 +1,29 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import com.fdkankan.scene.bean.SceneJsonBean;
|
|
|
import com.fdkankan.scene.service.ICommonService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
@Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Resource
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
@Override
|
|
|
public void transferToFlv(String num, String fileName, String bucket) throws Exception {
|
|
@@ -44,4 +52,22 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
String flvFileName = fileName.replace("mp4", "flv");
|
|
|
fYunFileService.uploadFile(bucket, localFilePath.replace("mp4", "flv"), userEditPath+flvFileName);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateViewGetInfo(String num, Map<String, Object> param) {
|
|
|
+ JSONObject infoJson = this.getInfoJson(num);
|
|
|
+ param.keySet().stream().forEach(k->{
|
|
|
+ infoJson.replace(k, param.get(k));
|
|
|
+ });
|
|
|
+
|
|
|
+ String redisKey = String.format(RedisKey.SCENE_JSON, num);
|
|
|
+ redisUtil.del(redisKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JSONObject getInfoJson(String num) {
|
|
|
+ String sceneJsonKey = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
|
|
|
+ String fileContent = fYunFileService.getFileContent(sceneJsonKey);
|
|
|
+ return JSON.parseObject(fileContent);
|
|
|
+ }
|
|
|
}
|