mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
使用lombok的@Data注解简化common模块的所有bean类
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user