package com.muchinfo.mtp3pojos.entity;

import com.baomidou.mybatisplus.annotation.TableField;
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;

/**
 * <p>
 * 资金账户日照表
 * </p>
 *
 * @author XKF
 * @since 2024-08-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("RECKON_DAYTAACCOUNT")
@ApiModel(value="ReckonDaytaaccount对象", description="资金账户日照表")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ReckonDaytaaccount extends Model<ReckonDaytaaccount> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "资金账户ID")
    private Long accountid;

    @ApiModelProperty(value = "日照日期(yyyyMMdd)")
    @TableField("RECKONDATE")
    private String reckondate;

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

    @ApiModelProperty(value = "货币ID")
    @TableField("CURRENCYID")
    private Long currencyid;

    @ApiModelProperty(value = "变动标志(当前账户资金有任何变动更新为1系统结算时更新0;供清算时使用) 0：无变动 1：有变动 ")
    @TableField("CHANGEFLAG")
    private Integer changeflag;

    @ApiModelProperty(value = "资金密码")
    @TableField("PASSWORD")
    private String password;

    @ApiModelProperty(value = "交易状态 - 1:正常 2:受限 3:冻结 4:禁止建仓(人工受限) 5:禁止交易(人工冻结) ")
    @TableField("TRADESTATUS")
    private Integer tradestatus;

    @ApiModelProperty(value = "签约状态 - 1:未签约  2:已签约  3:已解约")
    @TableField("SIGNSTATUS")
    private Integer signstatus;

    @ApiModelProperty(value = "是否账号 0:不是母账户 1:是母账户")
    @TableField("ISMAIN")
    private Integer ismain;

    @ApiModelProperty(value = "所属根账户")
    @TableField("PARENTACCOUNTID")
    private Long parentaccountid;

    @ApiModelProperty(value = "关联用户")
    @TableField("RELATEUSERID")
    private Long relateuserid;

    @ApiModelProperty(value = "关联用户交易状态 - 1:正常(可交易) 2:受限(可平仓，不可建仓) 3:冻结(不可交易)")
    @TableField("RELATEDACCOUNTSTATUS")
    private Integer relatedaccountstatus;

    @ApiModelProperty(value = "外部/内部账号 - 1:外部账号 2:内部账号")
    @TableField("TAACCOUNTTYPE")
    private Integer taaccounttype;

    @ApiModelProperty(value = "是否机构分润账号 0:不是 1:是")
    @TableField("ISRECKONACCOUNT")
    private Integer isreckonaccount;

    @ApiModelProperty(value = "是否机构接单账号 0:不是 1:是")
    @TableField("ISMARKETACCOUNT")
    private Integer ismarketaccount;

    @ApiModelProperty(value = "期初余额")
    @TableField("BALANCE")
    private BigDecimal balance;

    @ApiModelProperty(value = "期初冻结保证金")
    @TableField("ORIFREEZEMARGIN")
    private BigDecimal orifreezemargin;

    @ApiModelProperty(value = "期初占用保证金")
    @TableField("ORIUSEDMARGIN")
    private BigDecimal oriusedmargin;

    @ApiModelProperty(value = "期初其他冻结保证金(出金冻结资金 交割买方冻结 申购冻结 全款买入 商城买入)")
    @TableField("ORIOTHERFREEZEMARGIN")
    private BigDecimal oriotherfreezemargin;

    @ApiModelProperty(value = "期初手续费冻结")
    @TableField("ORIFREEZECHARGE")
    private BigDecimal orifreezecharge;

    @ApiModelProperty(value = "期初授信金额")
    @TableField("ORIMORTGAGECREDIT")
    private BigDecimal orimortgagecredit;

    @ApiModelProperty(value = "期初其它授信金额")
    @TableField("ORIOTHERCREDIT")
    private BigDecimal oriothercredit;

    @ApiModelProperty(value = "期初出金冻结")
    @TableField("ORIOUTAMOUNTFREEZE")
    private BigDecimal orioutamountfreeze;

    @ApiModelProperty(value = "期末余额")
    @TableField("CURRENTBALANCE")
    private BigDecimal currentbalance;

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

    @ApiModelProperty(value = "占用保证金")
    @TableField("USEDMARGIN")
    private BigDecimal usedmargin;

    @ApiModelProperty(value = "其他冻结保证金(出金冻结资金 交割买方冻结 申购冻结 全款买入 商城买入)")
    @TableField("OTHERFREEZEMARGIN")
    private BigDecimal otherfreezemargin;

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

    @ApiModelProperty(value = "授信金额")
    @TableField("MORTGAGECREDIT")
    private BigDecimal mortgagecredit;

    @ApiModelProperty(value = "其它授信金额")
    @TableField("OTHERCREDIT")
    private BigDecimal othercredit;

    @ApiModelProperty(value = "出金冻结")
    @TableField("OUTAMOUNTFREEZE")
    private BigDecimal outamountfreeze;

    @ApiModelProperty(value = "今日入金金额")
    @TableField("INAMOUNT")
    private BigDecimal inamount;

    @ApiModelProperty(value = "今日出金金额")
    @TableField("OUTAMOUNT")
    private BigDecimal outamount;

    @ApiModelProperty(value = "今日手续费支出")
    @TableField("PAYCHARGE")
    private BigDecimal paycharge;

    @ApiModelProperty(value = "今日平仓盈亏")
    @TableField("CLOSEPL")
    private BigDecimal closepl;

    @ApiModelProperty(value = "今日结算盈亏")
    @TableField("RECKONPL")
    private BigDecimal reckonpl;

    @ApiModelProperty(value = "今日授信增加")
    @TableField("CREDITINCREASE")
    private BigDecimal creditincrease;

    @ApiModelProperty(value = "今日授信减少")
    @TableField("CREDITDECREASE")
    private BigDecimal creditdecrease;

    @ApiModelProperty(value = "今日其它授信增加")
    @TableField("OTHERCREDITINCREASE")
    private BigDecimal othercreditincrease;

    @ApiModelProperty(value = "今日其它授信减少")
    @TableField("OTHERCREDITDECREASE")
    private BigDecimal othercreditdecrease;

    @ApiModelProperty(value = "其他支出(交割付款 申购付款 全款买入 商城买入 卖家退货)")
    @TableField("OTHERPAY")
    private BigDecimal otherpay;

    @ApiModelProperty(value = "其他收入(交割收款 申购收款 全款卖出 商城卖出 买家退货 会员手续费收入)")
    @TableField("OTHERINCOME")
    private BigDecimal otherincome;

    @ApiModelProperty(value = "今日划转金额(母子账号资金划转，从账号划入为正，从账号划出为负)")
    @TableField("TRANSFERAMOUNT")
    private BigDecimal transferamount;

    @ApiModelProperty(value = "出金阈值")
    @TableField("OUTTHRESHOLD")
    private BigDecimal outthreshold;

    @ApiModelProperty(value = "清算余额 = 期末余额 - 授信金额 - 其它授信金额")
    @TableField("CLEARBALANCE")
    private BigDecimal clearbalance;

    @ApiModelProperty(value = "今日已收手续费分成")
    @TableField("DIVIDEDCHARGE")
    private BigDecimal dividedcharge;

    @ApiModelProperty(value = "今日应付交易所手续费")
    @TableField("PAYEXCHCHARGE")
    private BigDecimal payexchcharge;

    @ApiModelProperty(value = "真实资金变动值(除出入金、应付交易所手续费) 清算盈亏 = 期末余额 - 期初余额 - (今日入金 + 今日出金) - 今日应付交易所手续费 - 【(今日授信增加 + 今日授信减少) - (今日其它授信增加 + 今日其它授信减少) ----母账户】= 今日手续费支出 + 今日平仓盈亏 + 今日结算盈亏 + 其他支出 + 其他收入 + 今日划转金额 + 今日已收手续费分成 - 今日应付交易所手续费")
    @TableField("CLEARPL")
    private BigDecimal clearpl;

    @ApiModelProperty(value = "今日三方入金")
    @TableField("THIRDINAMOUNT")
    private BigDecimal thirdinamount;

    @ApiModelProperty(value = "今日交易手续费支出 [101,102]")
    @TableField("TRADECHARGE")
    private BigDecimal tradecharge;

    @ApiModelProperty(value = "今日递延费支出[103, 104]")
    @TableField("INTERESTCHARGE")
    private BigDecimal interestcharge;

    @ApiModelProperty(value = "今日交收手续费支出 [105,106]")
    @TableField("DELIVERYCHARGE")
    private BigDecimal deliverycharge;

    @ApiModelProperty(value = "今日持仓过夜费支出[108,109,110]")
    @TableField("HOLDCHARGE")
    private BigDecimal holdcharge;

    @ApiModelProperty(value = "今日三方出金")
    @TableField("THIRDOUTAMOUNT")
    private BigDecimal thirdoutamount;

    @ApiModelProperty(value = "今日成交量 - 作废:数据量大汇总有性能问题")
    @TableField("TRADEQTY")
    private Long tradeqty;

    @ApiModelProperty(value = "今日成交金额 - 作废:数据量大汇总有性能问题")
    @TableField("TRADEAMOUNT")
    private BigDecimal tradeamount;

    @ApiModelProperty(value = "今日交收货款支出 - 作废:数据量大汇总有性能问题")
    @TableField("DELIVERYAMOUNTOUT")
    private BigDecimal deliveryamountout;

    @ApiModelProperty(value = "今日交收货款收入 - 作废:数据量大汇总有性能问题")
    @TableField("DELIVERYAMOUNTIN")
    private BigDecimal deliveryamountin;

    @ApiModelProperty(value = "今日交收补偿费支出 - 作废:数据量大汇总有性能问题")
    @TableField("DELIVERYCOMPENSATIONFEEOUT")
    private BigDecimal deliverycompensationfeeout;

    @ApiModelProperty(value = "今日交收补偿费收入 - 作废:数据量大汇总有性能问题")
    @TableField("DELIVERYCOMPENSATIONFEEIN")
    private BigDecimal deliverycompensationfeein;

    @ApiModelProperty(value = "本金余额[外部子账户实际出入金余额]")
    @TableField("CAPITALBALANCE")
    private BigDecimal capitalbalance;

    @ApiModelProperty(value = "平仓盈亏(逐笔)")
    @TableField("CLOSEPL2")
    private BigDecimal closepl2;

    @ApiModelProperty(value = "结算盈亏(逐笔)  - 汇总取期末")
    @TableField("RECKONPL2")
    private BigDecimal reckonpl2;

    @ApiModelProperty(value = "净值  = 期末余额 + 所有权市值 + 仓单市值 仓单市值由统计服务更新")
    @TableField("NETVALUE")
    private BigDecimal netvalue;

    @ApiModelProperty(value = "今日手续费支出(外部配置)")
    @TableField("PAYCHARGE2")
    private BigDecimal paycharge2;

    @ApiModelProperty(value = "今日递延费2支出[111, 112]")
    @TableField("DEFERCHARGE")
    private BigDecimal defercharge;

    @ApiModelProperty(value = "所属上级账户")
    @TableField("FROMACCOUNTID")
    private Long fromaccountid;

    @ApiModelProperty(value = "账号层级路径(逗号分隔,首尾加逗号)")
    @TableField("SUBLEVELPATH")
    private String sublevelpath;

    @ApiModelProperty(value = "所有权市值")
    @TableField("OWNERSHIPVALUE")
    private BigDecimal ownershipvalue;

    @ApiModelProperty(value = "现货市值-统计服务更新")
    @TableField("SPOTVALUE")
    private BigDecimal spotvalue;

    @ApiModelProperty(value = "今日账户盈亏 = 今日净值-昨日净值+今日出金-今日入金-今日划转+今日授信减少-今日授信增加+今日其它授信减少-今日其它授信增加+今日三方出金-今日三方入金; 由统计服务更新")
    @TableField("ACCOUNTPL")
    private BigDecimal accountpl;

    @ApiModelProperty(value = "账户名称")
    @TableField("ACCOUNTNAME")
    private String accountname;

    @ApiModelProperty(value = "期初欠款")
    @TableField("ORIDEBT")
    private BigDecimal oridebt;

    @ApiModelProperty(value = "期末欠款")
    @TableField("CURDEBT")
    private BigDecimal curdebt;

    @ApiModelProperty(value = "可用资金")
    @TableField("AVAIABLEMONEY")
    private BigDecimal avaiablemoney;

    @ApiModelProperty(value = "可出资金")
    @TableField("AVAIABLEOUTMONEY")
    private BigDecimal avaiableoutmoney;

    @ApiModelProperty(value = "浮动盈亏 - 每日有负债类商品")
    @TableField("FLOATPL")
    private BigDecimal floatpl;

    @ApiModelProperty(value = "浮动净值 = 净值 + 浮动盈亏")
    @TableField("FLOATNETVALUE")
    private BigDecimal floatnetvalue;

    @ApiModelProperty(value = "风险率 = 占用/ 浮动净值 或  浮动净值/占用")
    @TableField("RISKRATE")
    private BigDecimal riskrate;


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

}
