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;
}
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);
}
Aggregations