Search in sources :

Example 1 with ProductDetailVo

use of com.paascloud.provider.model.vo.ProductDetailVo in project paascloud-master by paascloud.

the class MdcProductServiceImpl method assembleProductDetailVo.

private ProductDetailVo assembleProductDetailVo(MdcProduct product) {
    ProductDetailVo productDetailVo = new ProductDetailVo();
    String mainImage = product.getMainImage();
    String subImages = product.getSubImages();
    if (StringUtils.isNotEmpty(mainImage)) {
        // 图片查询
        OptGetUrlRequest request = new OptGetUrlRequest();
        request.setAttachmentId(Long.valueOf(mainImage));
        request.setEncrypt(true);
        String url = opcRpcService.getFileUrl(request);
        productDetailVo.setMainImage(url);
    }
    if (StringUtils.isNotEmpty(subImages)) {
        List<String> urlList = Lists.newArrayList();
        List<String> subImageList = Splitter.on(GlobalConstant.Symbol.COMMA).trimResults().splitToList(subImages);
        for (final String subImage : subImageList) {
            OptGetUrlRequest request = new OptGetUrlRequest();
            request.setAttachmentId(Long.valueOf(subImage));
            request.setEncrypt(true);
            String url = opcRpcService.getFileUrl(request);
            urlList.add(url);
        }
        productDetailVo.setSubImages(Joiner.on(GlobalConstant.Symbol.COMMA).join(urlList));
    }
    productDetailVo.setId(product.getId());
    productDetailVo.setSubtitle(product.getSubtitle());
    productDetailVo.setPrice(product.getPrice());
    productDetailVo.setDetail(product.getDetail());
    productDetailVo.setName(product.getName());
    productDetailVo.setStatus(product.getStatus());
    productDetailVo.setStock(product.getStock());
    productDetailVo.setImageHost("");
    MdcProductCategory category = mdcProductCategoryService.getByCategoryId(product.getId());
    if (category == null) {
        // 默认根节点
        productDetailVo.setPid(0L);
    } else {
        productDetailVo.setPid(category.getPid());
    }
    return productDetailVo;
}
Also used : OptGetUrlRequest(com.paascloud.provider.model.dto.oss.OptGetUrlRequest) MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory) ProductDetailVo(com.paascloud.provider.model.vo.ProductDetailVo)

Example 2 with ProductDetailVo

use of com.paascloud.provider.model.vo.ProductDetailVo in project paascloud-master by paascloud.

the class MdcProductQueryFeignClient method getProductDetail.

@Override
@ApiOperation(httpMethod = "POST", value = "根据商品ID查询商品详细信息")
public Wrapper<ProductDetailVo> getProductDetail(@PathVariable("productId") Long productId) {
    logger.info("根据商品ID查询商品详细信息. productId={}", productId);
    ProductDetailVo productDto = mdcProductService.getProductDetail(productId);
    return WrapMapper.wrap(Wrapper.SUCCESS_CODE, Wrapper.SUCCESS_MESSAGE, productDto);
}
Also used : ProductDetailVo(com.paascloud.provider.model.vo.ProductDetailVo) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ProductDetailVo (com.paascloud.provider.model.vo.ProductDetailVo)2 MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)1 OptGetUrlRequest (com.paascloud.provider.model.dto.oss.OptGetUrlRequest)1 ApiOperation (io.swagger.annotations.ApiOperation)1