mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 02:16:53 +08:00
Compare commits
168 Commits
v3.10.1
...
f8d2f5cf6b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d2f5cf6b | ||
|
|
38a92824ba | ||
|
|
bf8311c296 | ||
|
|
686f6ac9a3 | ||
|
|
374cc92a79 | ||
|
|
63ef235b95 | ||
|
|
3ceea05ba1 | ||
|
|
9fda0a7bd6 | ||
|
|
9361097097 | ||
|
|
942c628cc6 | ||
|
|
521b98746f | ||
|
|
4229ec80b0 | ||
|
|
4582656e27 | ||
|
|
fff0120058 | ||
|
|
b8f2200af6 | ||
|
|
0a56497b51 | ||
|
|
2eb3742063 | ||
|
|
74aa2da89b | ||
|
|
3dcad0b78a | ||
|
|
6ba6b18849 | ||
|
|
d2c55e35ff | ||
|
|
8135e0ec10 | ||
|
|
2a545117fa | ||
|
|
d8baf9dba7 | ||
|
|
2f8a0b6153 | ||
|
|
a97afd4683 | ||
|
|
075e7ad134 | ||
|
|
acecebf4b3 | ||
|
|
73cd7f196c | ||
|
|
d3ef935859 | ||
|
|
97df843072 | ||
|
|
12bd821770 | ||
|
|
2b6ead23bd | ||
|
|
b2aa70ce9e | ||
|
|
143a500c44 | ||
|
|
8302ba4c2c | ||
|
|
7ae4e898ad | ||
|
|
245f8c7856 | ||
|
|
43a9f53c0a | ||
|
|
551c9c9086 | ||
|
|
28d188251b | ||
|
|
87210fad28 | ||
|
|
4f0296ce23 | ||
|
|
563b20206b | ||
|
|
c1373ed21d | ||
|
|
8f6852673a | ||
|
|
336bdc4895 | ||
|
|
922e49b27e | ||
|
|
3adb7376dd | ||
|
|
40880b87c1 | ||
|
|
a260368d0c | ||
|
|
e7d29c68ae | ||
|
|
c0dea0c3c6 | ||
|
|
4d2be37e0e | ||
|
|
d5abf42014 | ||
|
|
8d2d8f2846 | ||
|
|
0e06f36787 | ||
|
|
012096a3ee | ||
|
|
3fb4dfad09 | ||
|
|
f198a949c9 | ||
|
|
41fad5b831 | ||
|
|
696db3835a | ||
|
|
40edf452ac | ||
|
|
c93616bec2 | ||
|
|
61c49b5798 | ||
|
|
54ad0e5893 | ||
|
|
fa5b5c7def | ||
|
|
57270a7130 | ||
|
|
6c4cf9cc34 | ||
|
|
c49c1bbbfe | ||
|
|
47d41f0379 | ||
|
|
3c3e3b4e32 | ||
|
|
7bad13fc23 | ||
|
|
51caeb1ad1 | ||
|
|
f127f02c96 | ||
|
|
6583f5f90d | ||
|
|
d6a53f03b7 | ||
|
|
caf8e3aa25 | ||
|
|
97cfdf1f57 | ||
|
|
8bb9f173eb | ||
|
|
7ea97f8433 | ||
|
|
e7927bb948 | ||
|
|
79fc04d8cb | ||
|
|
393cb325c7 | ||
|
|
33c93ae365 | ||
|
|
3c2c3cf81b | ||
|
|
ec8fb1d69d | ||
|
|
d4f1806491 | ||
|
|
ce0551696a | ||
|
|
1abe2ee05e | ||
|
|
cead60b406 | ||
|
|
9445ad3cf6 | ||
|
|
dd31f3e8a5 | ||
|
|
486aa13cfd | ||
|
|
ade82f8aa2 | ||
|
|
66aac47a43 | ||
|
|
23c4889723 | ||
|
|
4062d5a4bb | ||
|
|
fc2f3f2e23 | ||
|
|
4683e31290 | ||
|
|
5136148ce1 | ||
|
|
558d5c86ff | ||
|
|
45b5ba6795 | ||
|
|
b72f58a0bb | ||
|
|
5fb1456080 | ||
|
|
a6607c063b | ||
|
|
580a783d25 | ||
|
|
a66d97a408 | ||
|
|
684cb3f71c | ||
|
|
109689be69 | ||
|
|
30901ed00f | ||
|
|
e5edc82beb | ||
|
|
ff868d1b2e | ||
|
|
7ef9000c62 | ||
|
|
c295073037 | ||
|
|
eeb9c569de | ||
|
|
5553aac514 | ||
|
|
30787815c8 | ||
|
|
92fd908619 | ||
|
|
b1cbad8362 | ||
|
|
ad7ad667c8 | ||
|
|
8b40637e98 | ||
|
|
5da35dfe85 | ||
|
|
55fc58da3d | ||
|
|
bb68f050bf | ||
|
|
2dd72e404a | ||
|
|
34fdf59432 | ||
|
|
66147e47da | ||
|
|
3ac76495ae | ||
|
|
0c156e23b2 | ||
|
|
d0e9eef9c2 | ||
|
|
e44b116184 | ||
|
|
57747d9082 | ||
|
|
81b7b2a3a4 | ||
|
|
a100b1ab12 | ||
|
|
2c70db1498 | ||
|
|
9a6d758fc7 | ||
|
|
c4b95654fe | ||
|
|
ac0f1ae2b9 | ||
|
|
8d635bb80b | ||
|
|
cdbb854e6c | ||
|
|
ae753844c7 | ||
|
|
e988867b17 | ||
|
|
db5e0062a0 | ||
|
|
29064c176f | ||
|
|
b7c71189e1 | ||
|
|
55fb01174f | ||
|
|
1943431df0 | ||
|
|
bbc382bc38 | ||
|
|
31f0041f74 | ||
|
|
36ebb16574 | ||
|
|
23b75137bb | ||
|
|
e3888cef9b | ||
|
|
7b681e44a8 | ||
|
|
83d970095b | ||
|
|
a3a7cf63a8 | ||
|
|
fff3ec203f | ||
|
|
a53acc504e | ||
|
|
64ebe2bfdb | ||
|
|
69ea81b020 | ||
|
|
cb39dedfd5 | ||
|
|
b27b004edc | ||
|
|
145895703d | ||
|
|
7b712bae71 | ||
|
|
69ff0a9631 | ||
|
|
364ca94973 | ||
|
|
33a8ab3280 | ||
|
|
dab0afdb59 |
@@ -4,16 +4,18 @@
|
|||||||
|
|
||||||
**<font color="#DC143C">国内首个满足《网络安全-三级等保》、《数据安全》</font>** 功能要求,支持登录限制、接口国产加解密、数据脱敏等一系列安全要求。
|
**<font color="#DC143C">国内首个满足《网络安全-三级等保》、《数据安全》</font>** 功能要求,支持登录限制、接口国产加解密、数据脱敏等一系列安全要求。
|
||||||
|
|
||||||
前端提供 **<font color="#DC143C">JavaScript和TypeScript双版本</font>**,后端提供 **<font color="#DC143C">Java8+SpringBoot2.X和Java17+SpringBoot3.X 双版本</font>**。
|
**<font color="#DC143C">支持国产数据库:【达梦、金仓、南大通用、海量数据、神州通用、OceanBase、GaussDB 高斯、阿里PolarDB、GoldenDB】等,主流数据库:【Mysql, PostgreSQL】等</font>**
|
||||||
|
|
||||||
|
**<font color="#DC143C">前端提供JavaScript和TypeScript双版本,后端提供Java8+SpringBoot2.X和Java17+SpringBoot3.X 双版本</font>**。
|
||||||
|
|
||||||
同时 **<font color="#DC143C">重磅开源</font>** 开源六年来 **<font color="#DC143C">千余家企业验证过且正在使用</font>** 的代码规范: **<font color="#DC143C">《高质量代码思想》、《Vue3规范》、《Java规范》</font>** ,让大家在这浮躁的世界里感受到一股把代码写好的清流!同时又能节省大量时间,减少加班,快乐工作,保持谦逊,保持学习,**<font color="#DC143C">热爱代码,更热爱生活</font>** !
|
同时 **<font color="#DC143C">重磅开源</font>** 开源六年来 **<font color="#DC143C">千余家企业验证过且正在使用</font>** 的代码规范: **<font color="#DC143C">《高质量代码思想》、《Vue3规范》、《Java规范》</font>** ,让大家在这浮躁的世界里感受到一股把代码写好的清流!同时又能节省大量时间,减少加班,快乐工作,保持谦逊,保持学习,**<font color="#DC143C">热爱代码,更热爱生活</font>** !
|
||||||
### **技术体系**
|
### **技术体系**
|
||||||
|
|
||||||
- 前端:JavaScript/TypeScript + Vue3 + Vite5 + Pinia + Ant Design Vue 4.X
|
- 前端:JavaScript/TypeScript + Vue3 + Vite5 + Pinia + Ant Design Vue 4.X
|
||||||
- 移动端:uniapp (vue3版本) + uni-ui + (同时支持APP、小程序、H5)
|
- 移动端:uniapp (vue3版本) + uni-ui + (同时支持APP、小程序、H5)
|
||||||
- 后端:Java8/17 + SpringBoot2/3 + Sa Token + Mybatis-plus + 多种数据库
|
- 后端:Java8/17 + SpringBoot2/3 + Sa Token + Mybatis-plus + 主流数据库/国产数据库
|
||||||
- 电脑在线预览:[https://preview.smartadmin.vip](https://preview.smartadmin.vip)
|
|
||||||
- 官方文档:[https://smartadmin.vip](https://smartadmin.vip)
|
- 官方文档:[https://smartadmin.vip](https://smartadmin.vip)
|
||||||
|
- 电脑在线预览:[https://preview.smartadmin.vip](https://preview.smartadmin.vip)
|
||||||
- 移动端在线预览:[https://app.smartadmin.vip](https://app.smartadmin.vip/#/pages/login/login)
|
- 移动端在线预览:[https://app.smartadmin.vip](https://app.smartadmin.vip/#/pages/login/login)
|
||||||
### **理念与思想**
|
### **理念与思想**
|
||||||
|
|
||||||
|
|||||||
35
smart-admin-api-java17-springboot3/.gitignore
vendored
35
smart-admin-api-java17-springboot3/.gitignore
vendored
@@ -1,35 +0,0 @@
|
|||||||
HELP.md
|
|
||||||
target/
|
|
||||||
|
|
||||||
velocity.log
|
|
||||||
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
build/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>net.1024lab</groupId>
|
<groupId>net.lab1024</groupId>
|
||||||
<artifactId>sa-parent</artifactId>
|
<artifactId>sa-parent</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@@ -16,53 +16,49 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<springboot.version>3.3.1</springboot.version>
|
<java.version>17</java.version>
|
||||||
<spring-mock.version>2.0.8</spring-mock.version>
|
<springboot.version>3.5.4</springboot.version>
|
||||||
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
<spring-security-crypto.version>6.5.1</spring-security-crypto.version>
|
||||||
|
<mybatis-plus.version>3.5.12</mybatis-plus.version>
|
||||||
<p6spy.version>3.9.1</p6spy.version>
|
<p6spy.version>3.9.1</p6spy.version>
|
||||||
<knife4j.version>4.4.0</knife4j.version>
|
<springdoc-openapi.version>2.8.9</springdoc-openapi.version>
|
||||||
<fastjson.version>2.0.52</fastjson.version>
|
<knife4j.version>4.6.0</knife4j.version>
|
||||||
<druid.version>1.2.23</druid.version>
|
<fastjson.version>2.0.57</fastjson.version>
|
||||||
|
<druid.version>1.2.25</druid.version>
|
||||||
<google-linkedhashmap.version>1.4.2</google-linkedhashmap.version>
|
<google-linkedhashmap.version>1.4.2</google-linkedhashmap.version>
|
||||||
<google-guava.version>20.0</google-guava.version>
|
<google-guava.version>20.0</google-guava.version>
|
||||||
<user-agent-utils.version>1.21</user-agent-utils.version>
|
<reflections.version>0.10.2</reflections.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<commons-io.version>2.19.0</commons-io.version>
|
||||||
<reflections.version>0.9.11</reflections.version>
|
<commons-lang3.version>3.18.0</commons-lang3.version>
|
||||||
<commons-io.version>2.15.0</commons-io.version>
|
<commons-collections4.version>4.5.0</commons-collections4.version>
|
||||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
<commons-compress.version>1.27.1</commons-compress.version>
|
||||||
<commons-collections4.version>4.4</commons-collections4.version>
|
<commons-codec.version>1.18.0</commons-codec.version>
|
||||||
<commons-codec.version>1.13</commons-codec.version>
|
<commons-text.version>1.13.1</commons-text.version>
|
||||||
<commons-text.version>1.9</commons-text.version>
|
<fast-excel.version>1.2.0</fast-excel.version>
|
||||||
<xerces.version>2.12.0</xerces.version>
|
<poi.version>5.4.1</poi.version>
|
||||||
<easy-excel.version>3.3.2</easy-excel.version>
|
<awssdk-s3.version>2.31.78</awssdk-s3.version>
|
||||||
<poi.version>5.2.4</poi.version>
|
<mysql-connector-j.version>9.3.0</mysql-connector-j.version>
|
||||||
<ooxml-schemas.version>1.4</ooxml-schemas.version>
|
<hutool.version>5.8.39</hutool.version>
|
||||||
<aws-java-sdk.version>1.11.842</aws-java-sdk.version>
|
<velocity-engine-core.version>2.4.1</velocity-engine-core.version>
|
||||||
<log4j-spring-boot.version>2.23.1</log4j-spring-boot.version>
|
|
||||||
<hutool.version>5.8.29</hutool.version>
|
|
||||||
<velocity-engine-core.version>2.3</velocity-engine-core.version>
|
|
||||||
<jjwt.version>0.9.1</jjwt.version>
|
|
||||||
<jwks-rsa.version>0.9.0</jwks-rsa.version>
|
|
||||||
<velocity-tools.version>3.1</velocity-tools.version>
|
<velocity-tools.version>3.1</velocity-tools.version>
|
||||||
<sa-token.version>1.37.0</sa-token.version>
|
<sa-token.version>1.44.0</sa-token.version>
|
||||||
<ip2region.version>2.7.0</ip2region.version>
|
<ip2region.version>2.7.0</ip2region.version>
|
||||||
<bcprov.version>1.59</bcprov.version>
|
<bcprov.version>1.80</bcprov.version>
|
||||||
<jackson-datatype-jsr310.version>2.13.4</jackson-datatype-jsr310.version>
|
|
||||||
<jackson-dataformat-yaml.version>2.16.1</jackson-dataformat-yaml.version>
|
|
||||||
<smartdb.version>1.2.0</smartdb.version>
|
<smartdb.version>1.2.0</smartdb.version>
|
||||||
<redisson.version>3.25.0</redisson.version>
|
<redisson.version>3.50.0</redisson.version>
|
||||||
<snakeyaml.version>2.2</snakeyaml.version>
|
<snakeyaml.version>2.4</snakeyaml.version>
|
||||||
<freemarker.version>2.3.33</freemarker.version>
|
<freemarker.version>2.3.34</freemarker.version>
|
||||||
<jsoup.version>1.18.1</jsoup.version>
|
<jsoup.version>1.21.1</jsoup.version>
|
||||||
|
<tika.version>3.1.0</tika.version>
|
||||||
|
<httpcomponents.version>5.5</httpcomponents.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!--BOM begin-->
|
<!--SpringBoot BOM begin-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
@@ -70,18 +66,27 @@
|
|||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--BOM end-->
|
<!--SpringBoot BOM end-->
|
||||||
|
<!--mybatis-plus BOM begin-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
<artifactId>mybatis-plus-bom</artifactId>
|
||||||
<version>${mybatis-plus.version}</version>
|
<version>${mybatis-plus.version}</version>
|
||||||
<exclusions>
|
<type>pom</type>
|
||||||
<exclusion>
|
<scope>import</scope>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</dependency>
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
<!--mybatis-plus BOM end-->
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-crypto</artifactId>
|
||||||
|
<version>${spring-security-crypto.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>${mysql-connector-j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -91,7 +96,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xingfudeshi</groupId>
|
||||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
<version>${knife4j.version}</version>
|
<version>${knife4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -102,7 +107,6 @@
|
|||||||
<version>${fastjson.version}</version>
|
<version>${fastjson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||||
@@ -121,24 +125,6 @@
|
|||||||
<version>${google-guava.version}</version>
|
<version>${google-guava.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>eu.bitwalker</groupId>
|
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
|
||||||
<version>${user-agent-utils.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.penggle</groupId>
|
|
||||||
<artifactId>kaptcha</artifactId>
|
|
||||||
<version>${kaptcha.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>*</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
@@ -169,6 +155,12 @@
|
|||||||
<version>${commons-collections4.version}</version>
|
<version>${commons-collections4.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
<version>${commons-compress.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
@@ -176,9 +168,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.amazonaws</groupId>
|
<groupId>software.amazon.awssdk</groupId>
|
||||||
<artifactId>aws-java-sdk-s3</artifactId>
|
<artifactId>s3</artifactId>
|
||||||
<version>${aws-java-sdk.version}</version>
|
<version>${awssdk-s3.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
@@ -198,19 +190,6 @@
|
|||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt</artifactId>
|
|
||||||
<version>${jjwt.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.auth0</groupId>
|
|
||||||
<artifactId>jwks-rsa</artifactId>
|
|
||||||
<version>${jwks-rsa.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--velocity begin-->
|
<!--velocity begin-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
@@ -237,6 +216,7 @@
|
|||||||
<artifactId>sa-token-redis-jackson</artifactId>
|
<artifactId>sa-token-redis-jackson</artifactId>
|
||||||
<version>${sa-token.version}</version>
|
<version>${sa-token.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- sa-token end -->
|
<!-- sa-token end -->
|
||||||
|
|
||||||
<!--ip 地址-->
|
<!--ip 地址-->
|
||||||
@@ -248,18 +228,22 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk18on</artifactId>
|
||||||
<version>${bcprov.version}</version>
|
<version>${bcprov.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>cn.idev.excel</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>fastexcel</artifactId>
|
||||||
<version>${easy-excel.version}</version>
|
<version>${fast-excel.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>poi-ooxml-schemas</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -270,12 +254,6 @@
|
|||||||
<version>${poi.version}</version>
|
<version>${poi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
@@ -284,20 +262,8 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>ooxml-schemas</artifactId>
|
<artifactId>poi-ooxml-full</artifactId>
|
||||||
<version>${ooxml-schemas.version}</version>
|
<version>${poi.version}</version>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
<version>${jackson-datatype-jsr310.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
|
||||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
|
||||||
<version>${jackson-dataformat-yaml.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -311,6 +277,25 @@
|
|||||||
<groupId>org.redisson</groupId>
|
<groupId>org.redisson</groupId>
|
||||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
<version>${redisson.version}</version>
|
<version>${redisson.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-data-32</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>objenesis</artifactId>
|
||||||
|
<groupId>org.objenesis</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-data-27</artifactId>
|
||||||
|
<version>${redisson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -331,6 +316,18 @@
|
|||||||
<version>${freemarker.version}</version>
|
<version>${freemarker.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tika</groupId>
|
||||||
|
<artifactId>tika-core</artifactId>
|
||||||
|
<version>${tika.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
|
<artifactId>httpclient5</artifactId>
|
||||||
|
<version>${httpcomponents.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.1024lab</groupId>
|
<groupId>net.lab1024</groupId>
|
||||||
<artifactId>sa-parent</artifactId>
|
<artifactId>sa-parent</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.1024lab</groupId>
|
<groupId>net.lab1024</groupId>
|
||||||
<artifactId>sa-base</artifactId>
|
<artifactId>sa-base</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ public class AdminCacheConst extends CacheKeyConst {
|
|||||||
*/
|
*/
|
||||||
public static final String DEPARTMENT_LIST_CACHE = "department_list_cache";
|
public static final String DEPARTMENT_LIST_CACHE = "department_list_cache";
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门map
|
|
||||||
*/
|
|
||||||
public static final String DEPARTMENT_MAP_CACHE = "department_map_cache";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门树
|
* 部门树
|
||||||
*/
|
*/
|
||||||
@@ -54,4 +49,20 @@ public class AdminCacheConst extends CacheKeyConst {
|
|||||||
public static final String CATEGORY_TREE = "category_tree_cache";
|
public static final String CATEGORY_TREE = "category_tree_cache";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录相关
|
||||||
|
*/
|
||||||
|
public static class Login {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求用户信息
|
||||||
|
*/
|
||||||
|
public static final String REQUEST_EMPLOYEE = "login_request_employee";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求用户信息权限
|
||||||
|
*/
|
||||||
|
public static final String USER_PERMISSION = "login_user_permission";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public class AdminSwaggerTagConst extends SwaggerTagConst {
|
|||||||
|
|
||||||
public static final String SYSTEM_POSITION = "系统-职务管理";
|
public static final String SYSTEM_POSITION = "系统-职务管理";
|
||||||
|
|
||||||
|
public static final String SYSTEM_MESSAGE = "系统-消息";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package net.lab1024.sa.admin.interceptor;
|
|||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import cn.dev33.satoken.exception.SaTokenException;
|
import cn.dev33.satoken.exception.SaTokenException;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.dev33.satoken.strategy.SaStrategy;
|
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -14,14 +13,9 @@ import net.lab1024.sa.admin.module.system.login.service.LoginService;
|
|||||||
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
|
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
|
||||||
import net.lab1024.sa.base.common.code.SystemErrorCode;
|
import net.lab1024.sa.base.common.code.SystemErrorCode;
|
||||||
import net.lab1024.sa.base.common.code.UserErrorCode;
|
import net.lab1024.sa.base.common.code.UserErrorCode;
|
||||||
import net.lab1024.sa.base.common.constant.StringConst;
|
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
import net.lab1024.sa.base.common.domain.SystemEnvironment;
|
|
||||||
import net.lab1024.sa.base.common.enumeration.SystemEnvironmentEnum;
|
|
||||||
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
|
||||||
import net.lab1024.sa.base.common.util.SmartRequestUtil;
|
import net.lab1024.sa.base.common.util.SmartRequestUtil;
|
||||||
import net.lab1024.sa.base.common.util.SmartResponseUtil;
|
import net.lab1024.sa.base.common.util.SmartResponseUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -47,9 +41,6 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
@Resource
|
@Resource
|
||||||
private LoginService loginService;
|
private LoginService loginService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SystemEnvironment systemEnvironment;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
|
||||||
@@ -68,17 +59,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
// --------------- 第一步: 根据token 获取用户 ---------------
|
// --------------- 第一步: 根据token 获取用户 ---------------
|
||||||
|
|
||||||
String tokenValue = StpUtil.getTokenValue();
|
String tokenValue = StpUtil.getTokenValue();
|
||||||
boolean debugNumberTokenFlag = isDevDebugNumberToken(tokenValue);
|
String loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
||||||
|
|
||||||
String loginId = null;
|
|
||||||
if (debugNumberTokenFlag) {
|
|
||||||
//开发、测试环境,且为数字的话,则表明为 调试临时用户,即需要调用 sa-token switch
|
|
||||||
loginId = UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + tokenValue;
|
|
||||||
StpUtil.switchTo(loginId);
|
|
||||||
} else {
|
|
||||||
loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
RequestEmployee requestEmployee = loginService.getLoginEmployee(loginId, request);
|
RequestEmployee requestEmployee = loginService.getLoginEmployee(loginId, request);
|
||||||
|
|
||||||
// --------------- 第二步: 校验 登录 ---------------
|
// --------------- 第二步: 校验 登录 ---------------
|
||||||
@@ -86,7 +67,8 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
Method method = ((HandlerMethod) handler).getMethod();
|
Method method = ((HandlerMethod) handler).getMethod();
|
||||||
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
|
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
|
||||||
if (noNeedLogin != null) {
|
if (noNeedLogin != null) {
|
||||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
updateActiveTimeout(requestEmployee);
|
||||||
|
SmartRequestUtil.setRequestUser(requestEmployee);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,14 +77,14 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测token 活跃频率
|
// 更新活跃
|
||||||
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
|
updateActiveTimeout(requestEmployee);
|
||||||
|
|
||||||
|
|
||||||
// --------------- 第三步: 校验 权限 ---------------
|
// --------------- 第三步: 校验 权限 ---------------
|
||||||
|
|
||||||
SmartRequestUtil.setRequestUser(requestEmployee);
|
SmartRequestUtil.setRequestUser(requestEmployee);
|
||||||
if (SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
if (SaAnnotationStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +93,7 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaStrategy.instance.checkMethodAnnotation.accept(method);
|
SaAnnotationStrategy.instance.checkMethodAnnotation.accept(method);
|
||||||
|
|
||||||
} catch (SaTokenException e) {
|
} catch (SaTokenException e) {
|
||||||
/*
|
/*
|
||||||
@@ -141,48 +123,19 @@ public class AdminInterceptor implements HandlerInterceptor {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测:token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结
|
* 更新活跃时间
|
||||||
*/
|
*/
|
||||||
private void checkActiveTimeout(RequestEmployee requestEmployee, boolean debugNumberTokenFlag) {
|
private void updateActiveTimeout(RequestEmployee requestEmployee) {
|
||||||
|
|
||||||
// 对于开发环境的 数字 debug token ,不需要检测活跃有效期
|
|
||||||
if (debugNumberTokenFlag) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户不在线,也不用检测
|
|
||||||
if (requestEmployee == null) {
|
if (requestEmployee == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StpUtil.checkActiveTimeout();
|
|
||||||
StpUtil.updateLastActiveToNow();
|
StpUtil.updateLastActiveToNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为开发使用的 debug token
|
|
||||||
*
|
|
||||||
* @param token
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isDevDebugNumberToken(String token) {
|
|
||||||
if (!StrUtil.isNumeric(token)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV
|
|
||||||
|| systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.TEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
// 清除上下文
|
// 清除上下文
|
||||||
SmartRequestUtil.remove();
|
SmartRequestUtil.remove();
|
||||||
// 开发环境,关闭 sa token 的临时切换用户
|
|
||||||
if (systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV) {
|
|
||||||
StpUtil.endSwitch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package net.lab1024.sa.admin.listener;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* admin 应用启动加载
|
|
||||||
*
|
|
||||||
* @Author 1024创新实验室-主任:卓大
|
|
||||||
* @Date 2021-08-26 18:46:32
|
|
||||||
* @Wechat zhuoda1024
|
|
||||||
* @Email lab1024@163.com
|
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class AdminStartupRunner implements CommandLineRunner {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(String... args) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
* @Email lab1024@163.com
|
* @Email lab1024@163.com
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CategoryDao extends BaseMapper<CategoryEntity> {
|
public interface CategoryDao extends BaseMapper<CategoryEntity> {
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.admin.module.business.category.constant.CategoryTypeEnum;
|
import net.lab1024.sa.admin.module.business.category.constant.CategoryTypeEnum;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +20,9 @@ import java.time.LocalDateTime;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("t_category")
|
@TableName("t_category")
|
||||||
public class CategoryEntity {
|
public class CategoryEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.lab1024.sa.admin.module.business.category.domain.vo;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +16,9 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class CategoryTreeVO {
|
public class CategoryTreeVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "类目id")
|
@Schema(description = "类目id")
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface GoodsDao extends BaseMapper<GoodsEntity> {
|
public interface GoodsDao extends BaseMapper<GoodsEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
||||||
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
|
import net.lab1024.sa.base.common.json.deserializer.DictDataDeserializer;
|
||||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||||
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class GoodsAddForm {
|
|||||||
|
|
||||||
@Schema(description = "产地")
|
@Schema(description = "产地")
|
||||||
@NotBlank(message = "产地 不能为空 ")
|
@NotBlank(message = "产地 不能为空 ")
|
||||||
@JsonDeserialize(using = DictValueVoDeserializer.class)
|
@JsonDeserialize(using = DictDataDeserializer.class)
|
||||||
private String place;
|
private String place;
|
||||||
|
|
||||||
@Schema(description = "商品价格")
|
@Schema(description = "商品价格")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.lab1024.sa.admin.module.business.goods.domain.form;
|
package net.lab1024.sa.admin.module.business.goods.domain.form;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
||||||
import net.lab1024.sa.base.common.domain.PageParam;
|
import net.lab1024.sa.base.common.domain.PageParam;
|
||||||
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
|
import net.lab1024.sa.base.common.json.deserializer.DictDataDeserializer;
|
||||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||||
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
@@ -34,7 +34,7 @@ public class GoodsQueryForm extends PageParam {
|
|||||||
private Integer goodsStatus;
|
private Integer goodsStatus;
|
||||||
|
|
||||||
@Schema(description = "产地")
|
@Schema(description = "产地")
|
||||||
@JsonDeserialize(using = DictValueVoDeserializer.class)
|
@JsonDeserialize(using = DictDataDeserializer.class)
|
||||||
private String place;
|
private String place;
|
||||||
|
|
||||||
@Schema(description = "上架状态")
|
@Schema(description = "上架状态")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
package net.lab1024.sa.admin.module.business.goods.domain.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
|
||||||
import net.lab1024.sa.base.common.json.serializer.DictValueVoSerializer;
|
|
||||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -32,7 +30,6 @@ public class GoodsVO {
|
|||||||
private Integer goodsStatus;
|
private Integer goodsStatus;
|
||||||
|
|
||||||
@Schema(description = "产地")
|
@Schema(description = "产地")
|
||||||
@JsonSerialize(using = DictValueVoSerializer.class)
|
|
||||||
private String place;
|
private String place;
|
||||||
|
|
||||||
@Schema(description = "商品价格")
|
@Schema(description = "商品价格")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.lab1024.sa.admin.module.business.goods.service;
|
package net.lab1024.sa.admin.module.business.goods.service;
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import cn.idev.excel.FastExcel;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -26,7 +26,6 @@ import net.lab1024.sa.base.common.util.SmartEnumUtil;
|
|||||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||||
import net.lab1024.sa.base.module.support.datatracer.constant.DataTracerTypeEnum;
|
import net.lab1024.sa.base.module.support.datatracer.constant.DataTracerTypeEnum;
|
||||||
import net.lab1024.sa.base.module.support.datatracer.service.DataTracerService;
|
import net.lab1024.sa.base.module.support.datatracer.service.DataTracerService;
|
||||||
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
|
|
||||||
import net.lab1024.sa.base.module.support.dict.service.DictService;
|
import net.lab1024.sa.base.module.support.dict.service.DictService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -60,7 +59,7 @@ public class GoodsService {
|
|||||||
private DataTracerService dataTracerService;
|
private DataTracerService dataTracerService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DictCacheService dictCacheService;
|
private DictService dictService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加商品
|
* 添加商品
|
||||||
@@ -174,7 +173,7 @@ public class GoodsService {
|
|||||||
public ResponseDTO<String> importGoods(MultipartFile file) {
|
public ResponseDTO<String> importGoods(MultipartFile file) {
|
||||||
List<GoodsImportForm> dataList;
|
List<GoodsImportForm> dataList;
|
||||||
try {
|
try {
|
||||||
dataList = EasyExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
dataList = FastExcel.read(file.getInputStream()).head(GoodsImportForm.class)
|
||||||
.sheet()
|
.sheet()
|
||||||
.doReadSync();
|
.doReadSync();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -194,12 +193,13 @@ public class GoodsService {
|
|||||||
*/
|
*/
|
||||||
public List<GoodsExcelVO> getAllGoods() {
|
public List<GoodsExcelVO> getAllGoods() {
|
||||||
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
|
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
|
||||||
|
String dictCode = "GOODS_PLACE";
|
||||||
return goodsEntityList.stream()
|
return goodsEntityList.stream()
|
||||||
.map(e ->
|
.map(e ->
|
||||||
GoodsExcelVO.builder()
|
GoodsExcelVO.builder()
|
||||||
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
|
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
|
||||||
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
|
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
|
||||||
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(code)).collect(Collectors.joining(",")))
|
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictService.getDictDataLabel(dictCode, code)).collect(Collectors.joining(",")))
|
||||||
.price(e.getPrice())
|
.price(e.getPrice())
|
||||||
.goodsName(e.getGoodsName())
|
.goodsName(e.getGoodsName())
|
||||||
.remark(e.getRemark())
|
.remark(e.getRemark())
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.bank;
|
package net.lab1024.sa.admin.module.business.oa.bank.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.bank.service.BankService;
|
||||||
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankCreateForm;
|
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankCreateForm;
|
||||||
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankQueryForm;
|
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankQueryForm;
|
||||||
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankUpdateForm;
|
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankUpdateForm;
|
||||||
@@ -35,24 +37,28 @@ public class BankController {
|
|||||||
|
|
||||||
@Operation(summary = "分页查询银行信息 @author 善逸")
|
@Operation(summary = "分页查询银行信息 @author 善逸")
|
||||||
@PostMapping("/oa/bank/page/query")
|
@PostMapping("/oa/bank/page/query")
|
||||||
|
@SaCheckPermission("oa:bank:query")
|
||||||
public ResponseDTO<PageResult<BankVO>> queryByPage(@RequestBody @Valid BankQueryForm queryForm) {
|
public ResponseDTO<PageResult<BankVO>> queryByPage(@RequestBody @Valid BankQueryForm queryForm) {
|
||||||
return bankService.queryByPage(queryForm);
|
return bankService.queryByPage(queryForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "根据企业ID查询银行信息列表 @author 善逸")
|
@Operation(summary = "根据企业ID查询银行信息列表 @author 善逸")
|
||||||
@GetMapping("/oa/bank/query/list/{enterpriseId}")
|
@GetMapping("/oa/bank/query/list/{enterpriseId}")
|
||||||
|
@SaCheckPermission("oa:bank:query")
|
||||||
public ResponseDTO<List<BankVO>> queryList(@PathVariable Long enterpriseId) {
|
public ResponseDTO<List<BankVO>> queryList(@PathVariable Long enterpriseId) {
|
||||||
return bankService.queryList(enterpriseId);
|
return bankService.queryList(enterpriseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询银行信息详情 @author 善逸")
|
@Operation(summary = "查询银行信息详情 @author 善逸")
|
||||||
@GetMapping("/oa/bank/get/{bankId}")
|
@GetMapping("/oa/bank/get/{bankId}")
|
||||||
|
@SaCheckPermission("oa:bank:query")
|
||||||
public ResponseDTO<BankVO> getDetail(@PathVariable Long bankId) {
|
public ResponseDTO<BankVO> getDetail(@PathVariable Long bankId) {
|
||||||
return bankService.getDetail(bankId);
|
return bankService.getDetail(bankId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "新建银行信息 @author 善逸")
|
@Operation(summary = "新建银行信息 @author 善逸")
|
||||||
@PostMapping("/oa/bank/create")
|
@PostMapping("/oa/bank/create")
|
||||||
|
@SaCheckPermission("oa:bank:add")
|
||||||
public ResponseDTO<String> createBank(@RequestBody @Valid BankCreateForm createVO) {
|
public ResponseDTO<String> createBank(@RequestBody @Valid BankCreateForm createVO) {
|
||||||
RequestUser requestUser = SmartRequestUtil.getRequestUser();
|
RequestUser requestUser = SmartRequestUtil.getRequestUser();
|
||||||
createVO.setCreateUserId(requestUser.getUserId());
|
createVO.setCreateUserId(requestUser.getUserId());
|
||||||
@@ -62,12 +68,14 @@ public class BankController {
|
|||||||
|
|
||||||
@Operation(summary = "编辑银行信息 @author 善逸")
|
@Operation(summary = "编辑银行信息 @author 善逸")
|
||||||
@PostMapping("/oa/bank/update")
|
@PostMapping("/oa/bank/update")
|
||||||
|
@SaCheckPermission("oa:bank:update")
|
||||||
public ResponseDTO<String> updateBank(@RequestBody @Valid BankUpdateForm updateVO) {
|
public ResponseDTO<String> updateBank(@RequestBody @Valid BankUpdateForm updateVO) {
|
||||||
return bankService.updateBank(updateVO);
|
return bankService.updateBank(updateVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除银行信息 @author 善逸")
|
@Operation(summary = "删除银行信息 @author 善逸")
|
||||||
@GetMapping("/oa/bank/delete/{bankId}")
|
@GetMapping("/oa/bank/delete/{bankId}")
|
||||||
|
@SaCheckPermission("oa:bank:delete")
|
||||||
public ResponseDTO<String> deleteBank(@PathVariable Long bankId) {
|
public ResponseDTO<String> deleteBank(@PathVariable Long bankId) {
|
||||||
return bankService.deleteBank(bankId);
|
return bankService.deleteBank(bankId);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.bank;
|
package net.lab1024.sa.admin.module.business.oa.bank.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -7,7 +7,6 @@ import net.lab1024.sa.admin.module.business.oa.bank.domain.BankQueryForm;
|
|||||||
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankVO;
|
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface BankDao extends BaseMapper<BankEntity> {
|
public interface BankDao extends BaseMapper<BankEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.bank;
|
package net.lab1024.sa.admin.module.business.oa.bank.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.bank.dao.BankDao;
|
||||||
import net.lab1024.sa.admin.module.business.oa.bank.domain.*;
|
import net.lab1024.sa.admin.module.business.oa.bank.domain.*;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseDao;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseDao;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.entity.EnterpriseEntity;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.entity.EnterpriseEntity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.enterprise;
|
package net.lab1024.sa.admin.module.business.oa.enterprise.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.enterprise.service.EnterpriseService;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.form.*;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.form.*;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
|
||||||
@@ -100,6 +101,7 @@ public class EnterpriseController {
|
|||||||
|
|
||||||
@Operation(summary = "按照类型查询企业 @author 开云")
|
@Operation(summary = "按照类型查询企业 @author 开云")
|
||||||
@GetMapping("/oa/enterprise/query/list")
|
@GetMapping("/oa/enterprise/query/list")
|
||||||
|
@SaCheckPermission("oa:enterprise:query")
|
||||||
public ResponseDTO<List<EnterpriseListVO>> queryList(@RequestParam(value = "type", required = false) Integer type) {
|
public ResponseDTO<List<EnterpriseListVO>> queryList(@RequestParam(value = "type", required = false) Integer type) {
|
||||||
return enterpriseService.queryList(type);
|
return enterpriseService.queryList(type);
|
||||||
}
|
}
|
||||||
@@ -114,12 +116,14 @@ public class EnterpriseController {
|
|||||||
|
|
||||||
@Operation(summary = "查询企业全部员工 @author 罗伊")
|
@Operation(summary = "查询企业全部员工 @author 罗伊")
|
||||||
@PostMapping("/oa/enterprise/employee/list")
|
@PostMapping("/oa/enterprise/employee/list")
|
||||||
|
@SaCheckPermission("oa:enterprise:queryEmployee")
|
||||||
public ResponseDTO<List<EnterpriseEmployeeVO>> employeeList(@RequestBody @Valid List<Long> enterpriseIdList) {
|
public ResponseDTO<List<EnterpriseEmployeeVO>> employeeList(@RequestBody @Valid List<Long> enterpriseIdList) {
|
||||||
return ResponseDTO.ok(enterpriseService.employeeList(enterpriseIdList));
|
return ResponseDTO.ok(enterpriseService.employeeList(enterpriseIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分页查询企业员工 @author 卓大")
|
@Operation(summary = "分页查询企业员工 @author 卓大")
|
||||||
@PostMapping("/oa/enterprise/employee/queryPage")
|
@PostMapping("/oa/enterprise/employee/queryPage")
|
||||||
|
@SaCheckPermission("oa:enterprise:queryEmployee")
|
||||||
public ResponseDTO<PageResult<EnterpriseEmployeeVO>> queryPageEmployeeList(@RequestBody @Valid EnterpriseEmployeeQueryForm queryForm) {
|
public ResponseDTO<PageResult<EnterpriseEmployeeVO>> queryPageEmployeeList(@RequestBody @Valid EnterpriseEmployeeQueryForm queryForm) {
|
||||||
return ResponseDTO.ok(enterpriseService.queryPageEmployeeList(queryForm));
|
return ResponseDTO.ok(enterpriseService.queryPageEmployeeList(queryForm));
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface EnterpriseDao extends BaseMapper<EnterpriseEntity> {
|
public interface EnterpriseDao extends BaseMapper<EnterpriseEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface EnterpriseEmployeeDao extends BaseMapper<EnterpriseEmployeeEntity> {
|
public interface EnterpriseEmployeeDao extends BaseMapper<EnterpriseEmployeeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo;
|
package net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.enterprise;
|
package net.lab1024.sa.admin.module.business.oa.enterprise.manager;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseEmployeeDao;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseEmployeeDao;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.enterprise;
|
package net.lab1024.sa.admin.module.business.oa.enterprise.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -13,6 +13,7 @@ import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEm
|
|||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseListVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseListVO;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.enterprise.manager.EnterpriseEmployeeManager;
|
||||||
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
|
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
|
||||||
import net.lab1024.sa.base.common.code.UserErrorCode;
|
import net.lab1024.sa.base.common.code.UserErrorCode;
|
||||||
import net.lab1024.sa.base.common.domain.PageResult;
|
import net.lab1024.sa.base.common.domain.PageResult;
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.invoice;
|
package net.lab1024.sa.admin.module.business.oa.invoice.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.invoice.service.InvoiceService;
|
||||||
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceAddForm;
|
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceAddForm;
|
||||||
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceQueryForm;
|
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceQueryForm;
|
||||||
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceUpdateForm;
|
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceUpdateForm;
|
||||||
@@ -38,18 +40,21 @@ public class InvoiceController {
|
|||||||
|
|
||||||
@Operation(summary = "分页查询发票信息 @author 善逸")
|
@Operation(summary = "分页查询发票信息 @author 善逸")
|
||||||
@PostMapping("/oa/invoice/page/query")
|
@PostMapping("/oa/invoice/page/query")
|
||||||
|
@SaCheckPermission("oa:invoice:query")
|
||||||
public ResponseDTO<PageResult<InvoiceVO>> queryByPage(@RequestBody @Valid InvoiceQueryForm queryForm) {
|
public ResponseDTO<PageResult<InvoiceVO>> queryByPage(@RequestBody @Valid InvoiceQueryForm queryForm) {
|
||||||
return invoiceService.queryByPage(queryForm);
|
return invoiceService.queryByPage(queryForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询发票信息详情 @author 善逸")
|
@Operation(summary = "查询发票信息详情 @author 善逸")
|
||||||
@GetMapping("/oa/invoice/get/{invoiceId}")
|
@GetMapping("/oa/invoice/get/{invoiceId}")
|
||||||
|
@SaCheckPermission("oa:invoice:query")
|
||||||
public ResponseDTO<InvoiceVO> getDetail(@PathVariable Long invoiceId) {
|
public ResponseDTO<InvoiceVO> getDetail(@PathVariable Long invoiceId) {
|
||||||
return invoiceService.getDetail(invoiceId);
|
return invoiceService.getDetail(invoiceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "新建发票信息 @author 善逸")
|
@Operation(summary = "新建发票信息 @author 善逸")
|
||||||
@PostMapping("/oa/invoice/create")
|
@PostMapping("/oa/invoice/create")
|
||||||
|
@SaCheckPermission("oa:invoice:add")
|
||||||
public ResponseDTO<String> createInvoice(@RequestBody @Valid InvoiceAddForm createVO) {
|
public ResponseDTO<String> createInvoice(@RequestBody @Valid InvoiceAddForm createVO) {
|
||||||
RequestUser requestUser = SmartRequestUtil.getRequestUser();
|
RequestUser requestUser = SmartRequestUtil.getRequestUser();
|
||||||
createVO.setCreateUserId(requestUser.getUserId());
|
createVO.setCreateUserId(requestUser.getUserId());
|
||||||
@@ -57,21 +62,24 @@ public class InvoiceController {
|
|||||||
return invoiceService.createInvoice(createVO);
|
return invoiceService.createInvoice(createVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateLog
|
||||||
@Operation(summary = "编辑发票信息 @author 善逸")
|
@Operation(summary = "编辑发票信息 @author 善逸")
|
||||||
@PostMapping("/oa/invoice/update")
|
@PostMapping("/oa/invoice/update")
|
||||||
@OperateLog
|
@SaCheckPermission("oa:invoice:update")
|
||||||
public ResponseDTO<String> updateInvoice(@RequestBody @Valid InvoiceUpdateForm updateVO) {
|
public ResponseDTO<String> updateInvoice(@RequestBody @Valid InvoiceUpdateForm updateVO) {
|
||||||
return invoiceService.updateInvoice(updateVO);
|
return invoiceService.updateInvoice(updateVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除发票信息 @author 善逸")
|
@Operation(summary = "删除发票信息 @author 善逸")
|
||||||
@GetMapping("/invoice/delete/{invoiceId}")
|
@GetMapping("/invoice/delete/{invoiceId}")
|
||||||
|
@SaCheckPermission("oa:invoice:delete")
|
||||||
public ResponseDTO<String> deleteInvoice(@PathVariable Long invoiceId) {
|
public ResponseDTO<String> deleteInvoice(@PathVariable Long invoiceId) {
|
||||||
return invoiceService.deleteInvoice(invoiceId);
|
return invoiceService.deleteInvoice(invoiceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询列表 @author lidoudou")
|
@Operation(summary = "查询列表 @author lidoudou")
|
||||||
@GetMapping("/oa/invoice/query/list/{enterpriseId}")
|
@GetMapping("/oa/invoice/query/list/{enterpriseId}")
|
||||||
|
@SaCheckPermission("oa:invoice:query")
|
||||||
public ResponseDTO<List<InvoiceVO>> queryList(@PathVariable Long enterpriseId) {
|
public ResponseDTO<List<InvoiceVO>> queryList(@PathVariable Long enterpriseId) {
|
||||||
return invoiceService.queryList(enterpriseId);
|
return invoiceService.queryList(enterpriseId);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.invoice;
|
package net.lab1024.sa.admin.module.business.oa.invoice.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -7,7 +7,6 @@ import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceQueryForm;
|
|||||||
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceVO;
|
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface InvoiceDao extends BaseMapper<InvoiceEntity> {
|
public interface InvoiceDao extends BaseMapper<InvoiceEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package net.lab1024.sa.admin.module.business.oa.invoice;
|
package net.lab1024.sa.admin.module.business.oa.invoice.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.EnterpriseService;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.service.EnterpriseService;
|
||||||
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
|
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
|
||||||
|
import net.lab1024.sa.admin.module.business.oa.invoice.dao.InvoiceDao;
|
||||||
import net.lab1024.sa.admin.module.business.oa.invoice.domain.*;
|
import net.lab1024.sa.admin.module.business.oa.invoice.domain.*;
|
||||||
import net.lab1024.sa.base.common.domain.PageResult;
|
import net.lab1024.sa.base.common.domain.PageResult;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
@@ -27,7 +27,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface NoticeDao extends BaseMapper<NoticeEntity> {
|
public interface NoticeDao extends BaseMapper<NoticeEntity> {
|
||||||
|
|
||||||
// ================================= 数据范围相关 【子表】 =================================
|
// ================================= 数据范围相关 【子表】 =================================
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface NoticeTypeDao extends BaseMapper<NoticeTypeEntity> {
|
public interface NoticeTypeDao extends BaseMapper<NoticeTypeEntity> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class NoticeQueryForm extends PageParam {
|
|||||||
private String documentNumber;
|
private String documentNumber;
|
||||||
|
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private Long createUserId;
|
private String createUserName;
|
||||||
|
|
||||||
@Schema(description = "删除标识")
|
@Schema(description = "删除标识")
|
||||||
private Boolean deletedFlag;
|
private Boolean deletedFlag;
|
||||||
|
|||||||
@@ -208,6 +208,10 @@ public class NoticeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NoticeUpdateFormVO updateFormVO = SmartBeanUtil.copy(noticeEntity, NoticeUpdateFormVO.class);
|
NoticeUpdateFormVO updateFormVO = SmartBeanUtil.copy(noticeEntity, NoticeUpdateFormVO.class);
|
||||||
|
NoticeTypeVO noticeType = noticeTypeService.getByNoticeTypeId(noticeEntity.getNoticeTypeId());
|
||||||
|
updateFormVO.setNoticeTypeName(noticeType.getNoticeTypeName());
|
||||||
|
updateFormVO.setPublishFlag(updateFormVO.getPublishTime() != null && updateFormVO.getPublishTime().isBefore(LocalDateTime.now()));
|
||||||
|
|
||||||
if (!updateFormVO.getAllVisibleFlag()) {
|
if (!updateFormVO.getAllVisibleFlag()) {
|
||||||
List<NoticeVisibleRangeVO> noticeVisibleRangeList = noticeDao.queryVisibleRange(noticeId);
|
List<NoticeVisibleRangeVO> noticeVisibleRangeList = noticeDao.queryVisibleRange(noticeId);
|
||||||
List<Long> employeeIdList = noticeVisibleRangeList.stream().filter(e -> NoticeVisibleRangeDataTypeEnum.EMPLOYEE.getValue().equals(e.getDataType()))
|
List<Long> employeeIdList = noticeVisibleRangeList.stream().filter(e -> NoticeVisibleRangeDataTypeEnum.EMPLOYEE.getValue().equals(e.getDataType()))
|
||||||
@@ -226,7 +230,7 @@ public class NoticeService {
|
|||||||
noticeVisibleRange.setDataName(employeeEntity == null ? StringConst.EMPTY : employeeEntity.getActualName());
|
noticeVisibleRange.setDataName(employeeEntity == null ? StringConst.EMPTY : employeeEntity.getActualName());
|
||||||
} else {
|
} else {
|
||||||
DepartmentVO departmentVO = departmentService.getDepartmentById(noticeVisibleRange.getDataId());
|
DepartmentVO departmentVO = departmentService.getDepartmentById(noticeVisibleRange.getDataId());
|
||||||
noticeVisibleRange.setDataName(departmentVO == null ? StringConst.EMPTY : departmentVO.getName());
|
noticeVisibleRange.setDataName(departmentVO == null ? StringConst.EMPTY : departmentVO.getDepartmentName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateFormVO.setVisibleRangeList(noticeVisibleRangeList);
|
updateFormVO.setVisibleRangeList(noticeVisibleRangeList);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import net.lab1024.sa.base.common.enumeration.BaseEnum;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据范围 种类
|
* 数据可见范围类型
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室: 罗伊
|
* @Author 1024创新实验室: 罗伊
|
||||||
* @Date 2020/11/28 20:59:17
|
* @Date 2020/11/28 20:59:17
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class DataScopeSqlConfig {
|
|||||||
/**
|
/**
|
||||||
* join sql 具体实现类
|
* join sql 具体实现类
|
||||||
*/
|
*/
|
||||||
private Class joinSqlImplClazz;
|
private Class<?> joinSqlImplClazz;
|
||||||
|
|
||||||
private String joinSql;
|
private String joinSql;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据范围
|
* 数据可见范围
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室: 罗伊
|
* @Author 1024创新实验室: 罗伊
|
||||||
* @Date 2020/11/28 20:59:17
|
* @Date 2020/11/28 20:59:17
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ public class DataScopeSqlConfigService {
|
|||||||
|
|
||||||
private static final String DEPARTMENT_PARAM = "#departmentIds";
|
private static final String DEPARTMENT_PARAM = "#departmentIds";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于拼接查看本人数据范围的 SQL
|
||||||
|
*/
|
||||||
|
private static final String CREATE_USER_ID_EQUALS = "create_user_id = ";
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, DataScopeSqlConfig> dataScopeMethodMap = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, DataScopeSqlConfig> dataScopeMethodMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -84,7 +89,6 @@ public class DataScopeSqlConfigService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据调用的方法获取,此方法的配置信息
|
* 根据调用的方法获取,此方法的配置信息
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public DataScopeSqlConfig getSqlConfig(String method) {
|
public DataScopeSqlConfig getSqlConfig(String method) {
|
||||||
return this.dataScopeMethodMap.get(method);
|
return this.dataScopeMethodMap.get(method);
|
||||||
@@ -94,14 +98,23 @@ public class DataScopeSqlConfigService {
|
|||||||
* 组装需要拼接的sql
|
* 组装需要拼接的sql
|
||||||
*/
|
*/
|
||||||
public String getJoinSql(Map<String, Object> paramMap, DataScopeSqlConfig sqlConfigDTO) {
|
public String getJoinSql(Map<String, Object> paramMap, DataScopeSqlConfig sqlConfigDTO) {
|
||||||
DataScopeTypeEnum dataScopeTypeEnum = sqlConfigDTO.getDataScopeType();
|
|
||||||
String joinSql = sqlConfigDTO.getJoinSql();
|
|
||||||
Long employeeId = SmartRequestUtil.getRequestUserId();
|
Long employeeId = SmartRequestUtil.getRequestUserId();
|
||||||
if (employeeId == null) {
|
if (employeeId == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataScopeTypeEnum dataScopeTypeEnum = sqlConfigDTO.getDataScopeType();
|
||||||
|
DataScopeViewTypeEnum viewTypeEnum = dataScopeViewService.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
||||||
|
|
||||||
|
// 数据权限设置为仅本人可见时 直接返回 create_user_id = employeeId
|
||||||
|
if (DataScopeViewTypeEnum.ME == viewTypeEnum) {
|
||||||
|
return CREATE_USER_ID_EQUALS + employeeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
String joinSql = sqlConfigDTO.getJoinSql();
|
||||||
|
|
||||||
if (DataScopeWhereInTypeEnum.CUSTOM_STRATEGY == sqlConfigDTO.getDataScopeWhereInType()) {
|
if (DataScopeWhereInTypeEnum.CUSTOM_STRATEGY == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||||
Class strategyClass = sqlConfigDTO.getJoinSqlImplClazz();
|
Class<?> strategyClass = sqlConfigDTO.getJoinSqlImplClazz();
|
||||||
if (strategyClass == null) {
|
if (strategyClass == null) {
|
||||||
log.warn("data scope custom strategy class is null");
|
log.warn("data scope custom strategy class is null");
|
||||||
return "";
|
return "";
|
||||||
@@ -111,11 +124,10 @@ public class DataScopeSqlConfigService {
|
|||||||
log.warn("data scope custom strategy class:{} ,bean is null", sqlConfigDTO.getJoinSqlImplClazz());
|
log.warn("data scope custom strategy class:{} ,bean is null", sqlConfigDTO.getJoinSqlImplClazz());
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
DataScopeViewTypeEnum viewTypeEnum = dataScopeViewService.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
|
||||||
return powerStrategy.getCondition(viewTypeEnum, paramMap, sqlConfigDTO);
|
return powerStrategy.getCondition(viewTypeEnum, paramMap, sqlConfigDTO);
|
||||||
}
|
}
|
||||||
if (DataScopeWhereInTypeEnum.EMPLOYEE == sqlConfigDTO.getDataScopeWhereInType()) {
|
if (DataScopeWhereInTypeEnum.EMPLOYEE == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||||
List<Long> canViewEmployeeIds = dataScopeViewService.getCanViewEmployeeId(dataScopeTypeEnum, employeeId);
|
List<Long> canViewEmployeeIds = dataScopeViewService.getCanViewEmployeeId(viewTypeEnum, employeeId);
|
||||||
if (CollectionUtils.isEmpty(canViewEmployeeIds)) {
|
if (CollectionUtils.isEmpty(canViewEmployeeIds)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -124,7 +136,7 @@ public class DataScopeSqlConfigService {
|
|||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
if (DataScopeWhereInTypeEnum.DEPARTMENT == sqlConfigDTO.getDataScopeWhereInType()) {
|
if (DataScopeWhereInTypeEnum.DEPARTMENT == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||||
List<Long> canViewDepartmentIds = dataScopeViewService.getCanViewDepartmentId(dataScopeTypeEnum, employeeId);
|
List<Long> canViewDepartmentIds = dataScopeViewService.getCanViewDepartmentId(viewTypeEnum, employeeId);
|
||||||
if (CollectionUtils.isEmpty(canViewDepartmentIds)) {
|
if (CollectionUtils.isEmpty(canViewDepartmentIds)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,9 @@ public class DataScopeViewService {
|
|||||||
private DepartmentService departmentService;
|
private DepartmentService departmentService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某人可以查看的所有人员信息
|
* 获取某人可以查看的所有人员数据
|
||||||
*/
|
*/
|
||||||
public List<Long> getCanViewEmployeeId(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
public List<Long> getCanViewEmployeeId(DataScopeViewTypeEnum viewType, Long employeeId) {
|
||||||
DataScopeViewTypeEnum viewType = this.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
|
||||||
if (DataScopeViewTypeEnum.ME == viewType) {
|
if (DataScopeViewTypeEnum.ME == viewType) {
|
||||||
return this.getMeEmployeeIdList(employeeId);
|
return this.getMeEmployeeIdList(employeeId);
|
||||||
}
|
}
|
||||||
@@ -57,16 +56,17 @@ public class DataScopeViewService {
|
|||||||
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
||||||
return this.getDepartmentAndSubEmployeeIdList(employeeId);
|
return this.getDepartmentAndSubEmployeeIdList(employeeId);
|
||||||
}
|
}
|
||||||
|
// 可以查看所有员工数据
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某人可以查看的所有部门信息
|
* 获取某人可以查看的所有部门数据
|
||||||
*/
|
*/
|
||||||
public List<Long> getCanViewDepartmentId(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
public List<Long> getCanViewDepartmentId(DataScopeViewTypeEnum viewType, Long employeeId) {
|
||||||
DataScopeViewTypeEnum viewType = this.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
|
||||||
if (DataScopeViewTypeEnum.ME == viewType) {
|
if (DataScopeViewTypeEnum.ME == viewType) {
|
||||||
return this.getMeDepartmentIdList(employeeId);
|
// 数据可见范围类型为本人时 不可以查看任何部门数据
|
||||||
|
return Lists.newArrayList(0L);
|
||||||
}
|
}
|
||||||
if (DataScopeViewTypeEnum.DEPARTMENT == viewType) {
|
if (DataScopeViewTypeEnum.DEPARTMENT == viewType) {
|
||||||
return this.getMeDepartmentIdList(employeeId);
|
return this.getMeDepartmentIdList(employeeId);
|
||||||
@@ -74,6 +74,7 @@ public class DataScopeViewService {
|
|||||||
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
||||||
return this.getDepartmentAndSubIdList(employeeId);
|
return this.getDepartmentAndSubIdList(employeeId);
|
||||||
}
|
}
|
||||||
|
// 可以查看所有部门数据
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +92,16 @@ public class DataScopeViewService {
|
|||||||
* 根据员工id 获取各数据范围最大的可见范围 map<dataScopeType,viewType></>
|
* 根据员工id 获取各数据范围最大的可见范围 map<dataScopeType,viewType></>
|
||||||
*/
|
*/
|
||||||
public DataScopeViewTypeEnum getEmployeeDataScopeViewType(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
public DataScopeViewTypeEnum getEmployeeDataScopeViewType(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
||||||
if (employeeId == null) {
|
EmployeeEntity employeeEntity = employeeDao.selectById(employeeId);
|
||||||
|
if (employeeEntity == null || employeeEntity.getEmployeeId() == null) {
|
||||||
return DataScopeViewTypeEnum.ME;
|
return DataScopeViewTypeEnum.ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是超级管理员 则可查看全部
|
||||||
|
if (employeeEntity.getAdministratorFlag()) {
|
||||||
|
return DataScopeViewTypeEnum.ALL;
|
||||||
|
}
|
||||||
|
|
||||||
List<Long> roleIdList = roleEmployeeDao.selectRoleIdByEmployeeId(employeeId);
|
List<Long> roleIdList = roleEmployeeDao.selectRoleIdByEmployeeId(employeeId);
|
||||||
//未设置角色 默认本人
|
//未设置角色 默认本人
|
||||||
if (CollectionUtils.isEmpty(roleIdList)) {
|
if (CollectionUtils.isEmpty(roleIdList)) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import net.lab1024.sa.admin.module.system.department.domain.entity.DepartmentEnt
|
|||||||
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
|
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ import java.util.List;
|
|||||||
* @Email lab1024@163.com
|
* @Email lab1024@163.com
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
|
public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
|
||||||
|
|
||||||
@@ -33,4 +31,5 @@ public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
|
|||||||
*/
|
*/
|
||||||
List<DepartmentVO> listAll();
|
List<DepartmentVO> listAll();
|
||||||
|
|
||||||
|
DepartmentVO selectDepartmentVO(@Param("departmentId")Long departmentId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package net.lab1024.sa.admin.module.system.department.domain.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
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.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -29,11 +31,12 @@ public class DepartmentEntity {
|
|||||||
/**
|
/**
|
||||||
* 部门名称
|
* 部门名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String departmentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 负责人员工 id
|
* 负责人员工 id
|
||||||
*/
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||||
private Long managerId;
|
private Long managerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class DepartmentAddForm {
|
|||||||
@Schema(description = "部门名称")
|
@Schema(description = "部门名称")
|
||||||
@Length(min = 1, max = 50, message = "请输入正确的部门名称(1-50个字符)")
|
@Length(min = 1, max = 50, message = "请输入正确的部门名称(1-50个字符)")
|
||||||
@NotNull(message = "请输入正确的部门名称(1-50个字符)")
|
@NotNull(message = "请输入正确的部门名称(1-50个字符)")
|
||||||
private String name;
|
private String departmentName;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
@NotNull(message = "排序值")
|
@NotNull(message = "排序值")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.lab1024.sa.admin.module.system.department.domain.vo;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,13 +16,15 @@ import java.time.LocalDateTime;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DepartmentVO {
|
public class DepartmentVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "部门id")
|
@Schema(description = "部门id")
|
||||||
private Long departmentId;
|
private Long departmentId;
|
||||||
|
|
||||||
@Schema(description = "部门名称")
|
@Schema(description = "部门名称")
|
||||||
private String name;
|
private String departmentName;
|
||||||
|
|
||||||
@Schema(description = "部门负责人姓名")
|
@Schema(description = "部门负责人姓名")
|
||||||
private String managerName;
|
private String managerName;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class DepartmentCacheManager {
|
|||||||
log.info("clear " + cache);
|
log.info("clear " + cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CacheEvict(value = {AdminCacheConst.Department.DEPARTMENT_LIST_CACHE, AdminCacheConst.Department.DEPARTMENT_MAP_CACHE, AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE, AdminCacheConst.Department.DEPARTMENT_TREE_CACHE, AdminCacheConst.Department.DEPARTMENT_PATH_CACHE,}, allEntries = true)
|
@CacheEvict(value = {AdminCacheConst.Department.DEPARTMENT_LIST_CACHE, AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE, AdminCacheConst.Department.DEPARTMENT_TREE_CACHE, AdminCacheConst.Department.DEPARTMENT_PATH_CACHE,}, allEntries = true)
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
logClearInfo(AdminCacheConst.Department.DEPARTMENT_LIST_CACHE);
|
logClearInfo(AdminCacheConst.Department.DEPARTMENT_LIST_CACHE);
|
||||||
}
|
}
|
||||||
@@ -56,19 +56,8 @@ public class DepartmentCacheManager {
|
|||||||
return departmentDao.listAll();
|
return departmentDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门map
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Cacheable(AdminCacheConst.Department.DEPARTMENT_MAP_CACHE)
|
|
||||||
public Map<Long, DepartmentVO> getDepartmentMap() {
|
|
||||||
return departmentDao.listAll().stream().collect(Collectors.toMap(DepartmentVO::getDepartmentId, Function.identity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存部门树结构
|
* 缓存部门树结构
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Cacheable(AdminCacheConst.Department.DEPARTMENT_TREE_CACHE)
|
@Cacheable(AdminCacheConst.Department.DEPARTMENT_TREE_CACHE)
|
||||||
public List<DepartmentTreeVO> getDepartmentTree() {
|
public List<DepartmentTreeVO> getDepartmentTree() {
|
||||||
@@ -78,7 +67,6 @@ public class DepartmentCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存某个部门的下级id列表
|
* 缓存某个部门的下级id列表
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Cacheable(AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE)
|
@Cacheable(AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE)
|
||||||
public List<Long> getDepartmentSelfAndChildren(Long departmentId) {
|
public List<Long> getDepartmentSelfAndChildren(Long departmentId) {
|
||||||
@@ -89,7 +77,6 @@ public class DepartmentCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门的路径名称
|
* 部门的路径名称
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Cacheable(AdminCacheConst.Department.DEPARTMENT_PATH_CACHE)
|
@Cacheable(AdminCacheConst.Department.DEPARTMENT_PATH_CACHE)
|
||||||
public Map<Long, String> getDepartmentPathMap() {
|
public Map<Long, String> getDepartmentPathMap() {
|
||||||
@@ -110,22 +97,21 @@ public class DepartmentCacheManager {
|
|||||||
*/
|
*/
|
||||||
private String buildDepartmentPath(DepartmentVO departmentVO, Map<Long, DepartmentVO> departmentMap) {
|
private String buildDepartmentPath(DepartmentVO departmentVO, Map<Long, DepartmentVO> departmentMap) {
|
||||||
if (Objects.equals(departmentVO.getParentId(), NumberUtils.LONG_ZERO)) {
|
if (Objects.equals(departmentVO.getParentId(), NumberUtils.LONG_ZERO)) {
|
||||||
return departmentVO.getName();
|
return departmentVO.getDepartmentName();
|
||||||
}
|
}
|
||||||
//父节点
|
//父节点
|
||||||
DepartmentVO parentDepartment = departmentMap.get(departmentVO.getParentId());
|
DepartmentVO parentDepartment = departmentMap.get(departmentVO.getParentId());
|
||||||
if (parentDepartment == null) {
|
if (parentDepartment == null) {
|
||||||
return departmentVO.getName();
|
return departmentVO.getDepartmentName();
|
||||||
}
|
}
|
||||||
String pathName = buildDepartmentPath(parentDepartment, departmentMap);
|
String pathName = buildDepartmentPath(parentDepartment, departmentMap);
|
||||||
return pathName + "/" + departmentVO.getName();
|
return pathName + "/" + departmentVO.getDepartmentName();
|
||||||
|
|
||||||
}
|
}
|
||||||
// ---------------------- 构造树的一些方法 ------------------------------
|
// ---------------------- 构造树的一些方法 ------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建部门树结构
|
* 构建部门树结构
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public List<DepartmentTreeVO> buildTree(List<DepartmentVO> voList) {
|
public List<DepartmentTreeVO> buildTree(List<DepartmentVO> voList) {
|
||||||
if (CollectionUtils.isEmpty(voList)) {
|
if (CollectionUtils.isEmpty(voList)) {
|
||||||
@@ -192,7 +178,6 @@ public class DepartmentCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子元素
|
* 获取子元素
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private List<DepartmentTreeVO> getChildren(Long departmentId, List<DepartmentVO> voList) {
|
private List<DepartmentTreeVO> getChildren(Long departmentId, List<DepartmentVO> voList) {
|
||||||
List<DepartmentVO> childrenEntityList = voList.stream().filter(e -> departmentId.equals(e.getParentId())).collect(Collectors.toList());
|
List<DepartmentVO> childrenEntityList = voList.stream().filter(e -> departmentId.equals(e.getParentId())).collect(Collectors.toList());
|
||||||
@@ -205,7 +190,6 @@ public class DepartmentCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过部门id,获取当前以及下属部门
|
* 通过部门id,获取当前以及下属部门
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public List<Long> selfAndChildrenIdList(Long departmentId, List<DepartmentVO> voList) {
|
public List<Long> selfAndChildrenIdList(Long departmentId, List<DepartmentVO> voList) {
|
||||||
List<Long> selfAndChildrenIdList = Lists.newArrayList();
|
List<Long> selfAndChildrenIdList = Lists.newArrayList();
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import net.lab1024.sa.base.common.domain.ResponseDTO;
|
|||||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门 service
|
* 部门 service
|
||||||
@@ -44,7 +41,6 @@ public class DepartmentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增添加部门
|
* 新增添加部门
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ResponseDTO<String> addDepartment(DepartmentAddForm departmentAddForm) {
|
public ResponseDTO<String> addDepartment(DepartmentAddForm departmentAddForm) {
|
||||||
@@ -57,7 +53,6 @@ public class DepartmentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新部门信息
|
* 更新部门信息
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> updateDepartment(DepartmentUpdateForm updateDTO) {
|
public ResponseDTO<String> updateDepartment(DepartmentUpdateForm updateDTO) {
|
||||||
if (updateDTO.getParentId() == null) {
|
if (updateDTO.getParentId() == null) {
|
||||||
@@ -78,7 +73,6 @@ public class DepartmentService {
|
|||||||
* 根据id删除部门
|
* 根据id删除部门
|
||||||
* 1、需要判断当前部门是否有子部门,有子部门则不允许删除
|
* 1、需要判断当前部门是否有子部门,有子部门则不允许删除
|
||||||
* 2、需要判断当前部门是否有员工,有员工则不能删除
|
* 2、需要判断当前部门是否有员工,有员工则不能删除
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> deleteDepartment(Long departmentId) {
|
public ResponseDTO<String> deleteDepartment(Long departmentId) {
|
||||||
DepartmentEntity departmentEntity = departmentDao.selectById(departmentId);
|
DepartmentEntity departmentEntity = departmentDao.selectById(departmentId);
|
||||||
@@ -122,7 +116,6 @@ public class DepartmentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 自身以及所有下级的部门id列表
|
* 自身以及所有下级的部门id列表
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public List<Long> selfAndChildrenIdList(Long departmentId) {
|
public List<Long> selfAndChildrenIdList(Long departmentId) {
|
||||||
return departmentCacheManager.getDepartmentSelfAndChildren(departmentId);
|
return departmentCacheManager.getDepartmentSelfAndChildren(departmentId);
|
||||||
@@ -131,7 +124,6 @@ public class DepartmentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有部门
|
* 获取所有部门
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public List<DepartmentVO> listAll() {
|
public List<DepartmentVO> listAll() {
|
||||||
return departmentCacheManager.getDepartmentList();
|
return departmentCacheManager.getDepartmentList();
|
||||||
@@ -140,10 +132,9 @@ public class DepartmentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门
|
* 获取部门
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public DepartmentVO getDepartmentById(Long departmentId) {
|
public DepartmentVO getDepartmentById(Long departmentId) {
|
||||||
return departmentCacheManager.getDepartmentMap().get(departmentId);
|
return departmentDao.selectDepartmentVO(departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,38 +144,4 @@ public class DepartmentService {
|
|||||||
return departmentCacheManager.getDepartmentPathMap().get(departmentId);
|
return departmentCacheManager.getDepartmentPathMap().get(departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询全部父级部门(不包含自己)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public List<DepartmentVO> queryAllParentDepartment(Long departmentId) {
|
|
||||||
List<DepartmentVO> list = new ArrayList<>();
|
|
||||||
|
|
||||||
Map<Long, DepartmentVO> departmentMap = departmentCacheManager.getDepartmentMap();
|
|
||||||
DepartmentVO departmentVO = departmentMap.get(departmentId);
|
|
||||||
while (departmentVO != null) {
|
|
||||||
list.add(departmentVO);
|
|
||||||
departmentVO = departmentMap.get(departmentVO.getParentId());
|
|
||||||
}
|
|
||||||
Collections.reverse(list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询全部父级部门(不包含自己)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public List<Long> queryAllParentDepartmentIdList(Long departmentId) {
|
|
||||||
List<Long> list = new ArrayList<>();
|
|
||||||
|
|
||||||
Map<Long, DepartmentVO> departmentMap = departmentCacheManager.getDepartmentMap();
|
|
||||||
DepartmentVO departmentVO = departmentMap.get(departmentId);
|
|
||||||
while (departmentVO != null) {
|
|
||||||
list.add(departmentVO.getDepartmentId());
|
|
||||||
departmentVO = departmentMap.get(departmentVO.getParentId());
|
|
||||||
}
|
|
||||||
Collections.reverse(list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ public class EmployeeController {
|
|||||||
return employeeService.updateEmployee(employeeUpdateForm);
|
return employeeService.updateEmployee(employeeUpdateForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "更新登录人信息 @author 善逸")
|
@Operation(summary = "更新员工个人中心信息 @author 善逸")
|
||||||
@PostMapping("/employee/update/login")
|
@PostMapping("/employee/update/center")
|
||||||
public ResponseDTO<String> updateByLogin(@Valid @RequestBody EmployeeUpdateForm employeeUpdateForm) {
|
public ResponseDTO<String> updateCenter(@Valid @RequestBody EmployeeUpdateCenterForm updateCenterForm) {
|
||||||
employeeUpdateForm.setEmployeeId(SmartRequestUtil.getRequestUserId());
|
updateCenterForm.setEmployeeId(SmartRequestUtil.getRequestUserId());
|
||||||
return employeeService.updateEmployee(employeeUpdateForm);
|
return employeeService.updateCenter(updateCenterForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "更新登录人头像 @author 善逸")
|
@Operation(summary = "更新登录人头像 @author 善逸")
|
||||||
@@ -117,7 +117,7 @@ public class EmployeeController {
|
|||||||
@Operation(summary = "查询员工-根据部门id @author 卓大")
|
@Operation(summary = "查询员工-根据部门id @author 卓大")
|
||||||
@GetMapping("/employee/getAllEmployeeByDepartmentId/{departmentId}")
|
@GetMapping("/employee/getAllEmployeeByDepartmentId/{departmentId}")
|
||||||
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(@PathVariable Long departmentId) {
|
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(@PathVariable Long departmentId) {
|
||||||
return employeeService.getAllEmployeeByDepartmentId(departmentId, Boolean.FALSE);
|
return employeeService.getAllEmployeeByDepartmentId(departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询所有员工 @author 卓大")
|
@Operation(summary = "查询所有员工 @author 卓大")
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||||
/**
|
/**
|
||||||
* 查询员工列表
|
* 查询员工列表
|
||||||
@@ -34,31 +33,30 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
|||||||
*/
|
*/
|
||||||
List<EmployeeVO> selectEmployeeByDisabledAndDeleted(@Param("disabledFlag") Boolean disabledFlag, @Param("deletedFlag") Boolean deletedFlag);
|
List<EmployeeVO> selectEmployeeByDisabledAndDeleted(@Param("disabledFlag") Boolean disabledFlag, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新单个
|
* 更新单个
|
||||||
*/
|
*/
|
||||||
void updateDisableFlag(@Param("employeeId") Long employeeId, @Param("disabledFlag") Boolean disabledFlag);
|
void updateDisableFlag(@Param("employeeId") Long employeeId, @Param("disabledFlag") Boolean disabledFlag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过登录名查询
|
* 通过登录名查询
|
||||||
*/
|
*/
|
||||||
EmployeeEntity getByLoginName(@Param("loginName") String loginName,
|
EmployeeEntity getByLoginName(@Param("loginName") String loginName, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
@Param("disabledFlag") Boolean disabledFlag);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过姓名查询
|
* 通过姓名查询
|
||||||
*/
|
*/
|
||||||
EmployeeEntity getByActualName(@Param("actualName") String actualName,
|
EmployeeEntity getByActualName(@Param("actualName") String actualName, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
@Param("disabledFlag") Boolean disabledFlag
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过手机号查询
|
* 通过手机号查询
|
||||||
*/
|
*/
|
||||||
EmployeeEntity getByPhone(@Param("phone") String phone, @Param("disabledFlag") Boolean disabledFlag);
|
EmployeeEntity getByPhone(@Param("phone") String phone, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过邮箱账号查询
|
||||||
|
*/
|
||||||
|
EmployeeEntity getByEmail(@Param("email") String email, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有员工
|
* 获取所有员工
|
||||||
@@ -67,7 +65,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个部门员工数
|
* 获取某个部门员工数
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
Integer countByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
Integer countByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
@@ -76,39 +73,35 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
|||||||
*/
|
*/
|
||||||
List<EmployeeVO> getEmployeeByIds(@Param("employeeIds") Collection<Long> employeeIds);
|
List<EmployeeVO> getEmployeeByIds(@Param("employeeIds") Collection<Long> employeeIds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单个员工信息
|
* 查询单个员工信息
|
||||||
*/
|
*/
|
||||||
EmployeeVO getEmployeeById(@Param("employeeId") Long employeeId);
|
EmployeeVO getEmployeeById(@Param("employeeId") Long employeeId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个部门的员工
|
* 获取某个部门的员工
|
||||||
*/
|
*/
|
||||||
List<EmployeeEntity> selectByDepartmentId(@Param("departmentId") Long departmentId, @Param("disabledFlag") Boolean disabledFlag);
|
List<EmployeeEntity> selectByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询某些部门下用户名是xxx的员工
|
* 查询某些部门下用户名是xxx的员工
|
||||||
*/
|
*/
|
||||||
List<EmployeeEntity> selectByActualName(@Param("departmentIdList") List<Long> departmentIdList, @Param("actualName") String actualName, @Param("disabledFlag") Boolean disabledFlag);
|
List<EmployeeEntity> selectByActualName(@Param("departmentIdList") List<Long> departmentIdList, @Param("actualName") String actualName, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某批部门的员工Id
|
* 获取某批部门的员工Id
|
||||||
*/
|
*/
|
||||||
List<Long> getEmployeeIdByDepartmentIdList(@Param("departmentIds") List<Long> departmentIds, @Param("disabledFlag") Boolean disabledFlag);
|
List<Long> getEmployeeIdByDepartmentIdList(@Param("departmentIds") List<Long> departmentIds, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有
|
* 获取所有
|
||||||
*/
|
*/
|
||||||
List<Long> getEmployeeId(@Param("leaveFlag") Boolean leaveFlag, @Param("disabledFlag") Boolean disabledFlag);
|
List<Long> getEmployeeId(@Param("leaveFlag") Boolean leaveFlag, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个部门的员工Id
|
* 获取某个部门的员工Id
|
||||||
*/
|
*/
|
||||||
List<Long> getEmployeeIdByDepartmentId(@Param("departmentId") Long departmentId, @Param("disabledFlag") Boolean disabledFlag);
|
List<Long> getEmployeeIdByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工重置密码
|
* 员工重置密码
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ public class EmployeeEntity {
|
|||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一id
|
||||||
|
*/
|
||||||
|
private String employeeUid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录账号
|
* 登录账号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -51,17 +51,19 @@ public class EmployeeAddForm {
|
|||||||
@Pattern(regexp = SmartVerificationUtil.PHONE_REGEXP, message = "手机号格式不正确")
|
@Pattern(regexp = SmartVerificationUtil.PHONE_REGEXP, message = "手机号格式不正确")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@Schema(description = "邮箱")
|
@Schema(description = "邮箱账号")
|
||||||
|
@NotNull(message = "邮箱账号不能为空")
|
||||||
|
@Pattern(regexp = SmartVerificationUtil.EMAIL, message = "邮箱账号格式不正确")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "职务级别ID")
|
||||||
|
private Long positionId;
|
||||||
|
|
||||||
@Schema(description = "角色列表")
|
@Schema(description = "角色列表")
|
||||||
private List<Long> roleIdList;
|
private List<Long> roleIdList;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
@Length(max = 30, message = "备注最多200字符")
|
@Length(max = 200, message = "备注最多200字符")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "职务级别ID")
|
|
||||||
private Long positionId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package net.lab1024.sa.admin.module.system.employee.domain.form;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.lab1024.sa.base.common.enumeration.GenderEnum;
|
||||||
|
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||||
|
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
|
||||||
|
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新员工个人中心信息
|
||||||
|
*
|
||||||
|
* @Author 1024创新实验室: 开云
|
||||||
|
* @Date 2021-12-20 21:06:49
|
||||||
|
* @Wechat zhuoda1024
|
||||||
|
* @Email lab1024@163.com
|
||||||
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EmployeeUpdateCenterForm {
|
||||||
|
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long employeeId;
|
||||||
|
|
||||||
|
@Schema(description = "姓名")
|
||||||
|
@NotNull(message = "姓名不能为空")
|
||||||
|
@Length(max = 30, message = "姓名最多30字符")
|
||||||
|
private String actualName;
|
||||||
|
|
||||||
|
@SchemaEnum(GenderEnum.class)
|
||||||
|
@CheckEnum(value = GenderEnum.class, message = "性别错误")
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
@Schema(description = "手机号")
|
||||||
|
@NotNull(message = "手机号不能为空")
|
||||||
|
@Pattern(regexp = SmartVerificationUtil.PHONE_REGEXP, message = "手机号格式不正确")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "邮箱账号")
|
||||||
|
@NotNull(message = "邮箱账号不能为空")
|
||||||
|
@Pattern(regexp = SmartVerificationUtil.EMAIL, message = "邮箱账号格式不正确")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "职务级别ID")
|
||||||
|
private Long positionId;
|
||||||
|
|
||||||
|
@Schema(description = "头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
@Length(max = 200, message = "备注最多200字符")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -2,9 +2,7 @@ package net.lab1024.sa.admin.module.system.employee.domain.form;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Pattern;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码所需参数
|
* 修改密码所需参数
|
||||||
|
|||||||
@@ -138,16 +138,20 @@ public class EmployeeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmployeeEntity entity = SmartBeanUtil.copy(employeeAddForm, EmployeeEntity.class);
|
EmployeeEntity entity = SmartBeanUtil.copy(employeeAddForm, EmployeeEntity.class);
|
||||||
|
// 员工uid
|
||||||
|
String employeeUid = cn.hutool.core.lang.UUID.randomUUID(true).toString(true);
|
||||||
|
entity.setEmployeeUid(employeeUid);
|
||||||
|
|
||||||
// 设置密码 默认密码
|
// 设置密码 随机密码
|
||||||
String password = securityPasswordService.randomPassword();
|
String randomPassword = securityPasswordService.randomPassword();
|
||||||
entity.setLoginPwd(SecurityPasswordService.getEncryptPwd(password));
|
String generateSaltPassword = this.generateSaltPassword(randomPassword, employeeUid);
|
||||||
|
entity.setLoginPwd(SecurityPasswordService.getEncryptPwd(generateSaltPassword));
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
entity.setDeletedFlag(Boolean.FALSE);
|
entity.setDeletedFlag(Boolean.FALSE);
|
||||||
employeeManager.saveEmployee(entity, employeeAddForm.getRoleIdList());
|
employeeManager.saveEmployee(entity, employeeAddForm.getRoleIdList());
|
||||||
|
|
||||||
return ResponseDTO.ok(password);
|
return ResponseDTO.ok(randomPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,19 +172,14 @@ public class EmployeeService {
|
|||||||
return ResponseDTO.userErrorParam("部门不存在");
|
return ResponseDTO.userErrorParam("部门不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查唯一性
|
||||||
EmployeeEntity existEntity = employeeDao.getByLoginName(employeeUpdateForm.getLoginName(), null);
|
ResponseDTO<String> checkResponse = checkUniqueness(employeeId, employeeUpdateForm.getLoginName(), employeeUpdateForm.getPhone(), employeeUpdateForm.getEmail());
|
||||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
if (!checkResponse.getOk()) {
|
||||||
return ResponseDTO.userErrorParam("登录名重复");
|
return checkResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
existEntity = employeeDao.getByPhone(employeeUpdateForm.getPhone(), null);
|
|
||||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
|
||||||
return ResponseDTO.userErrorParam("手机号已存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 不更新密码
|
|
||||||
EmployeeEntity entity = SmartBeanUtil.copy(employeeUpdateForm, EmployeeEntity.class);
|
EmployeeEntity entity = SmartBeanUtil.copy(employeeUpdateForm, EmployeeEntity.class);
|
||||||
|
// 不更新密码
|
||||||
entity.setLoginPwd(null);
|
entity.setLoginPwd(null);
|
||||||
|
|
||||||
// 更新数据
|
// 更新数据
|
||||||
@@ -192,12 +191,60 @@ public class EmployeeService {
|
|||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新员工个人中心信息
|
||||||
|
*/
|
||||||
|
public ResponseDTO<String> updateCenter(EmployeeUpdateCenterForm updateCenterForm) {
|
||||||
|
|
||||||
|
Long employeeId = updateCenterForm.getEmployeeId();
|
||||||
|
EmployeeEntity employeeEntity = employeeDao.selectById(employeeId);
|
||||||
|
if (null == employeeEntity) {
|
||||||
|
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查唯一性 登录账号不能修改则不需要检查
|
||||||
|
ResponseDTO<String> checkResponse = checkUniqueness(employeeId, "", updateCenterForm.getPhone(), updateCenterForm.getEmail());
|
||||||
|
if (!checkResponse.getOk()) {
|
||||||
|
return checkResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
EmployeeEntity employee = SmartBeanUtil.copy(updateCenterForm, EmployeeEntity.class);
|
||||||
|
// 不更新密码
|
||||||
|
employee.setLoginPwd(null);
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
employeeDao.updateById(employee);
|
||||||
|
|
||||||
|
// 清除员工缓存
|
||||||
|
loginService.clearLoginEmployeeCache(employeeId);
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查唯一性
|
||||||
|
*/
|
||||||
|
private ResponseDTO<String> checkUniqueness(Long employeeId, String loginName, String phone, String email) {
|
||||||
|
EmployeeEntity existEntity = employeeDao.getByLoginName(loginName, null);
|
||||||
|
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||||
|
return ResponseDTO.userErrorParam("登录名重复");
|
||||||
|
}
|
||||||
|
|
||||||
|
existEntity = employeeDao.getByPhone(phone, null);
|
||||||
|
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||||
|
return ResponseDTO.userErrorParam("手机号已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
existEntity = employeeDao.getByEmail(email, null);
|
||||||
|
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||||
|
return ResponseDTO.userErrorParam("邮箱账号已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新登录人头像
|
* 更新登录人头像
|
||||||
*
|
|
||||||
* @param employeeUpdateAvatarForm
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> updateAvatar(EmployeeUpdateAvatarForm employeeUpdateAvatarForm) {
|
public ResponseDTO<String> updateAvatar(EmployeeUpdateAvatarForm employeeUpdateAvatarForm) {
|
||||||
Long employeeId = employeeUpdateAvatarForm.getEmployeeId();
|
Long employeeId = employeeUpdateAvatarForm.getEmployeeId();
|
||||||
@@ -297,38 +344,38 @@ public class EmployeeService {
|
|||||||
if (employeeEntity == null) {
|
if (employeeEntity == null) {
|
||||||
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验原始密码
|
// 校验原始密码
|
||||||
String oldPassword = SecurityPasswordService.getEncryptPwd(updatePasswordForm.getOldPassword());
|
if (!SecurityPasswordService.matchesPwd(this.generateSaltPassword(updatePasswordForm.getOldPassword(), employeeEntity.getEmployeeUid()), employeeEntity.getLoginPwd())) {
|
||||||
if (!Objects.equals(oldPassword, employeeEntity.getLoginPwd())) {
|
|
||||||
return ResponseDTO.userErrorParam("原密码有误,请重新输入");
|
return ResponseDTO.userErrorParam("原密码有误,请重新输入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新旧密码相同
|
||||||
|
if (Objects.equals(updatePasswordForm.getOldPassword(), updatePasswordForm.getNewPassword())) {
|
||||||
|
return ResponseDTO.userErrorParam("新密码与原始密码相同,请重新输入");
|
||||||
|
}
|
||||||
|
|
||||||
// 校验密码复杂度
|
// 校验密码复杂度
|
||||||
ResponseDTO<String> validatePassComplexity = securityPasswordService.validatePasswordComplexity(updatePasswordForm.getNewPassword());
|
ResponseDTO<String> validatePassComplexity = securityPasswordService.validatePasswordComplexity(updatePasswordForm.getNewPassword());
|
||||||
if (!validatePassComplexity.getOk()) {
|
if (!validatePassComplexity.getOk()) {
|
||||||
return validatePassComplexity;
|
return validatePassComplexity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新旧密码相同
|
|
||||||
String newPassword = SecurityPasswordService.getEncryptPwd(updatePasswordForm.getNewPassword());
|
|
||||||
if (Objects.equals(oldPassword, newPassword)) {
|
|
||||||
return ResponseDTO.userErrorParam("新密码与原始密码相同,请重新输入");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据三级等保规则,校验密码是否重复
|
// 根据三级等保规则,校验密码是否重复
|
||||||
ResponseDTO<String> passwordRepeatTimes = securityPasswordService.validatePasswordRepeatTimes(requestUser, updatePasswordForm.getNewPassword());
|
ResponseDTO<String> passwordRepeatTimes = securityPasswordService.validatePasswordRepeatTimes(requestUser, this.generateSaltPassword(updatePasswordForm.getNewPassword(), employeeEntity.getEmployeeUid()));
|
||||||
if (!passwordRepeatTimes.getOk()) {
|
if (!passwordRepeatTimes.getOk()) {
|
||||||
return ResponseDTO.error(passwordRepeatTimes);
|
return ResponseDTO.error(passwordRepeatTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新密码
|
// 更新密码
|
||||||
|
String newEncryptPassword = SecurityPasswordService.getEncryptPwd(this.generateSaltPassword(updatePasswordForm.getNewPassword(), employeeEntity.getEmployeeUid()));
|
||||||
EmployeeEntity updateEntity = new EmployeeEntity();
|
EmployeeEntity updateEntity = new EmployeeEntity();
|
||||||
updateEntity.setEmployeeId(employeeId);
|
updateEntity.setEmployeeId(employeeId);
|
||||||
updateEntity.setLoginPwd(newPassword);
|
updateEntity.setLoginPwd(newEncryptPassword);
|
||||||
employeeDao.updateById(updateEntity);
|
employeeDao.updateById(updateEntity);
|
||||||
|
|
||||||
// 保存修改密码密码记录
|
// 保存修改密码密码记录
|
||||||
securityPasswordService.saveUserChangePasswordLog(requestUser, newPassword, oldPassword);
|
securityPasswordService.saveUserChangePasswordLog(requestUser, newEncryptPassword, employeeEntity.getLoginPwd());
|
||||||
|
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
@@ -336,11 +383,8 @@ public class EmployeeService {
|
|||||||
/**
|
/**
|
||||||
* 获取某个部门的员工信息
|
* 获取某个部门的员工信息
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(Long departmentId, Boolean disabledFlag) {
|
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(Long departmentId) {
|
||||||
List<EmployeeEntity> employeeEntityList = employeeDao.selectByDepartmentId(departmentId, disabledFlag);
|
List<EmployeeEntity> employeeEntityList = employeeDao.selectByDepartmentId(departmentId, Boolean.FALSE);
|
||||||
if (disabledFlag != null) {
|
|
||||||
employeeEntityList = employeeEntityList.stream().filter(e -> e.getDisabledFlag().equals(disabledFlag)).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(employeeEntityList)) {
|
if (CollectionUtils.isEmpty(employeeEntityList)) {
|
||||||
return ResponseDTO.ok(Collections.emptyList());
|
return ResponseDTO.ok(Collections.emptyList());
|
||||||
@@ -351,7 +395,7 @@ public class EmployeeService {
|
|||||||
List<EmployeeVO> voList = employeeEntityList.stream().map(e -> {
|
List<EmployeeVO> voList = employeeEntityList.stream().map(e -> {
|
||||||
EmployeeVO employeeVO = SmartBeanUtil.copy(e, EmployeeVO.class);
|
EmployeeVO employeeVO = SmartBeanUtil.copy(e, EmployeeVO.class);
|
||||||
if (department != null) {
|
if (department != null) {
|
||||||
employeeVO.setDepartmentName(department.getName());
|
employeeVO.setDepartmentName(department.getDepartmentName());
|
||||||
}
|
}
|
||||||
return employeeVO;
|
return employeeVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@@ -363,8 +407,14 @@ public class EmployeeService {
|
|||||||
* 重置密码
|
* 重置密码
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> resetPassword(Long employeeId) {
|
public ResponseDTO<String> resetPassword(Long employeeId) {
|
||||||
|
EmployeeEntity employeeEntity = employeeDao.selectById(employeeId);
|
||||||
|
if (employeeEntity == null) {
|
||||||
|
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
String password = securityPasswordService.randomPassword();
|
String password = securityPasswordService.randomPassword();
|
||||||
employeeDao.updatePassword(employeeId, SecurityPasswordService.getEncryptPwd(password));
|
String saltPassword = this.generateSaltPassword(password, employeeEntity.getEmployeeUid());
|
||||||
|
employeeDao.updatePassword(employeeId, SecurityPasswordService.getEncryptPwd(saltPassword));
|
||||||
return ResponseDTO.ok(password);
|
return ResponseDTO.ok(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +431,17 @@ public class EmployeeService {
|
|||||||
* 根据登录名获取员工
|
* 根据登录名获取员工
|
||||||
*/
|
*/
|
||||||
public EmployeeEntity getByLoginName(String loginName) {
|
public EmployeeEntity getByLoginName(String loginName) {
|
||||||
return employeeDao.getByLoginName(loginName, null);
|
return employeeDao.getByLoginName(loginName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成加盐密码
|
||||||
|
* 格式为:[password]_[uid大写]_[uid小写]
|
||||||
|
*/
|
||||||
|
public String generateSaltPassword(String password, String employeeUid) {
|
||||||
|
return password + StringConst.UNDERLINE +
|
||||||
|
employeeUid.toUpperCase() +
|
||||||
|
StringConst.UNDERLINE +
|
||||||
|
employeeUid.toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ public class LoginController {
|
|||||||
return ResponseDTO.ok(loginResult);
|
return ResponseDTO.ok(loginResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "退出登陆 @author 卓大")
|
@Operation(summary = "退出登录 @author 卓大")
|
||||||
@GetMapping("/login/logout")
|
@GetMapping("/login/logout")
|
||||||
public ResponseDTO<String> logout(@RequestHeader(value = RequestHeaderConst.TOKEN, required = false) String token) {
|
public ResponseDTO<String> logout() {
|
||||||
return loginService.logout(token, SmartRequestUtil.getRequestUser());
|
return loginService.logout(SmartRequestUtil.getRequestUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取验证码 @author 卓大")
|
@Operation(summary = "获取验证码 @author 卓大")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import net.lab1024.sa.base.common.enumeration.GenderEnum;
|
|||||||
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
||||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求员工登录信息
|
* 请求员工登录信息
|
||||||
*
|
*
|
||||||
@@ -17,7 +19,7 @@ import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RequestEmployee implements RequestUser {
|
public class RequestEmployee implements RequestUser, Serializable {
|
||||||
|
|
||||||
@Schema(description = "员工id")
|
@Schema(description = "员工id")
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
@@ -46,6 +48,12 @@ public class RequestEmployee implements RequestUser {
|
|||||||
@Schema(description = "部门名称")
|
@Schema(description = "部门名称")
|
||||||
private String departmentName;
|
private String departmentName;
|
||||||
|
|
||||||
|
@Schema(description = "职务级别ID")
|
||||||
|
private Long positionId;
|
||||||
|
|
||||||
|
@Schema(description = "邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "是否禁用")
|
@Schema(description = "是否禁用")
|
||||||
private Boolean disabledFlag;
|
private Boolean disabledFlag;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package net.lab1024.sa.admin.module.system.login.manager;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.lab1024.sa.admin.constant.AdminCacheConst;
|
||||||
|
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
|
||||||
|
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
|
||||||
|
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity;
|
||||||
|
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService;
|
||||||
|
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
|
||||||
|
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
|
||||||
|
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
|
||||||
|
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
|
||||||
|
import net.lab1024.sa.admin.module.system.role.service.RoleMenuService;
|
||||||
|
import net.lab1024.sa.base.common.constant.StringConst;
|
||||||
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
|
import net.lab1024.sa.base.common.domain.UserPermission;
|
||||||
|
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
|
||||||
|
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||||
|
import net.lab1024.sa.base.module.support.file.service.IFileStorageService;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录Manager
|
||||||
|
*
|
||||||
|
* @Author 1024创新实验室: 卓大
|
||||||
|
* @Date 2025-05-03 22:56:34
|
||||||
|
* @Wechat zhuoda1024
|
||||||
|
* @Email lab1024@163.com
|
||||||
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class LoginManager {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DepartmentService departmentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IFileStorageService fileStorageService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EmployeeService employeeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RoleEmployeeService roleEmployeeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RoleMenuService roleMenuService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求用户信息
|
||||||
|
*/
|
||||||
|
@Cacheable(AdminCacheConst.Login.REQUEST_EMPLOYEE)
|
||||||
|
public RequestEmployee getRequestEmployee(Long requestEmployeeId ) {
|
||||||
|
if (requestEmployeeId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 员工基本信息
|
||||||
|
EmployeeEntity employeeEntity = employeeService.getById(requestEmployeeId);
|
||||||
|
if (employeeEntity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.loadLoginInfo(employeeEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录的用户信息
|
||||||
|
*/
|
||||||
|
@CachePut(value = AdminCacheConst.Login.REQUEST_EMPLOYEE, key = "#employeeEntity.employeeId")
|
||||||
|
public RequestEmployee loadLoginInfo(EmployeeEntity employeeEntity) {
|
||||||
|
// 基础信息
|
||||||
|
RequestEmployee requestEmployee = SmartBeanUtil.copy(employeeEntity, RequestEmployee.class);
|
||||||
|
requestEmployee.setUserType(UserTypeEnum.ADMIN_EMPLOYEE);
|
||||||
|
|
||||||
|
// 部门信息
|
||||||
|
DepartmentVO department = departmentService.getDepartmentById(employeeEntity.getDepartmentId());
|
||||||
|
requestEmployee.setDepartmentName(null == department ? StringConst.EMPTY : department.getDepartmentName());
|
||||||
|
|
||||||
|
// 头像信息
|
||||||
|
String avatar = employeeEntity.getAvatar();
|
||||||
|
if (StringUtils.isNotBlank(avatar)) {
|
||||||
|
ResponseDTO<String> getFileUrl = fileStorageService.getFileUrl(avatar);
|
||||||
|
if (BooleanUtils.isTrue(getFileUrl.getOk())) {
|
||||||
|
requestEmployee.setAvatar(getFileUrl.getData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return requestEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户的权限(包含 角色列表、权限列表)
|
||||||
|
*/
|
||||||
|
@Cacheable(AdminCacheConst.Login.USER_PERMISSION)
|
||||||
|
public UserPermission getUserPermission(Long employeeId) {
|
||||||
|
if(null == employeeId){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.loadUserPermission(employeeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户的权限(包含 角色列表、权限列表)
|
||||||
|
*/
|
||||||
|
@CachePut(AdminCacheConst.Login.USER_PERMISSION)
|
||||||
|
public UserPermission loadUserPermission(Long employeeId) {
|
||||||
|
UserPermission userPermission = new UserPermission();
|
||||||
|
userPermission.setPermissionList(new ArrayList<>());
|
||||||
|
userPermission.setRoleList(new ArrayList<>());
|
||||||
|
|
||||||
|
// 角色列表
|
||||||
|
List<RoleVO> roleList = roleEmployeeService.getRoleIdList(employeeId);
|
||||||
|
userPermission.getRoleList().addAll(roleList.stream().map(RoleVO::getRoleCode).collect(Collectors.toSet()));
|
||||||
|
|
||||||
|
// 前端菜单和功能点清单
|
||||||
|
EmployeeEntity employeeEntity = employeeService.getById(employeeId);
|
||||||
|
|
||||||
|
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), employeeEntity.getAdministratorFlag());
|
||||||
|
|
||||||
|
// 权限列表
|
||||||
|
HashSet<String> permissionSet = new HashSet<>();
|
||||||
|
for (MenuVO menu : menuAndPointsList) {
|
||||||
|
if (menu.getPermsType() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String perms = menu.getApiPerms();
|
||||||
|
if (StringUtils.isEmpty(perms)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//接口权限
|
||||||
|
String[] split = perms.split(",");
|
||||||
|
permissionSet.addAll(Arrays.asList(split));
|
||||||
|
}
|
||||||
|
userPermission.getPermissionList().addAll(permissionSet);
|
||||||
|
|
||||||
|
return userPermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除用户权限
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.USER_PERMISSION)
|
||||||
|
public void clearUserPermission(Long employeeId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除用户登录信息
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.REQUEST_EMPLOYEE)
|
||||||
|
public void clearUserLoginInfo(Long employeeId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,17 +6,15 @@ import cn.hutool.core.lang.UUID;
|
|||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
|
|
||||||
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
|
|
||||||
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity;
|
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity;
|
||||||
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService;
|
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService;
|
||||||
import net.lab1024.sa.admin.module.system.login.domain.LoginForm;
|
import net.lab1024.sa.admin.module.system.login.domain.LoginForm;
|
||||||
import net.lab1024.sa.admin.module.system.login.domain.LoginResultVO;
|
import net.lab1024.sa.admin.module.system.login.domain.LoginResultVO;
|
||||||
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
|
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
|
||||||
|
import net.lab1024.sa.admin.module.system.login.manager.LoginManager;
|
||||||
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
|
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
|
||||||
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
|
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
|
||||||
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
|
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
|
||||||
@@ -39,7 +37,6 @@ import net.lab1024.sa.base.module.support.captcha.CaptchaService;
|
|||||||
import net.lab1024.sa.base.module.support.captcha.domain.CaptchaVO;
|
import net.lab1024.sa.base.module.support.captcha.domain.CaptchaVO;
|
||||||
import net.lab1024.sa.base.module.support.config.ConfigKeyEnum;
|
import net.lab1024.sa.base.module.support.config.ConfigKeyEnum;
|
||||||
import net.lab1024.sa.base.module.support.config.ConfigService;
|
import net.lab1024.sa.base.module.support.config.ConfigService;
|
||||||
import net.lab1024.sa.base.module.support.file.service.IFileStorageService;
|
|
||||||
import net.lab1024.sa.base.module.support.loginlog.LoginLogResultEnum;
|
import net.lab1024.sa.base.module.support.loginlog.LoginLogResultEnum;
|
||||||
import net.lab1024.sa.base.module.support.loginlog.LoginLogService;
|
import net.lab1024.sa.base.module.support.loginlog.LoginLogService;
|
||||||
import net.lab1024.sa.base.module.support.loginlog.domain.LoginLogEntity;
|
import net.lab1024.sa.base.module.support.loginlog.domain.LoginLogEntity;
|
||||||
@@ -48,21 +45,22 @@ import net.lab1024.sa.base.module.support.mail.MailService;
|
|||||||
import net.lab1024.sa.base.module.support.mail.constant.MailTemplateCodeEnum;
|
import net.lab1024.sa.base.module.support.mail.constant.MailTemplateCodeEnum;
|
||||||
import net.lab1024.sa.base.module.support.redis.RedisService;
|
import net.lab1024.sa.base.module.support.redis.RedisService;
|
||||||
import net.lab1024.sa.base.module.support.securityprotect.domain.LoginFailEntity;
|
import net.lab1024.sa.base.module.support.securityprotect.domain.LoginFailEntity;
|
||||||
import net.lab1024.sa.base.module.support.securityprotect.service.*;
|
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import net.lab1024.sa.base.module.support.securityprotect.service.SecurityLoginService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import net.lab1024.sa.base.module.support.securityprotect.service.SecurityPasswordService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室: 开云
|
* @Author 1024创新实验室: 卓大
|
||||||
* @Date 2021-12-01 22:56:34
|
* @Date 2025-05-03 22:56:34
|
||||||
* @Wechat zhuoda1024
|
* @Wechat zhuoda1024
|
||||||
* @Email lab1024@163.com
|
* @Email lab1024@163.com
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
@@ -76,28 +74,9 @@ public class LoginService implements StpInterface {
|
|||||||
*/
|
*/
|
||||||
private static final String SUPER_PASSWORD_LOGIN_ID_PREFIX = "S";
|
private static final String SUPER_PASSWORD_LOGIN_ID_PREFIX = "S";
|
||||||
|
|
||||||
/**
|
|
||||||
* 最大在线缓存人数
|
|
||||||
*/
|
|
||||||
private static final long CACHE_MAX_ONLINE_PERSON_COUNT = 1000L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录信息二级缓存
|
|
||||||
*/
|
|
||||||
private final ConcurrentMap<Long, RequestEmployee> loginEmployeeCache = new ConcurrentLinkedHashMap.Builder<Long, RequestEmployee>().maximumWeightedCapacity(CACHE_MAX_ONLINE_PERSON_COUNT).build();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 权限 缓存
|
|
||||||
*/
|
|
||||||
private final ConcurrentMap<Long, UserPermission> permissionCache = new ConcurrentLinkedHashMap.Builder<Long, UserPermission>().maximumWeightedCapacity(CACHE_MAX_ONLINE_PERSON_COUNT).build();
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EmployeeService employeeService;
|
private EmployeeService employeeService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DepartmentService departmentService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CaptchaService captchaService;
|
private CaptchaService captchaService;
|
||||||
|
|
||||||
@@ -119,9 +98,6 @@ public class LoginService implements StpInterface {
|
|||||||
@Resource
|
@Resource
|
||||||
private SecurityPasswordService protectPasswordService;
|
private SecurityPasswordService protectPasswordService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IFileStorageService fileStorageService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApiEncryptService apiEncryptService;
|
private ApiEncryptService apiEncryptService;
|
||||||
|
|
||||||
@@ -134,6 +110,9 @@ public class LoginService implements StpInterface {
|
|||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LoginManager loginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证码
|
* 获取验证码
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +121,7 @@ public class LoginService implements StpInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工登陆
|
* 员工登录
|
||||||
*
|
*
|
||||||
* @return 返回用户登录信息
|
* @return 返回用户登录信息
|
||||||
*/
|
*/
|
||||||
@@ -162,12 +141,17 @@ public class LoginService implements StpInterface {
|
|||||||
// 验证登录名
|
// 验证登录名
|
||||||
EmployeeEntity employeeEntity = employeeService.getByLoginName(loginForm.getLoginName());
|
EmployeeEntity employeeEntity = employeeService.getByLoginName(loginForm.getLoginName());
|
||||||
if (null == employeeEntity) {
|
if (null == employeeEntity) {
|
||||||
return ResponseDTO.userErrorParam("登录名不存在!");
|
return ResponseDTO.userErrorParam("登录名或密码错误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证账号状态
|
// 验证账号状态
|
||||||
|
if (employeeEntity.getDeletedFlag()) {
|
||||||
|
saveLoginLog(employeeEntity, ip, userAgent, "账号已删除", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
|
||||||
|
return ResponseDTO.userErrorParam("您的账号已被删除,请联系工作人员!");
|
||||||
|
}
|
||||||
|
|
||||||
if (employeeEntity.getDisabledFlag()) {
|
if (employeeEntity.getDisabledFlag()) {
|
||||||
saveLoginLog(employeeEntity, ip, userAgent, "账号已禁用", LoginLogResultEnum.LOGIN_FAIL);
|
saveLoginLog(employeeEntity, ip, userAgent, "账号已禁用", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
|
||||||
return ResponseDTO.userErrorParam("您的账号已被禁用,请联系工作人员!");
|
return ResponseDTO.userErrorParam("您的账号已被禁用,请联系工作人员!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,9 +185,9 @@ public class LoginService implements StpInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 密码错误
|
// 密码错误
|
||||||
if (!employeeEntity.getLoginPwd().equals(SecurityPasswordService.getEncryptPwd(requestPassword))) {
|
if (!SecurityPasswordService.matchesPwd(employeeService.generateSaltPassword(requestPassword, employeeEntity.getEmployeeUid()), employeeEntity.getLoginPwd())) {
|
||||||
// 记录登录失败
|
// 记录登录失败
|
||||||
saveLoginLog(employeeEntity, ip, userAgent, "密码错误", LoginLogResultEnum.LOGIN_FAIL);
|
saveLoginLog(employeeEntity, ip, userAgent, "密码错误", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
|
||||||
// 记录等级保护次数
|
// 记录等级保护次数
|
||||||
String msg = securityLoginService.recordLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, employeeEntity.getLoginName(), loginFailEntityResponseDTO.getData());
|
String msg = securityLoginService.recordLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, employeeEntity.getLoginName(), loginFailEntityResponseDTO.getData());
|
||||||
return msg == null ? ResponseDTO.userErrorParam("登录名或密码错误!") : ResponseDTO.error(UserErrorCode.LOGIN_FAIL_WILL_LOCK, msg);
|
return msg == null ? ResponseDTO.userErrorParam("登录名或密码错误!") : ResponseDTO.error(UserErrorCode.LOGIN_FAIL_WILL_LOCK, msg);
|
||||||
@@ -219,10 +203,7 @@ public class LoginService implements StpInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取员工信息
|
// 获取员工信息
|
||||||
RequestEmployee requestEmployee = loadLoginInfo(employeeEntity);
|
RequestEmployee requestEmployee = loginManager.loadLoginInfo(employeeEntity);
|
||||||
|
|
||||||
// 放入缓存
|
|
||||||
loginEmployeeCache.put(employeeEntity.getEmployeeId(), requestEmployee);
|
|
||||||
|
|
||||||
// 移除登录失败
|
// 移除登录失败
|
||||||
securityLoginService.removeLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE);
|
securityLoginService.removeLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE);
|
||||||
@@ -232,13 +213,13 @@ public class LoginService implements StpInterface {
|
|||||||
LoginResultVO loginResultVO = getLoginResult(requestEmployee, token);
|
LoginResultVO loginResultVO = getLoginResult(requestEmployee, token);
|
||||||
|
|
||||||
//保存登录记录
|
//保存登录记录
|
||||||
saveLoginLog(employeeEntity, ip, userAgent, superPasswordFlag ? "万能密码登录" : loginDeviceEnum.getDesc(), LoginLogResultEnum.LOGIN_SUCCESS);
|
saveLoginLog(employeeEntity, ip, userAgent, superPasswordFlag ? "万能密码登录" : StringConst.EMPTY, LoginLogResultEnum.LOGIN_SUCCESS, loginDeviceEnum);
|
||||||
|
|
||||||
// 设置 token
|
// 设置 token
|
||||||
loginResultVO.setToken(token);
|
loginResultVO.setToken(token);
|
||||||
|
|
||||||
// 清除权限缓存
|
// 更新用户权限
|
||||||
permissionCache.remove(employeeEntity.getEmployeeId());
|
loginManager.loadUserPermission(employeeEntity.getEmployeeId());
|
||||||
|
|
||||||
return ResponseDTO.ok(loginResultVO);
|
return ResponseDTO.ok(loginResultVO);
|
||||||
}
|
}
|
||||||
@@ -257,10 +238,6 @@ public class LoginService implements StpInterface {
|
|||||||
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), requestEmployee.getAdministratorFlag());
|
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), requestEmployee.getAdministratorFlag());
|
||||||
loginResultVO.setMenuList(menuAndPointsList);
|
loginResultVO.setMenuList(menuAndPointsList);
|
||||||
|
|
||||||
// 更新下后端权限缓存
|
|
||||||
UserPermission userPermission = getUserPermission(requestEmployee.getUserId());
|
|
||||||
permissionCache.put(requestEmployee.getUserId(), userPermission);
|
|
||||||
|
|
||||||
// 上次登录信息
|
// 上次登录信息
|
||||||
LoginLogVO loginLogVO = loginLogService.queryLastByUserId(requestEmployee.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, LoginLogResultEnum.LOGIN_SUCCESS);
|
LoginLogVO loginLogVO = loginLogService.queryLastByUserId(requestEmployee.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, LoginLogResultEnum.LOGIN_SUCCESS);
|
||||||
if (loginLogVO != null) {
|
if (loginLogVO != null) {
|
||||||
@@ -285,33 +262,7 @@ public class LoginService implements StpInterface {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登录的用户信息
|
* 根据登录token 获取员请求工信息
|
||||||
*/
|
|
||||||
private RequestEmployee loadLoginInfo(EmployeeEntity employeeEntity) {
|
|
||||||
|
|
||||||
// 基础信息
|
|
||||||
RequestEmployee requestEmployee = SmartBeanUtil.copy(employeeEntity, RequestEmployee.class);
|
|
||||||
requestEmployee.setUserType(UserTypeEnum.ADMIN_EMPLOYEE);
|
|
||||||
|
|
||||||
// 部门信息
|
|
||||||
DepartmentVO department = departmentService.getDepartmentById(employeeEntity.getDepartmentId());
|
|
||||||
requestEmployee.setDepartmentName(null == department ? StringConst.EMPTY : department.getName());
|
|
||||||
|
|
||||||
// 头像信息
|
|
||||||
String avatar = employeeEntity.getAvatar();
|
|
||||||
if (StringUtils.isNotBlank(avatar)) {
|
|
||||||
ResponseDTO<String> getFileUrl = fileStorageService.getFileUrl(avatar);
|
|
||||||
if (BooleanUtils.isTrue(getFileUrl.getOk())) {
|
|
||||||
requestEmployee.setAvatar(getFileUrl.getData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return requestEmployee;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据登陆token 获取员请求工信息
|
|
||||||
*/
|
*/
|
||||||
public RequestEmployee getLoginEmployee(String loginId, HttpServletRequest request) {
|
public RequestEmployee getLoginEmployee(String loginId, HttpServletRequest request) {
|
||||||
if (loginId == null) {
|
if (loginId == null) {
|
||||||
@@ -323,17 +274,7 @@ public class LoginService implements StpInterface {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestEmployee requestEmployee = loginEmployeeCache.get(requestEmployeeId);
|
RequestEmployee requestEmployee = loginManager.getRequestEmployee(requestEmployeeId);
|
||||||
if (requestEmployee == null) {
|
|
||||||
// 员工基本信息
|
|
||||||
EmployeeEntity employeeEntity = employeeService.getById(requestEmployeeId);
|
|
||||||
if (employeeEntity == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestEmployee = this.loadLoginInfo(employeeEntity);
|
|
||||||
loginEmployeeCache.put(requestEmployeeId, requestEmployee);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新请求ip和user agent
|
// 更新请求ip和user agent
|
||||||
requestEmployee.setUserAgent(JakartaServletUtil.getHeaderIgnoreCase(request, RequestHeaderConst.USER_AGENT));
|
requestEmployee.setUserAgent(JakartaServletUtil.getHeaderIgnoreCase(request, RequestHeaderConst.USER_AGENT));
|
||||||
@@ -371,13 +312,13 @@ public class LoginService implements StpInterface {
|
|||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> logout(String token, RequestUser requestUser) {
|
public ResponseDTO<String> logout(RequestUser requestUser) {
|
||||||
|
|
||||||
// sa token 登出
|
// sa token 登出
|
||||||
StpUtil.logoutByTokenValue(token);
|
StpUtil.logout();
|
||||||
|
|
||||||
// 清空登录信息缓存
|
// 清除用户登录信息缓存和权限信息
|
||||||
loginEmployeeCache.remove(requestUser.getUserId());
|
this.clearLoginEmployeeCache(requestUser.getUserId());
|
||||||
|
|
||||||
//保存登出日志
|
//保存登出日志
|
||||||
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
||||||
@@ -395,18 +336,10 @@ public class LoginService implements StpInterface {
|
|||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除员工登录缓存
|
|
||||||
*/
|
|
||||||
public void clearLoginEmployeeCache(Long employeeId) {
|
|
||||||
// 清空登录信息缓存
|
|
||||||
loginEmployeeCache.remove(employeeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存登录日志
|
* 保存登录日志
|
||||||
*/
|
*/
|
||||||
private void saveLoginLog(EmployeeEntity employeeEntity, String ip, String userAgent, String remark, LoginLogResultEnum result) {
|
private void saveLoginLog(EmployeeEntity employeeEntity, String ip, String userAgent, String remark, LoginLogResultEnum result, LoginDeviceEnum loginDeviceEnum) {
|
||||||
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
||||||
.userId(employeeEntity.getEmployeeId())
|
.userId(employeeEntity.getEmployeeId())
|
||||||
.userType(UserTypeEnum.ADMIN_EMPLOYEE.getValue())
|
.userType(UserTypeEnum.ADMIN_EMPLOYEE.getValue())
|
||||||
@@ -415,6 +348,7 @@ public class LoginService implements StpInterface {
|
|||||||
.loginIp(ip)
|
.loginIp(ip)
|
||||||
.loginIpRegion(SmartIpUtil.getRegion(ip))
|
.loginIpRegion(SmartIpUtil.getRegion(ip))
|
||||||
.remark(remark)
|
.remark(remark)
|
||||||
|
.loginDevice(loginDeviceEnum.getDesc())
|
||||||
.loginResult(result.getValue())
|
.loginResult(result.getValue())
|
||||||
.createTime(LocalDateTime.now())
|
.createTime(LocalDateTime.now())
|
||||||
.build();
|
.build();
|
||||||
@@ -429,12 +363,7 @@ public class LoginService implements StpInterface {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserPermission userPermission = permissionCache.get(employeeId);
|
UserPermission userPermission = loginManager.getUserPermission(employeeId);
|
||||||
if (userPermission == null) {
|
|
||||||
userPermission = getUserPermission(employeeId);
|
|
||||||
permissionCache.put(employeeId, userPermission);
|
|
||||||
}
|
|
||||||
|
|
||||||
return userPermission.getPermissionList();
|
return userPermission.getPermissionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,51 +374,10 @@ public class LoginService implements StpInterface {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserPermission userPermission = permissionCache.get(employeeId);
|
UserPermission userPermission = loginManager.getUserPermission(employeeId);
|
||||||
if (userPermission == null) {
|
|
||||||
userPermission = getUserPermission(employeeId);
|
|
||||||
permissionCache.put(employeeId, userPermission);
|
|
||||||
}
|
|
||||||
return userPermission.getRoleList();
|
return userPermission.getRoleList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户的权限(包含 角色列表、权限列表)
|
|
||||||
*/
|
|
||||||
private UserPermission getUserPermission(Long employeeId) {
|
|
||||||
|
|
||||||
UserPermission userPermission = new UserPermission();
|
|
||||||
userPermission.setPermissionList(new ArrayList<>());
|
|
||||||
userPermission.setRoleList(new ArrayList<>());
|
|
||||||
|
|
||||||
// 角色列表
|
|
||||||
List<RoleVO> roleList = roleEmployeeService.getRoleIdList(employeeId);
|
|
||||||
userPermission.getRoleList().addAll(roleList.stream().map(RoleVO::getRoleCode).collect(Collectors.toSet()));
|
|
||||||
|
|
||||||
// 前端菜单和功能点清单
|
|
||||||
EmployeeEntity employeeEntity = employeeService.getById(employeeId);
|
|
||||||
|
|
||||||
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), employeeEntity.getAdministratorFlag());
|
|
||||||
|
|
||||||
// 权限列表
|
|
||||||
HashSet<String> permissionSet = new HashSet<>();
|
|
||||||
for (MenuVO menu : menuAndPointsList) {
|
|
||||||
if (menu.getPermsType() == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String perms = menu.getApiPerms();
|
|
||||||
if (StringUtils.isEmpty(perms)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//接口权限
|
|
||||||
String[] split = perms.split(",");
|
|
||||||
permissionSet.addAll(Arrays.asList(split));
|
|
||||||
}
|
|
||||||
userPermission.getPermissionList().addAll(permissionSet);
|
|
||||||
|
|
||||||
return userPermission;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送 邮箱 验证码
|
* 发送 邮箱 验证码
|
||||||
@@ -504,10 +392,14 @@ public class LoginService implements StpInterface {
|
|||||||
// 验证登录名
|
// 验证登录名
|
||||||
EmployeeEntity employeeEntity = employeeService.getByLoginName(loginName);
|
EmployeeEntity employeeEntity = employeeService.getByLoginName(loginName);
|
||||||
if (null == employeeEntity) {
|
if (null == employeeEntity) {
|
||||||
return ResponseDTO.userErrorParam("登录名不存在!");
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证账号状态
|
// 验证账号状态
|
||||||
|
if (employeeEntity.getDeletedFlag()) {
|
||||||
|
return ResponseDTO.userErrorParam("您的账号已被删除,请联系工作人员!");
|
||||||
|
}
|
||||||
|
|
||||||
if (employeeEntity.getDisabledFlag()) {
|
if (employeeEntity.getDisabledFlag()) {
|
||||||
return ResponseDTO.userErrorParam("您的账号已被禁用,请联系工作人员!");
|
return ResponseDTO.userErrorParam("您的账号已被禁用,请联系工作人员!");
|
||||||
}
|
}
|
||||||
@@ -580,4 +472,9 @@ public class LoginService implements StpInterface {
|
|||||||
String redisVerificationCodeKey = redisService.generateRedisKey(RedisKeyConst.Support.LOGIN_VERIFICATION_CODE, UserTypeEnum.ADMIN_EMPLOYEE.getValue() + RedisKeyConst.SEPARATOR + employeeId);
|
String redisVerificationCodeKey = redisService.generateRedisKey(RedisKeyConst.Support.LOGIN_VERIFICATION_CODE, UserTypeEnum.ADMIN_EMPLOYEE.getValue() + RedisKeyConst.SEPARATOR + employeeId);
|
||||||
redisService.delete(redisVerificationCodeKey);
|
redisService.delete(redisVerificationCodeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearLoginEmployeeCache(Long employeeId) {
|
||||||
|
loginManager.clearUserPermission(employeeId);
|
||||||
|
loginManager.clearUserLoginInfo(employeeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface MenuDao extends BaseMapper<MenuEntity> {
|
public interface MenuDao extends BaseMapper<MenuEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import net.lab1024.sa.base.common.code.SystemErrorCode;
|
|||||||
import net.lab1024.sa.base.common.domain.RequestUrlVO;
|
import net.lab1024.sa.base.common.domain.RequestUrlVO;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||||
|
import net.lab1024.sa.base.common.util.SmartStringUtil;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -134,6 +135,10 @@ public class MenuService {
|
|||||||
* @return true 重复 false 未重复
|
* @return true 重复 false 未重复
|
||||||
*/
|
*/
|
||||||
public <T extends MenuBaseForm> Boolean validateWebPerms(T menuDTO) {
|
public <T extends MenuBaseForm> Boolean validateWebPerms(T menuDTO) {
|
||||||
|
if(SmartStringUtil.isEmpty(menuDTO.getWebPerms())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MenuEntity menu = menuDao.getByWebPerms(menuDTO.getWebPerms(), Boolean.FALSE);
|
MenuEntity menu = menuDao.getByWebPerms(menuDTO.getWebPerms(), Boolean.FALSE);
|
||||||
if (menuDTO instanceof MenuAddForm) {
|
if (menuDTO instanceof MenuAddForm) {
|
||||||
return menu != null;
|
return menu != null;
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package net.lab1024.sa.admin.module.system.message;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
|
||||||
|
import net.lab1024.sa.base.common.domain.PageResult;
|
||||||
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
|
import net.lab1024.sa.base.common.domain.ValidateList;
|
||||||
|
import net.lab1024.sa.base.module.support.message.domain.MessageQueryForm;
|
||||||
|
import net.lab1024.sa.base.module.support.message.domain.MessageSendForm;
|
||||||
|
import net.lab1024.sa.base.module.support.message.domain.MessageVO;
|
||||||
|
import net.lab1024.sa.base.module.support.message.service.MessageService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后管 消息路由
|
||||||
|
*
|
||||||
|
* @author: 卓大
|
||||||
|
* @date: 2025/04/09 20:55
|
||||||
|
*/
|
||||||
|
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_MESSAGE)
|
||||||
|
@RestController
|
||||||
|
public class AdminMessageController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
@Operation(summary = "通知消息-新建 @author 卓大")
|
||||||
|
@PostMapping("/message/sendMessages")
|
||||||
|
@SaCheckPermission("system:message:send")
|
||||||
|
public ResponseDTO<String> sendMessages(@RequestBody @Valid ValidateList<MessageSendForm> messageList) {
|
||||||
|
messageService.sendMessage(messageList);
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "通知消息-分页查询 @author 卓大")
|
||||||
|
@PostMapping("/message/query")
|
||||||
|
@SaCheckPermission("system:message:query")
|
||||||
|
public ResponseDTO<PageResult<MessageVO>> query(@RequestBody @Valid MessageQueryForm queryForm) {
|
||||||
|
return ResponseDTO.ok(messageService.query(queryForm));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "通知消息-删除 @author 卓大")
|
||||||
|
@GetMapping("/message/delete/{messageId}")
|
||||||
|
@SaCheckPermission("system:message:delete")
|
||||||
|
public ResponseDTO<String> delete(@PathVariable Long messageId) {
|
||||||
|
return messageService.delete(messageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface PositionDao extends BaseMapper<PositionEntity> {
|
public interface PositionDao extends BaseMapper<PositionEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class PositionEntity {
|
|||||||
/**
|
/**
|
||||||
* 职级
|
* 职级
|
||||||
*/
|
*/
|
||||||
private String level;
|
private String positionLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class PositionAddForm {
|
|||||||
private String positionName;
|
private String positionName;
|
||||||
|
|
||||||
@Schema(description = "职级")
|
@Schema(description = "职级")
|
||||||
private String level;
|
private String positionLevel;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
@NotNull(message = "排序不能为空")
|
@NotNull(message = "排序不能为空")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class PositionVO {
|
|||||||
private String positionName;
|
private String positionName;
|
||||||
|
|
||||||
@Schema(description = "职级")
|
@Schema(description = "职级")
|
||||||
private String level;
|
private String positionLevel;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import net.lab1024.sa.admin.module.system.role.domain.entity.RoleEntity;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface RoleDao extends BaseMapper<RoleEntity> {
|
public interface RoleDao extends BaseMapper<RoleEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface RoleDataScopeDao extends BaseMapper<RoleDataScopeEntity> {
|
public interface RoleDataScopeDao extends BaseMapper<RoleDataScopeEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.util.Set;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface RoleEmployeeDao extends BaseMapper<RoleEmployeeEntity> {
|
public interface RoleEmployeeDao extends BaseMapper<RoleEmployeeEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import java.util.List;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
|
||||||
public interface RoleMenuDao extends BaseMapper<RoleMenuEntity> {
|
public interface RoleMenuDao extends BaseMapper<RoleMenuEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import jakarta.validation.constraints.NotEmpty;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ package net.lab1024.sa.admin.module.system.role.manager;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import net.lab1024.sa.admin.module.system.role.dao.RoleEmployeeDao;
|
import net.lab1024.sa.admin.module.system.role.dao.RoleEmployeeDao;
|
||||||
import net.lab1024.sa.admin.module.system.role.domain.entity.RoleEmployeeEntity;
|
import net.lab1024.sa.admin.module.system.role.domain.entity.RoleEmployeeEntity;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色员工 manager
|
* 角色员工 manager
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
|||||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -73,7 +72,7 @@ public class RoleEmployeeService {
|
|||||||
List<Long> departmentIdList = employeeList.stream().filter(e -> e != null && e.getDepartmentId() != null).map(EmployeeVO::getDepartmentId).collect(Collectors.toList());
|
List<Long> departmentIdList = employeeList.stream().filter(e -> e != null && e.getDepartmentId() != null).map(EmployeeVO::getDepartmentId).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(departmentIdList)) {
|
if (CollectionUtils.isNotEmpty(departmentIdList)) {
|
||||||
List<DepartmentEntity> departmentEntities = departmentDao.selectBatchIds(departmentIdList);
|
List<DepartmentEntity> departmentEntities = departmentDao.selectBatchIds(departmentIdList);
|
||||||
Map<Long, String> departmentIdNameMap = departmentEntities.stream().collect(Collectors.toMap(DepartmentEntity::getDepartmentId, DepartmentEntity::getName));
|
Map<Long, String> departmentIdNameMap = departmentEntities.stream().collect(Collectors.toMap(DepartmentEntity::getDepartmentId, DepartmentEntity::getDepartmentName));
|
||||||
employeeList.forEach(e -> {
|
employeeList.forEach(e -> {
|
||||||
e.setDepartmentName(departmentIdNameMap.getOrDefault(e.getDepartmentId(), StringConst.EMPTY));
|
e.setDepartmentName(departmentIdNameMap.getOrDefault(e.getDepartmentId(), StringConst.EMPTY));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,23 +8,21 @@ import jakarta.validation.Valid;
|
|||||||
import net.lab1024.sa.base.common.controller.SupportBaseController;
|
import net.lab1024.sa.base.common.controller.SupportBaseController;
|
||||||
import net.lab1024.sa.base.common.domain.PageResult;
|
import net.lab1024.sa.base.common.domain.PageResult;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
|
import net.lab1024.sa.base.common.domain.ValidateList;
|
||||||
import net.lab1024.sa.base.constant.SwaggerTagConst;
|
import net.lab1024.sa.base.constant.SwaggerTagConst;
|
||||||
import net.lab1024.sa.base.module.support.dict.domain.form.*;
|
import net.lab1024.sa.base.module.support.dict.domain.form.*;
|
||||||
import net.lab1024.sa.base.module.support.dict.domain.vo.DictKeyVO;
|
import net.lab1024.sa.base.module.support.dict.domain.vo.DictDataVO;
|
||||||
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
|
import net.lab1024.sa.base.module.support.dict.domain.vo.DictVO;
|
||||||
import net.lab1024.sa.base.module.support.dict.service.DictService;
|
import net.lab1024.sa.base.module.support.dict.service.DictService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典
|
* 数据字典 Controller
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室: 罗伊
|
* @Author 1024创新实验室-主任-卓大
|
||||||
* @Date 2022/5/26 19:40:55
|
* @Date 2025-03-25 22:25:04
|
||||||
* @Wechat zhuoda1024
|
* @Wechat zhuoda1024
|
||||||
* @Email lab1024@163.com
|
* @Email lab1024@163.com
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
@@ -36,60 +34,106 @@ public class AdminDictController extends SupportBaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DictService dictService;
|
private DictService dictService;
|
||||||
|
|
||||||
@Resource
|
// ------------------- 获取全部数据 -------------------
|
||||||
private DictCacheService dictCacheService;
|
|
||||||
|
|
||||||
@Operation(summary = "分页查询数据字典KEY - @author 罗伊")
|
@Operation(summary = "获取全部数据(供前端缓存使用) @author 1024创新实验室-主任-卓大")
|
||||||
@PostMapping("/dict/key/query")
|
@GetMapping("/dict/getAllDictData")
|
||||||
public ResponseDTO<PageResult<DictKeyVO>> keyQuery(@Valid @RequestBody DictKeyQueryForm queryForm) {
|
public ResponseDTO<List<DictDataVO>> getAll() {
|
||||||
return dictService.keyQuery(queryForm);
|
return ResponseDTO.ok(dictService.getAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取所有字典code @author 1024创新实验室-主任-卓大")
|
||||||
|
@GetMapping("/dict/getAllDict")
|
||||||
|
public ResponseDTO<List<DictVO>> getAllDict() {
|
||||||
|
return ResponseDTO.ok(dictService.getAllDict());
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "数据字典KEY-添加- @author 罗伊")
|
// ------------------- 字典 -------------------
|
||||||
@PostMapping("/dict/key/add")
|
|
||||||
|
@Operation(summary = "分页查询 @author 1024创新实验室-主任-卓大")
|
||||||
|
@PostMapping("/dict/queryPage")
|
||||||
|
@SaCheckPermission("support:dict:query")
|
||||||
|
public ResponseDTO<PageResult<DictVO>> queryPage(@RequestBody @Valid DictQueryForm queryForm) {
|
||||||
|
return ResponseDTO.ok(dictService.queryPage(queryForm));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "添加 @author 1024创新实验室-主任-卓大")
|
||||||
|
@PostMapping("/dict/add")
|
||||||
@SaCheckPermission("support:dict:add")
|
@SaCheckPermission("support:dict:add")
|
||||||
public ResponseDTO<String> keyAdd(@Valid @RequestBody DictKeyAddForm keyAddForm) {
|
public ResponseDTO<String> add(@RequestBody @Valid DictAddForm addForm) {
|
||||||
return dictService.keyAdd(keyAddForm);
|
return dictService.add(addForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "数据字典缓存-刷新- @author 罗伊")
|
@Operation(summary = "更新 @author 1024创新实验室-主任-卓大")
|
||||||
@GetMapping("/dict/cache/refresh")
|
@PostMapping("/dict/update")
|
||||||
@SaCheckPermission("support:dict:refresh")
|
@SaCheckPermission("support:dict:update")
|
||||||
public ResponseDTO<String> cacheRefresh() {
|
public ResponseDTO<String> update(@RequestBody @Valid DictUpdateForm updateForm) {
|
||||||
return dictCacheService.cacheRefresh();
|
return dictService.update(updateForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "数据字典Value-添加- @author 罗伊")
|
@Operation(summary = "启用/禁用 @author 1024创新实验室-主任-卓大")
|
||||||
@PostMapping("/dict/value/add")
|
@GetMapping("/dict/updateDisabled/{dictId}")
|
||||||
public ResponseDTO<String> valueAdd(@Valid @RequestBody DictValueAddForm valueAddForm) {
|
@SaCheckPermission("support:dict:updateDisabled")
|
||||||
return dictService.valueAdd(valueAddForm);
|
public ResponseDTO<String> updateDisabled(@PathVariable Long dictId) {
|
||||||
|
return dictService.updateDisabled(dictId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "数据字典KEY-更新- @author 罗伊")
|
@Operation(summary = "批量删除 @author 1024创新实验室-主任-卓大")
|
||||||
@PostMapping("/dict/key/edit")
|
@PostMapping("/dict/batchDelete")
|
||||||
@SaCheckPermission("support:dict:edit")
|
|
||||||
public ResponseDTO<String> keyEdit(@Valid @RequestBody DictKeyUpdateForm keyUpdateForm) {
|
|
||||||
return dictService.keyEdit(keyUpdateForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "数据字典Value-更新- @author 罗伊")
|
|
||||||
@PostMapping("/dict/value/edit")
|
|
||||||
public ResponseDTO<String> valueEdit(@Valid @RequestBody DictValueUpdateForm valueUpdateForm) {
|
|
||||||
return dictService.valueEdit(valueUpdateForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "数据字典KEY-删除- @author 罗伊")
|
|
||||||
@PostMapping("/dict/key/delete")
|
|
||||||
@SaCheckPermission("support:dict:delete")
|
@SaCheckPermission("support:dict:delete")
|
||||||
public ResponseDTO<String> keyDelete(@RequestBody List<Long> keyIdList) {
|
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
|
||||||
return dictService.keyDelete(keyIdList);
|
return dictService.batchDelete(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "数据字典Value-删除- @author 罗伊")
|
@Operation(summary = "单个删除 @author 1024创新实验室-主任-卓大")
|
||||||
@PostMapping("/dict/value/delete")
|
@GetMapping("/dict/delete/{dictId}")
|
||||||
public ResponseDTO<String> valueDelete(@RequestBody List<Long> valueIdList) {
|
@SaCheckPermission("support:dict:delete")
|
||||||
return dictService.valueDelete(valueIdList);
|
public ResponseDTO<String> delete(@PathVariable Long dictId) {
|
||||||
|
return dictService.delete(dictId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------- 字典数据 -------------------
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 分页查询 @author 1024创新实验室-主任-卓大")
|
||||||
|
@GetMapping("/dict/dictData/queryDictData/{dictId}")
|
||||||
|
@SaCheckPermission("support:dictData:query")
|
||||||
|
public ResponseDTO<List<DictDataVO>> queryDictData(@PathVariable Long dictId) {
|
||||||
|
return ResponseDTO.ok(dictService.queryDictData(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 启用/禁用 @author 1024创新实验室-主任-卓大")
|
||||||
|
@GetMapping("/dict/dictData/updateDisabled/{dictDataId}")
|
||||||
|
@SaCheckPermission("support:dictData:updateDisabled")
|
||||||
|
public ResponseDTO<String> updateDictDataDisabled(@PathVariable Long dictDataId) {
|
||||||
|
return dictService.updateDictDataDisabled(dictDataId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 添加 @author 1024创新实验室-主任-卓大")
|
||||||
|
@PostMapping("/dict/dictData/add")
|
||||||
|
@SaCheckPermission("support:dictData:add")
|
||||||
|
public ResponseDTO<String> addDictData(@RequestBody @Valid DictDataAddForm addForm) {
|
||||||
|
return dictService.addDictData(addForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 更新 @author 1024创新实验室-主任-卓大")
|
||||||
|
@PostMapping("/dict/dictData/update")
|
||||||
|
@SaCheckPermission("support:dictData:update")
|
||||||
|
public ResponseDTO<String> updateDictData(@RequestBody @Valid DictDataUpdateForm updateForm) {
|
||||||
|
return dictService.updateDictData(updateForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 批量删除 @author 1024创新实验室-主任-卓大")
|
||||||
|
@PostMapping("/dict/dictData/batchDelete")
|
||||||
|
@SaCheckPermission("support:dictData:delete")
|
||||||
|
public ResponseDTO<String> batchDeleteDictData(@RequestBody ValidateList<Long> idList) {
|
||||||
|
return dictService.batchDeleteDictData(idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典数据 单个删除 @author 1024创新实验室-主任-卓大")
|
||||||
|
@GetMapping("/dict/dictData/delete/{dictDataId}")
|
||||||
|
@SaCheckPermission("support:dictData:delete")
|
||||||
|
public ResponseDTO<String> deleteDictData(@PathVariable Long dictDataId) {
|
||||||
|
return dictService.deleteDictData(dictDataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* 网络安全
|
* 网络安全
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室-主任:卓大
|
* @Author 1024创新实验室-主任:卓大
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ public class AdminSmartJobController extends SupportBaseController {
|
|||||||
return jobService.queryJob(queryForm);
|
return jobService.queryJob(queryForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "定时任务-添加任务 @huke")
|
||||||
|
@PostMapping("/job/add")
|
||||||
|
@RepeatSubmit
|
||||||
|
public ResponseDTO<String> addJob(@RequestBody @Valid SmartJobAddForm addForm) {
|
||||||
|
RequestUser requestUser = SmartRequestUtil.getRequestUser();
|
||||||
|
addForm.setUpdateName(requestUser.getUserName());
|
||||||
|
return jobService.addJob(addForm);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "定时任务-更新-任务信息 @huke")
|
@Operation(summary = "定时任务-更新-任务信息 @huke")
|
||||||
@PostMapping("/job/update")
|
@PostMapping("/job/update")
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@@ -70,6 +79,13 @@ public class AdminSmartJobController extends SupportBaseController {
|
|||||||
return jobService.updateJobEnabled(updateForm);
|
return jobService.updateJobEnabled(updateForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "定时任务-删除 @zhuoda")
|
||||||
|
@GetMapping("/job/delete")
|
||||||
|
@RepeatSubmit
|
||||||
|
public ResponseDTO<String> deleteJob(@RequestParam Integer jobId) {
|
||||||
|
return jobService.deleteJob(jobId, SmartRequestUtil.getRequestUser());
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "定时任务-执行记录-分页查询 @huke")
|
@Operation(summary = "定时任务-执行记录-分页查询 @huke")
|
||||||
@PostMapping("/job/log/query")
|
@PostMapping("/job/log/query")
|
||||||
public ResponseDTO<PageResult<SmartJobLogVO>> queryJobLog(@RequestBody @Valid SmartJobLogQueryForm queryForm) {
|
public ResponseDTO<PageResult<SmartJobLogVO>> queryJobLog(@RequestBody @Valid SmartJobLogQueryForm queryForm) {
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
-->
|
-->
|
||||||
<Configuration status="INFO" monitorInterval="30">
|
<Configuration status="INFO" monitorInterval="30">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-directory" value="${sys:project.log-directory}"/>
|
<Property name="log-directory" value="${spring:project.log-directory}"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<Console name="Console" target="SYSTEM_OUT">
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%blue{%d}][%highlight{%-5p}][%t][%cyan{%c{1.}:%L}] %m %n"
|
||||||
|
disableAnsi="false" noConsoleNoAnsi="false"/>
|
||||||
</Console>
|
</Console>
|
||||||
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
||||||
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -54,7 +55,7 @@
|
|||||||
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||||
@@ -86,7 +87,7 @@
|
|||||||
</RollingFile>
|
</RollingFile>
|
||||||
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
||||||
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -101,11 +102,9 @@
|
|||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
<Loggers>
|
<Loggers>
|
||||||
|
|
||||||
<logger name="com.alibaba.druid.filter.stat.StatFilter" level="ERROR" additivity="false">
|
<logger name="com.alibaba.druid.filter.stat.StatFilter" level="ERROR" additivity="false">
|
||||||
<AppenderRef ref="druidSlowSqlLog"/>
|
<AppenderRef ref="druidSlowSqlLog"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<Root level="debug">
|
<Root level="debug">
|
||||||
<AppenderRef ref="Console"/>
|
<AppenderRef ref="Console"/>
|
||||||
<AppenderRef ref="debug"/>
|
<AppenderRef ref="debug"/>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="net.lab1024.sa.admin.module.business.oa.bank.BankDao">
|
<mapper namespace="net.lab1024.sa.admin.module.business.oa.bank.dao.BankDao">
|
||||||
<update id="deleteBank">
|
<update id="deleteBank">
|
||||||
UPDATE t_oa_bank
|
UPDATE t_oa_bank
|
||||||
SET deleted_flag = #{deletedFlag}
|
SET deleted_flag = #{deletedFlag}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<select id="queryPageEmployeeList"
|
<select id="queryPageEmployeeList"
|
||||||
resultType="net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO">
|
resultType="net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO">
|
||||||
select
|
select
|
||||||
t_oa_enterprise_employee.*,
|
t_oa_enterprise_employee.enterprise_id,
|
||||||
t_oa_enterprise.enterprise_name,
|
t_oa_enterprise.enterprise_name,
|
||||||
t_employee.*,
|
t_employee.*,
|
||||||
t_employee.actual_name as employeeName
|
t_employee.actual_name as employeeName
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="net.lab1024.sa.admin.module.business.oa.invoice.InvoiceDao">
|
<mapper namespace="net.lab1024.sa.admin.module.business.oa.invoice.dao.InvoiceDao">
|
||||||
<update id="deleteInvoice">
|
<update id="deleteInvoice">
|
||||||
UPDATE t_oa_invoice
|
UPDATE t_oa_invoice
|
||||||
SET deleted_flag = #{deletedFlag}
|
SET deleted_flag = #{deletedFlag}
|
||||||
|
|||||||
@@ -2,6 +2,28 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="net.lab1024.sa.admin.module.business.oa.notice.dao.NoticeDao">
|
<mapper namespace="net.lab1024.sa.admin.module.business.oa.notice.dao.NoticeDao">
|
||||||
|
|
||||||
|
<!-- 查询结果列 -->
|
||||||
|
<sql id="base_columns">
|
||||||
|
t_notice.notice_id,
|
||||||
|
t_notice.notice_type_id,
|
||||||
|
t_notice.title,
|
||||||
|
t_notice.all_visible_flag,
|
||||||
|
t_notice.scheduled_publish_flag,
|
||||||
|
t_notice.publish_time,
|
||||||
|
t_notice.content_text,
|
||||||
|
t_notice.content_html,
|
||||||
|
t_notice.attachment,
|
||||||
|
t_notice.page_view_count,
|
||||||
|
t_notice.user_view_count,
|
||||||
|
t_notice.source,
|
||||||
|
t_notice.author,
|
||||||
|
t_notice.document_number,
|
||||||
|
t_notice.deleted_flag,
|
||||||
|
t_notice.create_user_id,
|
||||||
|
t_notice.update_time,
|
||||||
|
t_notice.create_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
<!-- ================================== 可见范围相关 ================================== -->
|
<!-- ================================== 可见范围相关 ================================== -->
|
||||||
|
|
||||||
<insert id="insertVisibleRange">
|
<insert id="insertVisibleRange">
|
||||||
@@ -35,14 +57,12 @@
|
|||||||
<!-- 后管分页查询资讯 -->
|
<!-- 后管分页查询资讯 -->
|
||||||
<select id="query" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
<select id="query" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
||||||
SELECT
|
SELECT
|
||||||
t_notice.* ,
|
<include refid="base_columns"/>,
|
||||||
t_notice_type.notice_type_name as noticeTypeName,
|
t_notice_type.notice_type_name as noticeTypeName,
|
||||||
t_employee.actual_name as createUserName,
|
t_employee.actual_name as createUserName
|
||||||
t_department.name as departmentName
|
|
||||||
FROM t_notice
|
FROM t_notice
|
||||||
left join t_notice_type on t_notice_type.notice_type_id = t_notice.notice_type_id
|
LEFT JOIN t_notice_type on t_notice.notice_type_id = t_notice_type.notice_type_id
|
||||||
left join t_employee on t_notice.create_user_id = t_employee.employee_id
|
LEFT JOIN t_employee on t_notice.create_user_id = t_employee.employee_id
|
||||||
left join t_department on t_employee.department_id = t_department.department_id
|
|
||||||
<where>
|
<where>
|
||||||
<if test="query.noticeTypeId != null">
|
<if test="query.noticeTypeId != null">
|
||||||
AND t_notice_type.notice_type_id = #{query.noticeTypeId}
|
AND t_notice_type.notice_type_id = #{query.noticeTypeId}
|
||||||
@@ -56,11 +76,11 @@
|
|||||||
<if test="query.documentNumber != null and query.documentNumber != ''">
|
<if test="query.documentNumber != null and query.documentNumber != ''">
|
||||||
AND INSTR(t_notice.document_number, #{query.documentNumber})
|
AND INSTR(t_notice.document_number, #{query.documentNumber})
|
||||||
</if>
|
</if>
|
||||||
<if test="query.createUserId != null">
|
<if test="query.createUserName != null and query.createUserName != ''">
|
||||||
AND t_notice.create_user_id = #{createUserId}
|
AND t_employee.actual_name = #{query.createUserName}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.deletedFlag != null">
|
<if test="query.deletedFlag != null">
|
||||||
and t_notice.deleted_flag = #{query.deletedFlag}
|
AND t_notice.deleted_flag = #{query.deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.createTimeBegin != null">
|
<if test="query.createTimeBegin != null">
|
||||||
AND DATE_FORMAT(t_notice.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{query.createTimeBegin},
|
AND DATE_FORMAT(t_notice.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{query.createTimeBegin},
|
||||||
@@ -84,10 +104,9 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- ================================== 通知公告【员工查看】相关 ================================== -->
|
<!-- ================================== 通知公告【员工查看】相关 ================================== -->
|
||||||
<select id="queryEmployeeNotice"
|
<select id="queryEmployeeNotice" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
|
||||||
select
|
select
|
||||||
t_notice.*,
|
<include refid="base_columns"/>,
|
||||||
t_notice_type.notice_type_name,
|
t_notice_type.notice_type_name,
|
||||||
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
||||||
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
||||||
@@ -142,12 +161,11 @@
|
|||||||
</where>
|
</where>
|
||||||
order by t_notice.publish_time desc
|
order by t_notice.publish_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="queryEmployeeNotViewNotice"
|
<select id="queryEmployeeNotViewNotice" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
|
||||||
select * from
|
select * from
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
t_notice.*,
|
<include refid="base_columns"/>,
|
||||||
t_notice_type.notice_type_name,
|
t_notice_type.notice_type_name,
|
||||||
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
||||||
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
||||||
@@ -198,11 +216,10 @@
|
|||||||
) t where viewFlag = 0
|
) t where viewFlag = 0
|
||||||
order by t.publish_time desc
|
order by t.publish_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="queryNoticeViewRecordList"
|
<select id="queryNoticeViewRecordList" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeViewRecordVO">
|
||||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeViewRecordVO">
|
|
||||||
select t_notice_view_record.*,
|
select t_notice_view_record.*,
|
||||||
t_employee.actual_name as employeeName,
|
t_employee.actual_name as employeeName,
|
||||||
t_department.name as departmentName
|
t_department.department_name
|
||||||
from t_notice_view_record
|
from t_notice_view_record
|
||||||
left join t_employee on t_employee.employee_id = t_notice_view_record.employee_id
|
left join t_employee on t_employee.employee_id = t_notice_view_record.employee_id
|
||||||
left join t_department on t_department.department_id = t_employee.department_id
|
left join t_department on t_department.department_id = t_employee.department_id
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO">
|
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO">
|
||||||
SELECT t_department.*,
|
SELECT t_department.*,
|
||||||
t_employee.actual_name as managerName,
|
t_employee.actual_name as managerName,
|
||||||
parent_department.`name` as parentName
|
parent_department.department_name as parentName
|
||||||
FROM t_department
|
FROM t_department
|
||||||
left join t_employee on t_department.manager_id = t_employee.employee_id
|
left join t_employee on t_department.manager_id = t_employee.employee_id
|
||||||
left join t_department parent_department on t_department.parent_id = parent_department.department_id
|
left join t_department parent_department on t_department.parent_id = parent_department.department_id
|
||||||
@@ -19,5 +19,16 @@
|
|||||||
WHERE parent_id = #{departmentId}
|
WHERE parent_id = #{departmentId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDepartmentVO"
|
||||||
|
resultType="net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO">
|
||||||
|
SELECT t_department.*,
|
||||||
|
t_employee.actual_name as managerName,
|
||||||
|
parent_department.department_name as parentName
|
||||||
|
FROM t_department
|
||||||
|
left join t_employee on t_department.manager_id = t_employee.employee_id
|
||||||
|
left join t_department parent_department on t_department.parent_id = parent_department.department_id
|
||||||
|
where t_department.department_id = #{departmentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<select id="queryEmployee" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
<select id="queryEmployee" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||||
SELECT
|
SELECT
|
||||||
t_employee.*,
|
t_employee.*,
|
||||||
t_department.name AS departmentName
|
t_department.department_name
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
||||||
<where>
|
<where>
|
||||||
@@ -33,21 +33,19 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateDisableFlag">
|
<update id="updateDisableFlag">
|
||||||
UPDATE t_employee
|
UPDATE t_employee
|
||||||
SET disabled_flag = #{disabledFlag}
|
SET disabled_flag = #{disabledFlag}
|
||||||
WHERE employee_id = #{employeeId}
|
WHERE employee_id = #{employeeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="getByLoginName" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
<select id="getByLoginName" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
login_name = #{loginName}
|
login_name = #{loginName}
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@@ -57,24 +55,33 @@
|
|||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
actual_name = #{actualName}
|
actual_name = #{actualName}
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getByPhone" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
<select id="getByPhone" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
phone = #{phone}
|
phone = #{phone}
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getByEmail" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||||
|
SELECT *
|
||||||
|
FROM t_employee
|
||||||
|
<where>
|
||||||
|
email = #{email}
|
||||||
|
<if test="deletedFlag != null">
|
||||||
|
AND deleted_flag = #{deletedFlag}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||||
SELECT *
|
SELECT *
|
||||||
@@ -88,22 +95,19 @@
|
|||||||
department_id = #{departmentId} AND deleted_flag = #{deletedFlag}
|
department_id = #{departmentId} AND deleted_flag = #{deletedFlag}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByDepartmentId" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||||
<select id="selectByDepartmentId"
|
|
||||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
department_id = #{departmentId}
|
department_id = #{departmentId}
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByActualName"
|
<select id="selectByActualName" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
|
||||||
SELECT * FROM t_employee
|
SELECT * FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
actual_name = #{actualName}
|
actual_name = #{actualName}
|
||||||
@@ -111,8 +115,8 @@
|
|||||||
<foreach collection="departmentIdList" item="item" open="(" close=")" separator=",">
|
<foreach collection="departmentIdList" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@@ -125,20 +129,19 @@
|
|||||||
<foreach collection="departmentIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="departmentIds" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getEmployeeId" resultType="java.lang.Long">
|
<select id="getEmployeeId" resultType="java.lang.Long">
|
||||||
SELECT employee_id
|
SELECT employee_id
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@@ -148,8 +151,8 @@
|
|||||||
FROM t_employee
|
FROM t_employee
|
||||||
<where>
|
<where>
|
||||||
department_id = #{departmentId}
|
department_id = #{departmentId}
|
||||||
<if test="disabledFlag != null">
|
<if test="deletedFlag != null">
|
||||||
AND disabled_flag = #{disabledFlag}
|
AND deleted_flag = #{deletedFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
@@ -164,20 +167,18 @@
|
|||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getEmployeeById" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
<select id="getEmployeeById" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||||
SELECT t_employee.*,
|
SELECT t_employee.*,
|
||||||
t_department.name AS departmentName
|
t_department.department_name
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
||||||
where t_employee.employee_id = #{employeeId}
|
where t_employee.employee_id = #{employeeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEmployeeByDisabledAndDeleted"
|
<select id="selectEmployeeByDisabledAndDeleted" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
|
||||||
SELECT
|
SELECT
|
||||||
t_employee.*,
|
t_employee.*,
|
||||||
t_department.name AS departmentName
|
t_department.department_name
|
||||||
FROM t_employee
|
FROM t_employee
|
||||||
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
|
||||||
<where>
|
<where>
|
||||||
@@ -196,5 +197,4 @@
|
|||||||
WHERE employee_id = #{employeeId}
|
WHERE employee_id = #{employeeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -19,9 +19,8 @@
|
|||||||
|
|
||||||
<select id="selectMenuListByRoleIdList"
|
<select id="selectMenuListByRoleIdList"
|
||||||
resultType="net.lab1024.sa.admin.module.system.menu.domain.entity.MenuEntity">
|
resultType="net.lab1024.sa.admin.module.system.menu.domain.entity.MenuEntity">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
t_menu.*
|
distinct t_menu.*
|
||||||
from t_menu
|
from t_menu
|
||||||
left join t_role_menu on t_role_menu.menu_id = t_menu.menu_id
|
left join t_role_menu on t_role_menu.menu_id = t_menu.menu_id
|
||||||
<where>
|
<where>
|
||||||
@@ -35,8 +34,6 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
group by t_menu.menu_id
|
|
||||||
ORDER BY t_menu.sort ASC
|
ORDER BY t_menu.sort ASC
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -5,12 +5,12 @@
|
|||||||
-->
|
-->
|
||||||
<Configuration status="INFO" monitorInterval="30">
|
<Configuration status="INFO" monitorInterval="30">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-directory" value="${sys:project.log-directory}"/>
|
<Property name="log-directory" value="${spring:project.log-directory}"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<Console name="Console" target="SYSTEM_OUT">
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
</Console>
|
</Console>
|
||||||
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
||||||
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</RollingFile>
|
</RollingFile>
|
||||||
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
||||||
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
-->
|
-->
|
||||||
<Configuration status="INFO" monitorInterval="30">
|
<Configuration status="INFO" monitorInterval="30">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-directory" value="${sys:project.log-directory}"/>
|
<Property name="log-directory" value="${spring:project.log-directory}"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<Console name="Console" target="SYSTEM_OUT">
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
</Console>
|
</Console>
|
||||||
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
||||||
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</RollingFile>
|
</RollingFile>
|
||||||
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
||||||
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
-->
|
-->
|
||||||
<Configuration status="INFO" monitorInterval="30">
|
<Configuration status="INFO" monitorInterval="30">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-directory" value="${sys:project.log-directory}"/>
|
<Property name="log-directory" value="${spring:project.log-directory}"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<Console name="Console" target="SYSTEM_OUT">
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
</Console>
|
</Console>
|
||||||
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
|
||||||
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
</Filters>
|
</Filters>
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</RollingFile>
|
</RollingFile>
|
||||||
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
|
||||||
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
|
||||||
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
|
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
|
||||||
<Policies>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||||
<SizeBasedTriggeringPolicy size="50 MB"/>
|
<SizeBasedTriggeringPolicy size="50 MB"/>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.1024lab</groupId>
|
<groupId>net.lab1024</groupId>
|
||||||
<artifactId>sa-parent</artifactId>
|
<artifactId>sa-parent</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
@@ -49,6 +49,11 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-crypto</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- sa-token start -->
|
<!-- sa-token start -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
@@ -59,7 +64,6 @@
|
|||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-redis-jackson</artifactId>
|
<artifactId>sa-token-redis-jackson</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- sa-token end -->
|
<!-- sa-token end -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -113,19 +117,25 @@
|
|||||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-jsqlparser</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>p6spy</groupId>
|
<groupId>p6spy</groupId>
|
||||||
<artifactId>p6spy</artifactId>
|
<artifactId>p6spy</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- knife4j & SpringDoc -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xingfudeshi</groupId>
|
||||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -143,11 +153,6 @@
|
|||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.penggle</groupId>
|
|
||||||
<artifactId>kaptcha</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
||||||
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
||||||
@@ -159,10 +164,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.amazonaws</groupId>
|
<groupId>software.amazon.awssdk</groupId>
|
||||||
<artifactId>aws-java-sdk-s3</artifactId>
|
<artifactId>s3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
@@ -177,21 +183,16 @@
|
|||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.auth0</groupId>
|
|
||||||
<artifactId>jwks-rsa</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity-engine-core</artifactId>
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
@@ -209,12 +210,12 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk18on</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>cn.idev.excel</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>fastexcel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -222,11 +223,6 @@
|
|||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
@@ -234,12 +230,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>ooxml-schemas</artifactId>
|
<artifactId>poi-ooxml-full</artifactId>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -273,6 +264,11 @@
|
|||||||
<artifactId>freemarker</artifactId>
|
<artifactId>freemarker</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tika</groupId>
|
||||||
|
<artifactId>tika-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package net.lab1024.sa.base.common.constant;
|
|||||||
*/
|
*/
|
||||||
public class RequestHeaderConst {
|
public class RequestHeaderConst {
|
||||||
|
|
||||||
public static final String TOKEN = "x-access-token";
|
public static final String TOKEN = "Authorization";
|
||||||
|
|
||||||
public static final String USER_AGENT = "user-agent";
|
public static final String USER_AGENT = "user-agent";
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.lab1024.sa.base.common.controller;
|
|||||||
import net.lab1024.sa.base.constant.SwaggerTagConst;
|
import net.lab1024.sa.base.constant.SwaggerTagConst;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支撑类业务路由基类
|
* 支撑类业务路由基类
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.common.domain;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +16,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserPermission {
|
public class UserPermission implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限列表
|
* 权限列表
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
package net.lab1024.sa.base.common.json.deserializer;
|
package net.lab1024.sa.base.common.json.deserializer;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.core.ObjectCodec;
|
import com.fasterxml.jackson.core.ObjectCodec;
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典反序列化
|
* 字典反序列化
|
||||||
@@ -24,10 +21,10 @@ import java.util.stream.Collectors;
|
|||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DictValueVoDeserializer extends JsonDeserializer<String> {
|
public class DictDataDeserializer extends JsonDeserializer<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
ObjectCodec objectCodec = jsonParser.getCodec();
|
ObjectCodec objectCodec = jsonParser.getCodec();
|
||||||
JsonNode listOrObjectNode = objectCodec.readTree(jsonParser);
|
JsonNode listOrObjectNode = objectCodec.readTree(jsonParser);
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package net.lab1024.sa.base.common.json.serializer;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
|
|
||||||
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典序列化
|
|
||||||
*
|
|
||||||
* @Author 1024创新实验室: 罗伊
|
|
||||||
* @Date 2022-08-12 22:17:53
|
|
||||||
* @Wechat zhuoda1024
|
|
||||||
* @Email lab1024@163.com
|
|
||||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
|
||||||
*/
|
|
||||||
public class DictValueVoSerializer extends JsonSerializer<String> {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DictCacheService dictCacheService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
|
||||||
if (StringUtils.isEmpty(value)) {
|
|
||||||
jsonGenerator.writeObject(Lists.newArrayList());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] valueCodeArray = value.split(",");
|
|
||||||
List<String> valueCodeList = Arrays.asList(valueCodeArray);
|
|
||||||
List<DictValueVO> dictValueVOList = Lists.newArrayList();
|
|
||||||
valueCodeList.forEach(e->{
|
|
||||||
if(StringUtils.isNotBlank(e)){
|
|
||||||
DictValueVO dictValueVO = dictCacheService.selectValueByValueCode(e);
|
|
||||||
if(dictValueVO != null){
|
|
||||||
dictValueVOList.add(dictValueVO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jsonGenerator.writeObject(dictValueVOList);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,17 +20,25 @@ public class LongJsonSerializer extends JsonSerializer<Long> {
|
|||||||
|
|
||||||
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS 安全整数范围
|
||||||
|
* 根据 JS Number.MIN_SAFE_INTEGER 与 Number.MAX_SAFE_INTEGER 得来
|
||||||
|
*/
|
||||||
|
private static final long JS_MIN_SAFE_INTEGER = -9007199254740991L;
|
||||||
|
private static final long JS_MAX_SAFE_INTEGER = 9007199254740991L;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||||
if (null == value) {
|
if (null == value) {
|
||||||
gen.writeNull();
|
gen.writeNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// js中最大安全整数16位 Number.MAX_SAFE_INTEGER
|
// 如果超出了 JavaScript 安全整数范围,则序列化为字符串
|
||||||
String longStr = String.valueOf(value);
|
if (value < JS_MIN_SAFE_INTEGER || value > JS_MAX_SAFE_INTEGER) {
|
||||||
if (longStr.length() > 16) {
|
gen.writeString(Long.toString(value));
|
||||||
gen.writeString(longStr);
|
|
||||||
} else {
|
} else {
|
||||||
|
// 否则,序列化为数字
|
||||||
gen.writeNumber(value);
|
gen.writeNumber(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package net.lab1024.sa.base.common.util;
|
package net.lab1024.sa.base.common.util;
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import cn.idev.excel.FastExcel;
|
||||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
import cn.idev.excel.write.handler.SheetWriteHandler;
|
||||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
||||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
import cn.idev.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -43,7 +43,7 @@ public final class SmartExcelUtil {
|
|||||||
// 设置下载消息头
|
// 设置下载消息头
|
||||||
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
|
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
|
||||||
// 下载
|
// 下载
|
||||||
EasyExcel.write(response.getOutputStream(), head)
|
FastExcel.write(response.getOutputStream(), head)
|
||||||
.autoCloseStream(Boolean.FALSE)
|
.autoCloseStream(Boolean.FALSE)
|
||||||
.sheet(sheetName)
|
.sheet(sheetName)
|
||||||
.doWrite(data);
|
.doWrite(data);
|
||||||
@@ -58,7 +58,7 @@ public final class SmartExcelUtil {
|
|||||||
// 水印
|
// 水印
|
||||||
Watermark watermark = new Watermark(watermarkString);
|
Watermark watermark = new Watermark(watermarkString);
|
||||||
// 一定要inMemory
|
// 一定要inMemory
|
||||||
EasyExcel.write(response.getOutputStream(), head)
|
FastExcel.write(response.getOutputStream(), head)
|
||||||
.inMemory(true)
|
.inMemory(true)
|
||||||
.sheet(sheetName)
|
.sheet(sheetName)
|
||||||
.registerWriteHandler(new CustomWaterMarkHandler(watermark))
|
.registerWriteHandler(new CustomWaterMarkHandler(watermark))
|
||||||
|
|||||||
@@ -52,11 +52,7 @@ public class SmartPageUtil {
|
|||||||
log.error("《存在SQL注入:》 : {}", sortItem.getColumn());
|
log.error("《存在SQL注入:》 : {}", sortItem.getColumn());
|
||||||
throw new BusinessException("存在SQL注入风险,请联系技术工作人员!");
|
throw new BusinessException("存在SQL注入风险,请联系技术工作人员!");
|
||||||
}
|
}
|
||||||
|
orderItemList.add(sortItem.getIsAsc() ? OrderItem.asc(sortItem.getColumn()) : OrderItem.desc(sortItem.getColumn()));
|
||||||
OrderItem orderItem = new OrderItem();
|
|
||||||
orderItem.setColumn(sortItem.getColumn());
|
|
||||||
orderItem.setAsc(sortItem.getIsAsc());
|
|
||||||
orderItemList.add(orderItem);
|
|
||||||
}
|
}
|
||||||
page.setOrders(orderItemList);
|
page.setOrders(orderItemList);
|
||||||
return page;
|
return page;
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class SmartRequestUtil {
|
|||||||
private static final ThreadLocal<RequestUser> REQUEST_THREAD_LOCAL = new ThreadLocal<>();
|
private static final ThreadLocal<RequestUser> REQUEST_THREAD_LOCAL = new ThreadLocal<>();
|
||||||
|
|
||||||
public static void setRequestUser(RequestUser requestUser) {
|
public static void setRequestUser(RequestUser requestUser) {
|
||||||
|
if(requestUser == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
REQUEST_THREAD_LOCAL.set(requestUser);
|
REQUEST_THREAD_LOCAL.set(requestUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.MediaTypeFactory;
|
import org.springframework.http.MediaTypeFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.CharsetUtil.UTF_8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回工具栏
|
* 返回工具栏
|
||||||
@@ -27,8 +29,8 @@ public class SmartResponseUtil {
|
|||||||
|
|
||||||
public static void write(HttpServletResponse response, ResponseDTO<?> responseDTO) {
|
public static void write(HttpServletResponse response, ResponseDTO<?> responseDTO) {
|
||||||
// 重置response
|
// 重置response
|
||||||
response.setContentType("application/json");
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding(UTF_8);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
response.getWriter().write(JSON.toJSONString(responseDTO));
|
response.getWriter().write(JSON.toJSONString(responseDTO));
|
||||||
@@ -44,21 +46,16 @@ public class SmartResponseUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setDownloadFileHeader(HttpServletResponse response, String fileName, Long fileSize) {
|
public static void setDownloadFileHeader(HttpServletResponse response, String fileName, Long fileSize) {
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding(UTF_8);
|
||||||
try {
|
|
||||||
if (fileSize != null) {
|
if (fileSize != null) {
|
||||||
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize));
|
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SmartStringUtil.isNotEmpty(fileName)) {
|
if (SmartStringUtil.isNotEmpty(fileName)) {
|
||||||
response.setHeader(HttpHeaders.CONTENT_TYPE, MediaTypeFactory.getMediaType(fileName).orElse(MediaType.APPLICATION_OCTET_STREAM) + ";charset=utf-8");
|
response.setHeader(HttpHeaders.CONTENT_TYPE, MediaTypeFactory.getMediaType(fileName).orElse(MediaType.APPLICATION_OCTET_STREAM) + ";charset=utf-8");
|
||||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"));
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"));
|
||||||
response.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION);
|
response.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION);
|
||||||
}
|
}
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package net.lab1024.sa.base.config;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import net.lab1024.sa.base.module.support.cache.CacheService;
|
||||||
|
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
||||||
|
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
||||||
|
import net.lab1024.sa.base.module.support.redis.CustomRedisCacheManager;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存配置
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class CacheConfig {
|
||||||
|
|
||||||
|
private static final String REDIS_CACHE = "redis";
|
||||||
|
private static final String CAFFEINE_CACHE = "caffeine";
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisConnectionFactory redisConnectionFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建自定义Redis缓存管理器Bean 整合spring-cache
|
||||||
|
* Redis连接工厂,用于建立与Redis服务器的连接
|
||||||
|
*
|
||||||
|
* @return CacheManager Redis缓存管理器实例
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
|
public CacheManager cacheManager() {
|
||||||
|
// 使用非阻塞模式的缓存写入器,适用于大多数高并发场景
|
||||||
|
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory);
|
||||||
|
|
||||||
|
// 构建默认缓存配置
|
||||||
|
RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
|
// 禁止缓存 null 值,避免缓存穿透
|
||||||
|
.disableCachingNullValues()
|
||||||
|
.computePrefixWith(name -> "cache:" + name + ":")
|
||||||
|
// 使用 FastJSON 序列化缓存值,支持复杂对象
|
||||||
|
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||||
|
.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||||
|
|
||||||
|
// 返回自定义缓存管理器,支持 cacheName#ttl 格式与永久缓存(#-1)
|
||||||
|
return new CustomRedisCacheManager(redisCacheWriter, defaultCacheConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
|
public CacheService redisCacheService() {
|
||||||
|
return new RedisCacheServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = CAFFEINE_CACHE)
|
||||||
|
public CacheService caffeineCacheService() {
|
||||||
|
return new CaffeineCacheServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.annotation.DbType;
|
|||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.lab1024.sa.base.common.domain.DataScopePlugin;
|
import net.lab1024.sa.base.common.domain.DataScopePlugin;
|
||||||
import net.lab1024.sa.base.handler.MybatisPlusFillHandler;
|
import net.lab1024.sa.base.handler.MybatisPlusFillHandler;
|
||||||
@@ -25,6 +24,7 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
@@ -92,10 +92,10 @@ public class DataSourceConfig {
|
|||||||
@Value("${spring.datasource.druid.method.pointcut}")
|
@Value("${spring.datasource.druid.method.pointcut}")
|
||||||
String methodPointcut;
|
String methodPointcut;
|
||||||
|
|
||||||
@Resource
|
@jakarta.annotation.Resource
|
||||||
private MybatisPlusInterceptor paginationInterceptor;
|
private MybatisPlusInterceptor paginationInterceptor;
|
||||||
|
|
||||||
@Resource
|
@jakarta.annotation.Resource
|
||||||
private DataScopePlugin dataScopePlugin;
|
private DataScopePlugin dataScopePlugin;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -136,7 +136,7 @@ public class DataSourceConfig {
|
|||||||
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
|
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
|
||||||
factoryBean.setDataSource(druidDataSource());
|
factoryBean.setDataSource(druidDataSource());
|
||||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||||
org.springframework.core.io.Resource[] resources = resolver.getResources("classpath*:/mapper/**/*.xml");
|
Resource[] resources = resolver.getResources("classpath*:/mapper/**/*.xml");
|
||||||
factoryBean.setMapperLocations(resources);
|
factoryBean.setMapperLocations(resources);
|
||||||
|
|
||||||
// 设置 MyBatis-Plus 分页插件 注意此处myBatisPlugin一定要放在后面
|
// 设置 MyBatis-Plus 分页插件 注意此处myBatisPlugin一定要放在后面
|
||||||
@@ -145,7 +145,7 @@ public class DataSourceConfig {
|
|||||||
if (dataScopePlugin != null) {
|
if (dataScopePlugin != null) {
|
||||||
pluginsList.add(dataScopePlugin);
|
pluginsList.add(dataScopePlugin);
|
||||||
}
|
}
|
||||||
factoryBean.setPlugins(pluginsList.toArray(new Interceptor[pluginsList.size()]));
|
factoryBean.setPlugins(pluginsList.toArray(new Interceptor[0]));
|
||||||
// 添加字段自动填充处理
|
// 添加字段自动填充处理
|
||||||
factoryBean.setGlobalConfig(new GlobalConfig().setBanner(false).setMetaObjectHandler(new MybatisPlusFillHandler()));
|
factoryBean.setGlobalConfig(new GlobalConfig().setBanner(false).setMetaObjectHandler(new MybatisPlusFillHandler()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
package net.lab1024.sa.base.config;
|
package net.lab1024.sa.base.config;
|
||||||
|
|
||||||
import com.amazonaws.ClientConfiguration;
|
|
||||||
import com.amazonaws.Protocol;
|
|
||||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
|
||||||
import com.amazonaws.auth.BasicAWSCredentials;
|
|
||||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
|
||||||
import com.amazonaws.services.s3.AmazonS3;
|
|
||||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.lab1024.sa.base.module.support.file.service.FileStorageCloudServiceImpl;
|
import net.lab1024.sa.base.module.support.file.service.FileStorageCloudServiceImpl;
|
||||||
import net.lab1024.sa.base.module.support.file.service.FileStorageLocalServiceImpl;
|
import net.lab1024.sa.base.module.support.file.service.FileStorageLocalServiceImpl;
|
||||||
@@ -17,6 +10,13 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||||
|
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||||||
|
import software.amazon.awssdk.regions.Region;
|
||||||
|
import software.amazon.awssdk.services.s3.S3Client;
|
||||||
|
import software.amazon.awssdk.services.s3.S3Configuration;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传 配置
|
* 文件上传 配置
|
||||||
@@ -31,6 +31,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class FileConfig implements WebMvcConfigurer {
|
public class FileConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
private static final String HTTPS = "https://";
|
||||||
|
|
||||||
|
private static final String HTTP = "http://";
|
||||||
|
|
||||||
private static final String MODE_CLOUD = "cloud";
|
private static final String MODE_CLOUD = "cloud";
|
||||||
|
|
||||||
private static final String MODE_LOCAL = "local";
|
private static final String MODE_LOCAL = "local";
|
||||||
@@ -68,16 +72,18 @@ public class FileConfig implements WebMvcConfigurer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "file.storage", name = {"mode"}, havingValue = "cloud")
|
@ConditionalOnProperty(prefix = "file.storage", name = {"mode"}, havingValue = MODE_CLOUD)
|
||||||
public AmazonS3 initAmazonS3() {
|
public S3Client initAmazonS3() {
|
||||||
ClientConfiguration clientConfig = new ClientConfiguration();
|
return S3Client.builder()
|
||||||
clientConfig.setProtocol(Protocol.HTTPS);
|
.region(Region.AWS_GLOBAL)
|
||||||
return AmazonS3ClientBuilder.standard()
|
.endpointOverride(URI.create((urlPrefix.startsWith(HTTPS) ? HTTPS : HTTP) + endpoint))
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
|
.credentialsProvider(
|
||||||
.withClientConfiguration(clientConfig)
|
StaticCredentialsProvider.create(
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region))
|
AwsBasicCredentials.create(accessKey, secretKey)))
|
||||||
.withPathStyleAccessEnabled(false)
|
.serviceConfiguration(S3Configuration.builder()
|
||||||
.withChunkedEncodingDisabled(true)
|
.pathStyleAccessEnabled(true)
|
||||||
|
.chunkedEncodingEnabled(false)
|
||||||
|
.build())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.config;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
@@ -13,12 +14,14 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Json 序列化配置
|
* json 序列化配置
|
||||||
*
|
*
|
||||||
* @Author 1024创新实验室-主任: 卓大
|
* @Author 1024创新实验室-主任: 卓大
|
||||||
* @Date 2017-11-28 15:21:10
|
* @Date 2017-11-28 15:21:10
|
||||||
@@ -37,6 +40,9 @@ public class JsonConfig {
|
|||||||
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(Long.TYPE, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(BigInteger.class, ToStringSerializer.instance);
|
||||||
|
builder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class RedisConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate() {
|
public RedisTemplate<String, Object> redisTemplate() {
|
||||||
|
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||||
ObjectMapper om = new ObjectMapper();
|
ObjectMapper om = new ObjectMapper();
|
||||||
om.registerModule(new JavaTimeModule())
|
om.registerModule(new JavaTimeModule())
|
||||||
.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
|
.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
|
||||||
@@ -41,10 +41,11 @@ public class RedisConfig {
|
|||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
|
.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
|
||||||
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(om, Object.class);
|
|
||||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
// enableDefaultTyping 官方已弃用 所以改为 activateDefaultTyping
|
// enableDefaultTyping 官方已弃用 所以改为 activateDefaultTyping
|
||||||
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
|
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
|
||||||
|
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||||
template.setConnectionFactory(factory);
|
template.setConnectionFactory(factory);
|
||||||
template.setKeySerializer(new StringRedisSerializer());
|
template.setKeySerializer(new StringRedisSerializer());
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user