1 package com.foxinmy.weixin4j.model.card;
2
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.foxinmy.weixin4j.type.card.CardType;
5 import com.foxinmy.weixin4j.util.DateUtil;
6
7
8
9
10
11
12
13
14
15 public class CashCoupon extends CardCoupon {
16
17
18
19 @JSONField(name = "least_cost")
20 private int leastCost;
21
22
23
24 @JSONField(name = "reduce_cost")
25 private final int reduceCost;
26
27
28
29
30
31
32
33
34
35 public CashCoupon(CouponBaseInfo couponBaseInfo, double reduceCost) {
36 super(couponBaseInfo);
37 this.reduceCost = DateUtil.formatYuan2Fen(reduceCost);
38 }
39
40 public int getLeastCost() {
41 return leastCost;
42 }
43
44
45
46
47
48
49 @JSONField(serialize = false)
50 public double getFormatLeastCost() {
51 return leastCost / 100d;
52 }
53
54 public void setLeastCost(double leastCost) {
55 this.leastCost = DateUtil.formatYuan2Fen(reduceCost);
56 }
57
58 public int getReduceCost() {
59 return reduceCost;
60 }
61
62
63
64
65
66
67 @JSONField(serialize = false)
68 public double getFormatReduceCost() {
69 return reduceCost / 100d;
70 }
71
72 @JSONField(serialize = false)
73 @Override
74 public CardType getCardType() {
75 return CardType.CASH;
76 }
77
78 @Override
79 public String toString() {
80 return "CashCoupon [leastCost=" + leastCost + ", reduceCost="
81 + reduceCost + ", " + super.toString() + "]";
82 }
83 }