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

import com.baomidou.mybatisplus.annotation.IdType;
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;

/**
 * @Description: 用户平台广告计划信息
 * @Author: jeecg-boot
 * @Date: 2019-08-23
 * @Version: V1.0
 */
@Data
@TableName("ctop_kuaishou_customer_plan_statistic_info")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_kuaishou_customer_plan_statistic_info对象", description = "用户平台广告计划信息")
public class CustomerPlanStatisticInfo {

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "id")
    private Long id;
    /**
     * 统计时间
     */
    @Excel(name = "统计时间", width = 15)
    @ApiModelProperty(value = "统计时间")
    private String statisticDate;
    /**
     * 结算方
     */
    @Excel(name = "结算方", width = 15)
    @ApiModelProperty(value = "结算方")
    private String settler;
    /**
     * 合同编号
     */
    @Excel(name = "合同编号", width = 15)
    @ApiModelProperty(value = "合同编号")
    private String contractNo;
    /**
     * 账户名称
     */
    @Excel(name = "账户名称", width = 15)
    @ApiModelProperty(value = "账户名称")
    private String accountName;
    /**
     * 三级分类
     */
    @Excel(name = "三级分类", width = 15)
    @ApiModelProperty(value = "三级分类")
    private String thirdCategory;
    /**
     * 渠道
     */
    @Excel(name = "渠道", width = 15)
    @ApiModelProperty(value = "渠道")
    private String channelName;
    /**
     * 渠道id
     */
    @Excel(name = "渠道id", width = 15)
    @ApiModelProperty(value = "渠道id")
    private String channnelId;
    /**
     * 子渠道
     */
    @Excel(name = "子渠道", width = 15)
    @ApiModelProperty(value = "子渠道")
    private String childChannel;
    /**
     * childChannelId
     */
    @Excel(name = "childChannelId", width = 15)
    @ApiModelProperty(value = "childChannelId")
    private String childChannelId;
    /**
     * 活动
     */
    @Excel(name = "活动", width = 15)
    @ApiModelProperty(value = "活动")
    private String action;
    /**
     * 广告内容
     */
    @Excel(name = "广告内容", width = 15)
    @ApiModelProperty(value = "广告内容")
    private String advertiserInfo;
    /**
     * 广告关键字
     */
    @Excel(name = "广告关键字", width = 15)
    @ApiModelProperty(value = "广告关键字")
    private String advertiserKeywords;
    /**
     * 广告组代码
     */
    @Excel(name = "广告组代码", width = 15)
    @ApiModelProperty(value = "广告组代码")
    private String campaignCode;
    /**
     * 注册用户数
     */
    @Excel(name = "注册用户数", width = 15)
    @ApiModelProperty(value = "注册用户数")
    private Integer registAccountNum;
    /**
     * 完件用户
     */
    @Excel(name = "完件用户", width = 15)
    @ApiModelProperty(value = "完件用户")
    private Integer completeUser;
    /**
     * 预估授信人数
     */
    @Excel(name = "预估授信人数", width = 15)
    @ApiModelProperty(value = "预估授信人数")
    private Integer estimatedCreditNumber;
    /**
     * 当日注册且完件数
     */
    @Excel(name = "当日注册且完件数", width = 15)
    @ApiModelProperty(value = "当日注册且完件数")
    private Integer registComplateNumber;
    /**
     * estimatedRegistCreditNumber
     */
    @Excel(name = "estimatedRegistCreditNumber", width = 15)
    @ApiModelProperty(value = "estimatedRegistCreditNumber")
    private Integer estimatedRegistCreditNumber;
    /**
     * createTime
     */
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**
     * updateTime
     */
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;

    public CustomerPlanStatisticInfo(String[] record) {
        String date = record[0];
        this.statisticDate = date;
        String settler = record[1];
        this.settler = settler;
        String contractNo = record[2];
        this.contractNo = contractNo;
        String accountName = record[3];
        this.accountName = accountName;
        String thirdCategory = record[4];
        this.thirdCategory = thirdCategory;
        String channelName = record[5];
        this.channelName = channelName;
        String channelId = record[6];
        this.channnelId = channelId;
        this.childChannel = record[7];
        this.childChannelId = record[8];
        this.action = record[9];
        this.advertiserInfo = record[10];
        String campaignCode = advertiserInfo.replace("xyk-", "").replace("kswj-", "");
        if (null != campaignCode && !"".equals(campaignCode)) {
            if (campaignCode.indexOf("-") >= 0) {
                this.campaignCode = campaignCode.substring(0, campaignCode.indexOf("-"));
            } else {
                this.campaignCode = campaignCode;
            }
        } else {
            this.campaignCode = "";
        }
        this.advertiserKeywords = record[11];
        this.registAccountNum = Integer.parseInt(record[12]);
        this.completeUser = Integer.parseInt(record[13]);
        this.estimatedCreditNumber = Integer.parseInt(record[14]);
		this.registComplateNumber = Integer.parseInt(record[15]);
		this.estimatedRegistCreditNumber = Integer.parseInt(record[16]);
		this.createTime = new Date();
		this.updateTime = new Date();
	}

	public CustomerPlanStatisticInfo() {
	}
}
