package com.bohuikeji.delivery.backstage.entity;

import com.alibaba.fastjson.annotation.JSONField;
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.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.bohuikeji.frame.module.admin.entity.TFranchiseeInformation;
import com.bohuikeji.frame.module.admin.entity.web.block.SelectBlock;
import com.bohuikeji.frame.module.admin.serializer.Decimal2Serializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 骑手工作考核记录
 * </p>
 *
 * @author 10552
 * @since 2019-12-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TCourierWorkExam对象", description="骑手工作考核")
@TableName("t_courier_work_exam")
public class TCourierWorkExam extends EntityBase<TCourierWorkExam> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "考核id")
    @TableId(value = "examine_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(required = false,edit = false,add = false)
    private Integer examineId;

    @ApiModelProperty(value = "骑手")
    @TableField("courier_id")
    @TableShowField(value = "骑手")
    @TableKeyField(table = "t_courier",keyShowFields = {"courier_name","courier_phone"},
            keyLikeFields = {"courier_name"},where = "courier_auth='认证成功'  and fran_id in(##FRAN_IDS##)",key = TCourier.class)
    @TableQueryField
    @TableNewField(block = SelectBlock.class)
    private Integer courierId;


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

    @ApiModelProperty(value = "考核金额")
    @TableField("examine_price")
    @TableShowField(value = "考核金额(￥)",show = true)
    @TableNewField
    @JSONField(serializeUsing = Decimal2Serializer.class)
    private BigDecimal examinePrice=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);


    @ApiModelProperty(value = "考核类型(奖励、惩罚)")
    @TableField("examine_type")
    @TableShowField("钱包状态")
    @TableNewField(options = {"奖励","惩罚"})
    @TableQueryField(like = false)
    private String examineType;

    @ApiModelProperty(value = "考核项目")
    @TableField("examine_project")
    @TableShowField("考核项目")
    @TableNewField
    @TableQueryField(like = false)
    private String examineProject;

    @ApiModelProperty(value = "考核说明")
    @TableField("examine_explain")
    @TableShowField("考核说明")
    @TableNewField
    @TableQueryField(like = false)
    private String examineExplain;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    @TableShowField(value = "创建时间")
    @TableNewField(required = false,add = false,edit = false)
    private LocalDateTime createTime=LocalDateTime.now();

    @ApiModelProperty(value = "考核状态")
    @TableField("examine_state")
    @TableShowField("考核状态")
    @TableNewField(options = {"待奖励","待惩罚"})
    @TableQueryField(like = false)
    private String examineState;


}
