TradeOrder.java 5.15 KB
package com.diligrp.cashier.trade.model;

import com.diligrp.cashier.pipeline.type.CashierType;
import com.diligrp.cashier.shared.domain.BaseDO;
import com.diligrp.cashier.shared.type.SourceType;

import java.time.LocalDateTime;

/**
 * 交易订单数据模型
 */
public class TradeOrder extends BaseDO {
    // 商户ID
    private Long mchId;
    // 交易ID
    private String tradeId;
    // 交易类型
    private Integer type;
    // 外部流水号
    private String outTradeNo;
    // 金额-分
    private Long amount;
    // 初始金额-分
    private Long maxAmount;
    // 商品描述
    private String goods;
    // 订单超时时间-秒
    private Integer timeout;
    // 交易状态
    private Integer state;
    // 业务回调地址
    private String notifyUrl;
    // 交易备注
    private String description;
    // 附加数据
    private String attach;
    // 收银台来源
    private Integer source;

    public Long getMchId() {
        return mchId;
    }

    public void setMchId(Long mchId) {
        this.mchId = mchId;
    }

    public String getTradeId() {
        return tradeId;
    }

    public void setTradeId(String tradeId) {
        this.tradeId = tradeId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public Long getAmount() {
        return amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    public Long getMaxAmount() {
        return maxAmount;
    }

    public void setMaxAmount(Long maxAmount) {
        this.maxAmount = maxAmount;
    }

    public String getGoods() {
        return goods;
    }

    public void setGoods(String goods) {
        this.goods = goods;
    }

    public Integer getTimeout() {
        return timeout;
    }

    public void setTimeout(Integer timeout) {
        this.timeout = timeout;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public static Builder builder() {
        return new TradeOrder().new Builder();
    }

    public class Builder {
        public Builder mchId(Long mchId) {
            TradeOrder.this.mchId = mchId;
            return this;
        }

        public Builder tradeId(String tradeId) {
            TradeOrder.this.tradeId = tradeId;
            return this;
        }

        public Builder type(CashierType type) {
            TradeOrder.this.type = type.getCode();
            return this;
        }

        public Builder outTradeNo(String outTradeNo) {
            TradeOrder.this.outTradeNo = outTradeNo;
            return this;
        }

        public Builder amount(Long amount) {
            TradeOrder.this.amount = amount;
            return this;
        }

        public Builder maxAmount(Long maxAmount) {
            TradeOrder.this.maxAmount = maxAmount;
            return this;
        }

        public Builder goods(String goods) {
            TradeOrder.this.goods = goods;
            return this;
        }

        public Builder timeout(Integer timeout) {
            TradeOrder.this.timeout = timeout;
            return this;
        }

        public Builder state(Integer state) {
            TradeOrder.this.state = state;
            return this;
        }

        public Builder notifyUrl(String notifyUrl) {
            TradeOrder.this.notifyUrl = notifyUrl;
            return this;
        }

        public Builder description(String description) {
            TradeOrder.this.description = description;
            return this;
        }

        public Builder attach(String attach) {
            TradeOrder.this.attach = attach;
            return this;
        }

        public Builder source(SourceType source) {
            TradeOrder.this.source = source != null ? source.getCode() : null;
            return this;
        }

        public Builder version(Integer version) {
            TradeOrder.this.version = version;
            return this;
        }

        public Builder createdTime(LocalDateTime createdTime) {
            TradeOrder.this.createdTime = createdTime;
            return this;
        }

        public Builder modifiedTime(LocalDateTime modifiedTime) {
            TradeOrder.this.modifiedTime = modifiedTime;
            return this;
        }

        public TradeOrder build() {
            return TradeOrder.this;
        }
    }
}