diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..186ea45ad2f6d1e937ec214b5c8c6c6d81baf90c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
+target
+bak
+.pmd
+.project
+.settings
+.classpath
+.idea.xml
+.idea
+*.class
+*.bak
+*.iml
+*.ipr
+*.iws
+bak
+null/
+tree.log
+tmp/
+velocity.log
+.DS_Store
+logs
+.m2
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100644
index 0000000000000000000000000000000000000000..b901097f2db6e50097dc0b222204a88f8cea1609
--- /dev/null
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+ private static final String WRAPPER_VERSION = "0.5.6";
+ /**
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+ */
+ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+ /**
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+ * use instead of the default one.
+ */
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+ ".mvn/wrapper/maven-wrapper.properties";
+
+ /**
+ * Path where the maven-wrapper.jar will be saved to.
+ */
+ private static final String MAVEN_WRAPPER_JAR_PATH =
+ ".mvn/wrapper/maven-wrapper.jar";
+
+ /**
+ * Name of the property which should be used to override the default download url for the wrapper.
+ */
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+ public static void main(String args[]) {
+ System.out.println("- Downloader started");
+ File baseDirectory = new File(args[0]);
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
+ // wrapperUrl parameter.
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+ String url = DEFAULT_DOWNLOAD_URL;
+ if(mavenWrapperPropertyFile.exists()) {
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
+ try {
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+ Properties mavenWrapperProperties = new Properties();
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+ } catch (IOException e) {
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+ } finally {
+ try {
+ if(mavenWrapperPropertyFileInputStream != null) {
+ mavenWrapperPropertyFileInputStream.close();
+ }
+ } catch (IOException e) {
+ // Ignore ...
+ }
+ }
+ }
+ System.out.println("- Downloading from: " + url);
+
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+ if(!outputFile.getParentFile().exists()) {
+ if(!outputFile.getParentFile().mkdirs()) {
+ System.out.println(
+ "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+ }
+ }
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+ try {
+ downloadFileFromURL(url, outputFile);
+ System.out.println("Done");
+ System.exit(0);
+ } catch (Throwable e) {
+ System.out.println("- Error downloading");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+ if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+ String username = System.getenv("MVNW_USERNAME");
+ char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+ Authenticator.setDefault(new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(username, password);
+ }
+ });
+ }
+ URL website = new URL(urlString);
+ ReadableByteChannel rbc;
+ rbc = Channels.newChannel(website.openStream());
+ FileOutputStream fos = new FileOutputStream(destination);
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ fos.close();
+ rbc.close();
+ }
+
+}
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054
Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000000000000000000000000000000000000..642d572ce90e5085986bdd9c9204b9404f028084
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git a/LOG_PATH_IS_UNDEFINED/sys-error.log b/LOG_PATH_IS_UNDEFINED/sys-error.log
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/LOG_PATH_IS_UNDEFINED/sys-info.log b/LOG_PATH_IS_UNDEFINED/sys-info.log
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/LOG_PATH_IS_UNDEFINED/sys-user.log b/LOG_PATH_IS_UNDEFINED/sys-user.log
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/README.md b/README.md
index de7c19be389f88d1c057baa626f50558452fb1c5..e374557e18e69ab7f65aaa803550264d5d4197ee 100644
--- a/README.md
+++ b/README.md
@@ -1,46 +1,84 @@
-# LinkWeChat
+
+
-### 平台介绍
+
+
+
-LinkWeChat,是一款基于企业微信的开源SCRM系统,为企业构建私域流量系统的综合解决方案,显著提升企业社交运营效率!
-
+
-#### 应用场景:
-泛零售、电商行业企业微信用户,提供多种工具多渠道多方式添加客户到企业微信好友,通过营销互动与客户标签管理等建立强连接。
+[](https://gitee.com/LinkWeChat/link-wechat/stargazers)
+[](https://gitee.com/LinkWeChat/link-wechat/members)
+
+
-#### 内置功能
+
-
+
+
+
+
+---
+ **如果您觉得我们的开源项目很有帮助,请帮忙点击右上方的 :star: Star ,您的认可就是我们最大的动力,谢谢支持!:heart:
**
+---
+
+[LinkWeChat 官方帮助手册——语雀](https://www.yuque.com/linkwechat/help)
+
+### 产品简介
+
+> LinkWeChat, Link to WeChat.
+
+基于人工智能的企业微信 SCRM 系统——LinkWeChat基于企业微信开放能力,不仅集成了企微基础的客户管理和后台管理功能,而且通过引流获客、客情维系、社群运营等灵活高效的客户运营模块,让客户与企业之间建立强链接关系,同时进一步通过多元化的客户营销工具,帮助企业提高客户运营效率,强化营销能力,拓展盈利空间,是企业私域流量管理与营销的综合解决方案。
+
+
+
+#### 功能特性
+
+系统分为八大模块:
+
+* **运营中心** :客户、客群、会话等全功能数据报表,数据一目了然;
+* **引流获客** :活码、群活码、公海、客服等多渠道引流,实现精准获客;
+* **客户中心** :助力企业搭建私域流量池,高效运营客户;
+* **客情维系** :企业客户运营精细化,朋友圈、红包工具提高客户活跃度;
+* **社群运营** :客群运营场景全覆盖,快速拉群;
+* **全能营销** :提供多类型、多场景客户营销工具;
+* **企业风控** :会话合规存档,敏感内容全局风控;
+* **企业管理** :组织架构、自建应用全融合,实现“一个后台”;
+
+
+
### 环境部署
+
#### 准备工作
-```
+```java
JDK >= 1.8 (推荐1.8版本)
-Mysql >= 5.5.0 (推荐5.7版本)
+Mysql >= 5.7.0 (推荐5.7版本)
+Mysql >= 5.7.0 (推荐5.7版本)
Redis >= 3.0
Maven >= 3.0
Node >= 10
```
+
#### 运行系统
##### 后端运行
-- 导入IDEA中
-- 创建数据库LW-vue并导入数据脚本
-- 打开运行com.linkwechat. LinkWeChatApplication.java
-
+- 导入 `IDEA` 中
+- 创建数据库 `LW-vue` 并导入数据脚本
+- 打开运行 `com.linkwechat.LinkWeChatApplication.java`
##### 前端运行
-```
+```bash
# 进入项目目录
cd linkwe-ui
@@ -53,51 +91,54 @@ npm install --registry=https://registry.npm.taobao.org
# 本地开发 启动项目
npm run serve
```
-4、打开浏览器,输入:http://localhost:80 (默认账户 admin/admin123)
-若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功
+
+打开浏览器,输入 `http://localhost:80 `,默认账密为:`admin/admin123` 。
+
+若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功。
##### 必要配置
1、修改数据库连接
-- 编辑resources目录下的application-druid.yml
-- url: 服务器地址
-- username: 账号
-- password: 密码
+- 编辑 `resources` 目录下的 `application-druid.yml`
+- `url` : 服务器地址
+- `username` : 账号
+- `password `: 密码
+
+数据库脚本:[https://gitee.com/LinkWeChat_admin/link-we-chat-db/tree/master](https://gitee.com/LinkWeChat_admin/link-we-chat-db/tree/master)
2、开发环境配置
-- 编辑resources目录下的application.yml
-- port: 端口
-- context-path: 部署路径
+- 编辑 `resources` 目录下的 `application.yml`
+- `port` : 端口
+- `context-path` : 部署路径
#### 部署系统
-##### 后端部署
+##### 后端部署
-- bin/package.bat 在项目的目录下执行
-- 然后会在项目下生成 target文件夹包含 war 或jar (多模块生成在linkwe-admin)
-- 1、jar部署方式
-- 使用命令行执行:java –jar LinkWeChat.jar
-- 2、war部署方式
-- pom.xml packaging修改为war 放入tomcat服务器webapps
+- `bin/package.bat` 在项目的目录下执行
+- 然后会在项目下生成 ` target` 文件夹包含 `war` 或 `jar `(多模块生成在 `linkwe-admin`)
+- `jar` 部署方式:使用命令行执行 `java –jar LinkWeChat.jar`
+- `war` 部署方式:`pom.xml packaging` 修改为 `war` 放入 `tomcat` 服务器 `webapps`
##### 前端部署
当项目开发完毕,只需要运行一行命令就可以打包你的应用
-```
+```bash
# 打包正式环境
npm run build:prod
# 打包预发布环境
npm run build:stage
```
-构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件,通常是 ***.js 、***.css、index.html 等静态文件。
-通常情况下 dist 文件夹的静态文件发布到你的 nginx 或者静态服务器即可,其中的 index.html 是后台服务的入口页面。
+构建打包成功之后,会在根目录生成 `dist` 文件夹,里面就是构建打包好的文件,通常是 `.js` 、`.css`、`index.html` 等静态文件。
+
+通常情况下 `dist` 文件夹的静态文件发布到你的 `nginx` 或者静态服务器即可,其中的 `index.html` 是后台服务的入口页面。
### 项目介绍
@@ -171,31 +212,33 @@ com.linkwechat
#### 核心技术
-- 前端技术栈 ES6、vue、vuex、vue-router、vue-cli、axios、element-ui
+- 前端技术栈 `ES6`、`vue`、`vuex`、`vue-router`、`vue-cli`、`axios`、`element-ui`
+
+- 后端技术栈 `SpringBoot`、`MyBatis-plus`、`Spring Security`、`Jwt`
-- 后端技术栈 SpringBoot、MyBatis-plus、Spring Security、Jwt
+#### 业务架构
-#### 最终业务架构
+利用 NLP 技术对聊天记录进行智能语义分析,实现敏感词自动告警及自动打标签功能。
-
+
#### 在线体验
- 演示演示:http://106.13.201.219/ 演示账号/密码:test/123456
+演示地址:http://demo.linkwechat.cn/
-#### 开发进度
+演示账号/密码:Wecome/123456
-
+#### 开发进度
-### 联系作者加入交流群
+
-
+### 联系作者加入群
+
### 特别鸣谢
-
- 感谢[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search)提供框架代码。
-
+
+感谢[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search)提供框架代码。
### 部分演示图,持续更新
@@ -205,11 +248,90 @@ com.linkwechat



+
+
+
+### 合作伙伴
+
+
### 版权声明
-LinkWeChat开源版遵循[GPL-3.0](https://gitee.com/LinkWeChat/link-wechat/blob/master/LICENSE)开源协议发布,并提供免费使用,但不允许修改后和衍生的代码做为闭源的商业软件发布和销售!
+LinkWeChat 开源版遵循 [GPL-3.0](https://gitee.com/LinkWeChat/link-wechat/blob/master/LICENSE) 开源协议发布,并提供免费使用,但 **绝不允许修改后和衍生的代码做为闭源的商业软件发布和销售!**
+
+### 捐赠支持
+
+#### 来一杯卡布奇诺
+
+如果您觉得我们的开源项目 `LinkWeChat` 对您有帮助,那就请项目开发者们来一杯卡布奇诺吧!当前我们接受来自于**微信**、**支付宝**或者**码云**的捐赠,请在捐赠时备注自己的昵称或附言。
+
+您的捐赠将用于支付该项目的一些费用支出,并激励开发者们以便更好的推动项目的发展,同时欢迎捐赠**公网服务器**用于提高在线演示系统体验。
+
+
+
+#### 长期捐赠
+
+如果您是企业的经营者并且有计划将 `LinkWeChat` 用在公司的经营产品中,欢迎进行长期捐赠。长期捐赠有商业上的益处有:
+
+* 积极响应,快速维护,及时更新;
+* 企业名称、Logo 及官网链接将长期展示在开源仓库、`LinkWeChat` 官网及宣发材料中;
+* 捐赠金额同比例抵扣未来 `LinkWeChat` 的付费产品价格。
+
+如果您对长期赞助 `LinkWeChat` 团队感兴趣,或者有其他好想法,欢迎联系开发团队微信 `sxjiangdongqin`,或发送邮件到 iamxiarui@foxmail.com。
+
+#### 捐赠记录
+
+`LinkWeChat` 全体开发团队感谢以下全部小伙伴们的赞助(排名不分先后):
+
+| 昵称 | 金额 | 渠道 | 时间 | 附言 |
+| :------: | :-----: | :--: | :-----------------: | :----------------: |
+| yang | ¥10.00 | 码云 | 2021-02-22 22:08:59 | 感谢您的开源项目! |
+| 水库浪子 | ¥1.00 | 码云 | 2021-02-22 22:09:03 | 感谢您的开源项目! |
+| 楼* | ¥166.60 | 微信 | 2021-02-22 22:27:25 | 希望这个好项目能长久发展 |
+| joygezxp | ¥66.60 | 微信 | 2021-02-22 22:39:41 | 愿项目一路666 |
+| iamxiarui | ¥10.00 | 微信 | 2021-02-22 22:37:52 | 坚持开源不容易 |
+| godricV | ¥10.00 | 微信 | 2021-02-22 22:28:55 | 感谢您的开源项目! |
+| *标 | ¥20.00 | 微信 | 2021-03-05 16:03:19 | 感谢您的开源项目! |
+| *涯 | ¥30.00 | 微信 | 2021-03-09 12:14:02 | 加油,感谢开源! |
+| *魂 | ¥30.00 | 微信 | 2021-03-11 10:52:47 | 感谢开源供大家学习 |
+| *J | ¥10.00 | 微信 | 2021-03-12 14:20:22 | 感谢开源供大家学习 |
+| 杨*源 | ¥10.00 | 码云 | 2021-03-23 11:07:22 | 期待月底的大更新 |
+| 骆*升 | ¥66.66 | 支付宝 | 2021-03-23 11:31:58 | 感谢开源供大家学习 |
+| 曲*旭 | ¥20.00 | 码云 | 2021-03-23 11:31:58 | 感谢您的开源项目! |
+| 郑* | ¥ 50.00 | 码云 | 2021-03-23 11:31:58 | 虽然之前做过类似的,还是感谢下开源和分享的奉献精神 |
+| *喵 | ¥ 66.00 | 微信 | 2021-03-24 11:06:31 | 感谢您的开源项目! |
+| q*s | ¥ 50.00 | 微信 | 2021-03-29 19:57:49 | 感谢您的开源项目! |
+| *海 | ¥ 1.00 | 微信 | 2021-03-30 10:47:03 | 感谢您的开源项目! |
+| m*r | ¥ 50.00 | 微信 | 2021-03-30 17:55:30 | 感谢您的开源项目! |
+| *祺 | ¥ 20.00 | 支付宝 | 2021-03-30 19:03:59 | 感谢您的开源项目! |
+| *桥 | ¥ 66.66 | 支付宝 | 2021-04-07 16:38:31 | 祝项目一路 666 |
+| *力 | ¥ 66.00 | 微信 | 2021-04-09 10:30:11 | 支持开源 |
+| *生 | ¥ 66.00 | 微信 | 2021-04-15 21:36:01 | 支持开源 |
+| Q*N | ¥ 10.00 | 微信 | 2021-04-19 20:24:11 | 感谢分享 |
+| 大*k | ¥ 10.00 | 微信 | 2021-04-22 12:25:02 | 感谢您的开源 |
+| J*s | ¥ 10.00 | 微信 | 2021-05-19 17:33:10 | 感谢您的开源 |
+| *茶 | ¥ 10.00 | 微信 | 2021-05-17 20:46:05 | 感谢您的开源 |
+
+
+`LinkWeChat` 全体开发团队感谢以下全部合作伙伴的服务器赞助(排名不分先后):
+
+| 公司/个人名称 | 服务器 |
+| :------: | :-----: |
+| 上海六感科技有限公司 | 八核 16G 服务器一台 |
+| Happy | 两核 8G 服务器一台 |
+| 平山阑槛倚晴空 | 两核 4G 服务器一台 |
+
+
+#### 捐赠用途
+
+患难与共,风雨同舟。
+
+LinkWeChat 开源团队将目前所收项目捐赠全额捐出,仅尽绵薄之力,在此我们也感谢大家的捐赠和支持,希望河南尽早渡过难关。
+同时也希望 LinkWeChat 不仅能为国内开源社区建设做一点贡献,也能为社会产生一些价值。
+
+---
+ **如果您觉得我们的开源项目很有帮助,请帮忙点击右上方的 :star: Star ,您的认可就是我们最大的动力,谢谢支持!:heart:**
\ No newline at end of file
diff --git a/RELEASES.md b/RELEASES.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/build_docker.sh b/build_docker.sh
new file mode 100644
index 0000000000000000000000000000000000000000..a6dcf8c3b5dde388f2057e1f957e6ecd31581105
--- /dev/null
+++ b/build_docker.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+########################################################
+############### LinkWeChat Docker 部署脚本 ##############
+########################################################
+LOG=$1
+PROJ_HOME=$PWD
+echo "$PROJ_HOME"
+CLEAN_BUILD="clean"
+BUILD_CODE="install"
+BUILD_DOCKER="docker:build"
+
+showLog(){
+ if [ "$1" == '--log' -o "$1" == '-l' ]; then
+ $PROJ_HOME/mvnw "$2"
+ else
+ $PROJ_HOME/mvnw "$2" > /dev/null
+ fi
+}
+
+cd "$PROJ_HOME"
+echo '开始从代码构建LinkWeChat'
+showLog "$LOG" "$CLEAN_BUILD"
+showLog "$LOG" "$BUILD_CODE"
+echo '构建完成'
+cd "$PROJ_HOME"/linkwe-admin
+echo '开始构建Docker镜像'
+showLog "$LOG" "$BUILD_DOCKER"
+echo 'Docker镜像构建完成'
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b9477a38b63303467e8d179a3e2f1e3a4c2947ff
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,28 @@
+version: '3.3'
+
+# 如需配置变量,请在environment中进行变量配置
+services:
+ api:
+ image: linkwechat
+ container_name: linkwechat
+ environment:
+ - JAVA_OPTS=-Xms4096m -Xmx4096m -Duser.timezone=Asia/Shanghai
+ - TZ=Asia/Shanghai
+ - NACOS_SERVER
+ # 如果使用nacos,以下变量可以不进行配置
+ - ES_ADDRESS
+ - DB_HOST
+ - DB_PORT
+ - DB_NAME
+ - DB_USER
+ - DB_PASS
+ - REDIS_HOST
+ - REDIS_PORT
+ ports:
+ - 8090
+ volumes:
+ - ./logs:/logs
+ # 上传文件地址,请根据实际${ruoyi.profile}自行修改映射
+ - ./pic:/app/project/pic
+ - ./tmp:/tmp
+ restart: always
\ No newline at end of file
diff --git a/linkwe-admin/pom.xml b/linkwe-admin/pom.xml
index 50d6829a4aa43d4ab50534254d81d5a30164896e..44b100849a0d1b41d1569bb9a0d1f45143318684 100644
--- a/linkwe-admin/pom.xml
+++ b/linkwe-admin/pom.xml
@@ -24,6 +24,12 @@
true
+
+
+ org.hibernate.validator
+ hibernate-validator
+
+
io.springfox
@@ -68,6 +74,35 @@
5.6.24
+
+
+
+ com.google.protobuf
+ protobuf-java
+
+
+
+
+
+ io.github.leejoker
+ linkwechat-nacos-starter
+
+
+
+
+
+
+ javax.xml.bind
+ jaxb-api
+
+
+
+
+
+ org.projectlombok
+ lombok
+
+
@@ -96,6 +131,36 @@
${project.artifactId}
+
+ com.spotify
+ docker-maven-plugin
+ 1.1.1
+
+ ${parent.artifactId}
+ ${basedir}/src/main/docker
+
+ ${parent.version}
+
+
+
+ ${project.build.finalName}.jar
+
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.jar
+
+
+
+
+
+ javax.activation
+ activation
+ 1.1.1
+
+
+
${project.artifactId}
diff --git a/linkwe-admin/src/main/docker/Dockerfile b/linkwe-admin/src/main/docker/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..edfe17e61169203dd9de342dcd8d81ee7080e47b
--- /dev/null
+++ b/linkwe-admin/src/main/docker/Dockerfile
@@ -0,0 +1,17 @@
+FROM openjdk:8-alpine
+
+RUN set -xe && apk --no-cache add ttf-dejavu fontconfig
+
+# 设置时区
+ADD Shanghai /usr/share/zoneinfo/Asia/
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && echo "Asia/Shanghai" > /etc/timezone
+
+VOLUME /tmp
+
+#设置字符集
+ENV LANG en_US.UTF-8
+ARG JAR_FILE
+ADD $JAR_FILE app.jar
+
+ENTRYPOINT ["sh","-c","java -server $JAVA_OPTS -jar /app.jar"]
\ No newline at end of file
diff --git a/linkwe-admin/src/main/docker/Shanghai b/linkwe-admin/src/main/docker/Shanghai
new file mode 100644
index 0000000000000000000000000000000000000000..d7f92e2fa5868addab98170099181375634ab1ca
Binary files /dev/null and b/linkwe-admin/src/main/docker/Shanghai differ
diff --git a/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatApplication.java b/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatApplication.java
index 9381985b798337e5abab58d53d6a7fb31b42be88..472e53ac769799aa437dad69e424556d5686bc49 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatApplication.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatApplication.java
@@ -1,38 +1,35 @@
package com.linkwechat;
+import com.dtflys.forest.springboot.annotation.ForestScan;
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
-import com.thebeastshop.forest.springboot.annotation.ForestScan;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
-import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
+import org.springframework.scheduling.annotation.EnableAsync;
/**
* 启动程序
- *
+ *
* @author ruoyi
*/
-@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class })
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
@MapperScan("com.linkwechat.*.mapper")
-@ForestScan(basePackages = "com.linkwechat.wecom.client")
-public class LinkWeChatApplication
-{
- public static void main(String[] args)
- {
+@ForestScan(basePackages = {"com.linkwechat.wecom.client", "com.linkwechat.wecom.wxclient"})
+@EnableAsync
+public class LinkWeChatApplication {
+ public static void main(String[] args) {
-
- SpringApplication.run(LinkWeChatApplication.class, args);
- System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
- " .-------. ____ __ \n" +
- " | _ _ \\ \\ \\ / / \n" +
- " | ( ' ) | \\ _. / ' \n" +
- " |(_ o _) / _( )_ .' \n" +
- " | (_,_).' __ ___(_ o _)' \n" +
- " | |\\ \\ | || |(_,_)' \n" +
- " | | \\ `' /| `-' / \n" +
- " | | \\ / \\ / \n" +
- " ''-' `'-' `-..-' ");
+ SpringApplication.run(LinkWeChatApplication.class, args);
+ System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
+ " .-------. ____ __ \n" +
+ " | _ _ \\ \\ \\ / / \n" +
+ " | ( ' ) | \\ _. / ' \n" +
+ " |(_ o _) / _( )_ .' \n" +
+ " | (_,_).' __ ___(_ o _)' \n" +
+ " | |\\ \\ | || |(_,_)' \n" +
+ " | | \\ `' /| `-' / \n" +
+ " | | \\ / \\ / \n" +
+ " ''-' `'-' `-..-' ");
}
}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CommonController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CommonController.java
index 20472616a09fcf2013cbb25288aeac15252f3d76..631c3b42b2333288f68e42244573ca6b2ecb9108 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CommonController.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CommonController.java
@@ -4,9 +4,12 @@ import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.FileVo;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils;
+import com.linkwechat.framework.web.domain.server.SysFile;
+import com.linkwechat.framework.web.service.FileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +33,10 @@ public class CommonController {
@Autowired
private ServerConfig serverConfig;
+
+ @Autowired
+ private FileService fileService;
+
/**
* 通用下载请求
*
@@ -96,4 +103,46 @@ public class CommonController {
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
+
+ /**
+ * 网络资源通用下载
+ */
+ @GetMapping("/common/download/url")
+ public void webResourceDownload(String url, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ FileUtils.downloadFile(url, response.getOutputStream());
+ }
+
+
+ /**
+ * 通用上传请求
+ */
+ @PostMapping("/common/uploadFile2Cos")
+ public AjaxResult uploadFile2Cos(MultipartFile file){
+ try {
+
+ SysFile sysFile
+ = fileService.upload(file);
+ return AjaxResult.success(
+ FileVo.builder()
+ .fileName(sysFile.getFileName())
+ .url(sysFile.getImgUrlPrefix()+sysFile.getFileName())
+ .build()
+ );
+ } catch (Exception e) {
+ return AjaxResult.error("不支持当前文件上传或文件过大建议传20MB以内的文件");
+ }
+ }
+
+
+ /**
+ * 获取图片
+ */
+ @GetMapping("/common/findImage")
+ public void findImage(HttpServletResponse response,String fileName){
+ fileService.findImage(fileName,response);
+ }
+
+
+
+
}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysLoginController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysLoginController.java
index b9bdd43d137ede96b711235a4fe2bdd3b985daa2..9b76fb6602f226571458703bf4c24a22cf6ab234 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysLoginController.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysLoginController.java
@@ -1,20 +1,26 @@
package com.linkwechat.web.controller.system;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysDept;
import com.linkwechat.common.core.domain.entity.SysMenu;
import com.linkwechat.common.core.domain.entity.SysUser;
+import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.core.domain.model.LoginBody;
import com.linkwechat.common.core.domain.model.LoginUser;
import com.linkwechat.common.utils.ServletUtils;
import com.linkwechat.framework.web.service.SysLoginService;
import com.linkwechat.framework.web.service.SysPermissionService;
import com.linkwechat.framework.web.service.TokenService;
+import com.linkwechat.system.service.ISysDeptService;
import com.linkwechat.system.service.ISysMenuService;
-import com.linkwechat.wecom.client.WeAccessTokenClient;
-import com.linkwechat.wecom.domain.WeCorpAccount;
+import com.linkwechat.system.service.ISysUserService;
+import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.domain.dto.WeLoginUserInfoDto;
+import com.linkwechat.wecom.domain.dto.WeUserInfoDto;
import com.linkwechat.wecom.service.IWeCorpAccountService;
+import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -50,8 +56,13 @@ public class SysLoginController
@Autowired
- private WeAccessTokenClient weAccessTokenClient;
+ private WeUserClient weUserClient;
+ @Autowired
+ private ISysDeptService iSysDeptService;
+
+ @Autowired
+ private ISysUserService sysUserService;
/**
@@ -87,6 +98,15 @@ public class SysLoginController
Set roles = permissionService.getRolePermission(user);
// 权限集合
Set permissions = permissionService.getMenuPermission(user);
+
+ List sysDepts = iSysDeptService.selectDeptList(SysDept.builder().parentId(new Long(0)).build());
+
+ if(!CollectionUtils.isEmpty(sysDepts)){
+ user.setCompanyName(
+ sysDepts.stream().findFirst().get().getDeptName()
+ );
+ }
+
//校验用户是否拥有可用corpid
WeCorpAccount wxCorpAccount
= iWxCorpAccountService.findValidWeCorpAccount();
@@ -115,47 +135,76 @@ public class SysLoginController
return AjaxResult.success(menuService.buildMenus(menus));
}
- /**
- * 获取企业扫码登录相关参数
- * @return
- */
- @GetMapping("/findWxQrLoginInfo")
- public AjaxResult findQrLoginParm(){
-
- WeCorpAccount validWeCorpAccount
- = iWxCorpAccountService.findValidWeCorpAccount();
- if(null != validWeCorpAccount){
- validWeCorpAccount.setContactSecret(null);
- validWeCorpAccount.setCorpSecret(null);
- validWeCorpAccount.setProviderSecret(null);
- }
-
- return AjaxResult.success(validWeCorpAccount);
- }
-
-
-
- /**
- * 扫码登录微信端回调
- * @param auth_code
- * @return
- */
- @GetMapping("/wxQrLogin")
- public AjaxResult wxQrLogin(String auth_code){
-
- AjaxResult ajax = AjaxResult.success();
-
- WeLoginUserInfoDto loginInfo = weAccessTokenClient.getLoginInfo(auth_code);
- if( null != loginInfo.getUser_info()){
-
- String token = loginService.noPwdLogin(loginInfo.getUser_info().getUserid());
- ajax.put(Constants.TOKEN, token);
-
- }
-
- return ajax;
-
- }
+// /**
+// * 获取企业扫码登录相关参数
+// * @return
+// */
+// @GetMapping("/findWxQrLoginInfo")
+// public AjaxResult findQrLoginParm(){
+//
+// WeCorpAccount validWeCorpAccount
+// = iWxCorpAccountService.findValidWeCorpAccount();
+// if(null != validWeCorpAccount){
+// validWeCorpAccount.setContactSecret(null);
+// validWeCorpAccount.setCorpSecret(null);
+// validWeCorpAccount.setProviderSecret(null);
+// }
+//
+// return AjaxResult.success(validWeCorpAccount);
+// }
+
+
+
+// /**
+// * 扫码登录微信端回调
+// * @param auth_code 授权code
+// * @param agentId 应用id
+// * @return
+// */
+// @GetMapping("/wxQrLogin")
+// public AjaxResult wxQrLogin(String auth_code, String agentId){
+//
+// AjaxResult ajax = AjaxResult.success();
+//
+// WeUserInfoDto userInfo = weUserClient.getUserInfo(auth_code, agentId);
+// if( null != userInfo){
+// SysUser sysUser = sysUserService.selectUserByCorpUserId(userInfo.getUserId());
+// if (null != sysUser){
+// String token = loginService.noPwdLogin(sysUser.getUserName());
+// ajax.put(Constants.TOKEN, token);
+// }else {
+// return AjaxResult.error("请绑定后再登录");
+// }
+// }
+// return ajax;
+// }
+
+
+
+// /**
+// * 通过企业id和企业密钥登录
+// * @param corpId
+// * @param corpSecret
+// * @return
+// */
+// @GetMapping("/corpLogin")
+// public AjaxResult corpLogin(String corpId,String corpSecret){
+//
+// WeCorpAccount weCorpAccount = iWxCorpAccountService.getOne(new LambdaQueryWrapper()
+// .eq(WeCorpAccount::getCorpId, corpId)
+// .eq(WeCorpAccount::getCorpSecret, corpSecret)
+// .eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
+//
+//
+// if(weCorpAccount == null){
+//
+// return AjaxResult.error("当前企业id与企业密码不匹配或不存在");
+// }
+//
+// return AjaxResult.success(
+// loginService.noPwdLogin(weCorpAccount.getCorpAccount())
+// );
+// }
}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysProfileController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysProfileController.java
index c589ead67327f270554e6b210fccf33afb8779d3..4938d26575a8e13f4fa58da2e43d9b936448748c 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysProfileController.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysProfileController.java
@@ -38,6 +38,11 @@ public class SysProfileController extends BaseController
@Autowired
private TokenService tokenService;
+
+ @Autowired
+ private RuoYiConfig ruoYiConfig;
+
+
/**
* 个人信息
*/
@@ -80,25 +85,30 @@ public class SysProfileController extends BaseController
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword)
{
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- String userName = loginUser.getUsername();
- String password = loginUser.getPassword();
- if (!SecurityUtils.matchesPassword(oldPassword, password))
- {
- return AjaxResult.error("修改密码失败,旧密码错误");
- }
- if (SecurityUtils.matchesPassword(newPassword, password))
- {
- return AjaxResult.error("新密码不能与旧密码相同");
- }
- if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
- {
- // 更新缓存用户密码
- loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
- tokenService.setLoginUser(loginUser);
- return AjaxResult.success();
+
+ if(ruoYiConfig.isEditPwd()){
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ String userName = loginUser.getUsername();
+ String password = loginUser.getPassword();
+ if (!SecurityUtils.matchesPassword(oldPassword, password))
+ {
+ return AjaxResult.error("修改密码失败,旧密码错误");
+ }
+ if (SecurityUtils.matchesPassword(newPassword, password))
+ {
+ return AjaxResult.error("新密码不能与旧密码相同");
+ }
+ if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
+ {
+ // 更新缓存用户密码
+ loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
+ tokenService.setLoginUser(loginUser);
+ return AjaxResult.success();
+ }
+ return AjaxResult.error("修改密码异常,请联系管理员");
+ }else{
+ return AjaxResult.error("当前环境密码不可修改");
}
- return AjaxResult.error("修改密码异常,请联系管理员");
}
/**
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
index 41c2c59c94c06d845bad23cd6e3706937a615769..8a3f0fd8097510bb75e1138fab1bf7ba63cb3071 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
@@ -1,5 +1,6 @@
package com.linkwechat.web.controller.system;
+import cn.hutool.core.collection.CollectionUtil;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.UserConstants;
import com.linkwechat.common.core.controller.BaseController;
@@ -17,19 +18,23 @@ import com.linkwechat.framework.web.service.TokenService;
import com.linkwechat.system.service.ISysPostService;
import com.linkwechat.system.service.ISysRoleService;
import com.linkwechat.system.service.ISysUserService;
+import com.linkwechat.wecom.domain.WeUser;
+import com.linkwechat.wecom.service.IWeUserService;
import io.swagger.annotations.ApiOperation;
+import io.vertx.ext.auth.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户信息
- *
+ *
* @author ruoyi
*/
@RestController
@@ -48,6 +53,10 @@ public class SysUserController extends BaseController
@Autowired
private TokenService tokenService;
+
+ @Autowired
+ private IWeUserService iWeUserService;
+
/**
* 获取用户列表
*/
@@ -56,6 +65,7 @@ public class SysUserController extends BaseController
public TableDataInfo list(SysUser user)
{
startPage();
+
List list = userService.selectUserList(user);
return getDataTable(list);
}
@@ -193,4 +203,27 @@ public class SysUserController extends BaseController
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user));
}
+
+
+ @GetMapping("/findCurrentLoginUser")
+ public AjaxResult findCurrentLoginUser(HttpServletRequest request){
+ String userId="";
+ LoginUser loginUser = tokenService.getLoginUser(request);
+ if(null != loginUser){
+ SysUser user = loginUser.getUser();
+ if(null != user){
+ List weUsers = iWeUserService.getList(WeUser.builder()
+ .mobile(user.getPhonenumber())
+ .build());
+ if(CollectionUtil.isNotEmpty(weUsers)){
+ userId=weUsers.get(0).getUserId();
+
+ }
+ }
+
+ }
+ return AjaxResult.success(userId);
+ }
+
+
}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
new file mode 100644
index 0000000000000000000000000000000000000000..95ca6259a2310033d1f0dd3d367de0305a206d27
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
@@ -0,0 +1,71 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.linkwechat.common.core.domain.entity.WeCorpAccount;
+import com.linkwechat.common.utils.wecom.WxCryptUtil;
+import com.linkwechat.web.controller.common.CommonController;
+import com.linkwechat.wecom.service.IWeCorpAccountService;
+import com.linkwechat.wecom.service.event.WeEventPublisherService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author danmo
+ * @description 企微回调通知接口
+ * @date 2020/11/6 17:31
+ **/
+@Api(tags = "企微回调通知")
+@Slf4j
+@RestController
+@RequestMapping("/wecom/callback")
+public class WeCallBackController extends CommonController {
+ @Autowired
+ private WeEventPublisherService weEventPublisherService;
+
+ @Autowired
+ private IWeCorpAccountService weCorpAccountService;
+
+ @ApiModelProperty("post数据接收")
+ @PostMapping(value = "/recive/{corpId}")
+ public String recive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
+ String timestamp, String nonce,@PathVariable("corpId") String corpId) {
+ WeCorpAccount corpAccount = weCorpAccountService.getCorpAccountByCorpId(corpId);
+ WxCryptUtil wxCryptUtil = new WxCryptUtil(corpAccount.getToken(), corpAccount.getEncodingAesKey(), corpId);
+ try {
+ String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
+ weEventPublisherService.register(decrypt);
+ return decrypt;
+ } catch (Exception e) {
+ e.printStackTrace();;
+ String sRespData = WxCryptUtil.getTextRespData("success");
+ return wxCryptUtil.encrypt(sRespData);
+ }
+ }
+
+ @ApiModelProperty("get数据校验")
+ @GetMapping(value = "/recive/{corpId}")
+ public String recive(HttpServletRequest request,@PathVariable("corpId") String corpId) {
+ // 微信加密签名
+ String sVerifyMsgSig = request.getParameter("msg_signature");
+ // 时间戳
+ String sVerifyTimeStamp = request.getParameter("timestamp");
+ // 随机数
+ String sVerifyNonce = request.getParameter("nonce");
+ // 随机字符串
+ String sVerifyEchoStr = request.getParameter("echostr");
+
+ WeCorpAccount corpAccount = weCorpAccountService.getCorpAccountByCorpId(corpId);
+ WxCryptUtil wxCryptUtil = new WxCryptUtil(corpAccount.getToken(), corpAccount.getEncodingAesKey(), corpId);
+ try {
+ return wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr);
+ } catch (Exception e) {
+ return "error";
+ }
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
index df146fd562790bae963bd927d4a759f7fe5b024a..fa7636c87de33d810abc9314eaf5d20cad5c7565 100644
--- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
@@ -1,17 +1,23 @@
package com.linkwechat.web.controller.wecom;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCategory;
+import com.linkwechat.wecom.domain.vo.WeCategoryVo;
import com.linkwechat.wecom.service.IWeCategoryService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -22,63 +28,79 @@ import java.util.List;
*/
@RestController
@RequestMapping("/wecom/category")
+@Api(tags = "企业微信素材分类")
public class WeCategoryController extends BaseController {
@Autowired
private IWeCategoryService weCategoryService;
- /**
- * 类目树
- */
- @PreAuthorize("@ss.hasPermi('wechat:category:list')")
+
+
+// @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list")
@ApiOperation("类目树")
- public List extends Tree>> list(@RequestParam("mediaType") String mediaType) {
- return weCategoryService.findWeCategoryByMediaType(mediaType);
+ public AjaxResult list(@RequestParam("mediaType") String mediaType) {
+ return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(mediaType));
}
/**
* 通过id查询类目详细信息
*/
- @PreAuthorize("@ss.hasPermi('wechat:category:query')")
+// @PreAuthorize("@ss.hasPermi('wechat:category:query')")
@GetMapping(value = "/{id}")
@ApiOperation("通过id查询类目详细信息")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return AjaxResult.success(weCategoryService.findWeCategoryById(id));
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return AjaxResult.success(weCategoryService.getById(id));
}
/**
* 添加类目
*/
- @PreAuthorize("@ss.hasPermi('wechat:category:add')")
+// @PreAuthorize("@ss.hasPermi('wechat:category:add')")
@Log(title = "添加类目", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("添加类目")
- public AjaxResult add(@RequestBody WeCategory category) {
- return toAjax(weCategoryService.insertWeCategory(category));
+ public AjaxResult add(@Validated @RequestBody WeCategory category) {
+ weCategoryService.insertWeCategory(category);
+ return AjaxResult.success();
}
/**
* 更新目录
*/
- @PreAuthorize("@ss.hasPermi('wechat:category:edit')")
+// @PreAuthorize("@ss.hasPermi('wechat:category:edit')")
@Log(title = "更新目录", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("更新目录")
- public AjaxResult edit(@RequestBody WeCategory category) {
- return toAjax(weCategoryService.updateWeCategory(category));
+ public AjaxResult edit(@Validated @RequestBody WeCategory category) {
+ weCategoryService.updateWeCategory(category);
+ return AjaxResult.success();
}
/**
* 删除类目
*/
- @PreAuthorize("@ss.hasPermi('wechat:category:remove')")
+// @PreAuthorize("@ss.hasPermi('wechat:category:remove')") Constants.DELETE_CODE
@Log(title = "删除类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除类目")
public AjaxResult remove(@PathVariable Long[] ids) {
- return toAjax(weCategoryService.deleteWeCategoryByIds(ids));
+ weCategoryService.deleteWeCategoryById(ids);
+// List categorys=new ArrayList<>();
+// for (Long id:ids) {
+// categorys.add(
+// WeCategory.builder()
+// .id(id)
+// .delFlag("55")
+// .build()
+// );
+// }
+// weCategoryService.updateBatchById(categorys);
+
+ return AjaxResult.success();
}
+
+
}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
new file mode 100644
index 0000000000000000000000000000000000000000..d9450b2bbd3516446308aa613b20a080dbe997bb
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
@@ -0,0 +1,68 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.wecom.domain.dto.WeChatCollectionDto;
+import com.linkwechat.wecom.domain.vo.WeChatSideVo;
+import com.linkwechat.wecom.service.IWeChatCollectionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 聊天工具 侧边栏栏 素材收藏
+ *
+ * @author kwen
+ */
+@RequestMapping(value = "/wecom/chat/collection")
+@RestController
+public class WeChatCollectionController extends BaseController {
+
+
+ @Autowired
+ private IWeChatCollectionService weChatCollectionService;
+
+
+ /**
+ * 添加收藏
+ */
+ //@PreAuthorize("@ss.hasPermi('chat:collection:add')")
+ @Log(title = "添加收藏", businessType = BusinessType.INSERT)
+ @PostMapping("addCollection")
+ public AjaxResult addCollection(@RequestBody WeChatCollectionDto chatCollectionDto) {
+ boolean b =
+ weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId());
+ if(weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId())){
+ return AjaxResult.success();
+ }
+ return AjaxResult.success("当前素材不可重复收藏");
+ }
+
+
+ /**
+ * 取消收藏
+ */
+ // @PreAuthorize("@ss.hasPermi('chat:collection:delete')")
+ // @Log(title = "取消收藏", businessType = BusinessType.UPDATE)
+ @PostMapping(value = "cancleCollection")
+ public AjaxResult cancleCollection(@RequestBody WeChatCollectionDto chatCollectionDto) {
+ return toAjax(weChatCollectionService.cancleCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId()));
+ }
+
+ /**
+ * 收藏列表
+ */
+ // @PreAuthorize("@ss.hasPermi('chat:collection:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(@RequestParam(value = "userId") String userId,@RequestParam(value = "keyword",required = false) String keyword) {
+ startPage();
+ List collections = weChatCollectionService.collections(userId,keyword);
+ return getDataTable(collections);
+ }
+
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatContactMsgController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatContactMsgController.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd2c3d238fa4ef0e3b437522df39dcc4426c5000
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatContactMsgController.java
@@ -0,0 +1,168 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.alibaba.fastjson.JSONObject;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.wecom.domain.WeChatContactMsg;
+import com.linkwechat.wecom.domain.vo.WeChatContactMsgVo;
+import com.linkwechat.wecom.service.IWeChatContactMsgService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 会话消息Controller
+ *
+ * @author ruoyi
+ * @date 2021-07-28
+ */
+@Api(tags = "会话存档管理")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/chat/msg" )
+public class WeChatContactMsgController extends BaseController {
+
+ private final IWeChatContactMsgService iWeChatContactMsgService;
+
+ /**
+ * 查询会话消息列表
+ */
+ @ApiOperation("查询会话消息列表")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:list')")
+ @GetMapping("/list")
+ public TableDataInfo> list(WeChatContactMsg weChatContactMsg) {
+ startPage();
+ List list = iWeChatContactMsgService.queryList(weChatContactMsg);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出会话消息列表
+ */
+ @ApiOperation("导出会话消息列表")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:export')" )
+ @Log(title = "会话消息" , businessType = BusinessType.EXPORT)
+ @GetMapping("/export" )
+ public AjaxResult export(WeChatContactMsg weChatContactMsg) {
+ List list = iWeChatContactMsgService.queryList(weChatContactMsg);
+ ExcelUtil util = new ExcelUtil(WeChatContactMsg.class);
+ return util.exportExcel(list, "msg" );
+ }
+
+ /**
+ * 获取会话消息详细信息
+ */
+ @ApiOperation("获取会话消息详细信息")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:query')" )
+ @GetMapping(value = "/{id}" )
+ public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+ return AjaxResult.success(iWeChatContactMsgService.getById(id));
+ }
+
+ /**
+ * 新增会话消息
+ */
+ @ApiOperation("新增会话消息")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:add')" )
+ @Log(title = "会话消息" , businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody WeChatContactMsg weChatContactMsg) {
+ return toAjax(iWeChatContactMsgService.save(weChatContactMsg) ? 1 : 0);
+ }
+
+ /**
+ * 修改会话消息
+ */
+ @ApiOperation("修改会话消息")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:edit')" )
+ @Log(title = "会话消息" , businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody WeChatContactMsg weChatContactMsg) {
+ return toAjax(iWeChatContactMsgService.updateById(weChatContactMsg) ? 1 : 0);
+ }
+
+ /**
+ * 删除会话消息
+ */
+ @ApiOperation("删除会话消息")
+ @PreAuthorize("@ss.hasPermi('linkwechat:msg:remove')" )
+ @Log(title = "会话消息" , businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}" )
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return toAjax(iWeChatContactMsgService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+ }
+
+ /**
+ * 外部联系人/单聊 会话列表
+ */
+ @ApiOperation("外部联系人 会话列表")
+ @Log(title = "外部联系人 会话列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectExternalChatList/{fromId}" )
+ public AjaxResult> selectExternalChatList(@PathVariable("fromId") String fromId) {
+ return AjaxResult.success(iWeChatContactMsgService.selectExternalChatList(fromId));
+ }
+
+ /**
+ * 外部联系人/单聊 会话列表
+ */
+ @ApiOperation("单聊 会话列表")
+ @Log(title = "单聊 会话列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectAloneChatList" )
+ public AjaxResult> selectAloneChatList(WeChatContactMsg weChatContactMsg) {
+ return AjaxResult.success(iWeChatContactMsgService.selectAloneChatList(weChatContactMsg));
+ }
+
+ /**
+ * 内部联系人 会话列表
+ */
+ @ApiOperation("内部联系人 会话列表")
+ @Log(title = "内部联系人 会话列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectInternalChatList/{fromId}" )
+ public AjaxResult> selectInternalChatList(@PathVariable("fromId") String fromId) {
+ return AjaxResult.success(iWeChatContactMsgService.selectInternalChatList(fromId));
+ }
+
+ /**
+ * 群聊 会话列表
+ */
+ @ApiOperation("群聊 会话列表")
+ @Log(title = "群聊 会话列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectGroupChatList/{fromId}" )
+ public AjaxResult> selectGroupChatList(@PathVariable("fromId") String fromId) {
+ return AjaxResult.success(iWeChatContactMsgService.selectGroupChatList(fromId));
+ }
+
+ /**
+ * 全文检索 会话列表
+ */
+ @ApiOperation("全文检索 会话列表")
+ @Log(title = "全文检索 会话列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectFullSearchChatList" )
+ public TableDataInfo> selectFullSearchChatList(WeChatContactMsg weChatContactMsg) {
+ startPage();
+ List list = iWeChatContactMsgService.selectFullSearchChatList(weChatContactMsg);
+ return getDataTable(list);
+ }
+
+ /**
+ * 全文检索 会话列表
+ */
+ @ApiOperation("全文检索 导出列表")
+ @Log(title = "全文检索 导出列表" , businessType = BusinessType.OTHER)
+ @GetMapping("/selectFullSearchChatList/export" )
+ public AjaxResult fullSearchChatListExport(WeChatContactMsg weChatContactMsg) {
+ List list = iWeChatContactMsgService.selectFullSearchChatList(weChatContactMsg);
+ ExcelUtil util = new ExcelUtil(WeChatContactMsgVo.class);
+ return util.exportExcel(list, "msg" );
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
new file mode 100644
index 0000000000000000000000000000000000000000..09e0fde82e13cb0aec32c70f51582af3c7747773
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
@@ -0,0 +1,119 @@
+package com.linkwechat.web.controller.wecom;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.enums.MediaType;
+import com.linkwechat.wecom.domain.WeChatItem;
+import com.linkwechat.wecom.domain.WeMaterial;
+import com.linkwechat.wecom.domain.dto.WeChatItemDto;
+import com.linkwechat.wecom.domain.vo.WeChatSideVo;
+import com.linkwechat.wecom.service.IWeChatItemService;
+import com.linkwechat.wecom.service.IWeMaterialService;
+import com.linkwechat.wecom.service.IWePosterService;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 聊天工具侧边栏
+ *
+ * @author kewen
+ */
+@RequestMapping(value = "/wecom/chat/item")
+@RestController
+public class WeChatItemController extends BaseController {
+
+ @Autowired
+ private IWeChatItemService weChatItemService;
+
+ @Autowired
+ private IWeMaterialService materialService;
+
+ @Resource
+ private IWePosterService wePosterService;
+
+
+
+
+
+ // @PreAuthorize("@ss.hasPermi('wecom:material:list')")
+ @GetMapping("/mList")
+ @ApiOperation("获取侧边栏选中或者未选中素材")
+ public TableDataInfo mList(@RequestParam(value = "categoryId", required = false) String categoryId
+ , @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) {
+ startPage();
+ List list;
+ if(StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())){
+ list = wePosterService.list(StringUtils.isBlank(categoryId)?null:Long.valueOf(categoryId),search).stream().map(wePoster -> {
+ WeMaterial weMaterial = new WeMaterial();
+ weMaterial.setMaterialName(wePoster.getTitle());
+ weMaterial.setMaterialUrl(wePoster.getSampleImgPath());
+ weMaterial.setCategoryId(wePoster.getCategoryId());
+ weMaterial.setId(wePoster.getId());
+ return weMaterial;
+ }).collect(Collectors.toList());
+ }else {
+ list = materialService.findWeMaterials(categoryId, search,mediaType);
+ }
+
+ if(CollectionUtil.isNotEmpty(list)){
+ List weChatItems = weChatItemService.list(new LambdaQueryWrapper()
+ .in(WeChatItem::getMaterialId,list.stream().map(WeMaterial::getId).collect(Collectors.toList())));
+ if(CollectionUtil.isNotEmpty(weChatItems)){
+ list.stream().forEach(k->{
+ k.setIsCheck(
+ weChatItems.stream().filter(item -> item.getMaterialId()
+ .equals(k.getId())).findFirst().isPresent()?true:false
+ );
+ });
+ }
+ }
+
+ return getDataTable(list);
+ }
+
+
+ /**
+ * 侧边栏抓取素材
+ */
+// @PreAuthorize("@ss.hasPermi('chat:item:add')")
+ @Log(title = "侧边栏抓取素材", businessType = BusinessType.INSERT)
+ @PutMapping
+ public AjaxResult add(@RequestBody WeChatItemDto chatItemDto) {
+ return toAjax(weChatItemService.checkItems(chatItemDto));
+ }
+
+ /**
+ * h5素材列表
+ */
+ //@PreAuthorize("@ss.hasPermi('chat:item:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(@RequestParam(value = "sideId") Long sideId
+ , @RequestParam(value = "keyword", required = false) String keyword,@RequestParam(value = "mediaType") String mediaType,@RequestParam(value = "userId") String userId) {
+ startPage();
+ List weChatSideVos;
+ if(mediaType.equals("5")){
+ weChatSideVos=weChatItemService.findChatPostsItems(sideId,keyword,mediaType,userId);
+ }else{
+ weChatSideVos
+ = weChatItemService.chatItems(sideId,keyword,mediaType,userId);
+ }
+ return getDataTable(weChatSideVos);
+ }
+
+
+
+
+
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatSideController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatSideController.java
new file mode 100644
index 0000000000000000000000000000000000000000..9bc6eddf6532697e9bfbb4a0021fdbff5d242e9e
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatSideController.java
@@ -0,0 +1,60 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.wecom.domain.WeChatSide;
+import com.linkwechat.wecom.service.IWeChatSideService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 聊天工具侧边栏
+ *
+ * @author kewen
+ */
+@RequestMapping(value = "/wecom/chat/side")
+@RestController
+public class WeChatSideController extends BaseController {
+
+
+ @Autowired
+ public IWeChatSideService weChatSideService;
+
+ /**
+ * 群发侧边栏列表
+ */
+// @PreAuthorize("@ss.hasPermi('chat:side:list')")
+ @GetMapping("/list")
+ public TableDataInfo list() {
+ startPage();
+ List weChatSides = weChatSideService.chatSides("0");
+ return getDataTable(weChatSides);
+ }
+
+ /**
+ * 更新侧边栏信息
+ */
+// @PreAuthorize("@ss.hasPermi('chat:side:edit')")
+ @Log(title = "更新侧边栏信息", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody WeChatSide weChatSide) {
+ return toAjax(weChatSideService.updateWeChatSide(weChatSide));
+ }
+
+ /**
+ * 群发侧边栏列表
+ */
+ @GetMapping("/h5List")
+ public TableDataInfo h5List() {
+ startPage();
+ List weChatSides = weChatSideService.chatSides("1");
+ return getDataTable(weChatSides);
+ }
+
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityGroupSopController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityGroupSopController.java
new file mode 100644
index 0000000000000000000000000000000000000000..c00d8ec20fa0ea43a663c96f0c5d515b20e40de6
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityGroupSopController.java
@@ -0,0 +1,153 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.constant.HttpStatus;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.wecom.domain.WeGroupSop;
+import com.linkwechat.wecom.domain.dto.WeGroupSopDto;
+import com.linkwechat.wecom.domain.vo.WeGroupSopVo;
+import com.linkwechat.wecom.service.IWeGroupSopService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 社区运营 - 群sop controller
+ */
+@Api(description = "新客自动拉群 Controller")
+@RestController
+@RequestMapping(value = "/wecom/communityGroupSop")
+public class WeCommunityGroupSopController extends BaseController {
+
+ @Autowired
+ private IWeGroupSopService groupSopService;
+
+ /**
+ * 通过过滤条件获取群sop列表
+ *
+ * @param ruleName 规则名称
+ * @param createBy 创建者
+ * @param beginTime 创建区间 - 开始时间
+ * @param endTime 创建区间 - 结束时间
+ * @return 群sop规则列表
+ */
+ @ApiOperation(value = "通过过滤条件获取群sop列表", httpMethod = "GET")
+// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:list')")
+ @GetMapping(path = "/list")
+ public TableDataInfo> getSopList(
+ @RequestParam(value = "ruleName", required = false) String ruleName,
+ @RequestParam(value = "createBy", required = false) String createBy,
+ @RequestParam(value = "beginTime", required = false) String beginTime,
+ @RequestParam(value = "endTime", required = false) String endTime
+ )
+ {
+ startPage();
+ List groupSopVoList = groupSopService.getGroupSopList(ruleName, createBy, beginTime, endTime);
+ return getDataTable(groupSopVoList);
+ }
+
+ /**
+ * 新增SOP规则
+ *
+ * @param groupSopDto 更新数据
+ * @return 结果
+ */
+ @ApiOperation(value = "新增SOP规则", httpMethod = "POST")
+// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')")
+ @PostMapping(path = "/")
+ public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) {
+
+ WeGroupSop weGroupSop = new WeGroupSop();
+ BeanUtils.copyProperties(groupSopDto, weGroupSop);
+
+ if (groupSopService.isNameOccupied(weGroupSop)) {
+ return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
+ }
+ weGroupSop.setCreateBy(SecurityUtils.getUsername());
+ // 群聊id列表
+ List groupIdList = groupSopDto.getChatIdList();
+ // 素材URL
+ List materialIdList = groupSopDto.getMaterialIdList();
+ // 上传的图片的URl列表
+ List picList = groupSopDto.getPicList();
+ int affectedRows = groupSopService.addGroupSop(weGroupSop, groupIdList, materialIdList, picList);
+ if (affectedRows > 0) {
+ // 添加成功后进行异步消息推送
+ groupSopService.sendMessage(groupIdList);
+ }
+ return toAjax(affectedRows);
+ }
+
+ /**
+ * 通过规则id获取sop规则
+ *
+ * @param ruleId 规则id
+ * @return 结果
+ */
+ @ApiOperation(value = "通过规则id获取sop规则详情", httpMethod = "GET")
+// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:query')")
+ @GetMapping(path = "/{ruleId}")
+ public AjaxResult getGroupSop(@PathVariable("ruleId") Long ruleId) {
+ WeGroupSopVo groupSopVo = groupSopService.getGroupSopById(ruleId);
+ if (null == groupSopVo) {
+ return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在");
+ }
+ return AjaxResult.success(groupSopVo);
+ }
+
+ /**
+ * 更改SOP规则
+ *
+ * @param ruleId SOP规则 id
+ * @param groupSopDto 更新数据
+ * @return 结果
+ */
+ @ApiOperation(value = "更改SOP规则", httpMethod = "PUT")
+// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:edit')")
+ @PutMapping(path = "/{ruleId}")
+ public AjaxResult updateGroupSop(@PathVariable Long ruleId, @Validated @RequestBody WeGroupSopDto groupSopDto) {
+ // 校验是否存在
+ if (null == groupSopService.getGroupSopById(ruleId)) {
+ return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在");
+ }
+ WeGroupSop weGroupSop = new WeGroupSop();
+ weGroupSop.setRuleId(ruleId);
+ BeanUtils.copyProperties(groupSopDto, weGroupSop);
+
+ // 校验规则名是否可用
+ if (groupSopService.isNameOccupied(weGroupSop)) {
+ return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
+ }
+
+ weGroupSop.setUpdateBy(SecurityUtils.getUsername());
+ // 群聊id列表
+ List groupIdList = groupSopDto.getChatIdList();
+ // 素材id列表
+ List materialIdList = groupSopDto.getMaterialIdList();
+ // 上传的图片的URl列表
+ List picList = groupSopDto.getPicList();
+ return toAjax(groupSopService.updateGroupSop(weGroupSop, groupIdList, materialIdList, picList));
+ }
+
+ /**
+ * 根据id列表批量删除群sop规则
+ *
+ * @param ids 群sop规则列表
+ * @return 结果
+ */
+ @ApiOperation(value = "根据id列表批量删除群sop规则", httpMethod = "DELETE")
+// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:remove')")
+ @DeleteMapping(path = "/{ids}")
+ public AjaxResult batchDeleteSopRule(@PathVariable("ids") Long[] ids) {
+ return toAjax(groupSopService.batchRemoveGroupSopByIds(ids));
+ }
+
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityH5Controller.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityH5Controller.java
new file mode 100644
index 0000000000000000000000000000000000000000..94ffc7cdeb9e3c6de62bb90248a0f80217adeef7
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityH5Controller.java
@@ -0,0 +1,121 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysUser;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.CommunityTaskType;
+import com.linkwechat.system.service.ISysUserService;
+import com.linkwechat.wecom.domain.WeKeywordGroupTask;
+import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
+import com.linkwechat.wecom.service.IWeGroupSopService;
+import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 社区运营H5接口
+ *
+ * @Author Hang
+ * @Date 2021/3/24 10:54
+ */
+@RestController
+@RequestMapping(value = "/wecom/community/h5")
+public class WeCommunityH5Controller extends BaseController {
+
+ @Autowired
+ IWePresTagGroupTaskService tagGroupTaskService;
+
+ @Autowired
+ IWeGroupSopService sopService;
+
+ @Autowired
+ IWeCommunityKeywordToGroupService keywordToGroupService;
+
+ @Autowired
+ ISysUserService userService;
+
+ /**
+ * 获取任务对应的执行人列表
+ * @param taskId 任务id
+ * @param type 任务类型 1:标签建群任务 2:sop任务
+ * @return
+ */
+ @GetMapping("/scope/{taskId}")
+ public AjaxResult getTaskScopeList(@PathVariable("taskId") Long taskId, @RequestParam(value = "type") Integer type) {
+ if (type.equals(CommunityTaskType.TAG.getType())) {
+ return AjaxResult.success(tagGroupTaskService.getScopeListByTaskId(taskId));
+ } else {
+ return AjaxResult.success(sopService.getScopeListByRuleId(taskId));
+ }
+ }
+
+ /**
+ * h5页面根据员工id获取老客标签建群和群sop任务信息
+ *
+ * @param emplId 员工id
+ * @param type 数据类型,0:全部数据 1:老客标签建群数据 2:群SOP数据
+ * @return
+ */
+ @GetMapping("/{emplId}")
+ public AjaxResult getEmplTask(@PathVariable("emplId") String emplId, @RequestParam(value = "type") Integer type) {
+ AjaxResult res = AjaxResult.success();
+ if (type.equals(CommunityTaskType.TAG.getType())) {
+ // 老客标签建群数据
+ res.put("todo", tagGroupTaskService.getFollowerTaskList(emplId, 0));
+ res.put("done", tagGroupTaskService.getFollowerTaskList(emplId, 1));
+ } else if (type.equals(CommunityTaskType.SOP.getType())) {
+ // 群SOP数据
+ res.put("todo", sopService.getEmplTaskList(emplId, false));
+ res.put("done", sopService.getEmplTaskList(emplId, true));
+ } else {
+ // 全部数据
+ List todoList = new ArrayList();
+ List doneList = new ArrayList();
+ todoList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 0));
+ todoList.addAll(sopService.getEmplTaskList(emplId, false));
+ res.put("todo", todoList);
+ doneList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 1));
+ doneList.addAll(sopService.getEmplTaskList(emplId, true));
+ res.put("done", doneList);
+ }
+ SysUser user = userService.selectUserByUserName(emplId);
+ boolean isAdmin = user != null && user.isAdmin();
+ res.put("isAdmin", isAdmin);
+ return res;
+ }
+
+ /**
+ * 员工发送老客标签建群任务信息或者发送sop到其客户群之后,变更其任务状态
+ *
+ * @param taskId 老客标签建群时代表任务id,sop时,代表规则id
+ * @param emplId 老客标签建群时代表员工id,sop时,代表群主
+ * @param type 类型 0:老客标签建群 1:sop
+ * @return 结果
+ */
+ @GetMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) {
+ if (type.equals(0)) {
+
+ return toAjax(tagGroupTaskService.updateFollowerTaskStatus(taskId, emplId));
+ } else {
+ return toAjax(sopService.updateChatSopStatus(taskId, emplId));
+ }
+ }
+
+ /**
+ * 用于支持H5页面的名称和关键字检索
+ *
+ * @param word 过滤字符
+ * @return 结果
+ */
+ @GetMapping(path = "/filter")
+ public TableDataInfo filter(@RequestParam("word") String word) {
+ startPage();
+ List taskList = keywordToGroupService.filterByNameOrKeyword(word);
+ return getDataTable(taskList);
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityKeywordGroupController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityKeywordGroupController.java
new file mode 100644
index 0000000000000000000000000000000000000000..3e6517d0c96b3cba53b71a1064165af4246e5a16
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityKeywordGroupController.java
@@ -0,0 +1,101 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.wecom.domain.WeKeywordGroupTask;
+import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 关键词拉群controller
+ */
+@Api(tags = "关键词拉群")
+@RestController
+@RequestMapping(value = "/wecom/communityKeywordGroup")
+public class WeCommunityKeywordGroupController extends BaseController {
+
+ @Autowired
+ private IWeCommunityKeywordToGroupService service;
+
+
+ /**
+ * 根据过滤条件获取关键词拉群任务列表
+ */
+ @ApiOperation(value = "获取关键词拉群任务列表")
+// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')")
+ @GetMapping(path = "/list")
+ public TableDataInfo> list(WeKeywordGroupTask task) {
+ startPage();
+ List taskList = service.getTaskList(task);
+ return getDataTable(taskList);
+ }
+
+ /**
+ * 根据id获取任务详情
+ *
+ * @param taskId 任务id
+ * @return 任务详情
+ */
+ @ApiOperation(value = "获取任务详情")
+ // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')")
+ @GetMapping(path = "/{taskId}")
+ public AjaxResult getTask(@ApiParam("任务id") @PathVariable("taskId") Long taskId) {
+ return AjaxResult.success(service.getTaskById(taskId));
+ }
+
+ /**
+ * 添加新任务
+ *
+ * @param task 添加任务所需的数据
+ * @return 结果
+ */
+ @ApiOperation(value = "添加新任务")
+ // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')")
+ @PostMapping(path = "/")
+ public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTask task) {
+ if (service.isNameOccupied(task)) {
+ return AjaxResult.error("关键词拉群任务名称"+ task.getTaskName() +"已存在");
+ }
+ task.setCreateBy(SecurityUtils.getUsername());
+ task.setCreateTime(new Date());
+ return toAjax(service.addTask(task));
+ }
+
+ /**
+ * 根据id及更新数据对指定任务进行更新
+ */
+ @ApiOperation(value = "更新任务")
+ // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')")
+ @PutMapping("/{taskId}")
+ public AjaxResult updateTask(
+ @ApiParam("任务id") @PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTask task) {
+ task.setTaskId(taskId);
+ task.setUpdateBy(SecurityUtils.getUsername());
+ task.setUpdateTime(new Date());
+ return toAjax(service.updateTask(task));
+ }
+
+ /**
+ * 通过id列表批量删除任务
+ *
+ * @param ids id列表
+ * @return 结果
+ */
+ @ApiOperation(value = "批量删除任务")
+ // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')")
+ @DeleteMapping(path = "/{ids}")
+ public AjaxResult batchDeleteTask(@ApiParam("待删除任务id数组") @PathVariable("ids") Long[] ids) {
+ return toAjax(service.batchRemoveTaskByIds(ids));
+ }
+
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
new file mode 100644
index 0000000000000000000000000000000000000000..706a1758e298e9e3f34eeb388b61076add39c55f
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
@@ -0,0 +1,164 @@
+package com.linkwechat.web.controller.wecom;
+
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.HttpStatus;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.file.FileUtils;
+import com.linkwechat.wecom.domain.WeCommunityNewGroup;
+import com.linkwechat.wecom.domain.WeEmpleCode;
+import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
+import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
+import com.linkwechat.wecom.service.IWeCommunityNewGroupService;
+import com.linkwechat.wecom.service.IWeEmpleCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 社群运营 新客自动拉群 Controller
+ *
+ * @author kewen
+ * @date 2021-02-19
+ */
+@Api(tags = "新客自动拉群 Controller")
+@RestController
+@RequestMapping(value = "/wecom/communityNewGroup")
+public class WeCommunityNewGroupController extends BaseController {
+
+ @Autowired
+ private IWeCommunityNewGroupService weCommunityNewGroupService;
+
+ @Autowired
+ private IWeEmpleCodeService weEmpleCodeService;
+
+ /**
+ * 新增新客自动拉群
+ */
+ @ApiOperation(value = "新增新客自动拉群", httpMethod = "POST")
+ // @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:add')")
+ @Log(title = "新客自动拉群", businessType = BusinessType.INSERT)
+ @PostMapping("/")
+ public AjaxResult add(@RequestBody @Validated WeCommunityNewGroupDto communityNewGroupDto) {
+ return toAjax(weCommunityNewGroupService.add(communityNewGroupDto));
+ }
+
+ /**
+ * 单个下载
+ *
+ * @param id 待下载员工活码
+ * @param request 请求
+ * @param response 响应
+ */
+ @ApiOperation(value = "员工活码下载", httpMethod = "GET")
+ // @PreAuthorize("@ss.hasPermi('wecom:code:download')")
+ @Log(title = "员工活码下载", businessType = BusinessType.OTHER)
+ @GetMapping("/download")
+ public void download(String id, HttpServletRequest request, HttpServletResponse response) {
+ Optional communityNewGroupVo = weCommunityNewGroupService.selectWeCommunityNewGroupById(Long.valueOf(id));
+ communityNewGroupVo.ifPresent(e -> {
+ try {
+ WeEmpleCode empleCode = weEmpleCodeService.selectWeEmpleCodeById(e.getEmplCodeId());
+ FileUtils.downloadFile(empleCode.getQrCode(), response.getOutputStream());
+ } catch (IOException exc) {
+ exc.printStackTrace();
+ }
+ });
+ }
+
+ /**
+ * 员工活码批量下载
+ *
+ * @param ids 新客自动拉群ids
+ * @param request 请求
+ * @param response 输出
+ */
+ @ApiOperation(value = "员工活码批量下载", httpMethod = "GET")
+ // @PreAuthorize("@ss.hasPermi('wecom:code:downloadBatch')")
+ @Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
+ @GetMapping("/downloadBatch")
+ public void downloadBatch(Long[] ids, HttpServletRequest request, HttpServletResponse response) {
+ List