🎨 升级部分依赖版本,优化代码,部分代码增加泛型参数

This commit is contained in:
altusea
2025-05-13 15:56:14 +08:00
committed by GitHub
parent a7b007f853
commit 063fbb7f19
263 changed files with 559 additions and 607 deletions

12
pom.xml
View File

@@ -196,17 +196,19 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<version>33.3.1-jre</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.15.2</version>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.18.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 测试所用依赖 -->

View File

@@ -18,11 +18,13 @@ import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.AppContext;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool;
import redis.clients.jedis.util.Pool;
import java.time.Duration;
import java.util.Set;
/**
@@ -75,7 +77,7 @@ public class WxQidianStorageAutoConfiguration {
}
private WxQidianConfigStorage jedisConfigStorage() {
Pool jedisPool;
Pool<Jedis> jedisPool;
if (StringUtils.isNotEmpty(redisHost) || StringUtils.isNotEmpty(redisHost2)) {
jedisPool = getJedisPool();
} else {
@@ -104,7 +106,7 @@ public class WxQidianStorageAutoConfiguration {
}
}
private Pool getJedisPool() {
private Pool<Jedis> getJedisPool() {
WxQidianProperties.ConfigStorage storage = wxQidianProperties.getConfigStorage();
RedisProperties redis = storage.getRedis();
@@ -116,7 +118,7 @@ public class WxQidianStorageAutoConfiguration {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
config.setMaxWait(Duration.ofMillis(redis.getMaxWaitMillis()));
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());

View File

@@ -20,6 +20,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool;
@@ -80,7 +81,7 @@ public class WxQidianStorageAutoConfiguration {
}
private WxQidianConfigStorage jedisConfigStorage() {
Pool jedisPool;
Pool<Jedis> jedisPool;
if (StringUtils.isNotEmpty(redisHost) || StringUtils.isNotEmpty(redisHost2)) {
jedisPool = getJedisPool();
} else {
@@ -136,7 +137,7 @@ public class WxQidianStorageAutoConfiguration {
}
}
private Pool getJedisPool() {
private Pool<Jedis> getJedisPool() {
WxQidianProperties.ConfigStorage storage = wxQidianProperties.getConfigStorage();
RedisProperties redis = storage.getRedis();

View File

@@ -131,5 +131,5 @@ public interface BaseWxChannelService extends WxService {
*
* @return . request http
*/
RequestHttp getRequestHttp();
RequestHttp<?, ?> getRequestHttp();
}

View File

@@ -66,7 +66,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
private int maxRetryTimes = 5;
@Override
public RequestHttp getRequestHttp() {
public RequestHttp<H, P> getRequestHttp() {
return this;
}
@@ -75,7 +75,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
try {
return SHA1.gen(this.getConfig().getToken(), timestamp, nonce).equals(signature);
} catch (Exception e) {
log.error("Checking signature failed, and the reason is :" + e.getMessage());
log.error("Checking signature failed, and the reason is :{}", e.getMessage());
return false;
}
}
@@ -276,7 +276,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
* @throws WxErrorException 异常
*/
protected String extractAccessToken(String resultContent) throws WxErrorException {
log.debug("access-token response: " + resultContent);
log.debug("access-token response: {}", resultContent);
WxChannelConfig config = this.getConfig();
WxError error = WxError.fromJson(resultContent, WxType.Channel);
if (error.getErrorCode() != 0) {

View File

@@ -28,7 +28,7 @@ import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Assist
public class WxAssistantServiceImpl implements WxAssistantService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
@Override
public WxChannelBaseResponse addWindowProduct(AddWindowProductRequest req) throws WxErrorException {
String resJson = shopService.post(ADD_WINDOW_PRODUCT_URL, "{}");

View File

@@ -29,9 +29,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelAddressServiceImpl implements WxChannelAddressService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelAddressServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelAddressServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -23,9 +23,9 @@ import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Compla
public class WxChannelAfterSaleServiceImpl implements WxChannelAfterSaleService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelAfterSaleServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelAfterSaleServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -31,9 +31,9 @@ import me.chanjar.weixin.common.util.http.RequestExecutor;
public class WxChannelBasicServiceImpl implements WxChannelBasicService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelBasicServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelBasicServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -33,9 +33,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelBrandServiceImpl implements WxChannelBrandService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelBrandServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelBrandServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -37,9 +37,9 @@ import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
public class WxChannelCategoryServiceImpl implements WxChannelCategoryService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelCategoryServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelCategoryServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}
@@ -56,7 +56,7 @@ public class WxChannelCategoryServiceImpl implements WxChannelCategoryService {
try {
pid = Long.parseLong(parentId);
} catch (Throwable e) {
log.error("parentId必须为数字, " + parentId, e);
log.error("parentId必须为数字, {}", parentId, e);
return Collections.emptyList();
}
String reqJson = "{\"f_cat_id\": " + pid + "}";
@@ -80,7 +80,7 @@ public class WxChannelCategoryServiceImpl implements WxChannelCategoryService {
try {
catId = Long.parseLong(id);
} catch (Throwable e) {
log.error("id必须为数字, " + id, e);
log.error("id必须为数字, {}", id, e);
return ResponseUtils.internalError(CategoryDetailResult.class);
}
String reqJson = "{\"cat_id\": " + catId + "}";

View File

@@ -20,9 +20,9 @@ public class WxChannelCompassFinderServiceImpl implements WxChannelCompassFinder
/**
* 微信商店服务
*/
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelCompassFinderServiceImpl(BaseWxChannelServiceImpl shopService) {this.shopService = shopService;}
public WxChannelCompassFinderServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {this.shopService = shopService;}
@Override
public OverallResponse getOverall(String ds) throws WxErrorException {

View File

@@ -41,9 +41,9 @@ public class WxChannelCompassShopServiceImpl implements WxChannelCompassShopServ
/**
* 微信商店服务
*/
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelCompassShopServiceImpl(BaseWxChannelServiceImpl shopService) {this.shopService = shopService;}
public WxChannelCompassShopServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {this.shopService = shopService;}
@Override
public ShopOverallResponse getShopOverall(String ds) throws WxErrorException {

View File

@@ -35,9 +35,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelCouponServiceImpl implements WxChannelCouponService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelCouponServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelCouponServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -24,9 +24,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
@Slf4j
public class WxChannelFreightTemplateServiceImpl implements WxChannelFreightTemplateService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelFreightTemplateServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelFreightTemplateServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -54,9 +54,9 @@ public class WxChannelFundServiceImpl implements WxChannelFundService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelFundServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelFundServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -27,10 +27,10 @@ public class WxChannelLiveDashboardServiceImpl implements WxChannelLiveDashboard
/**
* 微信商店服务
*/
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
private final ObjectMapper objectMapper = new ObjectMapper();
public WxChannelLiveDashboardServiceImpl(BaseWxChannelServiceImpl shopService) {this.shopService = shopService;}
public WxChannelLiveDashboardServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {this.shopService = shopService;}
@Override
public LiveListResponse getLiveList(Long ds) throws WxErrorException {

View File

@@ -39,9 +39,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelOrderServiceImpl implements WxChannelOrderService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelOrderServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelOrderServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -56,9 +56,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelProductServiceImpl implements WxChannelProductService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelProductServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelProductServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -33,9 +33,9 @@ import me.chanjar.weixin.common.util.json.GsonHelper;
public class WxChannelSharerServiceImpl implements WxChannelSharerService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelSharerServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelSharerServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -18,9 +18,9 @@ import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Vip.*;
@Slf4j
public class WxChannelVipServiceImpl implements WxChannelVipService {
private BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelVipServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelVipServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -40,9 +40,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxChannelWarehouseServiceImpl implements WxChannelWarehouseService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxChannelWarehouseServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxChannelWarehouseServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -26,7 +26,7 @@ import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Finder
public class WxFinderLiveServiceImpl implements WxFinderLiveService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
@Override
public FinderAttrResponse getFinderAttrByAppid() throws WxErrorException {
String resJson = shopService.post(GET_FINDER_ATTR_BY_APPID, "{}");

View File

@@ -38,7 +38,7 @@ import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.LeadCo
public class WxLeadComponentServiceImpl implements WxLeadComponentService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
private final ObjectMapper objectMapper = new ObjectMapper();
@Override
public LeadInfoResponse getLeadsInfoByComponentId(GetLeadInfoByComponentRequest req) throws WxErrorException {

View File

@@ -32,9 +32,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxLeagueProductServiceImpl implements WxLeagueProductService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxLeagueProductServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxLeagueProductServiceImpl(BaseWxChannelServiceImpl<?, ?>shopService) {
this.shopService = shopService;
}

View File

@@ -24,9 +24,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxLeaguePromoterServiceImpl implements WxLeaguePromoterService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxLeaguePromoterServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxLeaguePromoterServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -38,9 +38,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxLeagueSupplierServiceImpl implements WxLeagueSupplierService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxLeagueSupplierServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxLeagueSupplierServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -29,9 +29,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxLeagueWindowServiceImpl implements WxLeagueWindowService {
/** 微信商店服务 */
private final BaseWxChannelServiceImpl shopService;
private final BaseWxChannelServiceImpl<?, ?> shopService;
public WxLeagueWindowServiceImpl(BaseWxChannelServiceImpl shopService) {
public WxLeagueWindowServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

View File

@@ -25,9 +25,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxStoreCooperationServiceImpl implements WxStoreCooperationService {
/** 微信小店服务 */
private final BaseWxChannelServiceImpl storeService;
private final BaseWxChannelServiceImpl<?, ?> storeService;
public WxStoreCooperationServiceImpl(BaseWxChannelServiceImpl storeService) {
public WxStoreCooperationServiceImpl(BaseWxChannelServiceImpl<?, ?> storeService) {
this.storeService = storeService;
}

View File

@@ -37,9 +37,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
public class WxStoreHomePageServiceImpl implements WxStoreHomePageService {
/** 微信小店服务 */
private final BaseWxChannelServiceImpl storeService;
private final BaseWxChannelServiceImpl<?, ?> storeService;
public WxStoreHomePageServiceImpl(BaseWxChannelServiceImpl storeService) {
public WxStoreHomePageServiceImpl(BaseWxChannelServiceImpl<?, ?> storeService) {
this.storeService = storeService;
}

View File

@@ -3,6 +3,7 @@ package me.chanjar.weixin.channel.executor;
import java.io.File;
import java.io.IOException;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
@@ -59,8 +60,13 @@ public class ChannelFileUploadRequestExecutor implements RequestExecutor<String,
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<String, File> create(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
return new ChannelFileUploadRequestExecutor(requestHttp);
public static RequestExecutor<String, File> create(RequestHttp<?, ?> requestHttp) throws WxErrorException {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ChannelFileUploadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
default:
throw new WxErrorException("不支持的http框架");
}
}
}

View File

@@ -103,8 +103,13 @@ public class ChannelMediaDownloadRequestExecutor implements RequestExecutor<Chan
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<ChannelImageResponse, String> create(RequestHttp requestHttp, File tmpDirFile) {
return new ChannelMediaDownloadRequestExecutor(requestHttp, tmpDirFile);
public static RequestExecutor<ChannelImageResponse, String> create(RequestHttp<?, ?> requestHttp, File tmpDirFile) throws WxErrorException {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ChannelMediaDownloadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp, tmpDirFile);
default:
throw new WxErrorException("不支持的http框架");
}
}
/**
@@ -138,7 +143,7 @@ public class ChannelMediaDownloadRequestExecutor implements RequestExecutor<Chan
}
private String extractFileNameFromContentString(String content) throws WxErrorException {
if (content == null || content.length() == 0) {
if (content == null || content.isEmpty()) {
return createDefaultFileName();
}
Matcher m = PATTERN.matcher(content);

View File

@@ -137,7 +137,7 @@ public class WxChannelMessageRouter {
}
}
if (matchRules.size() == 0) {
if (matchRules.isEmpty()) {
return null;
}
final List<Future<?>> futures = new ArrayList<>();
@@ -157,7 +157,7 @@ public class WxChannelMessageRouter {
}
}
if (futures.size() > 0) {
if (!futures.isEmpty()) {
this.executorService.submit(() -> {
for (Future<?> future : futures) {
try {

View File

@@ -24,7 +24,7 @@ import java.io.IOException;
* created on 2019/6/27 14:06
*/
public class OcrDiscernApacheHttpRequestExecutor extends OcrDiscernRequestExecutor<CloseableHttpClient, HttpHost> {
public OcrDiscernApacheHttpRequestExecutor(RequestHttp requestHttp) {
public OcrDiscernApacheHttpRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}

View File

@@ -5,6 +5,8 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.ResponseHandler;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
@@ -18,7 +20,7 @@ import java.io.IOException;
public abstract class OcrDiscernRequestExecutor<H, P> implements RequestExecutor<String, File> {
protected RequestHttp<H, P> requestHttp;
public OcrDiscernRequestExecutor(RequestHttp requestHttp) {
public OcrDiscernRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp;
}
@@ -27,10 +29,11 @@ public abstract class OcrDiscernRequestExecutor<H, P> implements RequestExecutor
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<String, File> create(RequestHttp requestHttp) {
@SuppressWarnings("unchecked")
public static RequestExecutor<String, File> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new OcrDiscernApacheHttpRequestExecutor(requestHttp);
return new OcrDiscernApacheHttpRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
default:
return null;
}

View File

@@ -2,7 +2,6 @@ package me.chanjar.weixin.common.util;
import com.google.common.collect.Lists;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

View File

@@ -65,7 +65,7 @@ public class XmlUtils {
final List<String> names = names(nodes);
// 判断节点下有无非文本节点(非Text和CDATA)如无直接取Text文本内容
if (names.size() < 1) {
if (names.isEmpty()) {
return element.getText();
}

View File

@@ -1,6 +1,5 @@
package me.chanjar.weixin.common.util.crypto;
import com.google.common.base.CharMatcher;
import lombok.AllArgsConstructor;
import lombok.Data;
import me.chanjar.weixin.common.error.WxRuntimeException;

View File

@@ -3,11 +3,17 @@ package me.chanjar.weixin.common.util.http;
import java.io.File;
import java.io.IOException;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheMediaDownloadRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpMediaDownloadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpMediaDownloadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
/**
* 下载媒体文件请求执行器.
@@ -30,14 +36,15 @@ public abstract class BaseMediaDownloadRequestExecutor<H, P> implements RequestE
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<File, String> create(RequestHttp requestHttp, File tmpDirFile) {
@SuppressWarnings("unchecked")
public static RequestExecutor<File, String> create(RequestHttp<?, ?> requestHttp, File tmpDirFile) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheMediaDownloadRequestExecutor(requestHttp, tmpDirFile);
return new ApacheMediaDownloadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp, tmpDirFile);
case JODD_HTTP:
return new JoddHttpMediaDownloadRequestExecutor(requestHttp, tmpDirFile);
return new JoddHttpMediaDownloadRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp, tmpDirFile);
case OK_HTTP:
return new OkHttpMediaDownloadRequestExecutor(requestHttp, tmpDirFile);
return new OkHttpMediaDownloadRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp, tmpDirFile);
default:
return null;
}

View File

@@ -1,11 +1,17 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheMediaInputStreamUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpMediaInputStreamUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpMediaInputStreamUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.IOException;
@@ -18,7 +24,7 @@ import java.io.IOException;
public abstract class MediaInputStreamUploadRequestExecutor<H, P> implements RequestExecutor<WxMediaUploadResult, InputStreamData> {
protected RequestHttp<H, P> requestHttp;
public MediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
public MediaInputStreamUploadRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp;
}
@@ -27,14 +33,14 @@ public abstract class MediaInputStreamUploadRequestExecutor<H, P> implements Req
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<WxMediaUploadResult, InputStreamData> create(RequestHttp requestHttp) {
public static RequestExecutor<WxMediaUploadResult, InputStreamData> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheMediaInputStreamUploadRequestExecutor(requestHttp);
return new ApacheMediaInputStreamUploadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
case JODD_HTTP:
return new JoddHttpMediaInputStreamUploadRequestExecutor(requestHttp);
return new JoddHttpMediaInputStreamUploadRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp);
case OK_HTTP:
return new OkHttpMediaInputStreamUploadRequestExecutor(requestHttp);
return new OkHttpMediaInputStreamUploadRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp);
default:
return null;
}

View File

@@ -1,5 +1,7 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.CommonUploadParam;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.enums.WxType;
@@ -8,6 +10,10 @@ import me.chanjar.weixin.common.service.WxService;
import me.chanjar.weixin.common.util.http.apache.ApacheMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
@@ -25,7 +31,7 @@ import java.io.IOException;
public abstract class MediaUploadRequestExecutor<H, P> implements RequestExecutor<WxMediaUploadResult, File> {
protected RequestHttp<H, P> requestHttp;
public MediaUploadRequestExecutor(RequestHttp requestHttp) {
public MediaUploadRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp;
}
@@ -34,14 +40,14 @@ public abstract class MediaUploadRequestExecutor<H, P> implements RequestExecuto
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<WxMediaUploadResult, File> create(RequestHttp requestHttp) {
public static RequestExecutor<WxMediaUploadResult, File> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheMediaUploadRequestExecutor(requestHttp);
return new ApacheMediaUploadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
case JODD_HTTP:
return new JoddHttpMediaUploadRequestExecutor(requestHttp);
return new JoddHttpMediaUploadRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp);
case OK_HTTP:
return new OkHttpMediaUploadRequestExecutor(requestHttp);
return new OkHttpMediaUploadRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp);
default:
return null;
}

View File

@@ -1,11 +1,17 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadCustomizeResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheMinishopMediaUploadRequestCustomizeExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpMinishopMediaUploadRequestCustomizeExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpMinishopMediaUploadRequestCustomizeExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
@@ -16,7 +22,7 @@ public abstract class MinishopUploadRequestCustomizeExecutor<H, P> implements Re
protected String uploadType;
protected String imgUrl;
public MinishopUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType, String imgUrl) {
public MinishopUploadRequestCustomizeExecutor(RequestHttp<H, P> requestHttp, String respType, String imgUrl) {
this.requestHttp = requestHttp;
this.respType = respType;
if (imgUrl == null || imgUrl.isEmpty()) {
@@ -33,14 +39,15 @@ public abstract class MinishopUploadRequestCustomizeExecutor<H, P> implements Re
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<WxMinishopImageUploadCustomizeResult, File> create(RequestHttp requestHttp, String respType, String imgUrl) {
@SuppressWarnings("unchecked")
public static RequestExecutor<WxMinishopImageUploadCustomizeResult, File> create(RequestHttp<?, ?> requestHttp, String respType, String imgUrl) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl);
return new ApacheMinishopMediaUploadRequestCustomizeExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp, respType, imgUrl);
case JODD_HTTP:
return new JoddHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl);
return new JoddHttpMinishopMediaUploadRequestCustomizeExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp, respType, imgUrl);
case OK_HTTP:
return new OkHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl);
return new OkHttpMinishopMediaUploadRequestCustomizeExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp, respType, imgUrl);
default:
return null;
}

View File

@@ -1,11 +1,17 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheMinishopMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpMinishopMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpMinishopMediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
@@ -13,7 +19,7 @@ import java.io.IOException;
public abstract class MinishopUploadRequestExecutor<H, P> implements RequestExecutor<WxMinishopImageUploadResult, File> {
protected RequestHttp<H, P> requestHttp;
public MinishopUploadRequestExecutor(RequestHttp requestHttp) {
public MinishopUploadRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp;
}
@@ -22,14 +28,15 @@ public abstract class MinishopUploadRequestExecutor<H, P> implements RequestExec
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<WxMinishopImageUploadResult, File> create(RequestHttp requestHttp) {
@SuppressWarnings("unchecked")
public static RequestExecutor<WxMinishopImageUploadResult, File> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheMinishopMediaUploadRequestExecutor(requestHttp);
return new ApacheMinishopMediaUploadRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
case JODD_HTTP:
return new JoddHttpMinishopMediaUploadRequestExecutor(requestHttp);
return new JoddHttpMinishopMediaUploadRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp);
case OK_HTTP:
return new OkHttpMinishopMediaUploadRequestExecutor(requestHttp);
return new OkHttpMinishopMediaUploadRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp);
default:
return null;
}

View File

@@ -1,11 +1,17 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheSimpleGetRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpSimpleGetRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpSimpleGetRequestExecutor;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.IOException;
@@ -27,14 +33,15 @@ public abstract class SimpleGetRequestExecutor<H, P> implements RequestExecutor<
handler.handle(this.execute(uri, data, wxType));
}
@SuppressWarnings("unchecked")
public static RequestExecutor<String, String> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheSimpleGetRequestExecutor(requestHttp);
return new ApacheSimpleGetRequestExecutor((RequestHttp< CloseableHttpClient, HttpHost>) requestHttp);
case JODD_HTTP:
return new JoddHttpSimpleGetRequestExecutor(requestHttp);
return new JoddHttpSimpleGetRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp);
case OK_HTTP:
return new OkHttpSimpleGetRequestExecutor(requestHttp);
return new OkHttpSimpleGetRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp);
default:
throw new IllegalArgumentException("非法请求参数");
}

View File

@@ -1,11 +1,17 @@
package me.chanjar.weixin.common.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.apache.ApacheSimplePostRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpSimplePostRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpSimplePostRequestExecutor;
import okhttp3.OkHttpClient;
import org.apache.http.HttpHost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@@ -18,7 +24,7 @@ import java.io.IOException;
public abstract class SimplePostRequestExecutor<H, P> implements RequestExecutor<String, String> {
protected RequestHttp<H, P> requestHttp;
public SimplePostRequestExecutor(RequestHttp requestHttp) {
public SimplePostRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp;
}
@@ -28,14 +34,14 @@ public abstract class SimplePostRequestExecutor<H, P> implements RequestExecutor
handler.handle(this.execute(uri, data, wxType));
}
public static RequestExecutor<String, String> create(RequestHttp requestHttp) {
public static RequestExecutor<String, String> create(RequestHttp<?, ?> requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheSimplePostRequestExecutor(requestHttp);
return new ApacheSimplePostRequestExecutor((RequestHttp<CloseableHttpClient, HttpHost>) requestHttp);
case JODD_HTTP:
return new JoddHttpSimplePostRequestExecutor(requestHttp);
return new JoddHttpSimplePostRequestExecutor((RequestHttp<HttpConnectionProvider, ProxyInfo>) requestHttp);
case OK_HTTP:
return new OkHttpSimplePostRequestExecutor(requestHttp);
return new OkHttpSimplePostRequestExecutor((RequestHttp<OkHttpClient, OkHttpProxyInfo>) requestHttp);
default:
throw new IllegalArgumentException("非法请求参数");
}

View File

@@ -28,7 +28,7 @@ import java.io.InputStream;
* created on 2017/5/5
*/
public class ApacheMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheMediaDownloadRequestExecutor(RequestHttp requestHttp, File tmpDirFile) {
public ApacheMediaDownloadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp, File tmpDirFile) {
super(requestHttp, tmpDirFile);
}

View File

@@ -26,7 +26,7 @@ import java.io.IOException;
* created on 2022/02/15
*/
public class ApacheMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
public ApacheMediaInputStreamUploadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}

View File

@@ -22,7 +22,7 @@ import java.io.IOException;
* Created by ecoolper on 2017/5/5.
*/
public class ApacheMediaUploadRequestExecutor extends MediaUploadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheMediaUploadRequestExecutor(RequestHttp requestHttp) {
public ApacheMediaUploadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}

View File

@@ -24,7 +24,7 @@ import java.io.IOException;
*/
@Slf4j
public class ApacheMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<CloseableHttpClient, HttpHost> {
public ApacheMinishopMediaUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType, String imgUrl) {
public ApacheMinishopMediaUploadRequestCustomizeExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp, String respType, String imgUrl) {
super(requestHttp, respType, imgUrl);
}
@@ -64,7 +64,7 @@ public class ApacheMinishopMediaUploadRequestCustomizeExecutor extends MinishopU
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadCustomizeResult.fromJson(responseContent);
} finally {
httpPost.releaseConnection();

View File

@@ -5,7 +5,6 @@ import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.MinishopUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import org.apache.http.HttpEntity;
@@ -25,7 +24,7 @@ import java.io.IOException;
*/
@Slf4j
public class ApacheMinishopMediaUploadRequestExecutor extends MinishopUploadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheMinishopMediaUploadRequestExecutor(RequestHttp requestHttp) {
public ApacheMinishopMediaUploadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}
@@ -50,7 +49,7 @@ public class ApacheMinishopMediaUploadRequestExecutor extends MinishopUploadRequ
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadResult.fromJson(responseContent);
} finally {
httpPost.releaseConnection();

View File

@@ -19,7 +19,7 @@ import java.io.IOException;
* created on 2017/5/4
*/
public class ApacheSimpleGetRequestExecutor extends SimpleGetRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheSimpleGetRequestExecutor(RequestHttp requestHttp) {
public ApacheSimpleGetRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}

View File

@@ -21,7 +21,7 @@ import java.io.IOException;
* created on 2017/5/4
*/
public class ApacheSimplePostRequestExecutor extends SimplePostRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheSimplePostRequestExecutor(RequestHttp requestHttp) {
public ApacheSimplePostRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}

View File

@@ -25,17 +25,13 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.protocol.HttpContext;
import org.apache.http.ssl.SSLContexts;
import javax.annotation.concurrent.NotThreadSafe;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

View File

@@ -4,7 +4,6 @@ import jodd.http.HttpConnectionProvider;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import jodd.util.StringPool;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
@@ -28,7 +27,7 @@ import java.nio.charset.StandardCharsets;
* created on 2017/5/5
*/
public class JoddHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpMediaDownloadRequestExecutor(RequestHttp requestHttp, File tmpDirFile) {
public JoddHttpMediaDownloadRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp, File tmpDirFile) {
super(requestHttp, tmpDirFile);
}

View File

@@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets;
* created on 2022/02/15
*/
public class JoddHttpMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
public JoddHttpMediaInputStreamUploadRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -4,7 +4,6 @@ import jodd.http.HttpConnectionProvider;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import jodd.util.StringPool;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxError;
@@ -23,7 +22,7 @@ import java.nio.charset.StandardCharsets;
* created on 2017/5/5
*/
public class JoddHttpMediaUploadRequestExecutor extends MediaUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpMediaUploadRequestExecutor(RequestHttp requestHttp) {
public JoddHttpMediaUploadRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
*/
@Slf4j
public class JoddHttpMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpMinishopMediaUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType, String imgUrl) {
public JoddHttpMinishopMediaUploadRequestCustomizeExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp, String respType, String imgUrl) {
super(requestHttp, respType, imgUrl);
}
@@ -51,7 +51,7 @@ public class JoddHttpMinishopMediaUploadRequestCustomizeExecutor extends Minisho
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadCustomizeResult.fromJson(responseContent);
}

View File

@@ -5,12 +5,10 @@ import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.MinishopUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
@@ -26,7 +24,7 @@ import java.nio.charset.StandardCharsets;
*/
@Slf4j
public class JoddHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpMinishopMediaUploadRequestExecutor(RequestHttp requestHttp) {
public JoddHttpMinishopMediaUploadRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp) {
super(requestHttp);
}
@@ -46,7 +44,7 @@ public class JoddHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRe
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadResult.fromJson(responseContent);
}

View File

@@ -4,7 +4,6 @@ import jodd.http.HttpConnectionProvider;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import jodd.util.StringPool;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestHttp;
@@ -20,7 +19,7 @@ import java.nio.charset.StandardCharsets;
* created on 2017/5/4
*/
public class JoddHttpSimpleGetRequestExecutor extends SimpleGetRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpSimpleGetRequestExecutor(RequestHttp requestHttp) {
public JoddHttpSimpleGetRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets;
* created on 2017/5/4
*/
public class JoddHttpSimplePostRequestExecutor extends SimplePostRequestExecutor<HttpConnectionProvider, ProxyInfo> {
public JoddHttpSimplePostRequestExecutor(RequestHttp requestHttp) {
public JoddHttpSimplePostRequestExecutor(RequestHttp<HttpConnectionProvider, ProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException;
*/
@Slf4j
public class OkHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpMediaDownloadRequestExecutor(RequestHttp requestHttp, File tmpDirFile) {
public OkHttpMediaDownloadRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp, File tmpDirFile) {
super(requestHttp, tmpDirFile);
}

View File

@@ -20,7 +20,7 @@ import java.io.InputStream;
* created on 2022/02/15
*/
public class OkHttpMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
public OkHttpMediaInputStreamUploadRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -18,7 +18,7 @@ import java.io.IOException;
* created on 2017/5/5
*/
public class OkHttpMediaUploadRequestExecutor extends MediaUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpMediaUploadRequestExecutor(RequestHttp requestHttp) {
public OkHttpMediaUploadRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -18,7 +18,7 @@ import java.io.IOException;
*/
@Slf4j
public class OkHttpMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpMinishopMediaUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType, String imgUrl) {
public OkHttpMinishopMediaUploadRequestCustomizeExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp, String respType, String imgUrl) {
super(requestHttp, respType, imgUrl);
}
@@ -50,7 +50,7 @@ public class OkHttpMinishopMediaUploadRequestCustomizeExecutor extends MinishopU
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadCustomizeResult.fromJson(responseContent);
}

View File

@@ -1,12 +1,10 @@
package me.chanjar.weixin.common.util.http.okhttp;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.MinishopUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import okhttp3.*;
@@ -22,7 +20,7 @@ import java.io.IOException;
*/
@Slf4j
public class OkHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpMinishopMediaUploadRequestExecutor(RequestHttp requestHttp) {
public OkHttpMinishopMediaUploadRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp) {
super(requestHttp);
}
@@ -43,7 +41,7 @@ public class OkHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRequ
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
log.info("responseContent: " + responseContent);
log.info("responseContent: {}", responseContent);
return WxMinishopImageUploadResult.fromJson(responseContent);
}

View File

@@ -17,7 +17,7 @@ import java.io.IOException;
* created on 2017/5/4
*/
public class OkHttpSimpleGetRequestExecutor extends SimpleGetRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpSimpleGetRequestExecutor(RequestHttp requestHttp) {
public OkHttpSimpleGetRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -18,7 +18,7 @@ import java.util.Objects;
*/
@Slf4j
public class OkHttpSimplePostRequestExecutor extends SimplePostRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
public OkHttpSimplePostRequestExecutor(RequestHttp requestHttp) {
public OkHttpSimplePostRequestExecutor(RequestHttp<OkHttpClient, OkHttpProxyInfo> requestHttp) {
super(requestHttp);
}

View File

@@ -49,7 +49,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
buttonJson.addProperty("article_id", button.getArticleId());
buttonJson.addProperty("appid", button.getAppId());
buttonJson.addProperty("pagepath", button.getPagePath());
if (button.getSubButtons() != null && button.getSubButtons().size() > 0) {
if (button.getSubButtons() != null && !button.getSubButtons().isEmpty()) {
JsonArray buttonArray = new JsonArray();
for (WxMenuButton sub_button : button.getSubButtons()) {
buttonArray.add(convertToJson(sub_button));

View File

@@ -20,7 +20,7 @@ public class WxNetCheckResultGsonAdapter implements JsonDeserializer<WxNetCheckR
JsonArray dnssJson = json.getAsJsonObject().get("dns").getAsJsonArray();
List<WxNetCheckResult.WxNetCheckDnsInfo> dnsInfoList = new ArrayList<>();
if (dnssJson != null && dnssJson.size() > 0) {
if (dnssJson != null && !dnssJson.isEmpty()) {
for (int i = 0; i < dnssJson.size(); i++) {
JsonObject buttonJson = dnssJson.get(i).getAsJsonObject();
WxNetCheckResult.WxNetCheckDnsInfo dnsInfo = new WxNetCheckResult.WxNetCheckDnsInfo();
@@ -32,7 +32,7 @@ public class WxNetCheckResultGsonAdapter implements JsonDeserializer<WxNetCheckR
JsonArray pingsJson = json.getAsJsonObject().get("ping").getAsJsonArray();
List<WxNetCheckResult.WxNetCheckPingInfo> pingInfoList = new ArrayList<>();
if (pingsJson != null && pingsJson.size() > 0) {
if (pingsJson != null && !pingsJson.isEmpty()) {
for (int i = 0; i < pingsJson.size(); i++) {
JsonObject pingJson = pingsJson.get(i).getAsJsonObject();
WxNetCheckResult.WxNetCheckPingInfo pingInfo = new WxNetCheckResult.WxNetCheckPingInfo();

View File

@@ -9,7 +9,7 @@ import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.data.redis.core.types.Expiration;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -66,7 +66,7 @@ public class RedisTemplateSimpleDistributedLock implements Lock {
@Override
public boolean tryLock() {
String value = valueThreadLocal.get();
if (value == null || value.length() == 0) {
if (value == null || value.isEmpty()) {
value = UUID.randomUUID().toString();
valueThreadLocal.set(value);
}
@@ -98,8 +98,8 @@ public class RedisTemplateSimpleDistributedLock implements Lock {
public void unlock() {
if (valueThreadLocal.get() != null) {
// 提示: 必须指定returnType, 类型: 此处必须为Long, 不能是Integer
RedisScript<Long> script = new DefaultRedisScript("if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end", Long.class);
redisTemplate.execute(script, Arrays.asList(key), valueThreadLocal.get());
RedisScript<Long> script = new DefaultRedisScript<>("if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end", Long.class);
redisTemplate.execute(script, Collections.singletonList(key), valueThreadLocal.get());
valueThreadLocal.remove();
}
}

View File

@@ -25,7 +25,7 @@ public class IntegerArrayConverter extends StringConverter {
@Override
public Object fromString(String str) {
if (str == null || str.length() == 0) {
if (str == null || str.isEmpty()) {
return null;
}

View File

@@ -101,7 +101,6 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.4</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@@ -5,8 +5,6 @@ import me.chanjar.weixin.cp.bean.oa.meeting.WxCpMeeting;
import me.chanjar.weixin.cp.bean.oa.meeting.WxCpMeetingUpdateResult;
import me.chanjar.weixin.cp.bean.oa.meeting.WxCpUserMeetingIdResult;
import java.util.List;
/**
* 企业微信日程接口.
* 企业和开发者通过会议接口可以便捷地预定及管理会议,用于小组周会、部门例会等场景。

View File

@@ -110,7 +110,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
return SHA1.gen(this.configStorage.getToken(), timestamp, nonce, data)
.equals(msgSignature);
} catch (Exception e) {
log.error("Checking signature failed, and the reason is :" + e.getMessage());
log.error("Checking signature failed, and the reason is :{}", e.getMessage());
return false;
}
}

View File

@@ -8,7 +8,6 @@ import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.cp.api.WxCpCorpGroupService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorp;
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpListAppShareInfoResp;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.util.List;

View File

@@ -16,6 +16,7 @@ import me.chanjar.weixin.cp.api.WxCpMediaService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.media.MediaUploadByUrlReq;
import me.chanjar.weixin.cp.bean.media.MediaUploadByUrlResult;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.IOException;
@@ -67,12 +68,7 @@ public class WxCpMediaServiceImpl implements WxCpMediaService {
, this.mainService.getWxCpConfigStorage().getApiUrl(MEDIA_UPLOAD + mediaType),
new InputStreamData(inputStream, filename));
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
}
}
IOUtils.closeQuietly(inputStream);
if (conn != null) {
conn.disconnect();
}

View File

@@ -11,7 +11,6 @@ import me.chanjar.weixin.cp.bean.oa.meeting.WxCpUserMeetingIdResult;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.*;

View File

@@ -66,9 +66,9 @@ public class WxCpMsgAuditServiceImpl implements WxCpMsgAuditService {
List<String> libList = Arrays.asList(libFiles);
// 判断windows系统会话存档sdk中dll的加载因为会互相依赖所以是有顺序的否则会导致无法加载sdk #2598
List<String> osLib = new LinkedList();
List<String> fileLib = new ArrayList();
libList.stream().forEach(s -> {
List<String> osLib = new LinkedList<>();
List<String> fileLib = new ArrayList<>();
libList.forEach(s -> {
if (s.contains("lib")) {
osLib.add(s);
} else {

View File

@@ -99,7 +99,7 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
if (StringUtils.isNotEmpty(name)) {
jsonObject.addProperty("name", name);
}
if (departments != null && departments.size() > 0) {
if (departments != null && !departments.isEmpty()) {
JsonArray jsonArray = new JsonArray();
for (Integer depart : departments) {
jsonArray.add(new JsonPrimitive(depart));

View File

@@ -2,7 +2,6 @@ package me.chanjar.weixin.cp.bean.corpgroup;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import java.io.Serializable;
import java.util.List;

View File

@@ -4,7 +4,6 @@ import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionInfo;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;

View File

@@ -2,10 +2,7 @@ package me.chanjar.weixin.cp.bean.external.interceptrule;
import com.google.gson.annotations.SerializedName;
import lombok.*;
import me.chanjar.weixin.common.bean.ToJson;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionInfo;
import me.chanjar.weixin.cp.bean.external.acquisition.WxCpCustomerAcquisitionList;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;

View File

@@ -14,7 +14,6 @@ import java.io.Serializable;
import java.util.List;
import static me.chanjar.weixin.cp.constant.WxCpConsts.GroupRobotMsgType.*;
import static me.chanjar.weixin.cp.constant.WxCpConsts.GroupRobotMsgType.TEMPLATE_CARD;
/**
* 微信群机器人消息

View File

@@ -6,10 +6,8 @@ import org.apache.commons.lang3.StringUtils;
/**
* The type Base builder.
*
* @param <T> the type parameter
*/
public class BaseBuilder<T> {
public abstract class BaseBuilder<T> {
/**
* The Msg type.
*/

View File

@@ -24,7 +24,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Base info.
*/
@Data
public class BaseInfo implements Serializable {
public static class BaseInfo implements Serializable {
private static final long serialVersionUID = 3679745559788648438L;
@@ -143,7 +143,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Summary info.
*/
@Data
public class SummaryInfo implements Serializable {
public static class SummaryInfo implements Serializable {
private static final long serialVersionUID = 3428576099259666595L;
/**
* checkin_count 当日打卡次数
@@ -186,7 +186,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Holiday infos.
*/
@Data
public class HolidayInfos implements Serializable {
public static class HolidayInfos implements Serializable {
private static final long serialVersionUID = -6671577072585561527L;
/**
* sp_number 假勤相关信息
@@ -282,7 +282,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Exception infos.
*/
@Data
public class ExceptionInfos implements Serializable {
public static class ExceptionInfos implements Serializable {
private static final long serialVersionUID = -5987438373762518299L;
/**
* exception 校准状态类型1-迟到2-早退3-缺卡4-旷工5-地点异常6-设备异常
@@ -313,7 +313,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Ot info.
*/
@Data
public class OtInfo implements Serializable {
public static class OtInfo implements Serializable {
private static final long serialVersionUID = -6557759801572150175L;
/**
* ot_status 状态0-无加班1-正常2-缺时长
@@ -344,7 +344,7 @@ public class WxCpCheckinDayData implements Serializable {
* The type Sp item.
*/
@Data
public class SpItem implements Serializable {
public static class SpItem implements Serializable {
private static final long serialVersionUID = 2423158264958352024L;
/**
* type 类型1-请假2-补卡3-出差4-外出100-外勤

View File

@@ -49,7 +49,7 @@ public class WxCpCheckinSchedule implements Serializable {
* The type User schedule.
*/
@Data
public class UserSchedule implements Serializable {
public static class UserSchedule implements Serializable {
private static final long serialVersionUID = 9138985222324576857L;
/**
* scheduleList 个人排班表信息

View File

@@ -1,15 +1,11 @@
package me.chanjar.weixin.cp.bean.oa.meeting;
import com.google.common.base.Splitter;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
/**
* 为标签添加或移除用户结果对象类.

View File

@@ -59,7 +59,7 @@ public class MultipleSelect implements Serializable {
}
// select_list
List<CheckboxOption> options = this.getOptions();
if (null != options && options.size() > 0) {
if (null != options && !options.isEmpty()) {
JsonArray optionJsonArray = new JsonArray();
for (CheckboxOption option : this.getOptions()) {
JsonObject tempObject = option.toJson();

View File

@@ -44,7 +44,7 @@ public class TemplateCardButtonSelection implements Serializable {
btnObject.addProperty("selected_id", this.selectedId);
}
if (this.optionList != null && this.optionList.size() > 0) {
if (this.optionList != null && !this.optionList.isEmpty()) {
JsonArray optionJsonArray = new JsonArray();
for (TemplateCardButtonSelectionOption jump : this.getOptionList()) {
JsonObject tempObject = jump.toJson();

View File

@@ -17,7 +17,6 @@ import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpGetTokenReq;
import me.chanjar.weixin.cp.bean.corpgroup.WxCpMaTransferSession;
import me.chanjar.weixin.cp.config.WxCpCorpGroupConfigStorage;
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
import me.chanjar.weixin.cp.corpgroup.service.WxCpCgService;
import me.chanjar.weixin.cp.corpgroup.service.WxCpLinkedCorpService;

View File

@@ -205,12 +205,12 @@ public class WxCpMessageRouter {
}
}
if (matchRules.size() == 0) {
if (matchRules.isEmpty()) {
return null;
}
WxCpXmlOutMessage res = null;
final List<Future> futures = new ArrayList<>();
final List<Future<?>> futures = new ArrayList<>();
for (final WxCpMessageRouterRule rule : matchRules) {
// 返回最后一个非异步的rule的执行结果
if (rule.isAsync()) {
@@ -228,9 +228,9 @@ public class WxCpMessageRouter {
}
}
if (futures.size() > 0) {
if (!futures.isEmpty()) {
this.executorService.submit(() -> {
for (Future future : futures) {
for (Future<?> future : futures) {
try {
future.get();
log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName());

View File

@@ -213,12 +213,12 @@ public class WxCpTpMessageRouter {
}
}
if (matchRules.size() == 0) {
if (matchRules.isEmpty()) {
return null;
}
WxCpXmlOutMessage res = null;
final List<Future> futures = new ArrayList<>();
final List<Future<?>> futures = new ArrayList<>();
for (final WxCpTpMessageRouterRule rule : matchRules) {
// 返回最后一个非异步的rule的执行结果
if (rule.isAsync()) {
@@ -236,9 +236,9 @@ public class WxCpTpMessageRouter {
}
}
if (futures.size() > 0) {
if (!futures.isEmpty()) {
this.executorService.submit(() -> {
for (Future future : futures) {
for (Future<?> future : futures) {
try {
future.get();
log.debug("End session access: async=true, sessionId={}", wxMessage.getSuiteId());

View File

@@ -6,8 +6,6 @@ import me.chanjar.weixin.cp.bean.WxCpTpOpenKfIdConvertResult;
import me.chanjar.weixin.cp.bean.WxCpTpTagIdListConvertResult;
import me.chanjar.weixin.cp.bean.WxCpTpUnionidToExternalUseridResult;
import java.util.List;
/**
* <pre>
* 企业微信三方应用ID转换接口

View File

@@ -104,7 +104,7 @@ public abstract class BaseWxCpTpServiceImpl<H, P> implements WxCpTpService, Requ
return SHA1.gen(this.configStorage.getToken(), timestamp, nonce, data)
.equals(msgSignature);
} catch (Exception e) {
log.error("Checking signature failed, and the reason is :" + e.getMessage());
log.error("Checking signature failed, and the reason is :{}", e.getMessage());
return false;
}
}

View File

@@ -14,8 +14,6 @@ import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
import me.chanjar.weixin.cp.tp.service.WxCpTpIdConvertService;
import me.chanjar.weixin.cp.tp.service.WxCpTpService;
import java.util.List;
/**
* @author cocoa

View File

@@ -17,7 +17,7 @@ public class XStreamTransformer {
/**
* The constant CLASS_2_XSTREAM_INSTANCE.
*/
protected static final Map<Class, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance();
protected static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance();
/**
* xml -> pojo
@@ -53,7 +53,7 @@ public class XStreamTransformer {
* @param clz 类型
* @param xStream xml解析器
*/
public static void register(Class clz, XStream xStream) {
public static void register(Class<?> clz, XStream xStream) {
CLASS_2_XSTREAM_INSTANCE.put(clz, xStream);
}
@@ -69,8 +69,8 @@ public class XStreamTransformer {
return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object);
}
private static Map<Class, XStream> configXStreamInstance() {
Map<Class, XStream> map = new HashMap<>();
private static Map<Class<?>, XStream> configXStreamInstance() {
Map<Class<?>, XStream> map = new HashMap<>();
map.put(WxCpXmlMessage.class, configWxCpXmlMessage());
map.put(WxCpXmlOutNewsMessage.class, configWxCpXmlOutNewsMessage());
map.put(WxCpXmlOutTextMessage.class, configWxCpXmlOutTextMessage());

View File

@@ -51,7 +51,7 @@ public interface WxMaCloudService {
* @return the list
* @throws WxErrorException the wx error exception
*/
List<String> add(String collection, List list) throws WxErrorException;
List<String> add(String collection, List<?> list) throws WxErrorException;
/**
* Add string.

View File

@@ -2,7 +2,6 @@ package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.order.WxMaOrderManagementGetOrderDetailPath;
import cn.binarywang.wx.miniapp.bean.order.WxMaOrderManagementResult;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**

View File

@@ -5,18 +5,16 @@ import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetBrandResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetCategoryResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetFrightTemplateResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSkuListResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpu;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGet;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopUpdateGoodsSkuData;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse;
import java.io.File;
import java.util.List;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;

View File

@@ -147,7 +147,7 @@ public interface WxMaService extends WxService {
<T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
WxMaApiResponse execute(
ApiSignaturePostRequestExecutor executor,
ApiSignaturePostRequestExecutor<?, ?> executor,
String uri,
Map<String, String> headers,
String data)
@@ -353,7 +353,7 @@ public interface WxMaService extends WxService {
*
* @return . request http
*/
RequestHttp getRequestHttp();
RequestHttp<?, ?> getRequestHttp();
/**
* 获取物流助手接口服务对象

Some files were not shown because too many files have changed in this diff Show More