Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e709050ba3 | ||
|
|
59926aa2f4 | ||
|
|
5da83bb477 | ||
|
|
fb1f7c4e37 | ||
|
|
f831f4faf0 | ||
|
|
d7016b418e | ||
|
|
fd92109e2e | ||
|
|
c9679eeeac | ||
|
|
08a3c52f34 | ||
|
|
5a25006189 | ||
|
|
093d39a108 | ||
|
|
c0ded4356f | ||
|
|
8f7d543c8b | ||
|
|
67bb6041c6 | ||
|
|
78cb8dafeb | ||
|
|
d77eb50a5b | ||
|
|
aee4fa86f6 | ||
|
|
a10b57f6fc | ||
|
|
d2229e0028 | ||
|
|
80cd48b97c | ||
|
|
0e6bee4714 | ||
|
|
ae67cc53ec | ||
|
|
419cb06ff6 | ||
|
|
384ac928e3 | ||
|
|
130cd45de2 | ||
|
|
6840faa9d8 | ||
|
|
b6caecf140 | ||
|
|
fdcb1614cc | ||
|
|
88bc553213 | ||
|
|
5942c4cea4 | ||
|
|
ef34146563 | ||
|
|
1c8bc648ea | ||
|
|
144ca50fea | ||
|
|
1d2cabb048 | ||
|
|
b4334f4a5b | ||
|
|
ce44e4a05a | ||
|
|
a7024f7a8d | ||
|
|
c2fe494ed9 | ||
|
|
07de3f6ba7 | ||
|
|
1c521e5378 | ||
|
|
e98e98d659 | ||
|
|
75d052bd0c | ||
|
|
3758826987 | ||
|
|
8a4cf8e439 | ||
|
|
09203ac78d |
93
CHANGELOG.md
@@ -1,94 +1,7 @@
|
|||||||
## 1.1.0
|
## 2.0.0.rc4
|
||||||
|
|
||||||
- feat:globalConfig增加ext属性。
|
- perf:TsTokenConfig不在提供静态方法
|
||||||
- feat:增加网络请求超时、重定向的配置。
|
- perf:移除TsTokenAspect,由TokenWebMvcConfigurer替代,并实现TokenBean参数注入
|
||||||
- perf:更新数据库对比插件。
|
|
||||||
- feat(web):增加DaoBase的常量。
|
|
||||||
- perf(web):操作日志优化。
|
|
||||||
|
|
||||||
|
|
||||||
## 1.0.12
|
|
||||||
|
|
||||||
- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。
|
|
||||||
- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。
|
|
||||||
- perf(login):可重写**onSignError**方法自定义验签错误的跳转。
|
|
||||||
- fix(login):修复微信、钉钉授权跳转地址错误的bug
|
|
||||||
|
|
||||||
## 1.0.7
|
|
||||||
|
|
||||||
- feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况
|
|
||||||
- feat(database): 增加db/data目录,存放初始化数据的sql
|
|
||||||
- perf(login): 增加默认值,防止token解析异常
|
|
||||||
|
|
||||||
## 1.0.6
|
|
||||||
|
|
||||||
- feat(web):新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。
|
|
||||||
- feat(web):**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。
|
|
||||||
|
|
||||||
## 1.0.2
|
|
||||||
|
|
||||||
- feat(database):增加数据库定时备份;
|
|
||||||
- feat(database):增加过期备份的删除操作,默认过期时间为7天;
|
|
||||||
- perf(message):调整阿里云短信类,方便扩展其他方法。
|
|
||||||
- perf(message):消息发送接口该body类型为 **JSONObject**
|
|
||||||
- perf(message):调整消息发送接口和方法(不兼容旧版本)
|
|
||||||
|
|
||||||
## 1.0.1
|
|
||||||
|
|
||||||
- perf(web):fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。
|
|
||||||
|
|
||||||
## 1.0.0
|
|
||||||
|
|
||||||
- perf:hutool依赖升级:5.8.11 -> 5.8.16
|
|
||||||
- perf:fastjson依赖升级:1.2.78 -> 1.2.83
|
|
||||||
- perf:mybatis-plus依赖升级:3.5.1 -> 3.5.3
|
|
||||||
- perf:**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。
|
|
||||||
|
|
||||||
从该版本开始,仓库地址改为:
|
|
||||||
|
|
||||||
``` pom
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>kepai-repo</id>
|
|
||||||
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
```
|
|
||||||
|
|
||||||
## 0.9.3
|
|
||||||
|
|
||||||
> 1,增加版本对比器,防止某些情况下版本对比失效;
|
|
||||||
>
|
|
||||||
|
|
||||||
## 0.8.3
|
|
||||||
|
|
||||||
### 调整
|
|
||||||
|
|
||||||
> 1,优化返回数据加密;
|
|
||||||
> 2,上传文件接口调整,统一为**application/json**格式;
|
|
||||||
|
|
||||||
## 0.8.0
|
|
||||||
|
|
||||||
### 调整
|
|
||||||
|
|
||||||
> 1,移除**PasswordUtil**类,新增**EncryptConfig**配置;
|
|
||||||
> 2,默认启用网络请求的加解密,前端请配合接口使用。
|
|
||||||
|
|
||||||
## 0.7.4
|
|
||||||
|
|
||||||
### 新增
|
|
||||||
|
|
||||||
> 现在操作日志默认收集(不包括GET请求):使用方法名称和接口作为参数存储。如果存在OperationLog注解,则使用注解的内容。
|
|
||||||
|
|
||||||
## 0.7.3
|
|
||||||
|
|
||||||
### 增加
|
|
||||||
|
|
||||||
> 1,TsTokenConfig增加新的属性**ignorePaths**,用于通过路径忽略token;
|
|
||||||
> 2,PasswordUtils增加密码复杂度校验方法;
|
|
||||||
> 3,PasswordUtils.verifyPassword增加登录次数限制:10分钟内不能错误6次;
|
|
||||||
>
|
|
||||||
|
|
||||||
### 调整
|
|
||||||
|
|
||||||
> 1,TsTokenConfig中的**ignores**属性调整为**testMap**;
|
|
||||||
|
|||||||
94
CHANGELOG_V1.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
## 1.1.0
|
||||||
|
|
||||||
|
- feat:globalConfig增加ext属性。
|
||||||
|
- feat:增加网络请求超时、重定向的配置。
|
||||||
|
- perf:更新数据库对比插件。
|
||||||
|
- feat(web):增加DaoBase的常量。
|
||||||
|
- perf(web):操作日志优化。
|
||||||
|
|
||||||
|
|
||||||
|
## 1.0.12
|
||||||
|
|
||||||
|
- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。
|
||||||
|
- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。
|
||||||
|
- perf(login):可重写**onSignError**方法自定义验签错误的跳转。
|
||||||
|
- fix(login):修复微信、钉钉授权跳转地址错误的bug
|
||||||
|
|
||||||
|
## 1.0.7
|
||||||
|
|
||||||
|
- feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况
|
||||||
|
- feat(database): 增加db/data目录,存放初始化数据的sql
|
||||||
|
- perf(login): 增加默认值,防止token解析异常
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
- feat(web):新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。
|
||||||
|
- feat(web):**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
- feat(database):增加数据库定时备份;
|
||||||
|
- feat(database):增加过期备份的删除操作,默认过期时间为7天;
|
||||||
|
- perf(message):调整阿里云短信类,方便扩展其他方法。
|
||||||
|
- perf(message):消息发送接口该body类型为 **JSONObject**
|
||||||
|
- perf(message):调整消息发送接口和方法(不兼容旧版本)
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
- perf(web):fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
- perf:hutool依赖升级:5.8.11 -> 5.8.16
|
||||||
|
- perf:fastjson依赖升级:1.2.78 -> 1.2.83
|
||||||
|
- perf:mybatis-plus依赖升级:3.5.1 -> 3.5.3
|
||||||
|
- perf:**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。
|
||||||
|
|
||||||
|
从该版本开始,仓库地址改为:
|
||||||
|
|
||||||
|
``` pom
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>kepai-repo</id>
|
||||||
|
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 0.9.3
|
||||||
|
|
||||||
|
> 1,增加版本对比器,防止某些情况下版本对比失效;
|
||||||
|
>
|
||||||
|
|
||||||
|
## 0.8.3
|
||||||
|
|
||||||
|
### 调整
|
||||||
|
|
||||||
|
> 1,优化返回数据加密;
|
||||||
|
> 2,上传文件接口调整,统一为**application/json**格式;
|
||||||
|
|
||||||
|
## 0.8.0
|
||||||
|
|
||||||
|
### 调整
|
||||||
|
|
||||||
|
> 1,移除**PasswordUtil**类,新增**EncryptConfig**配置;
|
||||||
|
> 2,默认启用网络请求的加解密,前端请配合接口使用。
|
||||||
|
|
||||||
|
## 0.7.4
|
||||||
|
|
||||||
|
### 新增
|
||||||
|
|
||||||
|
> 现在操作日志默认收集(不包括GET请求):使用方法名称和接口作为参数存储。如果存在OperationLog注解,则使用注解的内容。
|
||||||
|
|
||||||
|
## 0.7.3
|
||||||
|
|
||||||
|
### 增加
|
||||||
|
|
||||||
|
> 1,TsTokenConfig增加新的属性**ignorePaths**,用于通过路径忽略token;
|
||||||
|
> 2,PasswordUtils增加密码复杂度校验方法;
|
||||||
|
> 3,PasswordUtils.verifyPassword增加登录次数限制:10分钟内不能错误6次;
|
||||||
|
>
|
||||||
|
|
||||||
|
### 调整
|
||||||
|
|
||||||
|
> 1,TsTokenConfig中的**ignores**属性调整为**testMap**;
|
||||||
27
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
<module>springboot-message</module>
|
<module>springboot-message</module>
|
||||||
<module>springboot-encrypt</module>
|
<module>springboot-encrypt</module>
|
||||||
<module>springboot-annotation</module>
|
<module>springboot-annotation</module>
|
||||||
|
<module>springboot-role</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -57,55 +58,61 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
|
<artifactId>springboot-role</artifactId>
|
||||||
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
BIN
springboot-ademo/.DS_Store
vendored
@@ -6,11 +6,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
@@ -26,6 +26,11 @@
|
|||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
|
<artifactId>springboot-role</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
|
|||||||
BIN
springboot-ademo/src/main/java/com/tiesheng/.DS_Store
vendored
Normal file
BIN
springboot-ademo/src/main/java/com/tiesheng/demo/.DS_Store
vendored
Normal file
@@ -1,7 +1,7 @@
|
|||||||
package com.tiesheng.demo;
|
package com.tiesheng.demo;
|
||||||
|
|
||||||
|
|
||||||
import com.tiesheng.core.EnableTieshengWeb;
|
import com.tiesheng.web.EnableTieshengWeb;
|
||||||
import com.tiesheng.demo.config.DemoWebConfigurer;
|
import com.tiesheng.demo.config.DemoWebConfigurer;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -13,7 +13,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableTieshengWeb(webConfigurer = DemoWebConfigurer.class)
|
@EnableTieshengWeb(webConfigurer = DemoWebConfigurer.class)
|
||||||
//@EnableEncryptConfig
|
|
||||||
public class DemoApplication {
|
public class DemoApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.tiesheng.demo.config;
|
package com.tiesheng.demo.config;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.tiesheng.core.pojos.RequestUserInfo;
|
import com.tiesheng.web.pojos.RequestUserInfo;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
import com.tiesheng.web.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
import com.tiesheng.util.config.GlobalConfig;
|
import com.tiesheng.util.config.GlobalConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -40,11 +40,11 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
|
|||||||
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
|
|
||||||
// 默认跳转到mobile
|
// 默认跳转到mobile
|
||||||
to = StrUtil.emptyToDefault(to, "mobile");
|
to = StrUtil.emptyToDefault(to, "static/mobile");
|
||||||
bean.setEnvironmentType(to);
|
bean.setEnvironmentType(to);
|
||||||
|
|
||||||
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
|
if (Objects.equals(bean.getEnvironmentType(), "static/mobile")) {
|
||||||
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
|
globalConfig.redirect("static/mobile", "/?token=" + bean.toToken(), response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package com.tiesheng.demo.config;
|
package com.tiesheng.demo.config;
|
||||||
|
|
||||||
|
|
||||||
import com.tiesheng.core.service.CoreConfigService;
|
import com.tiesheng.web.service.CoreConfigService;
|
||||||
import com.tiesheng.core.service.CoreJobService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -14,19 +13,11 @@ import javax.annotation.PostConstruct;
|
|||||||
@Component
|
@Component
|
||||||
public class TestJobConfig {
|
public class TestJobConfig {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CoreJobService coreJobService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CoreConfigService coreConfigService;
|
CoreConfigService coreConfigService;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
coreConfigService.refreshFunc("230328001", "demo", "辅导员统计", "辅导员责任班级,学生展示");
|
|
||||||
|
|
||||||
// 辅导员职位
|
|
||||||
coreJobService.refresh("class_fdy", "辅导员", "辅导员", 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.read.listener.ReadListener;
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
import com.tiesheng.annotation.operation.OperationLog;
|
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.core.service.CoreLogService;
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
import com.tiesheng.core.service.CoreMessageService;
|
import com.tiesheng.web.service.CoreLogService;
|
||||||
import com.tiesheng.core.util.ProcessImportConsumer;
|
import com.tiesheng.web.service.CoreMessageService;
|
||||||
|
import com.tiesheng.web.util.ProcessImportConsumer;
|
||||||
import com.tiesheng.database.config.DbBackupConfig;
|
import com.tiesheng.database.config.DbBackupConfig;
|
||||||
import com.tiesheng.demo.pojos.PoiBean;
|
import com.tiesheng.demo.pojos.PoiBean;
|
||||||
import com.tiesheng.demo.pojos.TestFile;
|
import com.tiesheng.demo.pojos.TestFile;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.util.config.TsTokenConfig;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.message.pojos.UserChannel;
|
import com.tiesheng.message.pojos.UserChannel;
|
||||||
import com.tiesheng.util.config.EncryptConfig;
|
import com.tiesheng.util.config.EncryptConfig;
|
||||||
@@ -28,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -57,9 +56,9 @@ public class TestController {
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
public ApiResp<String> index() {
|
@TokenIgnore
|
||||||
dbBackupConfig.dbBackup();
|
public void index(HttpServletResponse response) {
|
||||||
return ApiResp.respOK("hello world");
|
globalConfig.redirect("mobile", "/test", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/redirect")
|
@RequestMapping("/redirect")
|
||||||
@@ -94,7 +93,7 @@ public class TestController {
|
|||||||
public ApiResp<MessageReqResp> sendMessage() {
|
public ApiResp<MessageReqResp> sendMessage() {
|
||||||
|
|
||||||
MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
|
MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
|
||||||
JSONUtil.createObj().putOpt("code", "123456").putOpt("template_code", "SMS_154950909"));
|
JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
|
||||||
|
|
||||||
return ApiResp.respOK(reqResp);
|
return ApiResp.respOK(reqResp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tiesheng.demo.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.tiesheng.message.config.aliyun.AliyunSmsHandler;
|
||||||
|
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DemoSmsHandler implements AliyunSmsHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AliyunTempParam handler(JSONObject obj) {
|
||||||
|
|
||||||
|
String action = obj.getStr("action");
|
||||||
|
|
||||||
|
AliyunTempParam param = new AliyunTempParam();
|
||||||
|
param.setSignName("智慧校园");
|
||||||
|
|
||||||
|
if (Objects.equals(action, "sms-visitor-invite")) {
|
||||||
|
param.setTemplateCode("SMS_276125463");
|
||||||
|
param.setTemplateParam(JSONUtil.createObj()
|
||||||
|
.putOpt("date", DateUtil.today())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,10 +19,12 @@ tiesheng:
|
|||||||
test-map:
|
test-map:
|
||||||
"1111":
|
"1111":
|
||||||
id: "1111"
|
id: "1111"
|
||||||
|
role-id: "student_bks"
|
||||||
global:
|
global:
|
||||||
version: 2
|
version: 2
|
||||||
host: http://localhost:8100
|
host: http://localhost:8100
|
||||||
aliyun:
|
aliyun:
|
||||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||||
sign-name: 阿里云短信测试
|
encrypt:
|
||||||
|
body: false
|
||||||
|
|||||||
@@ -9,18 +9,13 @@ spring:
|
|||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 20MB
|
max-file-size: 20MB
|
||||||
|
max-request-size: 20MB
|
||||||
web:
|
web:
|
||||||
resources:
|
resources:
|
||||||
static-locations: classpath:/static/,file:static/
|
static-locations: classpath:/static/,file:static/
|
||||||
mvc:
|
|
||||||
pathmatch:
|
|
||||||
matching-strategy: ant_path_matcher
|
|
||||||
|
|
||||||
## 日志
|
## 日志
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: runtime/logs/tiesheng.log
|
name: runtime/logs/tiesheng.log
|
||||||
tiesheng:
|
|
||||||
token:
|
|
||||||
ignore-paths:
|
|
||||||
- /test/index
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
BIN
springboot-annotation/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
BIN
springboot-database/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
BIN
springboot-encrypt/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
BIN
springboot-login/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.tiesheng.login.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
|
import com.tiesheng.util.config.TsTokenConfig;
|
||||||
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.MethodParameter;
|
||||||
|
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||||
|
import org.springframework.web.context.request.NativeWebRequest;
|
||||||
|
import org.springframework.web.method.HandlerMethod;
|
||||||
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class TokenWebMvcConfigurer implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TsTokenConfig tsTokenConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
|
||||||
|
resolvers.add(new HandlerMethodArgumentResolver() {
|
||||||
|
@Override
|
||||||
|
public boolean supportsParameter(MethodParameter parameter) {
|
||||||
|
return parameter.getParameterType().isAssignableFrom(TokenBean.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||||
|
String header = webRequest.getHeader(TsTokenConfig.TOKEN_KEY);
|
||||||
|
|
||||||
|
boolean thrExp = true;
|
||||||
|
Method method = parameter.getMethod();
|
||||||
|
if (method != null) {
|
||||||
|
TokenIgnore annotation = method.getAnnotation(TokenIgnore.class);
|
||||||
|
thrExp = annotation == null;
|
||||||
|
}
|
||||||
|
return tsTokenConfig.validToken(header, thrExp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new HandlerInterceptor() {
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
|
|
||||||
|
// 非接口类直接跳过
|
||||||
|
if (!(handler instanceof HandlerMethod)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
|
||||||
|
if (ObjUtil.isNotEmpty(ignorePaths)) {
|
||||||
|
for (String path : ignorePaths) {
|
||||||
|
if (path.contains("/**") &&
|
||||||
|
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
|
||||||
|
// 通配路径
|
||||||
|
return true;
|
||||||
|
} else if (requestURI.equals(path)) {
|
||||||
|
// 完整路径
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤不要需要验证的接口(注解)
|
||||||
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||||
|
TokenIgnore annotation = handlerMethod.getBeanType().getAnnotation(TokenIgnore.class);
|
||||||
|
if (annotation != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
TokenIgnore apiTokenIgnore = handlerMethod.getMethodAnnotation(TokenIgnore.class);
|
||||||
|
if (apiTokenIgnore != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// token验证
|
||||||
|
tsTokenConfig.validToken(request, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package com.tiesheng.login.config.token;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
|
||||||
import com.tiesheng.util.ServletKit;
|
|
||||||
import org.aspectj.lang.JoinPoint;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
import org.aspectj.lang.annotation.Before;
|
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
* @ProjectName CmccSpring
|
|
||||||
* @Copyright Hangzhou ShuoChuang Technology Co.,Ltd All Right Reserved
|
|
||||||
* @Description 这里是对文件的描述
|
|
||||||
* @data 2019-07-15
|
|
||||||
* @note 这里写文件的详细功能和改动
|
|
||||||
* @note
|
|
||||||
*/
|
|
||||||
@Aspect
|
|
||||||
@Component
|
|
||||||
public class TsTokenAspect {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TsTokenConfig tsTokenConfig;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 切入点
|
|
||||||
*/
|
|
||||||
@Pointcut("execution(* com..controller..*.*(..))")
|
|
||||||
public void methodArgs() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取操作日志说明
|
|
||||||
*
|
|
||||||
* @param joinPoint
|
|
||||||
*/
|
|
||||||
@Before("methodArgs()")
|
|
||||||
public void before(JoinPoint joinPoint) {
|
|
||||||
|
|
||||||
// 过滤不要需要验证的接口(path)
|
|
||||||
String requestURI = ServletKit.getRequest().getRequestURI();
|
|
||||||
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
|
|
||||||
if (ObjUtil.isNotEmpty(ignorePaths)) {
|
|
||||||
for (String path : ignorePaths) {
|
|
||||||
if (path.contains("/**") &&
|
|
||||||
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
|
|
||||||
// 通配路径
|
|
||||||
return;
|
|
||||||
} else if (requestURI.equals(path)) {
|
|
||||||
// 完整路径
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 过滤不要需要验证的接口(注解)
|
|
||||||
Object aThis = joinPoint.getTarget();
|
|
||||||
TokenIgnore annotation = aThis.getClass().getAnnotation(TokenIgnore.class);
|
|
||||||
if (annotation != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
||||||
Method method = signature.getMethod();
|
|
||||||
TokenIgnore apiTokenIgnore = method.getAnnotation(TokenIgnore.class);
|
|
||||||
if (apiTokenIgnore != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// token验证
|
|
||||||
tsTokenConfig.validToken(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,8 @@ import cn.hutool.core.util.URLUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.tiesheng.annotation.operation.OperationIgnore;
|
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.util.config.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
import com.tiesheng.login.pojos.CodeExtraDTO;
|
import com.tiesheng.login.pojos.CodeExtraDTO;
|
||||||
import com.tiesheng.login.pojos.DoLoginInfo;
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
import com.tiesheng.login.pojos.UniqueIndexDTO;
|
import com.tiesheng.login.pojos.UniqueIndexDTO;
|
||||||
@@ -86,7 +86,7 @@ public class LoginController {
|
|||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
if (tokenBean == null) {
|
if (tokenBean == null || StrUtil.isEmpty(tokenBean.getId())) {
|
||||||
throw new ApiException("登录失败");
|
throw new ApiException("登录失败");
|
||||||
}
|
}
|
||||||
return ApiResp.respOK(tokenBean.toToken());
|
return ApiResp.respOK(tokenBean.toToken());
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package com.tiesheng.login.service;
|
package com.tiesheng.login.service;
|
||||||
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
import com.tiesheng.login.pojos.DoLoginInfo;
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
import com.tiesheng.util.ServletKit;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.tiesheng.login.service.impl;
|
package com.tiesheng.login.service.impl;
|
||||||
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
import com.tiesheng.login.pojos.DoLoginInfo;
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
|||||||
BIN
springboot-message/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tiesheng.message.config.aliyun;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||||
|
|
||||||
|
public interface AliyunSmsHandler {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理
|
||||||
|
*
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
AliyunTempParam handler(JSONObject obj);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,15 +3,16 @@ package com.tiesheng.message.config.aliyun;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Validator;
|
import cn.hutool.core.lang.Validator;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.extra.validation.ValidationUtil;
|
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.message.service.TieshengMessageSender;
|
import com.tiesheng.message.service.TieshengMessageSender;
|
||||||
|
import com.tiesheng.util.exception.ApiException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@@ -39,7 +40,9 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
|
|
||||||
private String accessKeyId;
|
private String accessKeyId;
|
||||||
private String accessKeySecret;
|
private String accessKeySecret;
|
||||||
private String signName;
|
|
||||||
|
@Autowired(required = false)
|
||||||
|
AliyunSmsHandler aliyunSmsHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 特殊字符替换
|
* 特殊字符替换
|
||||||
@@ -97,7 +100,16 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
String signature = specialUrlEncode(digest);
|
String signature = specialUrlEncode(digest);
|
||||||
queryMap.put("Signature", signature);
|
queryMap.put("Signature", signature);
|
||||||
|
|
||||||
return HttpUtil.get(ENDPOINT + "?Signature=" + signature + sortQueryStringTmp, 10 * 1000);
|
String respBody = "";
|
||||||
|
try {
|
||||||
|
respBody = HttpUtil.get(ENDPOINT + "?Signature=" + signature + sortQueryStringTmp, 10 * 1000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
respBody = JSONUtil.createObj()
|
||||||
|
.putOpt("Code", "Error")
|
||||||
|
.putOpt("Message", "消息通道异常")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
return respBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,29 +117,28 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
* 创建发送请求
|
* 创建发送请求
|
||||||
*
|
*
|
||||||
* @param phoneNumbers 手机号,多个用,隔开
|
* @param phoneNumbers 手机号,多个用,隔开
|
||||||
* @param templateCode 短信模板
|
* @param tempParam 短信模板
|
||||||
* @param params 模板参数
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
|
public MessageReqResp sendSms(String phoneNumbers, AliyunTempParam tempParam) {
|
||||||
|
|
||||||
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
||||||
reqResp.setTarget(phoneNumbers);
|
reqResp.setTarget(phoneNumbers);
|
||||||
reqResp.setResult(1);
|
reqResp.setResult(1);
|
||||||
reqResp.setContent(JSONUtil.createObj()
|
reqResp.setContent(JSONUtil.createObj()
|
||||||
.putOpt("PhoneNumbers", phoneNumbers)
|
.putOpt("PhoneNumbers", phoneNumbers)
|
||||||
.putOpt("SignName", getSignName())
|
.putOpt("SignName", tempParam.getSignName())
|
||||||
.putOpt("TemplateCode", templateCode)
|
.putOpt("TemplateCode", tempParam.getTemplateCode())
|
||||||
.putOpt("TemplateParam", params)
|
.putOpt("TemplateParam", tempParam.getTemplateParam())
|
||||||
.toString());
|
.toString());
|
||||||
|
|
||||||
// 业务API参数
|
// 业务API参数
|
||||||
ConcurrentHashMap<String, String> queryMap = new ConcurrentHashMap<>();
|
ConcurrentHashMap<String, String> queryMap = new ConcurrentHashMap<>();
|
||||||
queryMap.put("PhoneNumbers", phoneNumbers);
|
queryMap.put("PhoneNumbers", phoneNumbers);
|
||||||
queryMap.put("SignName", getSignName());
|
queryMap.put("SignName", tempParam.getSignName());
|
||||||
queryMap.put("TemplateCode", templateCode);
|
queryMap.put("TemplateCode", tempParam.getTemplateCode());
|
||||||
if (params != null) {
|
if (tempParam.getTemplateParam() != null) {
|
||||||
queryMap.put("TemplateParam", params.toString());
|
queryMap.put("TemplateParam", tempParam.getTemplateParam().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
reqResp.setRespBody(request("SendSms", queryMap));
|
reqResp.setRespBody(request("SendSms", queryMap));
|
||||||
@@ -146,11 +157,17 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
if (!mobile) {
|
if (!mobile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String templateCode = body.getStr("template_code");
|
|
||||||
if (StrUtil.isEmpty(templateCode)) {
|
if (aliyunSmsHandler == null) {
|
||||||
return null;
|
throw new ApiException("未注册短信参数处理器");
|
||||||
}
|
}
|
||||||
return sendSms(user, templateCode, body);
|
|
||||||
|
AliyunTempParam tempParam = aliyunSmsHandler.handler(body);
|
||||||
|
if (tempParam == null) {
|
||||||
|
throw new ApiException("未配置短信参数处理器");
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendSms(user, tempParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -160,7 +177,7 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean support() {
|
public boolean support() {
|
||||||
return StrUtil.isAllNotEmpty(accessKeyId, accessKeySecret, signName);
|
return StrUtil.isAllNotEmpty(accessKeyId, accessKeySecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -183,12 +200,5 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
this.accessKeySecret = accessKeySecret;
|
this.accessKeySecret = accessKeySecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSignName() {
|
|
||||||
return signName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignName(String signName) {
|
|
||||||
this.signName = signName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.tiesheng.message.pojos;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
|
public class AliyunTempParam {
|
||||||
|
|
||||||
|
private String signName;
|
||||||
|
private String templateCode;
|
||||||
|
private JSONObject templateParam;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getSignName() {
|
||||||
|
return signName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignName(String signName) {
|
||||||
|
this.signName = signName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplateCode() {
|
||||||
|
return templateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemplateCode(String templateCode) {
|
||||||
|
this.templateCode = templateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getTemplateParam() {
|
||||||
|
return templateParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemplateParam(JSONObject templateParam) {
|
||||||
|
this.templateParam = templateParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
springboot-platform/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -226,6 +226,8 @@ public class PlatformDingConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步钉钉的通讯录
|
* 同步钉钉的通讯录
|
||||||
|
* <br />
|
||||||
|
* PS:如果需要钉钉用户手机号,需要开通权限:企业员工手机号信息
|
||||||
*
|
*
|
||||||
* @param deptVo 为null时从第一级获取
|
* @param deptVo 为null时从第一级获取
|
||||||
* @param consumer 回调
|
* @param consumer 回调
|
||||||
@@ -264,18 +266,19 @@ public class PlatformDingConfig {
|
|||||||
* @param content
|
* @param content
|
||||||
* @param actionUrl
|
* @param actionUrl
|
||||||
* @param userIds
|
* @param userIds
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public void messageNotification(String service, String title, String content, String actionUrl, List<String> userIds) {
|
public DingResponse<String> messageNotification(String service, String title, String markdown, String actionUrl, List<String> userIds) {
|
||||||
|
|
||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DingConfigBean configBean = getConfigBean(service);
|
DingConfigBean configBean = getConfigBean(service);
|
||||||
|
|
||||||
JSONObject actionCard = new JSONObject();
|
JSONObject actionCard = new JSONObject();
|
||||||
actionCard.set("title", title);
|
actionCard.set("title", title);
|
||||||
actionCard.set("markdown", "### " + title + "\n" + content);
|
actionCard.set("markdown", markdown);
|
||||||
actionCard.set("single_title", "点击查看");
|
actionCard.set("single_title", "点击查看");
|
||||||
actionCard.set("single_url", actionUrl);
|
actionCard.set("single_url", actionUrl);
|
||||||
|
|
||||||
@@ -287,7 +290,7 @@ public class PlatformDingConfig {
|
|||||||
body.putOpt("agent_id", configBean.getAgentId());
|
body.putOpt("agent_id", configBean.getAgentId());
|
||||||
body.putOpt("userid_list", CollUtil.join(userIds, ","));
|
body.putOpt("userid_list", CollUtil.join(userIds, ","));
|
||||||
body.putOpt("msg", msg);
|
body.putOpt("msg", msg);
|
||||||
doRequest(service, "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", body,
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", body,
|
||||||
new TypeReference<DingResponse<String>>() {
|
new TypeReference<DingResponse<String>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
springboot-poi/.DS_Store
vendored
Normal file
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.20</version>
|
<version>2.0.0.rc6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
BIN
springboot-role/.DS_Store
vendored
Normal file
27
springboot-role/pom.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
|
<artifactId>springboot-parent</artifactId>
|
||||||
|
<version>2.0.0.rc6</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>springboot-role</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
|
<artifactId>springboot-util</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,317 @@
|
|||||||
|
package com.tiesheng.role.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.tiesheng.role.pojos.dao.*;
|
||||||
|
import com.tiesheng.role.pojos.dto.GroupRxUpdateDTO;
|
||||||
|
import com.tiesheng.role.pojos.dto.MenuListDTO;
|
||||||
|
import com.tiesheng.role.pojos.dto.OwnerMenuDTO;
|
||||||
|
import com.tiesheng.role.pojos.dto.OwnerPointDTO;
|
||||||
|
import com.tiesheng.role.pojos.vo.GroupTypeDTO;
|
||||||
|
import com.tiesheng.role.pojos.vo.RoleUserPageVO;
|
||||||
|
import com.tiesheng.role.pojos.vo.ServiceMenuVO;
|
||||||
|
import com.tiesheng.role.service.CoreRoleService;
|
||||||
|
import com.tiesheng.util.exception.ApiException;
|
||||||
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
|
import com.tiesheng.util.pojos.IdDTO;
|
||||||
|
import com.tiesheng.util.pojos.PageDTO;
|
||||||
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/role")
|
||||||
|
public class RoleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CoreRoleService coreRoleService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/group/list")
|
||||||
|
public ApiResp<List<CoreRoleGroup>> groupList(@Valid GroupTypeDTO dto) {
|
||||||
|
return ApiResp.respOK(coreRoleService.list(
|
||||||
|
new QueryWrapper<CoreRoleGroup>()
|
||||||
|
.eq("is_deleted", 0)
|
||||||
|
.eq("type", dto.getType())
|
||||||
|
.orderByAsc("sort")
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色编辑
|
||||||
|
*
|
||||||
|
* @param roleGroup
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/group/update")
|
||||||
|
public ApiResp<String> groupUpdate(@RequestBody CoreRoleGroup roleGroup) {
|
||||||
|
|
||||||
|
if (StrUtil.isNotEmpty(roleGroup.getId())) {
|
||||||
|
roleGroup.setType(null);
|
||||||
|
roleGroup.setIsSystem(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
coreRoleService.saveOrUpdate(roleGroup);
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色-删除
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/group/deleted")
|
||||||
|
public ApiResp<String> groupDeleted(@RequestBody @Valid IdDTO dto) {
|
||||||
|
|
||||||
|
CoreRoleGroup byId = coreRoleService.getById(dto.getId());
|
||||||
|
if (byId == null || byId.getIsDeleted() != 0) {
|
||||||
|
throw new ApiException("角色不存在或已删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (byId.getIsSystem() == 1) {
|
||||||
|
throw new ApiException(StrUtil.format("该{}无法删除",
|
||||||
|
Objects.equals(byId.getType(), "role") ? "角色" : "职位"));
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreRoleGroup coreServiceMenu = new CoreRoleGroup();
|
||||||
|
coreServiceMenu.setId(dto.getId());
|
||||||
|
coreServiceMenu.setIsDeleted(1);
|
||||||
|
coreRoleService.updateById(coreServiceMenu);
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色的权限
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/group/rx/list")
|
||||||
|
public ApiResp<List<CoreRoleGroupRx>> groupRxList(@Valid IdDTO dto) {
|
||||||
|
List<CoreRoleGroupRx> list = coreRoleService.getGroupRxMapper().selectList(new QueryWrapper<CoreRoleGroupRx>()
|
||||||
|
.eq(CoreRoleGroupRx.IS_DELETED, 0)
|
||||||
|
.eq("group_id", dto.getId())
|
||||||
|
);
|
||||||
|
return ApiResp.respOK(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 橘色的权限编辑
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/group/rx/update")
|
||||||
|
public ApiResp<String> groupRxUpdate(@RequestBody @Valid GroupRxUpdateDTO dto) {
|
||||||
|
coreRoleService.updateGroupRx(dto);
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/user/page")
|
||||||
|
public ApiResp<List<RoleUserPageVO>> userPage(PageDTO dto) {
|
||||||
|
|
||||||
|
QueryWrapper<CoreRoleUser> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("cru.is_deleted", 0);
|
||||||
|
dto.likeColumns(queryWrapper, "cru.ext1", "cru.ext2", "cru.ext3");
|
||||||
|
queryWrapper.orderByAsc("cru.user_id");
|
||||||
|
|
||||||
|
Page<RoleUserPageVO> page = dto.pageObj();
|
||||||
|
coreRoleService.getUserMapper().page(page, queryWrapper);
|
||||||
|
|
||||||
|
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权调整
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/user/update")
|
||||||
|
public ApiResp<String> userUpdate(@RequestBody CoreRoleUser roleUser) {
|
||||||
|
if (StrUtil.isNotEmpty(roleUser.getId())) {
|
||||||
|
coreRoleService.getUserMapper().updateById(roleUser);
|
||||||
|
} else {
|
||||||
|
coreRoleService.getUserMapper().insert(roleUser);
|
||||||
|
}
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权-删除
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/user/deleted")
|
||||||
|
public ApiResp<String> userDeleted(@RequestBody @Valid IdDTO dto) {
|
||||||
|
CoreRoleUser coreRoleUser = new CoreRoleUser();
|
||||||
|
coreRoleUser.setId(dto.getId());
|
||||||
|
coreRoleUser.setIsDeleted(1);
|
||||||
|
coreRoleService.getUserMapper().updateById(coreRoleUser);
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/server/list")
|
||||||
|
public ApiResp<List<CoreRoleServer>> list() {
|
||||||
|
return ApiResp.respOK(coreRoleService.getServerMapper().selectList(new QueryWrapper<CoreRoleServer>()
|
||||||
|
.eq(CoreRoleServer.IS_DELETED, 0)
|
||||||
|
.eq("is_open", 1)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改服务
|
||||||
|
*
|
||||||
|
* @param coreService
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/server/update")
|
||||||
|
public ApiResp<String> update(@RequestBody CoreRoleServer coreService) {
|
||||||
|
if (StrUtil.isNotEmpty(coreService.getId())) {
|
||||||
|
coreRoleService.getServerMapper().updateById(coreService);
|
||||||
|
} else {
|
||||||
|
coreRoleService.getServerMapper().insert(coreService);
|
||||||
|
}
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限-列出
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/authority/list")
|
||||||
|
public ApiResp<List<ServiceMenuVO>> menuList(@Valid MenuListDTO dto) {
|
||||||
|
|
||||||
|
List<CoreRoleAuthority> list = coreRoleService.getAuthorityMapper().selectList(new QueryWrapper<CoreRoleAuthority>()
|
||||||
|
.eq(CoreRoleAuthority.IS_DELETED, 0)
|
||||||
|
.eq("service", dto.getService())
|
||||||
|
.eq(StrUtil.isNotEmpty(dto.getPlatform()), "platform", dto.getPlatform())
|
||||||
|
.orderByAsc("sort")
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ServiceMenuVO> collect = coreRoleService.menuChildrenWrap(list, null);
|
||||||
|
|
||||||
|
return ApiResp.respOK(collect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限-编辑
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/authority/update")
|
||||||
|
public ApiResp<String> menuUpdate(@RequestBody CoreRoleAuthority serviceMenu) {
|
||||||
|
serviceMenu.setParent(StrUtil.emptyToDefault(serviceMenu.getParent(), null));
|
||||||
|
if (StrUtil.isEmpty(serviceMenu.getId())) {
|
||||||
|
coreRoleService.getAuthorityMapper().insert(serviceMenu);
|
||||||
|
} else {
|
||||||
|
serviceMenu.setNo(null);
|
||||||
|
coreRoleService.getAuthorityMapper().updateById(serviceMenu);
|
||||||
|
}
|
||||||
|
return ApiResp.respOK("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自己拥有的服务
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/owner/server")
|
||||||
|
public ApiResp<List<CoreRoleServer>> ownerServer(TokenBean tokenBean) {
|
||||||
|
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId());
|
||||||
|
List<String> list = allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<CoreRoleServer> roleServerList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
roleServerList = coreRoleService.getServerMapper().selectList(new QueryWrapper<CoreRoleServer>()
|
||||||
|
.in("id", list)
|
||||||
|
.eq(CoreRoleServer.IS_DELETED, 0)
|
||||||
|
.eq("is_open", 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ApiResp.respOK(roleServerList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自己拥有的菜单
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/owner/menu")
|
||||||
|
public ApiResp<List<ServiceMenuVO>> ownerMenu(TokenBean tokenBean, @Valid OwnerMenuDTO dto) {
|
||||||
|
List<ServiceMenuVO> ownerMenus = coreRoleService.getOwnerMenus(tokenBean.getId(), tokenBean.getRoleId(), dto);
|
||||||
|
return ApiResp.respOK(ownerMenus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自己拥有的功能点
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/owner/point")
|
||||||
|
public ApiResp<List<CoreRoleAuthority>> ownerPoint(TokenBean tokenBean, @Valid OwnerPointDTO dto) {
|
||||||
|
|
||||||
|
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId());
|
||||||
|
|
||||||
|
String parentId;
|
||||||
|
if (StrUtil.isNotEmpty(dto.getParentNo())) {
|
||||||
|
CoreRoleAuthority selected = coreRoleService.getAuthorityMapper().selectOne(new QueryWrapper<CoreRoleAuthority>()
|
||||||
|
.eq("no", dto.getParentNo())
|
||||||
|
.eq("is_deleted", 0)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
parentId = selected == null ? "" : selected.getId();
|
||||||
|
} else {
|
||||||
|
parentId = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CoreRoleAuthority> collect = allOwnerMenus.stream()
|
||||||
|
.filter(it -> Objects.equals(it.getType(), "point"))
|
||||||
|
.filter(it -> it.getService().equals(dto.getService()))
|
||||||
|
.filter(it -> it.getPlatform().equals(dto.getPlatform()))
|
||||||
|
.filter(it -> {
|
||||||
|
if (StrUtil.isNotEmpty(parentId)) {
|
||||||
|
return parentId.equals(it.getParent());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return ApiResp.respOK(collect);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.tiesheng.role.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
|
||||||
|
|
||||||
|
public interface CoreRoleAuthorityMapper extends BaseMapper<CoreRoleAuthority> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.tiesheng.role.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleGroup;
|
||||||
|
|
||||||
|
public interface CoreRoleGroupMapper extends BaseMapper<CoreRoleGroup> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.tiesheng.role.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleGroupRx;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CoreRoleGroupRxMapper extends BaseMapper<CoreRoleGroupRx> {
|
||||||
|
/**
|
||||||
|
* 批量插入数据
|
||||||
|
*
|
||||||
|
* @param coreRoleGroupRxs
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int batchInsert(@Param("list") List<CoreRoleGroupRx> coreRoleGroupRxs);
|
||||||
|
}
|
||||||