├── .classpath
├── .mvn
└── wrapper
│ ├── MavenWrapperDownloader.java
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
├── org.eclipse.m2e.core.prefs
└── org.eclipse.wst.common.project.facet.core.xml
├── .springBeans
├── README.md
├── images
├── home.png
├── image.png
├── login.png
├── msgcontent.png
└── text.png
├── logs
├── LearningWeb.log.2020-05-15.log
├── LearningWeb.log.2020-05-16.log
├── LearningWeb.log.2020-05-18.log
├── LearningWeb.log.2020-05-19.log
├── LearningWeb.log.2020-05-20.log
├── LearningWeb.log.2020-05-21.log
├── LearningWeb.log.2020-05-22.log
└── LearningWeb.log.2020-05-25.log
├── pom.xml
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ ├── tencent
│ │ │ └── wework
│ │ │ │ ├── Finance.java
│ │ │ │ ├── WeWorkFinanceSdk.dll
│ │ │ │ ├── libWeWorkFinanceSdk_Java.so
│ │ │ │ ├── libcurl.dll
│ │ │ │ ├── libeay32.dll
│ │ │ │ ├── libprotobuf.dll
│ │ │ │ └── ssleay32.dll
│ │ │ └── vocust
│ │ │ └── qywx
│ │ │ └── demo
│ │ │ ├── WeChatApplication.java
│ │ │ ├── controller
│ │ │ ├── MsgContentController.java
│ │ │ ├── QyChatController.java
│ │ │ └── UserController.java
│ │ │ ├── dao
│ │ │ ├── entity
│ │ │ │ ├── ChatDatas.java
│ │ │ │ ├── MsgContent.java
│ │ │ │ ├── QueryParam.java
│ │ │ │ ├── Qychat.java
│ │ │ │ └── User.java
│ │ │ └── mapper
│ │ │ │ ├── MsgContentMapper.java
│ │ │ │ ├── QychatMapper.java
│ │ │ │ └── UserMapper.java
│ │ │ ├── service
│ │ │ ├── MsgContentService.java
│ │ │ ├── QychatService.java
│ │ │ ├── UserService.java
│ │ │ └── impl
│ │ │ │ ├── MsgContentServiceImpl.java
│ │ │ │ ├── QychatServiceImpl.java
│ │ │ │ ├── ScheduledTasks.java
│ │ │ │ └── UserServiceImpl.java
│ │ │ ├── strategy
│ │ │ └── MsgTypeStrategy.java
│ │ │ └── utils
│ │ │ ├── EnterperiseUtils.java
│ │ │ ├── EnterpriseParame.java
│ │ │ ├── EnumMsgType.java
│ │ │ ├── GlobalCorsConfig.java
│ │ │ ├── HttpUtils.java
│ │ │ ├── RSAUtils.java
│ │ │ └── page
│ │ │ ├── PageBean.java
│ │ │ ├── PageParam.java
│ │ │ └── PageResponse.java
│ └── resources
│ │ ├── application-dev.yml
│ │ ├── application-prod.yml
│ │ ├── application.yml
│ │ ├── logback.xml
│ │ └── mapper
│ │ ├── MsgContentMapper.xml
│ │ ├── QychatMapper.xml
│ │ └── UserMapper.xml
└── test
│ └── java
│ └── com
│ └── enterprise
│ └── demo
│ └── DemoApplicationTests.java
└── target
├── classes
├── META-INF
│ ├── MANIFEST.MF
│ └── maven
│ │ └── com.enterprise
│ │ └── qywechat
│ │ ├── pom.properties
│ │ └── pom.xml
├── application-dev.yml
├── application-prod.yml
├── application.yml
├── com
│ ├── tencent
│ │ └── wework
│ │ │ ├── Finance.class
│ │ │ ├── WeWorkFinanceSdk.dll
│ │ │ ├── libWeWorkFinanceSdk_Java.so
│ │ │ ├── libcurl.dll
│ │ │ ├── libeay32.dll
│ │ │ ├── libprotobuf.dll
│ │ │ └── ssleay32.dll
│ └── vocust
│ │ └── qywx
│ │ └── demo
│ │ ├── WeChatApplication.class
│ │ ├── controller
│ │ ├── MsgContentController.class
│ │ ├── QyChatController.class
│ │ └── UserController.class
│ │ ├── dao
│ │ ├── entity
│ │ │ ├── ChatDatas.class
│ │ │ ├── MsgContent.class
│ │ │ ├── QueryParam.class
│ │ │ ├── Qychat.class
│ │ │ └── User.class
│ │ └── mapper
│ │ │ ├── MsgContentMapper.class
│ │ │ ├── QychatMapper.class
│ │ │ └── UserMapper.class
│ │ ├── service
│ │ ├── MsgContentService.class
│ │ ├── QychatService.class
│ │ ├── UserService.class
│ │ └── impl
│ │ │ ├── MsgContentServiceImpl.class
│ │ │ ├── QychatServiceImpl.class
│ │ │ ├── ScheduledTasks.class
│ │ │ └── UserServiceImpl.class
│ │ ├── strategy
│ │ └── MsgTypeStrategy.class
│ │ └── utils
│ │ ├── EnterperiseUtils.class
│ │ ├── EnterpriseParame.class
│ │ ├── EnumMsgType.class
│ │ ├── GlobalCorsConfig.class
│ │ ├── HttpUtils.class
│ │ ├── RSAUtils.class
│ │ └── page
│ │ ├── PageBean.class
│ │ ├── PageParam.class
│ │ └── PageResponse.class
├── logback.xml
└── mapper
│ ├── MsgContentMapper.xml
│ ├── QychatMapper.xml
│ └── UserMapper.xml
├── maven-archiver
└── pom.properties
├── maven-status
└── maven-compiler-plugin
│ ├── compile
│ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── testCompile
│ └── default-testCompile
│ ├── createdFiles.lst
│ └── inputFiles.lst
├── qywechat-0.0.1-SNAPSHOT.jar
├── qywechat-0.0.1-SNAPSHOT.jar.original
└── test-classes
└── com
└── enterprise
└── demo
└── DemoApplicationTests.class
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.6";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | qywechat
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.springframework.ide.eclipse.core.springbuilder
20 |
21 |
22 |
23 |
24 | org.springframework.ide.eclipse.boot.validation.springbootbuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.m2e.core.maven2Builder
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.ide.eclipse.core.springnature
36 | org.eclipse.jdt.core.javanature
37 | org.eclipse.m2e.core.maven2Nature
38 | org.eclipse.wst.common.project.facet.core.nature
39 |
40 |
41 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding//src/test/java=UTF-8
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # QyChat
2 |
3 | ###### 最近做企业微信 会话内容存档 由于官方网站没有完整的JAVA代码 踩了很多坑 最后自己整理出来一个springboot + vue 的项目放在这里 以供大家参考
4 |
5 | 企业微信会话内容存档 前端页面展示
6 | ##### 1登录页面
7 | 
8 |
9 | ##### 2首页及开启会话内容存档权限的用户列表
10 | 
11 |
12 | ##### 3企业微信用户消息记录表
13 | 
14 |
15 | ##### 4消息列表中文本消息展示
16 | 
17 |
18 | ##### 5消息列表图片消息展示
19 | 
20 |
--------------------------------------------------------------------------------
/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/images/home.png
--------------------------------------------------------------------------------
/images/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/images/image.png
--------------------------------------------------------------------------------
/images/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/images/login.png
--------------------------------------------------------------------------------
/images/msgcontent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/images/msgcontent.png
--------------------------------------------------------------------------------
/images/text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/images/text.png
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.springframework.boot
8 | spring-boot-starter-parent
9 | 1.5.9.RELEASE
10 |
11 |
12 | com.enterprise
13 | qywechat
14 | 0.0.1-SNAPSHOT
15 | demo
16 | Demo project for Spring Boot
17 |
18 |
19 | 1.8
20 |
21 | 1.3.0
22 | 5.1.39
23 |
24 |
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter
29 |
30 |
31 |
32 | commons-io
33 | commons-io
34 | 2.6
35 |
36 |
37 | com.google.code.gson
38 | gson
39 | 2.8.6
40 |
41 |
42 | com.alibaba
43 | fastjson
44 | 1.2.7
45 |
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-starter-web
50 |
51 |
52 |
53 |
54 | mysql
55 | mysql-connector-java
56 | ${mysql-connector}
57 |
58 |
59 |
60 |
61 | org.mybatis.spring.boot
62 | mybatis-spring-boot-starter
63 | ${mybatis-spring-boot}
64 |
65 |
66 |
67 |
68 | org.projectlombok
69 | lombok
70 |
71 |
72 |
73 |
74 | ch.qos.logback
75 | logback-classic
76 |
77 |
78 |
79 |
80 | org.slf4j
81 | jcl-over-slf4j
82 |
83 |
84 |
85 |
86 |
87 | javax.persistence
88 | persistence-api
89 | 1.0
90 |
91 |
92 |
93 |
94 |
95 | org.apache.httpcomponents
96 | httpclient
97 | 4.5.12
98 |
99 |
100 | commons-collections
101 | commons-collections
102 | 3.2.2
103 |
104 |
105 | commons-codec
106 | commons-codec
107 | 1.10
108 |
109 |
110 | net.sf.json-lib
111 | json-lib
112 | 2.4
113 | jdk15
114 |
115 |
116 |
117 | org.springframework.boot
118 | spring-boot-starter-test
119 | test
120 |
121 |
122 | org.junit.vintage
123 | junit-vintage-engine
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | org.springframework.boot
133 | spring-boot-maven-plugin
134 |
135 |
136 | org.springframework.boot
137 | spring-boot-maven-plugin
138 |
139 |
140 |
141 | org.apache.maven.plugins
142 | maven-war-plugin
143 | 2.6
144 |
145 | false
146 |
147 |
148 |
149 | org.apache.maven.plugins
150 | maven-surefire-plugin
151 | 2.18.1
152 |
153 | true
154 |
155 |
156 |
157 |
158 | org.mybatis.generator
159 | mybatis-generator-maven-plugin
160 | 1.3.2
161 |
162 | true
163 | true
164 |
165 |
166 |
167 | org.apache.maven.plugins
168 | maven-compiler-plugin
169 | 3.3
170 |
171 | 1.8
172 | 1.8
173 | UTF-8
174 |
175 | ${project.basedir}/src/main/resources/lib
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/Finance.java:
--------------------------------------------------------------------------------
1 | package com.tencent.wework;
2 |
3 | /* sdk返回数据
4 | typedef struct Slice_t {
5 | char* buf;
6 | int len;
7 | } Slice_t;
8 |
9 | typedef struct MediaData {
10 | char* outindexbuf;
11 | int out_len;
12 | char* data;
13 | int data_len;
14 | int is_finish;
15 | } MediaData_t;
16 | */
17 |
18 | public class Finance {
19 | public native static long NewSdk();
20 |
21 | /**
22 | * 初始化函数
23 | * Return值=0表示该API调用成功
24 | *
25 | * @param [in] sdk NewSdk返回的sdk指针
26 | * @param [in] corpid 调用企业的企业id,例如:wwd08c8exxxx5ab44d,可以在企业微信管理端--我的企业--企业信息查看
27 | * @param [in] secret 聊天内容存档的Secret,可以在企业微信管理端--管理工具--聊天内容存档查看
28 | *
29 | *
30 | * @return 返回是否初始化成功
31 | * 0 - 成功
32 | * !=0 - 失败
33 | */
34 | public native static int Init(long sdk, String corpid, String secret);
35 |
36 | /**
37 | * 拉取聊天记录函数
38 | * Return值=0表示该API调用成功
39 | *
40 | *
41 | * @param [in] sdk NewSdk返回的sdk指针
42 | * @param [in] seq 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0
43 | * @param [in] limit 一次拉取的消息条数,最大值1000条,超过1000条会返回错误
44 | * @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
45 | * @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
46 | * @param [out] chatDatas 返回本次拉取消息的数据,slice结构体.内容包括errcode/errmsg,以及每条消息内容。
47 |
48 |
49 | *
50 | * @return 返回是否调用成功
51 | * 0 - 成功
52 | * !=0 - 失败
53 | */
54 | public native static int GetChatData(long sdk, long seq, long limit, String proxy, String passwd, long timeout, long chatData);
55 |
56 | /**
57 | * 拉取媒体消息函数
58 | * Return值=0表示该API调用成功
59 | *
60 | *
61 | * @param [in] sdk NewSdk返回的sdk指针
62 | * @param [in] sdkFileid 从GetChatData返回的聊天消息中,媒体消息包括的sdkfileid
63 | * @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
64 | * @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
65 | * @param [in] indexbuf 媒体消息分片拉取,需要填入每次拉取的索引信息。首次不需要填写,默认拉取512k,后续每次调用只需要将上次调用返回的outindexbuf填入即可。
66 | * @param [out] media_data 返回本次拉取的媒体数据.MediaData结构体.内容包括data(数据内容)/outindexbuf(下次索引)/is_finish(拉取完成标记)
67 |
68 | *
69 | * @return 返回是否调用成功
70 | * 0 - 成功
71 | * !=0 - 失败
72 | */
73 | public native static int GetMediaData(long sdk, String indexbuf, String sdkField, String proxy, String passwd, long timeout, long mediaData);
74 |
75 | /**
76 | * @brief 解析密文
77 | * @param [in] encrypt_key, getchatdata返回的encrypt_key
78 | * @param [in] encrypt_msg, getchatdata返回的content
79 | * @param [out] msg, 解密的消息明文
80 | * @return 返回是否调用成功
81 | * 0 - 成功
82 | * !=0 - 失败
83 | */
84 | public native static int DecryptData(long sdk, String encrypt_key, String encrypt_msg, long msg);
85 |
86 | public native static void DestroySdk(long sdk);
87 | public native static long NewSlice();
88 | /**
89 | * @brief 释放slice,和NewSlice成对使用
90 | * @return
91 | */
92 | public native static void FreeSlice(long slice);
93 |
94 | /**
95 | * @brief 获取slice内容
96 | * @return 内容
97 | */
98 | public native static String GetContentFromSlice(long slice);
99 |
100 | /**
101 | * @brief 获取slice内容长度
102 | * @return 内容
103 | */
104 | public native static int GetSliceLen(long slice);
105 | public native static long NewMediaData();
106 | public native static void FreeMediaData(long mediaData);
107 |
108 | /**
109 | * @brief 获取mediadata outindex
110 | * @return outindex
111 | */
112 | public native static String GetOutIndexBuf(long mediaData);
113 | /**
114 | * @brief 获取mediadata data数据
115 | * @return data
116 | */
117 | public native static byte[] GetData(long mediaData);
118 | public native static int GetIndexLen(long mediaData);
119 | public native static int GetDataLen(long mediaData);
120 |
121 | /**
122 | * @brief 判断mediadata是否结束
123 | * @return 1完成、0未完成
124 | */
125 | public native static int IsMediaDataFinish(long mediaData);
126 |
127 | static {
128 | String OS = System.getProperty("os.name").toUpperCase();
129 |
130 | if(OS.contains("WIN"))
131 | {
132 | System.out.println("OS"+OS);
133 | System.loadLibrary("WeWorkFinanceSdk");
134 | }
135 | else
136 | {
137 | System.out.println("OS"+OS);
138 | System.loadLibrary("WeWorkFinanceSdk_Java");
139 | }
140 |
141 |
142 | }
143 | }
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/WeWorkFinanceSdk.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/WeWorkFinanceSdk.dll
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/libWeWorkFinanceSdk_Java.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/libWeWorkFinanceSdk_Java.so
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/libcurl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/libcurl.dll
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/libeay32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/libeay32.dll
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/libprotobuf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/libprotobuf.dll
--------------------------------------------------------------------------------
/src/main/java/com/tencent/wework/ssleay32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/src/main/java/com/tencent/wework/ssleay32.dll
--------------------------------------------------------------------------------
/src/main/java/com/vocust/qywx/demo/WeChatApplication.java:
--------------------------------------------------------------------------------
1 | package com.vocust.qywx.demo;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import org.springframework.boot.SpringApplication;
7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
8 | import org.springframework.scheduling.annotation.EnableAsync;
9 |
10 | @EnableAsync //开启异步调用
11 | @MapperScan({"com.vocust.qywx.demo.dao.mapper"})
12 | @SpringBootApplication
13 | public class WeChatApplication
14 | {
15 | private static final Logger log = LoggerFactory.getLogger(WeChatApplication.class);
16 |
17 | public static void main(String[] args)
18 | {
19 | SpringApplication.run(WeChatApplication.class, args);
20 | log.info("servers start success!");
21 | }
22 | }
--------------------------------------------------------------------------------
/src/main/java/com/vocust/qywx/demo/controller/MsgContentController.java:
--------------------------------------------------------------------------------
1 | package com.vocust.qywx.demo.controller;
2 |
3 | import java.util.Map;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestMethod;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import com.vocust.qywx.demo.service.MsgContentService;
12 | import com.vocust.qywx.demo.utils.EnumMsgType;
13 | import com.vocust.qywx.demo.utils.page.PageBean;
14 | import com.vocust.qywx.demo.utils.page.PageParam;
15 | import com.vocust.qywx.demo.utils.page.PageResponse;
16 |
17 | import lombok.extern.slf4j.Slf4j;
18 |
19 | @Slf4j
20 | @RestController
21 | @RequestMapping("/msg")
22 | public class MsgContentController {
23 | @Autowired
24 | private MsgContentService msgContentService;
25 |
26 | @RequestMapping(value = "/findAll", method = RequestMethod.POST)
27 | public PageResponse queryAllInfos(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize) {
28 | PageResponse pageResponse = new PageResponse();
29 | PageParam page = new PageParam();
30 | page.setPageNum(pageNum);
31 | page.setNumPerPage(pageSize);
32 | PageBean pageBean = msgContentService.findAll(page);
33 | pageResponse.setTotal(pageBean.getTotalCount());
34 | pageResponse.setRes(pageBean.getRecordList());
35 | return pageResponse;
36 | }
37 |
38 | @RequestMapping(value = "/getMsgById", method = RequestMethod.POST)
39 | public Map getMsgById(@RequestParam("id") int id, @RequestParam("msgtype") String msgtype) {
40 | Map map = msgContentService.getMsgByIdAndType(id, EnumMsgType.getIndex(msgtype));
41 | return map;
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/src/main/java/com/vocust/qywx/demo/controller/QyChatController.java:
--------------------------------------------------------------------------------
1 | package com.vocust.qywx.demo.controller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import com.vocust.qywx.demo.dao.entity.Qychat;
11 | import com.vocust.qywx.demo.service.QychatService;
12 |
13 | import lombok.extern.slf4j.Slf4j;
14 |
15 | @Slf4j
16 | @RestController
17 | @RequestMapping("/web")
18 | public class QyChatController {
19 | @Autowired
20 | private QychatService qychatService;
21 |
22 | /**
23 | * @see 获取所有会话信息列表
24 | * @return
25 | */
26 | @GetMapping("/queryAllInfos")
27 | public List queryAllInfos(){
28 | return qychatService.queryAllInfos();
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/src/main/java/com/vocust/qywx/demo/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.vocust.qywx.demo.controller;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RequestMethod;
12 | import org.springframework.web.bind.annotation.RequestParam;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import com.alibaba.fastjson.JSONObject;
16 | import com.vocust.qywx.demo.dao.entity.User;
17 | import com.vocust.qywx.demo.service.UserService;
18 | import com.vocust.qywx.demo.utils.EnterperiseUtils;
19 | import com.vocust.qywx.demo.utils.EnterpriseParame;
20 | import com.vocust.qywx.demo.utils.HttpUtils;
21 | import com.vocust.qywx.demo.utils.page.PageResponse;
22 |
23 | import lombok.extern.slf4j.Slf4j;
24 |
25 | @Slf4j
26 | @RestController
27 | @RequestMapping("/login")
28 | public class UserController {
29 | @Autowired
30 | private UserService userService;
31 |
32 | @GetMapping("/queryAllUsers")
33 | public List queryAllUsers() {
34 | return userService.queryAllUsers();
35 | }
36 |
37 | @RequestMapping(value = "/userLogin", method = RequestMethod.POST)
38 | public Map userLogin(@RequestParam("account") String account,@RequestParam("password") String password) {
39 | Map map = new HashMap<>();
40 | if("admin".equals(account)&&"admin".equals(password))
41 | {
42 |
43 | User user = new User();
44 | user.setUsername("admin");
45 | user.setPassword("admin");
46 | user.setAge(18);
47 | map.put("loginUser", user);
48 | map.put("result", "yes");
49 | }else
50 | {
51 | map.put("result", "no");
52 | }
53 |
54 | return map;
55 | }
56 |
57 | /**
58 | * 获取会话内容存档开启成员列表 企业可通过此接口,获取企业开启会话内容存档的成员列表
59 | *
60 | * 请求方式:GET(HTTPS)
61 | * 请求地址:https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_permit_user_list?access_token=ACCESS_TOKEN
62 | *
63 | * @param account
64 | * @param password
65 | * @return
66 | * @throws Exception
67 | */
68 |
69 | @RequestMapping(value = "/getAllowUsers", method = RequestMethod.POST)
70 | public PageResponse getAllowUsers() throws Exception {
71 | PageResponse pageResponse = new PageResponse();
72 | List> idLst =getIdList();
73 | List result = new ArrayList();
74 | int i=0;
75 | for (Object obj : idLst) {
76 | User user =new User();
77 | user.setUsername(userService.getUsernameByUserid(obj.toString()));
78 | user.setId(i);
79 | result.add(user);
80 | i++;
81 | }
82 | pageResponse.setTotal(result.size());
83 | pageResponse.setRes(result);
84 | return pageResponse;
85 | }
86 |
87 | private List