Search in sources :

Example 1 with OrderProductVo

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

the class OmcCartServiceImpl method getOrderCartProduct.

@Override
public OrderProductVo getOrderCartProduct(Long userId) {
    Preconditions.checkArgument(userId != null, ErrorCodeEnum.UAC10011001.msg());
    OrderProductVo orderProductVo = new OrderProductVo();
    List<OmcCart> omcCartList = omcCartMapper.selectCheckedCartByUserId(userId);
    List<OmcOrderDetail> orderItemList = this.getCartOrderItem(userId, omcCartList);
    List<OrderItemVo> orderItemVoList = Lists.newArrayList();
    BigDecimal payment = new BigDecimal("0");
    for (OmcOrderDetail orderItem : orderItemList) {
        payment = BigDecimalUtil.add(payment.doubleValue(), orderItem.getTotalPrice().doubleValue());
        final OptGetUrlRequest request = new OptGetUrlRequest();
        request.setAttachmentId(Long.valueOf(orderItem.getProductImage()));
        request.setEncrypt(true);
        String fileUrl = opcOssService.getFileUrl(request);
        OrderItemVo orderItemVo = assembleOrderItemVo(orderItem);
        orderItemVo.setProductImage(fileUrl);
        orderItemVoList.add(orderItemVo);
    }
    orderProductVo.setProductTotalPrice(payment);
    orderProductVo.setOrderItemVoList(orderItemVoList);
    return orderProductVo;
}
Also used : OptGetUrlRequest(com.paascloud.provider.model.dto.oss.OptGetUrlRequest) OrderProductVo(com.paascloud.provider.model.vo.OrderProductVo) OmcOrderDetail(com.paascloud.provider.model.domain.OmcOrderDetail) OrderItemVo(com.paascloud.provider.model.vo.OrderItemVo) OmcCart(com.paascloud.provider.model.domain.OmcCart) BigDecimal(java.math.BigDecimal)

Example 2 with OrderProductVo

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

the class OmcOrderController method getOrderCartProduct.

/**
 * 获取购物车商品数量.
 *
 * @return the order cart product
 */
@PostMapping("/getOrderCartProduct")
@ApiOperation(httpMethod = "POST", value = "获取购物车商品数量")
public Wrapper getOrderCartProduct() {
    logger.info("getOrderCartProduct - 获取购物车商品数量");
    OrderProductVo orderCartProduct = omcCartService.getOrderCartProduct(getLoginAuthDto().getUserId());
    return WrapMapper.ok(orderCartProduct);
}
Also used : OrderProductVo(com.paascloud.provider.model.vo.OrderProductVo) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

OrderProductVo (com.paascloud.provider.model.vo.OrderProductVo)2 OmcCart (com.paascloud.provider.model.domain.OmcCart)1 OmcOrderDetail (com.paascloud.provider.model.domain.OmcOrderDetail)1 OptGetUrlRequest (com.paascloud.provider.model.dto.oss.OptGetUrlRequest)1 OrderItemVo (com.paascloud.provider.model.vo.OrderItemVo)1 ApiOperation (io.swagger.annotations.ApiOperation)1 BigDecimal (java.math.BigDecimal)1