|
@@ -236,7 +236,8 @@ public class ResourceService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * upload ViDEO
|
|
|
+ * saveRemoteResource
|
|
|
+ * type 0 video , 1 audio
|
|
|
* @param resource
|
|
|
* @return
|
|
|
*/
|
|
@@ -268,8 +269,55 @@ public class ResourceService {
|
|
|
return errResult;
|
|
|
}
|
|
|
|
|
|
- Resource result = apiResult.getData().toNativeResource();
|
|
|
- return APIResult.ok(result);
|
|
|
+ Resource resourceVO = apiResult.getData().toNativeResource();
|
|
|
+ return APIResult.ok(resourceVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * update RemoteResource
|
|
|
+ * @param resource
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public APIResult<Resource> updateRemoteResource(Resource resource) {
|
|
|
+
|
|
|
+ APIResult<ResourceRemote> result = resourceProxy.findById(resource.getId());
|
|
|
+ if (!result.getSuccess()) {
|
|
|
+ log.error("Remote Server Error: code={}, message={}", result.getCode(), result.getMessage());
|
|
|
+ APIResult errResult = APIResult.error(APICode.REMOTE_SERVER_ERROR);
|
|
|
+ result.setMessage(result.getMessage());
|
|
|
+ return errResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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.updateResources(new HashMap<String, Object>(){
|
|
|
+ {
|
|
|
+ this.put("id", resource.getId());
|
|
|
+ this.put("no", resource.getCode());
|
|
|
+ this.put("title", resource.getName());
|
|
|
+ this.put("type", "1");
|
|
|
+ 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 resourceVO = apiResult.getData().toNativeResource();
|
|
|
+ return APIResult.ok(resourceVO);
|
|
|
}
|
|
|
|
|
|
}
|