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

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yh.saas.common.support.entity.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

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

/**
 * <p>
 * 记录服务商单据操作历史
 * </p>
 *
 * @author yul
 * @since 2019-12-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class ServicerBillOperateHis extends BaseModel<ServicerBillOperateHis> {

	private static final long serialVersionUID = -9190264106027572967L;

	/**
	 * 主键id
	 */
	@TableId(type = IdType.INPUT)
	private String id;
	/**
	 * 单据类型
	 */
	private String billType;
	/**
	 * 单据ID
	 */
	private String billId;
	/**
	 * 单据名称
	 */
	private String billName;
	/**
	 * 操作人
	 */
	private String operateUser;
	/**
	 * 操作时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date operateDate;
	/**
	 * 处理信息
	 */
	private String dealMsg;
	/**
	 * 处理信息英文
	 */
	private String dealMsgEn;
	/**
	 * 审核意见
	 */
	private String verifyRemark;
	/**
	 * 审核人职务
	 */
	private String verifyUserDuty;
	/**
	 * 审批结果
	 */
	@TableField(exist = false)
	private String approveResult;

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

	/**
	 * 查询类
	 */
	public static class QueryFields {

		private QueryFields() {

		}

		public static final String BILL_ID = "bill_id";
		public static final String OPERATE_DATE = "operate_date";

	}

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

}
