Compare commits

...

120 Commits

Author SHA1 Message Date
丁磊
0f524274c3 publish 2.0.17-scope-0.2-test
All checks were successful
/ local-deploy (push) Successful in 19s
2025-06-10 10:09:18 +08:00
丁磊
7b7aee2495 refactor(login): 调整微信公众号 OAuth2 登录流程- 注释掉原有的授权 URL生成和重定向逻辑
- 新增测试用 TokenBean 对象,用于模拟登录成功后的处理
- 修改重定向 URL,增加测试参数
2025-06-10 10:08:44 +08:00
丁磊
82c8076724 publish 2.0.17-scope-0.1
All checks were successful
/ local-deploy (push) Successful in 20s
2025-06-09 18:11:51 +08:00
丁磊
7fe1b1d79b fix(login): 修改微信公众号授权类型
- 将 snsapi_userinfo 修改为 snsapi_base
-优化了微信公众号登录的授权流程
2025-06-09 18:11:21 +08:00
丁磊
64127f3802 build: 更新 plugin repository
-将 kepai-repo-plugin 修改为 tiesheng-repo-plugin
- 更新 URL 为 https://git.tieshengkeji.com/api/packages/tieshengkeji/maven
2025-06-09 18:10:52 +08:00
曾文豪
2cf88cefa7 publish 2.0.17
All checks were successful
/ local-deploy (push) Successful in 20s
2024-12-08 12:00:48 +08:00
曾文豪
9a56994342 publish 2.0.16
All checks were successful
/ local-deploy (push) Successful in 20s
2024-12-08 11:53:36 +08:00
曾文豪
a987689bd6 perf:优化登录次数校验 2024-12-08 11:53:11 +08:00
曾文豪
690dffa779 publish 2.0.15
All checks were successful
/ local-deploy (push) Successful in 18s
2024-12-08 10:23:38 +08:00
曾文豪
3ccbd6cd8e feat:configKey增加缓存 2024-12-08 10:22:44 +08:00
曾文豪
89e0c5d1d5 publish 2.0.14
All checks were successful
/ local-deploy (push) Successful in 21s
2024-11-21 15:22:36 +08:00
曾文豪
b15dbc6d4c perf:调整表结构 2024-11-21 15:21:58 +08:00
曾文豪
2f6b5b0b05 perf:更改一个方法的名称 2024-10-28 09:24:38 +08:00
曾文豪
832d615273 publish 2.0.13
All checks were successful
/ local-deploy (push) Successful in 19s
2024-10-10 16:20:35 +08:00
曾文豪
383a82e530 feat:增加useragent 2024-10-10 16:20:14 +08:00
曾文豪
6531709c69 feat:增加一个表单提交方法 2024-10-10 16:15:06 +08:00
曾文豪
6aaf91a755 publish 2.0.12
All checks were successful
/ local-deploy (push) Successful in 32s
2024-10-10 15:52:53 +08:00
曾文豪
f1ac7d6886 publish 2.0.12 2024-10-10 15:51:40 +08:00
曾文豪
2f07f9eb66 publish 2.0.11 2024-09-30 11:46:43 +08:00
曾文豪
919cd47623 publish 2.0.10 2024-09-23 15:50:36 +08:00
曾文豪
eb1c20b033 feat:授权增加一个备注字段 2024-09-19 14:13:13 +08:00
曾文豪
c1559e96be publish 2.0.9 2024-09-18 23:09:53 +08:00
曾文豪
9ef7d2d4a2 publish 2.0.8 2024-09-18 22:59:28 +08:00
曾文豪
b90e92f4cb perf: token兼容旧版本,旧版本使用的是10位数的秒作为数据 2024-09-18 22:59:10 +08:00
曾文豪
cb816d0ff0 publish 2.0.7 2024-09-18 17:27:45 +08:00
曾文豪
0470ca0b9a perf:空指针调整 2024-09-18 17:25:19 +08:00
曾文豪
d38077b0f8 perf:代码调整 2024-09-18 17:13:40 +08:00
曾文豪
2621c6dedc perf:可以不实现TsAuthorityHandler类 2024-09-18 16:47:29 +08:00
曾文豪
456a95778c publish 2.0.6 2024-09-18 16:30:49 +08:00
曾文豪
fd0976a30c Merge remote-tracking branch 'origin/master'
# Conflicts:
#	springboot-ademo/src/main/java/com/tiesheng/demo/controller/TestController.java
2024-09-18 14:53:10 +08:00
曾文豪
e519781207 fix:职位授权增加非空校验 2024-09-18 14:52:48 +08:00
曾文豪
e602f4c658 publish 2.0.5 2024-09-14 22:57:37 +08:00
曾文豪
a816acaddb fix:修复网络请求异常时,api日志记录不完整的bug 2024-09-14 22:57:03 +08:00
曾文豪
278429157a perf:钉钉单次同步调整为200 2024-09-14 22:38:07 +08:00
曾文豪
143b100819 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	springboot-platform/src/main/java/com/tiesheng/platform/config/ding/PlatformDingConfig.java
2024-09-14 22:36:38 +08:00
曾文豪
d0cd9aed0b perf:钉钉单次同步调整为200 2024-09-14 22:35:56 +08:00
曾文豪
3080d8a936 publish 2.0.4 2024-09-14 11:21:17 +08:00
曾文豪
3f951dfe47 fix:图像验证码的大小不能超过500x200 2024-09-12 14:20:17 +08:00
曾文豪
9c66dafe6b fix:权限组缺少deps属性 2024-09-12 14:17:18 +08:00
曾文豪
d6ed2b8037 publish 2.0.3 2024-09-10 11:08:06 +08:00
曾文豪
02c2ccc0ff perf:优化登录代码 2024-08-29 14:56:05 +08:00
曾文豪
f27d8d1658 publish 2.0.2 2024-08-28 20:40:43 +08:00
曾文豪
ba9d0da33f remove:移除了poi模块 2024-08-28 20:39:52 +08:00
曾文豪
4690fa9f88 perf:调整登录日志,同时限制登录失败次数(10分钟内最多5次) 2024-08-28 20:35:38 +08:00
曾文豪
a9f218de89 perf:移除encrypt模块,直接集成到web模块中 2024-08-28 19:41:45 +08:00
曾文豪
55324199cd feat:枚举表增加sort排序字段 2024-08-28 19:34:03 +08:00
曾文豪
0b32559630 feat:新增接口 /comm/role/group 获取角色、职位列表 2024-08-28 19:29:45 +08:00
曾文豪
01cc4f16ad perf:调用日志可以筛选 url 2024-08-28 19:22:26 +08:00
曾文豪
2b70c8121d publish 2.0.1 2024-08-27 13:41:58 +08:00
曾文豪
fd30c5cf36 perf:key不用实现TsAuthorityHandler类 2024-08-27 13:41:00 +08:00
曾文豪
0310bd4a15 perf:更新用户职位的时候,清除缓存 2024-08-27 13:38:57 +08:00
曾文豪
80ec6d2e3d perf:操作日志实时插入 2024-08-27 13:32:15 +08:00
曾文豪
d96f17b847 perf:调用日志只保存json,xml,text格式的返回值 2024-08-27 11:08:36 +08:00
曾文豪
7648eef981 perf:hutool.version放到parent中 2024-08-26 14:28:12 +08:00
曾文豪
79087f33e4 perf:过程日志改造 2024-08-26 13:47:31 +08:00
曾文豪
d0289d38b3 publish 2.0.0.rc46 2024-08-26 13:31:03 +08:00
曾文豪
90029faa53 publish 2.0.0.rc44 2024-08-26 13:23:51 +08:00
曾文豪
ecb5aa1b29 perf:过程日志改造 2024-08-26 13:20:45 +08:00
曾文豪
1db8ef9d85 publish 2.0.0.rc42 2024-08-23 15:04:40 +08:00
曾文豪
4bcae2f8d1 perf:移除hutool-json,直接使用fastjson 2024-08-23 15:04:20 +08:00
曾文豪
9bab4cdb25 feat:jwt中的hutool-json改为fastjson 2024-08-23 14:10:47 +08:00
曾文豪
856a9f01dd feat:把hutool的jwt直接放入util中 2024-08-23 11:38:29 +08:00
曾文豪
e57cd5e1c8 publish 2.0.0.rc40 2024-08-23 11:15:48 +08:00
曾文豪
542e23ac1b publish 2.0.0.rc38 2024-08-23 11:12:16 +08:00
曾文豪
6949f50c7c publish 2.0.0.rc37 2024-08-22 17:13:29 +08:00
曾文豪
7b43ae3ce1 publish 2.0.0.rc36 2024-08-22 17:09:14 +08:00
曾文豪
8ca283ca85 perf:登录的时候清除授权信息,相当于刷新一下权限 2024-08-22 09:46:04 +08:00
曾文豪
3728291e73 publish 2.0.0.rc35 2024-08-19 19:15:56 +08:00
曾文豪
6997dea968 publish 2.0.0.rc34 2024-08-16 11:50:48 +08:00
曾文豪
7f601c8e60 publish 2.0.0.rc33 2024-08-16 11:46:30 +08:00
曾文豪
7adc2a7c4b fix:修复无法删除权限的bug 2024-08-15 15:00:26 +08:00
曾文豪
f4f082cc86 publish 2.0.0.rc32 2024-08-13 16:52:08 +08:00
曾文豪
d21d84bc87 publish 2.0.0.rc30 2024-08-13 15:59:50 +08:00
曾文豪
60f996137f publish 2.0.0.rc28 2024-08-13 15:19:03 +08:00
曾文豪
11c8d234ff publish 2.0.0.rc26 2024-08-13 15:07:10 +08:00
曾文豪
125c681669 feat:新增deps和授权类型,用于解决依赖问题 2024-08-13 15:06:31 +08:00
曾文豪
b9347013f0 perf:权限增加一个source字段,用于标记权限来源 2024-08-13 14:49:22 +08:00
曾文豪
3415f0836f fix:修复platform获取方式异常的bug 2024-08-13 14:42:11 +08:00
曾文豪
22672c8a9e publish 2.0.0.rc25 2024-08-12 14:57:08 +08:00
曾文豪
a405aa7057 publish 2.0.0.rc24 2024-08-12 14:56:57 +08:00
曾文豪
e39dd646f5 publish 2.0.0.rc23 2024-08-12 14:38:13 +08:00
曾文豪
2ca224f7a5 fix:允许取消所有的授权 2024-08-11 20:19:57 +08:00
曾文豪
d4e97babf4 publish 2.0.0.rc22 2024-08-09 18:24:47 +08:00
曾文豪
a1c75d010b publish 2.0.0.rc21 2024-08-09 17:20:56 +08:00
曾文豪
9b6b3af33e publish 2.0.0.rc20 2024-08-08 16:20:34 +08:00
曾文豪
91833a44bb feat:增加RoleIgnore 2024-08-08 16:20:05 +08:00
曾文豪
8dc8709499 perf:代码结构调整 2024-08-08 16:16:21 +08:00
曾文豪
b34d9d6242 publish 2.0.0.rc19 2024-08-08 11:27:50 +08:00
曾文豪
2c9519a35e publish 2.0.0.rc18 2024-08-08 11:11:40 +08:00
曾文豪
f5dfce08ed publish 2.0.0.rc17 2024-08-08 09:24:00 +08:00
曾文豪
5d4e97b206 feat:增加权限校验 2024-08-08 09:23:30 +08:00
曾文豪
82d3f471f9 perf:TokenBean移除无用的属性 2024-08-07 23:43:57 +08:00
曾文豪
316909dd61 perf:调整授权缓存 2024-08-07 23:13:55 +08:00
曾文豪
5e308be3ba publish 2.0.0.rc16 2024-08-07 22:16:12 +08:00
曾文豪
ba80cebc45 feat:提交角色授权 2024-08-07 22:15:40 +08:00
曾文豪
0f5cdb49c0 feat:增加权限校验 2024-08-07 19:02:54 +08:00
曾文豪
1ee4b4af30 perf:请求时将通过getCurrentUserName()方法返回的对象检验用户是否非法 2024-08-07 14:09:28 +08:00
曾文豪
bb38428708 publish 2.0.0.rc15 2024-08-05 19:11:17 +08:00
曾文豪
a22467d4f1 publish 2.0.0.rc14 2024-08-05 14:59:55 +08:00
曾文豪
ad90c83cf7 perf:调整消息日志相关代码 2024-08-05 14:46:54 +08:00
曾文豪
cdae6a9868 publish 2.0.0.rc13 2024-08-05 14:19:06 +08:00
曾文豪
be08001f3f publish 2.0.0.rc13 2024-08-05 14:18:50 +08:00
曾文豪
333d283e24 perf:移除hutool的http模块,使用okhttp3 2024-07-30 13:39:45 +08:00
曾文豪
450d1fb869 publish 2.0.0.rc12 2024-07-29 14:28:21 +08:00
曾文豪
1412782327 publish 2.0.0.rc11 2024-07-29 10:31:03 +08:00
曾文豪
6127cd50a9 publish 2.0.0.rc10 2024-07-29 09:53:44 +08:00
曾文豪
19f4d0395e publish 2.0.0.rc9 2024-07-29 09:42:53 +08:00
曾文豪
d52edbb23c perf:钉钉对接调整 2024-07-26 16:12:29 +08:00
曾文豪
6c6d713c01 publish 2.0.0.rc8 2024-07-25 17:35:51 +08:00
曾文豪
8ea34c3ee0 perf:移除TimedCacheService、TimedCacheHelper,新增TsCacheService,同时实现了内存缓存、Redis缓存 2024-07-25 17:35:01 +08:00
曾文豪
d357fa7c85 publish 2.0.0.rc7 2024-07-12 11:17:04 +08:00
曾文豪
6332d1486b publish 2.0.0.rc6 2024-07-12 11:16:46 +08:00
曾文豪
e709050ba3 publish 2.0.0.rc6 2024-07-11 16:03:07 +08:00
曾文豪
59926aa2f4 publish 2.0.0.rc5 2024-07-11 15:37:03 +08:00
曾文豪
5da83bb477 publish 2.0.0.rc4 2024-07-11 15:21:59 +08:00
曾文豪
fb1f7c4e37 perf:移除matching-strategy属性 2024-07-04 16:22:46 +08:00
曾文豪
f831f4faf0 publish 2.0.0.rc3 2024-07-03 14:01:53 +08:00
曾文豪
d7016b418e perf:操作日志执行批量插入 2024-07-03 13:57:10 +08:00
曾文豪
fd92109e2e fix:角色列表和角色授权bug 2024-07-03 13:31:23 +08:00
曾文豪
c9679eeeac publish 2.0.0.rc2 2024-06-28 10:57:08 +08:00
247 changed files with 6905 additions and 2446 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -0,0 +1,25 @@
## 工作流触发时机
on:
push:
tags:
- '*'
jobs:
## 任务名称
local-deploy:
## 任务执行的服务器
runs-on: tiesheng-local
## 任务步骤
steps:
## 检出代码(固定配置)
- name: Check out repository code
uses: https://git.tieshengkeji.com/actions/checkout@v4
## maven打包
- name: Maven deploy
run: |
mvn deploy

View File

@@ -1,94 +1,21 @@
## 1.1.0
## 2.0.12
- featglobalConfig增加ext属性。
- feat增加网络请求超时、重定向的配置。
- perf更新数据库对比插件。
- feat(web)增加DaoBase的常量。
- perf(web):操作日志优化。
- 调整OkHttp日志
## 1.0.12
## 2.0.0.rc46
- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。
- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。
- perf(login):可重写**onSignError**方法自定义验签错误的跳转。
- fix(login)修复微信、钉钉授权跳转地址错误的bug
现在导入导出都接入底层流程,无需新增接口,只需要实现接口即可。
## 1.0.7
- 过程日志不再和操作日志同时存在
- 过程日志新增params参数
- 通过实现*TsImportHandler*接口编写导入逻辑
- 通过实现*TsExportHandler*接口编写导出逻辑
- feat(web): 增加uploadFileCustomize方法允许自定义文件存放情况
- feat(database): 增加db/data目录存放初始化数据的sql
- perf(login): 增加默认值防止token解析异常
## 2.0.0.rc4
## 1.0.6
- perfTsTokenConfig不在提供静态方法
- perf移除TsTokenAspect由TokenWebMvcConfigurer替代并实现TokenBean参数注入
- 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
- perfhutool依赖升级5.8.11 -> 5.8.16
- perffastjson依赖升级1.2.78 -> 1.2.83
- perfmybatis-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
### 增加
> 1TsTokenConfig增加新的属性**ignorePaths**用于通过路径忽略token
> 2PasswordUtils增加密码复杂度校验方法
> 3PasswordUtils.verifyPassword增加登录次数限制10分钟内不能错误6次
>
### 调整
> 1TsTokenConfig中的**ignores**属性调整为**testMap**

94
CHANGELOG_V1.md Normal file
View File

@@ -0,0 +1,94 @@
## 1.1.0
- featglobalConfig增加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
- perfhutool依赖升级5.8.11 -> 5.8.16
- perffastjson依赖升级1.2.78 -> 1.2.83
- perfmybatis-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
### 增加
> 1TsTokenConfig增加新的属性**ignorePaths**用于通过路径忽略token
> 2PasswordUtils增加密码复杂度校验方法
> 3PasswordUtils.verifyPassword增加登录次数限制10分钟内不能错误6次
>
### 调整
> 1TsTokenConfig中的**ignores**属性调整为**testMap**

45
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -23,10 +23,8 @@
<module>springboot-login</module>
<module>springboot-web</module>
<module>springboot-util</module>
<module>springboot-poi</module>
<module>springboot-platform</module>
<module>springboot-message</module>
<module>springboot-encrypt</module>
<module>springboot-annotation</module>
<module>springboot-role</module>
</modules>
@@ -35,6 +33,8 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hutool.version>5.8.31</hutool.version>
</properties>
<developers>
@@ -58,61 +58,49 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>2.0.0.rc1</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-role</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>2.0.0.rc1</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-poi</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</dependency>
<dependency>
@@ -132,11 +120,18 @@
<pluginRepositories>
<pluginRepository>
<id>kepai-repo-plugin</id>
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
<id>tiesheng-repo-plugin</id>
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>gitea</id>
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
</repository>
</distributionManagement>
<build>
<pluginManagement>
<plugins>

31
qodana.yaml Normal file
View File

@@ -0,0 +1,31 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"
#Specify inspection profile for code analysis
profile:
name: qodana.starter
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>
projectJDK: 17 #(Applied in CI/CD pipeline)
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-jvm:latest

Binary file not shown.

View File

@@ -6,11 +6,11 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</parent>
<artifactId>springboot-ademo</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@@ -36,6 +36,12 @@
<artifactId>easyexcel</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.7.0</version>
</dependency>
</dependencies>
<repositories>

Binary file not shown.

Binary file not shown.

View File

@@ -1,11 +1,12 @@
package com.tiesheng.demo.config;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.web.pojos.RequestUserInfo;
import com.tiesheng.web.pojos.dao.CorePlatformUnique;
import com.tiesheng.web.service.TieshengWebConfigurer;
import com.tiesheng.util.pojos.TokenBean;
import com.tiesheng.login.pojos.RequestUserInfo;
import com.tiesheng.login.pojos.dao.CorePlatformUnique;
import com.tiesheng.login.service.TsLoginConfigurer;
import com.tiesheng.util.config.GlobalConfig;
import com.tiesheng.util.pojos.TokenBean;
import com.tiesheng.web.service.TieshengWebConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -13,24 +14,26 @@ import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
@Component
public class DemoWebConfigurer implements TieshengWebConfigurer {
@Autowired
GlobalConfig globalConfig;
public class DemoWebConfigurer implements TieshengWebConfigurer, TsLoginConfigurer {
@Override
public RequestUserInfo getCurrentUserName(TokenBean tokenBean) {
RequestUserInfo info = new RequestUserInfo();
info.setId("1");
info.setName("test");
info.setId(tokenBean.getId());
info.setName(tokenBean.getExtra());
return info;
}
@Override
public TokenBean login(CorePlatformUnique platformUnique) {
TokenBean tokenBean = null;
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
tokenBean = new TokenBean(platformUnique.getUserId(), "super");
} else if (Objects.equals(platformUnique.getUniqueId(), "1110290049")) {
tokenBean = new TokenBean("1", "super");
}
if (tokenBean != null) {
tokenBean.setExtra("1110290049");
}
return tokenBean;
@@ -39,13 +42,11 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
@Override
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
// 默认跳转到mobile
to = StrUtil.emptyToDefault(to, "mobile");
bean.setEnvironmentType(to);
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
}
}
@Override
public TsLoginConfigurer configureLogin() {
return this;
}
}

View File

@@ -1,15 +0,0 @@
package com.tiesheng.demo.config;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class DemoWebMvcConfigurer implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/mobile/**").addResourceLocations("classpath:/mobile/0.0.13/");
}
}

View File

@@ -1,8 +1,6 @@
package com.tiesheng.demo.config;
import com.tiesheng.web.service.CoreConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@@ -13,9 +11,6 @@ import javax.annotation.PostConstruct;
@Component
public class TestJobConfig {
@Autowired
CoreConfigService coreConfigService;
@PostConstruct
public void init() {
}

View File

@@ -1,41 +1,49 @@
package com.tiesheng.demo.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;
import cn.hutool.json.JSONUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.log.LogFactory;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.annotation.role.RoleAuthority;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.web.service.CoreLogService;
import com.tiesheng.web.service.CoreMessageService;
import com.tiesheng.web.util.ProcessImportConsumer;
import com.tiesheng.database.config.DbBackupConfig;
import com.tiesheng.demo.pojos.JsonTest;
import com.tiesheng.demo.pojos.PoiBean;
import com.tiesheng.demo.pojos.TestFile;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.message.pojos.MessageReqResp;
import com.tiesheng.message.pojos.UserChannel;
import com.tiesheng.platform.config.ding.PlatformDingConfig;
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
import com.tiesheng.util.config.EncryptConfig;
import com.tiesheng.util.config.GlobalConfig;
import com.tiesheng.util.config.Ip2regionConfig;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.FileUploadPath;
import com.tiesheng.util.service.TsCacheService;
import com.tiesheng.util.service.http.OkHttpUtil;
import com.tiesheng.web.service.CoreLogService;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
/**
* @author hao
*/
@RestController
@RequestMapping("/test")
@RoleAuthority(value = "test", group = "test")
public class TestController {
@Autowired
@@ -47,59 +55,88 @@ public class TestController {
@Autowired
EncryptConfig encryptConfig;
@Autowired
CoreMessageService coreMessageService;
@Autowired
CoreLogService coreLogService;
@Autowired
DbBackupConfig dbBackupConfig;
@Autowired
TsCacheService tsCacheService;
@Autowired
PlatformDingConfig platformDingConfig;
@RequestMapping("/index")
public ApiResp<String> index() {
return ApiResp.respOK("hello world");
@TokenIgnore
public void index(HttpServletResponse response) {
globalConfig.redirectWithVer("mobile", "/test", response);
}
@RequestMapping("/redirect")
@TokenIgnore
public void redirect(HttpServletResponse response) {
@RoleAuthority("redirect")
public ApiResp<JsonTest> redirect(HttpServletResponse response) {
ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
@Override
public int accept(List<String> list) {
LogFactory.get().info("list: " + list.size());
return 0;
}
String s1 = encryptConfig.passwdCreate("qU3?wE3{bX", "");
LogFactory.get().info(s1);
@Override
public String getFailFile() {
LogFactory.get().info("getFailFile: " + strings.size());
return null;
}
});
JsonTest jsonTest = new JsonTest();
jsonTest.setNow(DateUtil.date());
jsonTest.setNow1(DateUtil.date());
LogFactory.get().info("strings: " + strings.size());
String jsonString = JSON.toJSONString(jsonTest);
LogFactory.get().info(jsonString);
String s = OkHttpUtil.get("http://toolbox.tieshengkeji.com/test/login/23232/3232");
LogFactory.get().info(s);
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
// @Override
// public int accept(List<String> list) {
// LogFactory.get().info("list: " + list.size());
// return 0;
// }
//
// @Override
// public String getFailFile() {
// LogFactory.get().info("getFailFile: " + strings.size());
// return null;
// }
// });
//
// LogFactory.get().info("strings: " + strings.size());
// tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
globalConfig.redirect("mobile", "/test", response);
// globalConfig.redirect("mobile", "/test", response);
return ApiResp.respOK(jsonTest);
}
@GetMapping("/send")
@TokenIgnore
public ApiResp<MessageReqResp> sendMessage() {
public ApiResp<String> sendMessage() {
MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
// MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
// JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
return ApiResp.respOK(reqResp);
return ApiResp.respOK(null);
}
@RequestMapping("/export")
@TokenIgnore
public ApiResp<String> export() {
// tsCacheService.put("fdfhdfd", "fdfdfdfd");
// String s = tsCacheService.get("fdfhdfd");
// LogFactory.get().info("export: " + s);
platformDingConfig.syncDeptUser("", null, new Consumer<DingUserInfo>() {
@Override
public void accept(DingUserInfo dingUserInfo) {
}
});
// List<TestFile> list = new ArrayList<>();
// list.add(new TestFile("11111"));
// list.add(new TestFile("22222"));
@@ -120,7 +157,7 @@ public class TestController {
}
@RequestMapping("searchIP")
@PostMapping("searchIP")
@TokenIgnore
public ApiResp<String> searchIp() {
String search = ip2regionConfig.search("127.0.0.1");
@@ -128,17 +165,6 @@ public class TestController {
}
@RequestMapping("desensitize")
@TokenIgnore
public ApiResp<List<TestFile>> desensitize() {
TestFile file = new TestFile("11111");
file.setTest("111111");
TestFile file1 = new TestFile("22222");
file1.setTest("22222");
return ApiResp.respOK(CollUtil.newArrayList(file, file1));
}
@RequestMapping("passwd")
@TokenIgnore
public ApiResp<String> passwd() {
@@ -175,18 +201,33 @@ public class TestController {
return ApiResp.respOK("");
}
@RequestMapping("poiTool")
@GetMapping("getwxacode")
@TokenIgnore
public ApiResp<String> poiTool() {
TimeInterval timeInterval = new TimeInterval();
FileUploadPath file = FileUploadPath.file("/upload/test.xlsx");
ExcelUtil.getReader(new File(file.getAbsolutePath())).read();
System.out.println("timeInterval: " + timeInterval.interval());
return ApiResp.respOK("");
public ApiResp<String> getwxacode() {
String id = "test_1111111";
FileUploadPath path = FileUploadPath.random("png");
JSONObject paramJson = new JSONObject();
paramJson.put("page", "pages/login/index");
paramJson.put("scene", "no=" + id);
paramJson.put("env_version", "develop");
paramJson.put("width", 430);
paramJson.put("is_hyaline", false);
paramJson.put("auto_color", false);
FileUploadPath file = FileUploadPath.file(id + ".png");
try {
Request request = OkHttpUtil.ofPost("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" +
"83_7xqG36kdgwuf8zzWLY3jtz7bg4ucziN-0oxbE0X9zBzwbjZ4S4Ss2RM9uHeSIcRp2K-wEp6MLzWhqo2AXj0Jpzd6IiJdUsRxqdHPvEWqAdOgt83vzZwdDf7tZBkGNGeAFASZS",
paramJson);
Response execute1 = OkHttpUtil.ofHttpClient().build().newCall(request).execute();
if (execute1.body() != null) {
FileUtil.writeFromStream(execute1.body().byteStream(), file.getAbsolutePath());
execute1.close();
}
} catch (Exception e) {
throw new ApiException("每分钟最多生成5000个二维码请稍后再试");
}
return ApiResp.respOK(path.getHttpPath());
}
}

View File

@@ -0,0 +1,60 @@
package com.tiesheng.demo.pojos;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.Date;
public class JsonTest {
private Date now;
@JSONField(format = "yyyy-MM-dd")
private Date now1;
private String no;
private String name;
private JsonTest child;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public Date getNow() {
return now;
}
public void setNow(Date now) {
this.now = now;
}
public Date getNow1() {
return now1;
}
public void setNow1(Date now1) {
this.now1 = now1;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public JsonTest getChild() {
return child;
}
public void setChild(JsonTest child) {
this.child = child;
}
}

View File

@@ -1,21 +0,0 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestFile extends TestParent implements PoiWriteBase {
private String name;
public TestFile(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -1,33 +0,0 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.annotation.desensitize.Desensitize;
import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestParent implements PoiWriteBase {
private String id;
@Desensitize()
private String test;
///////////////////////////////////////////////////////////////////////////
// setter、getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
}

View File

@@ -1,10 +1,9 @@
package com.tiesheng.demo.service;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.message.config.aliyun.AliyunSmsHandler;
import com.tiesheng.message.pojos.AliyunTempParam;
import com.tiesheng.message.config.aliyun.AliyunTempParam;
import org.springframework.stereotype.Service;
import java.util.Objects;
@@ -15,16 +14,17 @@ public class DemoSmsHandler implements AliyunSmsHandler {
@Override
public AliyunTempParam handler(JSONObject obj) {
String action = obj.getStr("action");
String action = obj.getString("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())
);
JSONObject object = new JSONObject();
object.put("date", DateUtil.today());
param.setTemplateParam(object);
}
return param;

View File

@@ -0,0 +1,39 @@
package com.tiesheng.demo.service;
import cn.hutool.core.collection.CollUtil;
import com.tiesheng.util.pojos.TokenBean;
import com.tiesheng.web.pojos.imex.ImportDealDTO;
import com.tiesheng.web.service.imex.TsImportHandler;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserImportHandler implements TsImportHandler<String> {
@Override
public List<String> ready(ImportDealDTO dto, TokenBean token) {
return CollUtil.newArrayList("11111");
}
@Override
public String getTemplateUrl() {
return "/template/xsxxzx_teacher_leader.xlsx";
}
@Override
public String getAction() {
return "user_import";
}
@Override
public int batchHandler(List<String> list) {
return 0;
}
@Override
public String getResultFile() {
return "";
}
}

View File

@@ -7,8 +7,17 @@ spring:
url: jdbc:mysql://47.96.30.85:3306/com_tiesheng_web?useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&queryTimeout=5400&allowMultiQueries=true&serverTimezone=GMT%2B8
username: com_tiesheng_web
password: 4Xo$XheGFc
redis:
url: redis://kyF0zUL3011111@47.96.30.85:6234
database: 1
platform:
ding:
global:
corpId: dingebe664cb3baf3a52a39a90f97fcb1e09
agentId: 2474444028
appKey: dingyvf1niiajfaajyo5
appSecret: y6SGZ4fvPbdbj4RVbDWLeMBkGgplaOdnTA_9wN5TDdOV_Y47alYc1LDlIHjsBJE1
wxmp:
global:
app-id: wxa0343fe519824651
@@ -18,11 +27,12 @@ tiesheng:
token:
test-map:
"1111":
id: "1111"
role-id: "student_bks"
id: "1"
role-id: "1822829641023524865"
global:
version: 2
host: http://localhost:8100
service: yrx
aliyun:
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG

View File

@@ -13,16 +13,9 @@ spring:
web:
resources:
static-locations: classpath:/static/,file:static/
mvc:
pathmatch:
matching-strategy: ant_path_matcher
## 日志
logging:
file:
name: runtime/logs/tiesheng.log
tiesheng:
token:
ignore-paths:
- /test/index

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,42 @@
package com.tiesheng.demo;
import cn.hutool.core.date.DateUtil;
import cn.hutool.log.LogFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONPath;
import com.tiesheng.demo.pojos.JsonTest;
import com.tiesheng.login.pojos.RequestUserInfo;
public class MainTest {
public static void main(String[] args) {
MainTest test = new MainTest();
test.testJsonSelf();
}
private void testJsonSelf() {
RequestUserInfo info = new RequestUserInfo();
info.setId("1");
info.setName("name");
info.setData(info);
String jsonStr = JSON.toJSONString(info);
LogFactory.get().info(jsonStr);
}
private void testJsonPath() {
JsonTest jsonTest = new JsonTest();
jsonTest.setNo("1111");
jsonTest.setName("1111");
jsonTest.setNow(DateUtil.date());
jsonTest.setChild(jsonTest);
JSONPath jsonPath = JSONPath.compile("child.no");
String eval = jsonPath.eval(jsonTest, String.class);
LogFactory.get().info(eval);
}
}

BIN
springboot-annotation/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -1,16 +0,0 @@
package com.tiesheng.annotation.desensitize;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author hao
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Desensitize {
int prefix() default 1;
int suffix() default 1;
}

View File

@@ -0,0 +1,41 @@
package com.tiesheng.annotation.role;
import java.lang.annotation.*;
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface RoleAuthority {
/**
* 编号
*
* @return
*/
String value();
/**
* 平台类型
*
* @return
*/
String platform() default "";
/**
* 分组
*
* @return
*/
String[] group() default {};
/**
* 依赖其他权限
*
* @return
*/
String[] deps() default {};
}

View File

@@ -0,0 +1,9 @@
package com.tiesheng.annotation.role;
import java.lang.annotation.*;
@Target({ElementType.METHOD})
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface RoleIgnore {
}

BIN
springboot-database/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -1,40 +0,0 @@
<?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.rc1</version>
</parent>
<artifactId>springboot-encrypt</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,10 +0,0 @@
package com.tiesheng.encrypt;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan({
"com.tiesheng.encrypt.**.*",
})
public class EncryptAutoConfigurer {
}

BIN
springboot-login/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc1</version>
<version>2.0.17-scope-0.2-test</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -1,16 +0,0 @@
package com.tiesheng.login;
import com.tiesheng.platform.PlatformAutoConfigurer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
/**
* @author hao
*/
@ComponentScan({
"com.tiesheng.login.**.*",
})
@Import(PlatformAutoConfigurer.class)
public class LoginAutoConfigurer {
}

View File

@@ -0,0 +1,121 @@
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.login.pojos.RequestUserInfo;
import com.tiesheng.login.service.TsLoginConfigurer;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.TokenBean;
import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
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;
@Resource
TsLoginConfigurer tsLoginConfigurer;
@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;
if (handlerMethod.getBeanType() == BasicErrorController.class) {
return true;
}
TokenIgnore annotation = handlerMethod.getBeanType().getAnnotation(TokenIgnore.class);
if (annotation != null) {
return true;
}
TokenIgnore apiTokenIgnore = handlerMethod.getMethodAnnotation(TokenIgnore.class);
if (apiTokenIgnore != null) {
return true;
}
// 验证TOKEN是否存在
TokenBean tokenBean = tsTokenConfig.validToken(request, true);
// 验证用户是否存在
RequestUserInfo cachedUserInfo = tsLoginConfigurer.getCachedUserInfo(tokenBean, false);
if (cachedUserInfo == null) {
throw new ApiException("非法TOKEN请重新登录");
}
return true;
}
});
}
}

View File

@@ -1,88 +0,0 @@
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.ServletKit;
import com.tiesheng.util.config.TsTokenConfig;
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);
}
}

View File

@@ -6,13 +6,11 @@ import cn.hutool.core.util.URLUtil;
import com.alibaba.fastjson.JSON;
import com.tiesheng.annotation.operation.OperationIgnore;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.util.pojos.TokenBean;
import com.tiesheng.login.pojos.CodeExtraDTO;
import com.tiesheng.login.pojos.DoLoginInfo;
import com.tiesheng.login.pojos.UniqueIndexDTO;
import com.tiesheng.login.pojos.WxminiLoginVo;
import com.tiesheng.login.service.TieshengLoginConfigurer;
import com.tiesheng.login.service.CorePlatformUniqueService;
import com.tiesheng.platform.config.ding.PlatformDingConfig;
import com.tiesheng.platform.config.ding.bean.DingJsapiSignature;
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
@@ -23,8 +21,10 @@ import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
import com.tiesheng.platform.config.wxmp.bean.WxJsapiSignature;
import com.tiesheng.platform.config.wxmp.bean.WxUserInfo;
import com.tiesheng.util.config.GlobalConfig;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.TokenBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -49,7 +49,7 @@ public class LoginController {
@Autowired
PlatformWxminiConfig platformWxminiConfig;
@Autowired
TieshengLoginConfigurer tieshengLoginConfigurer;
CorePlatformUniqueService corePlatformUniqueService;
@Autowired
GlobalConfig globalConfig;
@Autowired
@@ -65,13 +65,13 @@ public class LoginController {
@OperationIgnore
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
if (tsTokenConfig.isValidLoginSign() && !dto.validSign()) {
tieshengLoginConfigurer.onSignError(response);
corePlatformUniqueService.redirect(null, dto.getTo(), dto.getExtra(), response);
return;
}
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo("web_unique_redirect",
dto.getNo(), dto.getPlatform(), dto.getInfo()));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -84,9 +84,9 @@ public class LoginController {
@PostMapping("/unique/index")
@OperationIgnore
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo("web_unique_index",
dto.getNo(), dto.getPlatform(), dto.getInfo()));
if (tokenBean == null || StrUtil.isEmpty(tokenBean.getId())) {
if (!TsTokenConfig.validToken(tokenBean)) {
throw new ApiException("登录失败");
}
return ApiResp.respOK(tokenBean.toToken());
@@ -134,9 +134,9 @@ public class LoginController {
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
DingUserSimple userSimple = platformDingConfig.getUserIdByCode(service, dto.getCode());
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, userSimple.getUserid());
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(dingUserInfo.getAppId(),
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -170,8 +170,9 @@ public class LoginController {
extra = "";
}
String configUrl = globalConfig.buildPath("/login/wxmp/oauth2/" + service + "?extra=" + extra);
String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_userinfo");
response.sendRedirect(authorizationUrl);
// String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_base");
// response.sendRedirect(authorizationUrl);
response.sendRedirect(configUrl+"&to=mobile&code=200");
}
@@ -181,10 +182,14 @@ public class LoginController {
@RequestMapping("/wxmp/oauth2/{service}")
@OperationIgnore
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
// WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
// TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(wxUserInfo.getAppId(),
// wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
TokenBean tokenBean = new TokenBean();
tokenBean.setId("testid");
tokenBean.setRoleId("testroleid");
tokenBean.setExtra("testextra");
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -214,12 +219,12 @@ public class LoginController {
public ApiResp<WxminiLoginVo> wxminiIndex(@PathVariable String service, String code) {
String openid = platformWxminiConfig.jscode2session(service, code);
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(configBean.getAppId(),
openid, "wxmini", "{}"));
WxminiLoginVo loginVo = new WxminiLoginVo();
loginVo.setOpenid(openid);
if (tokenBean != null) {
if (TsTokenConfig.validToken(tokenBean)) {
loginVo.setToken(tokenBean.toToken());
}
return ApiResp.respOK(loginVo);

View File

@@ -0,0 +1,18 @@
package com.tiesheng.login.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.login.pojos.dao.CoreLogLogin;
import org.apache.ibatis.annotations.Param;
public interface CoreLogLoginMapper extends BaseMapper<CoreLogLogin> {
/**
* 获取登录失败的次数
*
* @param ip
* @return
*/
int getLoginErrorTimes(@Param("ip") String ip);
}

View File

@@ -1,7 +1,7 @@
package com.tiesheng.web.mapper;
package com.tiesheng.login.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.web.pojos.dao.CorePlatformUnique;
import com.tiesheng.login.pojos.dao.CorePlatformUnique;
public interface CorePlatformUniqueMapper extends BaseMapper<CorePlatformUnique> {
}

View File

@@ -1,5 +1,9 @@
package com.tiesheng.login.pojos;
import com.tiesheng.util.ServletKit;
import javax.servlet.http.HttpServletRequest;
public class DoLoginInfo {
private String appId;
@@ -7,12 +11,16 @@ public class DoLoginInfo {
private String platform;
private String info;
private String extra;
private String loginIp;
public DoLoginInfo(String appId, String unique, String platform, String info) {
this.appId = appId;
this.unique = unique;
this.platform = platform;
this.info = info;
// 设置IP
this.loginIp = ServletKit.getClientIP();
}
///////////////////////////////////////////////////////////////////////////
@@ -58,4 +66,12 @@ public class DoLoginInfo {
public void setExtra(String extra) {
this.extra = extra;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
}

View File

@@ -1,4 +1,4 @@
package com.tiesheng.web.pojos;
package com.tiesheng.login.pojos;
/**
* 当前token的数据

View File

@@ -1,4 +1,4 @@
package com.tiesheng.web.pojos.dao;
package com.tiesheng.login.pojos.dao;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -16,13 +16,13 @@ public class CoreLogLogin extends DaoBase {
private String userId;
/**
* 用户id
* 用户姓名
*/
@TableField(value = "user_name")
private String userName;
/**
* ip
* 登录方式
*/
@TableField(value = "platform")
private String platform;
@@ -39,6 +39,18 @@ public class CoreLogLogin extends DaoBase {
@TableField(value = "address")
private String address;
/**
* 登录结果,0否1是
*/
@TableField(value = "`result`")
private Integer result;
/**
* 请求参数
*/
@TableField(value = "params")
private String params;
/**
* 获取用户id
*
@@ -57,18 +69,38 @@ public class CoreLogLogin extends DaoBase {
this.userId = userId;
}
/**
* 获取用户姓名
*
* @return user_name - 用户姓名
*/
public String getUserName() {
return userName;
}
/**
* 设置用户姓名
*
* @param userName 用户姓名
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* 获取登录方式
*
* @return platform - 登录方式
*/
public String getPlatform() {
return platform;
}
/**
* 设置登录方式
*
* @param platform 登录方式
*/
public void setPlatform(String platform) {
this.platform = platform;
}
@@ -108,4 +140,40 @@ public class CoreLogLogin extends DaoBase {
public void setAddress(String address) {
this.address = address;
}
/**
* 获取登录结果,0否1是
*
* @return result - 登录结果,0否1是
*/
public Integer getResult() {
return result;
}
/**
* 设置登录结果,0否1是
*
* @param result 登录结果,0否1是
*/
public void setResult(Integer result) {
this.result = result;
}
/**
* 获取请求参数
*
* @return params - 请求参数
*/
public String getParams() {
return params;
}
/**
* 设置请求参数
*
* @param params 请求参数
*/
public void setParams(String params) {
this.params = params;
}
}

View File

@@ -1,4 +1,4 @@
package com.tiesheng.web.pojos.dao;
package com.tiesheng.login.pojos.dao;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

Some files were not shown because too many files have changed in this diff Show More