package com.xxl.job.executor.report.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxl.job.executor.common.entity.CtopOauthToken;
import lombok.Data;

import java.util.Date;

/**
 * 账号日流水信息
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2020-04-08
 */
@Data
@TableName("ctop_bytedance_fund_daily")
public class BytedanceFundDaily {

    /**
     * id
     */
    @TableId
    private String id;
    /**
     * 广告主id
     */
    private Long advertiserId;
    /**
     * 日期
     */
    private String date;
    /**
     * 日终结于
     */
    private java.math.BigDecimal balance;
    /**
     * 现金支出
     */
    private java.math.BigDecimal cashCost;
    /**
     * 总支出
     */
    private java.math.BigDecimal cost;
    /**
     * 冻结
     */
    private java.math.BigDecimal frozen;
    /**
     * 总存入
     */
    private java.math.BigDecimal income;
    /**
     * 赠款支出
     */
    private java.math.BigDecimal rewardCost;
    /**
     * 返货支出
     */
    private java.math.BigDecimal returnGoodsCos;
    /**
     * 总转入
     */
    private java.math.BigDecimal transferIn;
    /**
     * 总转出
     */
    private java.math.BigDecimal transferOut;
    /**
     * createTime
     */
    private Date createTime;
    /**
     * 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();
    }
}
