|
@@ -11,6 +11,7 @@ import cn.rankin.common.utils.exception.UnsupportedOperationException;
|
|
|
import cn.rankin.resourceservice.dto.ResourceDetail;
|
|
|
import cn.rankin.resourceservice.dto.ResourceRemote;
|
|
|
import cn.rankin.data.api.resource.entity.Resource;
|
|
|
+import cn.rankin.resourceservice.dto.ResourceVideo;
|
|
|
import cn.rankin.resourceservice.proxy.RemoteResourceProxy;
|
|
|
import cn.rankin.resourceservice.repository.ResourceRepository;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -19,10 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@@ -243,7 +241,7 @@ public class ResourceService {
|
|
|
*/
|
|
|
public APIResult<Resource> saveRemoteResource(Resource resource) {
|
|
|
|
|
|
- List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
+/* List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
Map<String, Object> video = new HashMap<>();
|
|
|
video.put("bucket","efunbox");
|
|
|
video.put("path",resource.getPath());
|
|
@@ -253,6 +251,7 @@ public class ResourceService {
|
|
|
|
|
|
videos.add(video);
|
|
|
|
|
|
+
|
|
|
APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(new HashMap<String, Object>(){
|
|
|
{
|
|
|
this.put("no", resource.getCode());
|
|
@@ -262,6 +261,33 @@ public class ResourceService {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ */
|
|
|
+
|
|
|
+ Set<ResourceVideo> videos = new HashSet<>();
|
|
|
+ ResourceVideo video = new ResourceVideo();
|
|
|
+ video.setBucket("efunbox");
|
|
|
+ video.setPath(resource.getPath());
|
|
|
+ video.setQuality(resource.getQuality());
|
|
|
+ video.setFormat(resource.getFormat());
|
|
|
+ video.setSize(resource.getSize());
|
|
|
+ videos.add(video);
|
|
|
+
|
|
|
+
|
|
|
+ ResourceRemote resourceRemote = new ResourceRemote();
|
|
|
+ resourceRemote.setNo(resource.getCode());
|
|
|
+ resourceRemote.setTitle(resource.getName());
|
|
|
+ resourceRemote.setType(resource.getType());
|
|
|
+ resourceRemote.setVideos(videos);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(resourceRemote);
|
|
|
+
|
|
|
if (!apiResult.getSuccess()) {
|
|
|
return errorResourceAPIResult(apiResult);
|
|
|
}
|
|
@@ -286,7 +312,7 @@ public class ResourceService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
+/* List<Map<String, Object>> videos = new ArrayList<>();
|
|
|
Map<String, Object> video = new HashMap<>();
|
|
|
video.put("bucket","efunbox");
|
|
|
video.put("path",resource.getPath());
|
|
@@ -304,7 +330,25 @@ public class ResourceService {
|
|
|
this.put("type", "1");
|
|
|
this.put("videos", videos);
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
+
|
|
|
+ Set<ResourceVideo> videos = new HashSet<>();
|
|
|
+ ResourceVideo video = new ResourceVideo();
|
|
|
+ video.setBucket("efunbox");
|
|
|
+ video.setPath(resource.getPath());
|
|
|
+ video.setQuality(resource.getQuality());
|
|
|
+ video.setFormat(resource.getFormat());
|
|
|
+ video.setSize(resource.getSize());
|
|
|
+ videos.add(video);
|
|
|
+
|
|
|
+
|
|
|
+ ResourceRemote resourceRemote = new ResourceRemote();
|
|
|
+ resourceRemote.setNo(resource.getCode());
|
|
|
+ resourceRemote.setTitle(resource.getName());
|
|
|
+ resourceRemote.setType(resource.getType());
|
|
|
+ resourceRemote.setVideos(videos);
|
|
|
+
|
|
|
+ APIResult<ResourceDetail> apiResult = resourceProxy.updateResources(resourceRemote);
|
|
|
|
|
|
if (!apiResult.getSuccess()) {
|
|
|
return errorResourceAPIResult(apiResult);
|