package com.ruoyi.order.domain;

import java.util.Date;

import cn.hutool.core.util.StrUtil;
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;

/**
 * 资产单据对象 tb_order
 * 
 * @author 原动力
 * @date 2023-05-24
 */
public class TbOrder extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 编号 */
    private Long id;

    /** 单据编号 */
    @Excel(name = "单据编号")
    private String orderNumber;

    /** 单据类型，0：未知：1：调整，2：调拨，3：借出，4：拆分， 5：闲置，6：启用，7：报废，8：变卖 */
    @Excel(name = "单据类型，0：未知：1：调整，2：调拨，3：借出，4：拆分， 5：闲置，6：启用，7：报废，8：变卖")
    private Long orderType;

    /** 资产总原值（元） */
    @Excel(name = "资产总原值", readConverterExp = "元=")
    private String assetTotalOriginalValue;

    /** 资产总净值（元） */
    @Excel(name = "资产总净值", readConverterExp = "元=")
    private String assetTotalNetValue;

    /** 申请日期 */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date applicationDate;

    /** 申请部门 */
    @Excel(name = "申请部门")
    private String applicationDepartment;

    /** 【调整】资产编号 */
    @Excel(name = "【调整】资产编号")
    private String adjustmentAssetNumber;

    /** 【调整】资产原信息，以JSON字符串格式存入提取 */
    @Excel(name = "【调整】资产原信息，以JSON字符串格式存入提取")
    private String adjustmentOriginalAssetInfo;

    /** 【调拨】调出部门 */
    @Excel(name = "【调拨】调出部门")
    private String allocationCallOutDepartment;

    /** 【调拨】调出经办人 */
    @Excel(name = "【调拨】调出经办人")
    private String allocationCallOutBy;

    /** 【调拨】调出日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "【调拨】调出日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date allocationCallOutDate;

    /** 【调拨】调入部门 */
    @Excel(name = "【调拨】调入部门")
    private String allocationCallInDepartment;

    /** 【调拨】调入经办人 */
    @Excel(name = "【调拨】调入经办人")
    private String allocationCallInBy;

    /** 【调拨】调入日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "【调拨】调入日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date allocationCallInDate;

    /** 【调拨】新管理人 */
    @Excel(name = "【调拨】新管理人")
    private String allocationNewResponsiblePerson;

    /** 【调拨】新功能位置编号 */
    @Excel(name = "【调拨】新功能位置编号")
    private String allocationNewLocationNumber;

    /** 【借出】借出部门 */
    @Excel(name = "【借出】借出部门")
    private String lendDepartment;

    /** 【借出】经手人 */
    @Excel(name = "【借出】经手人")
    private String lendBySponsor;

    /** 【借出】往来单位 */
    @Excel(name = "【借出】往来单位")
    private String lendPassingUnit;

    /** 原因说明 */
    @Excel(name = "原因说明")
    private String reason;

    /** 制单人 */
    @Excel(name = "制单人")
    private String preparedBy;

    /** 制单部门 */
    @Excel(name = "制单部门")
    private String preparedDepartment;

    /** 所属公司 */
    @Excel(name = "所属公司")
    private String corporation;

    /** 记录状态 */
    @Excel(name = "记录状态")
    private Long recordStatus;

    /** 获取资产调整单据 */
    public static void adjustmentOrder(TbOrder tbOrder) {
        if (tbOrder.getAdjustmentAssetNumber() == null || StrUtil.isBlank(tbOrder.getAdjustmentAssetNumber())) {
            return;
        }
        setNullAllocation(tbOrder);
        setNullLend(tbOrder);
    }

    /** 获取资产调拨单据 */
    public static void allocationOrder(TbOrder tbOrder) {
        setNullAdjustment(tbOrder);
        setNullLend(tbOrder);
    }

    /** 获取资产借用单据 */
    public static void lendOrder(TbOrder tbOrder) {
        setNullAdjustment(tbOrder);
        setNullAllocation(tbOrder);
    }

    /** 获取其他资产单据 */
    public static void otherOrder(TbOrder tbOrder) {
        setNullLend(tbOrder);
        setNullAllocation(tbOrder);
        setNullAdjustment(tbOrder);
    }

    private static void setNullAllocation(TbOrder tbOrder) {
        tbOrder.setAllocationCallInBy(null);
        tbOrder.setAllocationCallInDate(null);
        tbOrder.setAllocationCallInDepartment(null);
        tbOrder.setAllocationCallOutBy(null);
        tbOrder.setAllocationCallOutDate(null);
        tbOrder.setAllocationCallOutDepartment(null);
        tbOrder.setAllocationNewLocationNumber(null);
        tbOrder.setAllocationNewResponsiblePerson(null);
    }

    private static void setNullLend(TbOrder tbOrder) {
        tbOrder.setLendBySponsor(null);
        tbOrder.setLendDepartment(null);
        tbOrder.setLendPassingUnit(null);
    }

    private static void setNullAdjustment(TbOrder tbOrder) {
        tbOrder.setAdjustmentOriginalAssetInfo(null);
        tbOrder.setAdjustmentAssetNumber(null);
        tbOrder.setAssetTotalNetValue(null);
        tbOrder.setAssetTotalOriginalValue(null);
    }

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setOrderNumber(String orderNumber) 
    {
        this.orderNumber = orderNumber;
    }

    public String getOrderNumber() 
    {
        return orderNumber;
    }
    public void setOrderType(Long orderType) 
    {
        this.orderType = orderType;
    }

    public Long getOrderType() 
    {
        return orderType;
    }
    public void setAssetTotalOriginalValue(String assetTotalOriginalValue) 
    {
        this.assetTotalOriginalValue = assetTotalOriginalValue;
    }

    public String getAssetTotalOriginalValue() 
    {
        return assetTotalOriginalValue;
    }
    public void setAssetTotalNetValue(String assetTotalNetValue) 
    {
        this.assetTotalNetValue = assetTotalNetValue;
    }

    public String getAssetTotalNetValue() 
    {
        return assetTotalNetValue;
    }
    public void setApplicationDate(Date applicationDate) 
    {
        this.applicationDate = applicationDate;
    }

    public Date getApplicationDate() 
    {
        return applicationDate;
    }
    public void setApplicationDepartment(String applicationDepartment) 
    {
        this.applicationDepartment = applicationDepartment;
    }

    public String getApplicationDepartment() 
    {
        return applicationDepartment;
    }
    public void setAdjustmentAssetNumber(String adjustmentAssetNumber) 
    {
        this.adjustmentAssetNumber = adjustmentAssetNumber;
    }

    public String getAdjustmentAssetNumber() 
    {
        return adjustmentAssetNumber;
    }
    public void setAdjustmentOriginalAssetInfo(String adjustmentOriginalAssetInfo) 
    {
        this.adjustmentOriginalAssetInfo = adjustmentOriginalAssetInfo;
    }

    public String getAdjustmentOriginalAssetInfo() 
    {
        return adjustmentOriginalAssetInfo;
    }
    public void setAllocationCallOutDepartment(String allocationCallOutDepartment) 
    {
        this.allocationCallOutDepartment = allocationCallOutDepartment;
    }

    public String getAllocationCallOutDepartment() 
    {
        return allocationCallOutDepartment;
    }
    public void setAllocationCallOutBy(String allocationCallOutBy) 
    {
        this.allocationCallOutBy = allocationCallOutBy;
    }

    public String getAllocationCallOutBy() 
    {
        return allocationCallOutBy;
    }
    public void setAllocationCallOutDate(Date allocationCallOutDate) 
    {
        this.allocationCallOutDate = allocationCallOutDate;
    }

    public Date getAllocationCallOutDate() 
    {
        return allocationCallOutDate;
    }
    public void setAllocationCallInDepartment(String allocationCallInDepartment) 
    {
        this.allocationCallInDepartment = allocationCallInDepartment;
    }

    public String getAllocationCallInDepartment() 
    {
        return allocationCallInDepartment;
    }
    public void setAllocationCallInBy(String allocationCallInBy) 
    {
        this.allocationCallInBy = allocationCallInBy;
    }

    public String getAllocationCallInBy() 
    {
        return allocationCallInBy;
    }
    public void setAllocationCallInDate(Date allocationCallInDate) 
    {
        this.allocationCallInDate = allocationCallInDate;
    }

    public Date getAllocationCallInDate() 
    {
        return allocationCallInDate;
    }
    public void setAllocationNewResponsiblePerson(String allocationNewResponsiblePerson) 
    {
        this.allocationNewResponsiblePerson = allocationNewResponsiblePerson;
    }

    public String getAllocationNewResponsiblePerson() 
    {
        return allocationNewResponsiblePerson;
    }
    public void setAllocationNewLocationNumber(String allocationNewLocationNumber) 
    {
        this.allocationNewLocationNumber = allocationNewLocationNumber;
    }

    public String getAllocationNewLocationNumber() 
    {
        return allocationNewLocationNumber;
    }
    public void setLendDepartment(String lendDepartment) 
    {
        this.lendDepartment = lendDepartment;
    }

    public String getLendDepartment() 
    {
        return lendDepartment;
    }
    public void setLendBySponsor(String lendBySponsor) 
    {
        this.lendBySponsor = lendBySponsor;
    }

    public String getLendBySponsor() 
    {
        return lendBySponsor;
    }
    public void setLendPassingUnit(String lendPassingUnit) 
    {
        this.lendPassingUnit = lendPassingUnit;
    }

    public String getLendPassingUnit() 
    {
        return lendPassingUnit;
    }
    public void setReason(String reason) 
    {
        this.reason = reason;
    }

    public String getReason() 
    {
        return reason;
    }
    public void setPreparedBy(String preparedBy) 
    {
        this.preparedBy = preparedBy;
    }

    public String getPreparedBy() 
    {
        return preparedBy;
    }
    public void setPreparedDepartment(String preparedDepartment) 
    {
        this.preparedDepartment = preparedDepartment;
    }

    public String getPreparedDepartment() 
    {
        return preparedDepartment;
    }
    public void setCorporation(String corporation) 
    {
        this.corporation = corporation;
    }

    public String getCorporation() 
    {
        return corporation;
    }
    public void setRecordStatus(Long recordStatus) 
    {
        this.recordStatus = recordStatus;
    }

    public Long getRecordStatus() 
    {
        return recordStatus;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("orderNumber", getOrderNumber())
            .append("orderType", getOrderType())
            .append("assetTotalOriginalValue", getAssetTotalOriginalValue())
            .append("assetTotalNetValue", getAssetTotalNetValue())
            .append("applicationDate", getApplicationDate())
            .append("applicationDepartment", getApplicationDepartment())
            .append("adjustmentAssetNumber", getAdjustmentAssetNumber())
            .append("adjustmentOriginalAssetInfo", getAdjustmentOriginalAssetInfo())
            .append("allocationCallOutDepartment", getAllocationCallOutDepartment())
            .append("allocationCallOutBy", getAllocationCallOutBy())
            .append("allocationCallOutDate", getAllocationCallOutDate())
            .append("allocationCallInDepartment", getAllocationCallInDepartment())
            .append("allocationCallInBy", getAllocationCallInBy())
            .append("allocationCallInDate", getAllocationCallInDate())
            .append("allocationNewResponsiblePerson", getAllocationNewResponsiblePerson())
            .append("allocationNewLocationNumber", getAllocationNewLocationNumber())
            .append("lendDepartment", getLendDepartment())
            .append("lendBySponsor", getLendBySponsor())
            .append("lendPassingUnit", getLendPassingUnit())
            .append("reason", getReason())
            .append("preparedBy", getPreparedBy())
            .append("preparedDepartment", getPreparedDepartment())
            .append("corporation", getCorporation())
            .append("recordStatus", getRecordStatus())
            .toString();
    }
}
