├── .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 | ![image](https://github.com/hufeiyaya/QyChat/blob/master/images/login.png) 8 | 9 | ##### 2首页及开启会话内容存档权限的用户列表 10 | ![image](https://github.com/hufeiyaya/QyChat/blob/master/images/home.png) 11 | 12 | ##### 3企业微信用户消息记录表 13 | ![image](https://github.com/hufeiyaya/QyChat/blob/master/images/msgcontent.png) 14 | 15 | ##### 4消息列表中文本消息展示 16 | ![image](https://github.com/hufeiyaya/QyChat/blob/master/images/text.png) 17 | 18 | ##### 5消息列表图片消息展示 19 | ![image](https://github.com/hufeiyaya/QyChat/blob/master/images/image.png) 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 getIdList() throws Exception { 88 | String accessToken = EnterperiseUtils.getAccessToken(EnterpriseParame.CORPID, EnterpriseParame.SECRET); 89 | Map param = new HashMap(); 90 | param.put("access_token", accessToken); 91 | String datas = HttpUtils.get("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_permit_user_list", param); 92 | JSONObject result = JSONObject.parseObject(datas); 93 | List list = result.getJSONArray("ids"); 94 | return list; 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/entity/ChatDatas.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import lombok.Data; 7 | 8 | /** 9 | * @author hf 10 | * @version 1.0 11 | * @date 2020年5月15日 下午4:27:43 12 | * @desc 13 | */ 14 | @Data 15 | public class ChatDatas implements Serializable { 16 | 17 | private static final long serialVersionUID = 1700586620843625231L; 18 | private String errcode; 19 | private String errmsg; 20 | private List chatdata; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/entity/MsgContent.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.entity; 2 | 3 | import javax.persistence.Table; 4 | 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | * @author hf 11 | * @version 1.0 12 | * @date 2020年5月16日 上午11:24:31 13 | * @desc 14 | */ 15 | 16 | @Data 17 | @NoArgsConstructor 18 | @Accessors(chain = true) 19 | @Table(name = "tbl_msgcontent") 20 | public class MsgContent { 21 | private long id; 22 | private String msgid;// 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。String类型 23 | private String action;// 消息动作,目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型。String类型 24 | private String from;// 消息发送方id。同一企业内容为userid,非相同企业为external_userid。消息如果是机器人发出,也为external_userid。String类型 25 | private String fromView; 26 | private String tolist;// 消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid。数组,内容为string类型 27 | private String tolistView; 28 | private String roomid;// 群聊消息的群id。如果是单聊则为空。String类型 29 | private String roomidView; 30 | private String msgtime;// 消息发送时间戳,utc时间,ms单位。 31 | private String msgtype;// 文本消息为:text/image/file... 32 | private String text;// 消息内容。String类型 33 | private String image;// 消息内容。String类型 34 | private String weapp;// 消息内容。String类型 35 | private String redpacket;// 消息内容。String类型 36 | private String file;// 消息内容。String类型 37 | private String video;// 消息内容。String类型 38 | private String voice;// 消息内容。String类型 39 | private String chatrecord;// 消息内容。String类型 40 | private String filename;//文件名称 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/entity/QueryParam.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author hf 7 | * @version 1.0 8 | * @date 2020年5月15日 下午8:23:10 9 | * @desc 10 | */ 11 | 12 | @Data 13 | public class QueryParam { 14 | private String searchType; 15 | 16 | private int limit; 17 | 18 | private String proxy; 19 | 20 | private String password; 21 | 22 | private long timeout; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/entity/Qychat.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import lombok.Data; 6 | 7 | /** 8 | *@author hf 9 | *@version 1.0 10 | *@date 2020年5月15日 下午4:27:43 11 | *@desc 12 | */ 13 | 14 | @Data 15 | public class Qychat implements Serializable{ 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | private String seq; 20 | 21 | private String msgid; 22 | 23 | private String publickey_ver; 24 | 25 | /**加密RSA秘钥*/ 26 | private String encrypt_random_key; 27 | 28 | /**加密消息*/ 29 | private String encrypt_chat_msg; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *@author hf 7 | *@version 1.0 8 | *@date 2020年5月15日 下午7:20:49 9 | *@desc 10 | */ 11 | 12 | @Data 13 | public class User { 14 | private long id; 15 | private String username; 16 | private String password; 17 | private String sex; 18 | private Integer age; 19 | private Integer classNo; 20 | private String loginTime; 21 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/mapper/MsgContentMapper.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.vocust.qywx.demo.dao.entity.MsgContent; 7 | import com.vocust.qywx.demo.utils.page.PageParam; 8 | 9 | /** 10 | * @author hf 11 | * @version 1.0 12 | * @date 2020年5月15日 下午7:20:17 13 | * @desc 14 | */ 15 | 16 | public interface MsgContentMapper { 17 | 18 | List findAll(PageParam page); 19 | 20 | int counts(); 21 | 22 | void insertMsgContent(MsgContent msgContent); 23 | 24 | void clearDatas(); 25 | 26 | String getMsgByIdAndType(Map map); 27 | 28 | void updateFileName(Map map); 29 | 30 | String getFileById(int id); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/mapper/QychatMapper.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.vocust.qywx.demo.dao.entity.Qychat; 6 | 7 | /** 8 | * @author hf 9 | * @version 1.0 10 | * @date 2020年5月15日 下午7:20:17 11 | * @desc 12 | */ 13 | 14 | public interface QychatMapper { 15 | 16 | List queryAllInfos(); 17 | 18 | void insertQychat(Qychat quchat); 19 | 20 | void clearDatas(); 21 | 22 | Integer getSeq(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/dao/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.dao.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.vocust.qywx.demo.dao.entity.User; 6 | 7 | /** 8 | *@author hf 9 | *@version 1.0 10 | *@date 2020年5月15日 下午7:20:17 11 | *@desc 12 | */ 13 | 14 | public interface UserMapper { 15 | 16 | public List queryAllUsers(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/MsgContentService.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service; 2 | 3 | import java.util.Map; 4 | 5 | import com.vocust.qywx.demo.utils.page.PageBean; 6 | import com.vocust.qywx.demo.utils.page.PageParam; 7 | 8 | /** 9 | *@author hf 10 | *@version 1.0 11 | *@date 2020年5月15日 下午7:22:12 12 | *@desc 13 | */ 14 | 15 | public interface MsgContentService { 16 | 17 | PageBean findAll(PageParam page); 18 | 19 | Map getMsgByIdAndType(int id, String msgtype); 20 | 21 | /** 22 | * 获取外部成员详细信息 23 | * @param extendsUserid 24 | * @throws Exception 25 | */ 26 | String getOuterCustomerDetails(String extendsUserid); 27 | 28 | /** 29 | * 获取内部成员详细信息 30 | * @param extendsUserid 31 | * @throws Exception 32 | */ 33 | String getInnerCustomerDetails(String extendsUserid); 34 | 35 | String getGroupchatInfoByRoomid(String roomid); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/QychatService.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service; 2 | 3 | import java.util.List; 4 | 5 | import com.vocust.qywx.demo.dao.entity.Qychat; 6 | 7 | /** 8 | *@author hf 9 | *@version 1.0 10 | *@date 2020年5月15日 下午7:22:12 11 | *@desc 12 | */ 13 | 14 | public interface QychatService { 15 | 16 | List queryAllInfos(); 17 | 18 | void initQychatData(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service; 2 | 3 | import java.util.List; 4 | 5 | import com.vocust.qywx.demo.dao.entity.User; 6 | 7 | /** 8 | *@author hf 9 | *@version 1.0 10 | *@date 2020年5月15日 下午7:22:12 11 | *@desc 12 | */ 13 | 14 | public interface UserService { 15 | 16 | List queryAllUsers(); 17 | 18 | String getUsernameByUserid(String userId); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/impl/MsgContentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.google.gson.Gson; 12 | import com.google.gson.JsonObject; 13 | import com.vocust.qywx.demo.dao.entity.MsgContent; 14 | import com.vocust.qywx.demo.dao.mapper.MsgContentMapper; 15 | import com.vocust.qywx.demo.service.MsgContentService; 16 | import com.vocust.qywx.demo.utils.EnterperiseUtils; 17 | import com.vocust.qywx.demo.utils.EnterpriseParame; 18 | import com.vocust.qywx.demo.utils.EnumMsgType; 19 | import com.vocust.qywx.demo.utils.HttpUtils; 20 | import com.vocust.qywx.demo.utils.page.PageBean; 21 | import com.vocust.qywx.demo.utils.page.PageParam; 22 | 23 | import lombok.extern.slf4j.Slf4j; 24 | 25 | @Slf4j 26 | @Service 27 | public class MsgContentServiceImpl implements MsgContentService { 28 | 29 | @Autowired 30 | private MsgContentMapper msgContentMapper; 31 | 32 | @Value("${filepath}") 33 | private String filepath; 34 | 35 | private static final Gson gson =new Gson(); 36 | 37 | @Override 38 | public PageBean findAll(PageParam page) { 39 | 40 | PageBean pageBean = null; 41 | try { 42 | Map map = new HashMap(); 43 | map.put("page", page); 44 | List msgList = msgContentMapper.findAll(page); 45 | for (MsgContent msgContent : msgList) { 46 | msgContent.setMsgtype(EnumMsgType.getName(msgContent.getMsgtype())); 47 | 48 | } 49 | pageBean = new PageBean(page.getPageNum(), page.getNumPerPage(), page.getCount(), msgList); 50 | pageBean.setTotalCount(msgContentMapper.counts()); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | } 54 | return pageBean; 55 | 56 | } 57 | 58 | @Override 59 | public Map getMsgByIdAndType(int id, String msgtype) { 60 | Map map = new HashMap(); 61 | map.put("id", id); 62 | map.put("msgtype", msgtype); 63 | String fileName = msgContentMapper.getFileById(id); 64 | String content = msgContentMapper.getMsgByIdAndType(map); 65 | log.info("get msg------> " + content); 66 | JsonObject jsonObject = gson.fromJson(content, JsonObject.class); 67 | Map data = new HashMap(); 68 | if ("text".equals(msgtype)) { 69 | data.put("result", jsonObject.get("content").getAsString()); 70 | } else if ("image".equals(msgtype) || "voice".equals(msgtype) || "video".equals(msgtype)) { 71 | data.put("result", jsonObject.toString()); 72 | data.put("filename", fileName); 73 | } else { 74 | data.put("result", jsonObject.toString()); 75 | } 76 | 77 | return data; 78 | } 79 | 80 | @Override 81 | public String getOuterCustomerDetails(String externalUserid) { 82 | String accessToken = EnterperiseUtils.getAccessToken(EnterpriseParame.CORPID, EnterpriseParame.CUSTOMER_SECRET); 83 | Map param = new HashMap(); 84 | param.put("access_token", accessToken); 85 | param.put("external_userid", externalUserid); 86 | String data = null; 87 | try { 88 | data = HttpUtils.get("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get", param); 89 | } catch (Exception e) { 90 | log.error("获取外部客户信息失败:"+e); 91 | } 92 | 93 | return data; 94 | 95 | } 96 | 97 | @Override 98 | public String getInnerCustomerDetails(String userid) { 99 | String data = null; 100 | String accessToken = EnterperiseUtils.getAccessToken(EnterpriseParame.CORPID, EnterpriseParame.CUSTOMER_SECRET); 101 | Map param = new HashMap(); 102 | param.put("access_token", accessToken); 103 | param.put("userid", userid); 104 | try { 105 | data = HttpUtils.get("https://qyapi.weixin.qq.com/cgi-bin/user/get", param); 106 | } catch (Exception e) { 107 | log.error("获取内部用户信息失败:"+e); 108 | } 109 | return data; 110 | } 111 | 112 | @Override 113 | public String getGroupchatInfoByRoomid(String roomid) { 114 | String accessToken = EnterperiseUtils.getAccessToken(EnterpriseParame.CORPID, EnterpriseParame.CUSTOMER_SECRET); 115 | Map param = new HashMap(); 116 | param.put("chat_id", roomid); 117 | System.out.println(new Gson().toJson(param)); 118 | String result = null; 119 | try { 120 | result = HttpUtils.post("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token="+accessToken,new Gson().toJson(param)); 121 | } catch (Exception e) { 122 | log.error("获取客户群信息失败:"+e); 123 | } 124 | log.info(result); 125 | return result; 126 | } 127 | 128 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/impl/QychatServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service.impl; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.google.gson.Gson; 6 | import com.google.gson.JsonArray; 7 | import com.google.gson.JsonElement; 8 | import com.google.gson.JsonObject; 9 | import com.tencent.wework.Finance; 10 | import com.vocust.qywx.demo.dao.entity.ChatDatas; 11 | import com.vocust.qywx.demo.dao.entity.MsgContent; 12 | import com.vocust.qywx.demo.dao.entity.QueryParam; 13 | import com.vocust.qywx.demo.dao.entity.Qychat; 14 | import com.vocust.qywx.demo.dao.mapper.MsgContentMapper; 15 | import com.vocust.qywx.demo.dao.mapper.QychatMapper; 16 | import com.vocust.qywx.demo.service.MsgContentService; 17 | import com.vocust.qywx.demo.service.QychatService; 18 | import com.vocust.qywx.demo.service.UserService; 19 | import com.vocust.qywx.demo.utils.EnterpriseParame; 20 | import com.vocust.qywx.demo.utils.RSAUtils; 21 | import lombok.extern.slf4j.Slf4j; 22 | import org.springframework.beans.factory.annotation.Autowired; 23 | import org.springframework.beans.factory.annotation.Value; 24 | import org.springframework.scheduling.annotation.Async; 25 | import org.springframework.scheduling.annotation.EnableScheduling; 26 | import org.springframework.scheduling.annotation.Scheduled; 27 | import org.springframework.stereotype.Component; 28 | import org.springframework.stereotype.Service; 29 | import org.springframework.util.StringUtils; 30 | 31 | import java.io.File; 32 | import java.io.FileOutputStream; 33 | import java.util.ArrayList; 34 | import java.util.List; 35 | 36 | @Slf4j 37 | @Component 38 | @Service 39 | @EnableScheduling 40 | public class QychatServiceImpl implements QychatService { 41 | @Autowired 42 | private QychatMapper qychatMapper; 43 | 44 | @Autowired 45 | private MsgContentMapper msgContentMapper; 46 | 47 | @Autowired 48 | private MsgContentService msgContentService; 49 | 50 | @Autowired 51 | private UserService userService; 52 | 53 | @Value("${filepath}") 54 | private String filepath; 55 | 56 | private static final Gson gson =new Gson();; 57 | 58 | @Override 59 | public List queryAllInfos() { 60 | log.info("/queryAllUsers start..."); 61 | return qychatMapper.queryAllInfos(); 62 | } 63 | 64 | /** 65 | * 每五分钟执行一次定时任务 66 | */ 67 | @Override 68 | @Scheduled(cron = "0 */5 * * * ?") 69 | public void initQychatData() { 70 | QueryParam param = new QueryParam(); 71 | Integer seq = qychatMapper.getSeq() == null ? 0 : qychatMapper.getSeq();// 从第几条开始拉取 72 | param.setLimit(100);// 一次拉取多少条消息 最大值为1000 73 | param.setTimeout(5); 74 | int ret = 0; 75 | long sdk = Finance.NewSdk(); 76 | 77 | // 初始化 78 | Finance.Init(sdk, EnterpriseParame.CORPID, EnterpriseParame.SECRET); 79 | int limit = param.getLimit(); 80 | long slice = Finance.NewSlice(); 81 | ret = Finance.GetChatData(sdk, seq, limit, param.getProxy(), param.getPassword(), param.getTimeout(), slice); 82 | if (ret != 0) { 83 | log.error("getchatdata ret " + ret); 84 | return; 85 | } 86 | // 获取消息 87 | String data = Finance.GetContentFromSlice(slice); 88 | 89 | JSONObject jsonObject = JSONObject.parseObject(data); 90 | ChatDatas cdata = JSON.toJavaObject(jsonObject, ChatDatas.class); 91 | List list = cdata.getChatdata(); 92 | for (Qychat qychat : list) { 93 | String msgs = qychat.getEncrypt_chat_msg(); 94 | String encrypt_key = null; 95 | try { 96 | encrypt_key = RSAUtils.getPrivateKey(qychat.getEncrypt_random_key()); 97 | } catch (Exception e) { 98 | e.printStackTrace(); 99 | } 100 | // 将获取到的数据进行解密操作 101 | long msg = Finance.NewSlice(); 102 | Finance.DecryptData(sdk, encrypt_key, msgs, msg); 103 | String decrypt_msg = Finance.GetContentFromSlice(msg);// 解密后的消息 104 | qychatMapper.insertQychat(qychat); 105 | JSONObject content = JSONObject.parseObject(decrypt_msg); 106 | MsgContent msgcontent = new MsgContent(); 107 | if(content.getString("action").equals("send")) 108 | { 109 | msgcontent.setMsgid(content.getString("msgid")); 110 | msgcontent.setAction(content.getString("action")); 111 | msgcontent.setFrom(content.getString("from")); 112 | msgcontent.setFromView(userService.getUsernameByUserid(content.getString("from"))); 113 | msgcontent.setTolist(content.getString("tolist")); 114 | msgcontent.setTolistView(getTolistByUserId(content.getString("tolist"))); 115 | msgcontent.setRoomid(content.getString("roomid")); 116 | msgcontent.setRoomidView(getGroupchatName(content.getString("roomid"))); 117 | msgcontent.setMsgtime(content.getString("msgtime")); 118 | msgcontent.setMsgtype(content.getString("msgtype")); 119 | msgcontent.setText(isEmpty(content.getString("text"))); 120 | msgcontent.setImage(isEmpty(content.getString("image"))); 121 | msgcontent.setWeapp(isEmpty(content.getString("weapp"))); 122 | msgcontent.setRedpacket(isEmpty(content.getString("redpacket"))); 123 | msgcontent.setFile(isEmpty(content.getString("file"))); 124 | msgcontent.setVideo(isEmpty(content.getString("video"))); 125 | msgcontent.setVoice(isEmpty(content.getString("voice"))); 126 | msgcontent.setChatrecord(isEmpty(content.getString("chatrecord"))); 127 | msgcontent.setFilename(getFileNameAndDownloadData(msgcontent)); 128 | }else if(content.getString("action").equals("switch")) 129 | { 130 | log.info("switch 消息"+content); 131 | msgcontent.setMsgid(content.getString("msgid")); 132 | msgcontent.setAction(content.getString("action")); 133 | msgcontent.setFrom(content.getString("user")); 134 | msgcontent.setMsgtime(content.getString("time")); 135 | msgcontent.setMsgtype("switch"); 136 | msgcontent.setFromView(userService.getUsernameByUserid(content.getString("user"))); 137 | }else 138 | { 139 | msgcontent.setMsgid(content.getString("msgid")); 140 | msgcontent.setAction(content.getString("action")); 141 | msgcontent.setMsgtime(content.getString("time")); 142 | msgcontent.setMsgtype("revoke"); 143 | } 144 | // 解析消息 并插入到数据库 145 | msgContentMapper.insertMsgContent(msgcontent); 146 | } 147 | Finance.FreeSlice(slice); 148 | log.info("----------------------scheduled tasks qywx data success-----------------------"); 149 | 150 | } 151 | 152 | 153 | private String getGroupchatName(String roomid) { 154 | if(StringUtils.isEmpty(roomid)) 155 | return null; 156 | String data = msgContentService.getGroupchatInfoByRoomid(roomid); 157 | JsonObject result = gson.fromJson(data, JsonObject.class); 158 | String name=null; 159 | if(result.get("errcode").getAsInt()!=0) 160 | { 161 | name = "该群不是客户群"; 162 | } 163 | else 164 | { 165 | name = result.get("group_chat").getAsJsonObject().get("name").getAsString(); 166 | } 167 | 168 | return name; 169 | } 170 | 171 | private String getTolistByUserId(String tolist) { 172 | if(StringUtils.isEmpty(tolist)) 173 | return null; 174 | List list =new ArrayList(); 175 | JsonArray result = gson.fromJson(tolist, JsonArray.class); 176 | for (JsonElement jsonElement : result) { 177 | list.add(userService.getUsernameByUserid(jsonElement.getAsString())); 178 | } 179 | return list.toString(); 180 | } 181 | 182 | 183 | 184 | private String content = null; 185 | 186 | private String isEmpty(String data) { 187 | if (StringUtils.isEmpty(data)) { 188 | return null; 189 | } else { 190 | content = data; 191 | return data; 192 | 193 | } 194 | } 195 | 196 | private String getFileNameAndDownloadData(MsgContent msgcontent) { 197 | String fileName = null; 198 | try { 199 | String fileType = msgcontent.getMsgtype(); 200 | JSONObject jsonObject = JSONObject.parseObject(content); 201 | String sdkfileid = jsonObject.getString("sdkfileid"); 202 | fileName =getFileName(jsonObject,fileType); 203 | if (!StringUtils.isEmpty(sdkfileid) && null != fileName) { 204 | downLodaFile(fileName, sdkfileid); 205 | } 206 | } catch (Exception e) { 207 | log.info("下载文件出错" + e); 208 | } 209 | return fileName; 210 | 211 | } 212 | 213 | private String getFileName(JSONObject jsonObject, String fileType) { 214 | String fileName = null; 215 | String md5sum =jsonObject.getString("md5sum"); 216 | switch (fileType) { 217 | case "image": 218 | fileName = md5sum+ ".jpg"; 219 | break; 220 | case "voice": 221 | fileName = md5sum+ ".mp3"; 222 | break; 223 | case "video": 224 | fileName = md5sum+ ".mp4"; 225 | break; 226 | case "file": 227 | fileName = jsonObject.getString("filename"); 228 | break; 229 | default: 230 | fileName = "default.jpg"; 231 | break; 232 | } 233 | return fileName; 234 | } 235 | 236 | @Async 237 | public void downLodaFile(String fileName, String sdkFileid) { 238 | int ret = 0; 239 | long sdk = Finance.NewSdk(); 240 | // 初始化 241 | Finance.Init(sdk, EnterpriseParame.CORPID, EnterpriseParame.SECRET); 242 | String indexbuf = ""; 243 | while (true) { 244 | long media_data = Finance.NewMediaData(); 245 | ret = Finance.GetMediaData(sdk, indexbuf, sdkFileid, null, null, 3, media_data); 246 | if (ret != 0) { 247 | return; 248 | } 249 | System.out.printf("getmediadata outindex len:%d, data_len:%d, is_finis:%d\n", 250 | Finance.GetIndexLen(media_data), Finance.GetDataLen(media_data), 251 | Finance.IsMediaDataFinish(media_data)); 252 | try { 253 | FileOutputStream outputStream = new FileOutputStream(new File(filepath + fileName), true); 254 | outputStream.write(Finance.GetData(media_data)); 255 | outputStream.close(); 256 | } catch (Exception e) { 257 | e.printStackTrace(); 258 | } 259 | if (Finance.IsMediaDataFinish(media_data) == 1) { 260 | Finance.FreeMediaData(media_data); 261 | break; 262 | } else { 263 | indexbuf = Finance.GetOutIndexBuf(media_data); 264 | Finance.FreeMediaData(media_data); 265 | } 266 | } 267 | log.info("下载完毕"); 268 | Finance.DestroySdk(sdk); 269 | } 270 | 271 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/impl/ScheduledTasks.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.scheduling.annotation.Async; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.vocust.qywx.demo.service.QychatService; 11 | 12 | @Component 13 | @Service 14 | @EnableScheduling 15 | public class ScheduledTasks implements CommandLineRunner { 16 | 17 | 18 | 19 | @Autowired 20 | private QychatService qychatService; 21 | 22 | @Async 23 | @Override 24 | public void run(String... args) throws Exception { 25 | qychatService.initQychatData(); 26 | } 27 | 28 | 29 | 30 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.util.StringUtils; 8 | 9 | import com.google.gson.Gson; 10 | import com.google.gson.JsonArray; 11 | import com.google.gson.JsonObject; 12 | import com.vocust.qywx.demo.dao.entity.User; 13 | import com.vocust.qywx.demo.dao.mapper.UserMapper; 14 | import com.vocust.qywx.demo.service.MsgContentService; 15 | import com.vocust.qywx.demo.service.UserService; 16 | 17 | import lombok.extern.slf4j.Slf4j; 18 | 19 | @Slf4j 20 | @Service 21 | public class UserServiceImpl implements UserService { 22 | @Autowired 23 | private UserMapper userMapper; 24 | 25 | @Autowired 26 | private MsgContentService msgContentService; 27 | 28 | private static final Gson gson = new Gson();; 29 | 30 | @Override 31 | public List queryAllUsers() { 32 | log.info("/queryAllUsers start..."); 33 | return userMapper.queryAllUsers(); 34 | } 35 | 36 | /** 37 | * 机器人与外部联系人的账号都是external_userid,其中机器人的external_userid是以”wb”开头,例如:”wbjc7bDwAAJVylUKpSA3Z5U11tDO4AAA”,外部联系人的external_userid以”wo”或”wm”开头。 38 | * 39 | * @param userId 40 | * @return 41 | * @return 42 | */ 43 | @Override 44 | public String getUsernameByUserid(String userId) { 45 | if(StringUtils.isEmpty(userId)) 46 | return null; 47 | String userName = null; 48 | if (userId.startsWith("wb") || userId.startsWith("wo") || userId.startsWith("wm")) { // 外部联系人信息获取 49 | String data = msgContentService.getOuterCustomerDetails(userId); 50 | userName = analysisOuterCustomerData(data); 51 | } else { // 内部部联系人信息获取 52 | String data = msgContentService.getInnerCustomerDetails(userId); 53 | userName = analysisOuterCustomerData2(data); 54 | } 55 | return userName; 56 | 57 | } 58 | 59 | private String analysisOuterCustomerData2(String data) { 60 | String userName = null; 61 | JsonObject result = gson.fromJson(data, JsonObject.class); 62 | if (result.get("errcode").getAsInt() != 0) { 63 | log.info("解析异常 errcode" + result.get("errcode").getAsInt()); 64 | } else { 65 | userName = result.get("name").getAsString(); 66 | } 67 | return userName; 68 | } 69 | 70 | private String analysisOuterCustomerData(String data) { 71 | String userName = null; 72 | JsonObject result = gson.fromJson(data, JsonObject.class); 73 | if (result.get("errcode").getAsInt() != 0) { 74 | log.info("解析异常 errcode" + result.get("errcode").getAsInt()); 75 | } else { 76 | userName = result.get("external_contact").getAsJsonObject().get("name").getAsString(); 77 | } 78 | return userName; 79 | 80 | } 81 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/strategy/MsgTypeStrategy.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.strategy; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | /** 6 | *@author hf 7 | *@version 1.0 8 | *@date 2020年5月21日 下午3:08:20 9 | *@desc 10 | */ 11 | 12 | public interface MsgTypeStrategy { 13 | 14 | public void downLoadFile(String msgtype, JSONObject jsonObject); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/EnterperiseUtils.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import com.alibaba.fastjson.JSONObject; 7 | 8 | import lombok.extern.slf4j.Slf4j; 9 | 10 | /** 11 | *@author hf 12 | *@version 1.0 13 | *@date 2020年5月21日 下午8:31:25 14 | *@desc 15 | */ 16 | 17 | @Slf4j 18 | public class EnterperiseUtils { 19 | 20 | /** 21 | * 获取accessToken 22 | * @param corpid 23 | * @param corpsecret 24 | * @return 25 | * @throws Exception 26 | */ 27 | public static String getAccessToken(String corpid, String corpsecret) { 28 | Map param = new HashMap(); 29 | param.put("corpid", corpid); 30 | param.put("corpsecret", corpsecret); 31 | String accessToken = null; 32 | try { 33 | accessToken = HttpUtils.get("https://qyapi.weixin.qq.com/cgi-bin/gettoken", param); 34 | } catch (Exception e) { 35 | log.info("获取accessToken出错:"+e); 36 | } 37 | JSONObject content = JSONObject.parseObject(accessToken); 38 | return content.getString("access_token"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/EnterpriseParame.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils; 2 | 3 | /** 4 | *@author hf 5 | *@version 1.0 6 | *@date 2020年5月15日 下午7:58:38 7 | *@desc 8 | */ 9 | 10 | /** 11 | * @see 企业微信参数 请配置好相关参数后再测试 12 | * @author lenovo 13 | * 14 | */ 15 | public class EnterpriseParame { 16 | /** 17 | *@desc 企业微信CORPID 18 | */ 19 | public static final String CORPID = "企业微信CORPID"; 20 | 21 | /** 22 | *@desc 企业微信SECRET 23 | */ 24 | public static final String SECRET = "企业微信SECRET"; 25 | 26 | /** 27 | *@desc 企业微信客户信息获取SECRET 28 | */ 29 | public static final String CUSTOMER_SECRET = "企业微信CUSTOMER_SECRET"; 30 | 31 | 32 | 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/EnumMsgType.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils; 2 | 3 | 4 | /** 5 | *@author hf 6 | *@version 1.0 7 | *@date 2020年5月18日 下午4:27:09 8 | *@desc 9 | */ 10 | 11 | public enum EnumMsgType { 12 | TEXT("文本", "text"), 13 | IMAGE("图片", "image"), 14 | VOICE("语音", "voice"), 15 | VIDEO("视频", "video"), 16 | WEAPP("小程序", "weapp"), 17 | FILE("文件", "file"), 18 | CHATRECORD("会话记录消息","chatrecord"), 19 | SWITCH("切换企业日志","switch"), 20 | RECALL("撤回消息","revoke"); 21 | private String name; 22 | private String index; 23 | 24 | // 构造方法 25 | private EnumMsgType(String name, String index) { 26 | this.name = name; 27 | this.index = index; 28 | } 29 | 30 | // 普通方法 31 | public static String getName(String index) { 32 | for (EnumMsgType c : EnumMsgType.values()) { 33 | if (c.getIndex().equals(index)) { 34 | return c.name; 35 | } 36 | } 37 | return null; 38 | } 39 | 40 | // 普通方法 41 | public static String getIndex(String name) { 42 | for (EnumMsgType c : EnumMsgType.values()) { 43 | if (c.getName().equals(name)) { 44 | return c.index; 45 | } 46 | } 47 | return null; 48 | } 49 | 50 | // get set 方法 51 | public String getName() { 52 | return name; 53 | } 54 | 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | public String getIndex() { 60 | return index; 61 | } 62 | 63 | public void setIndex(String index) { 64 | this.index = index; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/GlobalCorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | 9 | import lombok.extern.slf4j.Slf4j; 10 | 11 | @Slf4j 12 | @Configuration 13 | public class GlobalCorsConfig { 14 | 15 | private CorsConfiguration addCorsConfig() { 16 | log.info("---------------------加载跨域请求------------------------------"); 17 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 18 | //请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等) 19 | corsConfiguration.addAllowedOrigin("*"); 20 | corsConfiguration.addAllowedHeader("*"); 21 | corsConfiguration.addAllowedMethod("*"); 22 | return corsConfiguration; 23 | } 24 | 25 | @Bean 26 | public CorsFilter corsFilter() { 27 | log.info("---------------------加载跨域请求------------------------------"); 28 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 29 | source.registerCorsConfiguration("/**", addCorsConfig()); 30 | return new CorsFilter(source); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/HttpUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: HttpUtils.java, 2017年9月12日 上午9:53:01 yangtao Exp $ 3 | * 4 | * Copyright (c) 2017 doublecom 5 | * All rights reserved. 6 | * 7 | * This software is copyrighted and owned by ciotc or the copyright holder 8 | * specified, unless otherwise noted, and may not be reproduced or distributed 9 | * in whole or in part in any form or medium without express written permission. 10 | */ 11 | package com.vocust.qywx.demo.utils; 12 | 13 | import java.io.IOException; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Map; 17 | import java.util.Map.Entry; 18 | 19 | import org.apache.commons.collections.MapUtils; 20 | import org.apache.http.HttpEntity; 21 | import org.apache.http.NameValuePair; 22 | import org.apache.http.client.config.RequestConfig; 23 | import org.apache.http.client.entity.UrlEncodedFormEntity; 24 | import org.apache.http.client.methods.CloseableHttpResponse; 25 | import org.apache.http.client.methods.HttpGet; 26 | import org.apache.http.client.methods.HttpPost; 27 | import org.apache.http.entity.BasicHttpEntity; 28 | import org.apache.http.impl.client.CloseableHttpClient; 29 | import org.apache.http.impl.client.HttpClients; 30 | import org.apache.http.message.BasicNameValuePair; 31 | import org.apache.http.util.EntityUtils; 32 | import org.slf4j.Logger; 33 | import org.slf4j.LoggerFactory; 34 | 35 | import com.google.gson.Gson; 36 | import com.google.gson.reflect.TypeToken; 37 | 38 | public class HttpUtils { 39 | 40 | private final static Logger logger = LoggerFactory.getLogger(HttpUtils.class); 41 | 42 | /** 43 | * http get 44 | * 45 | * @return 46 | * @throws Exception 47 | */ 48 | public static String get(String baseUrl, Map param) throws Exception { 49 | String realUrl = baseUrl; 50 | StringBuffer sb = new StringBuffer(); 51 | if (!MapUtils.isEmpty(param)) { 52 | int index = 0; 53 | for (Entry entry : param.entrySet()) { 54 | if (index != 0) { 55 | sb.append("&"); 56 | } 57 | sb.append(entry.getKey()); 58 | sb.append("="); 59 | sb.append(entry.getValue()); 60 | index++; 61 | } 62 | } 63 | if (sb.length() > 0) { 64 | realUrl = realUrl + "?" + sb.toString(); 65 | } 66 | try { 67 | HttpGet httpget = new HttpGet(realUrl); 68 | CloseableHttpClient httpclient = HttpClients.createDefault(); 69 | CloseableHttpResponse response = httpclient.execute(httpget); 70 | try { 71 | // 获取响应实体 72 | HttpEntity entity = response.getEntity(); 73 | if (entity != null) { 74 | return EntityUtils.toString(entity); 75 | } 76 | } finally { 77 | httpclient.close(); 78 | response.close(); 79 | } 80 | } catch (IOException e) { 81 | throw new Exception(e); 82 | } 83 | return null; 84 | } 85 | 86 | /** 87 | * http post 88 | * 89 | * @return 90 | */ 91 | public static String post(String baseUrl, Map param) { 92 | 93 | List formparams = new ArrayList(); 94 | for (Entry entry : param.entrySet()) { 95 | formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); 96 | } 97 | HttpPost httppost = new HttpPost(baseUrl); 98 | 99 | CloseableHttpClient httpclient = null; 100 | CloseableHttpResponse response = null; 101 | try { 102 | UrlEncodedFormEntity uefEntity = new UrlEncodedFormEntity(formparams, "UTF-8"); 103 | httppost.setEntity(uefEntity); 104 | 105 | httpclient = HttpClients.createDefault(); 106 | response = httpclient.execute(httppost); 107 | // 获取响应实体 108 | HttpEntity entity = response.getEntity(); 109 | if (entity != null) { 110 | return EntityUtils.toString(entity); 111 | } else { 112 | throw new Exception("http status=" + response.getStatusLine()); 113 | } 114 | } catch (Exception ex) { 115 | logger.warn(ex.getMessage()); 116 | return null; 117 | } finally { 118 | if (httpclient != null) 119 | try { 120 | httpclient.close(); 121 | } catch (IOException e) { 122 | 123 | } 124 | if (response != null) 125 | try { 126 | response.close(); 127 | } catch (IOException e) { 128 | 129 | } 130 | } 131 | 132 | } 133 | 134 | public static String post(String baseUrl, String body) { 135 | 136 | HttpPost httppost = new HttpPost(baseUrl); 137 | httppost.setHeader("Accept", "application/json"); 138 | httppost.setHeader("Content-Type", "application/json;charset=utf-8"); 139 | BasicHttpEntity httpEntity = new BasicHttpEntity(); 140 | CloseableHttpClient httpclient = null; 141 | CloseableHttpResponse response = null; 142 | try { 143 | httpEntity.setContent(new java.io.ByteArrayInputStream(body.getBytes("UTF-8"))); 144 | httpEntity.setContentLength(body.getBytes("UTF-8").length); 145 | httppost.setEntity(httpEntity); 146 | // http post请求 连接 传输请求时间 3秒 147 | RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000) 148 | .build(); 149 | httppost.setConfig(requestConfig); 150 | 151 | httpclient = HttpClients.createDefault(); 152 | response = httpclient.execute(httppost); 153 | // 获取响应实体 154 | HttpEntity entity = response.getEntity(); 155 | if (entity != null) { 156 | return EntityUtils.toString(entity); 157 | } else { 158 | throw new Exception("http status=" + response.getStatusLine()); 159 | } 160 | } catch (Exception ex) { 161 | logger.warn(ex.getMessage()); 162 | return null; 163 | } finally { 164 | if (httpclient != null) 165 | try { 166 | httpclient.close(); 167 | } catch (IOException e) { 168 | 169 | } 170 | if (response != null) 171 | try { 172 | response.close(); 173 | } catch (IOException e) { 174 | 175 | } 176 | } 177 | 178 | } 179 | 180 | /** 181 | * http post and return object 182 | * 183 | * @param baseUrl 184 | * @param param 185 | * @param resultClass 186 | * @return 187 | */ 188 | public static T post(String baseUrl, Map param, Class resultClass) { 189 | String result = post(baseUrl, param); 190 | return new Gson().fromJson(result, resultClass); 191 | } 192 | 193 | public static T post(String baseUrl, String body, Class resultClass) { 194 | String result = post(baseUrl, body); 195 | return new Gson().fromJson(result, resultClass); 196 | } 197 | 198 | public static List post(String baseUrl, Map param, TypeToken> typeToken) { 199 | String result = post(baseUrl, param); 200 | return new Gson().fromJson(result, typeToken.getType()); 201 | } 202 | 203 | 204 | /** 205 | * http get and return object 206 | * 207 | * @param baseUrl 208 | * @param param 209 | * @param resultClass 210 | * @return 211 | * @throws Exception 212 | */ 213 | public static List get(String baseUrl, Map param, TypeToken> typeToken) throws Exception { 214 | String result = get(baseUrl, param); 215 | return new Gson().fromJson(result, typeToken.getType()); 216 | } 217 | 218 | public static T get(String baseUrl, Map param, Class resultClass) throws Exception { 219 | String result = get(baseUrl, param); 220 | return new Gson().fromJson(result, resultClass); 221 | } 222 | 223 | 224 | 225 | } 226 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/RSAUtils.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils; 2 | 3 | import java.security.KeyFactory; 4 | import java.security.interfaces.RSAPrivateKey; 5 | import java.security.spec.PKCS8EncodedKeySpec; 6 | import java.util.Base64; 7 | 8 | import javax.crypto.Cipher; 9 | 10 | /** 11 | * Java RSA 加密工具类 参考: https://blog.csdn.net/qy20115549/article/details/83105736 12 | */ 13 | public class RSAUtils { 14 | 15 | private static final String privKeyPEM = "-----BEGIN PRIVATE KEY-----\n" 16 | + "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCc2YtXiEDCOKCw\n" 17 | + "qe/Yfx4s7UNeThtN6oxhqVd4uKLu1rqiCO7juFQDUtWX83rKZ1loz9QqovwLrnze\n" 18 | + "QAVW4LfHHVz6uw6QEknSoB1Z2M6z5kGknXmhzLEeZxc98DNzbenF4RwytUZHSQ/w\n" 19 | + "me+p/Hml8vNForOVrROxEiYDNOTxExS8GLneFC32i5nS9HNxX8Skxd6XEknQprj/\n" 20 | + "QgIJtkHefSXwBRnyxdmXuPjAJ+EeiG1yBsAWjjNxhHKKqIp4n5Z4eXVlMlUOTlS8\n" 21 | + "ZkEd+NbUzWBE/RYPxb/VCGJHZI1YG3A4aJyZvizpA+GPxDKX6WlZ4pvZk4BE13Ff\n" 22 | + "WUkY7xLdAgMBAAECggEAbknBYuEZt/edddtoHLD1hN2oWy1MobLk1t799JLPbmVq\n" 23 | + "gfkKEPFRkayzJ886bgvRoJNSOlC0LXqZrqURnA8S6l1JPbw99ywE4KdZPA3o+jJT\n" 24 | + "we5A0nZdrGUMwK6fXvDQSiWJcFZqfkFvhdyX2sz+tKNqT3KiGALFL+L0+5g7yw5n\n" 25 | + "xrnfHHBY0axTj4hIxErSqeMUYOBZMBon7iCSTPkEXdy8CQ1D9jEhedIsXwPQ/aTX\n" 26 | + "19fggN2eksMrBMA64YWj/zS2OKFsXNSZDW8Iy4VVQGUtHikUwudSfM+OshoD1X+t\n" 27 | + "yHuQ9opirHla5GTAX7paDVKHrAOCpQ30nHEIGVJ9eQKBgQDNoVIPmM2qmO8iDunF\n" 28 | + "b6s1RIKeiEZZwddxdf43OePqrM5cwKT5mnooJvqkhAbaTeLrDfD0m/+As0i0aAzT\n" 29 | + "hDYRx5jfK/GajMr3P4MQX1MVPok7NUj+iPHgGfwlsTqzqdVmPl/R0xTLVNFJL2rg\n" 30 | + "/FB53O8rE6s7flSFmy4Ggcp2YwKBgQDDRUxh58V6eiA1+Cx0USu6NBxIpYT2cadK\n" 31 | + "x2dduBT/Nxk/nUv8/nAdmNrTpRy/vkrtXxNndOxz6+ZFFdiolDalOrCJWZ69vNmE\n" 32 | + "hPEzG7LDMDwi/5pjTR5aFIV9XQovdR+LbP0P9hi2yurVzvUKhPMtYEhDv/IH/0W0\n" 33 | + "CH1/fFz1vwKBgBcr24xoYpybuS60UYFvEPLisnlcz9ijcDyX2Dqu6lDyghqPlseN\n" 34 | + "scA+jDXnrsIAztY/7uwRfBwrl8DEjNV064bbYA2d7Q7GWMS9wm4g38LgFiS232/X\n" 35 | + "TLI9G12/9+Zw99waoT+Ksqgq+Z5umnOZ2xOwYr8O61e755haoTgYfhETAoGBAJaX\n" 36 | + "pPaEdgmkkZ7NjAsQZnatpXppHAerUucarR7bzmWcqn4i4u1zlCdfMLO0TF2bddFm\n" 37 | + "V2KcC5bCwM1ascIgu5vljSv/z6poMCBBHnrZy504X8hl8zzNxrCVzvUFgctjujYe\n" 38 | + "kXNzyU9/YmgNuXCpY5kE/fYx24hLWAgl3BMrZ82lAoGAavBM8P5Clefeh5WoEZ5X\n" 39 | + "tS1NKeIWjRmk3WqgjN+I95bDi1ACPUQ2AI6KxBZiO6L/dQ2d1B3Ny/YWSBTzcnup\n" 40 | + "psH8/TCUqUIBb0UvaTA8mjpMqERxe0hQXuvds1zJUKZS7BI0hW66cbe7yS9qq3W5\n" + "komTPrVN7tra95unoojaMeM=\n" 41 | + "-----END PRIVATE KEY-----"; 42 | 43 | // 用此方法先获取秘钥 44 | public static String getPrivateKey(String str) throws Exception { 45 | 46 | String privKeyPEMnew = privKeyPEM.replaceAll("\\n", "").replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", ""); 47 | 48 | byte[] decoded = Base64.getDecoder().decode(privKeyPEMnew); 49 | RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA") 50 | .generatePrivate(new PKCS8EncodedKeySpec(decoded)); 51 | // 64位解码加密后的字符串 52 | byte[] inputByte = Base64.getDecoder().decode(str); 53 | 54 | // RSA解密 55 | Cipher cipher = Cipher.getInstance("RSA"); 56 | cipher.init(Cipher.DECRYPT_MODE, priKey); 57 | String outStr = new String(cipher.doFinal(inputByte)); 58 | return outStr; 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/page/PageBean.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils.page; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | /** 8 | * 9 | * @描述: 分页组件. 10 | * @作者: ZhangWensi,WuShuicheng . 11 | * @创建时间: 2013-7-25,下午11:33:41 . 12 | * @版本: 1.0 . 13 | */ 14 | public class PageBean implements Serializable{ 15 | /** 16 | * 17 | */ 18 | private static final long serialVersionUID = 8470697978259453214L; 19 | 20 | // 指定的或是页面参数 21 | private int currentPage; // 当前页 22 | private int numPerPage; // 每页显示多少条 23 | 24 | // 查询数据库 25 | private int totalCount; // 总记录数 26 | private List recordList; // 本页的数据列表 27 | 28 | // 计算 29 | private int pageCount; // 总页数 30 | private int beginPageIndex; // 页码列表的开始索引(包含) 31 | private int endPageIndex; // 页码列表的结束索引(包含) 32 | 33 | private Map countResultMap; // 当前分页条件下的统计结果 34 | 35 | 36 | public PageBean(){} 37 | 38 | /** 39 | * 只接受前4个必要的属性,会自动的计算出其他3个属生的值 40 | * 41 | * @param currentPage 42 | * @param pageSize 43 | * @param totalCount 44 | * @param recordList 45 | */ 46 | public PageBean(int currentPage, int numPerPage, int totalCount, List recordList) { 47 | this.currentPage = currentPage; 48 | this.numPerPage = numPerPage; 49 | this.totalCount = totalCount; 50 | this.recordList = recordList; 51 | 52 | // 计算总页码 53 | pageCount = (totalCount + numPerPage - 1) / numPerPage; 54 | 55 | // 计算 beginPageIndex 和 endPageIndex 56 | // >> 总页数不多于10页,则全部显示 57 | if (pageCount <= 10) { 58 | beginPageIndex = 1; 59 | endPageIndex = pageCount; 60 | } 61 | // >> 总页数多于10页,则显示当前页附近的共10个页码 62 | else { 63 | // 当前页附近的共10个页码(前4个 + 当前页 + 后5个) 64 | beginPageIndex = currentPage - 4; 65 | endPageIndex = currentPage + 5; 66 | // 当前面的页码不足4个时,则显示前10个页码 67 | if (beginPageIndex < 1) { 68 | beginPageIndex = 1; 69 | endPageIndex = 10; 70 | } 71 | // 当后面的页码不足5个时,则显示后10个页码 72 | if (endPageIndex > pageCount) { 73 | endPageIndex = pageCount; 74 | beginPageIndex = pageCount - 10 + 1; 75 | } 76 | } 77 | } 78 | 79 | /** 80 | * 只接受前5个必要的属性,会自动的计算出其他3个属生的值 81 | * 82 | * @param currentPage 83 | * @param pageSize 84 | * @param totalCount 85 | * @param recordList 86 | */ 87 | public PageBean(int currentPage, int numPerPage, int totalCount, List recordList, Map countResultMap) { 88 | this.currentPage = currentPage; 89 | this.numPerPage = numPerPage; 90 | this.totalCount = totalCount; 91 | this.recordList = recordList; 92 | this.countResultMap = countResultMap; 93 | 94 | // 计算总页码 95 | pageCount = (totalCount + numPerPage - 1) / numPerPage; 96 | 97 | // 计算 beginPageIndex 和 endPageIndex 98 | // >> 总页数不多于10页,则全部显示 99 | if (pageCount <= 10) { 100 | beginPageIndex = 1; 101 | endPageIndex = pageCount; 102 | } 103 | // >> 总页数多于10页,则显示当前页附近的共10个页码 104 | else { 105 | // 当前页附近的共10个页码(前4个 + 当前页 + 后5个) 106 | beginPageIndex = currentPage - 4; 107 | endPageIndex = currentPage + 5; 108 | // 当前面的页码不足4个时,则显示前10个页码 109 | if (beginPageIndex < 1) { 110 | beginPageIndex = 1; 111 | endPageIndex = 10; 112 | } 113 | // 当后面的页码不足5个时,则显示后10个页码 114 | if (endPageIndex > pageCount) { 115 | endPageIndex = pageCount; 116 | beginPageIndex = pageCount - 10 + 1; 117 | } 118 | } 119 | } 120 | 121 | public List getRecordList() { 122 | return recordList; 123 | } 124 | 125 | public void setRecordList(List recordList) { 126 | this.recordList = recordList; 127 | } 128 | 129 | public int getCurrentPage() { 130 | return currentPage; 131 | } 132 | 133 | public void setCurrentPage(int currentPage) { 134 | this.currentPage = currentPage; 135 | } 136 | 137 | public int getPageCount() { 138 | return pageCount; 139 | } 140 | 141 | public void setPageCount(int pageCount) { 142 | this.pageCount = pageCount; 143 | } 144 | 145 | public int getNumPerPage() { 146 | return numPerPage; 147 | } 148 | 149 | public void setNumPerPage(int numPerPage) { 150 | this.numPerPage = numPerPage; 151 | } 152 | 153 | public int getTotalCount() { 154 | return totalCount; 155 | } 156 | 157 | public void setTotalCount(int totalCount) { 158 | this.totalCount = totalCount; 159 | } 160 | 161 | public int getBeginPageIndex() { 162 | return beginPageIndex; 163 | } 164 | 165 | public void setBeginPageIndex(int beginPageIndex) { 166 | this.beginPageIndex = beginPageIndex; 167 | } 168 | 169 | public int getEndPageIndex() { 170 | return endPageIndex; 171 | } 172 | 173 | public void setEndPageIndex(int endPageIndex) { 174 | this.endPageIndex = endPageIndex; 175 | } 176 | 177 | public Map getCountResultMap() { 178 | return countResultMap; 179 | } 180 | 181 | public void setCountResultMap(Map countResultMap) { 182 | this.countResultMap = countResultMap; 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/page/PageParam.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils.page; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 7 | * @描述: 分页参数传递工具类 . 8 | * @作者: WuShuicheng . 9 | * @创建时间: 2013-9-4,下午2:23:47 . 10 | * @版本: 1.0 . 11 | */ 12 | public class PageParam implements Serializable{ 13 | 14 | /** 15 | * 16 | */ 17 | private static final long serialVersionUID = 6297178964005032338L; 18 | private int pageNum; // 当前页数 19 | private int numPerPage; // 每页记录数 20 | private int count; //总数 21 | private String sortOrder; //排序方式 22 | private String sortName; //排序字段 23 | 24 | 25 | public String getSortOrder() { 26 | return sortOrder; 27 | } 28 | 29 | public void setSortOrder(String sortOrder) { 30 | this.sortOrder = sortOrder; 31 | } 32 | 33 | public String getSortName() { 34 | return sortName; 35 | } 36 | 37 | public void setSortName(String sortName) { 38 | this.sortName = sortName; 39 | } 40 | 41 | /** 当前页数 */ 42 | public int getPageNum() { 43 | return pageNum; 44 | } 45 | 46 | /** 当前页数 */ 47 | public void setPageNum(int pageNum) { 48 | this.pageNum = pageNum; 49 | } 50 | 51 | /** 每页记录数 */ 52 | public int getNumPerPage() { 53 | return numPerPage; 54 | } 55 | 56 | /** 每页记录数 */ 57 | public void setNumPerPage(int numPerPage) { 58 | this.numPerPage = numPerPage; 59 | } 60 | 61 | public int getCount() { 62 | return count; 63 | } 64 | 65 | public void setCount(int count) { 66 | this.count = count; 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/vocust/qywx/demo/utils/page/PageResponse.java: -------------------------------------------------------------------------------- 1 | package com.vocust.qywx.demo.utils.page; 2 | 3 | import java.io.Serializable; 4 | import java.lang.Integer; 5 | 6 | public class PageResponse implements Serializable { 7 | private static final long serialVersionUID = 5859230868818691254L; 8 | 9 | //查询到数据总数 10 | private Integer total; 11 | 12 | private boolean success=true; 13 | 14 | //分页内容 15 | private Object res; 16 | 17 | private String message; 18 | 19 | public Integer getTotal() { 20 | return total; 21 | } 22 | 23 | public void setTotal(Integer total) { 24 | this.total = total; 25 | } 26 | 27 | public Object getRes() { 28 | return res; 29 | } 30 | 31 | public void setRes(Object res) { 32 | this.res = res; 33 | } 34 | 35 | public String getMessage() { 36 | return message; 37 | } 38 | 39 | public void setMessage(String message) { 40 | this.message = message; 41 | } 42 | 43 | public boolean isSuccess() { 44 | return success; 45 | } 46 | 47 | public void setSuccess(boolean success) { 48 | this.success = success; 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | #服务器 2 | server: 3 | port: 8080 4 | spring: 5 | #数据源 6 | datasource: 7 | url: jdbc:mysql://localhost:3306/qychatdb?useUnicode=true&characterEncoding=UTF-8&useSSL=false 8 | username: root 9 | password: root 10 | driver-class-name: com.mysql.jdbc.Driver 11 | tomcat: 12 | init-s-q-l: SET NAMES utf8mb4 #解决emoji表情四个字节无法插入utf-8(3个字节)编码的mysql表中 13 | #thymelea模板配置 14 | thymeleaf: 15 | prefix: 16 | classpath: /templates/ 17 | suffix: .html 18 | mode: HTML5 19 | encoding: UTF-8 20 | content-type: text/html 21 | cache: false 22 | resources: 23 | chain: 24 | strategy: 25 | content: 26 | enabled: true 27 | paths: /** 28 | 29 | #mybatis配置 30 | mybatis: 31 | typeAliasesPackage: com.example.mybaitsxml.dao.entity 32 | mapperLocations: classpath:mapper/*.xml 33 | configuration: 34 | map-underscore-to-camel-case: true #开启驼峰命名规则自动转换 35 | 36 | 37 | #自定义配置 38 | filepath: D:\HbuiderWorkSpace\EnterpriseChat-View\static\ -------------------------------------------------------------------------------- /src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | #服务器 2 | server: 3 | port: 8888 4 | spring: 5 | #数据源 6 | datasource: 7 | url: jdbc:mysql://172.16.1.2:3306/qychatdb?useUnicode=true&characterEncoding=UTF-8&useSSL=false 8 | username: root 9 | password: Huake@uat2020 10 | driver-class-name: com.mysql.jdbc.Driver 11 | tomcat: 12 | init-s-q-l: SET NAMES utf8mb4 #解决emoji表情四个字节无法插入utf-8(3个字节)编码的mysql表中 13 | #thymelea模板配置 14 | thymeleaf: 15 | prefix: 16 | classpath: /templates/ 17 | suffix: .html 18 | mode: HTML5 19 | encoding: UTF-8 20 | content-type: text/html 21 | cache: false 22 | resources: 23 | chain: 24 | strategy: 25 | content: 26 | enabled: true 27 | paths: /** 28 | 29 | #mybatis配置 30 | mybatis: 31 | typeAliasesPackage: com.example.mybaitsxml.dao.entity 32 | mapperLocations: classpath:mapper/*.xml 33 | configuration: 34 | map-underscore-to-camel-case: true 35 | 36 | #自定义配置 37 | filepath: /home/dev/html/dist/static/ 38 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev 4 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ${LOG_HOME}/LearningWeb.log.%d{yyyy-MM-dd}.log 20 | 21 | 30 22 | 23 | 24 | 25 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 26 | 27 | 28 | 29 | 10MB 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/mapper/MsgContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | tbl_msgcontent 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 44 | 45 | 46 | INSERT INTO 47 | 48 | (msgid,action,sender,fromView,tolist,tolistView,roomid,roomidView,msgtime,msgtype,text,image,weapp,redpacket,file,video,voice,chatrecord,filename) 49 | VALUES (#{msgid},#{action},#{from},#{fromView},#{tolist},#{tolistView},#{roomid},#{roomidView},#{msgtime},#{msgtype},#{text},#{image},#{weapp},#{redpacket},#{file},#{video},#{voice},#{chatrecord},#{filename}) 50 | 51 | 52 | 57 | 58 | 59 | UPDATE tbl_msgcontent 60 | 61 | filename=#{filename} 62 | 63 | WHERE id=#{id} 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73 | truncate TABLE 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/mapper/QychatMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | INSERT INTO 19 | tbl_qychat(seq,msgid,publickey_ver,encrypt_random_key,encrypt_chat_msg) 20 | VALUES (#{seq},#{msgid},#{publickey_ver},#{encrypt_random_key},#{encrypt_chat_msg}) 21 | 22 | 23 | 26 | 27 | 28 | 29 | truncate TABLE tbl_qychat; 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /src/test/java/com/enterprise/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.enterprise.demo; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.util.List; 6 | 7 | import org.junit.Test; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.alibaba.fastjson.JSONObject; 12 | import com.tencent.wework.Finance; 13 | import com.vocust.qywx.demo.dao.entity.ChatDatas; 14 | import com.vocust.qywx.demo.dao.entity.Qychat; 15 | import com.vocust.qywx.demo.utils.EnterpriseParame; 16 | import com.vocust.qywx.demo.utils.RSAUtils; 17 | 18 | @SpringBootTest 19 | public class DemoApplicationTests { 20 | 21 | // 从官网上拉下来的代码 自己测了一下 有很多需要改的地方 实际应用看代码里边具体实现。。。 22 | @Test 23 | public void contextLoads() { 24 | String[] args = new String[6]; 25 | args[0] = "3";// 查询类型 26 | args[1] = "0";// seq 27 | args[2] = "999";// limit 28 | args[3] = ""; 29 | args[4] = ""; 30 | args[5] = "3";// timeout 31 | long sdk = Finance.NewSdk(); 32 | 33 | System.out.println(Finance.Init(sdk, EnterpriseParame.CORPID, EnterpriseParame.SECRET)); 34 | long ret = 0; 35 | if (args[0].equals("1")) { 36 | int seq = Integer.parseInt(args[1]); 37 | int limit = Integer.parseInt(args[2]); 38 | long slice = Finance.NewSlice(); 39 | ret = Finance.GetChatData(sdk, seq, limit, args[3], args[4], Integer.parseInt(args[5]), slice); 40 | if (ret != 0) { 41 | System.out.println("getchatdata ret " + ret); 42 | return; 43 | } 44 | String data = Finance.GetContentFromSlice(slice); 45 | 46 | JSONObject jsonObject = JSONObject.parseObject(data); 47 | ChatDatas cdata = JSON.toJavaObject(jsonObject, ChatDatas.class); 48 | List list = cdata.getChatdata(); 49 | 50 | for (Qychat ChatData : list) { 51 | System.out.println("msgid :" + ChatData.getMsgid()); 52 | System.out.println("Encrypt_random_key:" + ChatData.getEncrypt_random_key()); 53 | String msgs = ChatData.getEncrypt_chat_msg(); 54 | System.out.println("Encrypt_chat_msg :" + msgs); 55 | String encrypt_key = null; 56 | try { 57 | encrypt_key = RSAUtils.getPrivateKey(ChatData.getEncrypt_random_key()); 58 | } catch (Exception e) { 59 | e.printStackTrace(); 60 | } 61 | System.out.println("encrypt_key :" + encrypt_key); 62 | long msg = Finance.NewSlice(); 63 | System.out.println("result " + Finance.DecryptData(sdk, encrypt_key, msgs, msg)); 64 | String datas = Finance.GetContentFromSlice(msg); 65 | 66 | System.out.println("--------------" + datas); 67 | } 68 | 69 | Finance.FreeSlice(slice); 70 | } else if (args[0].equals("2")) { 71 | String indexbuf = ""; 72 | //sdkFileid 是我们从第一步拉取下来的解密消息 然后通过第三步解密后 的消息内容中 获取到的值(text消息没有 只有文件 图片 语音 视频等消息才有此字段) 73 | String sdkFileid ="CtYBMzA2OTAyMDEwMjA0NjIzMDYwMDIwMTAwMDIwNGVjN2ZhODFlMDIwMzBmNDI0MTAyMDQ0N2FkOTczZDAyMDQ1ZWMzYTQ2YTA0MjQzMzMwMzEzNTY1MzYzODM0MmQzMzM0MzIzNzJkMzQzODM3MzMyZDYyNjY2NTMyMmQzMzM4NjY2MzY2NjIzODM1MzQzMjMzNjQwMjAxMDAwMjAzMDE2MDEwMDQxMDIzNDZlOWUzYzAzMzZkNjNmYzFmNWU3MTg0Njg4MzBmMDIwMTAxMDIwMTAwMDQwMBI4TkRkZk1UWTRPRGcxTkRFME5EQTNOVE0zTVY4eE16UTFOalE1TXpNM1h6RTFPRGs0TnprNU1UUT0aIDY1MzkzMDM1MzUzNTMyMzQzMTYzMzc2MTM2Mzk2NTM0"; 74 | while (true) { 75 | long media_data = Finance.NewMediaData(); 76 | System.out.println(media_data + "--" + sdk); 77 | ret = Finance.GetMediaData(sdk, indexbuf, sdkFileid, null, null, 3, media_data); 78 | System.out.println("getmediadata ret:" + ret); 79 | if (ret != 0) { 80 | return; 81 | } 82 | System.out.printf("getmediadata outindex len:%d, data_len:%d, is_finis:%d\n", 83 | Finance.GetIndexLen(media_data), Finance.GetDataLen(media_data), 84 | Finance.IsMediaDataFinish(media_data)); 85 | try { 86 | String fileName ="a.jpg";//文件名根据自己需要下载的文件类型自定义 87 | FileOutputStream outputStream = new FileOutputStream(new File("C:\\Users\\lenovo\\Desktop\\java\\"+fileName), true); 88 | outputStream.write(Finance.GetData(media_data)); 89 | outputStream.close(); 90 | } catch (Exception e) { 91 | e.printStackTrace(); 92 | } 93 | if (Finance.IsMediaDataFinish(media_data) == 1) { 94 | // need free media_data 95 | Finance.FreeMediaData(media_data); 96 | break; 97 | } else { 98 | indexbuf = Finance.GetOutIndexBuf(media_data); 99 | // need free media_data 100 | Finance.FreeMediaData(media_data); 101 | } 102 | } 103 | } else if (args[0].equals("3")) { 104 | // 获取到的消息进行解密 105 | String encrypt_random_key ="dTJhxJVjHuOHyl8f1Co3TsrJMGa7Y9bHKGaSFjSolHXC0FvybDP1v3oCRo0dYk1UmWRWILgpU02VNpag5cHOtOxKleWyozT4ml/ndFPu+t8aK7M+rv8Ojtsj8awSS2t1P3Y1cE4Xgq1+RPZkrCRKq3xc2UJdutML/SUv3tCzJSP8LpHHxdbJqqA0AwHKb5E3g7DHUlJ6OFM0NQkQKyjh8v7efNXnhJY0w0q01wT8QhC9Si6m6TT+/B7eSTf82YJ/ER8rCwBruLNXN+Z+zGTOaklJsBwaETve6KU3OwSTy1lvLl/VD+Hc5J+Ka+9XEQ/tMg342T/+ascWHVtuq/duUw=="; 106 | String encrypt_key = null; 107 | String encrypt_msg="Hw0zlZSHkNcMW5cFILoupw42mTyDnxsfc5ls3cJKwePHtzNGCTksRjDttB0pSCUiAyhJl+TF09dzXGD0bngOwHGUcf1zIYjyf8PX9jG9Q3WTjvr4FbzCnxGQKBkr72bZxu9p/KvhqOC+ZDSd2ILJshXbqx5rs5NVreY94sp8kv4u8Y/czdF2Xi46dGvaPX1G4WAz3UMPWMHVr8n+nNaqW9PGOY7kNanATk=Xj"; 108 | try { 109 | encrypt_key = RSAUtils.getPrivateKey(encrypt_random_key); 110 | } catch (Exception e) { 111 | e.printStackTrace(); 112 | } 113 | long msg = Finance.NewSlice(); 114 | ret =Finance.DecryptData(sdk, encrypt_key, encrypt_msg, msg); 115 | String decrypt_msg = Finance.GetContentFromSlice(msg);//解密后的消息 116 | System.out.println(decrypt_msg); 117 | if (ret != 0) { 118 | System.out.println("getchatdata ret " + ret); 119 | return; 120 | } 121 | Finance.FreeSlice(msg); 122 | } else { 123 | System.out.println("wrong args " + args[0]); 124 | } 125 | Finance.DestroySdk(sdk); 126 | } 127 | 128 | } 129 | -------------------------------------------------------------------------------- /target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Implementation-Title: demo 3 | Implementation-Version: 0.0.1-SNAPSHOT 4 | Built-By: lenovo 5 | Implementation-Vendor-Id: com.enterprise 6 | Build-Jdk: 1.8.0_231 7 | Implementation-URL: http://projects.spring.io/spring-boot/qywechat/ 8 | Created-By: Maven Integration for Eclipse 9 | Implementation-Vendor: Pivotal Software, Inc. 10 | 11 | -------------------------------------------------------------------------------- /target/classes/META-INF/maven/com.enterprise/qywechat/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon May 25 19:26:18 CST 2020 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.enterprise 5 | m2e.projectName=qywechat 6 | m2e.projectLocation=C\:\\Users\\lenovo\\Desktop\\qywechat 7 | artifactId=qywechat 8 | -------------------------------------------------------------------------------- /target/classes/META-INF/maven/com.enterprise/qywechat/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 | -------------------------------------------------------------------------------- /target/classes/application-dev.yml: -------------------------------------------------------------------------------- 1 | #服务器 2 | server: 3 | port: 8080 4 | spring: 5 | #数据源 6 | datasource: 7 | url: jdbc:mysql://localhost:3306/qychatdb?useUnicode=true&characterEncoding=UTF-8 8 | username: root 9 | password: root 10 | driver-class-name: com.mysql.jdbc.Driver 11 | tomcat: 12 | init-s-q-l: SET NAMES utf8mb4 #解决emoji表情四个字节无法插入utf-8(3个字节)编码的mysql表中 13 | #thymelea模板配置 14 | thymeleaf: 15 | prefix: 16 | classpath: /templates/ 17 | suffix: .html 18 | mode: HTML5 19 | encoding: UTF-8 20 | content-type: text/html 21 | cache: false 22 | resources: 23 | chain: 24 | strategy: 25 | content: 26 | enabled: true 27 | paths: /** 28 | 29 | #mybatis配置 30 | mybatis: 31 | typeAliasesPackage: com.example.mybaitsxml.dao.entity 32 | mapperLocations: classpath:mapper/*.xml 33 | configuration: 34 | map-underscore-to-camel-case: true #开启驼峰命名规则自动转换 35 | 36 | 37 | #自定义配置 38 | filepath: D:\HbuiderWorkSpace\EnterpriseChat-View\static\ -------------------------------------------------------------------------------- /target/classes/application-prod.yml: -------------------------------------------------------------------------------- 1 | #服务器 2 | server: 3 | port: 8888 4 | spring: 5 | #数据源 6 | datasource: 7 | url: jdbc:mysql://172.16.1.2:3306/qychatdb?useUnicode=true&characterEncoding=UTF-8 8 | username: root 9 | password: Huake@uat2020 10 | driver-class-name: com.mysql.jdbc.Driver 11 | tomcat: 12 | init-s-q-l: SET NAMES utf8mb4 #解决emoji表情四个字节无法插入utf-8(3个字节)编码的mysql表中 13 | #thymelea模板配置 14 | thymeleaf: 15 | prefix: 16 | classpath: /templates/ 17 | suffix: .html 18 | mode: HTML5 19 | encoding: UTF-8 20 | content-type: text/html 21 | cache: false 22 | resources: 23 | chain: 24 | strategy: 25 | content: 26 | enabled: true 27 | paths: /** 28 | 29 | #mybatis配置 30 | mybatis: 31 | typeAliasesPackage: com.example.mybaitsxml.dao.entity 32 | mapperLocations: classpath:mapper/*.xml 33 | configuration: 34 | map-underscore-to-camel-case: true 35 | 36 | #自定义配置 37 | filepath: /home/dev/html/dist/static/ 38 | -------------------------------------------------------------------------------- /target/classes/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev 4 | -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/Finance.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/Finance.class -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/WeWorkFinanceSdk.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/WeWorkFinanceSdk.dll -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/libWeWorkFinanceSdk_Java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/libWeWorkFinanceSdk_Java.so -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/libcurl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/libcurl.dll -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/libeay32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/libeay32.dll -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/libprotobuf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/libprotobuf.dll -------------------------------------------------------------------------------- /target/classes/com/tencent/wework/ssleay32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/tencent/wework/ssleay32.dll -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/WeChatApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/WeChatApplication.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/controller/MsgContentController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/controller/MsgContentController.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/controller/QyChatController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/controller/QyChatController.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/controller/UserController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/controller/UserController.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/entity/ChatDatas.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/entity/ChatDatas.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/entity/MsgContent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/entity/MsgContent.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/entity/QueryParam.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/entity/QueryParam.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/entity/Qychat.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/entity/Qychat.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/entity/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/entity/User.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/mapper/MsgContentMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/mapper/MsgContentMapper.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/mapper/QychatMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/mapper/QychatMapper.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/dao/mapper/UserMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/dao/mapper/UserMapper.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/MsgContentService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/MsgContentService.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/QychatService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/QychatService.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/UserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/UserService.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/impl/MsgContentServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/impl/MsgContentServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/impl/QychatServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/impl/QychatServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/impl/ScheduledTasks.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/impl/ScheduledTasks.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/service/impl/UserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/service/impl/UserServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/strategy/MsgTypeStrategy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/strategy/MsgTypeStrategy.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/EnterperiseUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/EnterperiseUtils.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/EnterpriseParame.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/EnterpriseParame.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/EnumMsgType.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/EnumMsgType.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/GlobalCorsConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/GlobalCorsConfig.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/HttpUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/HttpUtils.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/RSAUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/RSAUtils.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/page/PageBean.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/page/PageBean.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/page/PageParam.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/page/PageParam.class -------------------------------------------------------------------------------- /target/classes/com/vocust/qywx/demo/utils/page/PageResponse.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/classes/com/vocust/qywx/demo/utils/page/PageResponse.class -------------------------------------------------------------------------------- /target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ${LOG_HOME}/LearningWeb.log.%d{yyyy-MM-dd}.log 20 | 21 | 30 22 | 23 | 24 | 25 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 26 | 27 | 28 | 29 | 10MB 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /target/classes/mapper/MsgContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | tbl_msgcontent 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 44 | 45 | 46 | insert into 47 | 48 | (msgid,action,sender,fromView,tolist,tolistView,roomid,roomidView,msgtime,msgtype,text,image,weapp,redpacket,file,video,voice,chatrecord,filename) 49 | values(#{msgid},#{action},#{from},#{fromView},#{tolist},#{tolistView},#{roomid},#{roomidView},#{msgtime},#{msgtype},#{text},#{image},#{weapp},#{redpacket},#{file},#{video},#{voice},#{chatrecord},#{filename}) 50 | 51 | 52 | 57 | 58 | 59 | update tbl_msgcontent 60 | 61 | filename=#{filename} 62 | 63 | where id=#{id} 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73 | truncate table 74 | 75 | 76 | -------------------------------------------------------------------------------- /target/classes/mapper/QychatMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | insert into 19 | tbl_qychat(seq,msgid,publickey_ver,encrypt_random_key,encrypt_chat_msg) 20 | values(#{seq},#{msgid},#{publickey_ver},#{encrypt_random_key},#{encrypt_chat_msg}) 21 | 22 | 23 | 26 | 27 | 28 | 29 | truncate table tbl_qychat; 30 | 31 | -------------------------------------------------------------------------------- /target/classes/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Apache Maven 2 | #Mon May 25 15:01:18 CST 2020 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.enterprise 5 | artifactId=qywechat 6 | -------------------------------------------------------------------------------- /target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com\vocust\qywx\demo\utils\EnumMsgType.class 2 | com\vocust\qywx\demo\service\impl\QychatServiceImpl.class 3 | com\vocust\qywx\demo\service\impl\ScheduledTasks.class 4 | com\vocust\qywx\demo\utils\page\PageResponse.class 5 | com\vocust\qywx\demo\dao\entity\QueryParam.class 6 | com\vocust\qywx\demo\dao\mapper\UserMapper.class 7 | com\vocust\qywx\demo\controller\MsgContentController.class 8 | com\vocust\qywx\demo\dao\mapper\QychatMapper.class 9 | com\vocust\qywx\demo\utils\GlobalCorsConfig.class 10 | com\vocust\qywx\demo\utils\HttpUtils.class 11 | com\vocust\qywx\demo\service\QychatService.class 12 | com\vocust\qywx\demo\dao\entity\MsgContent.class 13 | com\vocust\qywx\demo\strategy\MsgTypeStrategy.class 14 | com\vocust\qywx\demo\utils\EnterperiseUtils.class 15 | com\vocust\qywx\demo\dao\entity\Qychat.class 16 | com\vocust\qywx\demo\dao\entity\ChatDatas.class 17 | com\vocust\qywx\demo\utils\page\PageParam.class 18 | com\vocust\qywx\demo\dao\mapper\MsgContentMapper.class 19 | com\vocust\qywx\demo\controller\QyChatController.class 20 | com\vocust\qywx\demo\utils\RSAUtils.class 21 | com\tencent\wework\Finance.class 22 | com\vocust\qywx\demo\WeChatApplication.class 23 | com\vocust\qywx\demo\service\UserService.class 24 | com\vocust\qywx\demo\service\MsgContentService.class 25 | com\vocust\qywx\demo\controller\UserController.class 26 | com\vocust\qywx\demo\service\impl\MsgContentServiceImpl.class 27 | com\vocust\qywx\demo\service\impl\UserServiceImpl.class 28 | com\vocust\qywx\demo\utils\EnterpriseParame.class 29 | com\vocust\qywx\demo\utils\page\PageBean.class 30 | com\vocust\qywx\demo\dao\entity\User.class 31 | -------------------------------------------------------------------------------- /target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\entity\MsgContent.java 2 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\EnterpriseParame.java 3 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\UserService.java 4 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\impl\QychatServiceImpl.java 5 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\mapper\UserMapper.java 6 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\EnterperiseUtils.java 7 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\entity\QueryParam.java 8 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\controller\MsgContentController.java 9 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\controller\QyChatController.java 10 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\GlobalCorsConfig.java 11 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\MsgContentService.java 12 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\entity\Qychat.java 13 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\HttpUtils.java 14 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\impl\UserServiceImpl.java 15 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\strategy\MsgTypeStrategy.java 16 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\EnumMsgType.java 17 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\page\PageParam.java 18 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\page\PageResponse.java 19 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\controller\UserController.java 20 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\mapper\QychatMapper.java 21 | D:\eclipse_work_space\qywechat\src\main\java\com\tencent\wework\Finance.java 22 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\QychatService.java 23 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\entity\User.java 24 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\mapper\MsgContentMapper.java 25 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\RSAUtils.java 26 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\WeChatApplication.java 27 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\dao\entity\ChatDatas.java 28 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\utils\page\PageBean.java 29 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\impl\ScheduledTasks.java 30 | D:\eclipse_work_space\qywechat\src\main\java\com\vocust\qywx\demo\service\impl\MsgContentServiceImpl.java 31 | -------------------------------------------------------------------------------- /target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst -------------------------------------------------------------------------------- /target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | D:\eclipse_work_space\qywechat\src\test\java\com\enterprise\demo\DemoApplicationTests.java 2 | -------------------------------------------------------------------------------- /target/qywechat-0.0.1-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/qywechat-0.0.1-SNAPSHOT.jar -------------------------------------------------------------------------------- /target/qywechat-0.0.1-SNAPSHOT.jar.original: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/qywechat-0.0.1-SNAPSHOT.jar.original -------------------------------------------------------------------------------- /target/test-classes/com/enterprise/demo/DemoApplicationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hufeiyaya/QyChat/88b606d83369c260097cf1cca5105a8d6c657ada/target/test-classes/com/enterprise/demo/DemoApplicationTests.class --------------------------------------------------------------------------------