View Javadoc
1   package com.foxinmy.weixin4j.model.card;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   
5   import java.util.ArrayList;
6   import java.util.Arrays;
7   import java.util.List;
8   
9   /**
10   * 礼品卡货架主题
11   *
12   * @author kit(kit.li@qq.com)
13   * @date 2018年10月30日
14   */
15  public class PageTheme {
16      /**
17       * 主题的封面图片,须先将图片上传至CDN 大小控制在1000px*600px
18       */
19      @JSONField(name = "theme_pic_url")
20      private String cover;
21      /**
22       * 主题名称,如“圣诞”“感恩家人”
23       */
24      private String title;
25      /**
26       * 主题title的颜色,直接传入色值
27       */
28      @JSONField(name = "title_color")
29      private String titleColor;
30      /**
31       * 礼品卡列表,表示主题可选择的礼品卡,由cardid及标题文字组成
32       */
33      @JSONField(name = "item_list")
34      private List<CardItem> itemList;
35      /**
36       * 礼品卡可选择的封面图
37       */
38      @JSONField(name = "pic_item_list")
39      private List<PicItem> picItemList;
40      /**
41       * 当前主题所属主题分类的索引,对应主题分类列表category_list内的title字段, 若填写了category_list则每个主题必填该序号
42       */
43      @JSONField(name = "category_index")
44      private Integer categoryIndex;
45      /**
46       * 该主题购买页是否突出商品名显示
47       */
48      @JSONField(name = "show_sku_title_first")
49      private Boolean showSkuTitleFirst;
50      /**
51       * 是否将当前主题设置为banner主题(主推荐)
52       */
53      @JSONField(name = "is_banner")
54      private Boolean bannerTheme;
55  
56      public PageTheme(Builder builder){
57          this.cover = builder.cover;
58          this.title = builder.title;
59          this.titleColor = builder.titleColor;
60          this.itemList = builder.itemList;
61          this.picItemList = builder.picItemList;
62          this.categoryIndex = builder.categoryIndex;
63          this.showSkuTitleFirst = builder.showSkuTitleFirst;
64          this.bannerTheme = builder.bannerTheme;
65      }
66  
67      public String getCover() {
68          return cover;
69      }
70  
71      public String getTitle() {
72          return title;
73      }
74  
75      public String getTitleColor() {
76          return titleColor;
77      }
78  
79      public List<CardItem> getItemList() {
80          return itemList;
81      }
82  
83      public List<PicItem> getPicItemList() {
84          return picItemList;
85      }
86  
87      public Integer getCategoryIndex() {
88          return categoryIndex;
89      }
90  
91      public Boolean getShowSkuTitleFirst() {
92          return showSkuTitleFirst;
93      }
94  
95      public Boolean getBannerTheme() {
96          return bannerTheme;
97      }
98  
99      public static class Builder{
100         /**
101          * 主题的封面图片,须先将图片上传至CDN 大小控制在1000px*600px
102          */
103         private String cover;
104         /**
105          * 主题名称,如“圣诞”“感恩家人”
106          */
107         private String title;
108         /**
109          * 主题title的颜色,直接传入色值
110          */
111         private String titleColor;
112         /**
113          * 礼品卡列表,表示主题可选择的礼品卡,由cardid及标题文字组成
114          */
115         private List<CardItem> itemList;
116         /**
117          * 礼品卡可选择的封面图
118          */
119         private List<PicItem> picItemList;
120         /**
121          * 主题标号,对应category_list内的title字段, 若填写了category_list则每个主题必填该序号
122          */
123         private Integer categoryIndex;
124         /**
125          * 该主题购买页是否突出商品名显示
126          */
127         private Boolean showSkuTitleFirst;
128         /**
129          * 是否将当前主题设置为banner主题(主推荐)
130          */
131         private Boolean bannerTheme;
132 
133         public Builder(){
134             this.itemList = new ArrayList<CardItem>();
135             this.picItemList = new ArrayList<PicItem>();
136         }
137 
138         /**
139          * 设置主题的封面图片
140          *
141          * @param cover
142          * @return
143          */
144         public Builder cover(String cover){
145             this.cover = cover;
146             return this;
147         }
148 
149         /**
150          * 设置主题名称
151          *
152          * @param title
153          * @return
154          */
155         public Builder title(String title){
156             this.title = title;
157             return this;
158         }
159 
160         /**
161          * 设置主题title的颜色
162          *
163          * @param titleColor
164          *          直接设置色值,如:#FB966E
165          * @return
166          */
167         public Builder titleColor(String titleColor){
168             this.titleColor = titleColor;
169             return this;
170         }
171 
172         /**
173          * 添加一个或多个礼品卡内容
174          *
175          * @param items
176          * @return
177          */
178         public Builder cardItems(CardItem... items){
179             this.itemList = Arrays.asList(items);
180             return this;
181         }
182 
183         /**
184          * 添加一个礼品卡内容
185          *
186          * @param item
187          * @return
188          */
189         public Builder addCardItem(CardItem item){
190             this.itemList.add(item);
191             return this;
192         }
193 
194         /**
195          * 添加一个或多个礼品卡封面图
196          *
197          * @param items
198          * @return
199          */
200         public Builder picItems(PicItem... items){
201             this.picItemList = Arrays.asList(items);
202             return this;
203         }
204 
205         /**
206          * 添加一个礼品卡封面图
207          *
208          * @param item
209          * @return
210          */
211         public Builder addPicItem(PicItem item){
212             this.picItemList.add(item);
213             return this;
214         }
215 
216         /**
217          * 设置所属主题分类的索引号
218          *
219          * @param index
220          * @return
221          */
222         public Builder categoryIndex(Integer index){
223             this.categoryIndex = index;
224             return this;
225         }
226 
227         /**
228          * 设置该主题购买页是否突出商品名显示
229          *
230          * @param isShow
231          * @return
232          */
233         public Builder showSkuTitleFirst(Boolean isShow){
234             this.showSkuTitleFirst = isShow;
235             return this;
236         }
237 
238         /**
239          * 设置是否将当前主题设置为banner主题(主推荐)
240          *
241          * @param isBanner
242          * @return
243          */
244         public Builder bannerTheme(Boolean isBanner){
245             this.bannerTheme = isBanner;
246             return this;
247         }
248     }
249 }