Bläddra i källkod

fix updateRemoteResource

guozhaoshun 6 år sedan
förälder
incheckning
5ea2d836af

+ 19 - 2
rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/ResourceService.java

@@ -288,6 +288,7 @@ public class ResourceService {
 
         APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(resourceRemote);
         log.info("saveResources: "+apiResult);
+        log.error("Remote Server return: code={}, message={}", apiResult.getCode(), apiResult.getMessage());
         if (!apiResult.getSuccess()) {
             return errorResourceAPIResult(apiResult);
         }
@@ -304,6 +305,7 @@ public class ResourceService {
     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);
@@ -332,7 +334,22 @@ public class ResourceService {
             }
         });*/
 
-        Set<ResourceVideo> videos = new HashSet<>();
+        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<>();
         ResourceVideo video = new ResourceVideo();
         video.setBucket("efunbox");
         video.setPath(resource.getPath());
@@ -352,7 +369,7 @@ public class ResourceService {
         log.info("updateResources: "+apiResult);
         if (!apiResult.getSuccess()) {
             return errorResourceAPIResult(apiResult);
-        }
+        }*/
 
 //        Resource resourceVO = apiResult.getData().toNativeResource();
         return APIResult.ok();