71 Commits

Author SHA1 Message Date
Binary Wang
62f89987c0 🔖 发布 4.7.7.B 测试版本 2025-07-16 20:05:09 +08:00
痴货
990dbba06b 🎨 【开放平台】重构小程序认证及备案相关接口 2025-07-16 11:47:11 +00:00
痴货
d85e04a72a 🎨 starter模块添加 HttpClient 超时配置 2025-07-16 11:46:38 +00:00
Binary Wang
aacfa947be 🎨 统一优化gson adapter类,抽取常量,优化重复代码
Some checks are pending
Publish to Maven Central / build-and-publish (push) Waiting to run
2025-07-16 13:50:55 +08:00
Ryn
3e4ee57e1c 🎨 #3639 【小程序】修复多账号starter不支持设置数据格式,导致消息解析出错的问题 2025-07-16 13:44:50 +08:00
benben
d4cf48d059 🎨 【公众号】删除已下线的新增删除永久图文素材的接口
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-07-12 08:59:11 +00:00
ihao
696ce8621e 🆕 #3636【微信支付】增加微信签约、解约结果通知解析的方法 2025-07-12 16:57:50 +08:00
dependabot[bot]
8c8139533d ⬆️ Bump org.apache.commons:commons-lang3 from 3.10 to 3.18.0 2025-07-12 16:49:40 +08:00
zhfkt
84c69d4900 🎨 Add null check for textJsonElement in WxCpUserGsonAdapter 2025-07-04 15:40:29 +08:00
xuxiancan
d52e225626 🎨 #3633【微信支付】创建支付分订单接口请求参数里增加设备信息字段 2025-07-04 15:39:15 +08:00
ihao
686dff6436 🎨 优化微信h5纯签约接口,增加非必填字段判断 2025-07-03 01:55:33 +00:00
Style-lo
92431aabd9 🎨 getConfigKey方法改成public的 2025-07-03 09:53:30 +08:00
Binary Wang
29bc950f92 🎨 为小程序短剧管理服务接口增加接口 2025-07-02 10:35:54 +08:00
Binary Wang
5c74c1d930 🎨 为微信小程序物流退货组件接口增加注释文档 2025-07-02 10:35:54 +08:00
Binary Wang
52d0b2fc1c 🎨 为小程序虚拟支付接口类增加注释文档 2025-07-02 10:35:54 +08:00
Binary Wang
5b816242a4 🎨 优化小程序数据分析接口类的注释文档 2025-07-02 10:35:54 +08:00
Binary Wang
a45f0ac048 🎨 优化小程序云开发接口类的注释文档 2025-07-02 10:35:54 +08:00
Binary Wang
4731479b93 🎨 优化小程序接口注释文档 2025-07-02 10:35:54 +08:00
benben
cc344f105e 🎨 #3624 【企业微信】企微微盘API相关接口去掉废弃的userId参数 2025-07-02 10:33:56 +08:00
Well
172b96444f 🎨 #3626 【微信支付】创建代金券批次接口新增字段,包括背景色、卡包跳转目标、小程序 appid 与 path等 2025-07-02 10:31:26 +08:00
jinceon
b3b8c273c7 🎨 【企业微信】增加“审批申请状态变化回调通知”事件类型 2025-06-28 23:07:36 +08:00
大粽子
b6d489e9c8 📝 修改赞助商信息 2025-06-28 23:07:36 +08:00
zhoushi1
72266c3aeb 🎨 #3627 【开放平台】小程序三方平台代上传代码提交额外信息对象新增requiredPrivateInfos信息
Co-authored-by: zhoushi1 <qiannanyou9@gmail.com>
2025-06-28 20:57:37 +08:00
altusea
ccbfa98864 🎨 添加 Apache HttpComponents Client 5.x 为可选的 http client
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-06-09 14:29:35 +08:00
buaazyl
bf35797b91 :art:【小程序】发订阅消息的“43101用户未订阅消息”异常日志调整为debug 2025-06-09 14:28:56 +08:00
buaazyl
41081561b5 :art:【小程序】不再打印发订阅消息的“43101用户未订阅消息”警告日志 2025-06-09 11:19:37 +08:00
Binary Wang
8878f06c1e 🎨 修复单元测试代码
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-06-06 17:07:52 +08:00
Zeyes Lee
22d288f6cd 🎨 #3609 【视频号】微信小店获取售后单接口返回新增换货相关的数据 2025-06-06 16:55:46 +08:00
Binary Wang
b0af2c704e 🔖 发布 4.7.6.B 测试版本
Some checks are pending
Publish to Maven Central / build-and-publish (push) Waiting to run
2025-06-05 23:47:01 +08:00
Binary Wang
320f05e6d6 📝 赞助商表格优化 2025-06-03 12:15:47 +08:00
Binary Wang
4d7fd68fe5 📝 调整两个logo的位置
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-06-03 12:06:48 +08:00
Molzx
388188b694 🎨 【微信支付】调整逻辑:当完全使用公钥模式时,也可从p12证书中读取证书私钥等 2025-06-03 11:53:45 +08:00
altusea
ecce9292b2 🎨 初步引入 Apache HttpClient 5.x 2025-06-03 11:52:39 +08:00
msgpo
96a5cc995b 🎨 #3603【企业微信】获取审批申请详情接口 增加说明文字控件的支持 2025-05-29 11:18:12 +08:00
Binary Wang
4d66dd09ca 🎨 修改查看最新版本的地址 2025-05-28 16:22:20 +08:00
阿杆
08e2107667 🎨 #3571【公众号】草稿箱相关接口支持图片文章类型 2025-05-28 15:59:08 +08:00
Binary Wang
f71ac2185c 🎨 workflow 里增加 concurrency 设置并发限制 2025-05-22 15:21:39 +08:00
Zeyes Lee
5bde717f8f 🎨 #3594【视频号】微信小店更新售后、订单详情等返回参数,并修改获取售后单列表和获取快递公司列表等接口的参数
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-05-22 15:07:25 +08:00
altusea
8bacc9425e 🎨 修复CloseableHttpClient相关的误用代码 2025-05-22 15:03:27 +08:00
mengyou
3e1a38a696 🎨 #3591【微信支付】修复只设置privateKeyString或者privateKeyContent时私钥初始化失败的问题
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-05-16 20:19:19 +08:00
altusea
fefe737803 🎨 #3588 【小程序】短剧媒资列表接口增加新字段media_name_fuzzy 2025-05-15 14:43:07 +08:00
SynchPj
d0b7a526f6 🎨 #3587【微信支付】支持完全公钥模式,新增fullPublicKeyModel字段来控制,默认关闭,关闭时走老逻辑,开启时,只加载公钥所需相关配置,避免下载平台证书使灰度切换无法达到100%覆盖 2025-05-14 16:27:29 +08:00
SynchPj
47051bdf31 🎨 #3586 【微信支付】修复资源上传接口使用POST请求Content-Type不正确导致签名错误的问题 2025-05-14 11:54:30 +08:00
Binary Wang
f5dd32de86 📝 优化badge展示 2025-05-14 10:44:59 +08:00
altusea
d776792bae 🎨 #3575 【视频号】微信小店api官方将要废除finder_id,以promoter_id代替
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled
2025-05-13 22:57:07 +08:00
altusea
1a74e3e3a8 🎨 #3562 【企业微信】发送应用消息接口返回增加unlicenseduser字段 2025-05-13 22:54:28 +08:00
altusea
2762a98279 🎨 #3569 【视频号】微信小店-订单详情查询接口增加参数 2025-05-13 22:52:24 +08:00
altusea
04c162f03a 🎨 #3574 【微信支付】修复商家券available_day_time字段定义错误 2025-05-13 22:50:35 +08:00
Binary Wang
5c2a36c538 🎨 add serialVersionUID for some class 2025-05-13 22:48:25 +08:00
altusea
2c4b5ea128 🎨 #3525 【企业微信】第三方应用配置类提供setProviderSecret 方法 2025-05-13 22:41:15 +08:00
altusea
9a6db34b6a 🎨 #3577 【微信支付】微信分账回退请求接口新增字段:微信订单号transaction_id 2025-05-13 16:18:00 +08:00
Binary Wang
77b90626f3 ⬆️ Bump org.eclipse.jetty:jetty-server 2025-05-13 16:16:17 +08:00
altusea
063fbb7f19 🎨 升级部分依赖版本,优化代码,部分代码增加泛型参数 2025-05-13 15:56:14 +08:00
Binary Wang
a7b007f853 📝 修正版本说明文档 2025-05-13 13:08:24 +08:00
SynchPj
c91a5a8e22 🎨 【微信支付】修复连接池关闭异常问题 2025-05-13 12:49:46 +08:00
Binary Wang
a051587d3e 👷 自动构建迁移到maven central portal 2025-05-13 12:43:51 +08:00
Binary Wang
245cf72104 🎨 增加github action来自动发布版本到maven中央仓库 2025-05-12 12:35:06 +08:00
Binary Wang
fb57af7409 🔖 发布 4.7.5.B 测试版本 2025-05-08 23:04:32 +08:00
jimson
88a5bc4f43 🎨 企微客户群回调事件添加MemChangeList字段 2025-05-08 22:15:06 +08:00
Binary Wang
dc674ce024 🎨 优化部分javadoc 2025-04-29 12:12:34 +08:00
Binary Wang
854b50bd51 🎨 修复日志代码报错问题 2025-04-29 11:33:58 +08:00
imyzt
2d8d1df00e 🆕 #3320【企业微信】增加异步上传临时素材相关接口 2025-04-29 11:29:09 +08:00
Binary Wang
2279105fef :art: 优化微信支付请求代码,抽取合并重复代码 2025-04-26 11:18:56 +08:00
SynchPj
cbb3b24577 🎨 #3553【微信支付】v3请求统一加上Wechatpay-Serial请求头 2025-04-22 11:08:50 +08:00
giveup
ddfbee25e1 🐛 #3557 【企业微信】修复agentId数据类型不一致导致的WxCpTpMessageRouterRule.test()方法匹配失败的问题 2025-04-21 10:00:39 +08:00
友人A
6a4ed91ae2 🎨 #3558 【企业微信】修复会话内容存档接口获取解密的聊天数据时文件信息转换出错的问题 2025-04-21 09:58:51 +08:00
西东
59f5a99fda 🆕 添加wx-java-channel-solon-plugin README.md 2025-04-21 09:55:13 +08:00
Henry Heng
3718b499a0 🎨 #3554【企业微信】修复审批通知节点获取不到用户ID的问题 2025-04-16 10:43:55 +08:00
Henry Heng
bb76db052d 🎨 #3554【企业微信】修复审批通知节点获取不到用户ID的问题 2025-04-15 19:32:54 +08:00
HerveyHall
e16e0e9373 🎨 #3548【微信支付】修复公钥模式下V3接口未设置Wechatpay-Serial请求头导致的验签失败 2025-04-15 15:14:12 +08:00
Holy
89280abd00 🎨 #3547【微信支付】修复验证器未正确初始化导致的v3请求构造异常问题 2025-04-14 11:32:34 +08:00
517 changed files with 8899 additions and 2859 deletions

4
.github/workflows vendored
View File

@@ -1,4 +0,0 @@
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

94
.github/workflows/maven-publish.yml vendored Normal file
View File

@@ -0,0 +1,94 @@
name: Publish to Maven Central
on:
push:
branches:
- develop
permissions:
contents: write
concurrency:
group: maven-publish-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect and tag release version from commit message
id: version_detect
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
VERSION=""
TAG=""
IS_RELEASE="false"
if [[ "$COMMIT_MSG" =~ ^:bookmark:\ 发布\ ([0-9]+\.[0-9]+\.[0-9]+)\.B\ 测试版本 ]]; then
BASE_VER="${BASH_REMATCH[1]}"
VERSION="${BASE_VER}.B"
TAG="v${BASE_VER}"
IS_RELEASE="true"
echo "Matched release commit: VERSION=$VERSION, TAG=$TAG"
# 检查并打tag
if git tag | grep -q "^$TAG$"; then
echo "Tag $TAG already exists."
else
git config user.name "Binary Wang"
git config user.email "a@binarywang.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
echo "Tag $TAG created and pushed."
fi
fi
echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
cache: maven
- name: Verify GPG keys
run: |
echo "Available GPG Keys:"
gpg --list-secret-keys --keyid-format LONG
- name: Generate and set version
id: set_version
run: |
if [[ "${{ steps.version_detect.outputs.is_release }}" == "true" ]]; then
VERSION="${{ steps.version_detect.outputs.version }}"
else
git describe --tags 2>/dev/null || echo "no tag"
TIMESTAMP=$(date +'%Y%m%d.%H%M%S')
GIT_DESCRIBE=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1")
VERSION="${GIT_DESCRIBE}-${TIMESTAMP}"
fi
echo "Final version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
mvn versions:set -DnewVersion=$VERSION --no-transfer-progress
env:
TZ: Asia/Shanghai
- name: Publish to Maven Central
run: |
mvn clean deploy -P release \
-Dmaven.test.skip=true \
-Dgpg.args="--batch --yes --pinentry-mode loopback" \
--no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

121
README.md
View File

@@ -1,65 +1,65 @@
## WxJava - 微信开发 Java SDK
[![Github](https://img.shields.io/github/stars/binarywang/WxJava?logo=github&style=flat&label=Stars)](https://github.com/binarywang/WxJava)
[![Gitee](https://gitee.com/binary/weixin-java-tools/badge/star.svg?theme=blue)](https://gitee.com/binary/weixin-java-tools)
[![GitCode](https://gitcode.com/binary/WxJava/star/badge.svg)](https://gitcode.com/binary/WxJava)
[![码云Gitee](https://gitee.com/binary/weixin-java-tools/badge/star.svg?theme=blue)](https://gitee.com/binary/weixin-java-tools)
[![Github](https://img.shields.io/github/stars/binarywang/WxJava?logo=github&style=flat)](https://github.com/binarywang/WxJava)
[![GitHub release](https://img.shields.io/github/release/binarywang/WxJava.svg)](https://github.com/binarywang/WxJava/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java)
[![Build Status](https://img.shields.io/circleci/project/github/binarywang/WxJava/develop.svg?sanitize=true)](https://circleci.com/gh/binarywang/WxJava/tree/develop)
[![GitHub release](https://img.shields.io/github/release/binarywang/WxJava?label=Release)](https://github.com/binarywang/WxJava/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java?label=Maven)](https://central.sonatype.com/artifact/com.github.binarywang/wx-java/versions)
[![Build Status](https://img.shields.io/circleci/project/github/binarywang/WxJava/develop.svg?sanitize=true&label=Build)](https://circleci.com/gh/binarywang/WxJava/tree/develop)
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-支持-blue.svg)](https://www.jetbrains.com/?from=WxJava-weixin-java-tools)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
#### 微信`Java`开发工具包,支持包括微信支付、开放平台、公众号、企业微信、视频号、小程序等微信功能模块的后端开发。
<div align="center">
<a href="https://hellogithub.com/repository/6de6147050c94db4aedfd7098d19f8d8" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=6de6147050c94db4aedfd7098d19f8d8&claim_uid=mwKh0tILBfjlezR" alt="FeaturedHelloGitHub" width="250" height="54" />
</a>
<a href="https://trendshift.io/repositories/12152" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/12152" alt="binarywang%2FWxJava | 趋势转变" width="250" height="55" />
</a>
</div>
### 微信`Java`开发工具包,支持包括微信支付、开放平台、公众号、企业微信、视频号、小程序等微信功能模块的后端开发。
<div align="center">
<b>特别赞助</b>
<table cellspacing="0" cellpadding="0" width="500">
<tr>
<td align="center" colspan="3">
<a href="http://www.ccflow.org/?from=wxjava" target="_blank">
<img height="120" src="https://ccfast.cc/AD/ccflow2.png" alt="ccflow">
</a>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="https://www.jeequan.com/product/jeepay.html" target="_blank">
<img height="120" src="https://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/wxjava_jeepay.png" alt="计全支付Jeepay,开源支付系统">
</a>
</td>
<td align="center">
<a href="https://www.mall4j.com/cn/?statId=9" target="_blank">
<img height="120" src="https://img.mall4j.com/mall.png" alt="Mall4j">
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzI3MzAwMzk4OA==&hid=1&sn=f31af3bf562b116b061c9ab4edf70b61&scene=18#wechat_redirect" target="_blank">
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/develop/images/qrcodes/mp.png" alt="mp qrcode">
</a>
</td>
<td align="center">
<a href="https://www.diboot.com?from=wxjava" target="_blank">
<img height="120" src="https://www.diboot.com/img/diboot_ad.png" alt="diboot低代码开发平台">
</a>
</td>
<td align="center">
<a href="https://www.crmeb.com/xiazai" target="_blank">
<img height="120" src="https://crmebjavamer.oss-cn-beijing.aliyuncs.com/crmebimage/gitee/WechatIMG202.jpg" alt="ad">
</a>
</td>
</tr>
</table>
</div>
<table align="center" cellspacing="0" cellpadding="0" width="500">
<tr>
<td align="center" valign="middle" colspan="3">
<a href="http://www.ccflow.org/?from=wxjava" target="_blank">
<img height="120" src="https://ccfast.cc/AD/ccflow2.png" alt="ccflow">
</a>
</td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">
<a href="https://www.jeequan.com/product/jeepay.html" target="_blank">
<img height="120" src="https://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/wxjava_jeepay.png" alt="计全支付Jeepay,开源支付系统">
</a>
</td>
<td align="center" valign="middle" colspan="1">
<a href="https://www.mall4j.com/cn/?statId=9" target="_blank">
<img height="120" src="https://img.mall4j.com/mall.png" alt="Mall4j">
</a>
</td>
</tr>
<tr>
<td align="center" valign="middle">
<a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzI3MzAwMzk4OA==&hid=1&sn=f31af3bf562b116b061c9ab4edf70b61&scene=18#wechat_redirect" target="_blank">
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/develop/images/qrcodes/mp.png" alt="mp qrcode">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.diboot.com?from=wxjava" target="_blank">
<img height="120" src="https://www.diboot.com/img/diboot_ad.png" alt="diboot低代码开发平台"/>
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.iyque.cn/" target="_blank">
<img height="120" src="https://iyque-1251309172.cos.ap-nanjing.myqcloud.com/advert/wxjava.jpg" alt="aliyun ad">
</a>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<a href="https://hellogithub.com/repository/6de6147050c94db4aedfd7098d19f8d8" target="_blank">
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=6de6147050c94db4aedfd7098d19f8d8&claim_uid=mwKh0tILBfjlezR"
alt="FeaturedHelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</a>
<a href="https://trendshift.io/repositories/12152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12152" alt="binarywang%2FWxJava | 趋势转变" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
</td>
</tr>
</table>
### 重要信息
1. [`WxJava` 荣获 `GitCode` 2024年度十大开源社区奖项](https://mp.weixin.qq.com/s/wM_UlMsDm3IZ1CPPDvcvQw)。
@@ -89,7 +89,7 @@
---------------------------------
### Maven 引用方式
注意:最新版本(包括测试版)为 [![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java),以下为最新正式版。
注意:最新版本(包括测试版)为 [![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](https://central.sonatype.com/artifact/com.github.binarywang/wx-java/versions),以下为最新正式版。
```xml
<dependency>
@@ -113,10 +113,13 @@
<details>
<summary>点此展开查看</summary>
1. 本项目定为大约每两个月发布一次正式版(同时 `develop` 分支代码合并进入 `release` 分支),版本号格式为 `X.X.0`(如`2.1.0``2.2.0`等)遇到重大问题需修复会及时提交新版本欢迎大家随时提交Pull Request
2. BUG修复和新特性一般会先发布成小版本作为临时测试版本`3.6.8.B`即尾号不为0并添加B以区别于正式版代码仅存在于 `develop` 分支中;
3. 目前最新版本号为 [![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java) ,也可以通过访问链接 [【微信支付】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-pay%22) 、[【微信小程序】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-miniapp%22) 、[【公众号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-mp%22) 、[【企业微信】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-cp%22)、[【开放平台】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-open%22)
分别查看所有最新的版本。
1. 本项目定为大约每半年左右发布一次正式版,遇到重大问题需修复会及时提交新版本,欢迎大家随时提交 `Pull Request`
2. 每次代码更新都会自动构建出新版本方便及时尝鲜,版本号格式为 `x.x.x-时间戳`;
3. 发布正式版时,`develop` 分支代码合并进入 `release` 分支),版本号格式为 `X.X.0`(如`2.1.0``2.2.0`等);
4. 每隔一段时间后,会发布测试版本(如`3.6.8.B`即尾号不为0并添加B以区别于正式版代码仅存在于 `develop` 分支中;
5. 目前最新版本号为 [![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java) ,也可以通过访问以下链接分别查看各个模块最新的版本:
[【微信支付】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-pay/versions) 、[【小程序】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-miniapp/versions) 、[【公众号】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-mp/versions) 、[【企业微信】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-cp/versions)、[【开放平台】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-open/versions)、[【视频号】](https://central.sonatype.com/artifact/com.github.binarywang/weixin-java-channel/versions)
</details>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

53
pom.xml
View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
<packaging>pom</packaging>
<name>WxJava - Weixin/Wechat Java SDK</name>
<description>微信开发Java SDK</description>
@@ -136,10 +136,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<httpclient.version>4.5.13</httpclient.version>
<jetty.version>9.4.56.v20240826</jetty.version>
<!-- 这个不能用10以上的版本不支持jdk8-->
<jetty.version>9.4.57.v20241219</jetty.version> <!-- 这个不能用10以上的版本不支持jdk8-->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
@@ -156,7 +154,13 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.5.0</version>
<version>4.12.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.5</version>
<scope>provided</scope>
</dependency>
@@ -183,7 +187,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
<version>3.18.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -198,17 +202,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.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 测试所用依赖 -->
@@ -327,22 +333,11 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78.1</version>
<version>1.80</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>doclint-java8-disable</id>
@@ -432,14 +427,14 @@
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<deploymentName>Release WxJava:${project.version}</deploymentName>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
<plugin>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<packaging>pom</packaging>
<artifactId>wx-java-solon-plugins</artifactId>
@@ -14,7 +14,7 @@
<description>WxJava 各个模块的 Solon Plugin</description>
<properties>
<solon.version>3.0.1</solon.version>
<solon.version>3.2.0</solon.version>
</properties>
<modules>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -8,6 +8,7 @@ import com.binarywang.solon.wxjava.channel.service.WxChannelMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceHttpComponentsImpl;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceHttpClientImpl;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceImpl;
import me.chanjar.weixin.channel.config.WxChannelConfig;
@@ -84,6 +85,9 @@ public abstract class AbstractWxChannelConfiguration {
case HTTP_CLIENT:
wxChannelService = new WxChannelServiceHttpClientImpl();
break;
case HTTP_COMPONENTS:
wxChannelService = new WxChannelServiceHttpComponentsImpl();
break;
default:
wxChannelService = new WxChannelServiceImpl();
break;

View File

@@ -11,6 +11,10 @@ public enum HttpClientType {
* HttpClient
*/
HTTP_CLIENT,
/**
* HttpComponents
*/
HTTP_COMPONENTS
// WxChannelServiceOkHttpImpl 实现经测试无法正常完成业务固暂不支持OK_HTTP方式
// /**
// * OkHttp.

View File

@@ -0,0 +1,92 @@
# wx-java-channel-solon-plugin
## 快速开始
1. 引入依赖
```xml
<dependencies>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-channel-solon-plugin</artifactId>
<version>${version}</version>
</dependency>
<!-- 配置存储方式为jedis 则引入jedis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
</dependency>
<!-- 配置存储方式为redisson 则引入redisson -->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>${redisson.version}</version>
</dependency>
</dependencies>
```
2. 添加配置(app.properties)
```properties
# 视频号配置(必填)
## 视频号小店的appId和secret
wx.channel.app-id=@appId
wx.channel.secret=@secret
# 视频号配置 选填
## 设置视频号小店消息服务器配置的token
wx.channel.token=@token
## 设置视频号小店消息服务器配置的EncodingAESKey
wx.channel.aes-key=
## 支持JSON或者XML格式默认JSON
wx.channel.msg-data-format=JSON
## 是否使用稳定版 Access Token
wx.channel.use-stable-access-token=false
# ConfigStorage 配置(选填)
## 配置类型: memory(默认), jedis, redisson, redis_template
wx.channel.config-storage.type=memory
## 相关redis前缀配置: wx:channel(默认)
wx.channel.config-storage.key-prefix=wx:channel
wx.channel.config-storage.redis.host=127.0.0.1
wx.channel.config-storage.redis.port=6379
wx.channel.config-storage.redis.password=123456
# http 客户端配置(选填)
## # http客户端类型: http_client(默认)
wx.channel.config-storage.http-client-type=http_client
wx.channel.config-storage.http-proxy-host=
wx.channel.config-storage.http-proxy-port=
wx.channel.config-storage.http-proxy-username=
wx.channel.config-storage.http-proxy-password=
## 最大重试次数默认5 次,如果小于 0则为 0
wx.channel.config-storage.max-retry-times=5
## 重试时间间隔步进默认1000 毫秒,如果小于 0则为 1000
wx.channel.config-storage.retry-sleep-millis=1000
```
3. 自动注入的类型
- `WxChannelService`
- `WxChannelConfig`
4. 使用样例
```java
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.bean.shop.ShopInfoResponse;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import org.noear.solon.annotation.Inject;
@Component
public class DemoService {
@Inject
private WxChannelService wxChannelService;
public String getShopInfo() throws WxErrorException {
// 获取店铺基本信息
ShopInfoResponse response = wxChannelService.getBasicService().getShopInfo();
// 此处为演示如果要返回response的结果建议自己封装一个VO避免直接返回response
return JsonUtils.encode(response);
}
}
```

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -7,10 +7,7 @@ import com.binarywang.solon.wxjava.cp_multi.service.WxCpMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceJoddHttpImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceOkHttpImpl;
import me.chanjar.weixin.cp.api.impl.*;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
@@ -96,6 +93,9 @@ public abstract class AbstractWxCpConfiguration {
case HTTP_CLIENT:
wxCpService = new WxCpServiceApacheHttpClientImpl();
break;
case HTTP_COMPONENTS:
wxCpService = new WxCpServiceHttpComponentsImpl();
break;
default:
wxCpService = new WxCpServiceImpl();
break;

View File

@@ -117,6 +117,10 @@ public class WxCpMultiProperties implements Serializable {
* HttpClient
*/
HTTP_CLIENT,
/**
* HttpComponents
*/
HTTP_COMPONENTS,
/**
* OkHttp
*/

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

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

@@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<packaging>pom</packaging>
<artifactId>wx-java-spring-boot-starters</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -108,12 +108,12 @@ public abstract class AbstractWxMaConfiguration {
return wxMaService;
}
private void configApp(WxMaDefaultConfigImpl config, WxMaSingleProperties corpProperties) {
String appId = corpProperties.getAppId();
String appSecret = corpProperties.getAppSecret();
String token = corpProperties.getToken();
String aesKey = corpProperties.getAesKey();
boolean useStableAccessToken = corpProperties.isUseStableAccessToken();
private void configApp(WxMaDefaultConfigImpl config, WxMaSingleProperties properties) {
String appId = properties.getAppId();
String appSecret = properties.getAppSecret();
String token = properties.getToken();
String aesKey = properties.getAesKey();
boolean useStableAccessToken = properties.isUseStableAccessToken();
config.setAppid(appId);
config.setSecret(appSecret);
@@ -123,6 +123,7 @@ public abstract class AbstractWxMaConfiguration {
if (StringUtils.isNotBlank(aesKey)) {
config.setAesKey(aesKey);
}
config.setMsgDataFormat(properties.getMsgDataFormat());
config.useStableAccessToken(useStableAccessToken);
}

View File

@@ -33,6 +33,11 @@ public class WxMaSingleProperties implements Serializable {
*/
private String aesKey;
/**
* 消息格式XML或者JSON.
*/
private String msgDataFormat;
/**
* 是否使用稳定版 Access Token
*/

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -2,6 +2,8 @@ package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import org.apache.commons.lang3.StringUtils;
/**
@@ -10,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
public abstract class AbstractWxMaConfigStorageConfiguration {
protected WxMaDefaultConfigImpl config(WxMaDefaultConfigImpl config, WxMaProperties properties) {
WxMaProperties.ConfigStorage storage = properties.getConfigStorage();
config.setAppid(StringUtils.trimToNull(properties.getAppid()));
config.setSecret(StringUtils.trimToNull(properties.getSecret()));
config.setToken(StringUtils.trimToNull(properties.getToken()));
@@ -25,6 +28,19 @@ public abstract class AbstractWxMaConfigStorageConfiguration {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}
// 设置自定义的HttpClient超时配置
ApacheHttpClientBuilder clientBuilder = config.getApacheHttpClientBuilder();
if (clientBuilder == null) {
clientBuilder = DefaultApacheHttpClientBuilder.get();
}
if (clientBuilder instanceof DefaultApacheHttpClientBuilder) {
DefaultApacheHttpClientBuilder defaultBuilder = (DefaultApacheHttpClientBuilder) clientBuilder;
defaultBuilder.setConnectionTimeout(storage.getConnectionTimeout());
defaultBuilder.setSoTimeout(storage.getSoTimeout());
defaultBuilder.setConnectionRequestTimeout(storage.getConnectionRequestTimeout());
config.setApacheHttpClientBuilder(defaultBuilder);
}
int maxRetryTimes = configStorageProperties.getMaxRetryTimes();
if (configStorageProperties.getMaxRetryTimes() < 0) {
maxRetryTimes = 0;

View File

@@ -112,6 +112,21 @@ public class WxMaProperties {
* </pre>
*/
private int maxRetryTimes = 5;
/**
* 连接超时时间,单位毫秒
*/
private int connectionTimeout = 5000;
/**
* 读数据超时时间即socketTimeout单位毫秒
*/
private int soTimeout = 5000;
/**
* 从连接池获取链接的超时时间,单位毫秒
*/
private int connectionRequestTimeout = 5000;
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -7,10 +7,7 @@ import com.binarywang.spring.starter.wxjava.mp.service.WxMpMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
import me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl;
import me.chanjar.weixin.mp.api.impl.*;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.mp.config.WxMpHostConfig;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
@@ -91,6 +88,9 @@ public abstract class AbstractWxMpConfiguration {
case HTTP_CLIENT:
wxMpService = new WxMpServiceHttpClientImpl();
break;
case HTTP_COMPONENTS:
wxMpService = new WxMpServiceHttpComponentsImpl();
break;
default:
wxMpService = new WxMpServiceImpl();
break;

View File

@@ -142,6 +142,10 @@ public class WxMpMultiProperties implements Serializable {
* HttpClient
*/
HTTP_CLIENT,
/**
* HttpComponents
*/
HTTP_COMPONENTS,
/**
* OkHttp
*/

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -9,6 +9,8 @@ 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.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.mp.config.WxMpHostConfig;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
@@ -122,6 +124,19 @@ public class WxMpStorageAutoConfiguration {
config.setSecret(properties.getSecret());
config.setToken(properties.getToken());
config.setAesKey(properties.getAesKey());
WxMpProperties.ConfigStorage storage = properties.getConfigStorage();
// 设置自定义的HttpClient超时配置
ApacheHttpClientBuilder clientBuilder = config.getApacheHttpClientBuilder();
if (clientBuilder == null) {
clientBuilder = DefaultApacheHttpClientBuilder.get();
}
if (clientBuilder instanceof DefaultApacheHttpClientBuilder) {
DefaultApacheHttpClientBuilder defaultBuilder = (DefaultApacheHttpClientBuilder) clientBuilder;
defaultBuilder.setConnectionTimeout(storage.getConnectionTimeout());
defaultBuilder.setSoTimeout(storage.getSoTimeout());
defaultBuilder.setConnectionRequestTimeout(storage.getConnectionRequestTimeout());
config.setApacheHttpClientBuilder(defaultBuilder);
}
config.setUseStableAccessToken(wxMpProperties.isUseStableAccessToken());
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());

View File

@@ -102,6 +102,21 @@ public class WxMpProperties {
*/
private String httpProxyPassword;
/**
* 连接超时时间,单位毫秒
*/
private int connectionTimeout = 5000;
/**
* 读数据超时时间即socketTimeout单位毫秒
*/
private int soTimeout = 1;
/**
* 从连接池获取链接的超时时间,单位毫秒
*/
private int connectionRequestTimeout = 5000;
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,6 +1,8 @@
package com.binarywang.spring.starter.wxjava.open.config.storage;
import com.binarywang.spring.starter.wxjava.open.properties.WxOpenProperties;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage;
/**
@@ -28,6 +30,20 @@ public abstract class AbstractWxOpenConfigStorageConfiguration {
}
config.setRetrySleepMillis(retrySleepMillis);
config.setMaxRetryTimes(maxRetryTimes);
// 设置自定义的HttpClient超时配置
ApacheHttpClientBuilder clientBuilder = config.getApacheHttpClientBuilder();
if (clientBuilder == null) {
clientBuilder = DefaultApacheHttpClientBuilder.get();
}
if (clientBuilder instanceof DefaultApacheHttpClientBuilder) {
DefaultApacheHttpClientBuilder defaultBuilder = (DefaultApacheHttpClientBuilder) clientBuilder;
defaultBuilder.setConnectionTimeout(storage.getConnectionTimeout());
defaultBuilder.setSoTimeout(storage.getSoTimeout());
defaultBuilder.setConnectionRequestTimeout(storage.getConnectionRequestTimeout());
config.setApacheHttpClientBuilder(defaultBuilder);
}
return config;
}
}

View File

@@ -108,6 +108,21 @@ public class WxOpenProperties {
*/
private int maxRetryTimes = 5;
/**
* 连接超时时间,单位毫秒
*/
private int connectionTimeout = 5000;
/**
* 读数据超时时间即socketTimeout单位毫秒
*/
private int soTimeout = 1;
/**
* 从连接池获取链接的超时时间,单位毫秒
*/
private int connectionRequestTimeout = 5000;
}
public enum StorageType {

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>wx-java-spring-boot-starters</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

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

@@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<artifactId>weixin-graal</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.7.4.B</version>
<version>4.7.7.B</version>
</parent>
<artifactId>weixin-java-channel</artifactId>
@@ -14,7 +14,7 @@
<description>微信视频号/微信小店 Java SDK</description>
<properties>
<jackson.version>2.18.1</jackson.version>
<jackson.version>2.18.4</jackson.version>
</properties>
<dependencies>
@@ -29,6 +29,11 @@
<artifactId>jodd-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>

View File

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

View File

@@ -3,6 +3,7 @@ package me.chanjar.weixin.channel.api;
import java.util.List;
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleListParam;
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleReasonResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectReasonResponse;
@@ -26,10 +27,22 @@ public interface WxChannelAfterSaleService {
* @return 售后单列表
*
* @throws WxErrorException 异常
* @deprecated 使用 {@link WxChannelAfterSaleService#listIds(AfterSaleListParam)}
*/
@Deprecated
AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String nextKey)
throws WxErrorException;
/**
* 获取售后单列表
*
* @param param 参数
* @return 售后单列表
*
* @throws WxErrorException 异常
*/
AfterSaleListResponse listIds(AfterSaleListParam param) throws WxErrorException;
/**
* 获取售后单详情
*

View File

@@ -34,6 +34,17 @@ public interface WxChannelOrderService {
*/
OrderInfoResponse getOrder(String orderId) throws WxErrorException;
/**
* 获取订单详情
*
* @param orderId 订单id
* @param encodeSensitiveInfo 是否编码敏感信息
* @return 订单详情
*
* @throws WxErrorException 异常
*/
OrderInfoResponse getOrder(String orderId, Boolean encodeSensitiveInfo) throws WxErrorException;
/**
* 获取订单列表
*
@@ -128,7 +139,7 @@ public interface WxChannelOrderService {
WxChannelBaseResponse closeOrder(String orderId);
/**
* 获取快递公司列表
* 获取快递公司列表-旧
*
* @return 快递公司列表
*
@@ -136,6 +147,16 @@ public interface WxChannelOrderService {
*/
DeliveryCompanyResponse listDeliveryCompany() throws WxErrorException;
/**
* 获取快递公司列表
*
* @param ewaybillOnly 是否仅返回支持电子面单功能的快递公司
* @return 快递公司列表
*
* @throws WxErrorException 异常
*/
DeliveryCompanyResponse listDeliveryCompany(Boolean ewaybillOnly) throws WxErrorException;
/**
* 订单发货
*

View File

@@ -15,43 +15,84 @@ public interface WxLeaguePromoterService {
/**
* 新增达人
*
* @param finderId 视频号finder_id
* @param finderId 视频号finder_id,待废除
* @return 结果
* @deprecated 使用 {@link #addPromoterV2(String)}
*/
@Deprecated
WxChannelBaseResponse addPromoter(String finderId) throws WxErrorException;
/**
* 编辑达人
*
* @param finderId 视频号finder_id
* @param finderId 视频号finder_id,待废除
* @param type 操作 1取消邀请 2结束合作
* @return 结果
* @deprecated 使用 {@link #updatePromoterV2(String, int)}
*/
@Deprecated
WxChannelBaseResponse updatePromoter(String finderId, int type) throws WxErrorException;
/**
* 删除达人
*
* @param finderId 视频号finder_id
* @param finderId 视频号finder_id,待废除
* @return 结果
* @deprecated 使用 {@link #deletePromoterV2(String)}
*/
@Deprecated
WxChannelBaseResponse deletePromoter(String finderId) throws WxErrorException;
/**
* 获取达人详情信息
*
* @param finderId 视频号finder_id
* @param finderId 视频号finder_id,待废除
* @return 结果
* @deprecated 使用 {@link #getPromoterInfoV2(String)}
*/
@Deprecated
PromoterInfoResponse getPromoterInfo(String finderId) throws WxErrorException;
/**
* 获取达人列表
*
* @param pageIndex 页面下标下标从1开始默认为1
* @param pageSize 单页达人数不超过200
* @param status 拉取该状态下的达人列表
* @return 结果
*/
PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status) throws WxErrorException;
/**
* 新增达人
*
* @param promoterId 达人带货id
* @return 结果
*/
WxChannelBaseResponse addPromoterV2(String promoterId) throws WxErrorException;
/**
* 编辑达人
*
* @param promoterId 达人带货id
* @param type 操作 1取消邀请 2结束合作
* @return 结果
*/
WxChannelBaseResponse updatePromoterV2(String promoterId, int type) throws WxErrorException;
/**
* 删除达人
*
* @param promoterId 达人带货id
* @return 结果
*/
WxChannelBaseResponse deletePromoterV2(String promoterId) throws WxErrorException;
/**
* 获取达人详情信息
*
* @param promoterId 达人带货id
* @return 结果
*/
PromoterInfoResponse getPromoterInfoV2(String promoterId) throws WxErrorException;
/**
* 获取达人列表
*
* @param pageIndex 页面下标下标从1开始默认为1
* @param pageSize 单页达人数不超过200
* @param status 拉取该状态下的达人列表
* @return 结果
*/
PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status) throws WxErrorException;
}

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,16 +23,22 @@ 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;
}
@Override
public AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String nextKey)
throws WxErrorException {
AfterSaleListParam param = new AfterSaleListParam(beginCreateTime, endCreateTime, nextKey);
AfterSaleListParam param = new AfterSaleListParam(beginCreateTime, endCreateTime, null, null, nextKey);
String resJson = shopService.post(AFTER_SALE_LIST_URL, param);
return ResponseUtils.decode(resJson, AfterSaleListResponse.class);
}
@Override
public AfterSaleListResponse listIds(AfterSaleListParam param) throws WxErrorException {
String resJson = shopService.post(AFTER_SALE_LIST_URL, param);
return ResponseUtils.decode(resJson, AfterSaleListResponse.class);
}

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;
}
@@ -56,7 +56,7 @@ public class WxChannelBasicServiceImpl implements WxChannelBasicService {
public ChannelImageInfo uploadImg(int respType, File file, int height, int width) throws WxErrorException {
String url = IMG_UPLOAD_URL + "?upload_type=0&resp_type=" + respType + "&height=" + height + "&width=" + width;
RequestExecutor<String, File> executor = ChannelFileUploadRequestExecutor.create(shopService);
String resJson = (String) shopService.execute(executor, url, file);
String resJson = shopService.execute(executor, url, file);
UploadImageResponse response = ResponseUtils.decode(resJson, UploadImageResponse.class);
return response.getImgInfo();
}
@@ -64,19 +64,19 @@ public class WxChannelBasicServiceImpl implements WxChannelBasicService {
@Override
public QualificationFileResponse uploadQualificationFile(File file) throws WxErrorException {
RequestExecutor<String, File> executor = ChannelFileUploadRequestExecutor.create(shopService);
String resJson = (String) shopService.execute(executor, UPLOAD_QUALIFICATION_FILE, file);
String resJson = shopService.execute(executor, UPLOAD_QUALIFICATION_FILE, file);
return ResponseUtils.decode(resJson, QualificationFileResponse.class);
}
@Override
public ChannelImageResponse getImg(String mediaId) throws WxErrorException {
String appId = shopService.getConfig().getAppid();
ChannelImageResponse rs = null;
ChannelImageResponse rs;
try {
String url = GET_IMG_URL + "?media_id=" + mediaId;
RequestExecutor<ChannelImageResponse, String> executor = ChannelMediaDownloadRequestExecutor.create(shopService,
Files.createTempDirectory("wxjava-channel-" + appId).toFile());
rs = (ChannelImageResponse) shopService.execute(executor, url, null);
rs = shopService.execute(executor, url, null);
} catch (IOException e) {
throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e);
}

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

@@ -1,24 +1,37 @@
package me.chanjar.weixin.channel.api.impl;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.DELIVERY_SEND_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_NEW_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.*;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ACCEPT_ADDRESS_MODIFY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DECODE_SENSITIVE_INFO_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_LIST_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_SEARCH_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REJECT_ADDRESS_MODIFY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_ADDRESS_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_EXPRESS_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_PRICE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_REMARK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPLOAD_FRESH_INSPECT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_TEL_NUMBER_URL;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelOrderService;
import me.chanjar.weixin.channel.bean.base.AddressInfo;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliverySendParam;
import me.chanjar.weixin.channel.bean.delivery.FreshInspectParam;
import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
import me.chanjar.weixin.channel.bean.order.OrderAddressParam;
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
import me.chanjar.weixin.channel.bean.order.OrderListParam;
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
@@ -39,15 +52,22 @@ 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;
}
@Override
public OrderInfoResponse getOrder(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
OrderInfoParam param = new OrderInfoParam(orderId, null);
String resJson = shopService.post(ORDER_GET_URL, param);
return ResponseUtils.decode(resJson, OrderInfoResponse.class);
}
@Override
public OrderInfoResponse getOrder(String orderId, Boolean encodeSensitiveInfo) throws WxErrorException {
OrderInfoParam param = new OrderInfoParam(orderId, encodeSensitiveInfo);
String resJson = shopService.post(ORDER_GET_URL, param);
return ResponseUtils.decode(resJson, OrderInfoResponse.class);
}
@@ -119,6 +139,16 @@ public class WxChannelOrderServiceImpl implements WxChannelOrderService {
return ResponseUtils.decode(resJson, DeliveryCompanyResponse.class);
}
@Override
public DeliveryCompanyResponse listDeliveryCompany(Boolean ewaybillOnly) throws WxErrorException {
String reqJson = "{}";
if (ewaybillOnly != null) {
reqJson = "{\"ewaybill_only\":" + ewaybillOnly + "}";
}
String resJson = shopService.post(GET_DELIVERY_COMPANY_NEW_URL, reqJson);
return ResponseUtils.decode(resJson, DeliveryCompanyResponse.class);
}
@Override
public WxChannelBaseResponse deliveryOrder(String orderId, List<DeliveryInfo> deliveryList)
throws WxErrorException {

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

@@ -1,28 +1,28 @@
package me.chanjar.weixin.channel.api.impl;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_ACCESS_TOKEN_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_STABLE_ACCESS_TOKEN_URL;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.bean.token.StableTokenParam;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.util.http.HttpType;
import me.chanjar.weixin.common.util.http.HttpClientType;
import me.chanjar.weixin.common.util.http.apache.ApacheBasicResponseHandler;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.IOException;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_ACCESS_TOKEN_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_STABLE_ACCESS_TOKEN_URL;
/**
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@@ -63,8 +63,8 @@ public class WxChannelServiceHttpClientImpl extends BaseWxChannelServiceImpl<Htt
}
@Override
public HttpType getRequestType() {
return HttpType.APACHE_HTTP;
public HttpClientType getRequestType() {
return HttpClientType.APACHE_HTTP;
}
@Override
@@ -76,27 +76,12 @@ public class WxChannelServiceHttpClientImpl extends BaseWxChannelServiceImpl<Htt
url = String.format(url, config.getAppid(), config.getSecret());
HttpGet httpGet = null;
CloseableHttpResponse response = null;
try {
httpGet = new HttpGet(url);
if (this.getRequestHttpProxy() != null) {
RequestConfig requestConfig = RequestConfig.custom().setProxy(this.getRequestHttpProxy()).build();
httpGet.setConfig(requestConfig);
}
response = getRequestHttpClient().execute(httpGet);
return new BasicResponseHandler().handleResponse(response);
} finally {
if (httpGet != null) {
httpGet.releaseConnection();
}
if (response != null) {
try {
response.close();
} catch (IOException ignored) {
}
}
HttpGet httpGet = new HttpGet(url);
if (this.getRequestHttpProxy() != null) {
RequestConfig requestConfig = RequestConfig.custom().setProxy(this.getRequestHttpProxy()).build();
httpGet.setConfig(requestConfig);
}
return getRequestHttpClient().execute(httpGet, ApacheBasicResponseHandler.INSTANCE);
}
/**
@@ -125,10 +110,6 @@ public class WxChannelServiceHttpClientImpl extends BaseWxChannelServiceImpl<Htt
assert requestJson != null;
httpPost.setEntity(new StringEntity(requestJson, ContentType.APPLICATION_JSON));
try (CloseableHttpResponse response = getRequestHttpClient().execute(httpPost)) {
return new BasicResponseHandler().handleResponse(response);
} finally {
httpPost.releaseConnection();
}
return getRequestHttpClient().execute(httpPost, ApacheBasicResponseHandler.INSTANCE);
}
}

View File

@@ -0,0 +1,113 @@
package me.chanjar.weixin.channel.api.impl;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.bean.token.StableTokenParam;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.util.http.HttpClientType;
import me.chanjar.weixin.common.util.http.apache.ApacheBasicResponseHandler;
import me.chanjar.weixin.common.util.http.hc.BasicResponseHandler;
import me.chanjar.weixin.common.util.http.hc.DefaultHttpComponentsClientBuilder;
import me.chanjar.weixin.common.util.http.hc.HttpComponentsClientBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.hc.client5.http.classic.HttpClient;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.io.entity.StringEntity;
import java.io.IOException;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_ACCESS_TOKEN_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.GET_STABLE_ACCESS_TOKEN_URL;
/**
* @author altusea
*/
@Slf4j
public class WxChannelServiceHttpComponentsImpl extends BaseWxChannelServiceImpl<HttpClient, HttpHost> {
private CloseableHttpClient httpClient;
private HttpHost httpProxy;
@Override
public void initHttp() {
WxChannelConfig config = this.getConfig();
HttpComponentsClientBuilder apacheHttpClientBuilder = DefaultHttpComponentsClientBuilder.get();
apacheHttpClientBuilder.httpProxyHost(config.getHttpProxyHost())
.httpProxyPort(config.getHttpProxyPort())
.httpProxyUsername(config.getHttpProxyUsername())
.httpProxyPassword(config.getHttpProxyPassword().toCharArray());
if (config.getHttpProxyHost() != null && config.getHttpProxyPort() > 0) {
this.httpProxy = new HttpHost(config.getHttpProxyHost(), config.getHttpProxyPort());
}
this.httpClient = apacheHttpClientBuilder.build();
}
@Override
public CloseableHttpClient getRequestHttpClient() {
return httpClient;
}
@Override
public HttpHost getRequestHttpProxy() {
return httpProxy;
}
@Override
public HttpClientType getRequestType() {
return HttpClientType.HTTP_COMPONENTS;
}
@Override
protected String doGetAccessTokenRequest() throws IOException {
WxChannelConfig config = this.getConfig();
String url = StringUtils.isNotEmpty(config.getAccessTokenUrl()) ? config.getAccessTokenUrl() :
StringUtils.isNotEmpty(config.getApiHostUrl()) ?
GET_ACCESS_TOKEN_URL.replace("https://api.weixin.qq.com", config.getApiHostUrl()) : GET_ACCESS_TOKEN_URL;
url = String.format(url, config.getAppid(), config.getSecret());
HttpGet httpGet = new HttpGet(url);
if (this.getRequestHttpProxy() != null) {
RequestConfig requestConfig = RequestConfig.custom().setProxy(this.getRequestHttpProxy()).build();
httpGet.setConfig(requestConfig);
}
return getRequestHttpClient().execute(httpGet, BasicResponseHandler.INSTANCE);
}
/**
* 获取稳定版接口调用凭据
*
* @param forceRefresh false 为普通模式, true为强制刷新模式
* @return 返回json的字符串
* @throws IOException the io exception
*/
@Override
protected String doGetStableAccessTokenRequest(boolean forceRefresh) throws IOException {
WxChannelConfig config = this.getConfig();
String url = GET_STABLE_ACCESS_TOKEN_URL;
HttpPost httpPost = new HttpPost(url);
if (this.getRequestHttpProxy() != null) {
RequestConfig requestConfig = RequestConfig.custom().setProxy(this.getRequestHttpProxy()).build();
httpPost.setConfig(requestConfig);
}
StableTokenParam requestParam = new StableTokenParam();
requestParam.setAppId(config.getAppid());
requestParam.setSecret(config.getSecret());
requestParam.setGrantType("client_credential");
requestParam.setForceRefresh(forceRefresh);
String requestJson = JsonUtils.encode(requestParam);
assert requestJson != null;
httpPost.setEntity(new StringEntity(requestJson, ContentType.APPLICATION_JSON));
return getRequestHttpClient().execute(httpPost, BasicResponseHandler.INSTANCE);
}
}

View File

@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.bean.token.StableTokenParam;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.util.http.HttpType;
import me.chanjar.weixin.common.util.http.HttpClientType;
import me.chanjar.weixin.common.util.http.okhttp.DefaultOkHttpClientBuilder;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
import okhttp3.Authenticator;
@@ -65,8 +65,8 @@ public class WxChannelServiceOkHttpImpl extends BaseWxChannelServiceImpl<OkHttpC
}
@Override
public HttpType getRequestType() {
return HttpType.OK_HTTP;
public HttpClientType getRequestType() {
return HttpClientType.OK_HTTP;
}
@Override

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;
}
@@ -58,6 +58,34 @@ public class WxLeaguePromoterServiceImpl implements WxLeaguePromoterService {
return ResponseUtils.decode(resJson, PromoterInfoResponse.class);
}
@Override
public WxChannelBaseResponse addPromoterV2(String promoterId) throws WxErrorException {
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
String resJson = shopService.post(ADD_PROMOTER_URL, reqJson);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
@Override
public WxChannelBaseResponse updatePromoterV2(String promoterId, int type) throws WxErrorException {
String reqJson = "{\"promoter_id\":\"" + promoterId + "\",\"type\":" + type + "}";
String resJson = shopService.post(EDIT_PROMOTER_URL, reqJson);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
@Override
public WxChannelBaseResponse deletePromoterV2(String promoterId) throws WxErrorException {
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
String resJson = shopService.post(DELETE_PROMOTER_URL, reqJson);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
@Override
public PromoterInfoResponse getPromoterInfoV2(String promoterId) throws WxErrorException {
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
String resJson = shopService.post(GET_PROMOTER_URL, reqJson);
return ResponseUtils.decode(resJson, PromoterInfoResponse.class);
}
@Override
public PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status)
throws WxErrorException {

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

@@ -0,0 +1,35 @@
package me.chanjar.weixin.channel.bean.after;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.AddressInfo;
/**
* 换货类型的发货物流信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class AfterSaleExchangeDeliveryInfo implements Serializable {
private static final long serialVersionUID = 3039216368034112038L;
/** 快递单号 */
@JsonProperty("waybill_id")
private String waybillId;
/** 物流公司id */
@JsonProperty("delivery_id")
private String deliveryId;
/** 物流公司名称 */
@JsonProperty("delivery_name")
private String deliveryName;
/** 地址信息 */
@JsonProperty("address_info")
private AddressInfo addressInfo;
}

View File

@@ -0,0 +1,34 @@
package me.chanjar.weixin.channel.bean.after;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 换货商品信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class AfterSaleExchangeProductInfo implements Serializable {
private static final long serialVersionUID = -1341436607011117854L;
/** 商品spuid */
@JsonProperty("product_id")
private String productId;
/** 旧商品skuid */
@JsonProperty("old_sku_id")
private String oldSkuId;
/** 新商品skuid */
@JsonProperty("new_sku_id")
private String newSkuId;
/** 数量 */
@JsonProperty("product_cnt")
private String productCnt;
}

View File

@@ -86,4 +86,16 @@ public class AfterSaleInfo implements Serializable {
/** 仅在待商家审核退款退货申请或收货期间返回,表示操作剩余时间(秒数)*/
@JsonProperty("deadline")
private Long deadline;
/** 售后换货商品信息 */
@JsonProperty("exchange_product_info")
private AfterSaleExchangeProductInfo exchangeProductInfo;
/** 售后换货物流信息 */
@JsonProperty("exchange_delivery_info")
private AfterSaleExchangeDeliveryInfo exchangeDeliveryInfo;
/** 售后换货虚拟号码信息 */
@JsonProperty("virtual_tel_num_info")
private AfterSaleVirtualNumberInfo virtualTelNumInfo;
}

View File

@@ -28,6 +28,14 @@ public class AfterSaleListParam implements Serializable {
@JsonProperty("end_create_time")
private Long endCreateTime;
/** 售后单更新起始时间 */
@JsonProperty("begin_update_time")
private Long beginUpdateTime;
/** 售后单更新结束时间end_update_time减去begin_update_time不得大于24小时 */
@JsonProperty("end_update_time")
private Long endUpdateTime;
/** 翻页参数,从第二页开始传,来源于上一页的返回值 */
@JsonProperty("next_key")
private String nextKey;

View File

@@ -0,0 +1,26 @@
package me.chanjar.weixin.channel.bean.after;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 虚拟号码信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class AfterSaleVirtualNumberInfo implements Serializable {
private static final long serialVersionUID = -5756618937333859985L;
/** 虚拟号码 */
@JsonProperty("virtual_tel_number")
private String virtualTelNumber;
/** 虚拟号码过期时间 */
@JsonProperty("virtual_tel_expire_time")
private Long virtualTelExpireTime;
}

View File

@@ -18,11 +18,19 @@ import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
public class PromoterListResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = 1411870432999885996L;
/** 达人finder_id列表 */
/** 达人finder_id列表待废除后续以promoter_ids为准 */
@JsonProperty("finder_ids")
private List<String> finderIds;
/** 达人总数 */
@JsonProperty("total_num")
private Integer totalNum;
/** 后面是否还有true: 还有内容; false: 已结束)*/
@JsonProperty("continue_flag")
private Boolean continueFlag;
/** 达人带货id列表 */
@JsonProperty("promoter_ids")
private List<String> promoterIds;
}

View File

@@ -0,0 +1,33 @@
package me.chanjar.weixin.channel.bean.order;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 商品定制信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class OrderCustomInfo implements Serializable {
private static final long serialVersionUID = 6681266835402157651L;
/** 定制图片custom_type=2时返回 */
@JsonProperty("custom_img_url")
private String customImgUrl;
/** 定制文字custom_type=1时返回 */
@JsonProperty("custom_word")
private String customWord;
/** 定制类型枚举值请参考CustomType枚举 */
@JsonProperty("custom_type")
private Integer customType;
/** 定制预览图片,开启了定制预览时返回 */
@JsonProperty("custom_preview_img_url")
private String customPreviewImgUrl;
}

View File

@@ -61,7 +61,18 @@ public class OrderDetailInfo implements Serializable {
private OrderAgentInfo agentInfo;
/** 订单来源信息 */
@JsonProperty("source_info")
private OrderSourceInfo sourceInfo;
@JsonProperty("source_infos")
private List<OrderSourceInfo> sourceInfos;
/** 订单退款信息 */
@JsonProperty("refund_info")
private OrderSourceInfo refundInfo;
/** 订单代写商品信息 */
@JsonProperty("greeting_card_info")
private OrderGreetingCardInfo greetingCardInfo;
/** 商品定制信息 */
@JsonProperty("custom_info")
private OrderCustomInfo customInfo;
}

View File

@@ -0,0 +1,29 @@
package me.chanjar.weixin.channel.bean.order;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 订单商品贺卡信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class OrderGreetingCardInfo implements Serializable {
private static final long serialVersionUID = -6391443179945240242L;
/** 贺卡落款,用户选填 */
@JsonProperty("giver_name")
private String giverName;
/** 贺卡称谓,用户选填 */
@JsonProperty("receiver_name")
private String receiverName;
/** 贺卡内容,用户必填 */
@JsonProperty("greeting_message")
private String greetingMessage;
}

View File

@@ -39,6 +39,26 @@ public class OrderInfo implements Serializable {
@JsonProperty("aftersale_detail")
protected AfterSaleDetail afterSaleDetail;
/** 是否为礼物订单 */
@JsonProperty("is_present")
private Boolean present;
/** 礼物订单ID */
@JsonProperty("present_order_id_str")
private String presentOrderId;
/** 礼物订单留言 */
@JsonProperty("present_note")
private String presentNote;
/** 礼物订单赠送者openid */
@JsonProperty("present_giver_openid")
private String presentGiverOpenid;
/** 礼物订单赠送者unionid */
@JsonProperty("present_giver_unionid")
private String presentGiverUnionid;
/** 创建时间 秒级时间戳 */
@JsonProperty("create_time")
protected Integer createTime;
@@ -46,5 +66,4 @@ public class OrderInfo implements Serializable {
/** 更新时间 秒级时间戳 */
@JsonProperty("update_time")
protected Integer updateTime;
}

View File

@@ -0,0 +1,31 @@
package me.chanjar.weixin.channel.bean.order;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 获取订单详情参数
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderInfoParam implements Serializable {
private static final long serialVersionUID = 42L;
/** 订单ID */
@JsonProperty("order_id")
private String orderId;
/**
* 用于商家提前测试订单脱敏效果如果传true即对订单进行脱敏后期会默认对所有订单脱敏
*/
@JsonProperty("encode_sensitive_info")
private Boolean encodeSensitiveInfo;
}

View File

@@ -0,0 +1,21 @@
package me.chanjar.weixin.channel.bean.order;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 订单退款信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class OrderRefundInfo implements Serializable {
private static final long serialVersionUID = -7257910073388645919L;
/** 退还运费金额,礼物订单(is_present=true)可能存在 */
@JsonProperty("refund_freight")
private Integer refundFreight;
}

View File

@@ -25,6 +25,6 @@ public class OrderSearchParam extends StreamPageParam {
private Integer onAfterSaleOrderExist;
/** 订单状态 {@link me.chanjar.weixin.channel.enums.WxOrderStatus} */
@JsonProperty("on_aftersale_order_exist")
@JsonProperty("status")
private Integer status;
}

View File

@@ -23,26 +23,44 @@ public class OrderSourceInfo implements Serializable {
private String skuId;
/**
* 带货账类型1视频号2公众号3小程序
* 带货账类型1视频号2公众号3小程序4企业微信5带货达人6服务号1000带货机构
*/
@JsonProperty("account_type")
private Integer accountType;
/**
* 带货账id如果带货账类型是视频号此id为视频号id; 如果带货类型为 公众号/小程序, 此id 为对应 公众号/小程序 的appid
* 带货账id取决于带货账类型分别为视频号id、公众号appid、小程序appid、企业微信id、带货达人appid、服务号appid、带货机构id
*/
@JsonProperty("account_id")
private String accountId;
/**
* 销售渠道, 0关联账号1合作账号100联盟达人带货
* 账号关联类型,0关联账号1合作账号2授权号100达人带货101带货机构推广
*/
@JsonProperty("sale_channel")
private Integer saleChannel;
/**
* 带货账昵称
* 带货账昵称
*/
@JsonProperty("account_nickname")
private String accountNickname;
/**
* 带货内容类型1企微成员转发
*/
@JsonProperty("content_type")
private String contentType;
/**
* 带货内容id取决于带货内容类型企微成员user_id
*/
@JsonProperty("content_id")
private String contentId;
/**
* 自营推客推广的带货机构id
*/
@JsonProperty("promoter_head_supplier_id")
private String promoterHeadSupplierId;
}

View File

@@ -247,8 +247,9 @@ public class WxChannelApiUrlConstants {
/** 物流相关接口 */
public interface Delivery {
/** 获取快递公司列表 */
String GET_DELIVERY_COMPANY_NEW_URL = "https://api.weixin.qq.com/channels/ec/order/deliverycompanylist/new/get";
/** 获取快递公司列表(旧) */
String GET_DELIVERY_COMPANY_URL = "https://api.weixin.qq.com/channels/ec/order/deliverycompanylist/get";
/** 订单发货 */
String DELIVERY_SEND_URL = "https://api.weixin.qq.com/channels/ec/order/delivery/send";

View File

@@ -0,0 +1,47 @@
package me.chanjar.weixin.channel.executor;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.ResponseHandler;
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
public class ApacheHttpChannelFileUploadRequestExecutor extends ChannelFileUploadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheHttpChannelFileUploadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp) {
super(requestHttp);
}
@Override
public String execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (requestHttp.getRequestHttpProxy() != null) {
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
httpPost.setConfig(config);
}
if (file != null) {
HttpEntity entity = MultipartEntityBuilder
.create()
.addBinaryBody("media", file)
.setMode(HttpMultipartMode.RFC6532)
.build();
httpPost.setEntity(entity);
}
return requestHttp.getRequestHttpClient().execute(httpPost, Utf8ResponseHandler.INSTANCE);
}
@Override
public void execute(String uri, File data, ResponseHandler<String> handler, WxType wxType)
throws WxErrorException, IOException {
handler.handle(this.execute(uri, data, wxType));
}
}

View File

@@ -0,0 +1,90 @@
package me.chanjar.weixin.channel.executor;
import me.chanjar.weixin.channel.bean.image.ChannelImageResponse;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.ResponseHandler;
import me.chanjar.weixin.common.util.http.apache.InputStreamResponseHandler;
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
public class ApacheHttpChannelMediaDownloadRequestExecutor extends ChannelMediaDownloadRequestExecutor<CloseableHttpClient, HttpHost> {
public ApacheHttpChannelMediaDownloadRequestExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp, File tmpDirFile) {
super(requestHttp, tmpDirFile);
}
@Override
public ChannelImageResponse execute(String uri, String data, WxType wxType) throws WxErrorException, IOException {
if (data != null) {
if (uri.indexOf('?') == -1) {
uri += '?';
}
uri += uri.endsWith("?") ? data : '&' + data;
}
HttpGet httpGet = new HttpGet(uri);
if (requestHttp.getRequestHttpProxy() != null) {
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
httpGet.setConfig(config);
}
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpGet);
InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response)) {
Header[] contentTypeHeader = response.getHeaders("Content-Type");
String contentType = null;
if (contentTypeHeader != null && contentTypeHeader.length > 0) {
contentType = contentTypeHeader[0].getValue();
if (contentType.startsWith(ContentType.APPLICATION_JSON.getMimeType())) {
// application/json; encoding=utf-8 下载媒体文件出错
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
return JsonUtils.decode(responseContent, ChannelImageResponse.class);
}
}
String fileName = this.getFileName(response);
if (StringUtils.isBlank(fileName)) {
fileName = String.valueOf(System.currentTimeMillis());
}
String baseName = FilenameUtils.getBaseName(fileName);
if (StringUtils.isBlank(fileName) || baseName.length() < 3) {
baseName = String.valueOf(System.currentTimeMillis());
}
String extension = FilenameUtils.getExtension(fileName);
if (StringUtils.isBlank(extension)) {
extension = "unknown";
}
File file = createTmpFile(inputStream, baseName, extension, tmpDirFile);
return new ChannelImageResponse(file, contentType);
}
}
private String getFileName(CloseableHttpResponse response) throws WxErrorException {
Header[] contentDispositionHeader = response.getHeaders("Content-disposition");
if (contentDispositionHeader == null || contentDispositionHeader.length == 0) {
return createDefaultFileName();
}
return this.extractFileNameFromContentString(contentDispositionHeader[0].getValue());
}
@Override
public void execute(String uri, String data, ResponseHandler<ChannelImageResponse> handler, WxType wxType)
throws WxErrorException, IOException {
handler.handle(this.execute(uri, data, wxType));
}
}

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