Skip to content

Commit 28b09f7

Browse files
yuanqixunbinarywang
authored andcommitted
#736 修复卡券高级信息的商户服务属性
1 parent f90f72f commit 28b09f7

File tree

13 files changed

+238
-196
lines changed

13 files changed

+238
-196
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpMemberCardServiceImpl.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,20 @@ private WxMpCardCreateResult validCheck(WxMpMemberCardCreateMessage createMessag
191191
return WxMpCardCreateResult.failure("会员卡基本信息的门店使用范围选择指定门店,门店列表:locationIdList不能为空");
192192
}
193193

194-
//TODO 高级信息
195-
194+
//校验高级信息
195+
AdvancedInfo advancedInfo = memberCard.getAdvancedInfo();
196+
if (advancedInfo != null) {
197+
if (advancedInfo.getBusinessServiceList() != null) {
198+
for (String bs : advancedInfo.getBusinessServiceList()) {
199+
BusinessServiceType businessServiceType = null;
200+
try {
201+
businessServiceType = BusinessServiceType.valueOf(bs);
202+
} catch (IllegalArgumentException ex) {
203+
return WxMpCardCreateResult.failure("会员卡高级信息的商户服务:" + bs + " 不合法");
204+
}
205+
}
206+
}
207+
}
196208

197209
return WxMpCardCreateResult.success();
198210
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/Abstract.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
@Data
1616
public class Abstract implements Serializable {
1717

18-
/**
19-
* 摘要
20-
*/
21-
@SerializedName("abstract")
22-
private String abstractInfo;
18+
/**
19+
* 摘要
20+
*/
21+
@SerializedName("abstract")
22+
private String abstractInfo;
2323

24-
/**
25-
* 封面图片列表,仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350
26-
*/
27-
@SerializedName("icon_url_list")
28-
private String iconUrlList;
24+
/**
25+
* 封面图片列表,仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350
26+
*/
27+
@SerializedName("icon_url_list")
28+
private String iconUrlList;
2929

30-
public String toString(){
31-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
32-
}
30+
public String toString() {
31+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
32+
}
3333
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/AdvancedInfo.java

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,45 @@ public class AdvancedInfo implements Serializable {
2525
// timeLimit = new TimeLimit();
2626
// }
2727

28-
/**
29-
* 使用门槛(条件),若不填写使用条件则在券面拼写 :无最低消费限制,全场通用,不限品类;并在使用说明显示: 可与其他优惠共享
30-
*/
31-
@SerializedName( "use_condition")
32-
private UseCondition useCondition;
33-
34-
/**
35-
* 封面摘要
36-
*/
37-
@SerializedName( "abstract")
38-
private Abstract abstractInfo;
39-
40-
/**
41-
* 图文列表,显示在详情内页 ,优惠券券开发者须至少传入 一组图文列表
42-
*/
43-
@SerializedName( "text_image_list")
44-
private List<TextImageList> textImageList;
45-
46-
/**
47-
* 商家服务类型,数组类型:BIZ_SERVICE_DELIVER 外卖服务; BIZ_SERVICE_FREE_PARK 停车位; BIZ_SERVICE_WITH_PET 可带宠物; BIZ_SERVICE_FREE_WIFI 免费wifi, 可多选
48-
*/
49-
@SerializedName( "business_service")
50-
private String businessService;
51-
52-
/**
53-
* 使用时段限制
54-
*/
55-
@SerializedName( "time_limit")
56-
private TimeLimit timeLimit;
57-
58-
public String toString(){
59-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
28+
/**
29+
* 使用门槛(条件),若不填写使用条件则在券面拼写 :无最低消费限制,全场通用,不限品类;并在使用说明显示: 可与其他优惠共享
30+
*/
31+
@SerializedName("use_condition")
32+
private UseCondition useCondition;
33+
34+
/**
35+
* 封面摘要
36+
*/
37+
@SerializedName("abstract")
38+
private Abstract abstractInfo;
39+
40+
/**
41+
* 图文列表,显示在详情内页 ,优惠券券开发者须至少传入 一组图文列表
42+
*/
43+
@SerializedName("text_image_list")
44+
private List<TextImageList> textImageList;
45+
46+
/**
47+
* 商家服务类型,数组类型:BIZ_SERVICE_DELIVER 外卖服务; BIZ_SERVICE_FREE_PARK 停车位; BIZ_SERVICE_WITH_PET 可带宠物; BIZ_SERVICE_FREE_WIFI 免费wifi, 可多选
48+
*/
49+
@SerializedName("business_service")
50+
private List<String> businessServiceList;
51+
52+
/**
53+
* 使用时段限制
54+
*/
55+
@SerializedName("time_limit")
56+
private TimeLimit timeLimit;
57+
58+
public void addBusinessService(BusinessServiceType businessServiceType) {
59+
if (businessServiceType != null) {
60+
if (businessServiceList == null)
61+
businessServiceList = new ArrayList<String>();
62+
businessServiceList.add(businessServiceType.name());
6063
}
64+
}
65+
66+
public String toString() {
67+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
68+
}
6169
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/BaseInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public class BaseInfo implements Serializable {
164164
* 每人可领券的数量限制,建议会员卡每人限领一张
165165
*/
166166
@SerializedName("get_limit")
167-
private Integer getLimit=1;
167+
private Integer getLimit = 1;
168168

169169
/**
170170
* 卡券领取页面是否可分享,默认为true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package me.chanjar.weixin.mp.bean.card;
2+
3+
/**
4+
* 商户提供服务类型
5+
*/
6+
public enum BusinessServiceType {
7+
BIZ_SERVICE_DELIVER("外卖服务"),
8+
BIZ_SERVICE_FREE_PARK("停车位"),
9+
BIZ_SERVICE_WITH_PET("可带宠物"),
10+
BIZ_SERVICE_FREE_WIFI("可带宠物");
11+
12+
private String description;
13+
14+
BusinessServiceType(String description) {
15+
this.description = description;
16+
}
17+
18+
public String getDescription() {
19+
return description;
20+
}
21+
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/CardColor.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22

33
/**
44
* 会员卡颜色
5+
*
56
* @author yuanqixun
67
* @date 2018-08-29
78
*/
8-
public enum CardColor{
9-
Color010("#63b359"),
10-
Color020("#2c9f67"),
11-
Color030("#509fc9"),
12-
Color040("#5885cf"),
13-
Color050("#9062c0"),
14-
Color060("#d09a45"),
15-
Color070("#e4b138"),
16-
Color080("#ee903c"),
17-
Color081("#f08500"),
18-
Color082("#a9d92d"),
19-
Color090("#dd6549"),
20-
Color100("#cc463d"),
21-
Color101("#cf3e36"),
22-
Color102("#5E6671");
9+
public enum CardColor {
10+
Color010("#63b359"),
11+
Color020("#2c9f67"),
12+
Color030("#509fc9"),
13+
Color040("#5885cf"),
14+
Color050("#9062c0"),
15+
Color060("#d09a45"),
16+
Color070("#e4b138"),
17+
Color080("#ee903c"),
18+
Color081("#f08500"),
19+
Color082("#a9d92d"),
20+
Color090("#dd6549"),
21+
Color100("#cc463d"),
22+
Color101("#cf3e36"),
23+
Color102("#5E6671");
2324

24-
private String type;
25+
private String type;
2526

26-
CardColor(String type) {
27-
this.type = type;
28-
}
27+
CardColor(String type) {
28+
this.type = type;
29+
}
2930

30-
public String getValue() {
31-
return type;
32-
}
31+
public String getValue() {
32+
return type;
33+
}
3334

3435
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/CustomCell1.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
@Data
1616
public class CustomCell1 implements Serializable {
1717

18-
/**
19-
* 入口名称
20-
*/
21-
@SerializedName("name")
22-
private String name;
18+
/**
19+
* 入口名称
20+
*/
21+
@SerializedName("name")
22+
private String name;
2323

24-
/**
25-
* 入口右侧提示语,6个汉字内。
26-
*/
27-
@SerializedName("tips")
28-
private String tips;
24+
/**
25+
* 入口右侧提示语,6个汉字内。
26+
*/
27+
@SerializedName("tips")
28+
private String tips;
2929

30-
/**
31-
* 入口跳转链接。
32-
*/
33-
@SerializedName("url")
34-
private String url;
30+
/**
31+
* 入口跳转链接。
32+
*/
33+
@SerializedName("url")
34+
private String url;
3535

36-
public String toString(){
37-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
38-
}
36+
public String toString() {
37+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
38+
}
3939
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/PayInfo.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
@Data
1616
public class PayInfo implements Serializable {
1717

18-
/**
19-
* 刷卡功能
20-
*/
21-
@SerializedName( "swipe_card")
22-
private SwipeCard swipeCard;
18+
/**
19+
* 刷卡功能
20+
*/
21+
@SerializedName("swipe_card")
22+
private SwipeCard swipeCard;
2323

24-
public String toString(){
25-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
26-
}
24+
public String toString() {
25+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
26+
}
2727
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/Sku.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
@Data
1616
public class Sku implements Serializable {
1717

18-
/**
19-
* 卡券库存的数量,不支持填写0,上限为100000000。
20-
*/
21-
@SerializedName("quantity")
22-
private Integer quantity=100000000;
18+
/**
19+
* 卡券库存的数量,不支持填写0,上限为100000000。
20+
*/
21+
@SerializedName("quantity")
22+
private Integer quantity = 100000000;
2323

24-
public String toString(){
25-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
26-
}
24+
public String toString() {
25+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
26+
}
2727
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/card/SwipeCard.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
@Data
1616
public class SwipeCard implements Serializable {
1717

18-
/**
19-
* 是否设置该会员卡支持拉出微信支付刷卡界面
20-
*/
21-
@SerializedName( "is_swipe_card")
22-
private boolean isSwipeCard;
18+
/**
19+
* 是否设置该会员卡支持拉出微信支付刷卡界面
20+
*/
21+
@SerializedName("is_swipe_card")
22+
private boolean isSwipeCard;
2323

24-
/**
25-
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码
26-
*/
27-
@SerializedName( "is_pay_and_qrcode")
28-
private boolean isPayAndQrcode;
24+
/**
25+
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码
26+
*/
27+
@SerializedName("is_pay_and_qrcode")
28+
private boolean isPayAndQrcode;
2929

30-
public String toString(){
31-
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
32-
}
30+
public String toString() {
31+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
32+
}
3333
}

0 commit comments

Comments
 (0)