package com.slodon.b2b2c.vo.statistics;

import com.slodon.b2b2c.statistics.pojo.base.GoodsBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

import static com.slodon.b2b2c.vo.statistics.FlowOverviewVO.dealPvSubmitRate;

/**
 *
 * 封装商品动销-商品报表Vo对象
 * @author wuxy
 */
@Data
public class SellerGoodsReportVO {

    @ApiModelProperty("商品id")
    private Long goodsId;

    @ApiModelProperty("商品名称")
    private String goodsName;

    @ApiModelProperty("支付金额")
    private BigDecimal saleAmount;

    @ApiModelProperty("下单金额")
    private BigDecimal orderSubmitAmount;

    @ApiModelProperty("支付订单数")
    private Integer orderPayNum;

    @ApiModelProperty("下单数")
    private Integer orderSubmitNum;

    @ApiModelProperty("访客数")
    private Integer visitorNum;

    @ApiModelProperty("浏览量")
    private Integer viewNum;

    @ApiModelProperty("收藏人数")
    private Integer collectionNum;

    @ApiModelProperty("加购人数")
    private Integer addCartMemberNum;

    @ApiModelProperty("销量")
    private Integer saleNum;

    @ApiModelProperty("访问-下单转化率，下单人数/访客数*100%")
    private String pvSubmitRate;

    @ApiModelProperty("退单数")
    private Integer returnNum;

    @ApiModelProperty("退单金额")
    private BigDecimal returnAmount;

    public SellerGoodsReportVO(GoodsBase goodsBase) {
        this.goodsId = goodsBase.getGoodsId();
        this.goodsName = goodsBase.getGoodsName();
        this.saleAmount = goodsBase.getSaleAmount();
        this.orderSubmitAmount = goodsBase.getOrderSubmitAmount();
        this.orderPayNum = goodsBase.getOrderPayNum();
        this.orderSubmitNum = goodsBase.getOrderSubmitNum();
        this.visitorNum = goodsBase.getVisitorNum();
        this.viewNum = goodsBase.getViewNum();
        this.collectionNum = goodsBase.getCollectionNum();
        this.addCartMemberNum = goodsBase.getAddCartMemberNum();
        this.saleNum = goodsBase.getSaleNum();
        this.pvSubmitRate = dealPvSubmitRate(goodsBase.getOrderSubmitMemberNum(), goodsBase.getVisitorNum());
        this.returnNum = goodsBase.getReturnNum();
        this.returnAmount = goodsBase.getReturnAmount();
    }
}
