package com.dk.mdm.model.response.mst;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.dk.common.infrastructure.annotaiton.ExportTitle;
import com.dk.common.infrastructure.handler.*;
import com.dk.common.model.pojo.PageInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.StringTypeHandler;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 *  客户资料
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ExportTitle("客户资料")
@TableName(value = "t_mst_customer", autoResultMap = true,schema = "dkic_b")
@ApiModel(value="实体类：客户资料", description="表名：t_mst_customer")
public class CustomerResponse extends PageInfo<CustomerResponse> implements Serializable {

    /*
     * 数据库字段
     */

    /**
     * 客户ID
     */
//    @TableId(value = "cus_id", type = IdType.AUTO)
    @ApiModelProperty(value = "客户ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String cusId;


    /**
     * 客户编号
     */
    @Excel(name = "客户编号")
    @ApiModelProperty(value = "客户编号")
    private String cusCode;


    /**
     * 客户名称
     */
    @Excel(name = "客户名称")
    @ApiModelProperty(value = "客户名称")
    private String cusName;


    /**
     * 客户电话
     */
    @Excel(name = "客户电话")
    @ApiModelProperty(value = "客户电话")
    private String cusPhone;


    /**
     * 行政区划 (a1：省 a2：市 a3：区)
     */
    @Excel(name = "行政区划 (a1：省 a2：市 a3：区)")
    @ApiModelProperty(value = "行政区划 (a1：省 a2：市 a3：区)")
    @TableField(typeHandler = JsonTypeHandler.class)
    private JSONObject addressArea;


    /**
     * 小区或POI
     */
    @Excel(name = "小区或POI")
    @ApiModelProperty(value = "小区或POI")
    private String addressName;


    /**
     * 门牌号
     */
    @Excel(name = "门牌号")
    @ApiModelProperty(value = "门牌号")
    private String addressNo;


    /**
     * 地址坐标(gcj02) (LAT：纬度的值 LON：经度的值)
     */
    @Excel(name = "地址坐标(gcj02) (LAT：纬度的值 LON：经度的值)")
    @ApiModelProperty(value = "地址坐标(gcj02) (LAT：纬度的值 LON：经度的值)")
    @TableField(typeHandler = JsonTypeHandler.class)
    private JSONObject addressGcj02;


    /**
     * 详细地址
     */
    @Excel(name = "详细地址")
    @ApiModelProperty(value = "详细地址")
    private String addressFull;


    /**
     * 联系人
     */
    @Excel(name = "联系人")
    @ApiModelProperty(value = "联系人")
    private String contactName;


    /**
     * 联系电话
     */
    @Excel(name = "联系电话")
    @ApiModelProperty(value = "联系电话")
    private String contactPhone;


    /**
     * 客户来源 (【数据字典】)
     */
    @Excel(name = "客户来源 (【数据字典】)")
    @ApiModelProperty(value = "客户来源 (【数据字典】)")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String cusFrom;


    /**
     * 销售渠道
     */
    @Excel(name = "销售渠道")
    @ApiModelProperty(value = "销售渠道")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String channelId;


    /**
     * 部门
     */
    @Excel(name = "部门")
    @ApiModelProperty(value = "部门")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String orgId;


    /**
     * 业务员
     */
    @Excel(name = "业务员")
    @ApiModelProperty(value = "业务员")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String staffId;


    /**
     * 报备人
     */
    @Excel(name = "报备人")
    @ApiModelProperty(value = "报备人")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String reportStaff;


    /**
     * 报备时间
     */
    @Excel(name = "报备时间")
    @ApiModelProperty(value = "报备时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime reportTime;


    /**
     * 销售状态 (【系统字典】客销状态：公海、潜客、成交)
     */
    @Excel(name = "销售状态 (【系统字典】客销状态：公海、潜客、成交)")
    @ApiModelProperty(value = "销售状态 (【系统字典】客销状态：公海、潜客、成交)")
    private String saleStatus;


    /**
     * 备注
     */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remarks;


    /**
     * 当前跟进人
     */
    @Excel(name = "当前跟进人")
    @ApiModelProperty(value = "当前跟进人")
    @TableField(typeHandler = UuidListTypeHandler.class)
    private List<String> followStaffs;


    /**
     * 最后跟进人
     */
    @Excel(name = "最后跟进人")
    @ApiModelProperty(value = "最后跟进人")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String lastFollowStaff;


    /**
     * 最后跟进ID
     */
    @Excel(name = "最后跟进ID")
    @ApiModelProperty(value = "最后跟进ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String lastFollowId;


    /**
     * 最后跟进状态 (【系统字典】跟进状态：报备、跟进、邀约、报价、成交)
     */
    @Excel(name = "最后跟进状态 (【系统字典】跟进状态：报备、跟进、邀约、报价、成交)")
    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态：报备、跟进、邀约、报价、成交)")
    private String lastFollowStatus;


    /**
     * 最后跟进时间
     */
    @Excel(name = "最后跟进时间")
    @ApiModelProperty(value = "最后跟进时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime lastFollowTime;


    /**
     * 跟进次数
     */
    @Excel(name = "跟进次数")
    @ApiModelProperty(value = "跟进次数")
    private Integer followCount;


    /**
     * 有效标识 (1：正常 0：停用)
     */
    @Excel(name = "有效标识 (1：正常 0：停用)")
    @ApiModelProperty(value = "有效标识 (1：正常 0：停用)")
    private Boolean flgValid;


    /**
     * 企业ID
     */
    @Excel(name = "企业ID")
    @ApiModelProperty(value = "企业ID")
    private Integer cpId;




    @ApiModelProperty(value = "来源名称")
    private String cusFromName;

    @ApiModelProperty(value = "渠道")
    private String channelName;

    @ApiModelProperty(value = "部门")
    private String orgName;

    @ApiModelProperty(value = "员工")
    private String staffName;

    @ApiModelProperty(value = "报备人")
    private String reportStaffName;
    @TableField(typeHandler = UuidTypeHandler.class)
    private String followStaff;

    @ApiModelProperty(value = "跟进人")
    private String followStaffName;

    @ApiModelProperty(value = "")
    private String lastFollowStaffName;

    private String saleStatusName;

    @ApiModelProperty(value = "提醒日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime nextFollowTime;

    @ApiModelProperty(value = "总剩余应收 (总应收账款-总应收收款金额-总应收优惠金额)")
    private BigDecimal receivableResidue;

    @ApiModelProperty(value = "总收款金额-总应收收款金额+总应收优惠金额（现金池）")
    private BigDecimal receiptResidue;

    @ApiModelProperty(value = "总收款金额")
    private BigDecimal receipt;

    @ApiModelProperty(value = "总应收账款")
    private BigDecimal receivable;

    @ApiModelProperty(value = "订单数量")
    private BigDecimal orderQuantity;

    @ApiModelProperty(value = "订单金额")
    private BigDecimal orderAmount;

    @ApiModelProperty(value = "出库数量")
    private BigDecimal outboundQuantity;

    @ApiModelProperty(value = "出库金额")
    private BigDecimal outboundAmount;

    @ApiModelProperty(value = "未出库金额")
    private BigDecimal outboundNotAmount;

    @ApiModelProperty(value = "未出库数量")
    private BigDecimal outboundNotQuantity;

    @ApiModelProperty(value = "退货数量")
    private BigDecimal outboundReturnQuantity;

    @ApiModelProperty(value = "退货金额")
    private BigDecimal outboundReturnAmount;

    @ApiModelProperty(value = "初始欠款")
    private BigDecimal startAmount;


    private String followStaffsName;




    private static final long serialVersionUID = 1L;

}
