package com.ruoyi.asset.domain;

import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 资产领用申请主表对象 ams_receive_order
 * 
 * 对应数据库表 ams_receive_order，用于记录领用申请的单据基本信息、申请人快照、审核确认信息及单据状态。
 * 与明细表 ams_receive_order_item 呈 1:N 关系，在草稿保存和编辑时进行级联写入和物理删除。
 *
 * @author Yangk
 * @date 2026-06-12
 */
public class AmsReceiveOrder extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键单据ID */
    private Long orderId;

    /** 唯一领用单单号，按编码规则“RECEIVE_ORDER”在保存草稿时自动生成，不允许用户编辑 */
    @Excel(name = "领用单号")
    private String receiveNo;

    /** 申请人用户ID：创建领用申请时的当前登录用户ID，防止用户篡改 */
    private Long applicantId;

    /** 申请人姓名快照：保存申请人姓名的历史快照，防止因用户修改姓名导致历史单据无法正确追溯 */
    @Excel(name = "申请人")
    private String applicantName;

    /** 申请人所属部门ID */
    private Long applyDeptId;

    /** 申请人所属部门名称快照：保存部门名称的历史快照，防止组织架构变更后历史单据流转路径失真 */
    @Excel(name = "申请部门")
    private String applyDeptName;

    /** 确认人用户ID：最后确认通过此领用申请的管理员或负责人用户ID */
    private Long confirmUserId;

    /** 确认人姓名快照：确认通过领用申请的负责人姓名快照 */
    @Excel(name = "确认人")
    private String confirmUserName;

    /** 领用申请最终被确认通过的时间，此时间戳后资产实际状态开始流转为“在用” */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "确认时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date confirmTime;

    /** 驳回原因：当单据状态流转为 REJECTED 时由审核人填写的具体原因，其他状态下为空 */
    @Excel(name = "驳回原因")
    private String rejectReason;

    /** 领用单状态，值参考 {@link com.ruoyi.asset.constant.ReceiveOrderStatus}。使用字典 'ams_receive_status' 进行展示 */
    @Excel(name = "单据状态", dictType = "ams_receive_status")
    private String orderStatus;

    /** 逻辑删除标志：0正常存在，1已逻辑删除。仅 DRAFT 草稿单据可执行逻辑删除 */
    private String delFlag;

    /** 领用单明细列表：关联 of 多个被领用资产的明细快照及归属信息 */
    private List<AmsReceiveOrderItem> amsReceiveOrderItemList;

    public void setOrderId(Long orderId) 
    {
        this.orderId = orderId;
    }

    public Long getOrderId() 
    {
        return orderId;
    }

    public void setReceiveNo(String receiveNo) 
    {
        this.receiveNo = receiveNo;
    }

    public String getReceiveNo() 
    {
        return receiveNo;
    }

    public void setApplicantId(Long applicantId) 
    {
        this.applicantId = applicantId;
    }

    public Long getApplicantId() 
    {
        return applicantId;
    }

    public void setApplicantName(String applicantName) 
    {
        this.applicantName = applicantName;
    }

    public String getApplicantName() 
    {
        return applicantName;
    }

    public void setApplyDeptId(Long applyDeptId) 
    {
        this.applyDeptId = applyDeptId;
    }

    public Long getApplyDeptId() 
    {
        return applyDeptId;
    }

    public void setApplyDeptName(String applyDeptName) 
    {
        this.applyDeptName = applyDeptName;
    }

    public String getApplyDeptName() 
    {
        return applyDeptName;
    }

    public void setConfirmUserId(Long confirmUserId) 
    {
        this.confirmUserId = confirmUserId;
    }

    public Long getConfirmUserId() 
    {
        return confirmUserId;
    }

    public void setConfirmUserName(String confirmUserName) 
    {
        this.confirmUserName = confirmUserName;
    }

    public String getConfirmUserName() 
    {
        return confirmUserName;
    }

    public void setConfirmTime(Date confirmTime) 
    {
        this.confirmTime = confirmTime;
    }

    public Date getConfirmTime() 
    {
        return confirmTime;
    }

    public void setRejectReason(String rejectReason) 
    {
        this.rejectReason = rejectReason;
    }

    public String getRejectReason() 
    {
        return rejectReason;
    }

    public void setOrderStatus(String orderStatus) 
    {
        this.orderStatus = orderStatus;
    }

    public String getOrderStatus() 
    {
        return orderStatus;
    }

    public void setDelFlag(String delFlag) 
    {
        this.delFlag = delFlag;
    }

    public String getDelFlag() 
    {
        return delFlag;
    }

    public List<AmsReceiveOrderItem> getAmsReceiveOrderItemList()
    {
        return amsReceiveOrderItemList;
    }

    public void setAmsReceiveOrderItemList(List<AmsReceiveOrderItem> amsReceiveOrderItemList)
    {
        this.amsReceiveOrderItemList = amsReceiveOrderItemList;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("orderId", getOrderId())
            .append("receiveNo", getReceiveNo())
            .append("applicantId", getApplicantId())
            .append("applicantName", getApplicantName())
            .append("applyDeptId", getApplyDeptId())
            .append("applyDeptName", getApplyDeptName())
            .append("confirmUserId", getConfirmUserId())
            .append("confirmUserName", getConfirmUserName())
            .append("confirmTime", getConfirmTime())
            .append("rejectReason", getRejectReason())
            .append("orderStatus", getOrderStatus())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("delFlag", getDelFlag())
            .append("amsReceiveOrderItemList", getAmsReceiveOrderItemList())
            .toString();
    }
}
