Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
ef5861327c | ||
|
|
23faaa8f67 | ||
|
|
341c82e0bc | ||
|
|
d2d53523a8 | ||
|
|
fc00bad49a | ||
|
|
6dd4e19e39 | ||
|
|
4373ec7c0e | ||
|
|
5cc135d8e2 | ||
|
|
69a9681b48 | ||
|
|
6c39dc24bd |
@@ -4,7 +4,7 @@ stages:
|
|||||||
deploy-jar:
|
deploy-jar:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
tags:
|
tags:
|
||||||
- hzkepai
|
- zengos
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
script:
|
script:
|
||||||
|
|||||||
93
CHANGELOG.md
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
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
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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
|
<artifactId>springboot-role</artifactId>
|
||||||
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
BIN
springboot-ademo/.DS_Store
vendored
BIN
springboot-ademo/.DS_Store
vendored
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>1.0.13</version>
|
<version>2.0.0.rc4</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/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
springboot-ademo/src/main/java/com/tiesheng/demo/.DS_Store
vendored
Normal file
BIN
springboot-ademo/src/main/java/com/tiesheng/demo/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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;
|
||||||
|
|||||||
@@ -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,14 @@ 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.web.service.CoreLogService;
|
||||||
import com.tiesheng.core.service.CoreMessageService;
|
import com.tiesheng.web.service.CoreMessageService;
|
||||||
import com.tiesheng.core.util.ProcessImportConsumer;
|
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 +27,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;
|
||||||
@@ -58,7 +56,6 @@ public class TestController {
|
|||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
public ApiResp<String> index() {
|
public ApiResp<String> index() {
|
||||||
dbBackupConfig.dbBackup();
|
|
||||||
return ApiResp.respOK("hello world");
|
return ApiResp.respOK("hello world");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +91,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,12 +9,10 @@ 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:
|
||||||
@@ -24,3 +22,4 @@ tiesheng:
|
|||||||
token:
|
token:
|
||||||
ignore-paths:
|
ignore-paths:
|
||||||
- /test/index
|
- /test/index
|
||||||
|
|
||||||
|
|||||||
BIN
springboot-annotation/.DS_Store
vendored
Normal file
BIN
springboot-annotation/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
BIN
springboot-database/.DS_Store
vendored
Normal file
BIN
springboot-database/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
BIN
springboot-encrypt/.DS_Store
vendored
Normal file
BIN
springboot-encrypt/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
BIN
springboot-login/.DS_Store
vendored
Normal file
BIN
springboot-login/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
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.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);
|
||||||
|
return tsTokenConfig.validToken(header, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new HandlerInterceptor() {
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -16,6 +16,7 @@ import com.tiesheng.login.service.TieshengLoginConfigurer;
|
|||||||
import com.tiesheng.platform.config.ding.PlatformDingConfig;
|
import com.tiesheng.platform.config.ding.PlatformDingConfig;
|
||||||
import com.tiesheng.platform.config.ding.bean.DingJsapiSignature;
|
import com.tiesheng.platform.config.ding.bean.DingJsapiSignature;
|
||||||
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
|
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
|
||||||
|
import com.tiesheng.platform.config.ding.bean.DingUserSimple;
|
||||||
import com.tiesheng.platform.config.wxmini.PlatformWxminiConfig;
|
import com.tiesheng.platform.config.wxmini.PlatformWxminiConfig;
|
||||||
import com.tiesheng.platform.config.wxmp.PlatformWxmpConfig;
|
import com.tiesheng.platform.config.wxmp.PlatformWxmpConfig;
|
||||||
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
||||||
@@ -85,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());
|
||||||
@@ -113,6 +114,7 @@ public class LoginController {
|
|||||||
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
||||||
map.put("service", service);
|
map.put("service", service);
|
||||||
map.put("extra", extra);
|
map.put("extra", extra);
|
||||||
|
map.put("context", globalConfig.getContextPath());
|
||||||
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
||||||
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
||||||
try {
|
try {
|
||||||
@@ -130,8 +132,8 @@ public class LoginController {
|
|||||||
@RequestMapping("/ding/oauth2/{service}")
|
@RequestMapping("/ding/oauth2/{service}")
|
||||||
@OperationIgnore
|
@OperationIgnore
|
||||||
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
DingUserSimple userSimple = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, userSimple.getUserid());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
||||||
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -24,10 +24,10 @@
|
|||||||
corpId: getQueryString("corpId"),
|
corpId: getQueryString("corpId"),
|
||||||
onSuccess: function (result) {
|
onSuccess: function (result) {
|
||||||
let search = window.location.search + "&code=" + result.code;
|
let search = window.location.search + "&code=" + result.code;
|
||||||
window.location.href = "/login/ding/oauth2/" + getQueryString("service") + search;
|
window.location.replace(getQueryString("context") + "/login/ding/oauth2/" + getQueryString("service") + search);
|
||||||
},
|
},
|
||||||
onFail: function (err) {
|
onFail: function (err) {
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
window.location.replace("./error.html?message=" + JSON.stringify(err));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
BIN
springboot-message/.DS_Store
vendored
Normal file
BIN
springboot-message/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
package com.tiesheng.message.config.aliyun;
|
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.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
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.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;
|
||||||
|
|
||||||
@@ -36,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 特殊字符替换
|
* 特殊字符替换
|
||||||
@@ -94,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,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));
|
||||||
@@ -139,7 +153,21 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageReqResp send(String user, JSONObject body) {
|
public MessageReqResp send(String user, JSONObject body) {
|
||||||
return sendSms(user, body.getStr("template_code"), body);
|
boolean mobile = Validator.isMobile(user);
|
||||||
|
if (!mobile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aliyunSmsHandler == null) {
|
||||||
|
throw new ApiException("未注册短信参数处理器");
|
||||||
|
}
|
||||||
|
|
||||||
|
AliyunTempParam tempParam = aliyunSmsHandler.handler(body);
|
||||||
|
if (tempParam == null) {
|
||||||
|
throw new ApiException("未配置短信参数处理器");
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendSms(user, tempParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -149,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -172,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
BIN
springboot-platform/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.lang.TypeReference;
|
import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
@@ -49,6 +48,40 @@ public class PlatformDingConfig {
|
|||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送get请求
|
||||||
|
* 会自动增加accessToken在url上面
|
||||||
|
*
|
||||||
|
* @param service
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public <T> DingResponse<T> doRequest(String service, String url, JSONObject body, TypeReference<DingResponse<T>> typeReference) {
|
||||||
|
if (StrUtil.contains(url, "?")) {
|
||||||
|
url = url + "&access_token=" + getAccessToken(service);
|
||||||
|
} else {
|
||||||
|
url = url + "?access_token=" + getAccessToken(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse execute;
|
||||||
|
if (body == null) {
|
||||||
|
execute = HttpUtil.createGet(url).execute();
|
||||||
|
} else {
|
||||||
|
execute = HttpUtil.createPost(url).body(body.toString()).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (execute.isOk()) {
|
||||||
|
DingResponse<T> bean = JSONUtil.toBean(execute.body(), typeReference, true);
|
||||||
|
if (!bean.isOk()) {
|
||||||
|
LogFactory.get().info(bean.getErrmsg());
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 逻辑方法
|
// 逻辑方法
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -89,14 +122,15 @@ public class PlatformDingConfig {
|
|||||||
DingConfigBean dingConfigBean = getConfigBean(service);
|
DingConfigBean dingConfigBean = getConfigBean(service);
|
||||||
String jsapiTicket = TimedCacheHelper.getTimedCache().get(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), false);
|
String jsapiTicket = TimedCacheHelper.getTimedCache().get(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), false);
|
||||||
if (StrUtil.isEmpty(jsapiTicket)) {
|
if (StrUtil.isEmpty(jsapiTicket)) {
|
||||||
String response = HttpUtil.get("https://oapi.dingtalk.com/get_jsapi_ticket?access_token=" + getAccessToken(service));
|
DingResponse<String> respJson = doRequest(service, "https://oapi.dingtalk.com/get_jsapi_ticket", null,
|
||||||
LogFactory.get().info("getJsapiTicket: " + response);
|
new TypeReference<DingResponse<String>>() {
|
||||||
JSONObject respJson = JSONUtil.parseObj(response);
|
});
|
||||||
if (!Objects.equals(respJson.getStr("errcode"), "0")) {
|
if (!respJson.isOk()) {
|
||||||
throw new ApiException(respJson.getStr("errmsg"));
|
throw new ApiException(respJson.getErrmsg());
|
||||||
}
|
}
|
||||||
jsapiTicket = respJson.getStr("ticket");
|
jsapiTicket = respJson.getTicket();
|
||||||
TimedCacheHelper.getTimedCache().put(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(), jsapiTicket, respJson.getLong("expires_in"));
|
TimedCacheHelper.getTimedCache().put(CACHE_JSAPI_TICKET + dingConfigBean.getAppKey(),
|
||||||
|
jsapiTicket, respJson.getExpiresIn());
|
||||||
}
|
}
|
||||||
return jsapiTicket;
|
return jsapiTicket;
|
||||||
}
|
}
|
||||||
@@ -125,12 +159,11 @@ public class PlatformDingConfig {
|
|||||||
* @return
|
* @return
|
||||||
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
||||||
*/
|
*/
|
||||||
public String getUserIdByCode(String service, String code) {
|
public DingUserSimple getUserIdByCode(String service, String code) {
|
||||||
HttpRequest request = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=" + getAccessToken(service))
|
DingResponse<DingUserSimple> resp = doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo",
|
||||||
.body(JSONUtil.createObj().putOpt("code", code).toString());
|
JSONUtil.createObj().putOpt("code", code), new TypeReference<DingResponse<DingUserSimple>>() {
|
||||||
try (HttpResponse response = request.execute()) {
|
});
|
||||||
return JSONUtil.parseObj(response.body()).getJSONObject("result").getStr("userid");
|
return resp.getResult();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -144,16 +177,14 @@ public class PlatformDingConfig {
|
|||||||
*/
|
*/
|
||||||
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
||||||
DingConfigBean dingConfigBean = getConfigBean(service);
|
DingConfigBean dingConfigBean = getConfigBean(service);
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/get?access_token="
|
|
||||||
+ getAccessToken(service))
|
DingUserInfo userInfo = doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/get",
|
||||||
.body(JSONUtil.createObj().putOpt("userid", ddUserId).toString()).execute()) {
|
JSONUtil.createObj().putOpt("userid", ddUserId), new TypeReference<DingResponse<DingUserInfo>>() {
|
||||||
JSONObject resultJson = JSONUtil.parseObj(response.body()).getJSONObject("result");
|
}).getResult();
|
||||||
DingUserInfo userInfo = JSONUtil.toBean(resultJson, DingUserInfo.class);
|
// 设置一下job_number
|
||||||
// 设置一下job_number
|
userInfo.setJobNumber(userInfo.getJobNumber());
|
||||||
userInfo.setJobNumber(resultJson.getStr("job_number"));
|
userInfo.setAppId(dingConfigBean.getAppKey());
|
||||||
userInfo.setAppId(dingConfigBean.getAppKey());
|
return userInfo;
|
||||||
return userInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,16 +199,10 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + token)
|
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).toString()).execute()) {
|
|
||||||
DingResponse<List<DingDeptVo>> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
|
||||||
}.getType(), true);
|
|
||||||
|
|
||||||
if (!result.isOk()) {
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/v2/department/listsub",
|
||||||
result.setResult(new ArrayList<>());
|
JSONUtil.createObj().putOpt("dept_id", deptId), new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
||||||
}
|
}).getResult();
|
||||||
return result.getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,20 +217,17 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return DingUserListVo.fail();
|
return DingUserListVo.fail();
|
||||||
}
|
}
|
||||||
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/list?access_token=" + token)
|
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100).toString())
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/v2/user/list",
|
||||||
.execute()) {
|
JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100),
|
||||||
DingResponse<DingUserListVo> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<DingUserListVo>>() {
|
new TypeReference<DingResponse<DingUserListVo>>() {
|
||||||
}.getType(), true);
|
}).getResult();
|
||||||
if (!result.isOk()) {
|
|
||||||
result.setResult(DingUserListVo.fail());
|
|
||||||
}
|
|
||||||
return result.getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步钉钉的通讯录
|
* 同步钉钉的通讯录
|
||||||
|
* <br />
|
||||||
|
* PS:如果需要钉钉用户手机号,需要开通权限:企业员工手机号信息
|
||||||
*
|
*
|
||||||
* @param deptVo 为null时从第一级获取
|
* @param deptVo 为null时从第一级获取
|
||||||
* @param consumer 回调
|
* @param consumer 回调
|
||||||
@@ -244,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);
|
||||||
|
|
||||||
@@ -263,17 +286,18 @@ public class PlatformDingConfig {
|
|||||||
msg.set("msgtype", "action_card");
|
msg.set("msgtype", "action_card");
|
||||||
msg.set("action_card", actionCard);
|
msg.set("action_card", actionCard);
|
||||||
|
|
||||||
HashMap<String, Object> body = new HashMap<>(10);
|
JSONObject body = new JSONObject();
|
||||||
body.put("agent_id", configBean.getAgentId());
|
body.putOpt("agent_id", configBean.getAgentId());
|
||||||
body.put("userid_list", CollUtil.join(userIds, ","));
|
body.putOpt("userid_list", CollUtil.join(userIds, ","));
|
||||||
body.put("msg", msg);
|
body.putOpt("msg", msg);
|
||||||
String resp = HttpUtil.post("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + getAccessToken(service),
|
return doRequest(service, "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", body,
|
||||||
JSONUtil.toJsonStr(body));
|
new TypeReference<DingResponse<String>>() {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public Map<String, DingConfigBean> getConfigs() {
|
public Map<String, DingConfigBean> getConfigs() {
|
||||||
return configs;
|
return configs;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ public class DingResponse<T> {
|
|||||||
|
|
||||||
private String errcode;
|
private String errcode;
|
||||||
private String errmsg;
|
private String errmsg;
|
||||||
|
private String ticket;
|
||||||
|
private Long expiresIn;
|
||||||
private T result;
|
private T result;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -43,4 +45,20 @@ public class DingResponse<T> {
|
|||||||
public void setResult(T result) {
|
public void setResult(T result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(String ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getExpiresIn() {
|
||||||
|
return expiresIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpiresIn(Long expiresIn) {
|
||||||
|
this.expiresIn = expiresIn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
*/
|
*/
|
||||||
public class DingUserInfo {
|
public class DingUserInfo extends DingUserSimple {
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String userid;
|
|
||||||
private String avatar;
|
private String avatar;
|
||||||
private String mobile;
|
private String mobile;
|
||||||
private String email;
|
private String email;
|
||||||
@@ -17,7 +15,6 @@ public class DingUserInfo {
|
|||||||
private String nickname;
|
private String nickname;
|
||||||
private String title;
|
private String title;
|
||||||
private String remark;
|
private String remark;
|
||||||
private String unionid;
|
|
||||||
private String appId;
|
private String appId;
|
||||||
private List<String> deptIdList;
|
private List<String> deptIdList;
|
||||||
private boolean leader;
|
private boolean leader;
|
||||||
@@ -34,30 +31,6 @@ public class DingUserInfo {
|
|||||||
// setter\getter
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnionid() {
|
|
||||||
return unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnionid(String unionid) {
|
|
||||||
this.unionid = unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserid() {
|
|
||||||
return userid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserid(String userid) {
|
|
||||||
this.userid = userid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatar() {
|
public String getAvatar() {
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tiesheng.platform.config.ding.bean;
|
||||||
|
|
||||||
|
public class DingUserSimple {
|
||||||
|
|
||||||
|
private String unionid;
|
||||||
|
private String name;
|
||||||
|
private String userid;
|
||||||
|
|
||||||
|
public String getUnionid() {
|
||||||
|
return unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnionid(String unionid) {
|
||||||
|
this.unionid = unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserid() {
|
||||||
|
return userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserid(String userid) {
|
||||||
|
this.userid = userid;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
springboot-poi/.DS_Store
vendored
Normal file
BIN
springboot-poi/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
BIN
springboot-role/.DS_Store
vendored
Normal file
BIN
springboot-role/.DS_Store
vendored
Normal file
Binary file not shown.
27
springboot-role/pom.xml
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.rc4</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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.tiesheng.role.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleServer;
|
||||||
|
|
||||||
|
public interface CoreRoleServerMapper extends BaseMapper<CoreRoleServer> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.tiesheng.role.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleUser;
|
||||||
|
import com.tiesheng.role.pojos.vo.RoleUserPageVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CoreRoleUserMapper extends BaseMapper<CoreRoleUser> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param wrapper
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<RoleUserPageVO> page(Page<RoleUserPageVO> page, @Param("ew") QueryWrapper<CoreRoleUser> wrapper);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户所有的权限
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CoreRoleAuthority> getOwnerAuthorityLeafList(@Param("userId") String userId,
|
||||||
|
@Param("roleId") String roleId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,350 @@
|
|||||||
|
package com.tiesheng.role.pojos.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tiesheng.util.pojos.DaoBase;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色-权限
|
||||||
|
*/
|
||||||
|
@TableName(value = "core_role_authority")
|
||||||
|
public class CoreRoleAuthority extends DaoBase {
|
||||||
|
/**
|
||||||
|
* 服务
|
||||||
|
*/
|
||||||
|
@TableField(value = "service")
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableField(value = "`no`")
|
||||||
|
private String no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级
|
||||||
|
*/
|
||||||
|
@TableField(value = "`level`")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "parent")
|
||||||
|
private String parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_open")
|
||||||
|
private Integer isOpen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型:group-分组,menu-菜单项,point-点
|
||||||
|
*/
|
||||||
|
@TableField(value = "`type`")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "link")
|
||||||
|
private String link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台:ding、web、mobile等
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展1
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext1")
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展2
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext2")
|
||||||
|
private String ext2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展3
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext3")
|
||||||
|
private String ext3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务
|
||||||
|
*
|
||||||
|
* @return service - 服务
|
||||||
|
*/
|
||||||
|
public String getService() {
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务
|
||||||
|
*
|
||||||
|
* @param service 服务
|
||||||
|
*/
|
||||||
|
public void setService(String service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取编号
|
||||||
|
*
|
||||||
|
* @return no - 编号
|
||||||
|
*/
|
||||||
|
public String getNo() {
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置编号
|
||||||
|
*
|
||||||
|
* @param no 编号
|
||||||
|
*/
|
||||||
|
public void setNo(String no) {
|
||||||
|
this.no = no;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取名称
|
||||||
|
*
|
||||||
|
* @return name - 名称
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置名称
|
||||||
|
*
|
||||||
|
* @param name 名称
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取排序
|
||||||
|
*
|
||||||
|
* @return sort - 排序
|
||||||
|
*/
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置排序
|
||||||
|
*
|
||||||
|
* @param sort 排序
|
||||||
|
*/
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取层级
|
||||||
|
*
|
||||||
|
* @return level - 层级
|
||||||
|
*/
|
||||||
|
public Integer getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置层级
|
||||||
|
*
|
||||||
|
* @param level 层级
|
||||||
|
*/
|
||||||
|
public void setLevel(Integer level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取父类ID
|
||||||
|
*
|
||||||
|
* @return parent - 父类ID
|
||||||
|
*/
|
||||||
|
public String getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置父类ID
|
||||||
|
*
|
||||||
|
* @param parent 父类ID
|
||||||
|
*/
|
||||||
|
public void setParent(String parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取说明
|
||||||
|
*
|
||||||
|
* @return remark - 说明
|
||||||
|
*/
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置说明
|
||||||
|
*
|
||||||
|
* @param remark 说明
|
||||||
|
*/
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否启用
|
||||||
|
*
|
||||||
|
* @return is_open - 是否启用
|
||||||
|
*/
|
||||||
|
public Integer getIsOpen() {
|
||||||
|
return isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否启用
|
||||||
|
*
|
||||||
|
* @param isOpen 是否启用
|
||||||
|
*/
|
||||||
|
public void setIsOpen(Integer isOpen) {
|
||||||
|
this.isOpen = isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型:group-分组,menu-菜单项,point-点
|
||||||
|
*
|
||||||
|
* @return type - 类型:group-分组,menu-菜单项,point-点
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置类型:group-分组,menu-菜单项,point-点
|
||||||
|
*
|
||||||
|
* @param type 类型:group-分组,menu-菜单项,point-点
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取跳转地址
|
||||||
|
*
|
||||||
|
* @return link - 跳转地址
|
||||||
|
*/
|
||||||
|
public String getLink() {
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置跳转地址
|
||||||
|
*
|
||||||
|
* @param link 跳转地址
|
||||||
|
*/
|
||||||
|
public void setLink(String link) {
|
||||||
|
this.link = link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平台:ding、web、mobile等
|
||||||
|
*
|
||||||
|
* @return platform - 平台:ding、web、mobile等
|
||||||
|
*/
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置平台:ding、web、mobile等
|
||||||
|
*
|
||||||
|
* @param platform 平台:ding、web、mobile等
|
||||||
|
*/
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展1
|
||||||
|
*
|
||||||
|
* @return ext1 - 扩展1
|
||||||
|
*/
|
||||||
|
public String getExt1() {
|
||||||
|
return ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展1
|
||||||
|
*
|
||||||
|
* @param ext1 扩展1
|
||||||
|
*/
|
||||||
|
public void setExt1(String ext1) {
|
||||||
|
this.ext1 = ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展2
|
||||||
|
*
|
||||||
|
* @return ext2 - 扩展2
|
||||||
|
*/
|
||||||
|
public String getExt2() {
|
||||||
|
return ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展2
|
||||||
|
*
|
||||||
|
* @param ext2 扩展2
|
||||||
|
*/
|
||||||
|
public void setExt2(String ext2) {
|
||||||
|
this.ext2 = ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展3
|
||||||
|
*
|
||||||
|
* @return ext3 - 扩展3
|
||||||
|
*/
|
||||||
|
public String getExt3() {
|
||||||
|
return ext3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展3
|
||||||
|
*
|
||||||
|
* @param ext3 扩展3
|
||||||
|
*/
|
||||||
|
public void setExt3(String ext3) {
|
||||||
|
this.ext3 = ext3;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
package com.tiesheng.role.pojos.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tiesheng.util.pojos.DaoBase;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色-分组
|
||||||
|
*/
|
||||||
|
@TableName(value = "core_role_group")
|
||||||
|
public class CoreRoleGroup extends DaoBase {
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型:role-角色,job-职位
|
||||||
|
*/
|
||||||
|
@TableField(value = "`type`")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否系统
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_system")
|
||||||
|
private Integer isSystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展1
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext1")
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展2
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext2")
|
||||||
|
private String ext2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展3
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext3")
|
||||||
|
private String ext3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取名称
|
||||||
|
*
|
||||||
|
* @return name - 名称
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置名称
|
||||||
|
*
|
||||||
|
* @param name 名称
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取说明
|
||||||
|
*
|
||||||
|
* @return remark - 说明
|
||||||
|
*/
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置说明
|
||||||
|
*
|
||||||
|
* @param remark 说明
|
||||||
|
*/
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型:role-角色,job-职位
|
||||||
|
*
|
||||||
|
* @return type - 类型:role-角色,job-职位
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置类型:role-角色,job-职位
|
||||||
|
*
|
||||||
|
* @param type 类型:role-角色,job-职位
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 是否系统
|
||||||
|
*
|
||||||
|
* @return is_system - 是否系统
|
||||||
|
*/
|
||||||
|
public Integer getIsSystem() {
|
||||||
|
return isSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 是否系统
|
||||||
|
*
|
||||||
|
* @param isSystem 是否系统
|
||||||
|
*/
|
||||||
|
public void setIsSystem(Integer isSystem) {
|
||||||
|
this.isSystem = isSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取排序
|
||||||
|
*
|
||||||
|
* @return sort - 排序
|
||||||
|
*/
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置排序
|
||||||
|
*
|
||||||
|
* @param sort 排序
|
||||||
|
*/
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展1
|
||||||
|
*
|
||||||
|
* @return ext1 - 扩展1
|
||||||
|
*/
|
||||||
|
public String getExt1() {
|
||||||
|
return ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展1
|
||||||
|
*
|
||||||
|
* @param ext1 扩展1
|
||||||
|
*/
|
||||||
|
public void setExt1(String ext1) {
|
||||||
|
this.ext1 = ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展2
|
||||||
|
*
|
||||||
|
* @return ext2 - 扩展2
|
||||||
|
*/
|
||||||
|
public String getExt2() {
|
||||||
|
return ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展2
|
||||||
|
*
|
||||||
|
* @param ext2 扩展2
|
||||||
|
*/
|
||||||
|
public void setExt2(String ext2) {
|
||||||
|
this.ext2 = ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展3
|
||||||
|
*
|
||||||
|
* @return ext3 - 扩展3
|
||||||
|
*/
|
||||||
|
public String getExt3() {
|
||||||
|
return ext3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展3
|
||||||
|
*
|
||||||
|
* @param ext3 扩展3
|
||||||
|
*/
|
||||||
|
public void setExt3(String ext3) {
|
||||||
|
this.ext3 = ext3;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.tiesheng.role.pojos.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tiesheng.util.pojos.DaoBase;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色-分组-关系
|
||||||
|
*/
|
||||||
|
@TableName(value = "core_role_group_rx")
|
||||||
|
public class CoreRoleGroupRx extends DaoBase {
|
||||||
|
/**
|
||||||
|
* 角色id
|
||||||
|
*/
|
||||||
|
@TableField(value = "group_id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单id
|
||||||
|
*/
|
||||||
|
@TableField(value = "menu_id")
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色id
|
||||||
|
*
|
||||||
|
* @return group_id - 角色id
|
||||||
|
*/
|
||||||
|
public String getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置角色id
|
||||||
|
*
|
||||||
|
* @param groupId 角色id
|
||||||
|
*/
|
||||||
|
public void setGroupId(String groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单id
|
||||||
|
*
|
||||||
|
* @return menu_id - 菜单id
|
||||||
|
*/
|
||||||
|
public String getMenuId() {
|
||||||
|
return menuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置菜单id
|
||||||
|
*
|
||||||
|
* @param menuId 菜单id
|
||||||
|
*/
|
||||||
|
public void setMenuId(String menuId) {
|
||||||
|
this.menuId = menuId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
package com.tiesheng.role.pojos.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tiesheng.util.pojos.DaoBase;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色-服务
|
||||||
|
*/
|
||||||
|
@TableName(value = "core_role_server")
|
||||||
|
public class CoreRoleServer extends DaoBase {
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logo
|
||||||
|
*/
|
||||||
|
@TableField(value = "logo")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_open")
|
||||||
|
private Integer isOpen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "link")
|
||||||
|
private String link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展1
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext1")
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展2
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext2")
|
||||||
|
private String ext2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展3
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext3")
|
||||||
|
private String ext3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取名称
|
||||||
|
*
|
||||||
|
* @return name - 名称
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置名称
|
||||||
|
*
|
||||||
|
* @param name 名称
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取说明
|
||||||
|
*
|
||||||
|
* @return remark - 说明
|
||||||
|
*/
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置说明
|
||||||
|
*
|
||||||
|
* @param remark 说明
|
||||||
|
*/
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取logo
|
||||||
|
*
|
||||||
|
* @return logo - logo
|
||||||
|
*/
|
||||||
|
public String getLogo() {
|
||||||
|
return logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置logo
|
||||||
|
*
|
||||||
|
* @param logo logo
|
||||||
|
*/
|
||||||
|
public void setLogo(String logo) {
|
||||||
|
this.logo = logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取排序
|
||||||
|
*
|
||||||
|
* @return sort - 排序
|
||||||
|
*/
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置排序
|
||||||
|
*
|
||||||
|
* @param sort 排序
|
||||||
|
*/
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否启用
|
||||||
|
*
|
||||||
|
* @return is_open - 是否启用
|
||||||
|
*/
|
||||||
|
public Integer getIsOpen() {
|
||||||
|
return isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否启用
|
||||||
|
*
|
||||||
|
* @param isOpen 是否启用
|
||||||
|
*/
|
||||||
|
public void setIsOpen(Integer isOpen) {
|
||||||
|
this.isOpen = isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取跳转地址
|
||||||
|
*
|
||||||
|
* @return link - 跳转地址
|
||||||
|
*/
|
||||||
|
public String getLink() {
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置跳转地址
|
||||||
|
*
|
||||||
|
* @param link 跳转地址
|
||||||
|
*/
|
||||||
|
public void setLink(String link) {
|
||||||
|
this.link = link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展1
|
||||||
|
*
|
||||||
|
* @return ext1 - 扩展1
|
||||||
|
*/
|
||||||
|
public String getExt1() {
|
||||||
|
return ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展1
|
||||||
|
*
|
||||||
|
* @param ext1 扩展1
|
||||||
|
*/
|
||||||
|
public void setExt1(String ext1) {
|
||||||
|
this.ext1 = ext1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展2
|
||||||
|
*
|
||||||
|
* @return ext2 - 扩展2
|
||||||
|
*/
|
||||||
|
public String getExt2() {
|
||||||
|
return ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展2
|
||||||
|
*
|
||||||
|
* @param ext2 扩展2
|
||||||
|
*/
|
||||||
|
public void setExt2(String ext2) {
|
||||||
|
this.ext2 = ext2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展3
|
||||||
|
*
|
||||||
|
* @return ext3 - 扩展3
|
||||||
|
*/
|
||||||
|
public String getExt3() {
|
||||||
|
return ext3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展3
|
||||||
|
*
|
||||||
|
* @param ext3 扩展3
|
||||||
|
*/
|
||||||
|
public void setExt3(String ext3) {
|
||||||
|
this.ext3 = ext3;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +1,40 @@
|
|||||||
package com.tiesheng.core.pojos.dao;
|
package com.tiesheng.role.pojos.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.tiesheng.core.pojos.DaoBase;
|
import com.tiesheng.util.pojos.DaoBase;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 职位-用户
|
* 角色-用户
|
||||||
*/
|
*/
|
||||||
@TableName(value = "core_job_user")
|
@TableName(value = "core_role_user")
|
||||||
public class CoreJobUser extends DaoBase {
|
public class CoreRoleUser extends DaoBase {
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
@TableField(value = "user_id")
|
@TableField(value = "user_id")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 类型:menu-菜单,group-分组
|
||||||
*/
|
*/
|
||||||
@TableField(value = "job_id")
|
@TableField(value = "`type`")
|
||||||
private String jobId;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型关联的记录ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "type_id")
|
||||||
|
private String typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间,无则不过期
|
||||||
|
*/
|
||||||
|
@TableField(value = "expire_time")
|
||||||
|
private Date expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展1
|
* 扩展1
|
||||||
@@ -43,45 +55,75 @@ public class CoreJobUser extends DaoBase {
|
|||||||
private String ext3;
|
private String ext3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展文本
|
* 获取用户ID
|
||||||
*/
|
|
||||||
@TableField(value = "ext_text")
|
|
||||||
private String extText;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户id
|
|
||||||
*
|
*
|
||||||
* @return user_id - 用户id
|
* @return user_id - 用户ID
|
||||||
*/
|
*/
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置用户id
|
* 设置用户ID
|
||||||
*
|
*
|
||||||
* @param userId 用户id
|
* @param userId 用户ID
|
||||||
*/
|
*/
|
||||||
public void setUserId(String userId) {
|
public void setUserId(String userId) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户
|
* 获取类型:menu-菜单,group-分组
|
||||||
*
|
*
|
||||||
* @return job_id - 用户
|
* @return type - 类型:menu-菜单,group-分组
|
||||||
*/
|
*/
|
||||||
public String getJobId() {
|
public String getType() {
|
||||||
return jobId;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置用户
|
* 设置类型:menu-菜单,group-分组
|
||||||
*
|
*
|
||||||
* @param jobId 用户
|
* @param type 类型:menu-菜单,group-分组
|
||||||
*/
|
*/
|
||||||
public void setJobId(String jobId) {
|
public void setType(String type) {
|
||||||
this.jobId = jobId;
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型关联的记录ID
|
||||||
|
*
|
||||||
|
* @return type_id - 类型关联的记录ID
|
||||||
|
*/
|
||||||
|
public String getTypeId() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置类型关联的记录ID
|
||||||
|
*
|
||||||
|
* @param typeId 类型关联的记录ID
|
||||||
|
*/
|
||||||
|
public void setTypeId(String typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取过期时间,无则不过期
|
||||||
|
*
|
||||||
|
* @return expire_time - 过期时间,无则不过期
|
||||||
|
*/
|
||||||
|
public Date getExpireTime() {
|
||||||
|
return expireTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置过期时间,无则不过期
|
||||||
|
*
|
||||||
|
* @param expireTime 过期时间,无则不过期
|
||||||
|
*/
|
||||||
|
public void setExpireTime(Date expireTime) {
|
||||||
|
this.expireTime = expireTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,22 +179,4 @@ public class CoreJobUser extends DaoBase {
|
|||||||
public void setExt3(String ext3) {
|
public void setExt3(String ext3) {
|
||||||
this.ext3 = ext3;
|
this.ext3 = ext3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取扩展文本
|
|
||||||
*
|
|
||||||
* @return ext_text - 扩展文本
|
|
||||||
*/
|
|
||||||
public String getExtText() {
|
|
||||||
return extText;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置扩展文本
|
|
||||||
*
|
|
||||||
* @param extText 扩展文本
|
|
||||||
*/
|
|
||||||
public void setExtText(String extText) {
|
|
||||||
this.extText = extText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.tiesheng.role.pojos.dto;
|
||||||
|
|
||||||
|
import com.tiesheng.util.pojos.IdDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GroupRxUpdateDTO extends IdDTO {
|
||||||
|
|
||||||
|
private List<String> menuIds;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public List<String> getMenuIds() {
|
||||||
|
return menuIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMenuIds(List<String> menuIds) {
|
||||||
|
this.menuIds = menuIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.tiesheng.role.pojos.dto;
|
||||||
|
|
||||||
|
public class MenuListDTO extends ServiceDTO {
|
||||||
|
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.tiesheng.role.pojos.dto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
public class OwnerMenuDTO extends ServiceDTO {
|
||||||
|
|
||||||
|
@NotEmpty(message = "请选择一个平台")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public @NotEmpty(message = "请选择一个平台") String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(@NotEmpty(message = "请选择一个平台") String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.tiesheng.role.pojos.dto;
|
||||||
|
|
||||||
|
public class OwnerPointDTO extends OwnerMenuDTO {
|
||||||
|
|
||||||
|
private String parentNo;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getParentNo() {
|
||||||
|
return parentNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentNo(String parentNo) {
|
||||||
|
this.parentNo = parentNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.tiesheng.role.pojos.dto;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
public class ServiceDTO {
|
||||||
|
|
||||||
|
@NotEmpty(message = "请选择一个服务")
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
public String getService() {
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setService(String service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.tiesheng.role.pojos.vo;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
public class GroupTypeDTO {
|
||||||
|
|
||||||
|
@NotEmpty(message = "请选择一个类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.tiesheng.role.pojos.vo;
|
||||||
|
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleUser;
|
||||||
|
|
||||||
|
public class RoleUserPageVO extends CoreRoleUser {
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getTypeName() {
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeName(String typeName) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.tiesheng.role.pojos.vo;
|
||||||
|
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ServiceMenuVO extends CoreRoleAuthority {
|
||||||
|
|
||||||
|
private List<ServiceMenuVO> children;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public List<ServiceMenuVO> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<ServiceMenuVO> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package com.tiesheng.role.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.tiesheng.role.mapper.*;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleGroup;
|
||||||
|
import com.tiesheng.role.pojos.dao.CoreRoleGroupRx;
|
||||||
|
import com.tiesheng.role.pojos.dto.GroupRxUpdateDTO;
|
||||||
|
import com.tiesheng.role.pojos.dto.OwnerMenuDTO;
|
||||||
|
import com.tiesheng.role.pojos.vo.ServiceMenuVO;
|
||||||
|
import com.tiesheng.util.service.TsServiceBase;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRoleGroup> {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CoreRoleUserMapper coreRoleUserMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CoreRoleGroupRxMapper coreRoleGroupRxMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CoreRoleAuthorityMapper coreRoleAuthorityMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CoreRoleServerMapper coreRoleServerMapper;
|
||||||
|
|
||||||
|
public CoreRoleServerMapper getServerMapper() {
|
||||||
|
return coreRoleServerMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoreRoleAuthorityMapper getAuthorityMapper() {
|
||||||
|
return coreRoleAuthorityMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoreRoleUserMapper getUserMapper() {
|
||||||
|
return coreRoleUserMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoreRoleGroupRxMapper getGroupRxMapper() {
|
||||||
|
return coreRoleGroupRxMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单封装
|
||||||
|
*
|
||||||
|
* @param coreServiceMenuList
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<ServiceMenuVO> menuChildrenWrap(List<CoreRoleAuthority> coreServiceMenuList, String parent) {
|
||||||
|
List<CoreRoleAuthority> distinctList = coreServiceMenuList.stream().distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<ServiceMenuVO> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (CoreRoleAuthority coreServiceMenu : distinctList) {
|
||||||
|
if (!StrUtil.equals(parent, coreServiceMenu.getParent())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ServiceMenuVO menuVO = BeanUtil.copyProperties(coreServiceMenu, ServiceMenuVO.class);
|
||||||
|
menuVO.setChildren(menuChildrenWrap(distinctList, coreServiceMenu.getId()));
|
||||||
|
list.add(menuVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新角色的权限
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateGroupRx(GroupRxUpdateDTO dto) {
|
||||||
|
coreRoleGroupRxMapper.delete(new QueryWrapper<CoreRoleGroupRx>()
|
||||||
|
.eq("group_id", dto.getId())
|
||||||
|
);
|
||||||
|
List<CoreRoleGroupRx> list = new ArrayList<>();
|
||||||
|
for (String menuId : dto.getMenuIds()) {
|
||||||
|
CoreRoleGroupRx coreRoleGroupRx = new CoreRoleGroupRx();
|
||||||
|
coreRoleGroupRx.setGroupId(dto.getId());
|
||||||
|
coreRoleGroupRx.setMenuId(menuId);
|
||||||
|
list.add(coreRoleGroupRx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
coreRoleGroupRxMapper.batchInsert(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取拥有的所有叶子权限
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<CoreRoleAuthority> getOwnerAuthorityLeafList(String userId, String roleId) {
|
||||||
|
return coreRoleUserMapper.getOwnerAuthorityLeafList(userId, roleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自己拥有的所有菜单
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param roleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<ServiceMenuVO> getOwnerMenus(String userId, String roleId, OwnerMenuDTO dto) {
|
||||||
|
List<CoreRoleAuthority> allOwnerMenus = getOwnerAuthorityLeafList(userId, roleId);
|
||||||
|
|
||||||
|
List<CoreRoleAuthority> allRoleAuthorityList = coreRoleAuthorityMapper.selectList(new QueryWrapper<CoreRoleAuthority>()
|
||||||
|
.eq(CoreRoleAuthority.IS_DELETED, 0)
|
||||||
|
.eq("service", dto.getService())
|
||||||
|
.eq("platform", dto.getPlatform())
|
||||||
|
.eq("is_open", 1)
|
||||||
|
);
|
||||||
|
Map<Object, CoreRoleAuthority> allAuthorityMap = CollUtil.fieldValueMap(allRoleAuthorityList, "id");
|
||||||
|
|
||||||
|
|
||||||
|
List<CoreRoleAuthority> ownerAuthorityList = new ArrayList<>();
|
||||||
|
for (CoreRoleAuthority roleAuthority : allOwnerMenus) {
|
||||||
|
ownerAuthorityList.add(roleAuthority);
|
||||||
|
|
||||||
|
String parentId = roleAuthority.getParent();
|
||||||
|
while (StrUtil.isNotEmpty(parentId)) {
|
||||||
|
CoreRoleAuthority parent = allAuthorityMap.get(parentId);
|
||||||
|
if (parent == null) {
|
||||||
|
parentId = "";
|
||||||
|
} else {
|
||||||
|
parentId = parent.getParent();
|
||||||
|
ownerAuthorityList.add(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return menuChildrenWrap(ownerAuthorityList.stream()
|
||||||
|
.filter(it -> Objects.equals(it.getType(), "group") || Objects.equals(it.getType(), "menu"))
|
||||||
|
.collect(Collectors.toList()), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
create table core_role_authority
|
||||||
|
(
|
||||||
|
id varchar(50) not null
|
||||||
|
primary key,
|
||||||
|
create_time datetime not null,
|
||||||
|
update_time datetime not null,
|
||||||
|
is_deleted int(6) default 0 not null,
|
||||||
|
service varchar(50) not null comment '服务',
|
||||||
|
no varchar(50) not null comment '编号',
|
||||||
|
name varchar(50) not null comment '名称',
|
||||||
|
sort int(6) default 0 null comment '排序',
|
||||||
|
level int(6) default 0 null comment '层级',
|
||||||
|
parent varchar(50) null comment '父类ID',
|
||||||
|
remark varchar(500) null comment '说明',
|
||||||
|
is_open int(6) default 0 null comment '是否启用',
|
||||||
|
type varchar(20) default 'item' not null comment '类型:group-分组,menu-菜单项,point-点',
|
||||||
|
link text null comment '跳转地址',
|
||||||
|
platform varchar(20) null comment '平台:ding、web、mobile等',
|
||||||
|
ext1 varchar(500) null comment '扩展1',
|
||||||
|
ext2 varchar(500) null comment '扩展2',
|
||||||
|
ext3 varchar(500) null comment '扩展3'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
comment '角色-权限';
|
||||||
|
|
||||||
|
create table core_role_group
|
||||||
|
(
|
||||||
|
id varchar(50) not null
|
||||||
|
primary key,
|
||||||
|
create_time datetime not null,
|
||||||
|
update_time datetime not null,
|
||||||
|
is_deleted int(6) default 0 not null,
|
||||||
|
name varchar(50) not null comment '名称',
|
||||||
|
remark varchar(500) null comment '说明',
|
||||||
|
type varchar(10) null comment '类型:role-角色,job-职位',
|
||||||
|
is_system int(2) default 0 not null comment ' 是否系统',
|
||||||
|
sort int(6) default 0 not null comment '排序',
|
||||||
|
ext1 varchar(500) null comment '扩展1',
|
||||||
|
ext2 varchar(500) null comment '扩展2',
|
||||||
|
ext3 varchar(500) null comment '扩展3'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
comment '角色-分组';
|
||||||
|
|
||||||
|
create table core_role_group_rx
|
||||||
|
(
|
||||||
|
id varchar(50) not null
|
||||||
|
primary key,
|
||||||
|
create_time datetime not null,
|
||||||
|
update_time datetime not null,
|
||||||
|
is_deleted int(6) default 0 not null,
|
||||||
|
group_id varchar(50) not null comment '角色id',
|
||||||
|
menu_id varchar(50) not null comment '菜单id'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
comment '角色-分组-关系';
|
||||||
|
|
||||||
|
create table core_role_server
|
||||||
|
(
|
||||||
|
id varchar(50) not null
|
||||||
|
primary key,
|
||||||
|
create_time datetime not null,
|
||||||
|
update_time datetime not null,
|
||||||
|
is_deleted int(6) default 0 not null,
|
||||||
|
name varchar(255) null comment '名称',
|
||||||
|
remark varchar(500) null comment '说明',
|
||||||
|
logo varchar(500) null comment 'logo',
|
||||||
|
sort int(6) default 0 null comment '排序',
|
||||||
|
is_open int(2) default 1 not null comment '是否启用',
|
||||||
|
link varchar(500) null comment '跳转地址',
|
||||||
|
ext1 varchar(500) null comment '扩展1',
|
||||||
|
ext2 varchar(500) null comment '扩展2',
|
||||||
|
ext3 varchar(500) null comment '扩展3'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
comment '角色-服务';
|
||||||
|
|
||||||
|
create table core_role_user
|
||||||
|
(
|
||||||
|
id varchar(50) not null
|
||||||
|
primary key,
|
||||||
|
create_time datetime not null,
|
||||||
|
update_time datetime not null,
|
||||||
|
is_deleted int(6) default 0 not null,
|
||||||
|
user_id varchar(50) not null comment '用户ID',
|
||||||
|
type varchar(50) not null comment '类型:menu-菜单,job-职位',
|
||||||
|
type_id varchar(50) not null comment '类型关联的记录ID',
|
||||||
|
expire_time datetime null comment '过期时间,无则不过期',
|
||||||
|
ext1 varchar(500) null comment '扩展1',
|
||||||
|
ext2 varchar(500) null comment '扩展2',
|
||||||
|
ext3 varchar(500) null comment '扩展3'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
comment '角色-用户';
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.role.mapper.CoreRoleAuthorityMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleAuthority">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_role_authority-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="service" jdbcType="VARCHAR" property="service" />
|
||||||
|
<result column="no" jdbcType="VARCHAR" property="no" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||||
|
<result column="level" jdbcType="INTEGER" property="level" />
|
||||||
|
<result column="parent" jdbcType="VARCHAR" property="parent" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="is_open" jdbcType="INTEGER" property="isOpen" />
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="link" jdbcType="LONGVARCHAR" property="link" />
|
||||||
|
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||||
|
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||||
|
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||||
|
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, service, `no`, `name`, sort, `level`, parent,
|
||||||
|
remark, is_open, `type`, link, platform, ext1, ext2, ext3
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.role.mapper.CoreRoleGroupMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleGroup">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_role_group-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="is_system" jdbcType="INTEGER" property="isSystem" />
|
||||||
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||||
|
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||||
|
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||||
|
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, `name`, remark, `type`, is_system, sort,
|
||||||
|
ext1, ext2, ext3
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.role.mapper.CoreRoleGroupRxMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleGroupRx">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_role_group_rx-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="group_id" jdbcType="VARCHAR" property="groupId" />
|
||||||
|
<result column="menu_id" jdbcType="VARCHAR" property="menuId" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, group_id, menu_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="batchInsert">
|
||||||
|
insert into core_role_group_rx(id, create_time, update_time, is_deleted, group_id, menu_id)
|
||||||
|
values
|
||||||
|
<foreach collection="list" separator="," item="item">
|
||||||
|
(uuid(), now(), now(), 0,
|
||||||
|
#{item.groupId},
|
||||||
|
#{item.menuId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.role.mapper.CoreRoleServerMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleServer">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_role_server-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="logo" jdbcType="VARCHAR" property="logo" />
|
||||||
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||||
|
<result column="is_open" jdbcType="INTEGER" property="isOpen" />
|
||||||
|
<result column="link" jdbcType="VARCHAR" property="link" />
|
||||||
|
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||||
|
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||||
|
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, `name`, remark, logo, sort, is_open, link,
|
||||||
|
ext1, ext2, ext3
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.role.mapper.CoreRoleUserMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.role.pojos.dao.CoreRoleUser">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_role_user-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
|
||||||
|
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
|
||||||
|
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||||
|
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||||
|
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, user_id, `type`, type_id, expire_time,
|
||||||
|
ext1, ext2, ext3
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="page" resultType="com.tiesheng.role.pojos.vo.RoleUserPageVO">
|
||||||
|
select *,
|
||||||
|
(case cru.type
|
||||||
|
when 'menu' then (select name from core_role_authority where id = cru.type_id and is_deleted = 0)
|
||||||
|
when 'job' then (select name from core_role_group where id = cru.type_id and is_deleted = 0)
|
||||||
|
else '' end) type_name
|
||||||
|
from core_role_user cru
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getOwnerAuthorityLeafList" resultType="com.tiesheng.role.pojos.dao.CoreRoleAuthority">
|
||||||
|
select *
|
||||||
|
from core_role_authority
|
||||||
|
where is_open = 1
|
||||||
|
and is_deleted = 0
|
||||||
|
and
|
||||||
|
id in (select type_id
|
||||||
|
from core_role_user
|
||||||
|
where type = 'menu'
|
||||||
|
and user_id = #{userId}
|
||||||
|
and is_deleted = 0
|
||||||
|
and (expire_time is null or expire_time > now())
|
||||||
|
|
||||||
|
union
|
||||||
|
|
||||||
|
select crgr.menu_id
|
||||||
|
from core_role_user cru
|
||||||
|
left join core_role_group_rx crgr on crgr.group_id = cru.type_id
|
||||||
|
where type = 'job'
|
||||||
|
and user_id = #{userId}
|
||||||
|
and cru.is_deleted = 0
|
||||||
|
and (cru.expire_time is null or cru.expire_time > now())
|
||||||
|
|
||||||
|
<if test="roleId != null and roleId != ''">
|
||||||
|
union
|
||||||
|
|
||||||
|
select menu_id
|
||||||
|
from core_role_group_rx
|
||||||
|
where group_id = #{roleId}
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
order by sort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
BIN
springboot-util/.DS_Store
vendored
Normal file
BIN
springboot-util/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
@@ -36,6 +36,24 @@
|
|||||||
<version>5.8.16</version>
|
<version>5.8.16</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MySql驱动 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.30</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mybatis-plus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- fastJson -->
|
<!-- fastJson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.tiesheng.util;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CharacterUtils {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除特殊字符
|
||||||
|
*
|
||||||
|
* @param o 类
|
||||||
|
*/
|
||||||
|
public static void removeSymbol(Object o) {
|
||||||
|
removeSymbol(o, "\n|\r|\t| ");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除特殊字符
|
||||||
|
*
|
||||||
|
* @param o 类
|
||||||
|
* @param searchStr 规则
|
||||||
|
*/
|
||||||
|
public static void removeSymbol(Object o, String searchStr) {
|
||||||
|
JSONObject object = JSONUtil.parseObj(o, false);
|
||||||
|
for (Map.Entry<String, Object> entry : object) {
|
||||||
|
if (ObjectUtil.isEmpty(entry.getValue()) || StrUtil.equals("null", String.valueOf(entry.getValue()))) {
|
||||||
|
entry.setValue("");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotEmpty(entry.getKey())) {
|
||||||
|
entry.setValue(StrUtil.trim(StrUtil.replace(entry.getValue().toString(), searchStr, "")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BeanUtil.copyProperties(object, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.comparator.VersionComparator;
|
import cn.hutool.core.comparator.VersionComparator;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.core.util.URLUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.http.HttpGlobalConfig;
|
import cn.hutool.http.HttpGlobalConfig;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
@@ -116,7 +117,8 @@ public class GlobalConfig {
|
|||||||
if (FileUtil.exist(folder)) {
|
if (FileUtil.exist(folder)) {
|
||||||
File[] files = FileUtil.ls(folder);
|
File[] files = FileUtil.ls(folder);
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
versions.add(StrUtil.subAfter(file.getAbsolutePath(), htmlDir, true));
|
String normalize = FileUtil.normalize(file.getAbsolutePath());
|
||||||
|
versions.add(StrUtil.subAfter(normalize, htmlDir, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package com.tiesheng.login.config.token;
|
package com.tiesheng.util.config;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.jwt.JWT;
|
import cn.hutool.jwt.JWT;
|
||||||
import cn.hutool.jwt.JWTValidator;
|
import cn.hutool.jwt.JWTValidator;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
|
||||||
import com.tiesheng.util.ServletKit;
|
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
|
import com.tiesheng.util.pojos.TokenBean;
|
||||||
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;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -23,6 +23,11 @@ import java.util.Map;
|
|||||||
@ConfigurationProperties("tiesheng.token")
|
@ConfigurationProperties("tiesheng.token")
|
||||||
public class TsTokenConfig {
|
public class TsTokenConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token常量
|
||||||
|
*/
|
||||||
|
public static final String TOKEN_KEY = "token";
|
||||||
|
|
||||||
private Map<String, TokenBean> testMap = MapUtil.newHashMap();
|
private Map<String, TokenBean> testMap = MapUtil.newHashMap();
|
||||||
private String encryptKey = "%kIp9frQCu";
|
private String encryptKey = "%kIp9frQCu";
|
||||||
private Integer expireHours = 48;
|
private Integer expireHours = 48;
|
||||||
@@ -30,28 +35,6 @@ public class TsTokenConfig {
|
|||||||
private boolean validLoginSign = false;
|
private boolean validLoginSign = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前登录的token
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static TokenBean get() {
|
|
||||||
TsTokenConfig tokenConfig = SpringUtil.getBean(TsTokenConfig.class);
|
|
||||||
return tokenConfig.validToken(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前登录的token
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static TokenBean getWithoutThr() {
|
|
||||||
TsTokenConfig tokenConfig = SpringUtil.getBean(TsTokenConfig.class);
|
|
||||||
return tokenConfig.validToken(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证token
|
* 验证token
|
||||||
*
|
*
|
||||||
@@ -72,8 +55,8 @@ public class TsTokenConfig {
|
|||||||
* @param thrExp
|
* @param thrExp
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TokenBean validToken(boolean thrExp) {
|
public TokenBean validToken(HttpServletRequest request, boolean thrExp) {
|
||||||
String token = ServletUtil.getHeader(ServletKit.getRequest(), "token", "utf-8");
|
String token = ServletUtil.getHeader(request, TOKEN_KEY, "utf-8");
|
||||||
return validToken(token, thrExp);
|
return validToken(token, thrExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,12 +75,7 @@ public class TsTokenConfig {
|
|||||||
try {
|
try {
|
||||||
JWT decode = JWT.of(token);
|
JWT decode = JWT.of(token);
|
||||||
JWTValidator.of(decode).validateDate();
|
JWTValidator.of(decode).validateDate();
|
||||||
String id = decode.getPayload("id").toString();
|
tokenBean = JSONUtil.toBean(decode.getPayloads(), TokenBean.class);
|
||||||
String environmentType = decode.getPayload("environmentType").toString();
|
|
||||||
String service = decode.getPayload("service").toString();
|
|
||||||
String extra = decode.getPayload("extra").toString();
|
|
||||||
tokenBean = new TokenBean(id, environmentType, service);
|
|
||||||
tokenBean.setExtra(extra);
|
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tiesheng.core.pojos;
|
package com.tiesheng.util.pojos;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tiesheng.core.pojos.dto;
|
package com.tiesheng.util.pojos;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tiesheng.core.pojos.dto;
|
package com.tiesheng.util.pojos;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.tiesheng.login.config.token.bean;
|
package com.tiesheng.util.pojos;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.jwt.JWT;
|
import cn.hutool.jwt.JWT;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.util.config.TsTokenConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
@@ -14,6 +14,7 @@ public class TokenBean {
|
|||||||
private String id;
|
private String id;
|
||||||
private String environmentType;
|
private String environmentType;
|
||||||
private String service;
|
private String service;
|
||||||
|
private String roleId;
|
||||||
private String extra;
|
private String extra;
|
||||||
|
|
||||||
public TokenBean() {
|
public TokenBean() {
|
||||||
@@ -23,6 +24,7 @@ public class TokenBean {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.environmentType = environmentType;
|
this.environmentType = environmentType;
|
||||||
this.service = service;
|
this.service = service;
|
||||||
|
this.roleId = "";
|
||||||
this.extra = "";
|
this.extra = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +39,7 @@ public class TokenBean {
|
|||||||
.setPayload("id", getId())
|
.setPayload("id", getId())
|
||||||
.setPayload("environmentType", StrUtil.emptyToDefault(getEnvironmentType(), ""))
|
.setPayload("environmentType", StrUtil.emptyToDefault(getEnvironmentType(), ""))
|
||||||
.setPayload("service", StrUtil.emptyToDefault(getService(), ""))
|
.setPayload("service", StrUtil.emptyToDefault(getService(), ""))
|
||||||
|
.setPayload("roleId", StrUtil.emptyToDefault(getRoleId(), ""))
|
||||||
.setPayload("extra", StrUtil.emptyToDefault(getExtra(), ""))
|
.setPayload("extra", StrUtil.emptyToDefault(getExtra(), ""))
|
||||||
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
||||||
.sign();
|
.sign();
|
||||||
@@ -77,4 +80,12 @@ public class TokenBean {
|
|||||||
public void setExtra(String extra) {
|
public void setExtra(String extra) {
|
||||||
this.extra = extra;
|
this.extra = extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.util.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
BIN
springboot-web/.DS_Store
vendored
Normal file
BIN
springboot-web/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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.13</version>
|
<version>2.0.0.rc4</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
@@ -39,24 +39,6 @@
|
|||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- MySql驱动 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>8.0.30</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- mybatis-plus -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.tiesheng.core;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
*/
|
|
||||||
|
|
||||||
@ComponentScan({
|
|
||||||
"com.tiesheng.core.**.*",
|
|
||||||
})
|
|
||||||
@MapperScan("com.tiesheng.core.mapper")
|
|
||||||
public class CoreAutoConfigurer {
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
package com.tiesheng.core.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
|
||||||
import com.tiesheng.core.pojos.dto.IdDTO;
|
|
||||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
|
||||||
import com.tiesheng.core.pojos.dto.job.JobUpdateDTO;
|
|
||||||
import com.tiesheng.core.pojos.dto.job.JobUpdateRxDTO;
|
|
||||||
import com.tiesheng.core.pojos.dto.job.JobUserAssignDTO;
|
|
||||||
import com.tiesheng.core.pojos.dto.job.JobUserOwner;
|
|
||||||
import com.tiesheng.core.service.CoreJobService;
|
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
|
||||||
import com.tiesheng.util.exception.ApiException;
|
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/job")
|
|
||||||
public class JobController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CoreJobService coreJobService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取职位列表
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
|
||||||
public ApiResp<List<CoreJob>> list(PageDTO dto) {
|
|
||||||
QueryWrapper<CoreJob> queryWrapper = new QueryWrapper<CoreJob>().eq("is_deleted", 0);
|
|
||||||
dto.likeColumns(queryWrapper, "name");
|
|
||||||
List<CoreJob> jobList = coreJobService.list(queryWrapper);
|
|
||||||
return ApiResp.respOK(jobList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加、编辑职位
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/update")
|
|
||||||
public ApiResp<String> update(@Valid @RequestBody JobUpdateDTO dto) {
|
|
||||||
CoreJob job = BeanUtil.copyProperties(dto, CoreJob.class);
|
|
||||||
if (!StrUtil.isEmpty(job.getId())) {
|
|
||||||
CoreJob byId = coreJobService.getById(job.getId());
|
|
||||||
if (byId != null && byId.getIsSystem() == 1) {
|
|
||||||
throw new ApiException("系统配置,无法编辑");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
coreJobService.saveOrUpdate(job);
|
|
||||||
return ApiResp.respOK("");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取关系
|
|
||||||
*
|
|
||||||
* @param dto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/func/rx")
|
|
||||||
public ApiResp<List<String>> funcRx(@Valid IdDTO dto) {
|
|
||||||
List<String> list = coreJobService.getBaseMapper().getJobFunc(dto.getId(), null);
|
|
||||||
return ApiResp.respOK(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新职位关系
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/func/rx")
|
|
||||||
public ApiResp<String> updateJobRx(@Valid @RequestBody JobUpdateRxDTO dto) {
|
|
||||||
coreJobService.updateJobRx(dto.getJobId(), StrUtil.split(dto.getPoints(), ","));
|
|
||||||
return ApiResp.respOK("");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户职位分配
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/user/assign")
|
|
||||||
public ApiResp<String> userAssign(@Valid @RequestBody JobUserAssignDTO dto) {
|
|
||||||
coreJobService.userAssign(dto.getUserId(), dto.getJobId());
|
|
||||||
return ApiResp.respOK("");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户自己的
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/user/owner")
|
|
||||||
public ApiResp<List<JobUserOwner>> userOwner() {
|
|
||||||
List<JobUserOwner> coreJobUsers = coreJobService.getJobUserMapper().list(TsTokenConfig.get().getId());
|
|
||||||
coreJobUsers.forEach(it -> {
|
|
||||||
List<String> list = coreJobService.getBaseMapper().getJobFunc(it.getJobId(), 1);
|
|
||||||
it.setPoints(list);
|
|
||||||
});
|
|
||||||
return ApiResp.respOK(coreJobUsers);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.tiesheng.core.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
|
||||||
import com.tiesheng.util.pojos.IdName;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CoreConfigFuncMapper extends BaseMapper<CoreConfigFunc> {
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.tiesheng.core.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
|
||||||
import com.tiesheng.util.pojos.IdName;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CoreJobMapper extends BaseMapper<CoreJob> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除职位的关联关系
|
|
||||||
*
|
|
||||||
* @param jobId
|
|
||||||
*/
|
|
||||||
void clearJobFunc(@Param("jobId") String jobId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新关联关系
|
|
||||||
*
|
|
||||||
* @param pointList
|
|
||||||
*/
|
|
||||||
void updateJobFunc(@Param("list") List<IdName> pointList);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取关联的func
|
|
||||||
*
|
|
||||||
* @param jobId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<String> getJobFunc(@Param("jobId") String jobId, @Param("isUsed") Integer isUsed);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.tiesheng.core.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreJobUser;
|
|
||||||
import com.tiesheng.core.pojos.dto.job.JobUserOwner;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CoreJobUserMapper extends BaseMapper<CoreJobUser> {
|
|
||||||
/**
|
|
||||||
* 获取指定用户的职位和功能点
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<JobUserOwner> list(@Param("userId") String userId);
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.tiesheng.core.pojos.DaoBase;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 职位-功能点
|
|
||||||
*/
|
|
||||||
@TableName(value = "core_config_func")
|
|
||||||
public class CoreConfigFunc extends DaoBase {
|
|
||||||
/**
|
|
||||||
* 业务
|
|
||||||
*/
|
|
||||||
@TableField(value = "service")
|
|
||||||
private String service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@TableField(value = "`name`")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 其他说明
|
|
||||||
*/
|
|
||||||
@TableField(value = "remark")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否启用
|
|
||||||
*/
|
|
||||||
@TableField(value = "is_used")
|
|
||||||
private Integer isUsed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取业务
|
|
||||||
*
|
|
||||||
* @return service - 业务
|
|
||||||
*/
|
|
||||||
public String getService() {
|
|
||||||
return service;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置业务
|
|
||||||
*
|
|
||||||
* @param service 业务
|
|
||||||
*/
|
|
||||||
public void setService(String service) {
|
|
||||||
this.service = service;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取名称
|
|
||||||
*
|
|
||||||
* @return name - 名称
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置名称
|
|
||||||
*
|
|
||||||
* @param name 名称
|
|
||||||
*/
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取其他说明
|
|
||||||
*
|
|
||||||
* @return remark - 其他说明
|
|
||||||
*/
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置其他说明
|
|
||||||
*
|
|
||||||
* @param remark 其他说明
|
|
||||||
*/
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取是否启用
|
|
||||||
*
|
|
||||||
* @return is_used - 是否启用
|
|
||||||
*/
|
|
||||||
public Integer getIsUsed() {
|
|
||||||
return isUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置是否启用
|
|
||||||
*
|
|
||||||
* @param isUsed 是否启用
|
|
||||||
*/
|
|
||||||
public void setIsUsed(Integer isUsed) {
|
|
||||||
this.isUsed = isUsed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.tiesheng.core.pojos.DaoBase;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 职位
|
|
||||||
*/
|
|
||||||
@TableName(value = "core_job")
|
|
||||||
public class CoreJob extends DaoBase {
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@TableField(value = "`name`")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 其他说明
|
|
||||||
*/
|
|
||||||
@TableField(value = "remark")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否系统
|
|
||||||
*/
|
|
||||||
@TableField(value = "is_system")
|
|
||||||
private Integer isSystem;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取名称
|
|
||||||
*
|
|
||||||
* @return name - 名称
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置名称
|
|
||||||
*
|
|
||||||
* @param name 名称
|
|
||||||
*/
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取其他说明
|
|
||||||
*
|
|
||||||
* @return remark - 其他说明
|
|
||||||
*/
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置其他说明
|
|
||||||
*
|
|
||||||
* @param remark 其他说明
|
|
||||||
*/
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取是否系统
|
|
||||||
*
|
|
||||||
* @return is_system - 是否系统
|
|
||||||
*/
|
|
||||||
public Integer getIsSystem() {
|
|
||||||
return isSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置是否系统
|
|
||||||
*
|
|
||||||
* @param isSystem 是否系统
|
|
||||||
*/
|
|
||||||
public void setIsSystem(Integer isSystem) {
|
|
||||||
this.isSystem = isSystem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dto.config;
|
|
||||||
|
|
||||||
public class ConfigFuncDTO {
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
private String remark;
|
|
||||||
private Integer isUsed;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// setter\getter
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIsUsed() {
|
|
||||||
return isUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsUsed(Integer isUsed) {
|
|
||||||
this.isUsed = isUsed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dto.job;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
public class JobUpdateDTO {
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@NotEmpty(message = "请输入职位名称")
|
|
||||||
private String name;
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// setter\getter
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dto.job;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
public class JobUpdateRxDTO {
|
|
||||||
|
|
||||||
@NotEmpty(message = "请选择职位")
|
|
||||||
private String jobId;
|
|
||||||
private String points;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// setter\getter
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public String getJobId() {
|
|
||||||
return jobId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobId(String jobId) {
|
|
||||||
this.jobId = jobId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPoints() {
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoints(String points) {
|
|
||||||
this.points = points;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dto.job;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
public class JobUserAssignDTO {
|
|
||||||
|
|
||||||
@NotEmpty(message = "请选择用户")
|
|
||||||
private String userId;
|
|
||||||
@NotEmpty(message = "请选择职位")
|
|
||||||
private String jobId;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// setter\getter
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public String getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(String userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJobId() {
|
|
||||||
return jobId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobId(String jobId) {
|
|
||||||
this.jobId = jobId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.tiesheng.core.pojos.dto.job;
|
|
||||||
|
|
||||||
import com.tiesheng.util.pojos.IdName;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class JobUserOwner {
|
|
||||||
|
|
||||||
private String jobId;
|
|
||||||
private String jobName;
|
|
||||||
private List<String> points;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// setter\getter
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public String getJobId() {
|
|
||||||
return jobId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobId(String jobId) {
|
|
||||||
this.jobId = jobId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJobName() {
|
|
||||||
return jobName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobName(String jobName) {
|
|
||||||
this.jobName = jobName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getPoints() {
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoints(List<String> points) {
|
|
||||||
this.points = points;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.tiesheng.core.service;
|
|
||||||
|
|
||||||
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
|
||||||
import com.tiesheng.core.mapper.CoreConfigFuncMapper;
|
|
||||||
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, CoreConfigSystem> {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CoreConfigEnumMapper coreConfigEnumMapper;
|
|
||||||
@Autowired
|
|
||||||
CoreConfigFuncMapper coreConfigFuncMapper;
|
|
||||||
|
|
||||||
public CoreConfigEnumMapper getEnumMapper() {
|
|
||||||
return coreConfigEnumMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CoreConfigFuncMapper getFuncMapper() {
|
|
||||||
return coreConfigFuncMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新功能点
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param service
|
|
||||||
* @param name
|
|
||||||
* @param remark
|
|
||||||
*/
|
|
||||||
public void refreshFunc(String id, String service, String name, String remark) {
|
|
||||||
CoreConfigFunc jobPoint = new CoreConfigFunc();
|
|
||||||
jobPoint.setId(id);
|
|
||||||
jobPoint.setService(service);
|
|
||||||
jobPoint.setName(name);
|
|
||||||
jobPoint.setRemark(remark);
|
|
||||||
try {
|
|
||||||
coreConfigFuncMapper.insert(jobPoint);
|
|
||||||
} catch (Exception e) {
|
|
||||||
coreConfigFuncMapper.updateById(jobPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
package com.tiesheng.core.service;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.tiesheng.core.mapper.CoreJobMapper;
|
|
||||||
import com.tiesheng.core.mapper.CoreJobUserMapper;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
|
||||||
import com.tiesheng.core.pojos.dao.CoreJobUser;
|
|
||||||
import com.tiesheng.util.pojos.IdName;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CoreJobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CoreJobUserMapper coreJobUserMapper;
|
|
||||||
|
|
||||||
public CoreJobUserMapper getJobUserMapper() {
|
|
||||||
return coreJobUserMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新职位
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param remark
|
|
||||||
* @param isSystem
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void refresh(String id, String name, String remark, Integer isSystem) {
|
|
||||||
CoreJob coreJob = new CoreJob();
|
|
||||||
coreJob.setId(id);
|
|
||||||
coreJob.setName(name);
|
|
||||||
coreJob.setRemark(remark);
|
|
||||||
coreJob.setIsSystem(isSystem);
|
|
||||||
saveOrUpdate(coreJob);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新关联关系
|
|
||||||
*
|
|
||||||
* @param jobId
|
|
||||||
* @param points
|
|
||||||
*/
|
|
||||||
public void updateJobRx(String jobId, List<String> points) {
|
|
||||||
List<IdName> nameList = new ArrayList<>();
|
|
||||||
for (String s : points) {
|
|
||||||
IdName id = new IdName();
|
|
||||||
id.setId(IdUtil.getSnowflakeNextIdStr());
|
|
||||||
id.setName(jobId);
|
|
||||||
id.setExtra(s);
|
|
||||||
nameList.add(id);
|
|
||||||
}
|
|
||||||
if (StrUtil.isEmpty(jobId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getBaseMapper().clearJobFunc(jobId);
|
|
||||||
if (CollUtil.isNotEmpty(nameList)) {
|
|
||||||
getBaseMapper().updateJobFunc(nameList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分配职位
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @param jobId
|
|
||||||
*/
|
|
||||||
public void userAssign(String userId, String jobId) {
|
|
||||||
CoreJobUser jobUser = coreJobUserMapper.selectOne(new QueryWrapper<CoreJobUser>()
|
|
||||||
.eq("is_deleted", 0)
|
|
||||||
.eq("user_id", userId)
|
|
||||||
.eq("job_id", jobId)
|
|
||||||
);
|
|
||||||
if (jobUser == null) {
|
|
||||||
jobUser = new CoreJobUser();
|
|
||||||
}
|
|
||||||
jobUser.setUserId(userId);
|
|
||||||
jobUser.setJobId(jobId);
|
|
||||||
if (StrUtil.isEmpty(jobUser.getId())) {
|
|
||||||
coreJobUserMapper.insert(jobUser);
|
|
||||||
} else {
|
|
||||||
coreJobUserMapper.updateById(jobUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.tiesheng.core;
|
package com.tiesheng.web;
|
||||||
|
|
||||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
|
||||||
import com.tiesheng.database.DatabaseAutoConfigurer;
|
import com.tiesheng.database.DatabaseAutoConfigurer;
|
||||||
import com.tiesheng.encrypt.EncryptAutoConfigurer;
|
import com.tiesheng.encrypt.EncryptAutoConfigurer;
|
||||||
import com.tiesheng.login.LoginAutoConfigurer;
|
import com.tiesheng.login.LoginAutoConfigurer;
|
||||||
import com.tiesheng.message.MessageAutoConfigurer;
|
import com.tiesheng.message.MessageAutoConfigurer;
|
||||||
import com.tiesheng.util.UtilAutoConfigurer;
|
import com.tiesheng.util.UtilAutoConfigurer;
|
||||||
|
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
@@ -19,10 +19,10 @@ import java.lang.annotation.*;
|
|||||||
@Import({
|
@Import({
|
||||||
UtilAutoConfigurer.class,
|
UtilAutoConfigurer.class,
|
||||||
MessageAutoConfigurer.class,
|
MessageAutoConfigurer.class,
|
||||||
CoreAutoConfigurer.class,
|
WebAutoConfigurer.class,
|
||||||
LoginAutoConfigurer.class,
|
LoginAutoConfigurer.class,
|
||||||
DatabaseAutoConfigurer.class,
|
DatabaseAutoConfigurer.class,
|
||||||
EncryptAutoConfigurer.class
|
EncryptAutoConfigurer.class,
|
||||||
})
|
})
|
||||||
public @interface EnableTieshengWeb {
|
public @interface EnableTieshengWeb {
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tiesheng.web;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hao
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ComponentScan({
|
||||||
|
"com.tiesheng.web.**.*",
|
||||||
|
"com.tiesheng.role.**.*",
|
||||||
|
})
|
||||||
|
@MapperScan(value = {"com.tiesheng.web.mapper", "com.tiesheng.role.mapper"})
|
||||||
|
public class WebAutoConfigurer {
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.tiesheng.core.config.exception;
|
package com.tiesheng.web.config.exception;
|
||||||
|
|
||||||
import cn.hutool.core.exceptions.ValidateException;
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.exception.ApiRespEnum;
|
import com.tiesheng.util.exception.ApiRespEnum;
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user