View Javadoc
1   package com.foxinmy.weixin4j.pay.payment.mch;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.util.DateUtil;
5   
6   import javax.xml.bind.annotation.XmlAccessType;
7   import javax.xml.bind.annotation.XmlAccessorType;
8   import javax.xml.bind.annotation.XmlElement;
9   import javax.xml.bind.annotation.XmlRootElement;
10  import java.util.Date;
11  
12  /**
13   * 发送红包结果
14   * 
15   * @className RedpacketSendResult
16   * @author jinyu(foxinmy@gmail.com)
17   * @date 2015年4月1日
18   * @since JDK 1.6
19   * @see
20   */
21  @XmlRootElement
22  @XmlAccessorType(XmlAccessType.FIELD)
23  public class RedpacketSendResult extends MerchantResult {
24  
25  	private static final long serialVersionUID = 5611847899634131711L;
26  	/**
27  	 * 商户订单号(每个订单号必须唯一) 组成: mch_id+yyyymmdd+10位一天内不能重复的数字。
28  	 */
29  	@XmlElement(name = "mch_billno")
30  	@JSONField(name = "mch_billno")
31  	private String outTradeNo;
32  	/**
33  	 * 接收红包的用户的openid
34  	 */
35  	@XmlElement(name = "re_openid")
36  	@JSONField(name = "re_openid")
37  	private String openId;
38  	/**
39  	 * 付款金额 单位为分
40  	 */
41  	@XmlElement(name = "total_amount")
42  	@JSONField(name = "total_amount")
43  	private int totalAmount;
44  	/**
45  	 * 发放成功时间
46  	 */
47  	@XmlElement(name = "send_time")
48  	@JSONField(name = "send_time")
49  	private String sendTime;
50  	/**
51  	 * 微信单号
52  	 */
53  	@XmlElement(name = "send_listid")
54  	@JSONField(name = "send_listid")
55  	private String sendListid;
56  
57  	protected RedpacketSendResult() {
58  		// jaxb required
59  	}
60  
61  	public String getOutTradeNo() {
62  		return outTradeNo;
63  	}
64  
65  	public void setOutTradeNo(String outTradeNo) {
66  		this.outTradeNo = outTradeNo;
67  	}
68  
69  	public String getOpenId() {
70  		return openId;
71  	}
72  
73  	public void setOpenId(String openId) {
74  		this.openId = openId;
75  	}
76  
77  	public int getTotalAmount() {
78  		return totalAmount;
79  	}
80  
81  	public void setTotalAmount(int totalAmount) {
82  		this.totalAmount = totalAmount;
83  	}
84  
85  	/**
86  	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
87  	 * 
88  	 * @return 元单位
89  	 */
90  	@JSONField(serialize = false)
91  	public double getFormatTotalAmount() {
92  		return totalAmount / 100d;
93  	}
94  
95  	public String getSendTime() {
96  		return sendTime;
97  	}
98  
99  	public void setSendTime(String sendTime) {
100 		this.sendTime = sendTime;
101 	}
102 
103 	@JSONField(serialize = false)
104 	public Date getFormatSendTime() {
105 		return DateUtil.parse2yyyyMMddHHmmss(sendTime);
106 	}
107 
108 	public String getSendListid() {
109 		return sendListid;
110 	}
111 
112 	public void setSendListid(String sendListid) {
113 		this.sendListid = sendListid;
114 	}
115 
116 	@Override
117 	public String toString() {
118 		return "RedpacketSendResult [outTradeNo=" + outTradeNo + ", openId="
119 				+ openId + ", totalAmount=" + totalAmount + ", "
120 				+ super.toString() + "]";
121 	}
122 }