1 package com.foxinmy.weixin4j.pay.payment.mch;
2
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.foxinmy.weixin4j.http.weixin.XmlResult;
5 import com.foxinmy.weixin4j.pay.type.mch.RedpacketSendType;
6 import com.foxinmy.weixin4j.pay.type.mch.RedpacketStatus;
7 import com.foxinmy.weixin4j.pay.type.mch.RedpacketType;
8 import com.foxinmy.weixin4j.util.DateUtil;
9
10 import javax.xml.bind.annotation.*;
11 import java.io.Serializable;
12 import java.util.Date;
13 import java.util.List;
14
15
16
17
18
19
20
21
22
23
24 @XmlRootElement
25 @XmlAccessorType(XmlAccessType.FIELD)
26 public class RedpacketRecord extends XmlResult {
27
28 private static final long serialVersionUID = 929959747323918458L;
29
30
31
32
33 @XmlElement(name = "mch_billno")
34 @JSONField(name = "mch_billno")
35 private String outTradeNo;
36
37
38
39 @XmlElement(name = "mch_id")
40 @JSONField(name = "mch_id")
41 private String mchId;
42
43
44
45 @XmlElement(name = "detail_id")
46 @JSONField(name = "detail_id")
47 private String repacketId;
48
49
50
51 @XmlElement(name = "status")
52 private String status;
53
54
55
56 @XmlElement(name = "send_type")
57 @JSONField(name = "send_type")
58 private String sendType;
59
60
61
62 @XmlElement(name = "hb_type")
63 @JSONField(name = "hb_type")
64 private String hbType;
65
66
67
68 @XmlElement(name = "total_num")
69 @JSONField(name = "total_num")
70 private int totalNum;
71
72
73
74 @XmlElement(name = "total_amount")
75 @JSONField(name = "total_amount")
76 private int totalAmount;
77
78
79
80 @XmlElement(name = "reason")
81 private String reason;
82
83
84
85 @XmlElement(name = "send_time")
86 @JSONField(name = "send_time")
87 private String sendTime;
88
89
90
91 @XmlElement(name = "refund_time")
92 @JSONField(name = "refund_time")
93 private String refundTime;
94
95
96
97 @XmlElement(name = "refund_amount")
98 @JSONField(name = "refund_amount")
99 private Integer refundAmount;
100
101
102
103 @XmlElement(name = "wishing")
104 private String wishing;
105
106
107
108 @XmlElement(name = "remark")
109 private String remark;
110
111
112
113 @XmlElement(name = "act_name")
114 @JSONField(name = "act_name")
115 private String actName;
116
117
118
119 @XmlElement(name = "hbinfo")
120 @XmlElementWrapper(name = "hblist")
121 @JSONField(name = "hblist")
122 private List<RedpacketReceiver> receivers;
123
124 public String getOutTradeNo() {
125 return outTradeNo;
126 }
127
128 public String getMchId() {
129 return mchId;
130 }
131
132 public String getRepacketId() {
133 return repacketId;
134 }
135
136 @JSONField(serialize = false)
137 public RedpacketStatus getFormatStatus() {
138 return status != null ? RedpacketStatus.valueOf(status.toUpperCase())
139 : null;
140 }
141
142 @JSONField(serialize = false)
143 public RedpacketSendType getFormatSendType() {
144 return sendType != null ? RedpacketSendType.valueOf(sendType) : null;
145 }
146
147 @JSONField(serialize = false)
148 public RedpacketType getFomatHbType() {
149 return hbType != null ? RedpacketType.valueOf(hbType) : null;
150 }
151
152 public String getStatus() {
153 return status;
154 }
155
156 public String getSendType() {
157 return sendType;
158 }
159
160 public String getHbType() {
161 return hbType;
162 }
163
164 public int getTotalNum() {
165 return totalNum;
166 }
167
168 public int getTotalAmount() {
169 return totalAmount;
170 }
171
172
173
174
175
176
177 @JSONField(serialize = false)
178 public double getFormatTotalAmount() {
179 return totalAmount / 100d;
180 }
181
182 public String getReason() {
183 return reason;
184 }
185
186 public String getSendTime() {
187 return sendTime;
188 }
189
190 @JSONField(serialize = false)
191 public Date getFormatSendTime() {
192 return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
193 : null;
194 }
195
196 public String getRefundTime() {
197 return refundTime;
198 }
199
200 @JSONField(serialize = false)
201 public Date getFormatRefundTime() {
202 return refundTime != null ? DateUtil.parse2yyyyMMddHHmmss(refundTime)
203 : null;
204 }
205
206 public Integer getRefundAmount() {
207 return refundAmount;
208 }
209
210
211
212
213
214
215 @JSONField(serialize = false)
216 public double getFormatRefundAmount() {
217 return refundAmount != null ? refundAmount.intValue() / 100d : 0d;
218 }
219
220 public String getWishing() {
221 return wishing;
222 }
223
224 public String getRemark() {
225 return remark;
226 }
227
228 public String getActName() {
229 return actName;
230 }
231
232 public List<RedpacketReceiver> getReceivers() {
233 return receivers;
234 }
235
236 @XmlRootElement
237 @XmlAccessorType(XmlAccessType.FIELD)
238 public static class RedpacketReceiver implements Serializable {
239
240 private static final long serialVersionUID = 1L;
241
242
243
244
245 @XmlElement(name = "openid")
246 private String openId;
247
248
249
250 @XmlElement(name = "status")
251 private RedpacketStatus status;
252
253
254
255 private int amount;
256
257
258
259 @XmlElement(name = "rcv_time")
260 @JSONField(name = "rcv_time")
261 private String receiveTime;
262
263 public String getOpenId() {
264 return openId;
265 }
266
267 public RedpacketStatus getStatus() {
268 return status;
269 }
270
271 public int getAmount() {
272 return amount;
273 }
274
275 public String getReceiveTime() {
276 return receiveTime;
277 }
278
279
280
281
282
283
284 @JSONField(serialize = false)
285 public double getFormatAmount() {
286 return amount / 100d;
287 }
288
289 @JSONField(serialize = false)
290 public Date getFormatReceiveTime() {
291 return receiveTime != null ? DateUtil
292 .parse2yyyyMMddHHmmss(receiveTime) : null;
293 }
294
295 @Override
296 public String toString() {
297 return "RedpacketReceiver [openId=" + openId + ", status=" + status
298 + ", amount=" + getFormatAmount() + ", receiveTime="
299 + receiveTime + "]";
300 }
301 }
302
303 @Override
304 public String toString() {
305 return "RedpacketRecord [outTradeNo=" + outTradeNo + ", mchId=" + mchId
306 + ", repacketId=" + repacketId + ", status=" + status
307 + ", sendType=" + sendType + ", hbType=" + hbType
308 + ", totalNum=" + totalNum + ", totalAmount="
309 + getFormatTotalAmount() + ", reason=" + reason + ", sendTime="
310 + sendTime + ", refundTime=" + refundTime + ", refundAmount="
311 + getFormatRefundAmount() + ", wishing=" + wishing
312 + ", remark=" + remark + ", actName=" + actName
313 + ", receivers=" + receivers + "]";
314 }
315 }