|
@@ -304,53 +304,13 @@ public class ResourceService {
|
|
*/
|
|
*/
|
|
public APIResult<Resource> updateRemoteResource(Resource resource) {
|
|
public APIResult<Resource> updateRemoteResource(Resource resource) {
|
|
|
|
|
|
- APIResult<ResourceRemote> result = resourceProxy.findById(resource.getId());
|
|
|
|
- log.info("Remote Server info: code={}, message={},data={}", result.getCode(), result.getMessage(),result.getData());
|
|
|
|
- if (!result.getSuccess()) {
|
|
|
|
- log.error("Remote Server Error: code={}, message={}", result.getCode(), result.getMessage());
|
|
|
|
- APIResult errResult = APIResult.error(APICode.REMOTE_SERVER_ERROR);
|
|
|
|
- errResult.setMessage(result.getMessage());
|
|
|
|
- return errResult;
|
|
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isEmpty(resource.getId())) {
|
|
|
|
+ return APIResult.error(APICode.PARAMETER_ERROR);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-/* List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
|
- Map<String, Object> video = new HashMap<>();
|
|
|
|
- video.put("bucket","efunbox");
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
- });*/
|
|
|
|
-
|
|
|
|
- Set<ResourceVideo> videos = result.getData().getVideos();
|
|
|
|
- if(videos != null && videos.size() > 0){
|
|
|
|
- Iterator<ResourceVideo> iterator = videos.iterator();
|
|
|
|
- while(iterator.hasNext()){
|
|
|
|
- ResourceVideo video = iterator.next();
|
|
|
|
- video.setBucket("efunbox");
|
|
|
|
- video.setPath(resource.getPath());
|
|
|
|
- video.setQuality(resource.getQuality());
|
|
|
|
- video.setFormat(resource.getFormat());
|
|
|
|
- video.setSize(resource.getSize());
|
|
|
|
- log.info("Remote Server info: video={}, message={},data={}", video);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-/* Set<ResourceVideo> videos = new HashSet<>();
|
|
|
|
|
|
+ Set<ResourceVideo> videos = new HashSet<>();
|
|
ResourceVideo video = new ResourceVideo();
|
|
ResourceVideo video = new ResourceVideo();
|
|
|
|
+ video.setId(resource.getId());
|
|
video.setBucket("efunbox");
|
|
video.setBucket("efunbox");
|
|
video.setPath(resource.getPath());
|
|
video.setPath(resource.getPath());
|
|
video.setQuality(resource.getQuality());
|
|
video.setQuality(resource.getQuality());
|
|
@@ -360,18 +320,18 @@ public class ResourceService {
|
|
|
|
|
|
|
|
|
|
ResourceRemote resourceRemote = new ResourceRemote();
|
|
ResourceRemote resourceRemote = new ResourceRemote();
|
|
|
|
+ resourceRemote.setId(resource.getId());
|
|
resourceRemote.setNo(resource.getCode());
|
|
resourceRemote.setNo(resource.getCode());
|
|
resourceRemote.setTitle(resource.getName());
|
|
resourceRemote.setTitle(resource.getName());
|
|
resourceRemote.setType(resource.getType());
|
|
resourceRemote.setType(resource.getType());
|
|
resourceRemote.setVideos(videos);
|
|
resourceRemote.setVideos(videos);
|
|
|
|
|
|
APIResult<ResourceDetail> apiResult = resourceProxy.updateResources(resourceRemote);
|
|
APIResult<ResourceDetail> apiResult = resourceProxy.updateResources(resourceRemote);
|
|
- log.info("updateResources: "+apiResult);
|
|
|
|
if (!apiResult.getSuccess()) {
|
|
if (!apiResult.getSuccess()) {
|
|
return errorResourceAPIResult(apiResult);
|
|
return errorResourceAPIResult(apiResult);
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-// Resource resourceVO = apiResult.getData().toNativeResource();
|
|
|
|
|
|
+ log.info("Remote Server info: code={}, message={},data={}", apiResult.getCode(), apiResult.getMessage(),apiResult.getData());
|
|
return APIResult.ok();
|
|
return APIResult.ok();
|
|
}
|
|
}
|
|
|
|
|