package com.bohuikeji.delivery.backstage.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.constant.RegEx;
import com.bohuikeji.frame.module.admin.entity.TFranchiseeInformation;
import com.bohuikeji.frame.module.admin.entity.web.block.*;
import com.bohuikeji.frame.module.admin.enums.ColumnTypeEnum;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.baomidou.mybatisplus.annotation.IdType;

import java.math.BigDecimal;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 派送员信息表
 * </p>
 *
 * @author 10552
 * @since 2019-08-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TCourier对象", description="派送员信息表")
@TableName("t_courier")
public class TCourier extends EntityBase<TCourier> {

    @ApiModelProperty(value="派送员id(新增时请留空或null)")
    @TableId(value = "courier_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer courierId;

    @ApiModelProperty(value = "员工编号")
    @TableField("courier_number")
    @TableQueryField(show = false)
    @TableShowField(value = "员工编号")
    private String courierNumber;

    @ApiModelProperty(value = "配送员姓名")
    @TableField("courier_name")
    @TableQueryField(show = false)
    @TableShowField(value = "配送员姓名")
    @TableNewField
    private String courierName;

    @ApiModelProperty(value = "配送员手机号（账号）")
    @TableField("courier_phone")
    @TableShowField(value = "配送员手机号")
    @TableNewField(limit = RegEx.INTEGER)
    @TableQueryField(show = false)
    private String courierPhone;

    @ApiModelProperty(value = "密码")
    @TableField("courier_pwd")
    @TableShowField(value = "密码", show = false)
    private String courierPwd;

    @ApiModelProperty(value = "生日")
    @TableField("courier_birthday")
    @TableShowField(value = "生日",show = false)
    @TableNewField(block = DateBlock.class,edit = false)
    private LocalDate courierBirthday;

    @ApiModelProperty(value = "身份证号")
    @TableField("courier_card")
    @TableShowField(value = "身份证号",show = false)
    @TableNewField(edit = false)
    private String courierCard;

    @ApiModelProperty(value = "身份证照片")
    @TableField("courier_card_url")
    @TableShowField(value = "身份证照片",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class)
    private String courierCardUrl;

    @ApiModelProperty(value = "合同协议")
    @TableField("courier_cont_url")
    @TableShowField(value = "合同协议",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class,required = false)
    private String courierContUrl;

    @ApiModelProperty(value = "保险证明")
    @TableField("courier_ins_url")
    @TableShowField(value = "保险证明",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class,required = false)
    private String courierInsUrl;

    @ApiModelProperty(value = "性别")
    @TableField("courier_gender")
    @TableShowField("性别")
    @TableNewField(options = {"男","女"})
    @TableQueryField(like = false)
    private String courierGender;

    @ApiModelProperty(value = "居住地址")
    @TableField("courier_address")
    @TableShowField(value = "居住地址",show = false)
    @TableNewField(block = TextBlock.class)
    private String courierAddress;

    @ApiModelProperty(value = "是否有行业经验")
    @TableField("courier_experience")
    @TableShowField(value = "是否有行业经验",show = false)
    @TableNewField(options = {"是","否"})
    private String courierExperience;

    @ApiModelProperty(value = "从业经验描述")
    @TableField("courier_experience_describe")
    @TableShowField(value = "从业经验描述",show = false)
    @TableNewField(block = TextBlock.class,required = false)
    private String courierExperienceDescribe;

    @ApiModelProperty(value = "银行账户")
    @TableField("courier_bank_account")
    @TableShowField(value = "银行账户",show = false)
    //@TableNewField(limit = RegEx.INTEGER,required = false)
    @TableNewField(block = SelectBlock.class,required = false,edit = false)
    @TableQueryField
    @TableKeyField(table = "t_courier_card",keyShowFields = {"card_bank","card_num"},symbol = "-",key = TCourierCard.class)
    private Integer courierBankAccount;

    @ApiModelProperty(value = "职位类型(全职、兼职、营销)")
    @TableField("courier_type")
    @TableQueryField
    @TableShowField(value = "职位类型")
    @TableNewField(options = {"全职","兼职","营销"},edit = true)
    private String courierType="兼职";

    @ApiModelProperty(value = "派送单量")
    @TableField("courier_num")
    @TableShowField("派送单量")
    private Integer courierNum=0;

    @ApiModelProperty(value = "入驻费用")
    @TableField("courier_settled_money")
    @TableShowField(value = "入驻费用",show = false)
    @TableNewField(limit = RegEx.INTEGER,edit = false,required = false)
    private BigDecimal courierSettledMoney;

    @ApiModelProperty(value = "缴费状态")
    @TableField("courier_pay_status")
    @TableShowField("缴费状态")
    @TableNewField(block = SelectBlock.class,options = {"未缴费","已缴费","已退款"},edit = false)
    @TableQueryField
    private String courierPayStatus="未缴费";

    @ApiModelProperty(value = "配送员状态(未审核(默认状态)、审核中(提交认证材料之后)、正常(审核成功)、审核未通过、禁止登陆、禁止接单)")
    @TableField("courier_status")
    @TableQueryField
    @TableShowField(value = "配送员状态")
    @TableNewField(block = SelectBlock.class)
    private String courierStatus="未审核";

    @ApiModelProperty(value = "派送员认证状态(未认证、审核中、认证成功、认证失败)")
    @TableField("courier_auth")
    @TableQueryField
    @TableShowField(value = "认证状态")
    @TableNewField(block = SelectBlock.class,edit = false)
    private String courierAuth="未认证";


    @ApiModelProperty(value = "是否有运输车辆")
    @TableField("transport_vehicle")
    @TableQueryField
    @TableShowField(value = "是否有运输车辆",show = false)
    @TableNewField(options = {"有","无"},required = false)
    private String transportVehicle="无";

    @ApiModelProperty(value = "车辆认证状态")
    @TableField("courier_auth_vehicle")
    @TableQueryField
    @TableShowField(value = "车辆认证状态",show = false)
    @TableNewField(options = {"未认证","已认证"},required = false)
    private String courierAuthVehicle="未认证";

    @ApiModelProperty(value = "注册时间")
    @TableField("courier_create_time")
    @TableShowField("注册时间")
    @TableNewField(show = false)
    @TableQueryField(like = false,sort = 0)
    private LocalDateTime courierCreateTime=LocalDateTime.now();

    @ApiModelProperty(value = "更新时间")
    @TableField("courier_update_time")
    @TableShowField(value = "更新时间",show = false)
    @TableNewField(block = DateBlock.class)
    private LocalDateTime courierUpdateTime;

    @ApiModelProperty(value = "加盟商id")
    @TableField("fran_id")
    @TableShowField(value = "所属加盟商")
    @TableNewField(block = SelectBlock.class)
    @TableQueryField
    @TableKeyField(table = "t_franchisee_information",keyShowFields = "fran_name", where = "fran_id in(##FRAN_IDS##)",key = TFranchiseeInformation.class)
    private Integer franId;

    @ApiModelProperty(value = "支付单号")
    @TableField("pay_num")
    @TableShowField(value = "支付单号",show = false)
    @TableNewField(required = false,edit = false)
    private String payNum;


    @ApiModelProperty(value = "工作状态")
    @TableField("job_status")
    @TableQueryField
    @TableShowField(value = "工作状态",show = false)
    @TableNewField(options = {"停止","等待","工作中"})
    private String jobStatus="工作中";

    @ApiModelProperty(value = "综合评分")
    @TableField("evaluate_score")
    @TableShowField("综合评分")
    @TableNewField
    private Double evaluateScore=0d;

    @ApiModelProperty(value = "周接单数")
    @TableField(exist = false)
    private Integer weekcoun;

    @ApiModelProperty(value = "月接单数")
    @TableField(exist = false)
    private Integer monthcoun;

    @ApiModelProperty(value = "个推用户个人标识")
    @TableField("cid")
    /*@TableQueryField(show = false)
    @TableShowField(value = "个推用户个人标识")
    @TableNewField*/
    private String cid;

    @ApiModelProperty(value = "缴费等级")
    @TableField("grade")
    /*@TableQueryField(show = false)
    @TableShowField(value = "个推用户个人标识")
    @TableNewField*/
    private Integer grade=1;

    @ApiModelProperty(value = "考核设置")
    @TableField("assess_set")
    @TableQueryField
    @TableShowField(value = "考核设置")
    @TableNewField(options = {"考核","不考核"})
    private String assessSet="考核";

    @ApiModelProperty(value = "指派开关")
    @TableField("assign_switch")
    @TableQueryField
    @TableShowField(value = "指派开关",show = false)
    @TableNewField(options = {"开启","关闭"})
    private String assignSwitch="开启";

    /*@ApiModelProperty(value = "用户唯一标识微信开发者id，微信小程序")
    @TableField("open_id")
    private String openId;

    @ApiModelProperty(value = "微信会话密钥")
    @TableField("session_key")
    private String sessionKey;*/

    /**
     * codeUrl派送员二维码信息路径
     */
    @ApiModelProperty(value="codeUrl派送员二维码信息路径",name="url")
    @TableField(exist = false)
    private String codeUrl;

    /**
     * codeUrl派送员二维码信息路径
     */
    @ApiModelProperty(value="车辆信息",name="url")
    @TableField(exist = false)
    private TVehicleInformation vehicleInformation;

    /**
     * 经纬度
     */
    @ApiModelProperty(value="经纬度",name="url")
    @TableField(exist = false)
    private String location;

    /**
     * 封装加盟商名字
     * @param franId
    public void setFranId(Integer franId) {
        this.franId = franId;
        this.franName= (String) sql().selectObj("select fran_name from t_franchisee_information where fran_id={0}",this.franId);
    }*/
}
