1 package com.foxinmy.weixin4j.pay.payment.coupon;
2
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
5 import com.foxinmy.weixin4j.pay.type.mch.CouponStatus;
6 import com.foxinmy.weixin4j.pay.type.mch.CouponStockType;
7 import com.foxinmy.weixin4j.pay.type.mch.CouponType;
8 import com.foxinmy.weixin4j.util.DateUtil;
9
10 import javax.xml.bind.annotation.XmlAccessType;
11 import javax.xml.bind.annotation.XmlAccessorType;
12 import javax.xml.bind.annotation.XmlElement;
13 import javax.xml.bind.annotation.XmlRootElement;
14 import java.util.Date;
15
16
17
18
19
20
21
22
23
24
25 @XmlRootElement
26 @XmlAccessorType(XmlAccessType.FIELD)
27 public class CouponDetail extends MerchantResult {
28
29 private static final long serialVersionUID = -311265355895457070L;
30
31
32
33
34 @XmlElement(name = "coupon_stock_id")
35 @JSONField(name = "coupon_stock_id")
36 private String couponStockId;
37
38
39
40
41 @XmlElement(name = "coupon_stock_type")
42 @JSONField(name = "coupon_stock_type")
43 private int couponStockType;
44
45
46
47
48 @XmlElement(name = "coupon_id")
49 @JSONField(name = "coupon_id")
50 private String couponId;
51
52
53
54 @XmlElement(name = "coupon_value")
55 @JSONField(name = "coupon_value")
56 private int couponValue;
57
58
59
60
61 @XmlElement(name = "coupon_mininum")
62 @JSONField(name = "coupon_mininum")
63 private int couponMininum;
64
65
66
67 @XmlElement(name = "coupon_name")
68 @JSONField(name = "coupon_name")
69 private String couponName;
70
71
72
73 @XmlElement(name = "coupon_state")
74 @JSONField(name = "coupon_state")
75 private int couponStatus;
76
77
78
79 @XmlElement(name = "coupon_type")
80 @JSONField(name = "coupon_type")
81 private int couponType;
82
83
84
85 @XmlElement(name = "coupon_desc")
86 @JSONField(name = "coupon_desc")
87 private String couponDesc;
88
89
90
91
92 @XmlElement(name = "coupon_use_value")
93 @JSONField(name = "coupon_use_value")
94 private int couponUseValue;
95
96
97
98
99 @XmlElement(name = "coupon_remain_value")
100 @JSONField(name = "coupon_remain_value")
101 private int couponRemainValue;
102
103
104
105
106 @XmlElement(name = "begin_time")
107 @JSONField(name = "begin_time")
108 private String beginTime;
109
110
111
112
113 @XmlElement(name = "end_time")
114 @JSONField(name = "end_time")
115 private String endTime;
116
117
118
119
120 @XmlElement(name = "send_time")
121 @JSONField(name = "send_time")
122 private String sendTime;
123
124
125
126
127 @XmlElement(name = "use_time")
128 @JSONField(name = "use_time")
129 private String useTime;
130
131
132
133
134 @XmlElement(name = "trade_no")
135 @JSONField(name = "trade_no")
136 private String tradeNo;
137
138
139
140
141 @XmlElement(name = "consumer_mch_id")
142 @JSONField(name = "consumer_mch_id")
143 private String consumerMchId;
144
145
146
147
148 @XmlElement(name = "consumer_mch_name")
149 @JSONField(name = "consumer_mch_name")
150 private String consumerMchName;
151
152
153
154
155 @XmlElement(name = "consumer_mch_appid")
156 @JSONField(name = "consumer_mch_appid")
157 private String consumerMchAppid;
158
159
160
161
162 @XmlElement(name = "send_source")
163 @JSONField(name = "send_source")
164 private String sendSource;
165
166
167
168
169 @XmlElement(name = "is_partial_use")
170 @JSONField(name = "is_partial_use")
171 private int isPartialUse;
172
173 public CouponDetail() {
174
175 }
176
177 public String getCouponStockId() {
178 return couponStockId;
179 }
180
181 public void setCouponStockId(String couponStockId) {
182 this.couponStockId = couponStockId;
183 }
184
185 public int getCouponStockType() {
186 return couponStockType;
187 }
188
189 public void setCouponStockType(int couponStockType) {
190 this.couponStockType = couponStockType;
191 }
192
193 @JSONField(serialize = false)
194 public CouponStockType getFormatCouponStockType() {
195 for (CouponStockType couponStockType : CouponStockType.values()) {
196 if (couponStockType.getVal() == this.couponStockType) {
197 return couponStockType;
198 }
199 }
200 return null;
201 }
202
203 public String getCouponId() {
204 return couponId;
205 }
206
207 public void setCouponId(String couponId) {
208 this.couponId = couponId;
209 }
210
211 public int getCouponValue() {
212 return couponValue;
213 }
214
215 public void setCouponValue(int couponValue) {
216 this.couponValue = couponValue;
217 }
218
219
220
221
222
223
224 @JSONField(serialize = false)
225 public double getFormatCouponValue() {
226 return couponValue / 100d;
227 }
228
229 public int getCouponMininum() {
230 return couponMininum;
231 }
232
233 public void setCouponMininum(int couponMininum) {
234 this.couponMininum = couponMininum;
235 }
236
237
238
239
240
241
242 @JSONField(serialize = false)
243 public double getFormatCouponMininum() {
244 return couponMininum / 100d;
245 }
246
247 public String getCouponName() {
248 return couponName;
249 }
250
251 public void setCouponName(String couponName) {
252 this.couponName = couponName;
253 }
254
255 public int getCouponStatus() {
256 return couponStatus;
257 }
258
259 public void setCouponStatus(int couponStatus) {
260 this.couponStatus = couponStatus;
261 }
262
263 @JSONField(serialize = false)
264 public CouponStatus getFormatCouponStatus() {
265 for (CouponStatus couponStatus : CouponStatus.values()) {
266 if (couponStatus.getVal() == this.couponStatus) {
267 return couponStatus;
268 }
269 }
270 return null;
271 }
272
273 public int getCouponType() {
274 return couponType;
275 }
276
277 public void setCouponType(int couponType) {
278 this.couponType = couponType;
279 }
280
281 @JSONField(deserialize = false, serialize = false)
282 public CouponType getFormatCouponType() {
283 for (CouponType couponType : CouponType.values()) {
284 if (couponType.getVal() == this.couponType) {
285 return couponType;
286 }
287 }
288 return null;
289 }
290
291 public String getCouponDesc() {
292 return couponDesc;
293 }
294
295 public void setCouponDesc(String couponDesc) {
296 this.couponDesc = couponDesc;
297 }
298
299 public int getCouponUseValue() {
300 return couponUseValue;
301 }
302
303 public void setCouponUseValue(int couponUseValue) {
304 this.couponUseValue = couponUseValue;
305 }
306
307
308
309
310
311
312 @JSONField(serialize = false)
313 public double getFormatCouponUseValue() {
314 return couponUseValue / 100d;
315 }
316
317 public int getCouponRemainValue() {
318 return couponRemainValue;
319 }
320
321
322
323
324
325
326 @JSONField(serialize = false)
327 public double getFormatCouponRemainValue() {
328 return couponRemainValue / 100d;
329 }
330
331 public void setCouponRemainValue(int couponRemainValue) {
332 this.couponRemainValue = couponRemainValue;
333 }
334
335 public String getBeginTime() {
336 return beginTime;
337 }
338
339 public void setBeginTime(String beginTime) {
340 this.beginTime = beginTime;
341 }
342
343 @JSONField(serialize = false)
344 public Date getFormatBeginTime() {
345 return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
346 : null;
347 }
348
349 public String getEndTime() {
350 return endTime;
351 }
352
353 public void setEndTime(String endTime) {
354 this.endTime = endTime;
355 }
356
357 @JSONField(serialize = false)
358 public Date getFormatEndTime() {
359 return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
360 }
361
362 public String getSendTime() {
363 return sendTime;
364 }
365
366 public void setSendTime(String sendTime) {
367 this.sendTime = sendTime;
368 }
369
370 @JSONField(serialize = false)
371 public Date getFormatSendTime() {
372 return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
373 : null;
374 }
375
376 public String getUseTime() {
377 return useTime;
378 }
379
380 @JSONField(serialize = false)
381 public Date getFormatUseTime() {
382 return useTime != null ? DateUtil.parse2yyyyMMddHHmmss(useTime) : null;
383 }
384
385 public void setUseTime(String useTime) {
386 this.useTime = useTime;
387 }
388
389 public String getTradeNo() {
390 return tradeNo;
391 }
392
393 public void setTradeNo(String tradeNo) {
394 this.tradeNo = tradeNo;
395 }
396
397 public String getConsumerMchId() {
398 return consumerMchId;
399 }
400
401 public void setConsumerMchId(String consumerMchId) {
402 this.consumerMchId = consumerMchId;
403 }
404
405 public String getConsumerMchName() {
406 return consumerMchName;
407 }
408
409 public void setConsumerMchName(String consumerMchName) {
410 this.consumerMchName = consumerMchName;
411 }
412
413 public String getConsumerMchAppid() {
414 return consumerMchAppid;
415 }
416
417 public void setConsumerMchAppid(String consumerMchAppid) {
418 this.consumerMchAppid = consumerMchAppid;
419 }
420
421 public String getSendSource() {
422 return sendSource;
423 }
424
425 public void setSendSource(String sendSource) {
426 this.sendSource = sendSource;
427 }
428
429 public int getIsPartialUse() {
430 return isPartialUse;
431 }
432
433 @JSONField(serialize = false)
434 public boolean getFormatIsPartialUse() {
435 return isPartialUse == 1;
436 }
437
438 public void setIsPartialUse(int isPartialUse) {
439 this.isPartialUse = isPartialUse;
440 }
441
442 @Override
443 public String toString() {
444 return "CouponDetail [couponStockId=" + couponStockId
445 + ", couponStockType=" + getFormatCouponStockType()
446 + ", couponId=" + couponId + ", couponValue="
447 + getFormatCouponValue() + ", couponMininum="
448 + getFormatCouponMininum() + ", couponName=" + couponName
449 + ", couponStatus=" + getCouponStatus() + ", couponType="
450 + getFormatCouponType() + ", couponDesc=" + couponDesc
451 + ", couponUseValue=" + getFormatCouponUseValue()
452 + ", couponRemainValue=" + getFormatCouponRemainValue()
453 + ", beginTime=" + getFormatBeginTime() + ", endTime="
454 + getFormatEndTime() + ", sendTime=" + getFormatSendTime()
455 + ", useTime=" + getFormatUseTime() + ", tradeNo=" + tradeNo
456 + ", consumerMchId=" + consumerMchId + ", consumerMchName="
457 + consumerMchName + ", consumerMchAppid=" + consumerMchAppid
458 + ", sendSource=" + sendSource + ", isPartialUse="
459 + getFormatIsPartialUse() + ", " + super.toString() + "]";
460 }
461 }