View Javadoc
1   package com.foxinmy.weixin4j.model.card;
2   
3   import com.alibaba.fastjson.JSONArray;
4   import com.alibaba.fastjson.JSONObject;
5   import com.alibaba.fastjson.annotation.JSONField;
6   
7   /**
8    * 礼品卡货架
9    *
10   * @author kit(kit.li@qq.com)
11   * @date 2018年10月30日
12   */
13  public class GiftCardPage {
14      @JSONField(name = "page_id")
15      private String pageId;
16      /**
17       * 礼品卡货架名称
18       */
19      @JSONField(name = "page_title")
20      private String title;
21      /**
22       * 是否支持一次购买多张及发送至群,填true或者false,若填true则支持,默认为false
23       */
24      @JSONField(name = "support_multi")
25      private Boolean supportMulti;
26      /**
27       * 礼品卡货架是否支持买给自己,填true或者false,若填true则支持,默认为false
28       */
29      @JSONField(name = "support_buy_for_self")
30      private Boolean supportBuyForSelf;
31      /**
32       * 礼品卡货架主题页顶部banner图片,须先将图片上传至CDN,建议尺寸为750px*630px
33       */
34      @JSONField(name = "banner_pic_url")
35      private String bannerPicUrl;
36      /**
37       * 主题结构体
38       */
39      @JSONField(name = "theme_list")
40      private JSONArray themeList;
41      /**
42       * 主题分类列表
43       */
44      @JSONField(name = "category_list")
45      private JSONArray categoryList;
46      /**
47       * 商家地址
48       */
49      private String address;
50      /**
51       * 商家服务电话
52       */
53      @JSONField(name = "service_phone")
54      private String servicePhone;
55      /**
56       * 商家使用说明,用于描述退款、发票等流程
57       */
58      @JSONField(name = "biz_description")
59      private String description;
60      /**
61       * 该货架的订单是否支持开发票,填true或者false,若填true则需要使用API设置支付后开票功能,默认为false
62       */
63      @JSONField(name = "need_receipt")
64      private Boolean needReceipt;
65      /**
66       * 商家自定义链接,用于承载退款、发票等流程
67       */
68      @JSONField(name = "cell_1")
69      private JSONObject cell1;
70      /**
71       * 商家自定义链接,用于承载退款、发票等流程
72       */
73      @JSONField(name = "cell_2")
74      private JSONObject cell2;
75  
76      public String getPageId() { return pageId; }
77  
78      public String getTitle() {
79          return title;
80      }
81  
82      public Boolean getSupportMulti() {
83          return supportMulti;
84      }
85  
86      public Boolean getSupportBuyForSelf() {
87          return supportBuyForSelf;
88      }
89  
90      public String getBannerPicUrl() {
91          return bannerPicUrl;
92      }
93  
94      public JSONArray getThemeList() {
95          return themeList;
96      }
97  
98      public JSONArray getCategoryList() {
99          return categoryList;
100     }
101 
102     public String getAddress() {
103         return address;
104     }
105 
106     public String getServicePhone() {
107         return servicePhone;
108     }
109 
110     public String getDescription() {
111         return description;
112     }
113 
114     public Boolean getNeedReceipt() {
115         return needReceipt;
116     }
117 
118     public JSONObject getCell1() {
119         return cell1;
120     }
121 
122     public JSONObject getCell2() {
123         return cell2;
124     }
125 
126     public GiftCardPage(Builder builder){
127         this.pageId = builder.pageId;
128         this.address = builder.address;
129         this.bannerPicUrl = builder.bannerPicUrl;
130         this.categoryList = builder.categoryList;
131         this.cell1 = builder.cell1;
132         this.cell2 = builder.cell2;
133         this.description = builder.description;
134         this.needReceipt = builder.needReceipt;
135         this.servicePhone = builder.servicePhone;
136         this.supportBuyForSelf = builder.supportBuyForSelf;
137         this.supportMulti = builder.supportMulti;
138         this.themeList = builder.themeList;
139         this.title = builder.title;
140     }
141 
142     public static class Builder{
143         /**
144          * 货架ID,只在货架更新时用到
145          */
146         private String pageId;
147         /**
148          * 礼品卡货架名称
149          */
150         private String title;
151         /**
152          * 是否支持一次购买多张及发送至群,填true或者false,若填true则支持,默认为false
153          */
154         private Boolean supportMulti;
155         /**
156          * 礼品卡货架是否支持买给自己,填true或者false,若填true则支持,默认为false
157          */
158         private Boolean supportBuyForSelf;
159         /**
160          * 礼品卡货架主题页顶部banner图片,须先将图片上传至CDN,建议尺寸为750px*630px
161          */
162         private String bannerPicUrl;
163         /**
164          * 主题结构体
165          */
166         private JSONArray themeList;
167         /**
168          * 主题分类列表
169          */
170         private JSONArray categoryList;
171         /**
172          * 商家地址
173          */
174         private String address;
175         /**
176          * 商家服务电话
177          */
178         private String servicePhone;
179         /**
180          * 商家使用说明,用于描述退款、发票等流程
181          */
182         private String description;
183         /**
184          * 该货架的订单是否支持开发票,填true或者false,若填true则需要使用API设置支付后开票功能,默认为false
185          */
186         private Boolean needReceipt;
187         /**
188          * 商家自定义链接,用于承载退款、发票等流程
189          */
190         private JSONObject cell1;
191         /**
192          * 商家自定义链接,用于承载退款、发票等流程
193          */
194         private JSONObject cell2;
195 
196         public Builder(){
197             this.themeList = new JSONArray();
198             this.categoryList = null;
199         }
200 
201         public Builder pageId(String pageId){
202             this.pageId = pageId;
203             return this;
204         }
205 
206         /**
207          * 设置礼品卡货架名称
208          *
209          * @param title
210          * @return
211          */
212         public Builder title(String title){
213             this.title = title;
214             return this;
215         }
216 
217         /**
218          * 设置是否支持一次购买多张及发送至群
219          *
220          * @param supportMulti
221          * @return
222          */
223         public Builder supportMulti(boolean supportMulti){
224             this.supportMulti = Boolean.valueOf(supportMulti);
225             return this;
226         }
227 
228         /**
229          * 设置礼品卡货架是否支持买给自己
230          *
231          * @param supportBuyForSelf
232          * @return
233          */
234         public Builder supportBuyForSelf(boolean supportBuyForSelf){
235             this.supportBuyForSelf = Boolean.valueOf(supportBuyForSelf);
236             return this;
237         }
238 
239         /**
240          * 设置礼品卡货架主题页顶部banner图片
241          *
242          * @param url
243          * @return
244          */
245         public Builder bannerPicUrl(String url){
246             this.bannerPicUrl = url;
247             return this;
248         }
249 
250         /**
251          * 添加一个主题
252          *
253          * @param theme
254          * @return
255          */
256         public Builder themeList(PageTheme theme){
257             this.themeList.add(theme);
258             return this;
259         }
260 
261         /**
262          * 添加一个主题分类
263          *
264          * @param title
265          * @return
266          */
267         public Builder categoryList(String title){
268             if(this.categoryList==null){
269                 this.categoryList = new JSONArray();
270             }
271             JSONObject category = new JSONObject();
272             category.put("title", title);
273             this.categoryList.add(category);
274             return this;
275         }
276 
277         /**
278          * 设置商家地址
279          *
280          * @param address
281          * @return
282          */
283         public Builder address(String address){
284             this.address = address;
285             return this;
286         }
287 
288         /**
289          * 设置商家服务电话
290          *
291          * @param phoneNo
292          * @return
293          */
294         public Builder servicePhone(String phoneNo){
295             this.servicePhone = phoneNo;
296             return this;
297         }
298 
299         /**
300          * 设置商家使用说明
301          *
302          * @param description
303          * @return
304          */
305         public Builder description(String description){
306             this.description = description;
307             return this;
308         }
309 
310         /**
311          * 设置该货架的订单是否支持开发票
312          *
313          * @param needReceipt
314          * @return
315          */
316         public Builder needReceipt(boolean needReceipt){
317             this.needReceipt = Boolean.valueOf(needReceipt);
318             return this;
319         }
320 
321         /**
322          * 设置商家自定义链接
323          *
324          * @param title
325          * @param url
326          * @return
327          */
328         public Builder cell1(String title, String url){
329             JSONObject cell = new JSONObject();
330             cell.put("title", title);
331             cell.put("url", url);
332             this.cell1 = cell;
333             return this;
334         }
335 
336         /**
337          * 设置商家自定义链接
338          *
339          * @param title
340          * @param url
341          * @return
342          */
343         public Builder cell2(String title, String url){
344             JSONObject cell = new JSONObject();
345             cell.put("title", title);
346             cell.put("url", url);
347             this.cell2 = cell;
348             return this;
349         }
350     }
351 }