package com.muchinfo.mtp3pojos.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

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

/**
 * <p>
 * 仓单贸易委托表 - 导历史
 * </p>
 *
 * @author XKF
 * @since 2024-08-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("WRTRADE_ORDERDETAIL")
@ApiModel(value="WrtradeOrderdetail对象", description="仓单贸易委托表 - 导历史")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class WrtradeOrderdetail extends Model<WrtradeOrderdetail> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)")
    private Long wrtradeorderid;

    @ApiModelProperty(value = "交易日(yyyyMMdd)")
    @TableField("TRADEDATE")
    private String tradedate;

    @ApiModelProperty(value = "仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)")
    @TableField("WRTRADETYPE")
    private Integer wrtradetype;

    @ApiModelProperty(value = "买卖 - 0:买 1:卖 ")
    @TableField("BUYORSELL")
    private Integer buyorsell;

    @ApiModelProperty(value = "关联委托单号(摘牌委托关联挂牌委托单ID)")
    @TableField("RELATEDWRTRADEORDERID")
    private Long relatedwrtradeorderid;

    @ApiModelProperty(value = "市场ID")
    @TableField("MARKETID")
    private Long marketid;

    @ApiModelProperty(value = "用户ID")
    @TableField("USERID")
    private Long userid;

    @ApiModelProperty(value = "资金账号")
    @TableField("ACCOUNTID")
    private Long accountid;

    @ApiModelProperty(value = "仓单要素类型ID/商品ID(77)")
    @TableField("WRFACTORTYPEID")
    private Long wrfactortypeid;

    @ApiModelProperty(value = "委托数量")
    @TableField("ORDERQTY")
    private BigDecimal orderqty;

    @ApiModelProperty(value = "成交数量")
    @TableField("TRADEQTY")
    private BigDecimal tradeqty;

    @ApiModelProperty(value = "撤销数量")
    @TableField("CANCELQTY")
    private BigDecimal cancelqty;

    @ApiModelProperty(value = "价格方式 - 1:固定价 2-浮动价  -   [挂牌]")
    @TableField("WRPRICETYPE")
    private Integer wrpricetype;

    @ApiModelProperty(value = "固定价格    -   [挂牌]")
    @TableField("FIXEDPRICE")
    private BigDecimal fixedprice;

    @ApiModelProperty(value = "是否指定对手 - 0:不指定 1:指定好友(贸易圈) 2:指定对手    -   [挂牌]")
    @TableField("ISSPECIFIED")
    private Integer isspecified;

    @ApiModelProperty(value = "价格系数(浮动价时填写)    -   [挂牌]")
    @TableField("PRICEFACTOR")
    private BigDecimal pricefactor;

    @ApiModelProperty(value = "升贴水(浮动价时填写)    -   [挂牌]")
    @TableField("PRICEMOVE")
    private BigDecimal pricemove;

    @ApiModelProperty(value = "首付比率 - [挂牌时指定,摘牌时使用]")
    @TableField("FIRSTRATIO")
    private BigDecimal firstratio;

    @ApiModelProperty(value = "仓单受让用户 - [摘牌]")
    @TableField("WRTRANSFERUSERID")
    private Long wrtransferuserid;

    @ApiModelProperty(value = "成交价格 - [摘牌] (浮动价  (（商品1价格*商品1价格系数+升贴水）* 商品1重量系数 + 商品2价格*商品2价格系数+商品2升贴水）* 商品2重量系数 ...)* 委托单价格系数 +　委托单升贴水)")
    @TableField("TRADEPRICE")
    private BigDecimal tradeprice;

    @ApiModelProperty(value = "冻结首付金额 - [摘牌]")
    @TableField("FREEZEFIRSTAMOUNT")
    private BigDecimal freezefirstamount;

    @ApiModelProperty(value = "解冻首付金额 - [摘牌]")
    @TableField("UNFREEZEFIRSTAMOUNT")
    private BigDecimal unfreezefirstamount;

    @ApiModelProperty(value = "履约计划模板ID")
    @TableField("PERFORMANCETEMPLATEID")
    private Long performancetemplateid;

    @ApiModelProperty(value = "有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效")
    @TableField("VALIDTYPE")
    private Integer validtype;

    @ApiModelProperty(value = "有效期限 ")
    @TableField("VALIDTIME")
    private Date validtime;

    @ApiModelProperty(value = "委托时间")
    @TableField("ORDERTIME")
    private Date ordertime;

    @ApiModelProperty(value = "撤销时间")
    @TableField("CANCELTIME")
    private Date canceltime;

    @ApiModelProperty(value = "委托状态 - 参考枚举'WRTradeOrderStatus' - 1:委托请求  2:待冻结  3:委托成功  4:委托失败  5:配对成功  6:已撤  7:部成  8:已成  9:部成部撤  10:成交失败  11:委托拒绝  12:经过摘牌(先摘后挂专用)  13:冻结成功(通道交易专用)  14:通道已撤  15:通道部成部撤  16:成交失败违约(荷兰式竞拍专用)  17:冻结PD成功  18:冻结PD失败  19:冻结能量成功  20:冻结能量失败  21:预约已报价  22:过期未付  23:优惠券处理中  24:仓单生成失败  25:首付扣款失败  26:履约失败  27:撤单解冻贷款失败")
    @TableField("WRTRADEORDERSTATUS")
    private Integer wrtradeorderstatus;

    @ApiModelProperty(value = "客户端流水号")
    @TableField("CLIENTTICKET")
    private String clientticket;

    @ApiModelProperty(value = "委托来源 - 1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结")
    @TableField("ORDERSRC")
    private Integer ordersrc;

    @ApiModelProperty(value = "客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) ")
    @TableField("CLIENTTYPE")
    private Integer clienttype;

    @ApiModelProperty(value = "发起端唯一id")
    @TableField("UUID")
    private String uuid;

    @ApiModelProperty(value = "客户端委托时间")
    @TableField("CLIENTORDERTIME")
    private Date clientordertime;

    @ApiModelProperty(value = "错误代码")
    @TableField("RETCODE")
    private Integer retcode;

    @ApiModelProperty(value = "操作员ID")
    @TableField("OPERATORID")
    private Long operatorid;

    @ApiModelProperty(value = "浮动价显示方式 - 1:合并显示 2:分开显示 1: 价格显示一个值 ：(商品拟合价*价格系统+升贴水) 2: 价格显示两个值：(商品拟合价*价格系统)  、 升贴水")
    @TableField("PRICEDISPLAYMODE")
    private Integer pricedisplaymode;

    @ApiModelProperty(value = "冻结保证金")
    @TableField("FREEZEMARGIN")
    private BigDecimal freezemargin;

    @ApiModelProperty(value = "解冻保证金")
    @TableField("UNFREEZEMARGIN")
    private BigDecimal unfreezemargin;

    @ApiModelProperty(value = "冻结手续费")
    @TableField("FREEZECHARGE")
    private BigDecimal freezecharge;

    @ApiModelProperty(value = "解冻手续费")
    @TableField("UNFREEZECHARGE")
    private BigDecimal unfreezecharge;

    @ApiModelProperty(value = "保证金方式 - 1：比率  2：固定")
    @TableField("MARGINALGORITHM")
    private Integer marginalgorithm;

    @ApiModelProperty(value = "保证金设置值")
    @TableField("MARGINVALUE")
    private BigDecimal marginvalue;

    @ApiModelProperty(value = "手续费收取方式 1：比率  2：固定")
    @TableField("CHARGEALGORITHM")
    private Integer chargealgorithm;

    @ApiModelProperty(value = "手续费设置值(交易所部分)")
    @TableField("CHARGEALGORITHMVALUE")
    private BigDecimal chargealgorithmvalue;

    @ApiModelProperty(value = "手续费设置值(会员部分)")
    @TableField("CHARGEALGORITHMVALUE2")
    private BigDecimal chargealgorithmvalue2;

    @ApiModelProperty(value = "是否可议价 - 0:不可 1:可")
    @TableField("CANBARGAIN")
    private Integer canbargain;

    @ApiModelProperty(value = "议价申请单ID")
    @TableField("WRBARGAINID")
    private Long wrbargainid;

    @ApiModelProperty(value = "附件1")
    @TableField("ATTACHMENT1")
    private String attachment1;

    @ApiModelProperty(value = "附件2")
    @TableField("ATTACHMENT2")
    private String attachment2;

    @ApiModelProperty(value = "备注")
    @TableField("REMARK")
    private String remark;

    @ApiModelProperty(value = "申请单ID")
    @TableField("APPLYID")
    private Long applyid;

    @ApiModelProperty(value = "交货模式 - 1:履约计划 2:分步履约 3:分步提货[文昌]")
    @TableField("PERFORMANCEWAY")
    private Integer performanceway;

    @ApiModelProperty(value = "买方释放比率[2:分步履约]")
    @TableField("BUYRELEASERATIO")
    private BigDecimal buyreleaseratio;

    @ApiModelProperty(value = "卖方释放比率[2:分步履约]")
    @TableField("SELLRELEASERATIO")
    private BigDecimal sellreleaseratio;

    @ApiModelProperty(value = "执行方式[2:分步履约] - 1:顺序执行 2:交叉执行")
    @TableField("EXECUTEMODE")
    private Integer executemode;

    @ApiModelProperty(value = "执行方[2:分步履约] - 1:买方 2:卖方")
    @TableField("EXECUTESIDE")
    private Integer executeside;

    @ApiModelProperty(value = "最小执行量[2:分步履约]")
    @TableField("MINQTY")
    private Integer minqty;

    @ApiModelProperty(value = "合同期限[2:分步履约]")
    @TableField("HOLDDAYS")
    private Integer holddays;

    @ApiModelProperty(value = "仓单类型 - 1:无仓单 2:有仓单 3;有无仓单均可")
    @TableField("AUCTIONWRTYPE")
    private Integer auctionwrtype;

    @ApiModelProperty(value = "是否有仓单-卖方 - 0:无仓单 1:有仓单")
    @TableField("HASWR")
    private Integer haswr;

    @ApiModelProperty(value = "限制价格 - 浮动价，买方为最高价，卖方为最低价")
    @TableField("LIMITEDPRICE")
    private BigDecimal limitedprice;

    @ApiModelProperty(value = "是否允许部份摘牌 - 0:不允许 1:允许")
    @TableField("CANPART")
    private Integer canpart;

    @ApiModelProperty(value = "关联仓单ID")
    @TableField("WRID")
    private Long wrid;

    @ApiModelProperty(value = "交收月(yyyy-MM) [无仓单HasWR =0]")
    @TableField("DELIVERYMONTH")
    private String deliverymonth;

    @ApiModelProperty(value = "现货品种ID")
    @TableField("DELIVERYGOODSID")
    private Long deliverygoodsid;

    @ApiModelProperty(value = "现货商品ID")
    @TableField("WRSTANDARDID")
    private Long wrstandardid;

    @ApiModelProperty(value = "起摘数量")
    @TableField("DELISTMINQTY")
    private Long delistminqty;

    @ApiModelProperty(value = "挂牌是否指定保证金 - 0:未指定 1:指定")
    @TableField("MARGINFLAG")
    private Integer marginflag;

    @ApiModelProperty(value = "是否全好友可见 - 0:否 1:是")
    @TableField("ALLFRIENDSFLAG")
    private Integer allfriendsflag;

    @ApiModelProperty(value = "关联预售申请ID[47:仓单预售]")
    @TableField("PRESALEAPPLYID")
    private BigDecimal presaleapplyid;

    @ApiModelProperty(value = "预售类型 - 1:摇号 2:配售[47:仓单预售]")
    @TableField("PRESALETYPE")
    private Integer presaletype;

    @ApiModelProperty(value = "汇率[67]")
    @TableField("EXCHANGERATE")
    private BigDecimal exchangerate;

    @ApiModelProperty(value = "挂牌金额[账户] [67= OrderQty * FixedPrice * ExchangeRate /100]")
    @TableField("ORDERAMOUNT")
    private BigDecimal orderamount;


    @Override
    public Serializable pkVal() {
        return this.wrtradeorderid;
    }

}
