package cn.com.ctop.toutiao.modules.report.entity;

import cn.com.ctop.common.module.entity.CtopOauthToken;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.util.Date;

/**
 * 账号日流水信息
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2020-04-08
 */
@Data
@TableName("ctop_bytedance_fund_daily")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_bytedance_fund_daily对象", description = "账号日流水信息")
public class BytedanceFundDaily {

    /**
     * id
     */
    @TableId
    @ApiModelProperty(value = "id")
    private String id;
    /**
     * 广告主id
     */
    @Excel(name = "广告主id", width = 15)
    @ApiModelProperty(value = "广告主id")
    private Long advertiserId;
    /**
     * 日期
     */
    @Excel(name = "日期", width = 15)
    @ApiModelProperty(value = "日期")
    private String date;
    /**
     * 日终结于
     */
    @Excel(name = "日终结余", width = 15)
    @ApiModelProperty(value = "日终结于")
    private java.math.BigDecimal balance;
    /**
     * 现金支出
     */
    @Excel(name = "现金支出", width = 15)
    @ApiModelProperty(value = "现金支出")
    private java.math.BigDecimal cashCost;
    /**
     * 总支出
     */
    @Excel(name = "总支出", width = 15)
    @ApiModelProperty(value = "总支出")
    private java.math.BigDecimal cost;
    /**
     * 冻结
     */
    @Excel(name = "冻结", width = 15)
    @ApiModelProperty(value = "冻结")
    private java.math.BigDecimal frozen;
    /**
     * 总存入
     */
    @Excel(name = "总存入", width = 15)
    @ApiModelProperty(value = "总存入")
    private java.math.BigDecimal income;
    /**
     * 赠款支出
     */
    @Excel(name = "赠款支出", width = 15)
    @ApiModelProperty(value = "赠款支出")
    private java.math.BigDecimal rewardCost;
    /**
     * 返货支出
     */
    @Excel(name = "返货支出", width = 15)
    @ApiModelProperty(value = "返货支出")
    private java.math.BigDecimal returnGoodsCos;
    /**
     * 总转入
     */
    @Excel(name = "总转入", width = 15)
    @ApiModelProperty(value = "总转入")
    private java.math.BigDecimal transferIn;
    /**
     * 总转出
     */
    @Excel(name = "总转出", width = 15)
    @ApiModelProperty(value = "总转出")
    private java.math.BigDecimal transferOut;
    /**
     * createTime
     */
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**
     * updateTime
     */
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;

    public BytedanceFundDaily(JSONObject data, CtopOauthToken token) {
        this.advertiserId = token.getAccountId();
        this.date = data.getString("date");
        this.id = this.advertiserId + "_" + this.date;
        this.balance = data.getBigDecimal("balance");
        this.cashCost = data.getBigDecimal("cash_cost");
        this.cost = data.getBigDecimal("cost");
        this.frozen = data.getBigDecimal("frozen");
        this.income = data.getBigDecimal("income");
        this.rewardCost = data.getBigDecimal("reward_cost");
        this.returnGoodsCos = data.getBigDecimal("return_goods_cost");
        this.transferIn = data.getBigDecimal("transfer_in");
        this.transferOut = data.getBigDecimal("transfer_out");
        this.createTime = new Date();
        this.updateTime = new Date();
    }

    public BytedanceFundDaily() {
        this.createTime = new Date();
        this.updateTime = new Date();
    }
}
