mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-17 21:56:28 +08:00
🎨 优化和规范化部分代码
This commit is contained in:
@@ -138,7 +138,7 @@ public interface WxMpCardService {
|
||||
* @return result
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
WxMpCardCreateResult createCard(WxMpCardCreateMessage cardCreateMessage) throws WxErrorException;
|
||||
WxMpCardCreateResult createCard(WxMpCardCreateRequest cardCreateMessage) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 创建卡券二维码.
|
||||
@@ -183,7 +183,8 @@ public interface WxMpCardService {
|
||||
* @return WxMpCardLandingPageCreateResult
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
WxMpCardLandingPageCreateResult createLandingPage(WxMpCardLandingPageCreateRequest createRequest) throws WxErrorException;
|
||||
WxMpCardLandingPageCreateResult createLandingPage(WxMpCardLandingPageCreateRequest createRequest)
|
||||
throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 将用户的卡券设置为失效状态.
|
||||
|
||||
@@ -178,7 +178,7 @@ public class WxMpCardServiceImpl implements WxMpCardService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpCardCreateResult createCard(WxMpCardCreateMessage cardCreateMessage) throws WxErrorException {
|
||||
public WxMpCardCreateResult createCard(WxMpCardCreateRequest cardCreateMessage) throws WxErrorException {
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_CREATE, GSON.toJson(cardCreateMessage));
|
||||
return WxMpCardCreateResult.fromJson(response);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* .
|
||||
*
|
||||
* @author leeis
|
||||
* @date 2018/12/29
|
||||
*/
|
||||
@Data
|
||||
public abstract class AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = -260291223712818801L;
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author leeis
|
||||
* @Date 2018/12/29
|
||||
*/
|
||||
@Data
|
||||
public class CardCreateRequest implements Serializable {
|
||||
}
|
||||
@@ -2,17 +2,22 @@ package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* .
|
||||
*
|
||||
* @author leeis
|
||||
* @Date 2018/12/29
|
||||
* @date 2018/12/29
|
||||
*/
|
||||
@Data
|
||||
public class CashCardCreateRequest extends CardCreateRequest implements Serializable {
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CashCardCreateRequest extends AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 8251635683908302125L;
|
||||
|
||||
@SerializedName("card_type")
|
||||
private String cardType = "CASH";
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DiscountCardCreateRequest extends CardCreateRequest implements Serializable {
|
||||
public class DiscountCardCreateRequest extends AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1190518086576489692L;
|
||||
|
||||
@SerializedName("card_type")
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GeneralCardCreateRequest extends CardCreateRequest implements Serializable {
|
||||
public class GeneralCardCreateRequest extends AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1771355872211267723L;
|
||||
|
||||
@SerializedName("card_type")
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GiftCardCreateRequest extends CardCreateRequest implements Serializable {
|
||||
public class GiftCardCreateRequest extends AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1283655452584811858L;
|
||||
|
||||
@SerializedName("card_type")
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GrouponCardCreateRequest extends CardCreateRequest implements Serializable {
|
||||
public class GrouponCardCreateRequest extends AbstractCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7551441058859934512L;
|
||||
|
||||
@SerializedName("card_type")
|
||||
|
||||
@@ -6,18 +6,24 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* .
|
||||
*
|
||||
* @author IOMan
|
||||
*/
|
||||
@Data
|
||||
public final class WxMpCardCreateMessage implements Serializable {
|
||||
public final class WxMpCardCreateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 5951280855309617585L;
|
||||
|
||||
@SerializedName("card")
|
||||
private CardCreateRequest cardCreateRequest;
|
||||
private AbstractCardCreateRequest cardCreateRequest;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
public static WxMpCardCreateMessage fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardCreateMessage.class);
|
||||
public static WxMpCardCreateRequest fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardCreateRequest.class);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
/**
|
||||
* 卡券查询Code,核销Code接口返回结果
|
||||
* 卡券查询Code,核销Code接口返回结果.
|
||||
*
|
||||
* @author YuJian
|
||||
* @version 15/11/11
|
||||
|
||||
Reference in New Issue
Block a user