.
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 dd3f625cadc4405d0d1978d05e16b89f272f0d75..123eb76207ad14455504b7f2a1fef180bff18fd7 100644
--- a/README.md
+++ b/README.md
@@ -1,35 +1,382 @@
-# LinkWeChat
+
+
-#### 平台介绍
+
-LinkWeChat,是一款基于企业微信的开源SCRM系统,为企业构建私域流量系统的综合解决方案,显著提升企业社交运营效率!
-
+
+[](https://gitee.com/LinkWeChat/link-wechat/stargazers)
+[](https://gitee.com/LinkWeChat/link-wechat/members)
+[](https://www.yuque.com/linkwechat/help/ci1n9p)
+[](https://gitee.com/LinkWeChat/link-wechat/blob/master/LICENSE)
+[](https://portal.mulanos.cn//)
-#### 软件架构
+[官方网站](https://www.pardigital.cn/) | [在线演示](http://demo.linkwechat.cn/) | [V2.5功能清单](https://docs.qq.com/sheet/DZWNkTXFNS0FLYWdu) | [最新动态](https://www.yuque.com/linkwechat/help/mn63mx)
+[项目手册](https://www.yuque.com/linkwechat/help) | [用户手册](https://docs.qq.com/pdf/DZUNsTkZiall3aWJz) | [常见问题](https://www.yuque.com/linkwechat/help/qk5gl6) | [需求收集表](https://docs.qq.com/sheet/DZWxGU0JGVFRVdWZV)
-- 前端采用Vue、Element UI。
-- 后端采用Spring Boot、Spring Security、Redis & Jwt。
-- 权限认证使用Jwt,支持多终端认证系统。
-- 支持加载动态权限菜单,多方式轻松权限控制。
-- 感谢[ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)提供后台框架
-#### 内置功能
+
+
+
+
+
-
+---
+ **【📣最近更新】LinkWeChat SAAS版 正式公测啦,如有问题欢迎提交 Issue,项目组将光速修复,点击立即体验~
**
-#### 在线体验
+ **如果您觉得我们的开源项目很有帮助,请点击 :star: Star 支持 LinkWeChat 开源团队:heart:
**
+ **还有什么想要的产品功能/技术支持/说明文档/友好的建议或意见,点击告诉我们~
**
-1. 演示演示:http://www.topitclub.cn/
-2. 交流群
+---
-
+# 版权声明
-#### 演示图
+开源不代表免费,LinkWeChat 遵循 [GPL-3.0](https://gitee.com/LinkWeChat/link-wechat/blob/master/LICENSE) 开源协议发布,并提供技术交流学习,但**绝不允许修改后和衍生的代码做为闭源的商业软件发布和销售!** 如果需要将本产品在本地进行任何附带商业化性质行为使用,**请联系项目负责人进行商业授权**,以遵守 GPL 协议保证您的正常使用。
+目前在国内 GPL 协议**具备合同特征,是一种民事法律行为** ,属于我国《合同法》调整的范围。LinkWeChat 项目团队保留一切诉讼权利。
+[相关案例:违反 GPL 协议赔偿 50 万,国内首例!](https://mp.weixin.qq.com/s/YQ6sNjbDS-P7BViLZIsaoA)
+LinkWeChat 开源团队拥有对本开源协议的最终解释权。
+# 一、 关于 LinkWeChat
+
+## 1.1 介绍
+
+> LinkWeChat, Link to WeChat.
+
+基于人工智能的企业微信 SCRM 系统——LinkWeChat基于企业微信开放能力,不仅集成了企微基础的客户管理和后台管理功能,而且通过引流获客、客情维系、社群运营等灵活高效的客户运营模块,让客户与企业之间建立强链接关系,同时进一步通过多元化的客户营销工具,帮助企业提高客户运营效率,强化营销能力,拓展盈利空间,是企业私域流量管理与营销的综合解决方案。
+
+[更多 LinkWeChat 的故事](https://www.yuque.com/linkwechat/help/dsatfs)
+
+## 1.2 能力
+
+LinkWeChat SCRM 基于企业私域流量营销闭环,遵从获取新客到管理并维护客户,再到建立社群进行客户营销,最后在营销过程中再次获取新客的循环流程。
+
+
+
+整个系统共分为八大模块:
+
+* **运营中心** :客户、客群、会话等全功能数据报表,数据一目了然;
+* **引流获客** :活码、群活码、公海、客服等多渠道引流,实现精准获客;
+* **客户中心** :助力企业搭建私域流量池,高效运营客户;
+* **客情维系** :企业客户运营精细化,朋友圈、红包工具提高客户活跃度;
+* **社群运营** :客群运营场景全覆盖,快速拉群;
+* **全能营销** :提供多类型、多场景客户营销工具;
+* **企业风控** :会话合规存档,敏感内容全局风控;
+* **企业管理** :组织架构、自建应用全融合,实现“一个后台”;
+
+[LinkWeChat 社区版 V2.5 详细功能清单](https://docs.qq.com/sheet/DZWNkTXFNS0FLYWdu)
+
+
+
+## 1.3 优势
+
+LinkWeChat 基于企业微信从服务内部到对外全面开放能力,可为电商、零售、教育、金融等垂直场景提供企微私域管理基础架构,主要优势有:
+
+* 全面对接企微开放 API,无需重复对接,快速上手
+* 二次整合封装企微 API,避免重复踩坑
+* 采用主流 Java 架构,具备高拓展性、灵活性,避免 PHP 架构的缺点
+* 对外提供内部 API,低成本二次开发
+
+## 1.4 愿景
+
+LinkWeChat 不做私域营销专家,而是通过开源让每个企业都是自己的私域流量营销专家:
+
+* 集成企业微信基础能力,拿来即用
+* 针对垂直行业提供一站式营销解决方案
+* 开放自身平台能力,让更多的开发者参与进来
+* 与企业微信共同助力企业数字化转型
+
+# 二、关于项目
+
+## 2.1 在线体验
+
+SAAS体验地址:http://saas.linkwechat.cn/
+
+开源演示地址:[http://demo.linkwechat.cn/](http://demo.linkwechat.cn/)
+
+演示账号/密码:Wecome/123456
+
+ _(注意:演示环境已屏蔽管理权限和相关操作)_
+
+## 2.2 技术栈
+
+本项目基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search) 后台开发框架,感谢 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search) 的开源。
+
+ **前端技术栈**
+
+| 技术栈 | 介绍 | 地址 |
+|:-:|:-:|:-:|
+| Vue | 渐进式 JavaScript 框架 | https://cn.vuejs.org/ |
+| Vuex |专为 Vue.js 应用程序开发的状态管理模式 |https://vuex.vuejs.org/zh/ |
+|Vue Router| Vue.js 官方的路由管理器| https://router.vuejs.org/zh/
+|Vue CLI |基于 Vue.js 进行快速开发的完整系统 |https://cli.vuejs.org/zh/guide/
+|axios| 易用、简洁且高效的 Http 库 |http://www.axios-js.com/zh-cn/
+|Element-UI |基于 Vue 2.0 的桌面端组件库| https://element.eleme.io/#/zh-CN
+|ES6| JavaScript 语言的下一代标准| https://es6.ruanyifeng.com/
+
+
+ **后端技术栈**
+| 技术栈 | 介绍 | 地址 |
+|:-:|:-:|:-:|
+|Spring Boot |快捷创建基于 Spring 的生产级应用程序| https://spring.io/projects/spring-boot
+|MyBatis-Plus| MyBatis 增强工具 |https://mp.baomidou.com/
+|JWT| 轻量级身份认证规范| https://jwt.io/introduction
+|Spring Security |基于 Spring 的强大且高度可定制的身份验证和访问控制框架 |https://spring.io/projects/spring-security/
+
+## 2.3 项目结构
+
+**后端结构**
+
+```
+com.linkwechat
+├── common // 工具类
+│ └── annotation // 自定义注解
+│ └── config // 全局配置
+│ └── constant // 通用常量
+│ └── core // 核心控制
+│ └── enums // 通用枚举
+│ └── exception // 通用异常
+│ └── filter // 过滤器处理
+│ └── utils // 通用类处理
+├── framework // 框架核心
+│ └── aspectj // 注解实现
+│ └── config // 系统配置
+│ └── datasource // 数据权限
+│ └── interceptor // 拦截器
+│ └── manager // 异步处理
+│ └── security // 权限控制
+│ └── web // 前端控制
+├── linkwe-generator // 代码生成
+├── linkwe-quartz // 定时任务
+├── linkwe-system // 系统代码
+├── linkwe-admin // 后台服务
+├── linkwe-ui // 页面前端代码
+├── linkwe--wecom // 企业微信功能
+
+```
+
+**前端结构**
+
+```
+├── build // 构建相关
+├── bin // 执行脚本
+├── public // 公共文件
+│ ├── favicon.ico // favicon图标
+│ └── index.html // html模板
+├── src // 源代码
+│ ├── api // 所有请求
+│ ├── assets // 主题 字体等静态资源
+│ ├── components // 全局公用组件
+│ ├── directive // 全局指令
+│ ├── layout // 布局
+│ ├── router // 路由
+│ ├── store // 全局 store管理
+│ ├── utils // 全局公用方法
+│ ├── views // view
+│ ├── App.vue // 入口页面
+│ ├── main.js // 入口 加载组件 初始化等
+│ ├── permission.js // 权限管理
+│ └── settings.js // 系统配置
+├── .editorconfig // 编码格式
+├── .env.development // 开发环境配置
+├── .env.production // 生产环境配置
+├── .env.staging // 测试环境配置
+├── .eslintignore // 忽略语法检查
+├── .eslintrc.js // eslint 配置项
+├── .gitignore // git 忽略项
+├── babel.config.js // babel.config.js
+├── package.json // package.json
+└── vue.config.js // vue.config.js
+```
+
+## 2.4 项目部署
+
+点击下方链接进入官方语雀帮助手册查看项目部署方式:
+
+[如何快速部署 LinkWeChat](https://www.yuque.com/linkwechat/help/gpod7i)
+
+建议服务器最低配置:
+
+| 类型 | 配置 |
+|:-:|:-:|
+|操作系统|CentOS8.2|
+|CPU|4核|
+|内存|8G|
+|带宽|5M|
+|硬盘|100G|
+
+# 三、常见问题
+
+由于 LinkWeChat 项目基于企业微信官方第三方应用开发文档,所以请各位小伙伴在学习和使用 LinkWeChat 之前, **务必仔细了解并熟悉** 官方 API 已有功能。
+
+[企业微信-企业内部开发-API 文档](https://open.work.weixin.qq.com/api/doc/90000/90003/90556)
+
+**常见问题列表**
+
+[1.有哪几种部署方式?](https://www.yuque.com/linkwechat/help/bww8vd)
+
+[2.数据库为什么 Group By 查询报错?](https://www.yuque.com/linkwechat/help/babnva)
+
+[3.项目每个分支的作用是什么?](https://www.yuque.com/linkwechat/help/ztbre1)
+
+[4、运行项目必须配置 Nacos 吗?](https://www.yuque.com/linkwechat/help/yivnfb)
+
+[5、项目启动时为什么报错?](https://www.yuque.com/linkwechat/help/cepvgv)
+
+[6、如何使用 Docker 进行部署?](https://www.yuque.com/linkwechat/help/ffi7bu)
+
+[7、图片为什么不显示或者裂开?](https://www.yuque.com/linkwechat/help/ggqnhb)
+
+点击下方链接进入官方语雀帮助手册查看常见问题的相关描述及更多帮助:
+
+[帮助手册——常见问题](https://www.yuque.com/linkwechat/help/qk5gl6)
+
+# 四、最近更新
+
+## V2.5 更新日志
+
+LinkWeChat V2.5 版本主要围绕运营中心、引流获客、客情维系等模块进行升级,主要的升级内容如下:
+
+- [x] 首页全新升级为运营中心,各项运营数据快捷查看;
+- [x] 运营中心-新增客户分析,全维度查看客户数据;
+- [x] 运营中心-新增客群分析,全维度查看客群成员数据;
+- [x] 运营中心-新增会话分析,全维度查看客户联系、客群联系以及会话存档数据分析;
+- [x] 引流获客-新增微信客服,打通微信全渠道客服生态;
+- [x] 微信客服-新增客服管理,快捷创建客服,支持智能助手;
+- [x] 微信客服-新增场景管理,快捷接入多渠道客服;
+- [x] 微信客服-新增咨询记录,查看各渠道客服咨询客户及咨询记录;
+- [x] 微信客服-新增客服统计,支持场景及咨询分析,多维度查看客服数据;
+- [x] 客情维系-新增红包工具,侧边栏快捷发送企业红包;
+- [x] 红包工具-新增企业红包,快捷创建客户/客群红包模板,一键发送;
+- [x] 红包工具-新增员工管理,快捷设置员工限额,查看员工发送数据;
+- [x] 红包工具-新增发放记录,查看企业员工发放红包数据统计;
+- [x] 红包工具-新增支出分析,查看企业红包支出统计数据;
+- [x] 企业管理-企微配置升级,新增微信客服及微信支付配置;
+- [x] 其余各模块细节调优。
+
+ **【特别说明:V2.5版本中红包工具涉及企业支付,需要多轮封闭测试后逐步开放。具体源码是否开源酌情而定】**
+
+
+## V2.0 更新日志
+
+LinkWeChat V2.0 主要围绕引流获客、客户中心、客情维系等模块进行升级,主要的升级内容如下:
+
+- [x] 系统菜单重新整合,结构更加清晰;
+- [x] 引流获客-员工活码支持分组;
+- [x] 引流获客-员工活码支持自动排班;
+- [x] 引流获客-员工活码支持多类型欢迎语;
+- [x] 引流获客新增客户公海模块,支持一键分配自主添加;
+- [x] 引流获客-欢迎语升级为欢迎语模板,支持多类型欢迎语个性化配置;
+- [x] 客户中心-企业客户全新改版,支持查看多人跟进内容;
+- [x] 客户中心-企业客群支持标签管理;
+- [x] 客户中心-企业标签支持客群标签管理;
+- [x] 客情维系-消息群发全新改版,支持多类型群发类型;
+- [x] 客情维系-消息群发支持查看员工、客户维度的群发详情;
+- [x] 客情维系-素材中心新增链接、小程序等多类型;
+- [x] 客情维系-新增朋友圈模块,支持查看企业/个人动态;
+- [x] 客情维系-支持企业发表朋友圈;
+- [x] 社群运营-各模块细节调优;
+- [x] 企业管理-企微配置全新改版,支持多种配置方式。
+
+# 五、奖项荣誉
+
+凭借着出色的产品能力和专业的技术能力,LinkWeChat 在 Gitee 开源社区年度评选活动中荣获“2020 年度 GVP最有价值开源项目”、“2020 年开源中国最佳人气项目”两个重量级奖项。
+
+
+
+目前 LinkWeChat 已成功加入木兰开源社区孵化项目,得到了更加专业的技术支持与相关知识产权扶持,未来将会以更加严谨规范的专业能力服务各企业与行业。
+
+
+
+# 六、联系我们
+
+如果你想加入我们的开源交流群,请扫码添加 LinkWeChat 项目作者,加入群聊:
+
+
+
+如果你有任何 LinkWeChat 产品上的想法、意见或建议,或商务上的合作需求,请扫码添加 LinkWeChat 项目团队进一步沟通:
+
+
+
+# 七、捐赠支持
+
+## 7.1 来一杯卡布奇洛
+
+如果您觉得我们的开源项目 `LinkWeChat` 对您有帮助,那就请项目开发者们来一杯卡布奇诺吧!当前我们接受来自于**微信**、**支付宝**或者**码云**的捐赠,请在捐赠时备注自己的昵称或附言。
+
+您的捐赠将用于支付该项目的一些费用支出,并激励开发者们以便更好的推动项目的发展,同时欢迎捐赠**公网服务器**用于提高在线演示系统体验。
+
+
+
+## 7.2 长期捐赠
+
+如果您是企业的经营者并且有计划将 `LinkWeChat` 用在公司的经营产品中,欢迎进行长期捐赠。长期捐赠有商业上的益处有:
+
+* 积极响应,快速维护,及时更新;
+* 企业名称、Logo 及官网链接将长期展示在开源仓库、`LinkWeChat` 官网及宣发材料中;
+* 捐赠金额同比例抵扣未来 `LinkWeChat` 的付费产品价格。
+
+如果您对长期赞助 `LinkWeChat` 团队感兴趣,或者有其他好想法,欢迎联系开发团队微信 `sxjiangdongqin`,或发送邮件到 iamxiarui@foxmail.com。
+
+## 7.3 捐赠记录
+
+
+`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 | 感谢您的开源 |
+| 悟空 | ¥ 500.00 | 支付宝 | 2021- 11-17 11:05:05 | 感谢您的开源 |
+
+
+`LinkWeChat` 全体开发团队感谢以下全部合作伙伴的服务器赞助(排名不分先后):
+
+| 公司/个人名称 | 服务器 |
+| :------: | :-----: |
+| 上海六感科技有限公司 | 八核 16G 服务器一台 |
+| Happy | 两核 8G 服务器一台 |
+| 平山阑槛倚晴空 | 两核 4G 服务器一台 |
+
+## 7.4 社会价值
+
+LinkWeChat 开源团队将目前所收项目捐赠全额捐出,仅尽绵薄之力,在此我们也感谢大家的捐赠和支持,希望河南尽早渡过难关。
+
+同时也希望 LinkWeChat 不仅能为国内开源社区建设做一点贡献,也能为社会产生一些价值。
+
+
+
+---
+
+ **如果您觉得我们的开源项目很有帮助,请点击 :star: Star 支持 LinkWeChat 开源团队: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
new file mode 100644
index 0000000000000000000000000000000000000000..44b100849a0d1b41d1569bb9a0d1f45143318684
--- /dev/null
+++ b/linkwe-admin/pom.xml
@@ -0,0 +1,168 @@
+
+
+
+ linkwechat
+ com.linkwechat
+ 3.1.0
+
+ 4.0.0
+ jar
+ linkwe-admin
+
+
+ web服务入口
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+
+
+ org.hibernate.validator
+ hibernate-validator
+
+
+
+
+ io.springfox
+ springfox-swagger2
+
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.linkwechat
+ linkwe-framework
+
+
+
+
+ com.linkwechat
+ linkwe-quartz
+
+
+
+
+ com.linkwechat
+ linkwe-generator
+
+
+
+
+
+ com.linkwechat
+ linkwe-wecom
+
+
+
+ com.qcloud
+ cos_api
+ 5.6.24
+
+
+
+
+
+ com.google.protobuf
+ protobuf-java
+
+
+
+
+
+ io.github.leejoker
+ linkwechat-nacos-starter
+
+
+
+
+
+
+ javax.xml.bind
+ jaxb-api
+
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.1.1.RELEASE
+
+ true
+
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
+
+ false
+ ${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}
+
+
+
\ No newline at end of file
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
new file mode 100644
index 0000000000000000000000000000000000000000..472e53ac769799aa437dad69e424556d5686bc49
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatApplication.java
@@ -0,0 +1,35 @@
+package com.linkwechat;
+
+import com.dtflys.forest.springboot.annotation.ForestScan;
+import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
+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.scheduling.annotation.EnableAsync;
+
+/**
+ * 启动程序
+ *
+ * @author ruoyi
+ */
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
+@MapperScan("com.linkwechat.*.mapper")
+@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" +
+ " ''-' `'-' `-..-' ");
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatServletInitializer.java b/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatServletInitializer.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd240b2c38bbc77c16c9523034e9a1a08dbbd601
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/LinkWeChatServletInitializer.java
@@ -0,0 +1,18 @@
+package com.linkwechat;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+/**
+ * web容器中进行部署
+ *
+ * @author ruoyi
+ */
+public class LinkWeChatServletInitializer extends SpringBootServletInitializer
+{
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
+ {
+ return application.sources(LinkWeChatApplication.class);
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CaptchaController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CaptchaController.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff38d394cacedbc28bc3583c8a68aa4a9ad534da
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CaptchaController.java
@@ -0,0 +1,86 @@
+package com.linkwechat.web.controller.common;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.google.code.kaptcha.Producer;
+import com.linkwechat.common.constant.Constants;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.redis.RedisCache;
+import com.linkwechat.common.utils.sign.Base64;
+import com.linkwechat.common.utils.uuid.IdUtils;
+
+/**
+ * 验证码操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+public class CaptchaController
+{
+ @Resource(name = "captchaProducer")
+ private Producer captchaProducer;
+
+ @Resource(name = "captchaProducerMath")
+ private Producer captchaProducerMath;
+
+ @Autowired
+ private RedisCache redisCache;
+
+ // 验证码类型
+ @Value("${ruoyi.captchaType}")
+ private String captchaType;
+
+ /**
+ * 生成验证码
+ */
+ @GetMapping("/captchaImage")
+ public AjaxResult getCode(HttpServletResponse response) throws IOException
+ {
+ // 保存验证码信息
+ String uuid = IdUtils.simpleUUID();
+ String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
+
+ String capStr = null, code = null;
+ BufferedImage image = null;
+
+ // 生成验证码
+ if ("math".equals(captchaType))
+ {
+ String capText = captchaProducerMath.createText();
+ capStr = capText.substring(0, capText.lastIndexOf("@"));
+ code = capText.substring(capText.lastIndexOf("@") + 1);
+ image = captchaProducerMath.createImage(capStr);
+ }
+ else if ("char".equals(captchaType))
+ {
+ capStr = code = captchaProducer.createText();
+ image = captchaProducer.createImage(capStr);
+ }
+
+ redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+ // 转换流信息写出
+ FastByteArrayOutputStream os = new FastByteArrayOutputStream();
+ try
+ {
+ ImageIO.write(image, "jpg", os);
+ }
+ catch (IOException e)
+ {
+ return AjaxResult.error(e.getMessage());
+ }
+
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("uuid", uuid);
+ ajax.put("img", Base64.encode(os.toByteArray()));
+ return ajax;
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..631c3b42b2333288f68e42244573ca6b2ecb9108
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/common/CommonController.java
@@ -0,0 +1,148 @@
+package com.linkwechat.web.controller.common;
+
+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;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 通用请求处理
+ *
+ * @author ruoyi
+ */
+@RestController
+public class CommonController {
+ private static final Logger log = LoggerFactory.getLogger(CommonController.class);
+
+ @Autowired
+ private ServerConfig serverConfig;
+
+
+ @Autowired
+ private FileService fileService;
+
+ /**
+ * 通用下载请求
+ *
+ * @param fileName 文件名称
+ * @param delete 是否删除
+ */
+ @GetMapping("common/download")
+ public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+ try {
+ if (!FileUtils.isValidFilename(fileName)) {
+ throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
+ }
+ String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
+ String filePath = RuoYiConfig.getDownloadPath() + fileName;
+
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("multipart/form-data");
+ response.setHeader("Content-Disposition",
+ "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
+ FileUtils.writeBytes(filePath, response.getOutputStream());
+ if (delete) {
+ FileUtils.deleteFile(filePath);
+ }
+ } catch (Exception e) {
+ log.error("下载文件失败", e);
+ }
+ }
+
+ /**
+ * 通用上传请求
+ */
+ @PostMapping("/common/upload")
+ public AjaxResult uploadFile(MultipartFile file) throws Exception {
+ try {
+ // 上传文件路径
+ String filePath = RuoYiConfig.getUploadPath();
+ // 上传并返回新文件名称
+ String fileName = FileUploadUtils.upload(filePath, file);
+ String url = serverConfig.getUrl() + fileName;
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("fileName", fileName);
+ ajax.put("url", url);
+ return ajax;
+ } catch (Exception e) {
+ return AjaxResult.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 本地资源通用下载
+ */
+ @GetMapping("/common/download/resource")
+ public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // 本地资源路径
+ String localPath = RuoYiConfig.getProfile();
+ // 数据库资源地址
+ String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
+ // 下载名称
+ String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("multipart/form-data");
+ response.setHeader("Content-Disposition",
+ "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
+ 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/monitor/ServerController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/ServerController.java
new file mode 100644
index 0000000000000000000000000000000000000000..087be130993472f0082639fc0279450781d56e15
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/ServerController.java
@@ -0,0 +1,28 @@
+package com.linkwechat.web.controller.monitor;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.framework.web.domain.Server;
+
+/**
+ * 服务器监控
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/server")
+public class ServerController extends BaseController
+{
+ @PreAuthorize("@ss.hasPermi('monitor:server:list')")
+ @GetMapping()
+ public AjaxResult getInfo() throws Exception
+ {
+ Server server = new Server();
+ server.copyTo();
+ return AjaxResult.success(server);
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysLogininforController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysLogininforController.java
new file mode 100644
index 0000000000000000000000000000000000000000..0ca5604dfd62b658b35f1df1cc9a32ec2d7bf4a3
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysLogininforController.java
@@ -0,0 +1,67 @@
+package com.linkwechat.web.controller.monitor;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+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.system.domain.SysLogininfor;
+import com.linkwechat.system.service.ISysLogininforService;
+
+/**
+ * 系统访问记录
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/logininfor")
+public class SysLogininforController extends BaseController
+{
+ @Autowired
+ private ISysLogininforService logininforService;
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysLogininfor logininfor)
+ {
+ startPage();
+ List list = logininforService.selectLogininforList(logininfor);
+ return getDataTable(list);
+ }
+
+ @Log(title = "登陆日志", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysLogininfor logininfor)
+ {
+ List list = logininforService.selectLogininforList(logininfor);
+ ExcelUtil util = new ExcelUtil(SysLogininfor.class);
+ return util.exportExcel(list, "登陆日志");
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
+ @Log(title = "登陆日志", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{infoIds}")
+ public AjaxResult remove(@PathVariable Long[] infoIds)
+ {
+ return toAjax(logininforService.deleteLogininforByIds(infoIds));
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
+ @Log(title = "登陆日志", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/clean")
+ public AjaxResult clean()
+ {
+ logininforService.cleanLogininfor();
+ return AjaxResult.success();
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysOperlogController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysOperlogController.java
new file mode 100644
index 0000000000000000000000000000000000000000..112704247aeaa383038c9ab145e5a7774c29753c
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysOperlogController.java
@@ -0,0 +1,66 @@
+package com.linkwechat.web.controller.monitor;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+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.system.domain.SysOperLog;
+import com.linkwechat.system.service.ISysOperLogService;
+
+/**
+ * 操作日志记录
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/operlog")
+public class SysOperlogController extends BaseController
+{
+ @Autowired
+ private ISysOperLogService operLogService;
+
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysOperLog operLog)
+ {
+ startPage();
+ List list = operLogService.selectOperLogList(operLog);
+ return getDataTable(list);
+ }
+
+ @Log(title = "操作日志", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysOperLog operLog)
+ {
+ List list = operLogService.selectOperLogList(operLog);
+ ExcelUtil util = new ExcelUtil(SysOperLog.class);
+ return util.exportExcel(list, "操作日志");
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/{operIds}")
+ public AjaxResult remove(@PathVariable Long[] operIds)
+ {
+ return toAjax(operLogService.deleteOperLogByIds(operIds));
+ }
+
+ @Log(title = "操作日志", businessType = BusinessType.CLEAN)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/clean")
+ public AjaxResult clean()
+ {
+ operLogService.cleanOperLog();
+ return AjaxResult.success();
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysUserOnlineController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysUserOnlineController.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ac99188c1a94ebd0bbc81347b85eb2e082b1f5f
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/monitor/SysUserOnlineController.java
@@ -0,0 +1,92 @@
+package com.linkwechat.web.controller.monitor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+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.model.LoginUser;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.core.redis.RedisCache;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.StringUtils;
+import com.linkwechat.system.domain.SysUserOnline;
+import com.linkwechat.system.service.ISysUserOnlineService;
+
+/**
+ * 在线用户监控
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/online")
+public class SysUserOnlineController extends BaseController
+{
+ @Autowired
+ private ISysUserOnlineService userOnlineService;
+
+ @Autowired
+ private RedisCache redisCache;
+
+ @PreAuthorize("@ss.hasPermi('monitor:online:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(String ipaddr, String userName)
+ {
+ Collection keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
+ List userOnlineList = new ArrayList();
+ for (String key : keys)
+ {
+ LoginUser user = redisCache.getCacheObject(key);
+ if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
+ {
+ if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
+ }
+ }
+ else if (StringUtils.isNotEmpty(ipaddr))
+ {
+ if (StringUtils.equals(ipaddr, user.getIpaddr()))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
+ }
+ }
+ else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
+ {
+ if (StringUtils.equals(userName, user.getUsername()))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
+ }
+ }
+ else
+ {
+ userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
+ }
+ }
+ Collections.reverse(userOnlineList);
+ userOnlineList.removeAll(Collections.singleton(null));
+ return getDataTable(userOnlineList);
+ }
+
+ /**
+ * 强退用户
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
+ @Log(title = "在线用户", businessType = BusinessType.FORCE)
+ @DeleteMapping("/{tokenId}")
+ public AjaxResult forceLogout(@PathVariable String tokenId)
+ {
+ redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
+ return AjaxResult.success();
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysConfigController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysConfigController.java
new file mode 100644
index 0000000000000000000000000000000000000000..c1f9724c543ed2f7fbdfd219ea8a244554318e72
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysConfigController.java
@@ -0,0 +1,135 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.annotation.RepeatSubmit;
+import com.linkwechat.common.constant.UserConstants;
+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.SecurityUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.system.domain.SysConfig;
+import com.linkwechat.system.service.ISysConfigService;
+
+/**
+ * 参数配置 信息操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/config")
+public class SysConfigController extends BaseController
+{
+ @Autowired
+ private ISysConfigService configService;
+
+ /**
+ * 获取参数配置列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysConfig config)
+ {
+ startPage();
+ List list = configService.selectConfigList(config);
+ return getDataTable(list);
+ }
+
+ @Log(title = "参数管理", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:config:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysConfig config)
+ {
+ List list = configService.selectConfigList(config);
+ ExcelUtil util = new ExcelUtil(SysConfig.class);
+ return util.exportExcel(list, "参数数据");
+ }
+
+ /**
+ * 根据参数编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:query')")
+ @GetMapping(value = "/{configId}")
+ public AjaxResult getInfo(@PathVariable Long configId)
+ {
+ return AjaxResult.success(configService.selectConfigById(configId));
+ }
+
+ /**
+ * 根据参数键名查询参数值
+ */
+ @GetMapping(value = "/configKey/{configKey}")
+ public AjaxResult getConfigKey(@PathVariable String configKey)
+ {
+ return AjaxResult.success(configService.selectConfigByKey(configKey));
+ }
+
+ /**
+ * 新增参数配置
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:add')")
+ @Log(title = "参数管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ @RepeatSubmit
+ public AjaxResult add(@Validated @RequestBody SysConfig config)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
+ {
+ return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
+ }
+ config.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(configService.insertConfig(config));
+ }
+
+ /**
+ * 修改参数配置
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:edit')")
+ @Log(title = "参数管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysConfig config)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
+ {
+ return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
+ }
+ config.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(configService.updateConfig(config));
+ }
+
+ /**
+ * 删除参数配置
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:remove')")
+ @Log(title = "参数管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{configIds}")
+ public AjaxResult remove(@PathVariable Long[] configIds)
+ {
+ return toAjax(configService.deleteConfigByIds(configIds));
+ }
+
+ /**
+ * 清空缓存
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:remove')")
+ @Log(title = "参数管理", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/clearCache")
+ public AjaxResult clearCache()
+ {
+ configService.clearCache();
+ return AjaxResult.success();
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDeptController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDeptController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b04d0c593e1f3ffbf404e79664d7ae2c522afbd
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDeptController.java
@@ -0,0 +1,163 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.UserConstants;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysDept;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.StringUtils;
+import com.linkwechat.system.service.ISysDeptService;
+
+/**
+ * 部门信息
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dept")
+public class SysDeptController extends BaseController
+{
+ @Autowired
+ private ISysDeptService deptService;
+
+ /**
+ * 获取部门列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:list')")
+ @GetMapping("/list")
+ public AjaxResult list(SysDept dept)
+ {
+ List depts = deptService.selectDeptList(dept);
+ return AjaxResult.success(depts);
+ }
+
+ /**
+ * 查询部门列表(排除节点)
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:list')")
+ @GetMapping("/list/exclude/{deptId}")
+ public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
+ {
+ List depts = deptService.selectDeptList(new SysDept());
+ Iterator it = depts.iterator();
+ while (it.hasNext())
+ {
+ SysDept d = (SysDept) it.next();
+ if (d.getDeptId().intValue() == deptId
+ || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
+ {
+ it.remove();
+ }
+ }
+ return AjaxResult.success(depts);
+ }
+
+ /**
+ * 根据部门编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:query')")
+ @GetMapping(value = "/{deptId}")
+ public AjaxResult getInfo(@PathVariable Long deptId)
+ {
+ return AjaxResult.success(deptService.selectDeptById(deptId));
+ }
+
+ /**
+ * 获取部门下拉树列表
+ */
+ @GetMapping("/treeselect")
+ public AjaxResult treeselect(SysDept dept)
+ {
+ List depts = deptService.selectDeptList(dept);
+ return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
+ }
+
+ /**
+ * 加载对应角色部门列表树
+ */
+ @GetMapping(value = "/roleDeptTreeselect/{roleId}")
+ public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
+ {
+ List depts = deptService.selectDeptList(new SysDept());
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
+ ajax.put("depts", deptService.buildDeptTreeSelect(depts));
+ return ajax;
+ }
+
+ /**
+ * 新增部门
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:add')")
+ @Log(title = "部门管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDept dept)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+ {
+ return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+ }
+ dept.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(deptService.insertDept(dept));
+ }
+
+ /**
+ * 修改部门
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:edit')")
+ @Log(title = "部门管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDept dept)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+ {
+ return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+ }
+ else if (dept.getParentId().equals(dept.getDeptId()))
+ {
+ return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
+ }
+ else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
+ && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
+ {
+ return AjaxResult.error("该部门包含未停用的子部门!");
+ }
+ dept.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(deptService.updateDept(dept));
+ }
+
+ /**
+ * 删除部门
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:remove')")
+ @Log(title = "部门管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{deptId}")
+ public AjaxResult remove(@PathVariable Long deptId)
+ {
+ if (deptService.hasChildByDeptId(deptId))
+ {
+ return AjaxResult.error("存在下级部门,不允许删除");
+ }
+ if (deptService.checkDeptExistUser(deptId))
+ {
+ return AjaxResult.error("部门存在用户,不允许删除");
+ }
+ return toAjax(deptService.deleteDeptById(deptId));
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictDataController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictDataController.java
new file mode 100644
index 0000000000000000000000000000000000000000..db88dc5bf8ca1623847fb222e8685e0e750b0f60
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictDataController.java
@@ -0,0 +1,113 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+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.domain.entity.SysDictData;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.system.service.ISysDictDataService;
+import com.linkwechat.system.service.ISysDictTypeService;
+
+/**
+ * 数据字典信息
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dict/data")
+public class SysDictDataController extends BaseController
+{
+ @Autowired
+ private ISysDictDataService dictDataService;
+
+ @Autowired
+ private ISysDictTypeService dictTypeService;
+
+ @PreAuthorize("@ss.hasPermi('system:dict:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysDictData dictData)
+ {
+ startPage();
+ List list = dictDataService.selectDictDataList(dictData);
+ return getDataTable(list);
+ }
+
+ @Log(title = "字典数据", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:dict:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysDictData dictData)
+ {
+ List list = dictDataService.selectDictDataList(dictData);
+ ExcelUtil util = new ExcelUtil(SysDictData.class);
+ return util.exportExcel(list, "字典数据");
+ }
+
+ /**
+ * 查询字典数据详细
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:query')")
+ @GetMapping(value = "/{dictCode}")
+ public AjaxResult getInfo(@PathVariable Long dictCode)
+ {
+ return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
+ }
+
+ /**
+ * 根据字典类型查询字典数据信息
+ */
+ @GetMapping(value = "/type/{dictType}")
+ public AjaxResult dictType(@PathVariable String dictType)
+ {
+ return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
+ }
+
+ /**
+ * 新增字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:add')")
+ @Log(title = "字典数据", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDictData dict)
+ {
+ dict.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(dictDataService.insertDictData(dict));
+ }
+
+ /**
+ * 修改保存字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
+ @Log(title = "字典数据", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDictData dict)
+ {
+ dict.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(dictDataService.updateDictData(dict));
+ }
+
+ /**
+ * 删除字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "字典类型", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{dictCodes}")
+ public AjaxResult remove(@PathVariable Long[] dictCodes)
+ {
+ return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictTypeController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictTypeController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b52eb571be40ad08897d977db11994b189d2c29
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysDictTypeController.java
@@ -0,0 +1,131 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.UserConstants;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysDictType;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.system.service.ISysDictTypeService;
+
+/**
+ * 数据字典信息
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dict/type")
+public class SysDictTypeController extends BaseController
+{
+ @Autowired
+ private ISysDictTypeService dictTypeService;
+
+ @PreAuthorize("@ss.hasPermi('system:dict:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysDictType dictType)
+ {
+ startPage();
+ List list = dictTypeService.selectDictTypeList(dictType);
+ return getDataTable(list);
+ }
+
+ @Log(title = "字典类型", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:dict:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysDictType dictType)
+ {
+ List list = dictTypeService.selectDictTypeList(dictType);
+ ExcelUtil util = new ExcelUtil(SysDictType.class);
+ return util.exportExcel(list, "字典类型");
+ }
+
+ /**
+ * 查询字典类型详细
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:query')")
+ @GetMapping(value = "/{dictId}")
+ public AjaxResult getInfo(@PathVariable Long dictId)
+ {
+ return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
+ }
+
+ /**
+ * 新增字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:add')")
+ @Log(title = "字典类型", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDictType dict)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
+ }
+ dict.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(dictTypeService.insertDictType(dict));
+ }
+
+ /**
+ * 修改字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
+ @Log(title = "字典类型", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDictType dict)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
+ }
+ dict.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(dictTypeService.updateDictType(dict));
+ }
+
+ /**
+ * 删除字典类型
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "字典类型", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{dictIds}")
+ public AjaxResult remove(@PathVariable Long[] dictIds)
+ {
+ return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
+ }
+
+ /**
+ * 清空缓存
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "字典类型", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/clearCache")
+ public AjaxResult clearCache()
+ {
+ dictTypeService.clearCache();
+ return AjaxResult.success();
+ }
+
+ /**
+ * 获取字典选择框列表
+ */
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ List dictTypes = dictTypeService.selectDictTypeAll();
+ return AjaxResult.success(dictTypes);
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..9b76fb6602f226571458703bf4c24a22cf6ab234
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysLoginController.java
@@ -0,0 +1,210 @@
+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.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;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 登录验证
+ *
+ * @author ruoyi
+ */
+@RestController
+public class SysLoginController
+{
+ @Autowired
+ private SysLoginService loginService;
+
+ @Autowired
+ private ISysMenuService menuService;
+
+ @Autowired
+ private SysPermissionService permissionService;
+
+ @Autowired
+ private TokenService tokenService;
+
+
+ @Autowired
+ private IWeCorpAccountService iWxCorpAccountService;
+
+
+ @Autowired
+ private WeUserClient weUserClient;
+
+ @Autowired
+ private ISysDeptService iSysDeptService;
+
+ @Autowired
+ private ISysUserService sysUserService;
+
+
+ /**
+ * 登录方法
+ *
+ * @param loginBody 登录信息
+ * @return 结果
+ */
+ @PostMapping("/login")
+ public AjaxResult login(@RequestBody LoginBody loginBody)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ // 生成令牌
+ String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
+ loginBody.getUuid());
+ ajax.put(Constants.TOKEN, token);
+ return ajax;
+ }
+
+
+
+ /**
+ * 获取用户信息
+ *
+ * @return 用户信息
+ */
+ @GetMapping("getInfo")
+ public AjaxResult getInfo()
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ SysUser user = loginUser.getUser();
+ // 角色集合
+ 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();
+ if(null != wxCorpAccount){
+ user.setValidCropId(true);
+ }
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("user", user);
+ ajax.put("roles", roles);
+ ajax.put("permissions", permissions);
+ return ajax;
+ }
+
+ /**
+ * 获取路由信息
+ *
+ * @return 路由信息
+ */
+ @GetMapping("getRouters")
+ public AjaxResult getRouters()
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ // 用户信息
+ SysUser user = loginUser.getUser();
+ List menus = menuService.selectMenuTreeByUserId(user.getUserId());
+ 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 授权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/SysMenuController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysMenuController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1671951b2fe47e7c7ca373a9d57188606a4aef76
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysMenuController.java
@@ -0,0 +1,157 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.Constants;
+import com.linkwechat.common.constant.UserConstants;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysMenu;
+import com.linkwechat.common.core.domain.model.LoginUser;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.ServletUtils;
+import com.linkwechat.common.utils.StringUtils;
+import com.linkwechat.framework.web.service.TokenService;
+import com.linkwechat.system.service.ISysMenuService;
+
+/**
+ * 菜单信息
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/menu")
+public class SysMenuController extends BaseController
+{
+ @Autowired
+ private ISysMenuService menuService;
+
+ @Autowired
+ private TokenService tokenService;
+
+ /**
+ * 获取菜单列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:list')")
+ @GetMapping("/list")
+ public AjaxResult list(SysMenu menu)
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ Long userId = loginUser.getUser().getUserId();
+ List menus = menuService.selectMenuList(menu, userId);
+ return AjaxResult.success(menus);
+ }
+
+ /**
+ * 根据菜单编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:query')")
+ @GetMapping(value = "/{menuId}")
+ public AjaxResult getInfo(@PathVariable Long menuId)
+ {
+ return AjaxResult.success(menuService.selectMenuById(menuId));
+ }
+
+ /**
+ * 获取菜单下拉树列表
+ */
+ @GetMapping("/treeselect")
+ public AjaxResult treeselect(SysMenu menu)
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ Long userId = loginUser.getUser().getUserId();
+ List menus = menuService.selectMenuList(menu, userId);
+ return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
+ }
+
+ /**
+ * 加载对应角色菜单列表树
+ */
+ @GetMapping(value = "/roleMenuTreeselect/{roleId}")
+ public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ List menus = menuService.selectMenuList(loginUser.getUser().getUserId());
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
+ ajax.put("menus", menuService.buildMenuTreeSelect(menus));
+ return ajax;
+ }
+
+ /**
+ * 新增菜单
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:add')")
+ @Log(title = "菜单管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysMenu menu)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ {
+ return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
+ }
+ else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
+ && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
+ {
+ return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
+ }
+ menu.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(menuService.insertMenu(menu));
+ }
+
+ /**
+ * 修改菜单
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:edit')")
+ @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysMenu menu)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ {
+ return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
+ }
+ else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
+ && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
+ {
+ return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
+ }
+ else if (menu.getMenuId().equals(menu.getParentId()))
+ {
+ return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
+ }
+ menu.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(menuService.updateMenu(menu));
+ }
+
+ /**
+ * 删除菜单
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:remove')")
+ @Log(title = "菜单管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{menuId}")
+ public AjaxResult remove(@PathVariable("menuId") Long menuId)
+ {
+ if (menuService.hasChildByMenuId(menuId))
+ {
+ return AjaxResult.error("存在子菜单,不允许删除");
+ }
+ if (menuService.checkMenuExistRole(menuId))
+ {
+ return AjaxResult.error("菜单已分配,不允许删除");
+ }
+ return toAjax(menuService.deleteMenuById(menuId));
+ }
+}
\ No newline at end of file
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysNoticeController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysNoticeController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1aafc1184b7f3f4d765cc5915a4f2df2c6be5f4f
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysNoticeController.java
@@ -0,0 +1,92 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+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.SecurityUtils;
+import com.linkwechat.system.domain.SysNotice;
+import com.linkwechat.system.service.ISysNoticeService;
+
+/**
+ * 公告 信息操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/notice")
+public class SysNoticeController extends BaseController
+{
+ @Autowired
+ private ISysNoticeService noticeService;
+
+ /**
+ * 获取通知公告列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:notice:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysNotice notice)
+ {
+ startPage();
+ List list = noticeService.selectNoticeList(notice);
+ return getDataTable(list);
+ }
+
+ /**
+ * 根据通知公告编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:notice:query')")
+ @GetMapping(value = "/{noticeId}")
+ public AjaxResult getInfo(@PathVariable Long noticeId)
+ {
+ return AjaxResult.success(noticeService.selectNoticeById(noticeId));
+ }
+
+ /**
+ * 新增通知公告
+ */
+ @PreAuthorize("@ss.hasPermi('system:notice:add')")
+ @Log(title = "通知公告", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysNotice notice)
+ {
+ notice.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(noticeService.insertNotice(notice));
+ }
+
+ /**
+ * 修改通知公告
+ */
+ @PreAuthorize("@ss.hasPermi('system:notice:edit')")
+ @Log(title = "通知公告", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysNotice notice)
+ {
+ notice.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(noticeService.updateNotice(notice));
+ }
+
+ /**
+ * 删除通知公告
+ */
+ @PreAuthorize("@ss.hasPermi('system:notice:remove')")
+ @Log(title = "通知公告", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{noticeIds}")
+ public AjaxResult remove(@PathVariable Long[] noticeIds)
+ {
+ return toAjax(noticeService.deleteNoticeByIds(noticeIds));
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysPostController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysPostController.java
new file mode 100644
index 0000000000000000000000000000000000000000..f9f992d5438aa8d9ac513c6d884f97ea4227f2a2
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysPostController.java
@@ -0,0 +1,130 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.UserConstants;
+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.SecurityUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.system.domain.SysPost;
+import com.linkwechat.system.service.ISysPostService;
+
+/**
+ * 岗位信息操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/post")
+public class SysPostController extends BaseController
+{
+ @Autowired
+ private ISysPostService postService;
+
+ /**
+ * 获取岗位列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysPost post)
+ {
+ startPage();
+ List list = postService.selectPostList(post);
+ return getDataTable(list);
+ }
+
+ @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:post:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysPost post)
+ {
+ List list = postService.selectPostList(post);
+ ExcelUtil util = new ExcelUtil(SysPost.class);
+ return util.exportExcel(list, "岗位数据");
+ }
+
+ /**
+ * 根据岗位编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:query')")
+ @GetMapping(value = "/{postId}")
+ public AjaxResult getInfo(@PathVariable Long postId)
+ {
+ return AjaxResult.success(postService.selectPostById(postId));
+ }
+
+ /**
+ * 新增岗位
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:add')")
+ @Log(title = "岗位管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysPost post)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
+ {
+ return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
+ {
+ return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+ }
+ post.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(postService.insertPost(post));
+ }
+
+ /**
+ * 修改岗位
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:edit')")
+ @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysPost post)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
+ {
+ return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
+ {
+ return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+ }
+ post.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(postService.updatePost(post));
+ }
+
+ /**
+ * 删除岗位
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:remove')")
+ @Log(title = "岗位管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{postIds}")
+ public AjaxResult remove(@PathVariable Long[] postIds)
+ {
+ return toAjax(postService.deletePostByIds(postIds));
+ }
+
+ /**
+ * 获取岗位选择框列表
+ */
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ List posts = postService.selectPostAll();
+ return AjaxResult.success(posts);
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..4938d26575a8e13f4fa58da2e43d9b936448748c
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysProfileController.java
@@ -0,0 +1,137 @@
+package com.linkwechat.web.controller.system;
+
+import java.io.IOException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.config.RuoYiConfig;
+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.domain.model.LoginUser;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.ServletUtils;
+import com.linkwechat.common.utils.file.FileUploadUtils;
+import com.linkwechat.framework.web.service.TokenService;
+import com.linkwechat.system.service.ISysUserService;
+
+/**
+ * 个人信息 业务处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/user/profile")
+public class SysProfileController extends BaseController
+{
+ @Autowired
+ private ISysUserService userService;
+
+ @Autowired
+ private TokenService tokenService;
+
+
+ @Autowired
+ private RuoYiConfig ruoYiConfig;
+
+
+ /**
+ * 个人信息
+ */
+ @GetMapping
+ public AjaxResult profile()
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ SysUser user = loginUser.getUser();
+ AjaxResult ajax = AjaxResult.success(user);
+ ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
+ ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
+ return ajax;
+ }
+
+ /**
+ * 修改用户
+ */
+ @Log(title = "个人信息", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult updateProfile(@RequestBody SysUser user)
+ {
+ if (userService.updateUserProfile(user) > 0)
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ // 更新缓存用户信息
+ loginUser.getUser().setNickName(user.getNickName());
+ loginUser.getUser().setPhonenumber(user.getPhonenumber());
+ loginUser.getUser().setEmail(user.getEmail());
+ loginUser.getUser().setSex(user.getSex());
+ tokenService.setLoginUser(loginUser);
+ return AjaxResult.success();
+ }
+ return AjaxResult.error("修改个人信息异常,请联系管理员");
+ }
+
+ /**
+ * 重置密码
+ */
+ @Log(title = "个人信息", businessType = BusinessType.UPDATE)
+ @PutMapping("/updatePwd")
+ public AjaxResult updatePwd(String oldPassword, String newPassword)
+ {
+
+ 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("当前环境密码不可修改");
+ }
+ }
+
+ /**
+ * 头像上传
+ */
+ @Log(title = "用户头像", businessType = BusinessType.UPDATE)
+ @PostMapping("/avatar")
+ public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
+ {
+ if (!file.isEmpty())
+ {
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
+ if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
+ {
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("imgUrl", avatar);
+ // 更新缓存用户头像
+ loginUser.getUser().setAvatar(avatar);
+ tokenService.setLoginUser(loginUser);
+ return ajax;
+ }
+ }
+ return AjaxResult.error("上传图片异常,请联系管理员");
+ }
+}
diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysRoleController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysRoleController.java
new file mode 100644
index 0000000000000000000000000000000000000000..f45dfdd7afc8d9ad2f6eaf4002a793a784df5fbc
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysRoleController.java
@@ -0,0 +1,182 @@
+package com.linkwechat.web.controller.system;
+
+import java.util.List;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.linkwechat.common.annotation.Log;
+import com.linkwechat.common.constant.UserConstants;
+import com.linkwechat.common.core.controller.BaseController;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysRole;
+import com.linkwechat.common.core.domain.model.LoginUser;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.ServletUtils;
+import com.linkwechat.common.utils.StringUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+import com.linkwechat.framework.web.service.SysPermissionService;
+import com.linkwechat.framework.web.service.TokenService;
+import com.linkwechat.system.service.ISysRoleService;
+import com.linkwechat.system.service.ISysUserService;
+
+/**
+ * 角色信息
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/role")
+public class SysRoleController extends BaseController
+{
+ @Autowired
+ private ISysRoleService roleService;
+
+ @Autowired
+ private TokenService tokenService;
+
+ @Autowired
+ private SysPermissionService permissionService;
+
+ @Autowired
+ private ISysUserService userService;
+
+ @PreAuthorize("@ss.hasPermi('system:role:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysRole role)
+ {
+ startPage();
+ List list = roleService.selectRoleList(role);
+ return getDataTable(list);
+ }
+
+ @Log(title = "角色管理", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:role:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysRole role)
+ {
+ List list = roleService.selectRoleList(role);
+ ExcelUtil util = new ExcelUtil(SysRole.class);
+ return util.exportExcel(list, "角色数据");
+ }
+
+ /**
+ * 根据角色编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:query')")
+ @GetMapping(value = "/{roleId}")
+ public AjaxResult getInfo(@PathVariable Long roleId)
+ {
+ return AjaxResult.success(roleService.selectRoleById(roleId));
+ }
+
+ /**
+ * 新增角色
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:add')")
+ @Log(title = "角色管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysRole role)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
+ {
+ return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
+ {
+ return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
+ }
+ role.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(roleService.insertRole(role));
+
+ }
+
+ /**
+ * 修改保存角色
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
+ {
+ return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
+ {
+ return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
+ }
+ role.setUpdateBy(SecurityUtils.getUsername());
+
+ if (roleService.updateRole(role) > 0)
+ {
+ // 更新缓存用户权限
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
+ {
+ loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
+ loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
+ tokenService.setLoginUser(loginUser);
+ }
+ return AjaxResult.success();
+ }
+ return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
+ }
+
+ /**
+ * 修改保存数据权限
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/dataScope")
+ public AjaxResult dataScope(@RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ return toAjax(roleService.authDataScope(role));
+ }
+
+ /**
+ * 状态修改
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "角色管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ role.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(roleService.updateRoleStatus(role));
+ }
+
+ /**
+ * 删除角色
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:remove')")
+ @Log(title = "角色管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{roleIds}")
+ public AjaxResult remove(@PathVariable Long[] roleIds)
+ {
+ return toAjax(roleService.deleteRoleByIds(roleIds));
+ }
+
+ /**
+ * 获取角色选择框列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:query')")
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ return AjaxResult.success(roleService.selectRoleAll());
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..8a3f0fd8097510bb75e1138fab1bf7ba63cb3071
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
@@ -0,0 +1,229 @@
+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;
+import com.linkwechat.common.core.domain.AjaxResult;
+import com.linkwechat.common.core.domain.entity.SysRole;
+import com.linkwechat.common.core.domain.entity.SysUser;
+import com.linkwechat.common.core.domain.model.LoginUser;
+import com.linkwechat.common.core.page.TableDataInfo;
+import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.SecurityUtils;
+import com.linkwechat.common.utils.ServletUtils;
+import com.linkwechat.common.utils.StringUtils;
+import com.linkwechat.common.utils.poi.ExcelUtil;
+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
+@RequestMapping("/system/user")
+public class SysUserController extends BaseController
+{
+ @Autowired
+ private ISysUserService userService;
+
+ @Autowired
+ private ISysRoleService roleService;
+
+ @Autowired
+ private ISysPostService postService;
+
+ @Autowired
+ private TokenService tokenService;
+
+
+ @Autowired
+ private IWeUserService iWeUserService;
+
+ /**
+ * 获取用户列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysUser user)
+ {
+ startPage();
+
+ List list = userService.selectUserList(user);
+ return getDataTable(list);
+ }
+
+ @Log(title = "用户管理", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:user:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysUser user)
+ {
+ List list = userService.selectUserList(user);
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ return util.exportExcel(list, "用户数据");
+ }
+
+ @Log(title = "用户管理", businessType = BusinessType.IMPORT)
+ @PreAuthorize("@ss.hasPermi('system:user:import')")
+ @PostMapping("/importData")
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+ {
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ List userList = util.importExcel(file.getInputStream());
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+ String operName = loginUser.getUsername();
+ String message = userService.importUser(userList, updateSupport, operName);
+ return AjaxResult.success(message);
+ }
+
+ @GetMapping("/importTemplate")
+ public AjaxResult importTemplate()
+ {
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ return util.importTemplateExcel("用户数据");
+ }
+
+ /**
+ * 根据用户编号获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:query')")
+ @GetMapping(value = { "/", "/{userId}" })
+ public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ List roles = roleService.selectRoleAll();
+ ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+ ajax.put("posts", postService.selectPostAll());
+ if (StringUtils.isNotNull(userId))
+ {
+ ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
+ ajax.put("postIds", postService.selectPostListByUserId(userId));
+ ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
+ }
+ return ajax;
+ }
+
+ /**
+ * 新增用户
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:add')")
+ @Log(title = "用户管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysUser user)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
+ {
+ return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
+ {
+ return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
+ {
+ return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
+ }
+ user.setCreateBy(SecurityUtils.getUsername());
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ return toAjax(userService.insertUser(user));
+ }
+
+ /**
+ * 修改用户
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
+ {
+ return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
+ }
+ else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
+ {
+ return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
+ }
+ user.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(userService.updateUser(user));
+ }
+
+ /**
+ * 删除用户
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:remove')")
+ @Log(title = "用户管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{userIds}")
+ public AjaxResult remove(@PathVariable Long[] userIds)
+ {
+ return toAjax(userService.deleteUserByIds(userIds));
+ }
+
+ /**
+ * 重置密码
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/resetPwd")
+ public AjaxResult resetPwd(@RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ user.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(userService.resetPwd(user));
+ }
+
+ /**
+ * 状态修改
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ 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/tool/SwaggerController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/tool/SwaggerController.java
new file mode 100644
index 0000000000000000000000000000000000000000..b13d95546d78d3689faeed5ab91e61eeeedb3011
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/tool/SwaggerController.java
@@ -0,0 +1,24 @@
+package com.linkwechat.web.controller.tool;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.linkwechat.common.core.controller.BaseController;
+
+/**
+ * swagger 接口
+ *
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/tool/swagger")
+public class SwaggerController extends BaseController
+{
+ @PreAuthorize("@ss.hasPermi('tool:swagger:view')")
+ @GetMapping()
+ public String index()
+ {
+ return redirect("/swagger-ui.html");
+ }
+}
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..eb441fcb7e73cc4b13008f113a5da0f9345e6d2a
--- /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.findValidWeCorpAccount();
+ 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
new file mode 100644
index 0000000000000000000000000000000000000000..fa7636c87de33d810abc9314eaf5d20cad5c7565
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
@@ -0,0 +1,106 @@
+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;
+
+/**
+ * 企业微信素材分类Controller
+ *
+ * @author KEWEN
+ * @date 2020-10-08
+ */
+@RestController
+@RequestMapping("/wecom/category")
+@Api(tags = "企业微信素材分类")
+public class WeCategoryController extends BaseController {
+
+ @Autowired
+ private IWeCategoryService weCategoryService;
+
+
+
+// @PreAuthorize("@ss.hasPermi('wechat:category:list')")
+ @GetMapping("/list")
+ @ApiOperation("类目树")
+ public AjaxResult list(@RequestParam("mediaType") String mediaType) {
+ return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(mediaType));
+ }
+
+ /**
+ * 通过id查询类目详细信息
+ */
+// @PreAuthorize("@ss.hasPermi('wechat:category:query')")
+ @GetMapping(value = "/{id}")
+ @ApiOperation("通过id查询类目详细信息")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return AjaxResult.success(weCategoryService.getById(id));
+ }
+
+ /**
+ * 添加类目
+ */
+// @PreAuthorize("@ss.hasPermi('wechat:category:add')")
+ @Log(title = "添加类目", businessType = BusinessType.INSERT)
+ @PostMapping
+ @ApiOperation("添加类目")
+ public AjaxResult add(@Validated @RequestBody WeCategory category) {
+ weCategoryService.insertWeCategory(category);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 更新目录
+ */
+// @PreAuthorize("@ss.hasPermi('wechat:category:edit')")
+ @Log(title = "更新目录", businessType = BusinessType.UPDATE)
+ @PutMapping
+ @ApiOperation("更新目录")
+ public AjaxResult edit(@Validated @RequestBody WeCategory category) {
+ weCategoryService.updateWeCategory(category);
+ return AjaxResult.success();
+ }
+
+
+ /**
+ * 删除类目
+ */
+// @PreAuthorize("@ss.hasPermi('wechat:category:remove')") Constants.DELETE_CODE
+ @Log(title = "删除类目", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ @ApiOperation("删除类目")
+ public AjaxResult remove(@PathVariable Long[] 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..bc5248d62a9815448a78582d77f9ea6dc0d3bf7a
--- /dev/null
+++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
@@ -0,0 +1,88 @@
+package com.linkwechat.web.controller.wecom;
+
+import cn.hutool.core.collection.CollectionUtil;
+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.common.utils.StringUtils;
+import com.linkwechat.wecom.domain.WePoster;
+import com.linkwechat.wecom.domain.dto.WeChatCollectionDto;
+import com.linkwechat.wecom.domain.vo.WeChatSideVo;
+import com.linkwechat.wecom.service.IWeChatCollectionService;
+import com.linkwechat.wecom.service.IWePosterService;
+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;
+
+ @Autowired
+ private IWePosterService iWePosterService;
+
+
+ /**
+ * 添加收藏
+ */
+ //@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);
+ if(CollectionUtil.isNotEmpty(collections)){
+ collections.stream().forEach(k->{
+ if(StringUtils.isEmpty(k.getMediaType())){//为空则为海报
+ WePoster wePoster = iWePosterService.getById(k.getMaterialId());
+ if(null != wePoster){
+ k.setMediaType(MediaType.POSTER.getType());
+ k.setMaterialName(wePoster.getTitle());
+ k.setMaterialUrl(wePoster.getSampleImgPath());
+ }
+ }
+ });
+ }
+ 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