package com.yh.saas.plugin.news.entity;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.yh.saas.common.support.entity.BaseModel;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 记录单据操作历史
 * </p>
 *
 * @author Chenly
 * @since 2019-09-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("news_bill_operation_his")
public class OperationHis extends BaseModel<OperationHis> {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键id
	 */
	@TableId(type = IdType.INPUT)
	private String id;
	/**
	 * 公司ID
	 */
	private String compId;
	/**
	 * 船舶ID
	 */
	private String vesselId;
	/**
	 * 单据ID
	 */
	private String billId;
	/**
	 * 操作人ID
	 */
	private String operateUserId;
	/**
	 * 操作人
	 */
	private String operateUserName;
	/**
	 * 操作时间
	 */
	private Date operateDate;
	/**
	 * 操作人职务
	 */
	private String operateUserDuty;
	/**
	 * 处理信息
	 */
	private String dealMsg;
	/**
	 * 处理信息英文
	 */
	private String dealMsgEn;
	/**
	 * 审核意见
	 */
	private String verifyRemark;
	/**
	 * 审核人职务
	 */
	private String verifyUserDuty;
	/**
	 * 附件id
	 */
	private String appendixId;
	/**
	 * 审批结果
	 */
	@TableField(exist = false)
	private String approveResult;

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	public static class QueryFields {
		public static final String ID = "id";

		public static final String COMPID = "comp_id";

		public static final String CREATEUSERID = "create_user_id";

		public static final String BILLTYPEID = "bill_type_id";

		public static final String DELETEFLAG = "delete_flag";

		public static final String BILLID = "bill_id";

		public static final String OPERATEDATE = "operate_date";

		private QueryFields() {
		}
	}

	public static OperationHis getInstance(String operateUser, Date operateDate, String approveResult,
										   String dealMsg, String dealMsgEn, String duty) {
		OperationHis history = new OperationHis();
		history.setOperateUserName(duty + " " + operateUser);
		history.setOperateDate(operateDate);
		history.setDealMsg(dealMsg);
		history.setDealMsgEn(dealMsgEn);
		history.setApproveResult(approveResult);
		history.setVerifyRemark(approveResult);
		return history;
	}

}
