package com.gci.boot.modules.customer.entity;

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

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 com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.gci.boot.annotation.Query.SelectQuery;
import com.gci.boot.annotation.fileUrl.FileUrl;
import com.gci.boot.annotation.fileUrl.handle.FileUrlHandle;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.annotation.ExcelEnum;
import com.gci.boot.common.dict.excel.DictConverter;
import com.gci.boot.common.dict.excel.EnumConverter;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 客户回访台账
 * </p>
 *
 * @author xushuhan
 * @since 2023-10-14
 */
@Getter
@Setter
@TableName("tb_customer_follow")
@ApiModel(value = "TbCustomerFollow对象", description = "客户回访台账")
@ColumnWidth(20)
public class TbCustomerFollow implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ExcelIgnore
    private String id;

    @ApiModelProperty("回访单号")
    @SelectQuery
    @ExcelProperty(value = "回访单号", index = 0)
    private String followNo;
    
    @ApiModelProperty("所属项目")
    @ExcelProperty(value = "项目", converter = DictConverter.class, index = 1)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @Dict(dictTable = "tb_projects", dicText = "project_name", dicCode = "id")
    private String projectId;

    @ApiModelProperty("回访模板")
    @ExcelProperty(value = "回访模板", converter = DictConverter.class, index = 4)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @Dict(dictTable = "tb_customer_follow_template", dicText = "name", dicCode = "id")
    private String templateId;

    @ApiModelProperty("回访方式（1上门回访，2电话回访）")
    @ExcelProperty(value = "回访方式", converter = DictConverter.class, index = 2)
    @Dict(dicCode = "review_type")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String reviewType;

    @ApiModelProperty("回访时间")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
    @DateTimeFormat("yyyy-MM-dd HH:mm")
    @ExcelProperty(value = "回访时间", index = 3)
    private Date reviewTime;

    @ApiModelProperty("附件")
    @ExcelIgnore
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    @JsonDeserialize(using = FileUrlHandle.class)
    @FileUrl
    private String fileUrl;

    @ApiModelProperty("回访人")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "回访人", converter = DictConverter.class, index = 7)
    @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
    private String reviewUserId;

    @ApiModelProperty("回访结果（0未开始，1未完成，2已完成）")
    @ExcelProperty(value = "回访结果", converter = DictConverter.class, index = 8)
    @Dict(dicCode = "result_status")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String resultStatus;
    
    @ApiModelProperty("来源（1用户，2计划）")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelIgnore
    private String sourceType;

    @ApiModelProperty("备注")
    @ExcelIgnore
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String remark;

    @ApiModelProperty("所属机构")
    @ExcelIgnore
    private String sysOrgCode;

    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;

    @ApiModelProperty("创建人")
    @ExcelIgnore
    private String createBy;

    @ApiModelProperty("更新人")
    @ExcelIgnore
    private String updateBy;

    @TableField(exist = false)
    @ExcelIgnore
    private List<TbCustomerFollowPart> partList;

    @ApiModelProperty("日期开始")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date reviewTimeStart;

    @ApiModelProperty("日期结束")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date reviewTimeEnd;

    @ExcelEnum("0_×,1_√")
    @ExcelProperty(value = "车辆巡检",converter = EnumConverter.class, index = 5)
    @TableField(exist = false)
    private String hasInspectionTask = "0";
    
    @ExcelEnum("0_×,1_√")
    @ExcelProperty(value = "反馈意见",converter = EnumConverter.class, index = 6)
    @TableField(exist = false)
    private String hasOpinion = "0";
    
    //意见反馈
    @TableField(exist = false)
    @ExcelIgnore
    private TbCustomerOpinion opinion;
    
    //车辆巡检
    @TableField(exist = false)
    @ExcelIgnore
    private TbInspectionTask inspectionTask;
    
    
}
