mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 18:25:10 +08:00
使用lombok的@Data注解简化common模块的所有bean类
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
package me.chanjar.weixin.common.bean;
|
package me.chanjar.weixin.common.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class WxAccessToken implements Serializable {
|
public class WxAccessToken implements Serializable {
|
||||||
private static final long serialVersionUID = 8709719312922168909L;
|
private static final long serialVersionUID = 8709719312922168909L;
|
||||||
|
|
||||||
@@ -15,20 +17,4 @@ public class WxAccessToken implements Serializable {
|
|||||||
return WxGsonBuilder.create().fromJson(json, WxAccessToken.class);
|
return WxGsonBuilder.create().fromJson(json, WxAccessToken.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccessToken() {
|
|
||||||
return this.accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccessToken(String accessToken) {
|
|
||||||
this.accessToken = accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getExpiresIn() {
|
|
||||||
return this.expiresIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpiresIn(int expiresIn) {
|
|
||||||
this.expiresIn = expiresIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,18 @@
|
|||||||
package me.chanjar.weixin.common.bean;
|
package me.chanjar.weixin.common.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡券Api签名
|
* 卡券Api签名.
|
||||||
*
|
*
|
||||||
* @author YuJian
|
* @author YuJian
|
||||||
* @version 15/11/8
|
* @version 15/11/8
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class WxCardApiSignature implements Serializable {
|
public class WxCardApiSignature implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 158176707226975979L;
|
private static final long serialVersionUID = 158176707226975979L;
|
||||||
|
|
||||||
private String appId;
|
private String appId;
|
||||||
@@ -37,75 +38,4 @@ public class WxCardApiSignature implements Serializable {
|
|||||||
return ToStringUtils.toSimpleString(this);
|
return ToStringUtils.toSimpleString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAppId() {
|
|
||||||
return this.appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppId(String appId) {
|
|
||||||
this.appId = appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardId() {
|
|
||||||
return this.cardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardId(String cardId) {
|
|
||||||
this.cardId = cardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardType() {
|
|
||||||
return this.cardType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardType(String cardType) {
|
|
||||||
this.cardType = cardType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocationId() {
|
|
||||||
return this.locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationId(String locationId) {
|
|
||||||
this.locationId = locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(String code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOpenId() {
|
|
||||||
return this.openId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpenId(String openId) {
|
|
||||||
this.openId = openId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTimestamp() {
|
|
||||||
return this.timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimestamp(Long timestamp) {
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNonceStr() {
|
|
||||||
return this.nonceStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNonceStr(String nonceStr) {
|
|
||||||
this.nonceStr = nonceStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignature() {
|
|
||||||
return this.signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignature(String signature) {
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
package me.chanjar.weixin.common.bean;
|
package me.chanjar.weixin.common.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jspai signature
|
* jspai signature.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class WxJsapiSignature implements Serializable {
|
public class WxJsapiSignature implements Serializable {
|
||||||
private static final long serialVersionUID = -1116808193154384804L;
|
private static final long serialVersionUID = -1116808193154384804L;
|
||||||
|
|
||||||
@@ -18,43 +21,4 @@ public class WxJsapiSignature implements Serializable {
|
|||||||
|
|
||||||
private String signature;
|
private String signature;
|
||||||
|
|
||||||
public String getSignature() {
|
|
||||||
return this.signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignature(String signature) {
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNonceStr() {
|
|
||||||
return nonceStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNonceStr(String nonceStr) {
|
|
||||||
this.nonceStr = nonceStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTimestamp() {
|
|
||||||
return this.timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimestamp(long timestamp) {
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAppId() {
|
|
||||||
return appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppId(String appId) {
|
|
||||||
this.appId = appId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package me.chanjar.weixin.common.bean.menu;
|
package me.chanjar.weixin.common.bean.menu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
@@ -15,8 +16,8 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Daniel Qian
|
* @author Daniel Qian
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class WxMenu implements Serializable {
|
public class WxMenu implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7083914585539687746L;
|
private static final long serialVersionUID = -7083914585539687746L;
|
||||||
|
|
||||||
private List<WxMenuButton> buttons = new ArrayList<>();
|
private List<WxMenuButton> buttons = new ArrayList<>();
|
||||||
@@ -40,22 +41,6 @@ public class WxMenu implements Serializable {
|
|||||||
.fromJson(new InputStreamReader(is, StandardCharsets.UTF_8), WxMenu.class);
|
.fromJson(new InputStreamReader(is, StandardCharsets.UTF_8), WxMenu.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WxMenuButton> getButtons() {
|
|
||||||
return this.buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setButtons(List<WxMenuButton> buttons) {
|
|
||||||
this.buttons = buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WxMenuRule getMatchRule() {
|
|
||||||
return this.matchRule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMatchRule(WxMenuRule matchRule) {
|
|
||||||
this.matchRule = matchRule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toJson() {
|
public String toJson() {
|
||||||
return WxGsonBuilder.create().toJson(this);
|
return WxGsonBuilder.create().toJson(this);
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
package me.chanjar.weixin.common.bean.menu;
|
package me.chanjar.weixin.common.bean.menu;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class WxMenuButton implements Serializable {
|
public class WxMenuButton implements Serializable {
|
||||||
private static final long serialVersionUID = -1070939403109776555L;
|
private static final long serialVersionUID = -1070939403109776555L;
|
||||||
|
|
||||||
@@ -77,67 +79,4 @@ public class WxMenuButton implements Serializable {
|
|||||||
return ToStringUtils.toSimpleString(this);
|
return ToStringUtils.toSimpleString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return this.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKey(String key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WxMenuButton> getSubButtons() {
|
|
||||||
return this.subButtons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubButtons(List<WxMenuButton> subButtons) {
|
|
||||||
this.subButtons = subButtons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaId() {
|
|
||||||
return this.mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMediaId(String mediaId) {
|
|
||||||
this.mediaId = mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAppId() {
|
|
||||||
return appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppId(String appId) {
|
|
||||||
this.appId = appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPagePath() {
|
|
||||||
return pagePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPagePath(String pagePath) {
|
|
||||||
this.pagePath = pagePath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
package me.chanjar.weixin.common.bean.menu;
|
package me.chanjar.weixin.common.bean.menu;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class WxMenuRule implements Serializable {
|
public class WxMenuRule implements Serializable {
|
||||||
private static final long serialVersionUID = -4587181819499286670L;
|
private static final long serialVersionUID = -4587181819499286670L;
|
||||||
|
|
||||||
@@ -20,62 +22,6 @@ public class WxMenuRule implements Serializable {
|
|||||||
private String clientPlatformType;
|
private String clientPlatformType;
|
||||||
private String language;
|
private String language;
|
||||||
|
|
||||||
public String getTagId() {
|
|
||||||
return this.tagId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagId(String tagId) {
|
|
||||||
this.tagId = tagId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSex() {
|
|
||||||
return this.sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(String sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
|
||||||
return this.country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvince() {
|
|
||||||
return this.province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvince(String province) {
|
|
||||||
this.province = province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCity() {
|
|
||||||
return this.city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCity(String city) {
|
|
||||||
this.city = city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientPlatformType() {
|
|
||||||
return this.clientPlatformType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientPlatformType(String clientPlatformType) {
|
|
||||||
this.clientPlatformType = clientPlatformType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return this.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ToStringUtils.toSimpleString(this);
|
return ToStringUtils.toSimpleString(this);
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package me.chanjar.weixin.common.bean.result;
|
package me.chanjar.weixin.common.bean.result;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -9,6 +11,8 @@ import java.io.Serializable;
|
|||||||
*
|
*
|
||||||
* @author Daniel Qian
|
* @author Daniel Qian
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
public class WxError implements Serializable {
|
public class WxError implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7869786563361406291L;
|
private static final long serialVersionUID = 7869786563361406291L;
|
||||||
@@ -23,34 +27,6 @@ public class WxError implements Serializable {
|
|||||||
return WxGsonBuilder.create().fromJson(json, WxError.class);
|
return WxGsonBuilder.create().fromJson(json, WxError.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder newBuilder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getErrorCode() {
|
|
||||||
return this.errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorCode(int errorCode) {
|
|
||||||
this.errorCode = errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMsg() {
|
|
||||||
return this.errorMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMsg(String errorMsg) {
|
|
||||||
this.errorMsg = errorMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJson() {
|
|
||||||
return this.json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJson(String json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (this.json != null) {
|
if (this.json != null) {
|
||||||
@@ -59,29 +35,4 @@ public class WxError implements Serializable {
|
|||||||
return "错误: Code=" + this.errorCode + ", Msg=" + this.errorMsg;
|
return "错误: Code=" + this.errorCode + ", Msg=" + this.errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
private int errorCode;
|
|
||||||
private String errorMsg;
|
|
||||||
|
|
||||||
public Builder setErrorCode(int errorCode) {
|
|
||||||
this.errorCode = errorCode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setErrorMsg(String errorMsg) {
|
|
||||||
this.errorMsg = errorMsg;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造器方法.
|
|
||||||
*/
|
|
||||||
public WxError build() {
|
|
||||||
WxError wxError = new WxError();
|
|
||||||
wxError.setErrorCode(this.errorCode);
|
|
||||||
wxError.setErrorMsg(this.errorMsg);
|
|
||||||
return wxError;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
package me.chanjar.weixin.common.bean.result;
|
package me.chanjar.weixin.common.bean.result;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class WxMediaUploadResult implements Serializable {
|
public class WxMediaUploadResult implements Serializable {
|
||||||
private static final long serialVersionUID = 330834334738622341L;
|
private static final long serialVersionUID = 330834334738622341L;
|
||||||
|
|
||||||
@@ -17,38 +19,6 @@ public class WxMediaUploadResult implements Serializable {
|
|||||||
return WxGsonBuilder.create().fromJson(json, WxMediaUploadResult.class);
|
return WxGsonBuilder.create().fromJson(json, WxMediaUploadResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaId() {
|
|
||||||
return this.mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMediaId(String mediaId) {
|
|
||||||
this.mediaId = mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCreatedAt() {
|
|
||||||
return this.createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(long createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getThumbMediaId() {
|
|
||||||
return this.thumbMediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbMediaId(String thumbMediaId) {
|
|
||||||
this.thumbMediaId = thumbMediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ToStringUtils.toSimpleString(this);
|
return ToStringUtils.toSimpleString(this);
|
||||||
|
@@ -64,7 +64,7 @@ public class BeanUtils {
|
|||||||
if (!requiredFields.isEmpty()) {
|
if (!requiredFields.isEmpty()) {
|
||||||
String msg = "必填字段 " + requiredFields + " 必须提供值";
|
String msg = "必填字段 " + requiredFields + " 必须提供值";
|
||||||
log.debug(msg);
|
log.debug(msg);
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(msg).build());
|
throw new WxErrorException(WxError.builder().errorMsg(msg).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,8 @@ import java.util.regex.Pattern;
|
|||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
public class HttpResponseProxy {
|
public class HttpResponseProxy {
|
||||||
|
private static final Pattern PATTERN = Pattern.compile(".*filename=\"(.*)\"");
|
||||||
|
|
||||||
private CloseableHttpResponse apacheHttpResponse;
|
private CloseableHttpResponse apacheHttpResponse;
|
||||||
private HttpResponse joddHttpResponse;
|
private HttpResponse joddHttpResponse;
|
||||||
private Response okHttpResponse;
|
private Response okHttpResponse;
|
||||||
@@ -56,7 +58,7 @@ public class HttpResponseProxy {
|
|||||||
private String getFileName(CloseableHttpResponse response) throws WxErrorException {
|
private String getFileName(CloseableHttpResponse response) throws WxErrorException {
|
||||||
Header[] contentDispositionHeader = response.getHeaders("Content-disposition");
|
Header[] contentDispositionHeader = response.getHeaders("Content-disposition");
|
||||||
if (contentDispositionHeader == null || contentDispositionHeader.length == 0) {
|
if (contentDispositionHeader == null || contentDispositionHeader.length == 0) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("无法获取到文件名").build());
|
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.extractFileNameFromContentString(contentDispositionHeader[0].getValue());
|
return this.extractFileNameFromContentString(contentDispositionHeader[0].getValue());
|
||||||
@@ -74,15 +76,15 @@ public class HttpResponseProxy {
|
|||||||
|
|
||||||
private String extractFileNameFromContentString(String content) throws WxErrorException {
|
private String extractFileNameFromContentString(String content) throws WxErrorException {
|
||||||
if (content == null || content.length() == 0) {
|
if (content == null || content.length() == 0) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("无法获取到文件名").build());
|
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern p = Pattern.compile(".*filename=\"(.*)\"");
|
Matcher m = PATTERN.matcher(content);
|
||||||
Matcher m = p.matcher(content);
|
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
}
|
}
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("无法获取到文件名").build());
|
|
||||||
|
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,9 +39,7 @@ public class ApacheSimplePostRequestExecutor extends SimplePostRequestExecutor<C
|
|||||||
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) {
|
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) {
|
||||||
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
||||||
if (responseContent.isEmpty()) {
|
if (responseContent.isEmpty()) {
|
||||||
throw new WxErrorException(
|
throw new WxErrorException(WxError.builder().errorCode(9999).errorMsg("无响应内容").build());
|
||||||
WxError.newBuilder().setErrorCode(9999).setErrorMsg("无响应内容")
|
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseContent.startsWith("<xml>")) {
|
if (responseContent.startsWith("<xml>")) {
|
||||||
|
@@ -5,7 +5,6 @@ import jodd.http.HttpRequest;
|
|||||||
import jodd.http.HttpResponse;
|
import jodd.http.HttpResponse;
|
||||||
import jodd.http.ProxyInfo;
|
import jodd.http.ProxyInfo;
|
||||||
import jodd.util.StringPool;
|
import jodd.util.StringPool;
|
||||||
|
|
||||||
import me.chanjar.weixin.common.bean.result.WxError;
|
import me.chanjar.weixin.common.bean.result.WxError;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||||
@@ -40,9 +39,8 @@ public class JoddHttpSimplePostRequestExecutor extends SimplePostRequestExecutor
|
|||||||
|
|
||||||
String responseContent = response.bodyText();
|
String responseContent = response.bodyText();
|
||||||
if (responseContent.isEmpty()) {
|
if (responseContent.isEmpty()) {
|
||||||
throw new WxErrorException(
|
throw new WxErrorException(WxError.builder().errorCode(9999).errorMsg("无响应内容")
|
||||||
WxError.newBuilder().setErrorCode(9999).setErrorMsg("无响应内容")
|
.build());
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseContent.startsWith("<xml>")) {
|
if (responseContent.startsWith("<xml>")) {
|
||||||
|
@@ -14,23 +14,26 @@ import me.chanjar.weixin.common.bean.result.WxError;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Qian
|
* @author Daniel Qian.
|
||||||
*/
|
*/
|
||||||
public class WxErrorAdapter implements JsonDeserializer<WxError> {
|
public class WxErrorAdapter implements JsonDeserializer<WxError> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxError deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
public WxError deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
||||||
WxError wxError = new WxError();
|
throws JsonParseException {
|
||||||
|
WxError.WxErrorBuilder errorBuilder = WxError.builder();
|
||||||
JsonObject wxErrorJsonObject = json.getAsJsonObject();
|
JsonObject wxErrorJsonObject = json.getAsJsonObject();
|
||||||
|
|
||||||
if (wxErrorJsonObject.get("errcode") != null && !wxErrorJsonObject.get("errcode").isJsonNull()) {
|
if (wxErrorJsonObject.get("errcode") != null && !wxErrorJsonObject.get("errcode").isJsonNull()) {
|
||||||
wxError.setErrorCode(GsonHelper.getAsPrimitiveInt(wxErrorJsonObject.get("errcode")));
|
errorBuilder.errorCode(GsonHelper.getAsPrimitiveInt(wxErrorJsonObject.get("errcode")));
|
||||||
}
|
}
|
||||||
if (wxErrorJsonObject.get("errmsg") != null && !wxErrorJsonObject.get("errmsg").isJsonNull()) {
|
if (wxErrorJsonObject.get("errmsg") != null && !wxErrorJsonObject.get("errmsg").isJsonNull()) {
|
||||||
wxError.setErrorMsg(GsonHelper.getAsString(wxErrorJsonObject.get("errmsg")));
|
errorBuilder.errorMsg(GsonHelper.getAsString(wxErrorJsonObject.get("errmsg")));
|
||||||
}
|
}
|
||||||
wxError.setJson(json.toString());
|
|
||||||
return wxError;
|
errorBuilder.json(json.toString());
|
||||||
|
|
||||||
|
return errorBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ import org.testng.annotations.*;
|
|||||||
public class WxErrorTest {
|
public class WxErrorTest {
|
||||||
|
|
||||||
public void testFromJson() {
|
public void testFromJson() {
|
||||||
|
|
||||||
String json = "{ \"errcode\": 40003, \"errmsg\": \"invalid openid\" }";
|
String json = "{ \"errcode\": 40003, \"errmsg\": \"invalid openid\" }";
|
||||||
WxError wxError = WxError.fromJson(json);
|
WxError wxError = WxError.fromJson(json);
|
||||||
Assert.assertTrue(wxError.getErrorCode() == 40003);
|
Assert.assertTrue(wxError.getErrorCode() == 40003);
|
||||||
|
@@ -24,9 +24,7 @@ public class WxCpBusyRetryTest {
|
|||||||
RequestExecutor<T, E> executor, String uri, E data)
|
RequestExecutor<T, E> executor, String uri, E data)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
this.log.info("Executed");
|
this.log.info("Executed");
|
||||||
WxError error = new WxError();
|
throw new WxErrorException(WxError.builder().errorCode(-1).build());
|
||||||
error.setErrorCode(-1);
|
|
||||||
throw new WxErrorException(error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -229,10 +229,9 @@ public class WxMpCardServiceImpl implements WxMpCardService {
|
|||||||
String errcode = json.get("errcode").getAsString();
|
String errcode = json.get("errcode").getAsString();
|
||||||
if (!"0".equals(errcode)) {
|
if (!"0".equals(errcode)) {
|
||||||
String errmsg = json.get("errmsg").getAsString();
|
String errmsg = json.get("errmsg").getAsString();
|
||||||
WxError error = new WxError();
|
throw new WxErrorException(WxError.builder()
|
||||||
error.setErrorCode(Integer.valueOf(errcode));
|
.errorCode(Integer.valueOf(errcode)).errorMsg(errmsg)
|
||||||
error.setErrorMsg(errmsg);
|
.build());
|
||||||
throw new WxErrorException(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return responseContent;
|
return responseContent;
|
||||||
|
@@ -112,11 +112,11 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
|||||||
@Override
|
@Override
|
||||||
public WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException {
|
public WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException {
|
||||||
if (number > 10000) {
|
if (number > 10000) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法参数请求,每次最多查询10000条记录!").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("非法参数请求,每次最多查询10000条记录!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startTime.after(endTime)) {
|
if (startTime.after(endTime)) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("起始时间不能晚于结束时间!").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("起始时间不能晚于结束时间!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject param = new JsonObject();
|
JsonObject param = new JsonObject();
|
||||||
|
@@ -37,7 +37,7 @@ public class WxMpMaterialServiceImpl implements WxMpMaterialService {
|
|||||||
try {
|
try {
|
||||||
return this.mediaUpload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType));
|
return this.mediaUpload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build(), e);
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,13 +28,13 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
|||||||
@Override
|
@Override
|
||||||
public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException {
|
public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException {
|
||||||
if (sceneId == 0) {
|
if (sceneId == 0) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("临时二维码场景值不能为0!").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("临时二维码场景值不能为0!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
//expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
|
//expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
|
||||||
if (expireSeconds != null && expireSeconds > 2592000) {
|
if (expireSeconds != null && expireSeconds > 2592000) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1)
|
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||||
.setErrorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
.errorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expireSeconds == null) {
|
if (expireSeconds == null) {
|
||||||
@@ -59,13 +59,13 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
|||||||
@Override
|
@Override
|
||||||
public WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds) throws WxErrorException {
|
public WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds) throws WxErrorException {
|
||||||
if (StringUtils.isBlank(sceneStr)) {
|
if (StringUtils.isBlank(sceneStr)) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("临时二维码场景值不能为空!").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("临时二维码场景值不能为空!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
//expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
|
//expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
|
||||||
if (expireSeconds != null && expireSeconds > 2592000) {
|
if (expireSeconds != null && expireSeconds > 2592000) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1)
|
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||||
.setErrorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
.errorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expireSeconds == null) {
|
if (expireSeconds == null) {
|
||||||
@@ -90,7 +90,9 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
|||||||
@Override
|
@Override
|
||||||
public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException {
|
public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException {
|
||||||
if (sceneId < 1 || sceneId > 100000) {
|
if (sceneId < 1 || sceneId > 100000) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("永久二维码的场景值目前只支持1--100000!").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||||
|
.errorMsg("永久二维码的场景值目前只支持1--100000!")
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = API_URL_PREFIX + "/create";
|
String url = API_URL_PREFIX + "/create";
|
||||||
@@ -137,9 +139,7 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
|||||||
|
|
||||||
return resultUrl;
|
return resultUrl;
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
WxError error = WxError.newBuilder().setErrorCode(-1)
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build());
|
||||||
.setErrorMsg(e.getMessage()).build();
|
|
||||||
throw new WxErrorException(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.datacube;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +16,7 @@ import java.util.List;
|
|||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
|
public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
|
||||||
private static final long serialVersionUID = -9222452497954511765L;
|
private static final long serialVersionUID = -9222452497954511765L;
|
||||||
|
|
||||||
|
@@ -3,37 +3,38 @@ package me.chanjar.weixin.mp.bean.datacube;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图文分析数据接口返回结果对象
|
* 图文分析数据接口返回结果对象.
|
||||||
* <p>
|
|
||||||
* Created by Binary Wang on 2016/8/24.
|
* Created by Binary Wang on 2016/8/24.
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
|
public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
|
||||||
private static final long serialVersionUID = -7634365687303052699L;
|
private static final long serialVersionUID = -7634365687303052699L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* msgid
|
* msgid.
|
||||||
* 请注意:这里的msgid实际上是由msgid(图文消息id,这也就是群发接口调用后返回的msg_data_id)和index(消息次序索引)组成, 例如12003_3, 其中12003是msgid,即一次群发的消息的id; 3为index,假设该次群发的图文消息共5个文章(因为可能为多图文),3表示5个中的第3个
|
* 请注意:这里的msgid实际上是由msgid(图文消息id,这也就是群发接口调用后返回的msg_data_id)和index(消息次序索引)组成, 例如12003_3, 其中12003是msgid,即一次群发的消息的id; 3为index,假设该次群发的图文消息共5个文章(因为可能为多图文),3表示5个中的第3个
|
||||||
*/
|
*/
|
||||||
@SerializedName("msgid")
|
@SerializedName("msgid")
|
||||||
private String msgId;
|
private String msgId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* title
|
* title.
|
||||||
* 图文消息的标题
|
* 图文消息的标题
|
||||||
*/
|
*/
|
||||||
@SerializedName("title")
|
@SerializedName("title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* details
|
* details.
|
||||||
* 详细信息
|
* 详细信息
|
||||||
*/
|
*/
|
||||||
@SerializedName("details")
|
@SerializedName("details")
|
||||||
|
@@ -9,7 +9,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* 统计接口的共用属性类
|
* 统计接口的共用属性类.
|
||||||
* Created by Binary Wang on 2016/8/25.
|
* Created by Binary Wang on 2016/8/25.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
@@ -21,7 +21,7 @@ public abstract class WxDataCubeBaseResult implements Serializable {
|
|||||||
protected static final JsonParser JSON_PARSER = new JsonParser();
|
protected static final JsonParser JSON_PARSER = new JsonParser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ref_date
|
* ref_date.
|
||||||
* 数据的日期,需在begin_date和end_date之间
|
* 数据的日期,需在begin_date和end_date之间
|
||||||
*/
|
*/
|
||||||
@SerializedName("ref_date")
|
@SerializedName("ref_date")
|
||||||
|
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.datacube;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +16,7 @@ import java.util.List;
|
|||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
|
public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
|
||||||
private static final long serialVersionUID = 597734329161281398L;
|
private static final long serialVersionUID = 597734329161281398L;
|
||||||
|
|
||||||
|
@@ -3,51 +3,52 @@ package me.chanjar.weixin.mp.bean.datacube;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息分析数据接口返回结果对象
|
* 消息分析数据接口返回结果对象.
|
||||||
* <p>
|
|
||||||
* Created by Binary Wang on 2016/8/29.
|
* Created by Binary Wang on 2016/8/29.
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
|
public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
|
||||||
private static final long serialVersionUID = 6932121822150573659L;
|
private static final long serialVersionUID = 6932121822150573659L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ref_hour
|
* ref_hour.
|
||||||
* 数据的小时,包括从000到2300,分别代表的是[000,100)到[2300,2400),即每日的第1小时和最后1小时
|
* 数据的小时,包括从000到2300,分别代表的是[000,100)到[2300,2400),即每日的第1小时和最后1小时
|
||||||
*/
|
*/
|
||||||
@SerializedName("ref_hour")
|
@SerializedName("ref_hour")
|
||||||
private Integer refHour;
|
private Integer refHour;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* msg_type
|
* msg_type.
|
||||||
* 消息类型,代表含义如下:1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息(链接消息)
|
* 消息类型,代表含义如下:1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息(链接消息)
|
||||||
*/
|
*/
|
||||||
@SerializedName("msg_type")
|
@SerializedName("msg_type")
|
||||||
private Integer msgType;
|
private Integer msgType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* msg_user
|
* msg_user.
|
||||||
* 上行发送了(向公众号发送了)消息的用户数
|
* 上行发送了(向公众号发送了)消息的用户数
|
||||||
*/
|
*/
|
||||||
@SerializedName("msg_user")
|
@SerializedName("msg_user")
|
||||||
private Integer msgUser;
|
private Integer msgUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* msg_count
|
* msg_count.
|
||||||
* 上行发送了消息的消息总数
|
* 上行发送了消息的消息总数
|
||||||
*/
|
*/
|
||||||
@SerializedName("msg_count")
|
@SerializedName("msg_count")
|
||||||
private Integer msgCount;
|
private Integer msgCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* count_interval
|
* count_interval.
|
||||||
* 当日发送消息量分布的区间,0代表 “0”,1代表“1-5”,2代表“6-10”,3代表“10次以上”
|
* 当日发送消息量分布的区间,0代表 “0”,1代表“1-5”,2代表“6-10”,3代表“10次以上”
|
||||||
*/
|
*/
|
||||||
@SerializedName("count_interval")
|
@SerializedName("count_interval")
|
||||||
@@ -61,7 +62,7 @@ public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
|
|||||||
private Integer intPageReadCount;
|
private Integer intPageReadCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ori_page_read_user
|
* ori_page_read_user.
|
||||||
* 原文页(点击图文页“阅读原文”进入的页面)的阅读人数,无原文页时此处数据为0
|
* 原文页(点击图文页“阅读原文”进入的页面)的阅读人数,无原文页时此处数据为0
|
||||||
*/
|
*/
|
||||||
@SerializedName("ori_page_read_user")
|
@SerializedName("ori_page_read_user")
|
||||||
|
@@ -2,12 +2,14 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class BaseResp extends AbstractDeviceBean {
|
public class BaseResp extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 4252655933699659073L;
|
private static final long serialVersionUID = 4252655933699659073L;
|
||||||
|
|
||||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class RespMsg extends AbstractDeviceBean {
|
public class RespMsg extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = -4241272701707684136L;
|
private static final long serialVersionUID = -4241272701707684136L;
|
||||||
|
|
||||||
|
@@ -2,14 +2,16 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 14/12/2016
|
* @date 14/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class TransMsgResp extends AbstractDeviceBean {
|
public class TransMsgResp extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 5386954916622816491L;
|
private static final long serialVersionUID = 5386954916622816491L;
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -12,6 +13,7 @@ import java.util.List;
|
|||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceAuthorize extends AbstractDeviceBean {
|
public class WxDeviceAuthorize extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 8786321356569903887L;
|
private static final long serialVersionUID = 8786321356569903887L;
|
||||||
|
|
||||||
|
@@ -1,15 +1,17 @@
|
|||||||
package me.chanjar.weixin.mp.bean.device;
|
package me.chanjar.weixin.mp.bean.device;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceAuthorizeResult extends AbstractDeviceBean {
|
public class WxDeviceAuthorizeResult extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 9105294570912249811L;
|
private static final long serialVersionUID = 9105294570912249811L;
|
||||||
|
|
||||||
|
@@ -2,12 +2,14 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceBind extends AbstractDeviceBean {
|
public class WxDeviceBind extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 467559769037590880L;
|
private static final long serialVersionUID = 467559769037590880L;
|
||||||
|
|
||||||
|
@@ -2,15 +2,17 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 16/12/2016
|
* @date 16/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceBindDeviceResult extends AbstractDeviceBean {
|
public class WxDeviceBindDeviceResult extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 725870295905935355L;
|
private static final long serialVersionUID = 725870295905935355L;
|
||||||
|
|
||||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceBindResult extends AbstractDeviceBean {
|
public class WxDeviceBindResult extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 4687725146279339359L;
|
private static final long serialVersionUID = 4687725146279339359L;
|
||||||
|
|
||||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceMsg extends AbstractDeviceBean {
|
public class WxDeviceMsg extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = -5567110858455277963L;
|
private static final long serialVersionUID = -5567110858455277963L;
|
||||||
|
|
||||||
|
@@ -2,15 +2,17 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 16/12/2016
|
* @date 16/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceOpenIdResult extends AbstractDeviceBean {
|
public class WxDeviceOpenIdResult extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = 4980885167833836220L;
|
private static final long serialVersionUID = 4980885167833836220L;
|
||||||
|
|
||||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keungtung
|
* @author keungtung.
|
||||||
* @date 10/12/2016
|
* @date 10/12/2016
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxDeviceQrCodeResult extends AbstractDeviceBean {
|
public class WxDeviceQrCodeResult extends AbstractDeviceBean {
|
||||||
private static final long serialVersionUID = -4312858303060918266L;
|
private static final long serialVersionUID = -4312858303060918266L;
|
||||||
|
|
||||||
|
@@ -3,11 +3,13 @@ package me.chanjar.weixin.mp.bean.message;
|
|||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
|
public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
|
||||||
private static final long serialVersionUID = -2684778597067990723L;
|
private static final long serialVersionUID = -2684778597067990723L;
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.message;
|
|||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
|
public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
|
||||||
private static final long serialVersionUID = -4604402850905714772L;
|
private static final long serialVersionUID = -4604402850905714772L;
|
||||||
|
|
||||||
|
@@ -3,11 +3,13 @@ package me.chanjar.weixin.mp.bean.message;
|
|||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage {
|
public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage {
|
||||||
private static final long serialVersionUID = -3972786455288763361L;
|
private static final long serialVersionUID = -3972786455288763361L;
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.message;
|
|||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
|
public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
|
||||||
private static final long serialVersionUID = 1850903037285841322L;
|
private static final long serialVersionUID = 1850903037285841322L;
|
||||||
|
|
||||||
|
@@ -3,11 +3,13 @@ package me.chanjar.weixin.mp.bean.message;
|
|||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage {
|
public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage {
|
||||||
private static final long serialVersionUID = 240367390249860551L;
|
private static final long serialVersionUID = 240367390249860551L;
|
||||||
|
|
||||||
|
@@ -9,7 +9,8 @@ import me.chanjar.weixin.mp.util.http.okhttp.OkhttpMaterialVoiceAndImageDownload
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public abstract class MaterialVoiceAndImageDownloadRequestExecutor<H, P> implements RequestExecutor<InputStream, String> {
|
public abstract class MaterialVoiceAndImageDownloadRequestExecutor<H, P>
|
||||||
|
implements RequestExecutor<InputStream, String> {
|
||||||
protected RequestHttp<H, P> requestHttp;
|
protected RequestHttp<H, P> requestHttp;
|
||||||
protected File tmpDirFile;
|
protected File tmpDirFile;
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ public abstract class QrCodeRequestExecutor<H, P> implements RequestExecutor<Fil
|
|||||||
case OK_HTTP:
|
case OK_HTTP:
|
||||||
return new OkhttpQrCodeRequestExecutor(requestHttp);
|
return new OkhttpQrCodeRequestExecutor(requestHttp);
|
||||||
default:
|
default:
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("不支持的http框架").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("不支持的http框架").build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ public class ApacheMaterialUploadRequestExecutor extends MaterialUploadRequestEx
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法请求,material参数为空").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("非法请求,material参数为空").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = material.getFile();
|
File file = material.getFile();
|
||||||
|
@@ -30,7 +30,7 @@ public class ApacheMediaImgUploadRequestExecutor extends MediaImgUploadRequestEx
|
|||||||
@Override
|
@Override
|
||||||
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("文件对象为空").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("文件对象为空").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpPost httpPost = new HttpPost(uri);
|
HttpPost httpPost = new HttpPost(uri);
|
||||||
|
@@ -36,7 +36,7 @@ public class JoddMaterialUploadRequestExecutor extends MaterialUploadRequestExec
|
|||||||
request.withConnectionProvider(requestHttp.getRequestHttpClient());
|
request.withConnectionProvider(requestHttp.getRequestHttpClient());
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法请求,material参数为空").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("非法请求,material参数为空").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = material.getFile();
|
File file = material.getFile();
|
||||||
|
@@ -26,7 +26,7 @@ public class JoddMediaImgUploadRequestExecutor extends MediaImgUploadRequestExec
|
|||||||
@Override
|
@Override
|
||||||
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("文件对象为空").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("文件对象为空").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest request = HttpRequest.post(uri);
|
HttpRequest request = HttpRequest.post(uri);
|
||||||
|
@@ -31,7 +31,7 @@ public class OkhttpMaterialUploadRequestExecutor extends MaterialUploadRequestEx
|
|||||||
public WxMpMaterialUploadResult execute(String uri, WxMpMaterial material) throws WxErrorException, IOException {
|
public WxMpMaterialUploadResult execute(String uri, WxMpMaterial material) throws WxErrorException, IOException {
|
||||||
logger.debug("OkhttpMaterialUploadRequestExecutor is running");
|
logger.debug("OkhttpMaterialUploadRequestExecutor is running");
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法请求,material参数为空").build());
|
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("非法请求,material参数为空").build());
|
||||||
}
|
}
|
||||||
File file = material.getFile();
|
File file = material.getFile();
|
||||||
if (file == null || !file.exists()) {
|
if (file == null || !file.exists()) {
|
||||||
|
@@ -23,9 +23,7 @@ public class WxMpBusyRetryTest {
|
|||||||
RequestExecutor<T, E> executor, String uri, E data)
|
RequestExecutor<T, E> executor, String uri, E data)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
this.log.info("Executed");
|
this.log.info("Executed");
|
||||||
WxError error = new WxError();
|
throw new WxErrorException(WxError.builder().errorCode(-1).build());
|
||||||
error.setErrorCode(-1);
|
|
||||||
throw new WxErrorException(error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user