Skip to content

Develop #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1812b23
art:证书类配置读取优化调整
Aug 17, 2020
2b27ee9
new:电商收付通二级商户进件
Aug 17, 2020
a3ec261
Merge branch 'develop' into develop
binarywang Aug 18, 2020
cee3753
Merge remote-tracking branch 'wechat/develop' into develop
Aug 24, 2020
10e0ca5
art:微信服务商配置优化
Aug 24, 2020
5db9706
new:jsapi合单支付
Aug 24, 2020
e0d87eb
new:合单支付
Aug 26, 2020
84b9b99
Merge remote-tracking branch 'wechat/develop' into develop
Aug 30, 2020
541899a
Merge remote-tracking branch 'wechat/develop' into develop
Sep 4, 2020
9f60516
Merge remote-tracking branch 'wechat/develop' into develop
Sep 8, 2020
97409a7
new:电商收付通普通支付
Sep 8, 2020
f18c62b
new:电商收付通支付回调处理
Sep 10, 2020
b8d9a15
Merge remote-tracking branch 'wechat/develop' into develop
Sep 10, 2020
c8fc670
new:电商收付通支付回调处理
Sep 10, 2020
4f157b0
Merge remote-tracking branch 'wechat/develop' into develop
Sep 10, 2020
34f0d99
电商收付通支付调整
Sep 11, 2020
c2552de
Merge remote-tracking branch 'wechat/develop' into develop
Sep 11, 2020
3fbeec4
Merge remote-tracking branch 'wechat/develop' into develop
Sep 14, 2020
e56289f
Merge remote-tracking branch 'wechat/develop' into develop
Sep 15, 2020
60c63a5
fix:电商收付通回调通知测试
Sep 17, 2020
5b606fd
Merge remote-tracking branch 'wechat/develop' into develop
Sep 17, 2020
aa2fe98
Merge remote-tracking branch 'wechat/develop' into develop
Sep 20, 2020
9b20c74
new:电商收付通合单支付、普通支付查询
Sep 21, 2020
00bc965
new:电商收付通商户、平台提现
Sep 21, 2020
2037900
fix:命名统一调整
Sep 21, 2020
3b4bb74
Merge remote-tracking branch 'wechat/develop' into develop
Sep 22, 2020
58ac339
new:分账查询、退款通知
Sep 22, 2020
7df0e75
new:修改结算账户、退款查询
Sep 23, 2020
07edd5b
Merge remote-tracking branch 'wechat/develop' into develop
Sep 23, 2020
f0f21e1
Merge remote-tracking branch 'wechat/develop' into develop
Sep 25, 2020
a28a17a
Merge remote-tracking branch 'wechat/develop' into develop
Sep 27, 2020
d248c0e
fix:字段错误
Sep 28, 2020
9603199
Merge remote-tracking branch 'wechat/develop' into develop
Sep 28, 2020
429f170
:new: #1789 微信支付电商收付通增加下载账单的接口
f00lish Sep 29, 2020
cd0c63f
修改退款接口字段错误 (#1788)
binarywang Sep 29, 2020
8428270
:new: #1793 企业微信添加应用管理的设置工作台自定义展示模块
youflint Sep 30, 2020
8929fc4
:art: 优化公众号Spring Boot Starter的redisTemplate注入等代码
Dream2Land Oct 2, 2020
18f3f40
:art: 优化代码,提供toString方法,避免某些情况下出现的问题
binarywang Oct 5, 2020
64402ab
:new: #1675 企业微信增加更新、查询和删除日历的接口
binarywang Oct 5, 2020
6948044
:new: #1686 微信公众号增加对话能力(原导购助手)部分接口,如添加顾问、获取顾问信息等
binarywang Oct 6, 2020
9c91aeb
:new: #1686 微信公众号增加对话能力(原导购助手)部分接口,如修改顾问、删除顾问、获取顾问列表等
binarywang Oct 7, 2020
6cc5ebd
:art: #1797 企业微信配置客户联系「联系我」方式接口返回增加二维码链接字段
Acvrock Oct 12, 2020
c7b1abc
:art: 优化部分代码,重构OAuth2网页授权、网页登录等相关接口,方便接入open模块
binarywang Oct 10, 2020
5599c0d
:bug: 修复字段错误
cloudX2019 Oct 13, 2020
7c9e2e4
:new: #1725 微信支付分增加免确认模式(预授权方式)相关接口支持
spvycf Oct 15, 2020
77e3c8e
:new: #1806 开放平台增加第三方平台代公众号实现复用公众号资料快速创建小程序的接口
binarywang Oct 17, 2020
07bc5a5
:new: 微信开发平台模块增加OAuth2相关接口(网页授权、网页登录等)的实现
binarywang Oct 18, 2020
1510041
:art: 优化部分代码,明确出错信息
binarywang Oct 18, 2020
08bb399
:bookmark: 发布 3.9.5.B 测试版本
binarywang Oct 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>3.9.4.B</version>
<version>3.9.5.B</version>
<packaging>pom</packaging>
<name>WxJava - Weixin/Wechat Java SDK</name>
<description>微信开发Java SDK</description>
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>3.9.4.B</version>
<version>3.9.5.B</version>
</parent>
<packaging>pom</packaging>
<artifactId>wx-java-spring-boot-starters</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>3.9.4.B</version>
<version>3.9.5.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
12 changes: 11 additions & 1 deletion spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>3.9.4.B</version>
<version>3.9.5.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -30,6 +30,16 @@
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.binarywang.spring.starter.wxjava.mp.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
import me.chanjar.weixin.mp.api.*;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceJoddHttpImpl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,148 +1,166 @@
package com.binarywang.spring.starter.wxjava.mp.config;

import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
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 com.binarywang.spring.starter.wxjava.mp.enums.StorageType;
import com.binarywang.spring.starter.wxjava.mp.properties.RedisProperties;
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
import com.google.common.collect.Sets;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import me.chanjar.weixin.common.redis.WxRedisOps;
import me.chanjar.weixin.mp.bean.WxMpHostConfig;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
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.JedisPool;
import redis.clients.jedis.JedisPoolAbstract;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool;

import java.util.Set;

/**
* 微信公众号存储策略自动配置.
*
* @author someone
*/
@Slf4j
@Configuration
@RequiredArgsConstructor
public class WxMpStorageAutoConfiguration {
private final ApplicationContext applicationContext;

private final WxMpProperties wxMpProperties;

@Value("${wx.mp.config-storage.redis.host:")
private String redisHost;

@Value("${wx.mp.configStorage.redis.host:")
private String redisHost2;

@Bean
@ConditionalOnMissingBean(WxMpConfigStorage.class)
public WxMpConfigStorage wxMpConfigStorage() {
StorageType type = wxMpProperties.getConfigStorage().getType();
WxMpConfigStorage config;
switch (type) {
case Jedis:
config = jedisConfigStorage();
break;
case RedisTemplate:
config = redisTemplateConfigStorage();
break;
default:
config = defaultConfigStorage();
break;
}
// wx host config
if (null != wxMpProperties.getHosts() && StringUtils.isNotEmpty(wxMpProperties.getHosts().getApiHost())) {
WxMpHostConfig hostConfig = new WxMpHostConfig();
hostConfig.setApiHost(wxMpProperties.getHosts().getApiHost());
hostConfig.setMpHost(wxMpProperties.getHosts().getMpHost());
hostConfig.setOpenHost(wxMpProperties.getHosts().getOpenHost());
config.setHostConfig(hostConfig);
}
return config;
}

private WxMpConfigStorage defaultConfigStorage() {
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
setWxMpInfo(config);
return config;
}

private WxMpConfigStorage jedisConfigStorage() {
JedisPoolAbstract jedisPool;
if (StringUtils.isNotEmpty(redisHost) || StringUtils.isNotEmpty(redisHost2)) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
WxMpRedisConfigImpl wxMpRedisConfig = new WxMpRedisConfigImpl(redisOps,
wxMpProperties.getConfigStorage().getKeyPrefix());
setWxMpInfo(wxMpRedisConfig);
return wxMpRedisConfig;
}

private WxMpConfigStorage redisTemplateConfigStorage() {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
WxRedisOps redisOps = new RedisTemplateWxRedisOps(redisTemplate);
WxMpRedisConfigImpl wxMpRedisConfig = new WxMpRedisConfigImpl(redisOps,
wxMpProperties.getConfigStorage().getKeyPrefix());
setWxMpInfo(wxMpRedisConfig);
return wxMpRedisConfig;
}

private void setWxMpInfo(WxMpDefaultConfigImpl config) {
WxMpProperties properties = wxMpProperties;
WxMpProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
config.setAppId(properties.getAppId());
config.setSecret(properties.getSecret());
config.setToken(properties.getToken());
config.setAesKey(properties.getAesKey());

config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}
}

private JedisPoolAbstract getJedisPool() {
WxMpProperties.ConfigStorage storage = wxMpProperties.getConfigStorage();
RedisProperties redis = storage.getRedis();

JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
if (StringUtils.isNotEmpty(redis.getSentinelIps())) {
Set<String> sentinels = Sets.newHashSet(redis.getSentinelIps().split(","));
return new JedisSentinelPool(redis.getSentinelName(), sentinels);
}

return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(),
redis.getDatabase());
}
private final ApplicationContext applicationContext;

private final WxMpProperties wxMpProperties;

@Value("${wx.mp.config-storage.redis.host:")
private String redisHost;

@Value("${wx.mp.configStorage.redis.host:")
private String redisHost2;

@Bean
@ConditionalOnMissingBean(WxMpConfigStorage.class)
public WxMpConfigStorage wxMpConfigStorage() {
StorageType type = wxMpProperties.getConfigStorage().getType();
WxMpConfigStorage config;
switch (type) {
case Jedis:
config = jedisConfigStorage();
break;
case RedisTemplate:
config = redisTemplateConfigStorage();
break;
default:
config = defaultConfigStorage();
break;
}
// wx host config
if (null != wxMpProperties.getHosts() && StringUtils.isNotEmpty(wxMpProperties.getHosts().getApiHost())) {
WxMpHostConfig hostConfig = new WxMpHostConfig();
hostConfig.setApiHost(wxMpProperties.getHosts().getApiHost());
hostConfig.setMpHost(wxMpProperties.getHosts().getMpHost());
hostConfig.setOpenHost(wxMpProperties.getHosts().getOpenHost());
config.setHostConfig(hostConfig);
}
return config;
}

private WxMpConfigStorage defaultConfigStorage() {
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
setWxMpInfo(config);
return config;
}

private WxMpConfigStorage jedisConfigStorage() {
JedisPoolAbstract jedisPool;
if (StringUtils.isNotEmpty(redisHost) || StringUtils.isNotEmpty(redisHost2)) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
WxMpRedisConfigImpl wxMpRedisConfig = new WxMpRedisConfigImpl(redisOps,
wxMpProperties.getConfigStorage().getKeyPrefix());
setWxMpInfo(wxMpRedisConfig);
return wxMpRedisConfig;
}

private WxMpConfigStorage redisTemplateConfigStorage() {
StringRedisTemplate redisTemplate = null;
try {
redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
try {
if (null == redisTemplate) {
redisTemplate = (StringRedisTemplate) applicationContext.getBean("stringRedisTemplate");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}

if (null == redisTemplate) {
redisTemplate = (StringRedisTemplate) applicationContext.getBean("redisTemplate");
}

WxRedisOps redisOps = new RedisTemplateWxRedisOps(redisTemplate);
WxMpRedisConfigImpl wxMpRedisConfig = new WxMpRedisConfigImpl(redisOps,
wxMpProperties.getConfigStorage().getKeyPrefix());

setWxMpInfo(wxMpRedisConfig);
return wxMpRedisConfig;
}

private void setWxMpInfo(WxMpDefaultConfigImpl config) {
WxMpProperties properties = wxMpProperties;
WxMpProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
config.setAppId(properties.getAppId());
config.setSecret(properties.getSecret());
config.setToken(properties.getToken());
config.setAesKey(properties.getAesKey());

config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}
}

private JedisPoolAbstract getJedisPool() {
WxMpProperties.ConfigStorage storage = wxMpProperties.getConfigStorage();
RedisProperties redis = storage.getRedis();

JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
if (StringUtils.isNotEmpty(redis.getSentinelIps())) {
Set<String> sentinels = Sets.newHashSet(redis.getSentinelIps().split(","));
return new JedisSentinelPool(redis.getSentinelName(), sentinels);
}

return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(),
redis.getDatabase());
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.binarywang.spring.starter.wxjava.mp.properties;

import java.io.Serializable;

import lombok.Data;

import java.io.Serializable;

@Data
public class HostConfig implements Serializable {
private static final long serialVersionUID = -4172767630740346001L;

private String apiHost;
private String openHost;
private String mpHost;

private static final long serialVersionUID = -4172767630740346001L;

private String apiHost;

private String openHost;

private String mpHost;

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public class RedisProperties implements Serializable {
* 数据库.
*/
private int database = 0;

/**
* sentinel ips
*/
private String sentinelIps;

/**
* sentinel name
*/
Expand Down
Loading