package cn.pluss.platform.dto;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import cn.pluss.platform.entity.DeviceMerchantBuy;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author yuchen
 * 
 * @Description
 */
@Data
public class DeviceMerchantBuyDTO {

    @ApiModelProperty(value = "订单金额")
    private Double orderAmount;

    @ApiModelProperty(value = "购买数量")
    private Integer quantity;

    @ApiModelProperty(value = "设备code")
    private String code;

    @ApiModelProperty(value = "设备唯一识别码")
    private String venderCode;

    @ApiModelProperty(value = "厂家型号")
    private String venderModel;

    @ApiModelProperty(value = "省市区")
    private String provinces;

    @ApiModelProperty(value = "支付方式")
    private String payCode;

    @ApiModelProperty(value = "支付名称")
    private String payName;

    @ApiModelProperty(value = "详细地址")
    private String address;

    @ApiModelProperty(value = "联系人姓名")
    private String linkName;

    @ApiModelProperty(value = "联系人手机号")
    private String linkPhone;

    @ApiModelProperty(value = "邮箱")
    private String email;

    /**
     * 规格类别
     */
    private String type;

    /**
     * 订单类型, 1: 押金购买
     */
    private String orderType;

    public Map<String, String> convert(String orderNo) {
        Map<String, String> result = new HashMap<String, String>(16);
        result.put("body", "收银呗商品订单支付");
        result.put("subject", "收银呗商品订单支付");
        result.put("outTradeNo", orderNo);
        result.put("totalAmount", orderAmount + "");
        return result;
    }

    public DeviceMerchantBuy convertDeviceMerchantBuy() {
        DeviceMerchantBuy deviceMerchantBuy = new DeviceMerchantBuy();
        deviceMerchantBuy.setOrderAmount(orderAmount);
        deviceMerchantBuy.setQuantity(quantity);
        deviceMerchantBuy.setVenderCode(venderCode);
        deviceMerchantBuy.setVenderModel(venderModel);
        deviceMerchantBuy.setProvinces(provinces);
        deviceMerchantBuy.setPayCode(payCode);
        deviceMerchantBuy.setPayName(payName);
        //更改支付时间
        Calendar calendar = Calendar.getInstance();
        deviceMerchantBuy.setTransDt(calendar.getTime());
        deviceMerchantBuy.setAddress(address);
        deviceMerchantBuy.setLinkName(linkName);
        deviceMerchantBuy.setLinkPhone(linkPhone);
        deviceMerchantBuy.setStatus("0");
        deviceMerchantBuy.setEmail(email);
        return deviceMerchantBuy;
    }

}

