package com.inkasso.factoring.system.businessProcessLog.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.inkasso.factoring.common.entity.BaseEntity;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Description:业务处理日志实体
 * <p>
 * taskDefKey:流程定义中，用户任务定义key，要求见名知意，它是判断具体业务（表）的依据<br>
 * historicTaskId:唯一映射具体（表单）业务信息的依据，相当于taskDefKey和formBusinessId的结合<br>
 * formBusinessId/endTime:判断业务表单完成时处理日志的依据——仅当这两个字段均不为空时
 * </p>
 * @Author:wanxiangZhou
 * @E-mail:zhouyu@sunxung.cn
 * @Date:2018年6月26日 下午7:48:29
 */
public class BusinessProcessingLog extends BaseEntity {

    private static final long serialVersionUID = 1L;
    @NotNull(message = "业务信息ID不能为空", groups = {
            Add.class
    })
    private Long busnessKey;// 启动流程实例时主业务信息ID
    @NotBlank(message = "业务类型不能为空", groups = {
            Add.class
    }) // 与ConstantUtil.java中定义的常量保持一致
    private String businessType;// 业务类型或者说流程类别，一个流程（定义/实例）关联一项业务，如立项、尽调、评审会等等
    @NotBlank(message = "历史任务ID不能为空", groups = {
            Add.class
    })
    private String historicTaskId;
    @Length(min = 1, max = 255, message = "任务名称不能为空，且不超过255个字符", groups = {
            Add.class
    })
    private String taskName;
    @Length(min = 1, max = 255, message = "任务定义KEY不能为空，且不超过255个字符", groups = {
            Add.class
    })
    private String taskDefKey;
    @NotNull(message = "表单业务ID不能为空", groups = {
            Update.class
    })
    private Long formBusinessId;// 流程中任务涉及的表单业务ID
//    @ObjectValidator(message = "办理人ID不能为空")
    private Long assigneeId;
    @Length(min = 1, max = 20, message = "办理人类型不能为空，且不超过20个字符")
    private String assigneeType;// 与ConstantConversionUtil.java中assigneeType定义的常量保持一致
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    private Float overdueDays;// 若为null，表示无时间限制，最小单位0.5（天），目前业务只记录逾期时间，故默认为逾期，默认不超过1000天FLOAT(4,1)
    private boolean isWorkingDay;// 工作日(true)、自然日(false)标识
    @Length(min = 1, max = 50, message = "任务状态不能为空，且不超过50个字符", groups = {
            Update.class
    })
    private String status;// 即：taskDefKey对应的业务数据的状态，仅仅为展示，故String类型

    public Long getBusnessKey() {
        return busnessKey;
    }

    public void setBusnessKey(Long busnessKey) {
        this.busnessKey = busnessKey;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getHistoricTaskId() {
        return historicTaskId;
    }

    public void setHistoricTaskId(String historicTaskId) {
        this.historicTaskId = historicTaskId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskDefKey() {
        return taskDefKey;
    }

    public void setTaskDefKey(String taskDefKey) {
        this.taskDefKey = taskDefKey;
    }

    public Long getFormBusinessId() {
        return formBusinessId;
    }

    public void setFormBusinessId(Long formBusinessId) {
        this.formBusinessId = formBusinessId;
    }

    public Long getAssigneeId() {
        return assigneeId;
    }

    public void setAssigneeId(Long assigneeId) {
        this.assigneeId = assigneeId;
    }

    public String getAssigneeType() {
        return assigneeType;
    }

    public void setAssigneeType(String assigneeType) {
        this.assigneeType = assigneeType;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Float getOverdueDays() {
        return overdueDays;
    }

    public void setOverdueDays(Float overdueDays) {
        this.overdueDays = overdueDays;
    }

    public boolean isWorkingDay() {
        return isWorkingDay;
    }

    public void setWorkingDay(boolean workingDay) {
        isWorkingDay = workingDay;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
