|
@@ -234,5 +234,43 @@ public class ResourceService {
|
|
|
targetResouce.setPath(resource.getPath());
|
|
|
resourceRepository.save(targetResouce);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * upload ViDEO
|
|
|
+ * @param resource
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public APIResult<Resource> saveRemoteResource(Resource resource) {
|
|
|
+
|
|
|
+ List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
+ Map<String, Object> video = new HashMap<>();
|
|
|
+ video.put("bucket","");
|
|
|
+ video.put("path",resource.getPath());
|
|
|
+ video.put("format",resource.getFormat());
|
|
|
+ video.put("quality",resource.getQuality());
|
|
|
+ video.put("size",resource.getSize());
|
|
|
+
|
|
|
+ videos.add(video);
|
|
|
+
|
|
|
+ APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(new HashMap<String, Object>(){
|
|
|
+ {
|
|
|
+ this.put("no", resource.getCode());
|
|
|
+ this.put("title", resource.getName());
|
|
|
+ this.put("type", resource.getType());
|
|
|
+ this.put("videos", videos);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!apiResult.getSuccess()) {
|
|
|
+ log.error("Remote Server Error: code={}, message={}", apiResult.getCode(), apiResult.getMessage());
|
|
|
+ APIResult errResult = APIResult.error(APICode.REMOTE_SERVER_ERROR);
|
|
|
+ apiResult.setMessage(apiResult.getMessage());
|
|
|
+ return errResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ Resource result = apiResult.getData().toNativeResource();
|
|
|
+ return APIResult.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|