package com.slodon.b2b2c.vo.statistics;

import com.slodon.b2b2c.core.util.TimeUtil;
import com.slodon.b2b2c.statistics.pojo.base.StoreBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

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

/**
 *
 * 封装流量分析-近30天变化趋势Vo对象
 * @author wuxy
 */
@Data
public class FlowChangeTrendVO {

    @ApiModelProperty("统计时间")
    private String statsTime;

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

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

    @ApiModelProperty("人均浏览量")
    private BigDecimal perViewNum;

    @ApiModelProperty("商品访客数")
    private Integer goodsVisitorNum;

    @ApiModelProperty("商品浏览量")
    private Integer goodsViewNum;

    @ApiModelProperty("支付人数")
    private Integer orderPayMemberNum;

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

    @ApiModelProperty("访问-支付转化率")
    private String pvPayRate;

    public FlowChangeTrendVO(StoreBase storeBase) {
        this.statsTime = TimeUtil.getZDDay(storeBase.getStatsTime());
        this.visitorNum = storeBase.getVisitorNum();
        this.viewNum = storeBase.getViewNum();
        this.perViewNum = storeBase.getPerViewNum();
        this.goodsVisitorNum = storeBase.getGoodsVisitorNum();
        this.goodsViewNum = storeBase.getGoodsViewNum();
        this.orderPayNum = storeBase.getOrderPayNum();
        this.orderPayMemberNum = storeBase.getOrderPayMemberNum();
        this.pvPayRate = dealPvPayRate(storeBase.getOrderPayMemberNum(), storeBase.getVisitorNum());
    }

}
