package com.storlead.sales.pojo.entity.customer;

import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.storlead.framework.annotate.AnnotateEnumType;
import com.storlead.framework.annotate.Dict;
import com.storlead.framework.annotate.OrgAutoMateAnnotate;
import com.storlead.framework.mybatis.entity.SysBaseField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 工单表
 * </p>
 *
 * @author YPZ
 * @since 2024-04-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("work_order")
@ApiModel(value="WorkOrderEntity对象", description="工单表")
public class WorkOrderEntity extends SysBaseField {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "工单主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "编码")
    @TableField(value = "data_code")
    private String dataCode;

    @ApiModelProperty(value = "关联客户ID")
    @TableField("customer_id")
    private Long customerId;

    @ApiModelProperty(value = "订单ID")
    @TableField("order_form_id")
    private Long orderFormId;

    @ApiModelProperty(value = "联系人ID")
    @TableField("liaison_id")
    private Long liaisonId;

    @ApiModelProperty(value = "工单标题")
    @TableField("title")
    private String title;

    @ApiModelProperty(value = "工单内容")
    @TableField("content")
    private String content;

    @ApiModelProperty(value = "期望完成时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("expect_time")
    private Date expectTime;

    @ApiModelProperty(value = "实际完成时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("actual_time")
    private Date actualTime;

//    @ApiModelProperty(value = "提醒用户id，逗号隔开")
    @TableField("remind_user_ids")
    private String remindUserIds;

    @ApiModelProperty(value = "最后处理人id")
    @TableField(value = "current_user_id")
    private Long currentUserId;

    @ApiModelProperty(value = "最后处理人")
    @TableField("current_user_name")
    private String currentUserName;

    @ApiModelProperty(value = "工单类型id")
    @TableField("work_order_category_id")
    @Dict(dictCode = "work_order_category_id",valueField = "workOrderCategoryName",multiple = true)
    private Integer workOrderCategoryId;

    @ApiModelProperty(value = "工单紧急程度：1:非常紧急，2:紧急，3:一般")
    @TableField("urgent_status")
    @Dict(dictCode = "urgent_status",valueField = "urgentStatusName",multiple = true)
    private Integer urgentStatus;

    @ApiModelProperty(value = "工单的状态：1待处理，2已撤销，3被退回，4已完成，5已确认")
    @TableField("order_status")
    @Dict(dictCode = "order_status",valueField = "orderStatusName",multiple = true)
    private Integer orderStatus;

    @ApiModelProperty(value = "订单发起次数")
    @TableField("order_count")
    private Integer orderCount;

    @ApiModelProperty(value = "退回原因备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "发起时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("commit_time")
    private Date commitTime;

    @ApiModelProperty(value = "撤销、拒绝时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("revoke_time")
    private Date revokeTime;

    @ApiModelProperty(value = "工单来源")
    @TableField("order_from")
    private String orderFrom;

    @ApiModelProperty(value = "再次发起说明")
    @TableField("order_again")
    private String orderAgain;


    @ApiModelProperty(value = "发起部门id")
    @TableField("create_department_id")
    private Long createDepartmentId;

    @ApiModelProperty(value = "处理部门id")
    @TableField("owner_department_id")
    private Long ownerDepartmentId;

    @ApiModelProperty(value = "发起部门名称")
    @TableField("create_department_name")
    private String createDepartmentName;

    @ApiModelProperty(value = "处理部门名称")
    @TableField("owner_department_name")
    private String ownerDepartmentName;

    @ApiModelProperty(value = "前归属人")
    @OrgAutoMateAnnotate(valueField = "formerOwnerByName",annotateType = AnnotateEnumType.USER)
    private Long formerOwnerBy;
}
