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.entity.sys.SysUser;
import com.bohuikeji.frame.module.admin.entity.web.block.FileBlock;
import com.bohuikeji.frame.module.admin.entity.web.block.SelectBlock;
import com.bohuikeji.frame.module.admin.entity.web.block.TextBlock;
import com.bohuikeji.frame.module.admin.enums.ColumnTypeEnum;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.baomidou.mybatisplus.annotation.IdType;
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="TComplaint对象", description="投诉记录表")
@TableName("t_complaint")
public class TComplaint extends EntityBase<TComplaint> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value="投诉记录id(新增时请留空或null)")
    @TableId(value = "complaint_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer complaintId;

    @ApiModelProperty(value = "投诉级别")
    @TableField("complaint_level")
    /*@TableShowField("投诉级别")
    @TableNewField(show = false)*/
    private Integer complaintLevel;

    @ApiModelProperty(value = "投诉人标志（投诉人表名）")
    @TableField("complaint_sign")
    @TableShowField(value = "投诉人标志（投诉人表名）",show = false)
    @TableNewField(show = false)
    private String complaintSign;

    @ApiModelProperty(value = "投诉原因")
    @TableField("complaint_causes")
    @TableShowField("投诉原因")
    @TableNewField(edit = false)
    private String complaintCauses;

    @ApiModelProperty(value = "投诉订单号")
    @TableField("order_num")
    @TableQueryField
    @TableShowField(value = "投诉订单号")
    @TableNewField(edit = false)
    private String orderNum;

    @ApiModelProperty(value = "投诉物流单号")
    @TableField("logistics_num")
    @TableQueryField
    @TableShowField(value = "投诉物流单号")
    @TableNewField(edit = false)
    private String logisticsNum;

    @ApiModelProperty(value = "投诉时间")
    @TableField("complaint_time")
    @TableShowField("投诉时间")
    @TableNewField(edit = false)
    private LocalDateTime complaintTime;

    @ApiModelProperty(value = "投诉人id")
    @TableField("complainant_id")
    @TableShowField(value = "投诉人",show = false)
    @TableNewField(block = SelectBlock.class)
    @TableKeyField(table = "t_customer",keyShowFields = "customer_name",key = TCustomer.class)
    @TableQueryField
    private Integer complainantId;

    /*@ApiModelProperty(value = "投诉人姓名")
    @TableField(exist = false)
    @TableShowField("投诉人姓名")
    @TableNewField(show = false)
    private String complainantName;*/

    @ApiModelProperty(value = "投诉描述")
    @TableField("complaint_desc")
    @TableShowField(value = "投诉内容",show = false)
    @TableNewField(edit =false)
    private String complaintDesc;

    @ApiModelProperty(value = "投诉作证附件")
    @TableField("complaint_evidence")
    @TableShowField(value = "投诉作证附件",type = ColumnTypeEnum.FILE,show = false)
    @TableNewField()
    private String complaintEvidence;

    @ApiModelProperty(value = "投诉处理人id")
    @TableField("complaint_handler_id")
    @TableShowField(value = "投诉处理人",show = false)
    @TableNewField(block = SelectBlock.class)
    @TableQueryField()
    @TableKeyField(table = "sys_user",keyShowFields = "user_name",keyLikeFields = "user_name",key = SysUser.class)
    private Integer complaintHandlerId;

    /*@ApiModelProperty(value = "投诉处理人名称")
    @TableField(exist = false)
    @TableShowField("处理人名称")
    @TableNewField(show = false)
    private String complaintHandlerName;*/

    @ApiModelProperty(value = "处理结果描述")
    @TableField("results_desc")
    @TableShowField(value = "处理结果描述",show = false)
    @TableNewField(block = TextBlock.class)
    private String resultsDesc;

    @ApiModelProperty(value = "处理结果附件")
    @TableField("results_evidence")
    @TableShowField(value = "处理结果附件",type = ColumnTypeEnum.FILE,show = false)
    @TableNewField(block = FileBlock.class)
    private String resultsEvidence;

    @ApiModelProperty(value = "处理次数")
    @TableField("handle_num")
    @TableShowField(value = "处理次数",show = false)
    @TableNewField(show = false)
    private Integer handleNum;

    @ApiModelProperty(value = "处理时间")
    @TableField("handle_time")
    @TableShowField(value = "处理时间",show = false)
    @TableNewField(show = false)
    private LocalDateTime handleTime;


    @ApiModelProperty(value = "投诉状态")
    @TableField("complaint_state")
    @TableShowField("投诉状态")
    @TableNewField
    private String complaintState="处理中";

    /**
     * 投诉人姓名
     * @param complainantId
     */
   /* public void setComplainantId(Integer complainantId) {
        this.complainantId = complainantId;
        if(this.complaintSign.equals("t_customer")){
            *//**
             * 客户投诉派送员
             *//*
            this.complainantName = (String) sql().selectObj("select customer_name from t_customer where customer_id={0}",complainantId);
        }else if(this.complaintSign.equals("t_courier")){
            *//**
             * 派送员投诉平台
             *//*
            this.complainantName = (String) sql().selectObj("select courier_name from t_courier where courier_id={0}",complainantId);
        }
    }

    *//**
     * 投诉处理人
     * @param complaintHandlerId
     *//*
    public void setComplaintHandlerId(Integer complaintHandlerId) {
        this.complaintHandlerId = complaintHandlerId;
        this.complaintHandlerName = (String) sql().selectObj("select user_name from sys_user where user_id={0}",complaintHandlerId);
    }*/
}
