mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 10:15:08 +08:00
使用lombok的@Data注解简化common模块的所有bean类
This commit is contained in:
@@ -229,10 +229,9 @@ public class WxMpCardServiceImpl implements WxMpCardService {
|
||||
String errcode = json.get("errcode").getAsString();
|
||||
if (!"0".equals(errcode)) {
|
||||
String errmsg = json.get("errmsg").getAsString();
|
||||
WxError error = new WxError();
|
||||
error.setErrorCode(Integer.valueOf(errcode));
|
||||
error.setErrorMsg(errmsg);
|
||||
throw new WxErrorException(error);
|
||||
throw new WxErrorException(WxError.builder()
|
||||
.errorCode(Integer.valueOf(errcode)).errorMsg(errmsg)
|
||||
.build());
|
||||
}
|
||||
|
||||
return responseContent;
|
||||
|
@@ -112,11 +112,11 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
||||
@Override
|
||||
public WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException {
|
||||
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)) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("起始时间不能晚于结束时间!").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("起始时间不能晚于结束时间!").build());
|
||||
}
|
||||
|
||||
JsonObject param = new JsonObject();
|
||||
|
@@ -37,7 +37,7 @@ public class WxMpMaterialServiceImpl implements WxMpMaterialService {
|
||||
try {
|
||||
return this.mediaUpload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType));
|
||||
} 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
|
||||
public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException {
|
||||
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秒。
|
||||
if (expireSeconds != null && expireSeconds > 2592000) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1)
|
||||
.setErrorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||
.errorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||
}
|
||||
|
||||
if (expireSeconds == null) {
|
||||
@@ -59,13 +59,13 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
||||
@Override
|
||||
public WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds) throws WxErrorException {
|
||||
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秒。
|
||||
if (expireSeconds != null && expireSeconds > 2592000) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorCode(-1)
|
||||
.setErrorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||
.errorMsg("临时二维码有效时间最大不能超过2592000(即30天)!").build());
|
||||
}
|
||||
|
||||
if (expireSeconds == null) {
|
||||
@@ -90,7 +90,9 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
||||
@Override
|
||||
public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException {
|
||||
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";
|
||||
@@ -137,9 +139,7 @@ public class WxMpQrcodeServiceImpl implements WxMpQrcodeService {
|
||||
|
||||
return resultUrl;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
WxError error = WxError.newBuilder().setErrorCode(-1)
|
||||
.setErrorMsg(e.getMessage()).build();
|
||||
throw new WxErrorException(error);
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.bean.datacube;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,6 +16,7 @@ import java.util.List;
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
|
||||
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.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图文分析数据接口返回结果对象
|
||||
* <p>
|
||||
* 图文分析数据接口返回结果对象.
|
||||
* Created by Binary Wang on 2016/8/24.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
|
||||
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个
|
||||
*/
|
||||
@SerializedName("msgid")
|
||||
private String msgId;
|
||||
|
||||
/**
|
||||
* title
|
||||
* title.
|
||||
* 图文消息的标题
|
||||
*/
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* details
|
||||
* details.
|
||||
* 详细信息
|
||||
*/
|
||||
@SerializedName("details")
|
||||
|
@@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 统计接口的共用属性类
|
||||
* 统计接口的共用属性类.
|
||||
* Created by Binary Wang on 2016/8/25.
|
||||
* </pre>
|
||||
*
|
||||
@@ -21,7 +21,7 @@ public abstract class WxDataCubeBaseResult implements Serializable {
|
||||
protected static final JsonParser JSON_PARSER = new JsonParser();
|
||||
|
||||
/**
|
||||
* ref_date
|
||||
* ref_date.
|
||||
* 数据的日期,需在begin_date和end_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.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,6 +16,7 @@ import java.util.List;
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
|
||||
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.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息分析数据接口返回结果对象
|
||||
* <p>
|
||||
* 消息分析数据接口返回结果对象.
|
||||
* Created by Binary Wang on 2016/8/29.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
|
||||
private static final long serialVersionUID = 6932121822150573659L;
|
||||
|
||||
/**
|
||||
* ref_hour
|
||||
* ref_hour.
|
||||
* 数据的小时,包括从000到2300,分别代表的是[000,100)到[2300,2400),即每日的第1小时和最后1小时
|
||||
*/
|
||||
@SerializedName("ref_hour")
|
||||
private Integer refHour;
|
||||
|
||||
/**
|
||||
* msg_type
|
||||
* msg_type.
|
||||
* 消息类型,代表含义如下:1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息(链接消息)
|
||||
*/
|
||||
@SerializedName("msg_type")
|
||||
private Integer msgType;
|
||||
|
||||
/**
|
||||
* msg_user
|
||||
* msg_user.
|
||||
* 上行发送了(向公众号发送了)消息的用户数
|
||||
*/
|
||||
@SerializedName("msg_user")
|
||||
private Integer msgUser;
|
||||
|
||||
/**
|
||||
* msg_count
|
||||
* msg_count.
|
||||
* 上行发送了消息的消息总数
|
||||
*/
|
||||
@SerializedName("msg_count")
|
||||
private Integer msgCount;
|
||||
|
||||
/**
|
||||
* count_interval
|
||||
* count_interval.
|
||||
* 当日发送消息量分布的区间,0代表 “0”,1代表“1-5”,2代表“6-10”,3代表“10次以上”
|
||||
*/
|
||||
@SerializedName("count_interval")
|
||||
@@ -61,7 +62,7 @@ public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
|
||||
private Integer intPageReadCount;
|
||||
|
||||
/**
|
||||
* ori_page_read_user
|
||||
* ori_page_read_user.
|
||||
* 原文页(点击图文页“阅读原文”进入的页面)的阅读人数,无原文页时此处数据为0
|
||||
*/
|
||||
@SerializedName("ori_page_read_user")
|
||||
|
@@ -2,12 +2,14 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BaseResp extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 4252655933699659073L;
|
||||
|
||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class RespMsg extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = -4241272701707684136L;
|
||||
|
||||
|
@@ -2,14 +2,16 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 14/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class TransMsgResp extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 5386954916622816491L;
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@@ -12,6 +13,7 @@ import java.util.List;
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceAuthorize extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 8786321356569903887L;
|
||||
|
||||
|
@@ -1,15 +1,17 @@
|
||||
package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceAuthorizeResult extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 9105294570912249811L;
|
||||
|
||||
|
@@ -2,12 +2,14 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceBind extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 467559769037590880L;
|
||||
|
||||
|
@@ -2,15 +2,17 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 16/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceBindDeviceResult extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 725870295905935355L;
|
||||
|
||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceBindResult extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 4687725146279339359L;
|
||||
|
||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceMsg extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = -5567110858455277963L;
|
||||
|
||||
|
@@ -2,15 +2,17 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 16/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceOpenIdResult extends AbstractDeviceBean {
|
||||
private static final long serialVersionUID = 4980885167833836220L;
|
||||
|
||||
|
@@ -2,13 +2,15 @@ package me.chanjar.weixin.mp.bean.device;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
/**
|
||||
* @author keungtung
|
||||
* @author keungtung.
|
||||
* @date 10/12/2016
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WxDeviceQrCodeResult extends AbstractDeviceBean {
|
||||
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.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
|
||||
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.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.List;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
|
||||
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.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage {
|
||||
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.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@@ -10,6 +11,7 @@ import java.io.Serializable;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
|
||||
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.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage {
|
||||
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.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 File tmpDirFile;
|
||||
|
||||
|
@@ -32,7 +32,7 @@ public abstract class QrCodeRequestExecutor<H, P> implements RequestExecutor<Fil
|
||||
case OK_HTTP:
|
||||
return new OkhttpQrCodeRequestExecutor(requestHttp);
|
||||
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) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法请求,material参数为空").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("非法请求,material参数为空").build());
|
||||
}
|
||||
|
||||
File file = material.getFile();
|
||||
|
@@ -30,7 +30,7 @@ public class ApacheMediaImgUploadRequestExecutor extends MediaImgUploadRequestEx
|
||||
@Override
|
||||
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
||||
if (data == null) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("文件对象为空").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("文件对象为空").build());
|
||||
}
|
||||
|
||||
HttpPost httpPost = new HttpPost(uri);
|
||||
|
@@ -36,7 +36,7 @@ public class JoddMaterialUploadRequestExecutor extends MaterialUploadRequestExec
|
||||
request.withConnectionProvider(requestHttp.getRequestHttpClient());
|
||||
|
||||
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();
|
||||
|
@@ -26,7 +26,7 @@ public class JoddMediaImgUploadRequestExecutor extends MediaImgUploadRequestExec
|
||||
@Override
|
||||
public WxMediaImgUploadResult execute(String uri, File data) throws WxErrorException, IOException {
|
||||
if (data == null) {
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg("文件对象为空").build());
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("文件对象为空").build());
|
||||
}
|
||||
|
||||
HttpRequest request = HttpRequest.post(uri);
|
||||
|
@@ -31,7 +31,7 @@ public class OkhttpMaterialUploadRequestExecutor extends MaterialUploadRequestEx
|
||||
public WxMpMaterialUploadResult execute(String uri, WxMpMaterial material) throws WxErrorException, IOException {
|
||||
logger.debug("OkhttpMaterialUploadRequestExecutor is running");
|
||||
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();
|
||||
if (file == null || !file.exists()) {
|
||||
|
@@ -23,9 +23,7 @@ public class WxMpBusyRetryTest {
|
||||
RequestExecutor<T, E> executor, String uri, E data)
|
||||
throws WxErrorException {
|
||||
this.log.info("Executed");
|
||||
WxError error = new WxError();
|
||||
error.setErrorCode(-1);
|
||||
throw new WxErrorException(error);
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1).build());
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user