4 コミット 4f2db3edf5 ... 33f4ed14cc

作者 SHA1 メッセージ 日付
  xuchaolang 33f4ed14cc cms-web-api, /resource PUT, id pass in body 6 年 前
  xuchaolang 42d7a7fde9 web-api, /package/<pid>, return goods 6 年 前
  xuchaolang 80337f7aee Merge branch 'master' of http://gogs.efunbox.cn:3000/Rankin/rankin 6 年 前
  xuchaolang e0359d50e8 Accomplish /user/messages/productExpiredAlert, /package/<pid> 6 年 前

+ 61 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/PackageController.java

@@ -0,0 +1,61 @@
+package cn.rankin.apiweb.controller;
+
+import cn.rankin.apiweb.assist.resolver.NeedUser;
+import cn.rankin.apiweb.service.product.ProductClient;
+import cn.rankin.apiweb.service.product.ProductService;
+import cn.rankin.common.utils.api.model.APIResult;
+import cn.rankin.data.api.app.vo.DeviceUserVo;
+import cn.rankin.data.api.product.entity.Product;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+@RestController
+@RequestMapping(value="/package")
+@Slf4j
+public class PackageController {
+
+    @Autowired
+    private ProductService productService;
+
+    @Autowired
+    private ProductClient productClient;
+
+    @RequestMapping(value = "/{pid}")
+    public APIResult getPackage(@NeedUser DeviceUserVo user, @PathVariable("pid") String pid){
+
+        String uid = user.getUid();
+        String merchantId = user.getMerchantId();
+
+        //get merchant product, with goods field
+        Product product = productClient.getProduct(merchantId, pid);
+
+        //get package, with children field
+        Product pkg = productClient.getPackage(pid);
+
+        if (null == product || null == pkg){
+            log.error("No Package Found, pid={}, merchantId={}", pid, merchantId);
+            return APIResult.ok(new HashMap<>());
+        }
+
+        pkg.setGoods(product.getGoods());
+
+        Map<String, Object> data = new HashMap<>();
+
+        data.put("id", pkg.getPid());
+        data.put("name", pkg.getName());
+        data.put("code", pkg.getCode());
+        data.put("type", pkg.getType());
+        data.put("goods",product.getGoods());
+        data.put("totalNum", Optional.ofNullable(pkg.getChildrens()).map(v->v.size()).orElse(0));
+        data.put("recs", pkg.getChildrens());
+
+        return APIResult.ok(data);
+    }
+}

+ 17 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/ProductController.java

@@ -35,6 +35,22 @@ public class ProductController {
         //get Pkg
         List<Product> packages = productClient.getRelatedPackages(pid, merchantId, 0L, 10, "id", Sort.Direction.ASC);
 
+        if(null == packages){
+            packages = new ArrayList<>();
+        }
+
+        //if no package, self is a package
+        /*
+        if (packages.isEmpty()){
+            log.info("No RelatedPackage Found, Use Product itself, pid={}", pid);
+            Product targetProduct = productClient.getProduct(merchantId, pid);
+
+            if(null != targetProduct){
+                packages.add(targetProduct);
+            }
+        }
+        */
+
         //get each product in Pkg
         List<Map<String, Object>> recs = new ArrayList<>();
 
@@ -73,6 +89,7 @@ public class ProductController {
             recs.add(rec);
         }
 
+
         Map<String, Object> data = new HashMap<>();
 
         data.put("totalNum", recs.size());

+ 46 - 5
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/UserController.java

@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @RestController
 @RequestMapping(value = "/user")
@@ -56,7 +53,7 @@ public class UserController {
             products = new ArrayList<>();
         }
 
-        log.error("Valid-Product-Get-From-Service, product={}, len={}", products, products.size());
+        log.error("Valid Product Get From Service, product={}, len={}", products, products.size());
 
         List<Map<String, Object> > recs = new ArrayList<>();
 
@@ -77,4 +74,48 @@ public class UserController {
         return APIResult.ok(data);
     }
 
+    @RequestMapping(value="/messages/productExpiredAlert", method = RequestMethod.GET)
+    public APIResult getMessagesProductExpired(@NeedUser DeviceUserVo user){
+
+        String uid = user.getUid();
+
+        //get Valid Product
+        List<Map<String, Object>> validItems =  userService.getProductValid(uid);
+
+        List<Map<String, Object> > recs = new ArrayList<>();
+
+        Long now = new Date().getTime();
+
+        // Five Days
+        Long remindTime = 5*24*3600*1000L;
+
+        for(Map<String, Object> item : validItems){
+
+            Long endTime = (Long) item.get("endTime");
+
+            if (null == endTime){
+                log.error("Illegal Product endTime, endTime=null");
+                continue;
+            }
+
+            if (endTime  > now + remindTime){
+               continue;
+            }
+
+            Map<String, Object> rec = new HashMap<>();
+            rec.put("id", item.get("pid"));
+            rec.put("title", item.get("name"));
+            rec.put("beginTime", item.get("beginTime"));
+            rec.put("endTime", item.get("endTime"));
+            rec.put("type", item.get("type"));
+            recs.add(rec);
+        }
+
+        Map<String, Object> data = new HashMap<>();
+        data.put("totalNum", recs.size());
+        data.put("recs", recs);
+
+        return APIResult.ok(data);
+    }
+
 }

+ 10 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/service/product/ProductClient.java

@@ -76,6 +76,10 @@ public interface ProductClient {
     @RequestMapping(value = "/package/{pid}", method = RequestMethod.GET)
     Product getPackage(@PathVariable("pid") String pid);
 
+    @RequestMapping(value = "/merchant/{merchantId}/product/{pid}", method = RequestMethod.GET)
+    Product getProduct(@PathVariable("merchantId") String merchantId, @PathVariable("pid") String pid);
+
+
 
     @Component
     class ProductClientHystrix implements ProductClient {
@@ -163,5 +167,11 @@ public interface ProductClient {
             return null;
         }
 
+
+        @Override
+        public Product getProduct(String merchantId, String pid) {
+            return null;
+        }
+
     }
 }

+ 15 - 4
rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/resource/ResourceController.java

@@ -1,17 +1,23 @@
 package cn.rankin.cmsweb.controller.resource;
 
+import cn.rankin.cmsweb.code.CmsWebAPICode;
 import cn.rankin.cmsweb.service.resource.ResourceService;
 import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
-import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
 import cn.rankin.common.utils.dto.resource.ResourceDTO;
+import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
 import cn.rankin.common.utils.util.BeanUtil;
 import cn.rankin.common.utils.vo.resource.ResourceVo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
 @RestController
 @RequestMapping(value = "/resource")
+@Slf4j
 public class ResourceController {
 
     @Autowired
@@ -27,8 +33,13 @@ public class ResourceController {
         return resourceService.create(resourceDTO);
     }
 
-    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
-    public APIResult<ResourceVo> create(@PathVariable("id") String id, @RequestBody ResourceDTO resourceDTO) {
+    @RequestMapping(method = RequestMethod.PUT)
+    public APIResult<ResourceVo> update(@RequestBody ResourceDTO resourceDTO) {
+        String id = resourceDTO.getId();
+        if (null == id || id.isEmpty()){
+            log.error("id Is Null");
+            return APIResult.error(CmsWebAPICode.PARAMETER_ERROR);
+        }
         return resourceService.update(id,resourceDTO);
     }
 }

+ 45 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/controller/MerchantController.java

@@ -1,8 +1,15 @@
 package cn.rankin.productservice.controller;
 
 import cn.rankin.common.utils.enums.BaseStatusEnum;
+import cn.rankin.data.api.product.entity.Goods;
+import cn.rankin.data.api.product.entity.MerchantProduct;
 import cn.rankin.data.api.product.entity.Poster;
+import cn.rankin.data.api.product.entity.Product;
+import cn.rankin.productservice.repository.GoodsRepository;
+import cn.rankin.productservice.repository.MerchantProductRepository;
 import cn.rankin.productservice.repository.PosterRepository;
+import cn.rankin.productservice.repository.ProductRepository;
+import cn.rankin.productservice.service.ProductService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort;
@@ -19,6 +26,18 @@ public class MerchantController {
     @Autowired
     private PosterRepository posterRepo;
 
+    @Autowired
+    private ProductService productService;
+
+    @Autowired
+    private ProductRepository productRepository;
+
+    @Autowired
+    private MerchantProductRepository merchantProductRepository;
+
+    @Autowired
+    private GoodsRepository goodsRepository;
+
     @RequestMapping(value = "/{merchantId}/posters", method = RequestMethod.GET)
     public List<Poster> getPosters(@PathVariable("merchantId") String merchantId, @RequestParam("start") Long start,
                                          @RequestParam("offset") Integer offset, @RequestParam("sortKey") String sortKey,
@@ -38,5 +57,31 @@ public class MerchantController {
         log.info("Find Posters, len={}, merchantId={}", posters.size(), merchantId);
         return posters;
     }
+
+    @RequestMapping(value = "/{merchantId}/product/{pid}", method = RequestMethod.GET)
+    public Product getProduct(@PathVariable("merchantId") String merchantId, @PathVariable("pid") String pid){
+
+        //check merchant
+        MerchantProduct merchantProduct =  merchantProductRepository.findByPidAndMerchantId(pid, merchantId);
+
+        if (null == merchantProduct){
+            log.error("Cannot Find Merchant Product By pid, pid={}, merchantId={}", pid, merchantId);
+            return null;
+        }
+
+        Product product = productRepository.findByPid(pid);
+
+        if (null == product){
+            log.error("Cannot Find Product By pid, pid={}", pid);
+            return null;
+        }
+
+        //get goods
+        List<Goods> goods = goodsRepository.findByPidAndMerchantId(pid, merchantId);
+
+        product.setGoods(goods);
+
+        return product;
+    }
 }
 

+ 5 - 4
rankin-product-service/src/main/java/cn/rankin/productservice/controller/PackageController.java

@@ -19,6 +19,11 @@ public class PackageController {
     @Autowired
     private GoodsRepository goodsRepository;
 
+    /**
+     * Get plain package info, with childrens field
+     * @param pid
+     * @return Package
+     */
     @RequestMapping(value = "/{pid}", method = RequestMethod.GET)
     public Product getPackage(@PathVariable("pid") String pid) {
 
@@ -33,10 +38,6 @@ public class PackageController {
             return null;
         }
 
-        //List<Goods> goods = goodsRepository.findByPidAndMerchantId(pid, merchantId);
-
-        //pkg.setGoods(goods);
-
         return pkg;
     }
 }

+ 11 - 2
rankin-product-service/src/main/java/cn/rankin/productservice/controller/ProductController.java

@@ -63,7 +63,7 @@ public class ProductController {
 
     @RequestMapping(value = "/{productId}", method = RequestMethod.GET)
     public APIResult getProduct2(@PathVariable("productId") String productId) {
-        Map<String, Object> product = productService.getProduct(productId);
+        Map<String, Object> product = productService.getProductDict(productId);
         if(null == product){
             return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
         } else{
@@ -128,7 +128,16 @@ public class ProductController {
         return productService.findByPids(pidList);
     }
 
-
+    /**
+     *
+     * @param pid
+     * @param merchantId
+     * @param start
+     * @param offset
+     * @param sortKey
+     * @param direction
+     * @return
+     */
     @RequestMapping(value = "/{pid}/relatedPkg", method = RequestMethod.GET)
     public List<Product> getRelatedPkg(@PathVariable("pid") String pid, @RequestParam("merchantId") String merchantId, @RequestParam("start") Long start,
                                        @RequestParam("offset") Integer offset, @RequestParam("sortKey") String sortKey,

+ 2 - 2
rankin-product-service/src/main/java/cn/rankin/productservice/service/MerchantProductService.java

@@ -133,7 +133,7 @@ public class MerchantProductService {
         for (MerchantProduct product : merchantProductList) {
             String productId = product.getPid();
 
-            Map<String, Object> productMap = productService.getProduct(productId);
+            Map<String, Object> productMap = productService.getProductDict(productId);
             product.setName(String.valueOf(productMap.get("name")));
 
             String merchantId = product.getMerchantId();
@@ -310,7 +310,7 @@ public class MerchantProductService {
             String productId = merchantProduct.getPid();
             List<Goods> tmp = goodsMap.get(productId);
 
-            Map<String, Object> product = productService.getProduct(productId);
+            Map<String, Object> product = productService.getProductDict(productId);
             merchantProduct.setName(String.valueOf(product.get("name")));
 
             merchantProduct.setGoods(tmp);

+ 11 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/service/ProductService.java

@@ -94,7 +94,8 @@ public class ProductService {
         return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
     }
 
-    public Map<String, Object> getProduct(String productId) {
+
+    public Map<String, Object> getProductDict(String productId) {
         Map<String, Object> result = new HashMap<>();
 
 
@@ -184,6 +185,15 @@ public class ProductService {
         return pkgs;
     }
 
+    /**
+     *
+     * @param pid
+     * @return
+     */
+    public Product getProduct(String pid){
+        return productRepository.findByPid(pid);
+    }
+
 
     @Transactional
     public APIResult delete(String productId) {

+ 14 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java

@@ -193,6 +193,20 @@ public class TagService {
     @Transactional
     public void sortTag(String groupId, List<String> tagIdList) {
         List<Tag> tagList = tagRepository.findByGroupId(groupId);
+        sortTag(tagIdList, tagList);
+        tagRepository.update(tagList);
+    }
+
+
+
+    @Transactional
+    public void sortTagByTypeCode(String typeCode, List<String> tagIdList) {
+        List<Tag> tagList = tagRepository.findByTypeCode(typeCode);
+        sortTag(tagIdList, tagList);
+        tagRepository.update(tagList);
+    }
+
+    private void sortTag(List<String> tagIdList, List<Tag> tagList) {
         for (Tag tag : tagList) {
             String tagId = tag.getId();
             if (!tagIdList.contains(tagId)) {
@@ -202,6 +216,5 @@ public class TagService {
             Integer index = tagIdList.indexOf(tagId);
             tag.setSort(index);
         }
-        tagRepository.update(tagList);
     }
 }

+ 2 - 2
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagTypeService.java

@@ -64,14 +64,14 @@ public class TagTypeService {
 
     @Transactional
     public TagType update(TagTypeDTO tagTypeDTO) {
-        String groupId = tagTypeDTO.getId();
+        String typeCode = tagTypeDTO.getCode();
         TagType tagType = convert(tagTypeDTO);
         // 更新标签组
         TagType result = tagTypeRepository.update(tagType);
         // 给组内的标签排序
         List<String> tagIdList = tagTypeDTO.getTagList();
         if (!CollectionUtils.isEmpty(tagIdList)) {
-            tagService.sortTag(groupId, tagIdList);
+            tagService.sortTagByTypeCode(typeCode, tagIdList);
         }
         return result;
     }

+ 3 - 6
rankin-resource-service/src/main/java/cn/rankin/resourceservice/proxy/RemoteResourceProxy.java

@@ -5,10 +5,7 @@ import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.resourceservice.dto.ResourceDetail;
 import cn.rankin.resourceservice.dto.ResourceRemote;
 import org.springframework.cloud.netflix.feign.FeignClient;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
@@ -32,9 +29,9 @@ public interface RemoteResourceProxy {
     APIResult<List<ResourceDetail>> getBatch(@RequestParam("ids") List<String> ids);
 
     @RequestMapping(value = "/rcenter/v1/resources/mgt", method = RequestMethod.POST)
-    APIResult<ResourceDetail> saveResources(@RequestParam Map<String, Object> map);
+    APIResult<ResourceDetail> saveResources(@RequestBody ResourceRemote resourceRemote);
 
     @RequestMapping(value = "/rcenter/v1/resources/mgt", method = RequestMethod.PUT)
-    APIResult<ResourceDetail> updateResources(@RequestParam Map<String, Object> map);
+    APIResult<ResourceDetail> updateResources(@RequestBody ResourceRemote resourceRemote);
 
 }

+ 85 - 23
rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/ResourceService.java

@@ -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,9 +241,9 @@ 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","");
+        video.put("bucket","efunbox");
         video.put("path",resource.getPath());
         video.put("format",resource.getFormat());
         video.put("quality",resource.getQuality());
@@ -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,15 +261,40 @@ 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);
+        log.info("saveResources: "+apiResult);
+        log.info("Remote Server return: code={}, message={}", apiResult.getCode(), apiResult.getMessage());
         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;
+            return errorResourceAPIResult(apiResult);
         }
 
-        Resource resourceVO = apiResult.getData().toNativeResource();
-        return APIResult.ok(resourceVO);
+//        Resource resourceVO = apiResult.getData().toNativeResource();
+        return APIResult.ok();
     }
 
     /**
@@ -281,17 +305,18 @@ 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);
-            result.setMessage(result.getMessage());
+            errResult.setMessage(result.getMessage());
             return errResult;
         }
 
 
-        List<Map<String, Object>> videos = new ArrayList<>();
+/*        List<Map<String, Object>> videos = new ArrayList<>();
         Map<String, Object> video = new HashMap<>();
-        video.put("bucket","");
+        video.put("bucket","efunbox");
         video.put("path",resource.getPath());
         video.put("format",resource.getFormat());
         video.put("quality",resource.getQuality());
@@ -307,17 +332,54 @@ public class ResourceService {
                 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<>();
+        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);
+        log.info("updateResources: "+apiResult);
         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;
-        }
+            return errorResourceAPIResult(apiResult);
+        }*/
+
+//        Resource resourceVO = apiResult.getData().toNativeResource();
+        return APIResult.ok();
+    }
 
-        Resource resourceVO = apiResult.getData().toNativeResource();
-        return APIResult.ok(resourceVO);
+    private APIResult<Resource> errorResourceAPIResult(APIResult<ResourceDetail> apiResult) {
+        log.error("Remote Server Error: code={}, message={}", apiResult.getCode(), apiResult.getMessage());
+        APIResult errResult = APIResult.error(APICode.REMOTE_SERVER_ERROR);
+        errResult.setMessage(apiResult.getMessage());
+        return errResult;
     }
 
 }