package com.bohuikeji.delivery.backstage.entity.baidu;


import cn.hutool.json.JSONUtil;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 招商加盟入驻轮播
 * </p>
 * @author 10552
 * @since 2019-08-22
 */
@Data
@Accessors(chain = true)
@ApiModel(value="BaiDuOrderInfo对象", description="百度支付收银台支付")
public class BaiDuOrderInfo{
    @ApiModelProperty(value = "百度收银台的财务结算凭证")
    private String dealId;
    @ApiModelProperty(value = "支付AppKey")
    private String appKey;
    @ApiModelProperty(value = "订单金额（单位：人民币分）")
    private String totalAmount;
    @ApiModelProperty(value = "小程序开发者系统创建的唯一订单 ID")
    private String tpOrderId;
    @ApiModelProperty(value = "通知开发者支付状态的回调地址")
    private String notifyUrl;
    @ApiModelProperty(value = "订单的名称")
    private String dealTitle;
    @ApiModelProperty(value = "用于区分验签字段范围，signFieldsRange 的值：0：原验签字段 appKey+dealId+tpOrderId；1：包含 totalAmount 的验签，验签字段包括appKey+dealId+tpOrderId+totalAmount。固定值为 1")
    private String signFieldsRange;
    @ApiModelProperty(value = "进行 RSA 加密后的签名")
    private String rsaSign;
    @ApiModelProperty(value = "订单详细信息")
    private String bizInfo;

    //这里写一个方法，提供传入bizInfo对象来给this.bizInfo的值，当然也可以直接使用set方法赋值
    public void setBaiDuBizInfo(BaiDuBizInfo bizInfo) {
        String json = JSONUtil.toJsonStr(bizInfo);
        StringBuffer buffer = new StringBuffer("{\"tpData\":");
        buffer.append(json);
        buffer.append("}");
        this.setBizInfo(buffer.toString());
    }
}
