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

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxl.job.executor.utils.DateUtils;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 素材报表
 * @author jeecg-boot
 * @date   2020-04-16
 * @version V1.0
 */
@Data
@TableName("ctop_bytedance_report_material_daily")
public class BytedanceReportMaterialDaily {

	/**id*/
	@TableId(type = IdType.AUTO)

	private Long id;
	/**广告主id*/
	private Long accountId;
	/**数据起始时间1*/

	private String statDatetime;

    /**点击量1*/

	private Integer click;
	/**总花费1*/

    private BigDecimal cost;
	/**应用下载-激活1*/

	private Integer active;
	/**应用下载-安卓下载完成1*/

	private Integer downloadFinish;
	/**应用下载-安卓下载开始1*/

	private Integer downloadStart;
	/**应用下载-安卓安装完成*/

	private Integer installFinish;
	/**应用下载-注册1*/

	private Integer register;
	/**应用下载-付费数1*/

	private Integer payCount;
	/**应用下载-到达uv1*/
	private Integer inAppUv;
	/**应用下载-详情页到站uv1*/
	private Integer inAppDetailUv;
	/**应用下载-加入购物车1*/

	private Integer inAppCart;
	/**应用下载-提交订单1*/

	private Integer inAppOrder;
	/**应用下载-付费1*/

	private Integer inAppPay;
	/**落地页-电话拨打数1*/

	private Integer phone;
	/**表单提交数1*/

	private Integer form;
	/**落地页-地图搜索1*/

	private Integer mapSearch;
	/**落地页-按钮button1*/
	private Integer button;
	/**落地页-关键页面浏览1*/

	private Integer viewMaterial;
	/**落地页-QQ咨询数1*/
	private Integer qq;
	/**落地页-抽奖数1*/

	private Integer lottery;
	/**落地页-投票1*/

	private Integer vote;
	/**落地页-页面跳转1*/

	private Integer redirect;
	/**落地页-商品购买1*/

	private Integer shopping;
	/**落地页-在线咨询1*/

	private Integer consult;
	/**落地页-微信1*/

	private Integer wechat;
	/**落地页-智能电话确认拨打1*/

	private Integer phoneConfirm;
	/**落地页-智能电话确认接通1*/

	private Integer phoneConnect;
	/**落地页-智能电话有效咨询1*/

	private Integer consultEffective;
	/**视频-总播放1*/

	private Integer totalPlay;
	/**视频-有效播放1*/

	private Integer validPlay;
	/**视频-wifi播放1*/
	private Integer wifiPlay;
	/**视频-播放时长，单位ms1*/
	private Integer playDurationSum;
	/**视频-播放25%进度总数1*/

	private Integer play25FeedBreak;
	/**视频-播放50%进度总数1*/

	private Integer play50FeedBreak;
	/**视频-播放75%进度总数*/

	private Integer play75FeedBreak;
	/**视频-播放100%进度总数1*/

	private Integer play100FeedBreak;
	/**附加创意-电话按钮1*/

	private Integer advancedCreativePhoneClick;
	/**附加创意-在线咨询1*/

	private Integer advancedCreativeCounselClick;
	/**附加创意-表单提交1*/

	private Integer advancedCreativeFormClick;
	/**互动数据-分享数1*/

	private Integer shareMaterial;
	/**互动数据-评论数1*/

	private Integer commentMaterial;
	/**互动数据-关注数1*/

	private Integer follow;
	/**互动数据-主页访问量1*/

	private Integer homeVisited;
	/**互动数据-挑战赛查看数1*/

	private Integer iesChallengeClick;
	/**互动数据-音乐查看数1*/

	private Integer iesMusicClick;
	/**次留数1*/

	private Integer nextDayOpen;
	/**次留率1*/

    private BigDecimal nextDayOpenRate;
	/**次留成本*/

    private BigDecimal nextDayOpenCost;
	/**素材类型*/

	private String imageMode;
	/**素材id*/
	private Long materialId;
	/**投放位置*/

	private String inventory;
	/**activePayAmount*/

	private Integer activePayAmount;
	/**validPlayCost*/

    private BigDecimal validPlayCost;
	/**advancedCreativeCouponAddition*/

	private Integer advancedCreativeCouponAddition;
	/**convert*/

	private Integer convertMaterial;
	/**activePayCost*/

    private BigDecimal activePayCost;
	/**download*/

	private Integer download;
	/**cpa*/

    private BigDecimal cpa;
	/**cpc*/

    private BigDecimal cpc;
	/**locationClick*/

	private Integer locationClick;
	/**playOverRate*/

    private BigDecimal playOverRate;
	/**ctr*/

    private BigDecimal ctr;
	/**cpm*/

    private BigDecimal cpm;
	/**wifiPlayRate*/

    private BigDecimal wifiPlayRate;
	/**like*/

	private Integer likeMaterial;
	/**activePayRate*/

    private BigDecimal activePayRate;
	/**activeCost*/

    private BigDecimal activeCost;
	/**gameAddictionCost*/

    private BigDecimal gameAddictionCost;
	/**gameAddiction*/

	private Integer gameAddiction;
	/**activeRate*/

    private BigDecimal activeRate;
	/**playDuration10s*/

	private Integer playDuration_10s;
	/**phoneEffective*/

	private Integer phoneEffective;
	/**gameAddictionRate*/

    private BigDecimal gameAddictionRate;
	/**activeRegisterRate*/

    private BigDecimal activeRegisterRate;
	/**averageVideoPlay*/

    private BigDecimal averageVideoPlay;
	/**downloadFinishCost*/

    private BigDecimal downloadFinishCost;
	/**playDuration3s*/

	private Integer playDuration_3s;
	/**activeRegisterCost*/

    private BigDecimal activeRegisterCost;
	/**show*/

	private Integer showMaterial;
	/**convertRate*/

    private BigDecimal convertRate;
	/**downloadFinishRate*/

    private BigDecimal downloadFinishRate;
	/**installFinishRate*/

    private BigDecimal installFinishRate;
	/**coupon*/

	private Integer coupon;
	/**couponSinglePage*/

	private Integer couponSinglePage;
	/**playOver*/

	private Integer playOver;
	/**downloadStartCost*/

    private BigDecimal downloadStartCost;
	/**message*/

	private Integer message;
	/**playDuration*/

	private Integer playDuration;
	/**validPlayRate*/

    private BigDecimal validPlayRate;
	/**averagePlayTimePerPlay*/

    private BigDecimal averagePlayTimePerPlay;
	/**convertCost*/

    private BigDecimal convertCost;
	/**convertShowRate*/

    private BigDecimal convertShowRate;
	/**installFinishCost*/

    private BigDecimal installFinishCost;

	private BigDecimal downloadStartRate;

	public BytedanceReportMaterialDaily() {
	}

	public BytedanceReportMaterialDaily(JSONObject detailJson, Long accountId) {
		JSONObject dimensions = detailJson.getJSONObject("dimensions");
		this.accountId = accountId;
		this.setImageMode(dimensions.getString("image_mode"));
		this.setMaterialId(dimensions.getLong("material_id"));
		this.setInventory(dimensions.getString("inventory"));
		this.setStatDatetime(dimensions.getDate("stat_datetime") == null ? null : DateUtils.formatDate(dimensions.getDate("stat_datetime"), "yyyy-MM-dd"));

		JSONObject metrics = detailJson.getJSONObject("metrics");
		this.setActivePayAmount(metrics.getInteger("active_pay_amount"));
		this.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
		this.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
		this.setNextDayOpen(metrics.getInteger("next_day_open"));
		this.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
		this.setConvertMaterial(metrics.getInteger("convert"));
		this.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
		this.setInAppCart(metrics.getInteger("in_app_cart"));
		this.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
		this.setConsultEffective(metrics.getInteger("consult_effective"));
		this.setViewMaterial(metrics.getInteger("view"));
		this.setDownload(metrics.getInteger("download"));
		this.setCpa(metrics.getBigDecimal("cpa"));
		this.setCpc(metrics.getBigDecimal("cpc"));
		this.setLocationClick(metrics.getInteger("location_click"));
		this.setPhoneConfirm(metrics.getInteger("phone_confirm"));
		this.setIesMusicClick(metrics.getInteger("ies_music_click"));
		this.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
		this.setWifiPlay(metrics.getInteger("wifi_play"));
		this.setShopping(metrics.getInteger("shopping"));
		this.setQq(metrics.getInteger("qq"));
		this.setCtr(metrics.getBigDecimal("ctr"));
		this.setCpm(metrics.getBigDecimal("cpm"));
		this.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
		this.setLikeMaterial(metrics.getInteger("like"));
		this.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
		this.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
		this.setActiveCost(metrics.getBigDecimal("active_cost"));
		this.setActive(metrics.getInteger("active"));
		this.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
		this.setGameAddiction(metrics.getInteger("game_addiction"));
		this.setActiveRate(metrics.getBigDecimal("active_rate"));
		this.setClick(metrics.getInteger("click"));
		this.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
		this.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
		this.setDownloadStart(metrics.getInteger("download_start"));
		this.setHomeVisited(metrics.getInteger("home_visited"));
		this.setPhone(metrics.getInteger("phone"));
		this.setPhoneEffective(metrics.getInteger("phone_effective"));
		this.setInAppPay(metrics.getInteger("in_app_pay"));
		this.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
		this.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
		this.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
		this.setTotalPlay(metrics.getInteger("total_play"));
		this.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
		this.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
		this.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
		this.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
		this.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
		this.setShowMaterial(metrics.getInteger("show"));
		this.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
		this.setMapSearch(metrics.getInteger("map_search"));
		this.setButton(metrics.getInteger("button"));
		this.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
		this.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
		this.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
		this.setConvertRate(metrics.getBigDecimal("convert_rate"));
		this.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
		this.setConsult(metrics.getInteger("consult"));
		this.setShareMaterial(metrics.getInteger("share"));
		this.setVote(metrics.getInteger("vote"));
		this.setValidPlay(metrics.getInteger("valid_play"));
		this.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
		this.setRedirect(metrics.getInteger("redirect"));
		this.setPayCount(metrics.getInteger("pay_count"));
		this.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
		this.setCost(metrics.getBigDecimal("cost"));
		this.setPhoneConnect(metrics.getInteger("phone_connect"));
		this.setCoupon(metrics.getInteger("coupon"));
		this.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
		this.setDownloadFinish(metrics.getInteger("download_finish"));
		this.setWechat(metrics.getInteger("wechat"));
		this.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
		this.setInstallFinish(metrics.getInteger("install_finish"));
		this.setLottery(metrics.getInteger("lottery"));
		this.setPlayOver(metrics.getInteger("play_over"));
		this.setInAppOrder(metrics.getInteger("in_app_order"));
		this.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
		this.setFollow(metrics.getInteger("follow"));
		this.setMessage(metrics.getInteger("message"));
		this.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
		this.setPlayDuration(metrics.getInteger("play_duration"));
		this.setForm(metrics.getInteger("form"));
		this.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
		this.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
		this.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
		this.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
		this.setCommentMaterial(metrics.getInteger("comment"));
		this.setInAppUv(metrics.getInteger("in_app_uv"));
		this.setRegister(metrics.getInteger("register"));
		this.setConvertCost(metrics.getBigDecimal("convert_cost"));
	}
}
