
package com.tmerclub.cloud.user.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tmerclub.cloud.common.model.ExcelModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户导入信息
 *
 * @author cl
 * @date 2021-05-12 10:13:29
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
public class UserExcelDTO extends ExcelModel implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * excel 信息
     */
    public static final String EXCEL_NAME = "导入用户信息模板";
    public static final String SHEET_NAME = "sheet";
    /**
     * 哪一行开始导出
     */
    public static final int MERGE_ROW_INDEX = 1;
    /**
     * 需要合并的列数组
     */
    public static final int[] MERGE_COLUMN_INDEX = {};

    /**
     * 需要批注的列
     */
    public static final int[] COMMENT_INDEX = {2};

    public static final String[] COMMENTS = {
        "由字母、数字和特殊符号三种字符组成8-20位半角字符，区分大小写"
    };

    @ExcelProperty(value = "序号", index = 0)
    private String seq;

    @ExcelProperty(value = "手机号(必填)", index = 1)
    @ColumnWidth(20)
    private String phone;

    @ExcelProperty(value = "密码(必填)", index = 2)
    @ColumnWidth(16)
    private String password;

    @ExcelProperty(value = "用户昵称(最多15个字符)", index = 3)
    @ColumnWidth(30)
    private String nickName;

    @ExcelProperty(value = "会员类型(0普通会员/1付费会员(不填默认为普通会员)", index = 4)
    @ColumnWidth(15)
    private Integer levelType;

    @ExcelProperty(value = "付费会员等级(付费会员必填，普通会员以成长值为准)", index = 5)
    @ColumnWidth(15)
    private String level;

    /**
     * 注解@ContentStyle(dataFormat = 49) 设置单元格格式为文本格式
     * 只会将对象属性所在单元格设置为文本格式，所在列的其他单元格还是为自定义格式
     */
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty(value = "vip结束时间(格式:2021-08-08，会员类型是1则必填)", index = 6)
    @ColumnWidth(25)
    private Date vipEndTime;


    @ExcelProperty(value = "性别(0男/1女)", index = 8)
    private String sex;

    @ExcelProperty(value = "生日(格式:2009-11-27)", index = 9)
    @ColumnWidth(20)
    private String birthDate;

    @ExcelProperty(value = "积分(限整数)", index = 10)
    private String score;

    @ExcelProperty(value = "余额(限整数)", index = 11)
    private String balance;

    @ExcelProperty(value = "成长值(限整数)", index = 12)
    private String growth;

}
