mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7198a58e9c | ||
|
|
e72991c0b5 | ||
|
|
9e190fef36 | ||
|
|
e2e4d345b0 | ||
|
|
7ba18434a1 | ||
|
|
a3919af9a9 | ||
|
|
a4fc7c9a7c | ||
|
|
15b2cefaf8 | ||
|
|
25ac89c3bf | ||
|
|
c065ad212f | ||
|
|
9d5e22f7c8 | ||
|
|
22a29c51c0 | ||
|
|
087870ed0c | ||
|
|
b5a760d4ca | ||
|
|
e0e03d82ff | ||
|
|
43a3a1e5a0 | ||
|
|
6e96d7cf55 | ||
|
|
722c2cfe2b | ||
|
|
36028b8d5b | ||
|
|
bae84e1d6b | ||
|
|
ee94e6d03b | ||
|
|
a726e37ba5 | ||
|
|
185df6e16d | ||
|
|
a19112b320 | ||
|
|
cb6e9c85ac | ||
|
|
a4bc5389b9 | ||
|
|
a9b8667053 | ||
|
|
3acf55a0d2 | ||
|
|
677b2cf432 | ||
|
|
87322e6d78 | ||
|
|
26057b0844 | ||
|
|
59074bae86 | ||
|
|
b83435281d | ||
|
|
a47bc221f5 | ||
|
|
f84ccb3cdd | ||
|
|
3def66bc78 | ||
|
|
bef154020f | ||
|
|
71334bf630 | ||
|
|
4ee7728091 | ||
|
|
b7dc0d6526 | ||
|
|
9818ba3ab7 | ||
|
|
112f7c100e | ||
|
|
abae2cfce9 | ||
|
|
6ccbf900db | ||
|
|
64e29af498 | ||
|
|
521ea08ba9 | ||
|
|
1557894954 | ||
|
|
e425817e69 | ||
|
|
0d1320a48f | ||
|
|
87c33ac776 | ||
|
|
90556820ba | ||
|
|
b7ceeed557 | ||
|
|
baa8a6da37 | ||
|
|
901fceba27 | ||
|
|
e0a39c8d68 | ||
|
|
749f326f94 | ||
|
|
90d8098d93 | ||
|
|
b35645ee67 | ||
|
|
a3a8295262 | ||
|
|
8088c4ada8 | ||
|
|
c443dc1fd1 | ||
|
|
c0a7376e22 | ||
|
|
5776914faa | ||
|
|
d2571d094b | ||
|
|
d3552245a5 | ||
|
|
57859d8d80 | ||
|
|
6205568948 | ||
|
|
327e6ffa05 | ||
|
|
d68956df72 | ||
|
|
c7ade5b2d5 | ||
|
|
07c4615d7e | ||
|
|
99a55e6bc9 | ||
|
|
3ced24eb9e | ||
|
|
431e83bf4f | ||
|
|
3f6e5d8d51 | ||
|
|
c702f787f7 | ||
|
|
0721b01cdb | ||
|
|
e636362585 | ||
|
|
ace4f9a278 | ||
|
|
60fdf91ce7 | ||
|
|
d94b42b6ee | ||
|
|
1e13645f72 | ||
|
|
43a460a28b | ||
|
|
c109e81842 | ||
|
|
c26b055ccf | ||
|
|
4888d1576b | ||
|
|
48a86940e2 | ||
|
|
199c109a3d | ||
|
|
9522585074 | ||
|
|
ae08833323 | ||
|
|
bf9c0571f8 | ||
|
|
30264bfaae | ||
|
|
edb098500d | ||
|
|
46921e0e55 | ||
|
|
df759717cd | ||
|
|
31d446a6bd | ||
|
|
48a22a0e60 | ||
|
|
512975fb86 | ||
|
|
62490c77b6 | ||
|
|
2eb6180567 | ||
|
|
4118e8bba6 | ||
|
|
10414d9971 | ||
|
|
c1e7d095ed | ||
|
|
6b21f1a234 | ||
|
|
69cf2bcb90 | ||
|
|
a8a5359c9f | ||
|
|
9b78acd0e5 | ||
|
|
b08530917c | ||
|
|
791ec8d2db | ||
|
|
b6ad48dff7 | ||
|
|
809ff15709 | ||
|
|
bb65189fb8 | ||
|
|
8a161cfa2c | ||
|
|
4ca4dec37e | ||
|
|
d759317396 | ||
|
|
3bd517a007 | ||
|
|
7219c2dbd0 | ||
|
|
26e2cbcb60 | ||
|
|
320bbfe7be | ||
|
|
65134bd1ca | ||
|
|
81cb16bf9f | ||
|
|
aa19a2874d | ||
|
|
3477e41ad2 | ||
|
|
7f7c0a3765 | ||
|
|
b8d0baae5b | ||
|
|
286596f8a2 | ||
|
|
310e1d91be | ||
|
|
3918005b1f | ||
|
|
a435ee5a01 | ||
|
|
7a200c0574 | ||
|
|
80cc0e4939 | ||
|
|
81bb1f3563 | ||
|
|
57ff6a80ec | ||
|
|
d19fec73d4 | ||
|
|
db5826cfcf | ||
|
|
dc8b5454e2 | ||
|
|
30a0eb8e98 | ||
|
|
6e5800181b | ||
|
|
4d526dbd7a | ||
|
|
152e6a01fa | ||
|
|
d39062353c | ||
|
|
8c461bbaf2 | ||
|
|
3e09168019 | ||
|
|
3abaa2c1d1 | ||
|
|
1dfde62772 | ||
|
|
36602d58a5 | ||
|
|
f94e67056d | ||
|
|
066c77c752 | ||
|
|
c3f4943acd | ||
|
|
e9c351a083 | ||
|
|
dbd02fda8c | ||
|
|
27081809d6 | ||
|
|
705256bb19 | ||
|
|
9004b089a2 |
11
.circleci/config.yml
Normal file
11
.circleci/config.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2.1
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cimg/openjdk:11.0
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Build
|
||||
command: mvn -B -DskipTests clean package -Dcheckstyle.skip=true
|
||||
|
||||
14
README.md
14
README.md
@@ -4,7 +4,7 @@
|
||||
[](https://github.com/Wechat-Group/WxJava)
|
||||
[](https://github.com/Wechat-Group/WxJava/releases)
|
||||
[](http://mvnrepository.com/artifact/com.github.binarywang/wx-java)
|
||||
[](https://app.travis-ci.com/github/Wechat-Group/WxJava)
|
||||
[](https://circleci.com/gh/Wechat-Group/WxJava/tree/develop)
|
||||
[](https://www.jetbrains.com/?from=WxJava-weixin-java-tools)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<tr>
|
||||
<td align="center" valign="middle" colspan="3">
|
||||
<a href="http://www.ccflow.org/?from=wxjava" target="_blank">
|
||||
<img height="120" src="http://binary.ac.cn/images/banners/ccflow.png" alt="">
|
||||
<img height="120" src="https://ccfast.cc/AD/ccflow2.png" alt="ccflow">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -31,17 +31,17 @@
|
||||
<tr>
|
||||
<td align="left" 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="http://binary.ac.cn/images/qrcodes/mp.png" alt="">
|
||||
<img height="120" src="https://gitee.com/public-res/wx-java-images/raw/main/qrcodes/mp.png" alt="mp qrcode">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<a href="https://www.diboot.com/" target="_blank">
|
||||
<img height="120" src="http://binary.ac.cn/images/banners/diboot.png" alt="diboot低代码开发平台"/>
|
||||
<img height="120" src="https://gitee.com/public-res/wx-java-images/raw/main/banners/diboot.png" alt="diboot低代码开发平台"/>
|
||||
</a>
|
||||
</td>
|
||||
<td align="right" valign="middle">
|
||||
<a href="https://promotion.aliyun.com/ntms/act/qwbk.html?userCode=7makzf5h" target="_blank">
|
||||
<img height="120" src="http://binary.ac.cn/images/banners/aliyun.jpg" alt="">
|
||||
<img height="120" src="https://gitee.com/public-res/wx-java-images/raw/main/banners/aliyun.jpg" alt="aliyun ad">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
### 重要信息
|
||||
1. 项目合作洽谈请联系微信`binary0000`(在微信里自行搜索并添加好友,请注明来意,如有关于SDK问题需讨论请参考下文入群讨论,不要加此微信)。
|
||||
2. **2022-4-10 发布 [【4.3.0正式版】](https://mp.weixin.qq.com/s/yCsa7nD4_DLjW1RDcrEk6g)**!
|
||||
2. **2022-8-21 发布 [【4.4.0正式版】](https://mp.weixin.qq.com/s/kHg-QHMK6ymbQwTdKFF2lQ)**!
|
||||
3. 贡献源码可以参考视频:[【贡献源码全过程(上集)】](https://mp.weixin.qq.com/s/3xUZSATWwHR_gZZm207h7Q)、[【贡献源码全过程(下集)】](https://mp.weixin.qq.com/s/nyzJwVVoYSJ4hSbwyvTx9A) ,友情提供:[程序员小山与Bug](https://space.bilibili.com/473631007)
|
||||
4. 新手重要提示:本项目仅是一个SDK开发工具包,未提供Web实现,建议使用 `maven` 或 `gradle` 引用本项目即可使用本SDK提供的各种功能,详情可参考 **[【Demo项目】](demo.md)** 或本项目中的部分单元测试代码;
|
||||
5. 微信开发新手请务必阅读【开发文档】([Gitee Wiki](https://gitee.com/binary/weixin-java-tools/wikis/Home) 或者 [Github Wiki](https://github.com/Wechat-Group/WxJava/wiki))的常见问题部分,可以少走很多弯路,节省不少时间。
|
||||
@@ -80,7 +80,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>(不同模块参考下文)</artifactId>
|
||||
<version>4.3.0</version>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 100 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 366 KiB After Width: | Height: | Size: 241 KiB |
15
pom.xml
15
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>WxJava - Weixin/Wechat Java SDK</name>
|
||||
<description>微信开发Java SDK</description>
|
||||
@@ -129,7 +129,8 @@
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<httpclient.version>4.5.13</httpclient.version>
|
||||
<jetty.version>9.4.43.v20210629</jetty.version>
|
||||
<jetty.version>9.4.51.v20230217</jetty.version>
|
||||
<!-- 这个不能用10以上的版本,不支持jdk8-->
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -185,7 +186,7 @@
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.19</version>
|
||||
<version>1.4.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@@ -225,7 +226,8 @@
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.1.0</version>
|
||||
<version>7.5</version>
|
||||
<!-- 这个不能用7.6以上的版本,不支持jdk8-->
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -320,11 +322,6 @@
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<version>1.68</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Import;
|
||||
* 企业微信自动注册
|
||||
*
|
||||
* @author yl
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(WxCpProperties.class)
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* 企业微信平台相关服务自动注册
|
||||
*
|
||||
* @author yl
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Import;
|
||||
* 企业微信存储策略自动配置
|
||||
*
|
||||
* @author yl
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
@Configuration
|
||||
@Import({
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
* 企业微信接入相关配置属性
|
||||
*
|
||||
* @author yl
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
* WxCpConfigStorage 抽象配置类
|
||||
*
|
||||
* @author yl & Wang_Wong
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
public abstract class AbstractWxCpConfigStorageConfiguration {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* 自动装配基于内存策略配置
|
||||
*
|
||||
* @author yl
|
||||
* @date 2021/12/6
|
||||
* created on 2021/12/6
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.cp.config.WxCpAutoConfiguration
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Import;
|
||||
* 自动配置.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-08-10
|
||||
* created on 2019-08-10
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(WxMaProperties.class)
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.miniapp.enums;
|
||||
* httpclient类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-05-25
|
||||
* created on 2020-05-25
|
||||
*/
|
||||
public enum HttpClientType {
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.miniapp.enums;
|
||||
* storage类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-05-25
|
||||
* created on 2020-05-25
|
||||
*/
|
||||
public enum StorageType {
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
* redis 配置.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
@Data
|
||||
public class RedisProperties {
|
||||
|
||||
@@ -12,7 +12,7 @@ import static com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProper
|
||||
* 属性配置类.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-08-10
|
||||
* created on 2019-08-10
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = PREFIX)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.miniapp.config.WxMaAutoConfiguration
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.mp.enums;
|
||||
* httpclient类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
public enum HttpClientType {
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.mp.enums;
|
||||
* storage类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
public enum StorageType {
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||
* redis 配置属性.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
@Data
|
||||
public class RedisProperties implements Serializable {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.mp.config.WxMpAutoConfiguration
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.open.config.WxOpenAutoConfiguration
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.pay.config.WxPayAutoConfiguration
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>wx-java-spring-boot-starters</artifactId>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.qidian.enums;
|
||||
* httpclient类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
public enum HttpClientType {
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.binarywang.spring.starter.wxjava.qidian.enums;
|
||||
* storage类型.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
public enum StorageType {
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||
* redis 配置属性.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-30
|
||||
* created on 2020-08-30
|
||||
*/
|
||||
@Data
|
||||
public class RedisProperties implements Serializable {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
com.binarywang.spring.starter.wxjava.qidian.config.WxQidianAutoConfiguration
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>weixin-graal</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>weixin-java-common</artifactId>
|
||||
@@ -77,10 +77,6 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
|
||||
@@ -223,6 +223,7 @@ public class WxConsts {
|
||||
public static final String TEXT = "text";
|
||||
public static final String VOICE = "voice";
|
||||
public static final String IMAGE = "image";
|
||||
public static final String IMAGES = "images";
|
||||
public static final String MPVIDEO = "mpvideo";
|
||||
}
|
||||
|
||||
@@ -309,7 +310,23 @@ public class WxConsts {
|
||||
*/
|
||||
public static final String LOCATION_SELECT = "location_select";
|
||||
|
||||
/**
|
||||
* 授权用户资料变更事件
|
||||
* 1、 当部分用户的资料存在风险时,平台会对用户资料进行清理,并通过消息推送服务器通知最近30天授权过的公众号开发者,我们建议开发者留意响应该事件,及时主动更新或清理用户的头像及昵称,降低风险。
|
||||
* 2、 当用户撤回授权信息时,平台会通过消息推送服务器通知给公众号开发者,请开发者注意及时删除用户信息。
|
||||
*/
|
||||
public static final String USER_INFO_MODIFIED = "user_info_modified";
|
||||
|
||||
/**
|
||||
* 用户撤回授权事件
|
||||
*/
|
||||
public static final String USER_AUTHORIZATION_REVOKE = "user_authorization_revoke";
|
||||
|
||||
/**
|
||||
* 群发模板回调事件
|
||||
*/
|
||||
public static final String TEMPLATE_SEND_JOB_FINISH = "TEMPLATESENDJOBFINISH";
|
||||
|
||||
/**
|
||||
* 微信小店 订单付款通知.
|
||||
*/
|
||||
@@ -397,11 +414,29 @@ public class WxConsts {
|
||||
*/
|
||||
public static final String WEAPP_AUDIT_FAIL = "weapp_audit_fail";
|
||||
|
||||
/**
|
||||
* 小程序自定义交易组件支付通知
|
||||
*/
|
||||
public static final String OPEN_PRODUCT_ORDER_PAY = "open_product_order_pay";
|
||||
/**
|
||||
* 点击菜单跳转小程序的事件推送
|
||||
*/
|
||||
public static final String VIEW_MINIPROGRAM = "view_miniprogram";
|
||||
|
||||
/**
|
||||
* 订阅通知事件:用户操作订阅通知弹窗
|
||||
*/
|
||||
public static final String SUBSCRIBE_MSG_POPUP_EVENT = "subscribe_msg_popup_event";
|
||||
|
||||
/**
|
||||
* 订阅通知事件:用户管理订阅通知
|
||||
*/
|
||||
public static final String SUBSCRIBE_MSG_CHANGE_EVENT = "subscribe_msg_change_event";
|
||||
|
||||
/**
|
||||
* 订阅通知事件:发送订阅通知回调
|
||||
*/
|
||||
public static final String SUBSCRIBE_MSG_SENT_EVENT = "subscribe_msg_sent_event";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,10 +12,10 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author jiangby
|
||||
* @version 1.0
|
||||
* <p>
|
||||
* 消息去重,记录消息ID首次出现时的时间戳,
|
||||
* 15S后定时任务触发时废除该记录消息ID
|
||||
* 消息去重,记录消息ID首次出现时的时间戳,
|
||||
* 15S后定时任务触发时废除该记录消息ID
|
||||
* </p>
|
||||
* @date 2022/5/26 1:32
|
||||
* created on 2022/5/26 1:32
|
||||
*/
|
||||
@Slf4j
|
||||
public class WxMessageInMemoryDuplicateCheckerSingleton implements WxMessageDuplicateChecker {
|
||||
@@ -34,7 +34,7 @@ public class WxMessageInMemoryDuplicateCheckerSingleton implements WxMessageDupl
|
||||
* 线程池
|
||||
*/
|
||||
private static final ScheduledThreadPoolExecutor SCHEDULED_THREAD_POOL_EXECUTOR = new ScheduledThreadPoolExecutor(1,
|
||||
new ThreadFactoryBuilder().setNameFormat("wxMessage-memory-pool-%d").build(), new ThreadPoolExecutor.AbortPolicy());
|
||||
new ThreadFactoryBuilder().setNameFormat("wxMessage-memory-pool-%d").setDaemon(true).build(), new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
/**
|
||||
* 消息id->消息时间戳的map.
|
||||
@@ -71,7 +71,7 @@ public class WxMessageInMemoryDuplicateCheckerSingleton implements WxMessageDupl
|
||||
* 内部类实现单例
|
||||
*/
|
||||
private static class WxMessageInnerClass {
|
||||
static final WxMessageInMemoryDuplicateCheckerSingleton CHECKER_SINGLETON = new WxMessageInMemoryDuplicateCheckerSingleton();
|
||||
static final WxMessageInMemoryDuplicateCheckerSingleton CHECKER_SINGLETON = new WxMessageInMemoryDuplicateCheckerSingleton();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package me.chanjar.weixin.common.api;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 利用redis检查消息是否重复
|
||||
*
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class WxMessageInRedisDuplicateChecker implements WxMessageDuplicateChecker {
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private int expire = 10;
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
/**
|
||||
* messageId是否重复
|
||||
*
|
||||
* @param messageId messageId
|
||||
* @return 是否
|
||||
*/
|
||||
@Override
|
||||
public boolean isDuplicate(String messageId) {
|
||||
RBucket<String> r = redissonClient.getBucket("wx:message:duplicate:check:" + messageId);
|
||||
boolean setSuccess = r.trySet("1", expire, TimeUnit.SECONDS);
|
||||
return !setSuccess;
|
||||
}
|
||||
|
||||
public int getExpire() {
|
||||
return expire;
|
||||
}
|
||||
|
||||
public void setExpire(int expire) {
|
||||
this.expire = expire;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ package me.chanjar.weixin.common.bean;
|
||||
* 包含toJson()方法的接口.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-10-05
|
||||
* created on 2020-10-05
|
||||
*/
|
||||
public interface ToJson {
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
* oauth2用户个人信息.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-10-11
|
||||
* created on 2020-10-11
|
||||
*/
|
||||
@Data
|
||||
public class WxOAuth2UserInfo implements Serializable {
|
||||
|
||||
@@ -30,6 +30,9 @@ public class WxOAuth2AccessToken implements Serializable {
|
||||
@SerializedName("scope")
|
||||
private String scope;
|
||||
|
||||
@SerializedName("is_snapshotuser")
|
||||
private Integer snapshotUser;
|
||||
|
||||
/**
|
||||
* https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&announce_id=11513156443eZYea&version=&lang=zh_CN.
|
||||
* 本接口在scope参数为snsapi_base时不再提供unionID字段。
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
* OCR身份证识别结果.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-06-23
|
||||
* created on 2019-06-23
|
||||
*/
|
||||
@Data
|
||||
public class WxOcrIdCardResult implements Serializable {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||
* .
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2021-01-27
|
||||
* created on 2021-01-27
|
||||
*/
|
||||
@Data
|
||||
public class CategoryData implements Serializable {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||
* .
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2021-01-27
|
||||
* created on 2021-01-27
|
||||
*/
|
||||
@Data
|
||||
public class PubTemplateKeyword implements Serializable {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||
* .
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2021-01-27
|
||||
* created on 2021-01-27
|
||||
*/
|
||||
@Data
|
||||
public class TemplateInfo implements Serializable {
|
||||
|
||||
@@ -1136,6 +1136,11 @@ public enum WxOpenErrorMsgEnum {
|
||||
*/
|
||||
CODE_40222(40222, "invalid request idc domain"),
|
||||
|
||||
/**
|
||||
* empty media cover, please check the media
|
||||
*/
|
||||
CODE_40229(40229, "媒体封面为空,请添加媒体封面"),
|
||||
|
||||
/**
|
||||
* 缺少 access_token 参数 access_token missing
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ package me.chanjar.weixin.common.error;
|
||||
* WxJava专用的runtime exception.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-09-26
|
||||
* created on 2020-09-26
|
||||
*/
|
||||
public class WxRuntimeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 4881698471192264412L;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.chanjar.weixin.common.redis;
|
||||
|
||||
import com.github.jedis.lock.JedisLock;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.util.locks.JedisDistributedLock;
|
||||
import redis.clients.jedis.Jedis;
|
||||
@@ -8,6 +9,12 @@ import redis.clients.jedis.util.Pool;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
/**
|
||||
* @author Mario Luo
|
||||
*
|
||||
* @deprecated 该类底层使用过时的8年不维护的 {@link JedisLock}组件,不可靠,不建议继续使用。请
|
||||
* 使用:{@link RedisTemplateWxRedisOps}、{@link RedissonWxRedisOps} 替换
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class JedisWxRedisOps implements WxRedisOps {
|
||||
private final Pool<Jedis> jedisPool;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.concurrent.locks.Lock;
|
||||
* <p>
|
||||
* 该接口不承诺稳定, 外部实现请继承{@link BaseWxRedisOps}
|
||||
*
|
||||
* @author Mario Luo
|
||||
* @see BaseWxRedisOps 实现需要继承该类
|
||||
* @see JedisWxRedisOps jedis实现
|
||||
* @see RedissonWxRedisOps redisson实现
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author : zhayueran
|
||||
* @date 2019/6/27 14:06
|
||||
* created on 2019/6/27 14:06
|
||||
*/
|
||||
public class OcrDiscernApacheHttpRequestExecutor extends OcrDiscernRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
public OcrDiscernApacheHttpRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author zhayueran
|
||||
* @date 2019/6/27 15:06
|
||||
* created on 2019/6/27 15:06
|
||||
*/
|
||||
public abstract class OcrDiscernRequestExecutor<H, P> implements RequestExecutor<String, File> {
|
||||
protected RequestHttp<H, P> requestHttp;
|
||||
|
||||
@@ -8,7 +8,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
* oauth2 相关接口.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-08
|
||||
* created on 2020-08-08
|
||||
*/
|
||||
public interface WxOAuth2Service {
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.File;
|
||||
* https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21516712284rHWMX
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-06-22
|
||||
* created on 2019-06-22
|
||||
*/
|
||||
public interface WxOcrService {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
* 微信服务接口.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-04-25
|
||||
* created on 2020-04-25
|
||||
*/
|
||||
public interface WxService {
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
*
|
||||
* @author Daniel Qian
|
||||
* @date 14/10/19
|
||||
* created on 14/10/19
|
||||
*/
|
||||
public class SHA1 {
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import java.util.Base64;
|
||||
|
||||
import static org.apache.commons.io.FileUtils.openOutputStream;
|
||||
|
||||
/**
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
/**
|
||||
@@ -21,7 +24,8 @@ public class FileUtils {
|
||||
* @param ext 扩展名
|
||||
* @param tmpDirFile 临时文件夹目录
|
||||
*/
|
||||
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
|
||||
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile)
|
||||
throws IOException {
|
||||
File resultFile = File.createTempFile(name, '.' + ext, tmpDirFile);
|
||||
|
||||
resultFile.deleteOnExit();
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
* InputStreamData
|
||||
*
|
||||
* @author zichuan.zhou91@gmail.com
|
||||
* @date 2022/2/15
|
||||
* created on 2022/2/15
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.io.InputStream;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
public class ApacheMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
public ApacheMediaDownloadRequestExecutor(RequestHttp requestHttp, File tmpDirFile) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.io.IOException;
|
||||
* 文件输入流上传.
|
||||
*
|
||||
* @author meiqin.zhou91@gmail.com
|
||||
* @date 2022/02/15
|
||||
* created on 2022/02/15
|
||||
*/
|
||||
public class ApacheMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
public ApacheMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
public class ApacheSimpleGetRequestExecutor extends SimpleGetRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
public ApacheSimpleGetRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
public class ApacheSimplePostRequestExecutor extends SimplePostRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
public ApacheSimplePostRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -182,7 +182,6 @@ public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder {
|
||||
.register("https", this.sslConnectionSocketFactory)
|
||||
.build();
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
|
||||
connectionManager.setMaxTotal(this.maxTotalConn);
|
||||
connectionManager.setDefaultMaxPerRoute(this.maxConnPerHost);
|
||||
@@ -238,12 +237,7 @@ public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder {
|
||||
try {
|
||||
SSLContext sslcontext = SSLContexts.custom()
|
||||
//忽略掉对服务器端证书的校验
|
||||
.loadTrustMaterial(new TrustStrategy() {
|
||||
@Override
|
||||
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
return true;
|
||||
}
|
||||
}).build();
|
||||
.loadTrustMaterial((TrustStrategy) (chain, authType) -> true).build();
|
||||
|
||||
return new SSLConnectionSocketFactory(
|
||||
sslcontext,
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
public class JoddHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
public JoddHttpMediaDownloadRequestExecutor(RequestHttp requestHttp, File tmpDirFile) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* 文件输入流上传.
|
||||
*
|
||||
* @author meiqin.zhou91@gmail.com
|
||||
* @date 2022/02/15
|
||||
* created on 2022/02/15
|
||||
*/
|
||||
public class JoddHttpMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
public JoddHttpMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
public class JoddHttpMediaUploadRequestExecutor extends MediaUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
public JoddHttpMediaUploadRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/10
|
||||
* created on 2021/8/10
|
||||
*/
|
||||
@Slf4j
|
||||
public class JoddHttpMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
@Slf4j
|
||||
public class JoddHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
public class JoddHttpSimpleGetRequestExecutor extends SimpleGetRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
public JoddHttpSimpleGetRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import jodd.http.HttpConnectionProvider;
|
||||
import jodd.http.HttpRequest;
|
||||
import jodd.http.HttpResponse;
|
||||
import jodd.http.ProxyInfo;
|
||||
import jodd.util.StringPool;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
@@ -17,7 +16,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
public class JoddHttpSimplePostRequestExecutor extends SimplePostRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
public JoddHttpSimplePostRequestExecutor(RequestHttp requestHttp) {
|
||||
@@ -35,6 +34,7 @@ public class JoddHttpSimplePostRequestExecutor extends SimplePostRequestExecutor
|
||||
}
|
||||
request.withConnectionProvider(provider);
|
||||
if (postEntity != null) {
|
||||
request.contentType("application/json", "utf-8");
|
||||
request.bodyText(postEntity);
|
||||
}
|
||||
HttpResponse response = request.send();
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
package me.chanjar.weixin.common.util.http.okhttp;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
|
||||
import javax.annotation.concurrent.NotThreadSafe;
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* @author wulang
|
||||
**/
|
||||
@Slf4j
|
||||
@Data
|
||||
@NotThreadSafe
|
||||
public class DefaultOkHttpClientBuilder implements OkHttpClientBuilder {
|
||||
|
||||
private final AtomicBoolean prepared = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* 代理
|
||||
*/
|
||||
private Proxy proxy;
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
private Authenticator authenticator;
|
||||
|
||||
/**
|
||||
* 拦截器
|
||||
*/
|
||||
private final List<Interceptor> interceptorList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 请求调度管理
|
||||
*/
|
||||
private Dispatcher dispatcher;
|
||||
|
||||
/**
|
||||
* 连接池
|
||||
*/
|
||||
private ConnectionPool connectionPool;
|
||||
|
||||
/**
|
||||
* 监听网络请求过程
|
||||
*/
|
||||
private EventListener.Factory eventListenerFactory;
|
||||
|
||||
/**
|
||||
* 是否支持失败重连
|
||||
*/
|
||||
private Boolean retryOnConnectionFailure;
|
||||
|
||||
/**
|
||||
* 是否允许重定向操作
|
||||
*/
|
||||
private Boolean followRedirects;
|
||||
|
||||
/**
|
||||
* 连接建立的超时时长
|
||||
*/
|
||||
private Long connectTimeout;
|
||||
|
||||
/**
|
||||
* 连接建立的超时时间单位
|
||||
*/
|
||||
private TimeUnit connectTimeUnit;
|
||||
|
||||
/**
|
||||
* 完整的请求过程超时时长
|
||||
*/
|
||||
private Long callTimeout;
|
||||
|
||||
/**
|
||||
* 完整的请求过程超时时间单位
|
||||
*/
|
||||
private TimeUnit callTimeUnit;
|
||||
|
||||
/**
|
||||
* 连接的IO读操作超时时长
|
||||
*/
|
||||
private Long readTimeout;
|
||||
|
||||
/**
|
||||
* 连接的IO读操作超时时间单位
|
||||
*/
|
||||
private TimeUnit readTimeUnit;
|
||||
|
||||
/**
|
||||
* 连接的IO写操作超时时长
|
||||
*/
|
||||
private Long writeTimeout;
|
||||
|
||||
/**
|
||||
* 连接的IO写操作超时时间单位
|
||||
*/
|
||||
private TimeUnit writeTimeUnit;
|
||||
|
||||
/**
|
||||
* ping的时间间隔
|
||||
*/
|
||||
private Integer pingInterval;
|
||||
|
||||
/**
|
||||
* 持有client对象,仅初始化一次,避免多service实例的时候造成重复初始化的问题
|
||||
*/
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
private DefaultOkHttpClientBuilder() {
|
||||
|
||||
}
|
||||
|
||||
public static DefaultOkHttpClientBuilder get() {
|
||||
return DefaultOkHttpClientBuilder.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClient build() {
|
||||
if (!prepared.get()) {
|
||||
prepare();
|
||||
}
|
||||
return this.okHttpClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder proxy(Proxy proxy) {
|
||||
this.proxy = proxy;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder authenticator(Authenticator authenticator) {
|
||||
this.authenticator = authenticator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder addInterceptor(Interceptor interceptor) {
|
||||
this.interceptorList.add(interceptor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setDispatcher(Dispatcher dispatcher) {
|
||||
this.dispatcher = dispatcher;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setConnectionPool(ConnectionPool connectionPool) {
|
||||
this.connectionPool = connectionPool;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setEventListenerFactory(EventListener.Factory eventListenerFactory) {
|
||||
this.eventListenerFactory = eventListenerFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setRetryOnConnectionFailure(Boolean retryOnConnectionFailure) {
|
||||
this.retryOnConnectionFailure = retryOnConnectionFailure;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setFollowRedirects(Boolean followRedirects) {
|
||||
this.followRedirects = followRedirects;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder connectTimeout(Long timeout, TimeUnit unit) {
|
||||
this.connectTimeout = timeout;
|
||||
this.connectTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder callTimeout(Long timeout, TimeUnit unit) {
|
||||
this.callTimeout = timeout;
|
||||
this.callTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder readTimeout(Long timeout, TimeUnit unit) {
|
||||
this.readTimeout = timeout;
|
||||
this.readTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder writeTimeout(Long timeout, TimeUnit unit) {
|
||||
this.writeTimeout = timeout;
|
||||
this.writeTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setPingInterval(Integer pingInterval) {
|
||||
this.pingInterval = pingInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
private synchronized void prepare() {
|
||||
if (prepared.get()) {
|
||||
return;
|
||||
}
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
if (this.authenticator != null) {
|
||||
builder.authenticator(this.authenticator);
|
||||
}
|
||||
if (this.proxy != null) {
|
||||
builder.proxy(this.proxy);
|
||||
}
|
||||
for (Interceptor interceptor : this.interceptorList) {
|
||||
builder.addInterceptor(interceptor);
|
||||
}
|
||||
if (this.dispatcher != null) {
|
||||
builder.dispatcher(dispatcher);
|
||||
}
|
||||
if (this.connectionPool != null) {
|
||||
builder.connectionPool(connectionPool);
|
||||
}
|
||||
if (this.eventListenerFactory != null) {
|
||||
builder.eventListenerFactory(this.eventListenerFactory);
|
||||
}
|
||||
if (this.retryOnConnectionFailure != null) {
|
||||
builder.setRetryOnConnectionFailure$okhttp(this.retryOnConnectionFailure);
|
||||
}
|
||||
if (this.followRedirects != null) {
|
||||
builder.followRedirects(this.followRedirects);
|
||||
}
|
||||
if (this.connectTimeout != null && this.connectTimeUnit != null) {
|
||||
builder.connectTimeout(this.connectTimeout, this.connectTimeUnit);
|
||||
}
|
||||
if (this.callTimeout != null && this.callTimeUnit != null) {
|
||||
builder.callTimeout(this.callTimeout, this.callTimeUnit);
|
||||
}
|
||||
if (this.readTimeout != null && this.readTimeUnit != null) {
|
||||
builder.readTimeout(this.readTimeout, this.readTimeUnit);
|
||||
}
|
||||
if (this.writeTimeout != null && this.writeTimeUnit != null) {
|
||||
builder.writeTimeout(this.writeTimeout, this.writeTimeUnit);
|
||||
}
|
||||
if (this.pingInterval != null) {
|
||||
builder.setPingInterval$okhttp(this.pingInterval);
|
||||
}
|
||||
this.okHttpClient = builder.build();
|
||||
prepared.set(true);
|
||||
}
|
||||
|
||||
private static class SingletonHolder {
|
||||
private static final DefaultOkHttpClientBuilder INSTANCE = new DefaultOkHttpClientBuilder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package me.chanjar.weixin.common.util.http.okhttp;
|
||||
|
||||
import okhttp3.*;
|
||||
|
||||
import java.net.Proxy;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author wulang
|
||||
**/
|
||||
public interface OkHttpClientBuilder {
|
||||
/**
|
||||
* 构建OkHttpClient实例.
|
||||
*
|
||||
* @return OkHttpClient
|
||||
*/
|
||||
OkHttpClient build();
|
||||
|
||||
/**
|
||||
* 代理
|
||||
*
|
||||
* @param proxy Proxy
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder proxy(Proxy proxy);
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*
|
||||
* @param authenticator Authenticator
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder authenticator(Authenticator authenticator);
|
||||
|
||||
/**
|
||||
* 拦截器
|
||||
*
|
||||
* @param interceptor Interceptor
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder addInterceptor(Interceptor interceptor);
|
||||
|
||||
/**
|
||||
* 请求调度管理
|
||||
*
|
||||
* @param dispatcher Dispatcher
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setDispatcher(Dispatcher dispatcher);
|
||||
|
||||
/**
|
||||
* 连接池
|
||||
*
|
||||
* @param connectionPool ConnectionPool
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setConnectionPool(ConnectionPool connectionPool);
|
||||
|
||||
/**
|
||||
* 监听网络请求过程
|
||||
*
|
||||
* @param eventListenerFactory EventListener
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setEventListenerFactory(EventListener.Factory eventListenerFactory);
|
||||
|
||||
/**
|
||||
* 是否支持失败重连
|
||||
*
|
||||
* @param retryOnConnectionFailure retryOnConnectionFailure
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setRetryOnConnectionFailure(Boolean retryOnConnectionFailure);
|
||||
|
||||
/**
|
||||
* 是否允许重定向操作
|
||||
*
|
||||
* @param followRedirects followRedirects
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setFollowRedirects(Boolean followRedirects);
|
||||
|
||||
/**
|
||||
* 连接建立的超时时间
|
||||
*
|
||||
* @param timeout 时长
|
||||
* @param unit 时间单位
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder connectTimeout(Long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* 完整的请求过程超时时间
|
||||
*
|
||||
* @param timeout 时长
|
||||
* @param unit 时间单位
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder callTimeout(Long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* 连接的IO读操作超时时间
|
||||
*
|
||||
* @param timeout 时长
|
||||
* @param unit 时间单位
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder readTimeout(Long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* 连接的IO写操作超时时间
|
||||
*
|
||||
* @param timeout 时长
|
||||
* @param unit 时间单位
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder writeTimeout(Long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* ping的时间间隔
|
||||
*
|
||||
* @param pingInterval ping的时间间隔
|
||||
* @return OkHttpClientBuilder
|
||||
*/
|
||||
OkHttpClientBuilder setPingInterval(Integer pingInterval);
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package me.chanjar.weixin.common.util.http.okhttp;
|
||||
|
||||
import okhttp3.*;
|
||||
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* OkHttpClient 连接管理器 多一个DNS解析.
|
||||
* <p>大部分代码拷贝自:DefaultOkHttpClientBuilder</p>
|
||||
*
|
||||
* @author wulang
|
||||
**/
|
||||
public class OkHttpDnsClientBuilder implements OkHttpClientBuilder {
|
||||
|
||||
/**
|
||||
* 代理
|
||||
*/
|
||||
private Proxy proxy;
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
private Authenticator authenticator;
|
||||
|
||||
/**
|
||||
* 拦截器
|
||||
*/
|
||||
private final List<Interceptor> interceptorList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 请求调度管理
|
||||
*/
|
||||
private Dispatcher dispatcher;
|
||||
|
||||
/**
|
||||
* 连接池
|
||||
*/
|
||||
private ConnectionPool connectionPool;
|
||||
|
||||
/**
|
||||
* 监听网络请求过程
|
||||
*/
|
||||
private EventListener.Factory eventListenerFactory;
|
||||
|
||||
/**
|
||||
* 是否支持失败重连
|
||||
*/
|
||||
private Boolean retryOnConnectionFailure;
|
||||
|
||||
/**
|
||||
* 是否允许重定向操作
|
||||
*/
|
||||
private Boolean followRedirects;
|
||||
|
||||
/**
|
||||
* 连接建立的超时时长
|
||||
*/
|
||||
private Long connectTimeout;
|
||||
|
||||
/**
|
||||
* 连接建立的超时时间单位
|
||||
*/
|
||||
private TimeUnit connectTimeUnit;
|
||||
|
||||
/**
|
||||
* 完整的请求过程超时时长
|
||||
*/
|
||||
private Long callTimeout;
|
||||
|
||||
/**
|
||||
* 完整的请求过程超时时间单位
|
||||
*/
|
||||
private TimeUnit callTimeUnit;
|
||||
|
||||
/**
|
||||
* 连接的IO读操作超时时长
|
||||
*/
|
||||
private Long readTimeout;
|
||||
|
||||
/**
|
||||
* 连接的IO读操作超时时间单位
|
||||
*/
|
||||
private TimeUnit readTimeUnit;
|
||||
|
||||
/**
|
||||
* 连接的IO写操作超时时长
|
||||
*/
|
||||
private Long writeTimeout;
|
||||
|
||||
/**
|
||||
* 连接的IO写操作超时时间单位
|
||||
*/
|
||||
private TimeUnit writeTimeUnit;
|
||||
|
||||
/**
|
||||
* ping的时间间隔
|
||||
*/
|
||||
private Integer pingInterval;
|
||||
|
||||
private Dns dns;
|
||||
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
private OkHttpDnsClientBuilder() {
|
||||
|
||||
}
|
||||
|
||||
public static OkHttpDnsClientBuilder get() {
|
||||
return new OkHttpDnsClientBuilder();
|
||||
}
|
||||
|
||||
public Dns getDns() {
|
||||
return dns;
|
||||
}
|
||||
|
||||
public void setDns(Dns dns) {
|
||||
this.dns = dns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClient build() {
|
||||
prepare();
|
||||
return this.okHttpClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder proxy(Proxy proxy) {
|
||||
this.proxy = proxy;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder authenticator(Authenticator authenticator) {
|
||||
this.authenticator = authenticator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder addInterceptor(Interceptor interceptor) {
|
||||
this.interceptorList.add(interceptor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setDispatcher(Dispatcher dispatcher) {
|
||||
this.dispatcher = dispatcher;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setConnectionPool(ConnectionPool connectionPool) {
|
||||
this.connectionPool = connectionPool;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setEventListenerFactory(EventListener.Factory eventListenerFactory) {
|
||||
this.eventListenerFactory = eventListenerFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setRetryOnConnectionFailure(Boolean retryOnConnectionFailure) {
|
||||
this.retryOnConnectionFailure = retryOnConnectionFailure;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setFollowRedirects(Boolean followRedirects) {
|
||||
this.followRedirects = followRedirects;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder connectTimeout(Long timeout, TimeUnit unit) {
|
||||
this.connectTimeout = timeout;
|
||||
this.connectTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder callTimeout(Long timeout, TimeUnit unit) {
|
||||
this.callTimeout = timeout;
|
||||
this.callTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder readTimeout(Long timeout, TimeUnit unit) {
|
||||
this.readTimeout = timeout;
|
||||
this.readTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder writeTimeout(Long timeout, TimeUnit unit) {
|
||||
this.writeTimeout = timeout;
|
||||
this.writeTimeUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClientBuilder setPingInterval(Integer pingInterval) {
|
||||
this.pingInterval = pingInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
private synchronized void prepare() {
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
if (this.authenticator != null) {
|
||||
builder.authenticator(this.authenticator);
|
||||
}
|
||||
if (this.proxy != null) {
|
||||
builder.proxy(this.proxy);
|
||||
}
|
||||
for (Interceptor interceptor : this.interceptorList) {
|
||||
builder.addInterceptor(interceptor);
|
||||
}
|
||||
if (this.dispatcher != null) {
|
||||
builder.dispatcher(dispatcher);
|
||||
}
|
||||
if (this.connectionPool != null) {
|
||||
builder.connectionPool(connectionPool);
|
||||
}
|
||||
if (this.eventListenerFactory != null) {
|
||||
builder.eventListenerFactory(this.eventListenerFactory);
|
||||
}
|
||||
if (this.retryOnConnectionFailure != null) {
|
||||
builder.setRetryOnConnectionFailure$okhttp(this.retryOnConnectionFailure);
|
||||
}
|
||||
if (this.followRedirects != null) {
|
||||
builder.followRedirects(this.followRedirects);
|
||||
}
|
||||
if (this.dns != null) {
|
||||
builder.dns(this.dns);
|
||||
}
|
||||
if (this.connectTimeout != null && this.connectTimeUnit != null) {
|
||||
builder.connectTimeout(this.connectTimeout, this.connectTimeUnit);
|
||||
}
|
||||
if (this.callTimeout != null && this.callTimeUnit != null) {
|
||||
builder.callTimeout(this.callTimeout, this.callTimeUnit);
|
||||
}
|
||||
if (this.readTimeout != null && this.readTimeUnit != null) {
|
||||
builder.readTimeout(this.readTimeout, this.readTimeUnit);
|
||||
}
|
||||
if (this.writeTimeout != null && this.writeTimeUnit != null) {
|
||||
builder.writeTimeout(this.writeTimeout, this.writeTimeUnit);
|
||||
}
|
||||
if (this.pingInterval != null) {
|
||||
builder.setPingInterval$okhttp(this.pingInterval);
|
||||
}
|
||||
this.okHttpClient = builder.build();
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
/**
|
||||
*.
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
@Slf4j
|
||||
public class OkHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.io.InputStream;
|
||||
* 文件输入流上传.
|
||||
*
|
||||
* @author meiqin.zhou91@gmail.com
|
||||
* @date 2022/02/15
|
||||
* created on 2022/02/15
|
||||
*/
|
||||
public class OkHttpMediaInputStreamUploadRequestExecutor extends MediaInputStreamUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
public OkHttpMediaInputStreamUploadRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
public class OkHttpMediaUploadRequestExecutor extends MediaUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
public OkHttpMediaUploadRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/10
|
||||
* created on 2021/8/10
|
||||
*/
|
||||
@Slf4j
|
||||
public class OkHttpMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/5
|
||||
* created on 2017/5/5
|
||||
*/
|
||||
@Slf4j
|
||||
public class OkHttpMinishopMediaUploadRequestExecutor extends MinishopUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
public class OkHttpSimpleGetRequestExecutor extends SimpleGetRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
public OkHttpSimpleGetRequestExecutor(RequestHttp requestHttp) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Objects;
|
||||
* .
|
||||
*
|
||||
* @author ecoolper
|
||||
* @date 2017/5/4
|
||||
* created on 2017/5/4
|
||||
*/
|
||||
@Slf4j
|
||||
public class OkHttpSimplePostRequestExecutor extends SimplePostRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
@@ -24,7 +24,7 @@ public class OkHttpSimplePostRequestExecutor extends SimplePostRequestExecutor<O
|
||||
|
||||
@Override
|
||||
public String execute(String uri, String postEntity, WxType wxType) throws WxErrorException, IOException {
|
||||
RequestBody body = RequestBody.Companion.create(postEntity, MediaType.parse("text/plain; charset=utf-8"));
|
||||
RequestBody body = RequestBody.Companion.create(postEntity, MediaType.parse("application/json; charset=utf-8"));
|
||||
Request request = new Request.Builder().url(uri).post(body).build();
|
||||
Response response = requestHttp.getRequestHttpClient().newCall(request).execute();
|
||||
return this.handleResponse(wxType, Objects.requireNonNull(response.body()).string());
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package me.chanjar.weixin.common.util.locks;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.data.redis.connection.RedisStringCommands;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@@ -34,11 +32,11 @@ public class RedisTemplateSimpleDistributedLock implements Lock {
|
||||
|
||||
private final ThreadLocal<String> valueThreadLocal = new ThreadLocal<>();
|
||||
|
||||
public RedisTemplateSimpleDistributedLock(@NonNull StringRedisTemplate redisTemplate, int leaseMilliseconds) {
|
||||
public RedisTemplateSimpleDistributedLock( StringRedisTemplate redisTemplate, int leaseMilliseconds) {
|
||||
this(redisTemplate, "lock:" + UUID.randomUUID().toString(), leaseMilliseconds);
|
||||
}
|
||||
|
||||
public RedisTemplateSimpleDistributedLock(@NonNull StringRedisTemplate redisTemplate, @NonNull String key, int leaseMilliseconds) {
|
||||
public RedisTemplateSimpleDistributedLock( StringRedisTemplate redisTemplate, String key, int leaseMilliseconds) {
|
||||
if (leaseMilliseconds <= 0) {
|
||||
throw new IllegalArgumentException("Parameter 'leaseMilliseconds' must grate then 0: " + leaseMilliseconds);
|
||||
}
|
||||
@@ -84,7 +82,7 @@ public class RedisTemplateSimpleDistributedLock implements Lock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryLock(long time, @NotNull TimeUnit unit) throws InterruptedException {
|
||||
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
|
||||
long waitMs = unit.toMillis(time);
|
||||
boolean locked = tryLock();
|
||||
while (!locked && waitMs > 0) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.thoughtworks.xstream.converters.basic.StringConverter;
|
||||
* Integer型数组转换器.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-08-22
|
||||
* created on 2019-08-22
|
||||
*/
|
||||
public class IntegerArrayConverter extends StringConverter {
|
||||
@Override
|
||||
@@ -24,6 +24,11 @@ public class IntegerArrayConverter extends StringConverter {
|
||||
|
||||
@Override
|
||||
public Object fromString(String str) {
|
||||
|
||||
if (str == null || str.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final Iterable<String> iterable = Splitter.on(",").split(str);
|
||||
final String[] strings = Iterables.toArray(iterable, String.class);
|
||||
Integer[] result = new Integer[strings.length];
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.thoughtworks.xstream.converters.basic.StringConverter;
|
||||
* Long型数组转换器.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-08-22
|
||||
* created on 2019-08-22
|
||||
*/
|
||||
public class LongArrayConverter extends StringConverter {
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
|
||||
import com.thoughtworks.xstream.io.xml.XppDriver;
|
||||
import com.thoughtworks.xstream.security.NoTypePermission;
|
||||
import com.thoughtworks.xstream.security.WildcardTypePermission;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
@@ -20,6 +19,13 @@ import java.io.Writer;
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
public class XStreamInitializer {
|
||||
|
||||
public static ClassLoader classLoader;
|
||||
|
||||
public static void setClassLoader(ClassLoader classLoaderInfo) {
|
||||
classLoader = classLoaderInfo;
|
||||
}
|
||||
|
||||
private static final XppDriver XPP_DRIVER = new XppDriver() {
|
||||
@Override
|
||||
public HierarchicalStreamWriter createWriter(Writer out) {
|
||||
@@ -87,7 +93,10 @@ public class XStreamInitializer {
|
||||
xstream.addPermission(new WildcardTypePermission(new String[]{
|
||||
"me.chanjar.weixin.**", "cn.binarywang.wx.**", "com.github.binarywang.**"
|
||||
}));
|
||||
xstream.setClassLoader(Thread.currentThread().getContextClassLoader());
|
||||
if (null == classLoader) {
|
||||
classLoader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
xstream.setClassLoader(classLoader);
|
||||
return xstream;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import static org.testng.Assert.assertTrue;
|
||||
* @author jiangby
|
||||
* @version 1.0
|
||||
* @description: 作用
|
||||
* @date 2022/5/26 1:46
|
||||
* created on 2022/5/26 1:46
|
||||
*/
|
||||
@Test
|
||||
public class WxMessageInMemoryDuplicateCheckerSingletonTest {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package me.chanjar.weixin.common.api;
|
||||
|
||||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.config.Config;
|
||||
import org.redisson.config.TransportMode;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
@Test
|
||||
public class WxMessageInRedisDuplicateCheckerTest {
|
||||
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@BeforeTest
|
||||
public void init() {
|
||||
Config config = new Config();
|
||||
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
|
||||
config.setTransportMode(TransportMode.NIO);
|
||||
this.redissonClient = Redisson.create(config);
|
||||
checker = new WxMessageInRedisDuplicateChecker(redissonClient);
|
||||
checker.setExpire(2);
|
||||
}
|
||||
|
||||
private WxMessageInRedisDuplicateChecker checker;
|
||||
|
||||
public void test() throws InterruptedException {
|
||||
Long[] msgIds = new Long[]{1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L};
|
||||
|
||||
// 第一次检查
|
||||
for (Long msgId : msgIds) {
|
||||
boolean result = checker.isDuplicate(String.valueOf(msgId));
|
||||
assertFalse(result);
|
||||
}
|
||||
|
||||
// 过1秒再检查
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
for (Long msgId : msgIds) {
|
||||
boolean result = checker.isDuplicate(String.valueOf(msgId));
|
||||
assertTrue(result);
|
||||
}
|
||||
|
||||
// 过1.5秒再检查
|
||||
TimeUnit.MILLISECONDS.sleep(1500L);
|
||||
for (Long msgId : msgIds) {
|
||||
boolean result = checker.isDuplicate(String.valueOf(msgId));
|
||||
assertFalse(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import org.testng.annotations.Test;
|
||||
/**
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-06-06
|
||||
* created on 2020-06-06
|
||||
*/
|
||||
public class WxNetCheckResultTest {
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.chanjar.weixin.common.util.fs;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class FileUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testCreateTmpFile() throws IOException {
|
||||
String strings = "abc";
|
||||
File tmpFile = FileUtils.createTmpFile(new ByteArrayInputStream(strings.getBytes()), "name", "txt");
|
||||
System.out.println(tmpFile);
|
||||
List<String> lines = IOUtils.readLines(Files.newInputStream(tmpFile.toPath()), Charset.defaultCharset());
|
||||
assertThat(lines).hasSize(1);
|
||||
assertThat(lines.get(0)).isEqualTo(strings);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTestCreateTmpFile() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImageToBase64ByStream() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package me.chanjar.weixin.common.util.http.okhttp;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultOkHttpClientBuilderTest {
|
||||
@Test
|
||||
public void testBuild() throws Exception {
|
||||
DefaultOkHttpClientBuilder builder1 = DefaultOkHttpClientBuilder.get();
|
||||
DefaultOkHttpClientBuilder builder2 = DefaultOkHttpClientBuilder.get();
|
||||
Assert.assertSame(builder1, builder2, "DefaultOkHttpClientBuilder为单例,获取到的对象应该相同");
|
||||
List<DefaultOkHttpClientBuilderTest.TestThread> threadList = new ArrayList<>(10);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
DefaultOkHttpClientBuilderTest.TestThread thread = new DefaultOkHttpClientBuilderTest.TestThread();
|
||||
thread.start();
|
||||
threadList.add(thread);
|
||||
}
|
||||
for (DefaultOkHttpClientBuilderTest.TestThread testThread : threadList) {
|
||||
testThread.join();
|
||||
Assert.assertNotEquals(-1, testThread.getRespState(), "请求响应code不应为-1");
|
||||
}
|
||||
|
||||
for (int i = 1; i < threadList.size(); i++) {
|
||||
DefaultOkHttpClientBuilderTest.TestThread thread1 = threadList.get(i - 1);
|
||||
DefaultOkHttpClientBuilderTest.TestThread thread2 = threadList.get(i);
|
||||
Assert.assertSame(
|
||||
thread1.getClient(),
|
||||
thread2.getClient(),
|
||||
"DefaultOkHttpClientBuilderTest为单例,并持有了相同的OkHttpClient"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestThread extends Thread {
|
||||
private OkHttpClient client;
|
||||
private int respState = -1;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
client = DefaultOkHttpClientBuilder.get().build();
|
||||
Request request = new Request.Builder()
|
||||
.url("http://www.sina.com.cn/")
|
||||
.build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
respState = response.code();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public OkHttpClient getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
public int getRespState() {
|
||||
return respState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* GsonHelper 的单元测试.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-09-04
|
||||
* created on 2020-09-04
|
||||
*/
|
||||
public class GsonHelperTest {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>weixin-java-cp</artifactId>
|
||||
@@ -88,6 +88,13 @@
|
||||
<artifactId>moco-runner</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.13.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -15,8 +15,7 @@ import java.util.List;
|
||||
* 官方文档:
|
||||
* https://developer.work.weixin.qq.com/document/path/91552
|
||||
*
|
||||
* @author <a href="https://github.com/0katekate0">Wang_Wong</a>
|
||||
* @date 2022-01-17
|
||||
* @author <a href="https://github.com/0katekate0">Wang_Wong</a> created on 2022-01-17
|
||||
*/
|
||||
@Slf4j
|
||||
public class Finance {
|
||||
@@ -26,130 +25,182 @@ public class Finance {
|
||||
private static final String SO_FILE = "so";
|
||||
private static final String DLL_FILE = "dll";
|
||||
|
||||
public native static long NewSdk();
|
||||
/**
|
||||
* New sdk long.
|
||||
*
|
||||
* @return the long
|
||||
*/
|
||||
public native static long NewSdk();
|
||||
|
||||
/**
|
||||
* 初始化函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param [in] sdk NewSdk返回的sdk指针
|
||||
* @param [in] corpid 调用企业的企业id,例如:wwd08c8exxxx5ab44d,可以在企业微信管理端--我的企业--企业信息查看
|
||||
* @param [in] secret 聊天内容存档的Secret,可以在企业微信管理端--管理工具--聊天内容存档查看
|
||||
* @return 返回是否初始化成功
|
||||
* 0 - 成功
|
||||
* !=0 - 失败
|
||||
*/
|
||||
public native static int Init(long sdk, String corpid, String secret);
|
||||
/**
|
||||
* 初始化函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param sdk the sdk
|
||||
* @param corpid the corpid
|
||||
* @param secret the secret
|
||||
* @return 返回是否初始化成功 0 - 成功 !=0 - 失败
|
||||
*/
|
||||
public native static int Init(long sdk, String corpid, String secret);
|
||||
|
||||
/**
|
||||
* 拉取聊天记录函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param [in] sdk NewSdk返回的sdk指针
|
||||
* @param [in] seq 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0
|
||||
* @param [in] limit 一次拉取的消息条数,最大值1000条,超过1000条会返回错误
|
||||
* @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
|
||||
* @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
|
||||
* @param [out] chatDatas 返回本次拉取消息的数据,slice结构体.内容包括errcode/errmsg,以及每条消息内容。
|
||||
* @return 返回是否调用成功
|
||||
* 0 - 成功
|
||||
* !=0 - 失败
|
||||
*/
|
||||
public native static int GetChatData(long sdk, long seq, long limit, String proxy, String passwd, long timeout, long chatData);
|
||||
/**
|
||||
* 拉取聊天记录函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param sdk the sdk
|
||||
* @param seq the seq
|
||||
* @param limit the limit
|
||||
* @param proxy the proxy
|
||||
* @param passwd the passwd
|
||||
* @param timeout the timeout
|
||||
* @param chatData the chat data
|
||||
* @return 返回是否调用成功 0 - 成功 !=0 - 失败
|
||||
*/
|
||||
public native static int GetChatData(long sdk, long seq, long limit, String proxy, String passwd, long timeout, long chatData);
|
||||
|
||||
/**
|
||||
* 拉取媒体消息函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param [in] sdk NewSdk返回的sdk指针
|
||||
* @param [in] sdkFileid 从GetChatData返回的聊天消息中,媒体消息包括的sdkfileid
|
||||
* @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
|
||||
* @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
|
||||
* @param [in] indexbuf 媒体消息分片拉取,需要填入每次拉取的索引信息。首次不需要填写,默认拉取512k,后续每次调用只需要将上次调用返回的outindexbuf填入即可。
|
||||
* @param [out] media_data 返回本次拉取的媒体数据.MediaData结构体.内容包括data(数据内容)/outindexbuf(下次索引)/is_finish(拉取完成标记)
|
||||
* @return 返回是否调用成功
|
||||
* 0 - 成功
|
||||
* !=0 - 失败
|
||||
*/
|
||||
public native static int GetMediaData(long sdk, String indexbuf, String sdkField, String proxy, String passwd, long timeout, long mediaData);
|
||||
/**
|
||||
* 拉取媒体消息函数
|
||||
* Return值=0表示该API调用成功
|
||||
*
|
||||
* @param sdk the sdk
|
||||
* @param indexbuf the indexbuf
|
||||
* @param sdkField the sdk field
|
||||
* @param proxy the proxy
|
||||
* @param passwd the passwd
|
||||
* @param timeout the timeout
|
||||
* @param mediaData the media data
|
||||
* @return 返回是否调用成功 0 - 成功 !=0 - 失败
|
||||
*/
|
||||
public native static int GetMediaData(long sdk, String indexbuf, String sdkField, String proxy, String passwd, long timeout, long mediaData);
|
||||
|
||||
/**
|
||||
* @param [in] encrypt_key, getchatdata返回的encrypt_key
|
||||
* @param [in] encrypt_msg, getchatdata返回的content
|
||||
* @param [out] msg, 解密的消息明文
|
||||
* @return 返回是否调用成功
|
||||
* 0 - 成功
|
||||
* !=0 - 失败
|
||||
* @brief 解析密文
|
||||
*/
|
||||
public native static int DecryptData(long sdk, String encrypt_key, String encrypt_msg, long msg);
|
||||
/**
|
||||
* Decrypt data int.
|
||||
*
|
||||
* @param sdk the sdk
|
||||
* @param encrypt_key the encrypt key
|
||||
* @param encrypt_msg the encrypt msg
|
||||
* @param msg the msg
|
||||
* @return 返回是否调用成功 0 - 成功 !=0 - 失败
|
||||
* @brief 解析密文
|
||||
*/
|
||||
public native static int DecryptData(long sdk, String encrypt_key, String encrypt_msg, long msg);
|
||||
|
||||
public native static void DestroySdk(long sdk);
|
||||
/**
|
||||
* Destroy sdk.
|
||||
*
|
||||
* @param sdk the sdk
|
||||
*/
|
||||
public native static void DestroySdk(long sdk);
|
||||
|
||||
public native static long NewSlice();
|
||||
/**
|
||||
* New slice long.
|
||||
*
|
||||
* @return the long
|
||||
*/
|
||||
public native static long NewSlice();
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @brief 释放slice,和NewSlice成对使用
|
||||
*/
|
||||
public native static void FreeSlice(long slice);
|
||||
/**
|
||||
* Free slice.
|
||||
*
|
||||
* @param slice the slice
|
||||
* @return
|
||||
* @brief 释放slice ,和NewSlice成对使用
|
||||
*/
|
||||
public native static void FreeSlice(long slice);
|
||||
|
||||
/**
|
||||
* @return 内容
|
||||
* @brief 获取slice内容
|
||||
*/
|
||||
public native static String GetContentFromSlice(long slice);
|
||||
/**
|
||||
* Get content from slice string.
|
||||
*
|
||||
* @param slice the slice
|
||||
* @return 内容 string
|
||||
* @brief 获取slice内容
|
||||
*/
|
||||
public native static String GetContentFromSlice(long slice);
|
||||
|
||||
/**
|
||||
* @return 内容
|
||||
* @brief 获取slice内容长度
|
||||
*/
|
||||
public native static int GetSliceLen(long slice);
|
||||
/**
|
||||
* Get slice len int.
|
||||
*
|
||||
* @param slice the slice
|
||||
* @return 内容 int
|
||||
* @brief 获取slice内容长度
|
||||
*/
|
||||
public native static int GetSliceLen(long slice);
|
||||
|
||||
public native static long NewMediaData();
|
||||
/**
|
||||
* New media data long.
|
||||
*
|
||||
* @return the long
|
||||
*/
|
||||
public native static long NewMediaData();
|
||||
|
||||
public native static void FreeMediaData(long mediaData);
|
||||
/**
|
||||
* Free media data.
|
||||
*
|
||||
* @param mediaData the media data
|
||||
*/
|
||||
public native static void FreeMediaData(long mediaData);
|
||||
|
||||
/**
|
||||
* @return outindex
|
||||
* @brief 获取mediadata outindex
|
||||
*/
|
||||
public native static String GetOutIndexBuf(long mediaData);
|
||||
/**
|
||||
* Get out index buf string.
|
||||
*
|
||||
* @param mediaData the media data
|
||||
* @return outindex string
|
||||
* @brief 获取mediadata outindex
|
||||
*/
|
||||
public native static String GetOutIndexBuf(long mediaData);
|
||||
|
||||
/**
|
||||
* @return data
|
||||
* @brief 获取mediadata data数据
|
||||
*/
|
||||
public native static byte[] GetData(long mediaData);
|
||||
/**
|
||||
* Get data byte [ ].
|
||||
*
|
||||
* @param mediaData the media data
|
||||
* @return data byte [ ]
|
||||
* @brief 获取mediadata data数据
|
||||
*/
|
||||
public native static byte[] GetData(long mediaData);
|
||||
|
||||
public native static int GetIndexLen(long mediaData);
|
||||
/**
|
||||
* Get index len int.
|
||||
*
|
||||
* @param mediaData the media data
|
||||
* @return the int
|
||||
*/
|
||||
public native static int GetIndexLen(long mediaData);
|
||||
|
||||
public native static int GetDataLen(long mediaData);
|
||||
/**
|
||||
* Get data len int.
|
||||
*
|
||||
* @param mediaData the media data
|
||||
* @return the int
|
||||
*/
|
||||
public native static int GetDataLen(long mediaData);
|
||||
|
||||
/**
|
||||
* @return 1完成、0未完成
|
||||
* @brief 判断mediadata是否结束
|
||||
*/
|
||||
public native static int IsMediaDataFinish(long mediaData);
|
||||
/**
|
||||
* Is media data finish int.
|
||||
*
|
||||
* @param mediaData the media data
|
||||
* @return 1完成 、0未完成
|
||||
* @brief 判断mediadata是否结束
|
||||
*/
|
||||
public native static int IsMediaDataFinish(long mediaData);
|
||||
|
||||
/**
|
||||
* 判断Windows环境
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isWindows() {
|
||||
/**
|
||||
* 判断Windows环境
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isWindows() {
|
||||
String osName = System.getProperties().getProperty("os.name");
|
||||
log.info("Loading System Libraries, Current OS Version Is: {}", osName);
|
||||
return osName.toUpperCase().contains("WINDOWS");
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载系统类库
|
||||
*
|
||||
* @param libFiles 类库配置文件
|
||||
* @param prefixPath 类库文件的前缀路径
|
||||
*/
|
||||
public Finance(List<String> libFiles, String prefixPath) {
|
||||
/**
|
||||
* 加载系统类库
|
||||
*
|
||||
* @param libFiles 类库配置文件
|
||||
* @param prefixPath 类库文件的前缀路径
|
||||
*/
|
||||
public Finance(List<String> libFiles, String prefixPath) {
|
||||
boolean isWindows = Finance.isWindows();
|
||||
for (String file : libFiles) {
|
||||
String suffix = file.substring(file.lastIndexOf(".") + 1);
|
||||
@@ -168,14 +219,14 @@ public class Finance {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化类库文件
|
||||
*
|
||||
* @param libFiles
|
||||
* @param prefixPath
|
||||
* @return
|
||||
*/
|
||||
public synchronized static Finance loadingLibraries(List<String> libFiles, String prefixPath) {
|
||||
/**
|
||||
* 初始化类库文件
|
||||
*
|
||||
* @param libFiles the lib files
|
||||
* @param prefixPath the prefix path
|
||||
* @return finance
|
||||
*/
|
||||
public synchronized static Finance loadingLibraries(List<String> libFiles, String prefixPath) {
|
||||
if (finance != null) {
|
||||
return finance;
|
||||
}
|
||||
@@ -183,12 +234,12 @@ public class Finance {
|
||||
return finance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单例sdk
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public synchronized static long SingletonSDK() {
|
||||
/**
|
||||
* 单例sdk
|
||||
*
|
||||
* @return long
|
||||
*/
|
||||
public synchronized static long SingletonSDK() {
|
||||
if (sdk > 0) {
|
||||
return sdk;
|
||||
}
|
||||
@@ -196,12 +247,13 @@ public class Finance {
|
||||
return sdk;
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁sdk,保证线程可见性
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public synchronized static void DestroySingletonSDK(long destroySDK) {
|
||||
/**
|
||||
* 销毁sdk,保证线程可见性
|
||||
*
|
||||
* @param destroySDK the destroy sdk
|
||||
* @return
|
||||
*/
|
||||
public synchronized static void DestroySingletonSDK(long destroySDK) {
|
||||
sdk = 0L;
|
||||
Finance.DestroySdk(destroySDK);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
/**
|
||||
* <pre>
|
||||
* 管理企业号应用
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc#10087
|
||||
* 文档地址:<a href="https://work.weixin.qq.com/api/doc#10087">...</a>
|
||||
* Created by huansinho on 2018/4/13.
|
||||
* </pre>
|
||||
*
|
||||
@@ -19,11 +19,12 @@ public interface WxCpAgentService {
|
||||
* <pre>
|
||||
* 获取企业号应用信息
|
||||
* 该API用于获取企业号某个应用的基本信息,包括头像、昵称、帐号类型、认证类型、可见范围等信息
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#10087
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#10087">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param agentId 企业应用的id
|
||||
* @return 部门id
|
||||
* @return wx cp agent
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpAgent get(Integer agentId) throws WxErrorException;
|
||||
|
||||
@@ -31,10 +32,11 @@ public interface WxCpAgentService {
|
||||
* <pre>
|
||||
* 设置应用.
|
||||
* 仅企业可调用,可设置当前凭证对应的应用;第三方不可调用。
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#10088
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#10088">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param agentInfo 应用信息
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void set(WxCpAgent agentInfo) throws WxErrorException;
|
||||
|
||||
@@ -42,9 +44,11 @@ public interface WxCpAgentService {
|
||||
* <pre>
|
||||
* 获取应用列表.
|
||||
* 企业仅可获取当前凭证对应的应用;第三方仅可获取被授权的应用。
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#11214
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#11214">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @return the list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
List<WxCpAgent> list() throws WxErrorException;
|
||||
|
||||
|
||||
@@ -4,15 +4,36 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpAgentWorkBench;
|
||||
|
||||
/**
|
||||
* The interface Wx cp agent work bench service.
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92535">工作台自定义展示</a>
|
||||
*
|
||||
* @author songshiyu
|
||||
* @date : create in 16:16 2020/9/27
|
||||
* @description: 工作台自定义展示:https://work.weixin.qq.com/api/doc/90000/90135/92535
|
||||
* created on 16:16 2020/9/27
|
||||
*/
|
||||
public interface WxCpAgentWorkBenchService {
|
||||
|
||||
/**
|
||||
* Sets work bench template.
|
||||
*
|
||||
* @param wxCpAgentWorkBench the wx cp agent work bench
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void setWorkBenchTemplate(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* Gets work bench template.
|
||||
*
|
||||
* @param agentid the agentid
|
||||
* @return the work bench template
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
String getWorkBenchTemplate(Long agentid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* Sets work bench data.
|
||||
*
|
||||
* @param wxCpAgentWorkBench the wx cp agent work bench
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void setWorkBenchData(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErrorException;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpAppChatMessage;
|
||||
import me.chanjar.weixin.cp.bean.WxCpChat;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpAppChatMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface WxCpChatService {
|
||||
* @param owner 指定群主的id。如果不指定,系统会随机从userlist中选一人作为群主
|
||||
* @param users 群成员id列表。至少2人,至多500人
|
||||
* @param chatId 群聊的唯一标志,不能与已有的群重复;字符串类型,最长32个字符。只允许字符0-9及字母a-zA-Z。如果不填,系统会随机生成群id
|
||||
* @return 创建的群聊会话chatId
|
||||
* @return 创建的群聊会话chatId string
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
String create(String name, String owner, List<String> users, String chatId) throws WxErrorException;
|
||||
@@ -40,7 +40,7 @@ public interface WxCpChatService {
|
||||
* 获取群聊会话.
|
||||
*
|
||||
* @param chatId 群聊编号
|
||||
* @return 群聊会话
|
||||
* @return 群聊会话 wx cp chat
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
WxCpChat get(String chatId) throws WxErrorException;
|
||||
@@ -49,7 +49,7 @@ public interface WxCpChatService {
|
||||
* 应用支持推送文本、图片、视频、文件、图文等类型.
|
||||
* 请求方式: POST(HTTPS)
|
||||
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token=ACCESS_TOKEN
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc#90000/90135/90248
|
||||
* 文档地址:<a href="https://work.weixin.qq.com/api/doc#90000/90135/90248">...</a>
|
||||
*
|
||||
* @param message 要发送的消息内容对象
|
||||
* @throws WxErrorException 异常
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.corpgroup.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Project: WxJava
|
||||
* @Package: me.chanjar.weixin.cp.api
|
||||
* @Description: 企业互联相关接口
|
||||
* @Author: libo
|
||||
* @Email: 422423229@qq.com
|
||||
* @Date: 27/2/2023 9:57 PM
|
||||
*/
|
||||
public interface WxCpCorpGroupService {
|
||||
List<WxCpCorpGroupCorp> listAppShareInfo(Integer agentId,Integer businessType,String corpId,Integer limit,String cursor) throws WxErrorException;
|
||||
}
|
||||
@@ -19,11 +19,11 @@ public interface WxCpDepartmentService {
|
||||
* <pre>
|
||||
* 部门管理接口 - 创建部门.
|
||||
* 最多支持创建500个部门
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90205
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90205">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param depart 部门
|
||||
* @return 部门id
|
||||
* @return 部门id long
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
Long create(WxCpDepart depart) throws WxErrorException;
|
||||
@@ -31,11 +31,11 @@ public interface WxCpDepartmentService {
|
||||
/**
|
||||
* <pre>
|
||||
* 部门管理接口 - 获取单个部门详情.
|
||||
* 详情请见: https://developer.work.weixin.qq.com/document/path/95351
|
||||
* 详情请见: <a href="https://developer.work.weixin.qq.com/document/path/95351">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param id 部门id
|
||||
* @return 部门信息
|
||||
* @return 部门信息 wx cp depart
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
WxCpDepart get(Long id) throws WxErrorException;
|
||||
@@ -43,11 +43,11 @@ public interface WxCpDepartmentService {
|
||||
/**
|
||||
* <pre>
|
||||
* 部门管理接口 - 获取部门列表.
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90208
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90208">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param id 部门id。获取指定部门及其下的子部门。非必需,可为null
|
||||
* @return 获取的部门列表
|
||||
* @return 获取的部门列表 list
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
List<WxCpDepart> list(Long id) throws WxErrorException;
|
||||
@@ -55,11 +55,11 @@ public interface WxCpDepartmentService {
|
||||
/**
|
||||
* <pre>
|
||||
* 部门管理接口 - 获取子部门ID列表.
|
||||
* 详情请见: https://developer.work.weixin.qq.com/document/path/95350
|
||||
* 详情请见: <a href="https://developer.work.weixin.qq.com/document/path/95350">...</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param id 部门id。获取指定部门及其下的子部门(以及子部门的子部门等等,递归)。 如果不填,默认获取全量组织架构
|
||||
* @return 子部门ID列表
|
||||
* @return 子部门ID列表 list
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
List<WxCpDepart> simpleList(Long id) throws WxErrorException;
|
||||
@@ -67,7 +67,7 @@ public interface WxCpDepartmentService {
|
||||
/**
|
||||
* <pre>
|
||||
* 部门管理接口 - 更新部门.
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90206
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90206">...</a>
|
||||
* 如果id为0(未部门),1(黑名单),2(星标组),或者不存在的id,微信会返回系统繁忙的错误
|
||||
* </pre>
|
||||
*
|
||||
@@ -79,7 +79,7 @@ public interface WxCpDepartmentService {
|
||||
/**
|
||||
* <pre>
|
||||
* 部门管理接口 - 删除部门.
|
||||
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90207
|
||||
* 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90207">...</a>
|
||||
* 应用须拥有指定部门的管理权限
|
||||
* </pre>
|
||||
*
|
||||
|
||||
@@ -7,9 +7,8 @@ import me.chanjar.weixin.cp.bean.export.WxCpExportResult;
|
||||
/**
|
||||
* 异步导出接口
|
||||
*
|
||||
* @author <a href="https://github.com/zhongjun96">zhongjun</a>
|
||||
* @date 2022/4/21
|
||||
**/
|
||||
* @author <a href="https://github.com/zhongjun96">zhongjun</a> created on 2022/4/21
|
||||
*/
|
||||
public interface WxCpExportService {
|
||||
|
||||
/**
|
||||
@@ -93,7 +92,7 @@ public interface WxCpExportService {
|
||||
* </pre>
|
||||
*
|
||||
* @param jobId 异步任务id
|
||||
* @return 导出结果
|
||||
* @return 导出结果 result
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpExportResult getResult(String jobId) throws WxErrorException;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import lombok.NonNull;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.*;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import me.chanjar.weixin.cp.bean.external.interceptrule.WxCpInterceptRule;
|
||||
import me.chanjar.weixin.cp.bean.external.interceptrule.WxCpInterceptRuleAddRequest;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -42,7 +42,7 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp contact way result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpContactWayResult addContactWay(@NonNull WxCpContactWayInfo info) throws WxErrorException;
|
||||
WxCpContactWayResult addContactWay(WxCpContactWayInfo info) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取企业已配置的「联系我」方式
|
||||
@@ -55,7 +55,8 @@ public interface WxCpExternalContactService {
|
||||
* @return contact way
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpContactWayInfo getContactWay(@NonNull String configId) throws WxErrorException;
|
||||
WxCpContactWayInfo getContactWay(String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新企业已配置的「联系我」方式
|
||||
*
|
||||
@@ -67,7 +68,7 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp updateContactWay(@NonNull WxCpContactWayInfo info) throws WxErrorException;
|
||||
WxCpBaseResp updateContactWay(WxCpContactWayInfo info) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 删除企业已配置的「联系我」方式
|
||||
@@ -80,7 +81,7 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp deleteContactWay(@NonNull String configId) throws WxErrorException;
|
||||
WxCpBaseResp deleteContactWay(String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 结束临时会话
|
||||
@@ -96,7 +97,7 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp closeTempChat(@NonNull String userId, @NonNull String externalUserId) throws WxErrorException;
|
||||
WxCpBaseResp closeTempChat(String userId, String externalUserId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -142,7 +143,7 @@ public interface WxCpExternalContactService {
|
||||
* 企业和服务商可通过此接口,将微信外部联系人的userid转为微信openid,用于调用支付相关接口。暂不支持企业微信外部联系人(ExternalUserid为wo开头)的userid转openid。
|
||||
*
|
||||
* @param externalUserid 微信外部联系人的userid
|
||||
* @return 该企业的外部联系人openid
|
||||
* @return 该企业的外部联系人openid string
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String convertToOpenid(String externalUserid) throws WxErrorException;
|
||||
@@ -165,13 +166,13 @@ public interface WxCpExternalContactService {
|
||||
* </pre>
|
||||
*
|
||||
* @param unionid 微信客户的unionid
|
||||
* @return 该企业的外部联系人ID
|
||||
* @param openid the openid
|
||||
* @return 该企业的外部联系人ID string
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String unionidToExternalUserid(@NotNull String unionid,String openid) throws WxErrorException;
|
||||
String unionidToExternalUserid(String unionid, String openid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
*
|
||||
* 配置客户群进群方式
|
||||
* 企业可以在管理后台-客户联系中配置「加入群聊」的二维码或者小程序按钮,客户通过扫描二维码或点击小程序上的按钮,即可加入特定的客户群。
|
||||
* 企业可通过此接口为具有客户联系功能的成员生成专属的二维码或者小程序按钮。
|
||||
@@ -179,40 +180,44 @@ public interface WxCpExternalContactService {
|
||||
* 注意:
|
||||
* 通过API添加的配置不会在管理端进行展示,每个企业可通过API最多配置50万个「加入群聊」(与「联系我」共用50万的额度)。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param wxCpGroupJoinWayInfo
|
||||
*
|
||||
* @param wxCpGroupJoinWayInfo the wx cp group join way info
|
||||
* @return {@link WxCpGroupJoinWayResult}
|
||||
* @throws WxErrorException
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGroupJoinWayResult addJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
WxCpGroupJoinWayResult addJoinWay(WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
*更新客户群进群方式配置
|
||||
* 更新客户群进群方式配置
|
||||
* 更新进群方式配置信息。注意:使用覆盖的方式更新。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param wxCpGroupJoinWayInfo
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*
|
||||
* @param wxCpGroupJoinWayInfo the wx cp group join way info
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp updateJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
WxCpBaseResp updateJoinWay(WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取客户群进群方式配置
|
||||
* 获取企业配置的群二维码或小程序按钮。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param configId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*
|
||||
* @param configId the config id
|
||||
* @return join way
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGroupJoinWayInfo getJoinWay(@NonNull String configId) throws WxErrorException;
|
||||
WxCpGroupJoinWayInfo getJoinWay(String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 删除客户群进群方式配置
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param configId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*
|
||||
* @param configId the config id
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp delJoinWay( @NonNull String configId) throws WxErrorException;
|
||||
WxCpBaseResp delJoinWay(String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 代开发应用external_userid转换
|
||||
@@ -231,10 +236,28 @@ public interface WxCpExternalContactService {
|
||||
* </pre>
|
||||
*
|
||||
* @param externalUserid 代开发自建应用获取到的外部联系人ID
|
||||
* @return 该服务商第三方应用下的企业的外部联系人ID
|
||||
* @return 该服务商第三方应用下的企业的外部联系人ID string
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String toServiceExternalUserid(@NotNull String externalUserid) throws WxErrorException;
|
||||
String toServiceExternalUserid(String externalUserid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 将代开发应用或第三方应用获取的externaluserid转换成自建应用的externaluserid
|
||||
* <pre>
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/95884#external-userid%E8%BD%AC%E6%8D%A2
|
||||
*
|
||||
* 权限说明:
|
||||
*
|
||||
* 需要使用自建应用或基础应用的access_token
|
||||
* 客户的跟进人,或者用户所在客户群的群主,需要同时在access_token和source_agentid所对应应用的可见范围内
|
||||
* </pre>
|
||||
*
|
||||
* @param externalUserid 服务商主体的external_userid,必须是source_agentid对应的应用所获取
|
||||
* @param sourceAgentId 企业授权的代开发自建应用或第三方应用的agentid
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
String fromServiceExternalUserid(String externalUserid, String sourceAgentId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 企业客户微信unionid的升级 - unionid查询external_userid
|
||||
@@ -255,12 +278,12 @@ public interface WxCpExternalContactService {
|
||||
* </pre>
|
||||
*
|
||||
* @param unionid 微信客户的unionid
|
||||
* @param openid 微信客户的openid
|
||||
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
||||
* @return 该服务商第三方应用下的企业的外部联系人ID
|
||||
* @param openid 微信客户的openid
|
||||
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
||||
* @return 该服务商第三方应用下的企业的外部联系人ID wx cp external user id list
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpExternalUserIdList unionidToExternalUserid3rd(@NotNull String unionid, @NotNull String openid, String corpid) throws WxErrorException;
|
||||
WxCpExternalUserIdList unionidToExternalUserid3rd(String unionid, String openid, String corpid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 转换external_userid
|
||||
@@ -279,7 +302,7 @@ public interface WxCpExternalContactService {
|
||||
* </pre>
|
||||
*
|
||||
* @param externalUserIdList 微信客户的unionid
|
||||
* @return List<String> 新外部联系人id
|
||||
* @return List<String> 新外部联系人id
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpNewExternalUserIdList getNewExternalUserId(String[] externalUserIdList) throws WxErrorException;
|
||||
@@ -303,7 +326,7 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpBaseResp finishExternalUserIdMigration(@NotNull String corpid) throws WxErrorException;
|
||||
WxCpBaseResp finishExternalUserIdMigration(String corpid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 客户群opengid转换
|
||||
@@ -323,11 +346,12 @@ public interface WxCpExternalContactService {
|
||||
* 仅可转换出自己企业下的客户群chat_id
|
||||
* </pre>
|
||||
*
|
||||
* @param opengid 小程序在微信获取到的群ID,参见wx.getGroupEnterInfo(https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
|
||||
* @return 客户群ID,可以用来调用获取客户群详情
|
||||
* @param opengid 小程序在微信获取到的群ID,参见wx.getGroupEnterInfo(https://developers.weixin.qq
|
||||
* .com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
|
||||
* @return 客户群ID ,可以用来调用获取客户群详情
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String opengidToChatid(@NotNull String opengid) throws WxErrorException;
|
||||
String opengidToChatid(String opengid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量获取客户详情.
|
||||
@@ -405,15 +429,15 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* 获取待分配的离职成员列表
|
||||
* 企业和第三方可通过此接口,获取所有离职成员的客户列表,并可进一步调用分配离职成员的客户接口将这些客户重新分配给其他企业成员。
|
||||
*
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_unassigned_list?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param pageId 分页查询,要查询页号,从0开始
|
||||
* @param cursor 分页查询游标,字符串类型,适用于数据量较大的情况,如果使用该参数则无需填写page_id,该参数由上一次调用返回
|
||||
* @param pageId 分页查询,要查询页号,从0开始
|
||||
* @param cursor 分页查询游标,字符串类型,适用于数据量较大的情况,如果使用该参数则无需填写page_id,该参数由上一次调用返回
|
||||
* @param pageSize 每次返回的最大记录数,默认为1000,最大值为1000
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @return wx cp user external unassign list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserExternalUnassignList listUnassignedList(Integer pageId, String cursor, Integer pageSize) throws WxErrorException;
|
||||
|
||||
@@ -463,10 +487,11 @@ public interface WxCpExternalContactService {
|
||||
* @param handOverUserid 原添加成员的userid
|
||||
* @param takeOverUserid 接替成员的userid
|
||||
* @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
|
||||
* @return 客户转接接口实体
|
||||
* @return 客户转接接口实体 wx cp user transfer result resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserTransferResultResp transferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException;
|
||||
WxCpUserTransferResultResp transferResult(String handOverUserid, String takeOverUserid,
|
||||
String cursor) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 企业可通过此接口,分配离职成员的客户给其他成员。
|
||||
@@ -503,10 +528,11 @@ public interface WxCpExternalContactService {
|
||||
* @param handOverUserid 原添加成员的userid
|
||||
* @param takeOverUserid 接替成员的userid
|
||||
* @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
|
||||
* @return 客户转接接口实体
|
||||
* @return 客户转接接口实体 wx cp user transfer result resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserTransferResultResp resignedTransferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException;
|
||||
WxCpUserTransferResultResp resignedTransferResult(String handOverUserid, String takeOverUserid,
|
||||
String cursor) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -526,7 +552,8 @@ public interface WxCpExternalContactService {
|
||||
* @deprecated 请使用 {@link WxCpExternalContactService#listGroupChat(Integer, String, int, String[])}
|
||||
*/
|
||||
@Deprecated
|
||||
WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds, String[] partyIds) throws WxErrorException;
|
||||
WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds,
|
||||
String[] partyIds) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -553,7 +580,8 @@ public interface WxCpExternalContactService {
|
||||
* 微信文档:https://work.weixin.qq.com/api/doc/90000/90135/92122
|
||||
* </pre>
|
||||
*
|
||||
* @param chatId the chat id
|
||||
* @param chatId the chat id
|
||||
* @param needName the need name
|
||||
* @return group chat
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -580,11 +608,30 @@ public interface WxCpExternalContactService {
|
||||
*
|
||||
* @param chatIds 需要转群主的客户群ID列表。取值范围: 1 ~ 100
|
||||
* @param newOwner 新群主ID
|
||||
* @return 分配结果,主要是分配失败的群列表
|
||||
* @return 分配结果 ,主要是分配失败的群列表
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 企业可通过此接口,将在职成员为群主的群,分配给另一个客服成员。
|
||||
* <per>
|
||||
* 注意:
|
||||
* 继承给的新群主,必须是配置了客户联系功能的成员
|
||||
* 继承给的新群主,必须有设置实名
|
||||
* 继承给的新群主,必须有激活企业微信
|
||||
* 同一个人的群,限制每天最多分配300个给新群主
|
||||
* 为保障客户服务体验,90个自然日内,在职成员的每个客户群仅可被转接2次。
|
||||
* </pre>
|
||||
*
|
||||
* @param chatIds 需要转群主的客户群ID列表。取值范围: 1 ~ 100
|
||||
* @param newOwner 新群主ID
|
||||
* @return 分配结果 ,主要是分配失败的群列表
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserExternalGroupChatTransferResp onjobTransferGroupChat(String[] chatIds, String newOwner) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业可通过此接口获取成员联系客户的数据,包括发起申请数、新增客户数、聊天数、发送消息数和删除/拉黑成员的客户数等指标。
|
||||
@@ -600,7 +647,8 @@ public interface WxCpExternalContactService {
|
||||
* @return user behavior statistic
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserExternalUserBehaviorStatistic getUserBehaviorStatistic(Date startTime, Date endTime, String[] userIds, String[] partyIds) throws WxErrorException;
|
||||
WxCpUserExternalUserBehaviorStatistic getUserBehaviorStatistic(Date startTime, Date endTime, String[] userIds,
|
||||
String[] partyIds) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -619,7 +667,9 @@ public interface WxCpExternalContactService {
|
||||
* @return group chat statistic
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpUserExternalGroupChatStatistic getGroupChatStatistic(Date startTime, Integer orderBy, Integer orderAsc, Integer pageIndex, Integer pageSize, String[] userIds, String[] partyIds) throws WxErrorException;
|
||||
WxCpUserExternalGroupChatStatistic getGroupChatStatistic(Date startTime, Integer orderBy, Integer orderAsc,
|
||||
Integer pageIndex, Integer pageSize, String[] userIds,
|
||||
String[] partyIds) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 添加企业群发消息任务
|
||||
@@ -631,7 +681,7 @@ public interface WxCpExternalContactService {
|
||||
* <p>
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_msg_template?access_token=ACCESS_TOKEN
|
||||
* <p>
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/92135
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">文档地址</a>
|
||||
*
|
||||
* @param wxCpMsgTemplate the wx cp msg template
|
||||
* @return the wx cp msg template add result
|
||||
@@ -650,7 +700,7 @@ public interface WxCpExternalContactService {
|
||||
*
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/send_welcome_msg?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/92137
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92137">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param msg .
|
||||
@@ -725,7 +775,7 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 企业可通过此接口为指定成员的客户添加上由企业统一配置的标签。
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/92117
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92117">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param userid the userid
|
||||
@@ -739,10 +789,11 @@ public interface WxCpExternalContactService {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业和第三方应用可通过该接口创建客户朋友圈的发表任务。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/95094
|
||||
* 企业和第三方应用可通过该接口创建客户朋友圈的发表任务。
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/95094">文档地址</a>
|
||||
* </pre>
|
||||
* @param task
|
||||
*
|
||||
* @param task the task
|
||||
* @return wx cp add moment result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -751,41 +802,44 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 由于发表任务的创建是异步执行的,应用需要再调用该接口以获取创建的结果。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/95094
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/95094">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param jobId 异步任务id,最大长度为64字节,由创建发表内容到客户朋友圈任务接口获取
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @return moment task result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentTaskResult getMomentTaskResult(String jobId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户朋友圈全部的发表记录 获取企业全部的发表列表
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/93333
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/93333">文档地址</a>
|
||||
* </pre>
|
||||
* @param startTime 朋友圈记录开始时间。Unix时间戳
|
||||
* @param endTime 朋友圈记录结束时间。Unix时间戳
|
||||
* @param creator 朋友圈创建人的userid
|
||||
*
|
||||
* @param startTime 朋友圈记录开始时间。Unix时间戳
|
||||
* @param endTime 朋友圈记录结束时间。Unix时间戳
|
||||
* @param creator 朋友圈创建人的userid
|
||||
* @param filterType 朋友圈类型。0:企业发表 1:个人发表 2:所有,包括个人创建以及企业创建,默认情况下为所有类型
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值100,超过最大值时取默认值
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值100,超过最大值时取默认值
|
||||
* @return moment list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentList getMomentList(Long startTime, Long endTime, String creator, Integer filterType,
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户朋友圈全部的发表记录 获取客户朋友圈企业发表的列表
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/93333
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/93333">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param momentId 朋友圈id,仅支持企业发表的朋友圈id
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @return moment task
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentTask getMomentTask(String momentId, String cursor, Integer limit)
|
||||
throws WxErrorException;
|
||||
@@ -793,45 +847,48 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户朋友圈全部的发表记录 获取客户朋友圈发表时选择的可见范围
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/93333
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/93333">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param momentId 朋友圈id
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的
|
||||
* 列表获取已发表成员userid,如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的
|
||||
* 列表获取已发表成员userid,如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @return moment customer list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentCustomerList getMomentCustomerList(String momentId, String userId,
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户朋友圈全部的发表记录 获取客户朋友圈发表后的可见客户列表
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/93333
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/93333">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param momentId 朋友圈id
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的列表获取已发表成员userid,
|
||||
* 如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值5000,默认值3000,超过最大值时取默认值
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的列表获取已发表成员userid,
|
||||
* 如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值5000,默认值3000,超过最大值时取默认值
|
||||
* @return moment send result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentSendResult getMomentSendResult(String momentId, String userId,
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
String cursor, Integer limit) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户朋友圈全部的发表记录 获取客户朋友圈的互动数据
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/93333
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/93333">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param momentId 朋友圈id
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的列表获取已发表成员userid,
|
||||
* 如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @param userId 企业发表成员userid,如果是企业创建的朋友圈,可以通过获取客户朋友圈企业发表的列表获取已发表成员userid,
|
||||
* 如果是个人创建的朋友圈,创建人userid就是企业发表成员userid
|
||||
* @return moment comments
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGetMomentComments getMomentComments(String momentId, String userId)
|
||||
throws WxErrorException;
|
||||
@@ -839,31 +896,32 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 企业和第三方应用可通过此接口获取企业与成员的群发记录。
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/93338
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/93338">文档地址</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param chatType 群发任务的类型,默认为single,表示发送给客户,group表示发送给客户群
|
||||
* @param startTime 群发任务记录开始时间
|
||||
* @param endTime 群发任务记录结束时间
|
||||
* @param creator 群发任务创建人企业账号id
|
||||
* @param filterType 创建人类型。0:企业发表 1:个人发表 2:所有,包括个人创建以及企业创建,默认情况下为所有类型
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param chatType 群发任务的类型,默认为single,表示发送给客户,group表示发送给客户群
|
||||
* @param startTime 群发任务记录开始时间
|
||||
* @param endTime 群发任务记录结束时间
|
||||
* @param creator 群发任务创建人企业账号id
|
||||
* @param filterType 创建人类型。0:企业发表 1:个人发表 2:所有,包括个人创建以及企业创建,默认情况下为所有类型
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGroupMsgListResult getGroupMsgListV2(String chatType, @NonNull Date startTime, @NonNull Date endTime, String creator, Integer filterType, Integer limit, String cursor) throws WxErrorException;
|
||||
WxCpGroupMsgListResult getGroupMsgListV2(String chatType, Date startTime, Date endTime,
|
||||
String creator, Integer filterType, Integer limit, String cursor) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业和第三方应用可通过此接口获取企业与成员的群发记录。
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/93338#获取企业群发成员执行结果
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/93338#获取企业群发成员执行结果">获取企业群发成员执行结果</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param msgid 群发消息的id,通过获取群发记录列表接口返回
|
||||
* @param userid 发送成员userid,通过获取群发成员发送任务列表接口返回
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param msgid 群发消息的id,通过获取群发记录列表接口返回
|
||||
* @param userid 发送成员userid,通过获取群发成员发送任务列表接口返回
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -872,7 +930,7 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 企业跟第三方应用可通过该接口获取到创建企业群发的群发发送结果。
|
||||
* https://work.weixin.qq.com/api/doc/16251
|
||||
* <a href="https://work.weixin.qq.com/api/doc/16251">文档</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param msgid 群发消息的id,通过创建企业群发接口返回
|
||||
@@ -881,30 +939,30 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
public WxCpGroupMsgResult getGroupMsgResult(String msgid, Integer limit, String cursor) throws WxErrorException;
|
||||
WxCpGroupMsgResult getGroupMsgResult(String msgid, Integer limit, String cursor) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取群发成员发送任务列表。
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/93338#获取群发成员发送任务列表
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/93338#获取群发成员发送任务列表">获取群发成员发送任务列表</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param msgid 群发消息的id,通过获取群发记录列表接口返回
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param msgid 群发消息的id,通过获取群发记录列表接口返回
|
||||
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGroupMsgTaskResult getGroupMsgTask(String msgid, Integer limit, String cursor) throws WxErrorException;
|
||||
WxCpGroupMsgTaskResult getGroupMsgTask(String msgid, Integer limit, String cursor) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 添加入群欢迎语素材。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/92366#添加入群欢迎语素材
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/92366#添加入群欢迎语素材">添加入群欢迎语素材</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param template 素材内容
|
||||
* @return template_id 欢迎语素材id
|
||||
* @param template 素材内容
|
||||
* @return template_id 欢迎语素材id
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
String addGroupWelcomeTemplate(WxCpGroupWelcomeTemplateResult template) throws WxErrorException;
|
||||
@@ -912,10 +970,10 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 编辑入群欢迎语素材。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/92366#编辑入群欢迎语素材
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/92366#编辑入群欢迎语素材">编辑入群欢迎语素材</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param template
|
||||
* @param template the template
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -924,37 +982,37 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 获取入群欢迎语素材。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/92366#获取入群欢迎语素材
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/92366#获取入群欢迎语素材">获取入群欢迎语素材</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param templateId 群欢迎语的素材id
|
||||
* @param templateId 群欢迎语的素材id
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpGroupWelcomeTemplateResult getGroupWelcomeTemplate(@NotNull String templateId) throws WxErrorException;
|
||||
WxCpGroupWelcomeTemplateResult getGroupWelcomeTemplate(String templateId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除入群欢迎语素材。
|
||||
* 企业可通过此API删除入群欢迎语素材,且仅能删除调用方自己创建的入群欢迎语素材。
|
||||
* https://open.work.weixin.qq.com/api/doc/90000/90135/92366#删除入群欢迎语素材
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90000/90135/92366#删除入群欢迎语素材">删除入群欢迎语素材</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param templateId 群欢迎语的素材id
|
||||
* @param templateId 授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数
|
||||
* @param templateId 群欢迎语的素材id
|
||||
* @param agentId the agent id
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp delGroupWelcomeTemplate(@NotNull String templateId, String agentId) throws WxErrorException;
|
||||
WxCpBaseResp delGroupWelcomeTemplate(String templateId, String agentId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取商品图册
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册列表
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册列表">获取商品图册列表</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
||||
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -963,10 +1021,10 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 获取商品图册
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册
|
||||
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册">获取商品图册</a>
|
||||
* </pre>
|
||||
*
|
||||
* @param productId 商品id
|
||||
* @param productId 商品id
|
||||
* @return wx cp base resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
@@ -975,29 +1033,31 @@ public interface WxCpExternalContactService {
|
||||
/**
|
||||
* <pre>
|
||||
* 上传附件资源
|
||||
* https://open.work.weixin.qq.com/api/doc/90001/90143/95178
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90001/90143/95178">...</a>
|
||||
* </pre>
|
||||
* @param mediaType
|
||||
* @param fileType
|
||||
* @param attachmentType
|
||||
* @param inputStream
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @throws IOException
|
||||
*
|
||||
* @param mediaType the media type
|
||||
* @param fileType the file type
|
||||
* @param attachmentType the attachment type
|
||||
* @param inputStream the input stream
|
||||
* @return wx media upload result
|
||||
* @throws WxErrorException the wx error exception
|
||||
* @throws IOException the io exception
|
||||
*/
|
||||
WxMediaUploadResult uploadAttachment(String mediaType, String fileType, Integer attachmentType,
|
||||
InputStream inputStream) throws WxErrorException, IOException;
|
||||
InputStream inputStream) throws WxErrorException, IOException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 上传附件资源
|
||||
* https://open.work.weixin.qq.com/api/doc/90001/90143/95178
|
||||
* <a href="https://open.work.weixin.qq.com/api/doc/90001/90143/95178">...</a>
|
||||
* </pre>
|
||||
* @param mediaType
|
||||
* @param attachmentType
|
||||
* @param file
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*
|
||||
* @param mediaType the media type
|
||||
* @param attachmentType the attachment type
|
||||
* @param file the file
|
||||
* @return wx media upload result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxMediaUploadResult uploadAttachment(String mediaType, Integer attachmentType, File file)
|
||||
throws WxErrorException;
|
||||
@@ -1009,8 +1069,12 @@ public interface WxCpExternalContactService {
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_intercept_rule?access_token=ACCESS_TOKEN
|
||||
* <pre>
|
||||
* @param ruleAddRequest the rule add request
|
||||
* @return 规则id
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpInterceptRuleResultResp addInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||
String addInterceptRule(WxCpInterceptRuleAddRequest ruleAddRequest) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 修改敏感词规则
|
||||
@@ -1018,30 +1082,35 @@ public interface WxCpExternalContactService {
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_intercept_rule?access_token=ACCESS_TOKEN
|
||||
* <pre>
|
||||
* @param interceptRule the rule
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpInterceptRuleResultResp updateInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||
void updateInterceptRule(WxCpInterceptRule interceptRule) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除敏感词规则
|
||||
* 企业和第三方应用可以通过此接口修改敏感词规则
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_intercept_rule?access_token=ACCESS_TOKEN
|
||||
* <a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_intercept_rule?access_token=ACCESS_TOKEN">请求地址</a>
|
||||
* <pre>
|
||||
* @param rule_id 规则id
|
||||
* @param ruleId 规则id
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException;
|
||||
void delInterceptRule(String ruleId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 创建商品图册
|
||||
* 企业和第三方应用可以通过此接口增加商品
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%9B%E5%BB%BA%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E5%88%9B%E5%BB%BA%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* 请求地址:
|
||||
* <a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* <a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%9B%E5%BB%BA%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">文档地址</a>
|
||||
* <pre>
|
||||
* @param wxCpProductAlbumInfo 商品图册信息
|
||||
* @return 商品id
|
||||
* @return 商品id string
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
String addProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException;
|
||||
|
||||
@@ -1050,10 +1119,12 @@ public interface WxCpExternalContactService {
|
||||
* 编辑商品图册
|
||||
* 企业和第三方应用可以通过此接口修改商品信息
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E7%BC%96%E8%BE%91%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E7%BC%96%E8%BE%91%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* 请求地址:
|
||||
* <a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* <a href="https://developer.work.weixin.qq.com/document/path/95096#%E7%BC%96%E8%BE%91%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">文档地址</a>
|
||||
* <pre>
|
||||
* @param wxCpProductAlbumInfo 商品图册信息
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void updateProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException;
|
||||
|
||||
@@ -1062,10 +1133,13 @@ public interface WxCpExternalContactService {
|
||||
* 删除商品图册
|
||||
* 企业和第三方应用可以通过此接口删除商品信息
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* 请求地址:
|
||||
* <a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN</a>
|
||||
*
|
||||
* <a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">文档地址</a>
|
||||
* <pre>
|
||||
* @param productId 商品id
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void deleteProductAlbum(String productId) throws WxErrorException;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user