package cn.iocoder.yudao.module.course.vo;

import cn.iocoder.yudao.annotation.Excel;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class CommissionExportVO {

    /*@ExcelProperty(value = " ", index = 0)
    @ColumnWidth(8)
    private Integer serialNumber;*/

    @ExcelIgnore
    private Long coachId;

    @ExcelProperty(value = "教练", index = 0)
    private String coachName;

    @ExcelProperty(value = "教练身份证号", index = 1)
    private String coachIdCard;

    @ExcelIgnore
    private Long studentId;

    @ExcelProperty(value = "学员", index = 2)
    private String studentName;

    @ExcelProperty(value = "学员身份证号", index = 3)
    private String studentIdCard;

    @ExcelIgnore
    private String courseId;

    @ExcelProperty(value = "课程名称", index = 4)
    private String courseName;

    @ExcelProperty(value = "课程类型", index = 5)
    private String courseType;

    @ExcelProperty(value = "科目", index = 6)
    private String subject;

    @ExcelIgnore
    private Date examTime;

    @ExcelProperty(value = "考试通过时间", index = 7)
    private String examTimeStr;

    @ExcelProperty(value = "缴纳学费金额", index = 8)
    private BigDecimal studentPay;

    @ExcelProperty(value = "提成金额（元）", index = 9)
    private String commissionAmount;

    @ExcelProperty(value = "审核人", index = 10)
    private String checkName;

    @ExcelProperty(value = "审核时间", index = 11)
//    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    private String createTimeStr;

    @ExcelProperty(value = "备注", index = 12)
    private String checkRemark;

    @ExcelIgnore
    private  String source;

    @ExcelProperty(value = "渠道", index = 13)
    private String sourceStr;

    @ExcelIgnore
    private String startTimeStr;
    @ExcelIgnore
    private String endTimeStr;

    // 分页参数
    @ExcelIgnore
    private Integer pageNo = 1;
    @ExcelIgnore
    private Integer pageSize = 10;

    // 导出类型：all(全部)、current(当前页)、range(自定义范围)
    @ExcelIgnore
    private String exportType;

    // 自定义范围参数
    @ExcelIgnore
    private Integer startPage;
    @ExcelIgnore
    private Integer endPage;


    public void setCreateTime(Date createTime) {
        if (createTime != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            this.createTimeStr = sdf.format(createTime);
        }
    }
    public void setExamTime(Date examTime) {
        this.examTime = examTime;
        if (examTime != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            this.examTimeStr = sdf.format(examTime);
        }
    }

    public void setSource(String source) {
        this.source = source;

        if (source == null) {
            this.sourceStr = "";
            return;
        }

        switch (source) {
            case "01":
                this.sourceStr = "驾校统招";
                break;
            case "02":
                this.sourceStr = "教练自招";
                break;
            case "03":
                this.sourceStr = "自来客户";
                break;
            case "04":
                this.sourceStr = "业务经理统招";
                break;
            default:
                this.sourceStr = "未知渠道";
                break;
        }
    }
}
